mIRC Home    About    Download    Register    News    Help

Print Thread
#53308 10/10/03 05:19 PM
Joined: Oct 2003
Posts: 38
T
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Oct 2003
Posts: 38
Hello, I'm working on a DLL for my full script (VC++ 6) and I was wondering if anyone could point me in the right direction for counting the number of icons in a file. Also, just out of curiosity (although i'll probably have tested it before anyone replies) can you use NULL for the hInst parameter of ExtractIcon or should I use GetWindowLong to get mIRCs hInstance.

I would also like to know what API's are used to replace the icon displayed on a hWnd. Many DLLs do it and I'm sure it's not hard, just looking for some clues.

One last question for today; How do you call a menu command from a menu item that already exists? is it just SendMessage(hWnd,WM_COMMAND,menuid,0) or something? anyway, any help would be appreciated. ty


-TheXenocide
ParseMPopup
#53309 10/10/03 08:03 PM
Joined: Jun 2003
Posts: 195
N
Vogon poet
Offline
Vogon poet
N
Joined: Jun 2003
Posts: 195
int total = ExtractIconEx("C:\\mirc\\mirc.exe",-1,NULL,NULL,0);

using ExtractIconEx you dont need an HINSTANCE argument

if you do need the icon (as in your second question) you can use the following

HICON icon;
ExtractIconEx("C:\\mirc\\mirc.exe,5,NULL,icon,1);

then send that to mirc

SendMessage(mWnd,WM_SETICON,ICON_SMALL,(LPARAM)icon);

swap the NULL and icon args in the ExtractIconEx and use ICON_BIG as wparam to set the large icon (alt+tab) for mirc. the 5 is the index (0 based) of the icon to extract.

as for the thrid question yes you can send the WM_COMMAND message directly to simlate menu item clicks. However you msut know the id of the menu item and theres nothing regulating these mirc can change them whimsically on every build if khaled so chose. He has been known to change classnames as well as child id's in the past so be carefull there.


Have Fun smile
#53310 11/10/03 04:00 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Quote:
as for the thrid question yes you can send the WM_COMMAND message directly to simlate menu item clicks. However you msut know the id of the menu item and theres nothing regulating these mirc can change them whimsically on every build if khaled so chose. He has been known to change classnames as well as child id's in the past so be carefull there.


Well you can then get the menu id at runtime rather than hardcoding it. Basically use a loop of GetMenuItemString, check for the string of the command you want, then if it is the one you want, call GetMenuItemID on that menu index to get the ID of the menu.

#53311 12/10/03 12:08 AM
Joined: Jun 2003
Posts: 195
N
Vogon poet
Offline
Vogon poet
N
Joined: Jun 2003
Posts: 195
actually ya i was going to suggest that but ive been away. however it is also possible the strings could be changed as well. You could also go by position but again nothing is concrete. I really doubt khaled will radically alter the menu layout but you just never know.

on a side note i read somewhere that adding more than one custom menu item to the main menu _may_ be implemented. if this does happen it could cause the layout to be altered quite a bit depending on the user and how they set up the menu.


Have Fun smile
#53312 12/10/03 12:15 AM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Quote:
if this does happen it could cause the layout to be altered quite a bit depending on the user and how they set up the menu.


Well the way I handle this personally is, I go through each submenu until I find the submenu I'm looking for. Then, once I've found that I search that submenu for the string I want, then I get the ID. It's still not 100%, but it's probably pretty close.

#53313 12/10/03 06:48 PM
Joined: Oct 2003
Posts: 38
T
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Oct 2003
Posts: 38
Well thanks guys, I am willing to update my DLLs upon new builds of mIRC, but one of the main reasons is just creating a function that allows the user to specify which mIRC Menu Item to call.

In response to mIRC adding a new commands menu, those ID's are generated dynamically (right now, I believe they start at 7000) so they won't much interfere with the Resource defined ID's because those are mostly in the hundreds.

I have a new question though. This one may involve a signifigant amount of thought, but how do you create an Owner Drawn Menu Bar? I know how to create ownder drawn popup menu's (kinda) but I would like to make an owner drawn bar that encapsulates them.

One last question. I have used a dll call menuedit. the menuedit DLL allowed you to edit/replace mIRCs menubar. It said something along the lines that it "fixed mIRC trying to redraw the commads menu" when it replaced the menubar. I would like to know a couple things.
1) mIRC closes if I try to use the SetMenu API on it. I can't replace the menu with a different one. Is this because mIRC is trying to redraw the commands menu?
2)If so, do you have any ideas how I could fix this? I'm playing around with it as we speak, but mIRC closes to quickly for me to find out any information on it.

Thank you everyone very much for the help.


-TheXenocide
ParseMPopup

Link Copied to Clipboard