mIRC Homepage

[HELP] Adding icons through TB_ADDBITMAP

Posted By: Squal

[HELP] Adding icons through TB_ADDBITMAP - 15/09/04 11:10 PM


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
Posted By: Squal

Re: [HELP] Adding icons through TB_ADDBITMAP - 16/09/04 08:03 PM

Perhaps a hint? wink
Posted By: ClickHeRe

Re: [HELP] Adding icons through TB_ADDBITMAP - 17/09/04 11:57 AM

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);
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
Posted By: Squal

Re: [HELP] Adding icons through TB_ADDBITMAP - 17/09/04 03:16 PM

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.
Posted By: ClickHeRe

Re: [HELP] Adding icons through TB_ADDBITMAP - 17/09/04 05:30 PM

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)
Posted By: qwerty

Re: [HELP] Adding icons through TB_ADDBITMAP - 17/09/04 06:37 PM

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).
Posted By: ClickHeRe

Re: [HELP] Adding icons through TB_ADDBITMAP - 17/09/04 06:52 PM

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)
Posted By: Squal

Re: [HELP] Adding icons through TB_ADDBITMAP - 18/09/04 09:12 AM

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!

Posted By: ClickHeRe

Re: [HELP] Adding icons through TB_ADDBITMAP - 18/09/04 05:35 PM

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.
Posted By: Squal

Re: [HELP] Adding icons through TB_ADDBITMAP - 24/09/04 02:39 PM


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.

© 2022 mIRC Discussion Forums