Hi to all, :eek
I recently notice something bizzard. I made a simple message box following "Iczelion" no.2 tutorial. I added a Loadicon to see if it would work, and it did. After a few days, I decided to change icon to a different one. It changed the one we see in our folders, however it didn't change the one we see when the message box is opened. Not to overwrite the second one I made, I renamed that message box. When I tried the renamed message box, It was now showing the new icon that I had changed. Under the first name it was assemble, (Just again renaming it to the first name), It would again show the first icon (without ever reassembling it,
just renaming it). I'm not sure if I'm making myself clear. But if so, can someone help me understand why this is happening ? I added what I made if this can help. Thank you in advance,
LL
;Cet example est retiré du tutorial no.2 d'Iczelion et fut modifié pour
;etre assemblé par (Goasm et Golink)...
Data section
MsgCaption db "L'example no. 02 d'Iczelion",0
MsgBoxText db '"Win32 Assembly" est intéressant !', 0
Constant section
IDI_ICON1 equ 5
Code section
start:
PUSH IDI_ICON1 ;5 = "MAINICON.ico"
PUSH 0
CALL LoadIconA
PUSH 1000F0h ;0F0h = MB_ICONMASK, no icon & no sound
PUSH ADDR MsgCaption ;addr MsgCaption
PUSH ADDR MsgBoxText ;addr MsgBoxTex
PUSH 0 ;NULL
CALL MessageBoxA ;invoke MessageBox
PUSH 0 ;NULL
CALL ExitProcess ;invoke ExitProcess
After the call to LoadIconA, the icon handle is in the EAX register. Then you should store the handle in a variable before calling any other function (so you don't lose the value of EAX). Also don't call MessageBoxA, use MessageBoxIndirectA instead to specify a custom icon.
http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxfunctions/messageboxindirect.asp?frame=true
Hope that helps! :U
Hi QvasiModo,
I still don't know how to use the "MSGBOXPARAMS" structure within a program. This is one of the reason I haven't yet used MessageBoxIndirect. I will try to find some examples on how to use the "MSGBOXPARAMS" structure.
But I'm still not sure that I've explained myself properly. Let me try again ! I assembled the above messagebox with, for example "icon A" named MAINICON. The messagebox has the proper "icon A" being displayed on the desktop, and when running, on the taskbar. If a try "icon B", also named MAINICON, the new "icon B" will be properly displayed on the desktop. However, when running the newly assembled messagebox, the "icon A" will still be displayed on the taskbar. Icon A and icon B are both being used, even if only the second MAINICON still exist in the folder. If I simply rename the second ".exe", or the newly assembled messagebox, things get back to normal. The renamed messagebox has the proper "icon B" being displayed on the desktop, and when running, on the taskbar. Is this what you had understood ?
LL
Oh, sorry, I hadn't understood correctly. :red
Could you post the resource file? The explanation is probably there...
Otherwise it could be Window's icon cache that's playing tricks on you. Try using Tweak-UI or a similar program to clear the icon cache, and see if it changes anything.
Hi again,
I tried Tweak-UI, but it didn't resolve the problem. Here is the resource file:
#define IDI_ICON1 5
IDI_ICON1 ICON DISCARDABLE MOVEABLE LOADONCALL "MAINICON.ico"
Just those two lines. It's bizzard, but I'm not going to lose sleep over it yet ! :bg
LL
bizarre :U
Hi to all,
I finally tried to understand how to use: MessageBoxIndirect (and MSGBOXPARAMS), and this is what I wrote:
*******************************
DATA SECTION
hicon DD 0
mbp MSGBOXPARAMS ?
mbp.cbsize DD 0
mbp.hwndOwner DD 0
mbp.hinstance DD 0
mbp.lpszText DD 0
mbp.lpszCaption DD 0
mbp.dwStyle DD 0
mbp.lpszIcon DD 0
Constant section
IDI_ICON1 equ 5
szAppTitle db "MessageBoxIndirect Demo", 0
szMsgAbout db "MessageBoxIndirect Demo", 13, 10
db " Version 1.0", 13, 13, 10
db " Created by Léonard!", 13, 10
db " © November 26, 2005", 0
CODE SECTION
Start:
PUSH 0
CALL GetModuleHandleA
MOV D[mbp.hinstance],EAX
PUSH IDI_ICON1 ;5 = "Dude.ico"
PUSH 0
CALL LoadIconA
MOV D[hicon],eax
MOV D[mbp.cbsize], 28D ;7 "mbp." * 4 bytes each = 28D
MOV D[mbp.lpszText], OFFSET szMsgAbout
MOV D[mbp.lpszCaption], OFFSET szAppTitle
MOV D[mbp.dwStyle],080h ;80h = MB_USERICON, with no sound
MOV D[mbp.lpszIcon], 5
PUSH ADDR mbp
CALL MessageBoxIndirectA
PUSH EAX
CALL ExitProcess*******************************************
I still don't know what these features are: "dwContextHelpId", "lpfnMsgBoxCallback" and "dwLanguageId". Give me time, and soner or later I'll stumble over something. Ha! Ha! :lol
LL