flat assembler
Message board for the users of flat assembler.

Index > Windows > Need some help with uType in a Messagebox with fasm

Author
Thread Post new topic Reply to topic
erg322(NOOB)



Joined: 28 Dec 2012
Posts: 3
erg322(NOOB) 28 Dec 2012, 02:52
I'm working at assembling Messagebox but I'm having trouble with uType.Even in the Hello example provided with FASM.

I can make uType = 0 or NULL or MB_OK and it compiles and runs perfectly but I want to use all the other buttons and Icons that Microsoft show in their Messagebox exemplar.

If I make uType MB_OKCANCEL it will compile but I end up with a program that never opens.

Any help would be appreciated....I've googled this problem and I can't find an equivalent fragment of code to give me a clue to what to do.
Post 28 Dec 2012, 02:52
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20413
Location: In your JS exploiting you and your system
revolution 28 Dec 2012, 03:05
Works for me:
Code:
; example of simplified Windows programming using complex macro features

include 'win32ax.inc' ; you can simply switch between win32ax, win32wx, win64ax and win64wx here

.code

  start:
 invoke  MessageBox,HWND_DESKTOP,"Hi! I'm the example program!",invoke GetCommandLine,MB_OKCANCEL
 invoke  ExitProcess,0

.end start    
Post 28 Dec 2012, 03:05
View user's profile Send private message Visit poster's website Reply with quote
erg322(NOOB)



Joined: 28 Dec 2012
Posts: 3
erg322(NOOB) 28 Dec 2012, 04:02
Many Thanks for the code fragment.

I just get the different styles and add them together and it works a treat.

Before I was pushing values onto the stack and calling MessageBox, obviously it's not the best way to do it.
Post 28 Dec 2012, 04:02
View user's profile Send private message Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel 28 Dec 2012, 07:24
How do you think the "invoke" macro does it? Precisely by "pushing values onto the stack and calling MessageBox": http://flatassembler.net/docs.php?article=win32#1.3

So you must have done something wrong in your code.
Post 28 Dec 2012, 07:24
View user's profile Send private message Reply with quote
erg322(NOOB)



Joined: 28 Dec 2012
Posts: 3
erg322(NOOB) 28 Dec 2012, 08:59
Many thanks Man of Steel.

It was how I was declaring uType with an equ instead of using a db so it could take on a value or add multiple types together.

I can now do both ways, should have RTFM instead of running around for a code fragment to work it out.

I'l fiddle with this for a while and then try and figure out a dialog box.
Post 28 Dec 2012, 08:59
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.