mIRC Home    About    Download    Register    News    Help

Print Thread
[HELP] Adding icons through TB_ADDBITMAP #97722 15/09/04 11:10 PM
Joined: Sep 2004
Posts: 11
S
Squal Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Sep 2004
Posts: 11
Hi!

I need help with adding new bitmaps to the toolbar's image list. I'm trying to use SendMessage(hToolbar, TB_ADDBITMAP, nBitmaps, myAddBitmap), but this doesn't work (or I'm just not utilizing it correctly). Does anyone know how to add new icons to the image list of the toolbar through SendMessage?

Here is what I have managed to do by now:
I am trying to extend the functionality of mIRC with my DLL. I am adding new buttons to mIRC's toolbar to create new shortcuts. Until now, I have managed to add new buttons to the toolbar and have successfully processed their commands, but I have problems with adding new bitmaps to the image list of the toolbar. So, now I may add new buttons, but I may not use any other images exept for the ones that are already built into mIRC.

Thank you in advance

Re: [HELP] Adding icons through TB_ADDBITMAP #97723 16/09/04 08:03 PM
Joined: Sep 2004
Posts: 11
S
Squal Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Sep 2004
Posts: 11
Perhaps a hint? wink

Re: [HELP] Adding icons through TB_ADDBITMAP #97724 17/09/04 11:57 AM
Joined: Jan 2003
Posts: 249
C
ClickHeRe Offline
Fjord artisan
Offline
Fjord artisan
C
Joined: Jan 2003
Posts: 249
The way it works is you need to know the number of bitmaps on your bmp image (it's the same thing as mIRC's button bmp strip)

You must load your bitmap file into a bitmap handle to pass to the function.

nImg = N; <-- number of icons on the bitmap
HBITMAP hbmp = LoadBitmap(Other parms);
TBADDBITMAP tbadd;
tbadd.hInst = NULL;
tbadd.nID = hbmp;

SendMessage(hwnd, TB_ADDBITMAP, (WPARAM) nImg, (LPARAM) &tbadd);

Hope you get it working =], it's a nice feature to add to mIRC's toolbar already, but most people tend to replace mIRC's toolbar for more functionnality eheh.

Good Luck

Re: [HELP] Adding icons through TB_ADDBITMAP #97725 17/09/04 03:16 PM
Joined: Sep 2004
Posts: 11
S
Squal Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Sep 2004
Posts: 11
ClickHeRe, yes, this is the way I have tried before - and am still trying to bring it to work. The SendMessage(hWnd_toolbar, TB_ADDIMAGE, ...) call returns a SUCCESS code (the index of the first newly added image), but when I assign this image to my button, the button remains blank.

You say people have done this before me? Can you give me an example (because the above thing doesn't really work)? (I know that MDX is not doing exactly what I want...)

I still need your help.

Thank you.

Re: [HELP] Adding icons through TB_ADDBITMAP #97726 17/09/04 05:30 PM
Joined: Jan 2003
Posts: 249
C
ClickHeRe Offline
Fjord artisan
Offline
Fjord artisan
C
Joined: Jan 2003
Posts: 249
People don't play with mIRC's Toolbar, they simply delete it and make their own toolbar in replacement with a new mIRC Dialog docked up top with a MDX toolbar on it.

Then you get all the functionnality you need without the need to hastle about trying to guess how mIRC handles his toolbar (same applies with the switchbar)

Re: [HELP] Adding icons through TB_ADDBITMAP #97727 17/09/04 06:37 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
That's the thing, you don't really get all the functionality you need: the handy right-click menus of the native toobar buttons cannot be fully replicated easily, if at all (MDX doesn't even offer a rclick event for the toolbar buttons).

The ideal solution for me is to take advantage of the empty space to the right of mirc's tool buttons (there's plenty of space if you run on high resolutions). Unfortunately, I haven't found a combination of dlls that would do that properly; Naru's tool.dll provided all the functionality I needed but was unstable (kept crashing mirc and creating other, less serious, problems).


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: [HELP] Adding icons through TB_ADDBITMAP #97728 17/09/04 06:52 PM
Joined: Jan 2003
Posts: 249
C
ClickHeRe Offline
Fjord artisan
Offline
Fjord artisan
C
Joined: Jan 2003
Posts: 249
My new DLL DCX (which is still in dev) has native rclick support for toolbar buttons and much more possibilities than what MDX has to offer in terms of those kind of things.

http://dcx.scriptsdb.org/dcx.htm <-- you can read the help files on controls already made and functionnal and see how it will work.

And it will also have button text color possibilities like mIRC's switchbar buttons (same thing will apply on treeview items having independant colors and probably listview too)

anyways, the DLL is in dev for the moment, I will probably hand out a beta later this month if you are interested to test ité.

For the moment it only works with XP (there's a bug that makes it crash in 98 and since I don't have any 98 OS here, it's quite hard to tell what happens)

Re: [HELP] Adding icons through TB_ADDBITMAP #97729 18/09/04 09:12 AM
Joined: Sep 2004
Posts: 11
S
Squal Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Sep 2004
Posts: 11
What a misery! That is not what I need. But thank you very much for your answers! ClickHeRe, you seem to know a lot about these things!

However, I will try to bring it to work, even if it takes me an eternity :-)

Thank you again!

Sq

Last edited by Squal; 18/09/04 09:15 AM.
Re: [HELP] Adding icons through TB_ADDBITMAP #97730 18/09/04 05:35 PM
Joined: Jan 2003
Posts: 249
C
ClickHeRe Offline
Fjord artisan
Offline
Fjord artisan
C
Joined: Jan 2003
Posts: 249
Well I made a couple DLLs in the last years and learned all about windows API myself with MSDN help and tries and errors eheh, but last time I played with toolbar I didn't use the bmp icons, I prefer to use image lists and icon files to load button images.

Re: [HELP] Adding icons through TB_ADDBITMAP #97731 24/09/04 02:39 PM
Joined: Sep 2004
Posts: 11
S
Squal Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Sep 2004
Posts: 11
Hi!

I have discovered a temporary solution. I have added a new bitmap background for the buttons through the /background -u command.

Just so you know. It is not the solution I wanted, but I grew tired of searching for other methods.

Bye