softwareguy74
Nov 19th, 2000, 12:05 AM
Hi,
I'm trying to learn the Win API and I came across this article at:
http://vb-world.net/php-bin/printfriendly.php?articlepageid=486
And I implimented the code exactly but it does not seem to work.. The code should put a picture next to a menu item but it keeps returning 0 and not putting in a picture.
Here's the code:
'in form module
Private Sub Command1_Click()
On Error Resume Next
Dim lngMenu As Long
Dim lngSubMenu As Long
Dim lngMenuItemID As Long
Dim lngRet As Long
lngMenu = GetMenu(Form1.hwnd)
lngSubMenu = GetSubMenu(lngMenu, 0)
lngMenuItemID = GetMenuItemID(lngSubMenu, 1)
lngRet = SetMenuItemBitmaps(lngMenu, lngMenuItemID, 0, _
Picture1.Picture, Picture1.Picture)
End Sub
'in module
Public Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
Public Declare Function GetMenuItemID Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
Public Declare Function SetMenuItemBitmaps Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, _
ByVal wFlags As Long, ByVal hBitmapUnchecked As Long, _
ByVal hBitmapChecked As Long) As Long
any ideas why this is not working? I'm really curious to find out what the problem and solution is..
Thanks,
Dan
I'm trying to learn the Win API and I came across this article at:
http://vb-world.net/php-bin/printfriendly.php?articlepageid=486
And I implimented the code exactly but it does not seem to work.. The code should put a picture next to a menu item but it keeps returning 0 and not putting in a picture.
Here's the code:
'in form module
Private Sub Command1_Click()
On Error Resume Next
Dim lngMenu As Long
Dim lngSubMenu As Long
Dim lngMenuItemID As Long
Dim lngRet As Long
lngMenu = GetMenu(Form1.hwnd)
lngSubMenu = GetSubMenu(lngMenu, 0)
lngMenuItemID = GetMenuItemID(lngSubMenu, 1)
lngRet = SetMenuItemBitmaps(lngMenu, lngMenuItemID, 0, _
Picture1.Picture, Picture1.Picture)
End Sub
'in module
Public Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
Public Declare Function GetMenuItemID Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
Public Declare Function SetMenuItemBitmaps Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, _
ByVal wFlags As Long, ByVal hBitmapUnchecked As Long, _
ByVal hBitmapChecked As Long) As Long
any ideas why this is not working? I'm really curious to find out what the problem and solution is..
Thanks,
Dan