M
Michael Keilhack
Hello,
i try to get this working from VB.Net. Because i don't want a macro in
my Startdocument in my Visio-Solution.
I tried this code in a ComAddin, EXE-Addon and in a macro within the
document.
The WindowHandle is the right one (Spy++).
Perhaps anybody knows why this isn't working?
Is there a way to insert VBA at runtime?
Thx Michael Keilhack
Declare Function GetActiveWindow32 Lib "USER32" Alias _
"GetActiveWindow" () As Integer
Declare Function SendMessage32 Lib "USER32" Alias _
"SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function ExtractIcon32 Lib "SHELL32.DLL" Alias _
"ExtractIconA" (ByVal hInst As Long, _
ByVal lpszExeFileName As String, _
ByVal nIconIndex As Long) As Long
Sub SetFormIcon()
Dim h32NewIcon As Long
Dim h32WndVisMAIN As Long
Dim lResult As Long
h32NewIcon = ExtractIcon32(0, "Notepad.exe", 0)
h32WndVisMAIN = Application.WindowHandle32
lResult = SendMessage32(h32WndVisMAIN, &H80, 1, h32NewIcon)
'Iconbig
lResult = SendMessage32(h32WndVisMAIN, &H80, 0, h32NewIcon)
'Icon small
End Sub
i try to get this working from VB.Net. Because i don't want a macro in
my Startdocument in my Visio-Solution.
I tried this code in a ComAddin, EXE-Addon and in a macro within the
document.
The WindowHandle is the right one (Spy++).
Perhaps anybody knows why this isn't working?
Is there a way to insert VBA at runtime?
Thx Michael Keilhack
Declare Function GetActiveWindow32 Lib "USER32" Alias _
"GetActiveWindow" () As Integer
Declare Function SendMessage32 Lib "USER32" Alias _
"SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function ExtractIcon32 Lib "SHELL32.DLL" Alias _
"ExtractIconA" (ByVal hInst As Long, _
ByVal lpszExeFileName As String, _
ByVal nIconIndex As Long) As Long
Sub SetFormIcon()
Dim h32NewIcon As Long
Dim h32WndVisMAIN As Long
Dim lResult As Long
h32NewIcon = ExtractIcon32(0, "Notepad.exe", 0)
h32WndVisMAIN = Application.WindowHandle32
lResult = SendMessage32(h32WndVisMAIN, &H80, 1, h32NewIcon)
'Iconbig
lResult = SendMessage32(h32WndVisMAIN, &H80, 0, h32NewIcon)
'Icon small
End Sub