Página 1 de 1

ICONE NO USERFORM

Enviado: 26 Abr 2018 às 12:43
por pasedo
Bom dia pessoal, gostaria de por um icone no meu userform, como faço isso? Grato.

Re: ICONE NO USERFORM

Enviado: 27 Abr 2018 às 07:38
por pasedo
Pessoal bom dia achei este mas não está funcionando. Podem dar uma olhada.Grato

Re: ICONE NO USERFORM

Enviado: 28 Abr 2018 às 16:20
por babdallas
Explique o que você fazer por favor.

Re: ICONE NO USERFORM

Enviado: 28 Abr 2018 às 18:53
por pasedo
Boa noite babdallas, eu quero que este icone do computador apareça no form na barra de titulo onde esta no caption "TESTE DE CÓDIGO" ao iniciar o formulário como esta na imagem que vai junto no arquivo rar

Re: ICONE NO USERFORM

Enviado: 29 Abr 2018 às 23:25
por babdallas
Meu nível de VBA ainda não resolve problemas com API do WIndows. Até tentei dar uma pesquisada, mas não consegui.
Um opção é você postar sua dúvida no Fórum do Tomas Vasquez, já que imagino que você deve ter pegado este código lá.
Sinto por não poder ajudar mais.

ICONE NO USERFORM

Enviado: 30 Abr 2018 às 09:24
por pasedo
babdallas muito obrigado pela tentativa de ajuda, vou ver la no forum dele. Grato.

ICONE NO USERFORM

Enviado: 03 Mai 2018 às 04:36
por repairkerkereh
Providing electric shutter repair services throughout Tehran, Karaj, and suburban cities is carried out by an experienced and experienced Iranian team at any time of day and at the best price.
Electric shutter repair requires a high level of knowledge and is a highly specialized work. There are, therefore, there are few groups that can perform repairs and because of the complexity of تعمیرات کرکره برقی the structure of the shutters, it is necessary for تعمیرات موتور کرکره برقی
the electric shutter repairer to be well It has a bunch of pieces and recognizes existing bugs and works best to fix problems.

Re: ICONE NO USERFORM

Enviado: 03 Mai 2018 às 06:11
por JCabral
Veja se esse exemplo ajuda.

Nota: Não é da minha autoria

ICONE NO USERFORM

Enviado: 03 Mai 2018 às 09:46
por pasedo
JCabral muito obrigado, vou ver se consigo adapta-lo para iniciar com o icone ja colocado no form...

Re: ICONE NO USERFORM

Enviado: 06 Mai 2018 às 22:25
por babdallas
Este código funciona, já testei. Mas tem um porém, a extensão do arquivo deve ser .ICO. Fonte: https://answers.microsoft.com/en-us/mso ... 6aea36974d

Código: Selecionar todos
Private Declare Function FindWindow _
    Lib "user32" Alias "FindWindowA" _
   (ByVal lpClassName As String, _
    ByVal lpWindowName As String) As Long
 
Private Declare Function ExtractIcon _
    Lib "shell32.dll" Alias "ExtractIconA" _
   (ByVal hInst As Long, _
    ByVal lpszExeFileName As String, _
    ByVal nIconIndex As Long) As Long
 
Private Declare Function SendMessage _
    Lib "user32" Alias "SendMessageA" _
   (ByVal hWnd As Long, _
    ByVal wMsg As Long, _
    ByVal wParam As Integer, _
    ByVal lParam As Long) As Long
 
Private Const WM_SETICON = &H80
 
Private Sub UserForm_Initialize()
    Dim strIconPath As String
    Dim lngIcon As Long
    Dim lnghWnd As Long
    
    With frmTest
        .Caption = "TESTE DE CÓDIGO  - ppasedo@gmail.com"
    End With
    
    ' Change to the path and filename of an icon file
    strIconPath = "C:\Program Files\Microsoft Office\root\Office16\FORMS\1046\ACTIVITL.ICO"
    ' Get the icon from the source
    lngIcon = ExtractIcon(0, strIconPath, 0)
    ' Get the window handle of the userform
    lnghWnd = FindWindow("ThunderDFrame", Me.Caption)
    'Set the big (32x32) and small (16x16) icons
    SendMessage lnghWnd, WM_SETICON, True, lngIcon
    SendMessage lnghWnd, WM_SETICON, False, lngIcon
End Sub

Private Sub btnOK_Click()
    Unload Me
End Sub

Re: ICONE NO USERFORM

Enviado: 07 Mai 2018 às 12:47
por pasedo
babdallas muito obrigado, perfeitooooooooo.