|
-
Nov 28th, 2000, 11:33 AM
#1
Thread Starter
Addicted Member
Alright I can give bitmaps to a menu using the api. But I can only get the first menu on the form using getmenu(me.hwnd). How can I get the other menus and add bitmaps to their submenus?
-
Nov 28th, 2000, 11:35 AM
#2
Fanatic Member
Getmenu returns the handle of the first menu (the menu bar ).
-
Nov 28th, 2000, 11:57 AM
#3
Thread Starter
Addicted Member
So
So how can I get the other menus, as in say the 2nd and 3rd on my form
-
Nov 28th, 2000, 12:08 PM
#4
Fanatic Member
First, get the menu handle of the menu bar. Then you can use the GetSubMenu api function, to get the handles of the menus (like File). Its syntax is simple.
Code:
Declare Function GetSubMenu Lib "user32" Alias "GetSubMenu" (ByVal hMenu As Long, ByVal nPos As Long) As Long
hMenu = The handle of the menu bar
nPos = Which menu, the first = 0, the 2nd = 1 and so on.
-
Nov 28th, 2000, 06:25 PM
#5
Thread Starter
Addicted Member
hmm
Wouldnt that just get file's submenus? I want to get the hwnd of say..edit
-
Nov 29th, 2000, 01:49 PM
#6
Fanatic Member
I assume that Edit is the 2nd menu. To get the handle of the edit menu:
Code:
Dim Handle As Long
Handle = GetSubMenu(GetMenu(Me.hwnd), 1) '1, because counting starts with 0:rolleyes:
To get the first item in the edit menu, use the GetMenuItemID api function. Sorry, I couldn't find info on it on the internet. So, just get the declaration from Win32api.txt. It takes two arguments.
- hMenu As Long, it's the id of the Edit/File/etc. menu that you just got.
- nPos As Long, the position of the item in the menu. Counting also starts here with 0.
Sorry that I didn't include the declarations for the api functions in this post. I don't have vb on this computer.
-
Dec 3rd, 2000, 02:11 PM
#7
Thread Starter
Addicted Member
Thanks, I have the API Toolkit from allapi.net so the declares are all in there. Their example was only for the first menu though. Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|