-> edit: I've added one last Donkey's change to the code.
-> edit: Another change is uploaded
-> edit: Another change (read bottom of the thread, now it's only 4.5k big)

Hello everybody. I guess Donkey will agree that this is the final version of Button Changer Addin.
This is a clean version I developed by stripping down the old, initial version of the DLL and then adding on changes Donkey did to the original.

Donkey, I was changing (A LOT) code of ButtonChanger again. With all additions and reductions it's just 5k :grin:

As of other kinds of changes that I've made:

-GetIniKey PROC added : logical-bug fix
-Parsestring recoded : cut to half; i don't know how to optimize it any more then this
-TB* procedures : cut to half
-CopyString : a bit of optimization
-UpdateIcon : the same but still shorter
-general optimization on rest of the code
- ... no code is left untouched :grin:

As of the bug that is fixed: IniKey1 and IniKey2 were hardcoded so if items "1=" or "2=" were separators or some other weird conditions were met the Addin would not load correct icon. That is why I wrote a GetKeyIni procedure and put it in TBChangeIcon so keys are dynamically reloaded with icons if/when a change to tools menu is made.

Parsestring procedure is a real BEAUTY though I bet some of the guys from the board can write much faster code then I can. :grin:
It is alike old Parsestring PROC that had only one parameter and then I added a second Request parameter to it. Request parameter specifies which column you want Parsestring to extract so if you specify constant value REQUEST_DESCRIPTION equ 4, you will get description string or if you specify REQUEST_PATH equ 1, you will get the file path.




Donkey, I suggest you install Virtual PC (you can get it for free from some internet locations), it's great PC emulator and I use it to test
programs on all platforms. Well since last hard disk format I did't reinstall it but I plan to ;)
Posted on 2003-02-28 16:51:10 by Milos
P.S. Yes, this is for RadASM v20.1.1 only.
On older versions tool tips wont work.
Posted on 2003-02-28 16:52:38 by Milos
I'll see how much Virtual PC costs, but I usually only code for me, it's pretty rare that I post code for anything - I'm just not that skilled yet. Thanks for the work Milos I'll be using your version.

Looked over the code: Now why can't I wrte code like that ! Very nice Milos

Donkey
Posted on 2003-02-28 16:59:53 by donkey
Thanks Donkey, I think this addin idea was really great and you did great work yourself too! If there wasn't you to lead the way I doubt I would cope with RadASM plugin interface just to get tool tips working.
Posted on 2003-02-28 17:07:50 by Milos
Just uploaded these last minute changes.
Posted on 2003-02-28 18:35:45 by Milos
Hey Milos, looks pretty final now :)

I just sent you an email with some changes but you have already incorporated them so just ignore it. It is now a good package, and works perfectly. I see that Hiro deleted the other thread so there won't be any confusion about which version is the right one, makes life less complicated.

Donkey
Posted on 2003-02-28 18:57:40 by donkey
Hi Milos,

One minor bug :

Change
TBLoadIcon	PROC UserBtnID :DWORD, ButtonDef :DWORD, ICOPath

invoke LoadImage, NULL, ICOPath, IMAGE_ICON, 16, 16, LR_LOADFROMFILE
test eax, eax
jz @F
[b]invoke UpdateIcon, eax, UserBtnID1[/b]
ret
@@:
invoke SendMessage, hToolBar, TB_CHANGEBITMAP, UserBtnID, ButtonDef
ret
TBLoadIcon ENDP
to
TBLoadIcon	PROC UserBtnID :DWORD, ButtonDef :DWORD, ICOPath

invoke LoadImage, NULL, ICOPath, IMAGE_ICON, 16, 16, LR_LOADFROMFILE
test eax, eax
jz @F
[b]invoke UpdateIcon, eax, UserBtnID[/b]
ret
@@:
invoke SendMessage, hToolBar, TB_CHANGEBITMAP, UserBtnID, ButtonDef
ret
TBLoadIcon ENDP
Donkey
Posted on 2003-02-28 19:17:27 by donkey
Hi Milos,

Also add the following to the end of the UpdateIcon procedure, the previous Icon is not being erased and appears behind the new one until a repaint occurs, redrawing the toolbar when the icons are changed solves this problem

invoke InvalidateRect,hToolBar,NULL,TRUE
invoke UpdateWindow,hToolBar

Donkey
Posted on 2003-03-01 02:19:46 by donkey
OK, The first issue is fixed.
I will add the Update toolbar thingy as well and upload then.
BTW code is now 4.5k :)
Posted on 2003-03-01 14:02:33 by Milos
As usual... I didn't post code with the latest change so here it is now.
Posted on 2003-03-02 15:43:05 by Milos