flat assembler
Message board for the users of flat assembler.

Index > Windows > Why this program crashes?

Author
Thread Post new topic Reply to topic
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY 11 Aug 2007, 21:27
Code:
format PE GUI 4.0
include '%fasminc%\win32ax.inc'
include '%fasminc%\macro\if.inc'

BTNGO = 1003
BTNCLEAR = 1004
EDITMSG = 1002

main:
    invoke DialogBoxParam,0,1000,0,dlgproc,0
    invoke ExitProcess,0




proc dlgproc, hwnd, msg, wp, lp
     .if [msg] = WM_CLOSE
                invoke EndDialog,[hwnd],1
   .elseif [msg] = WM_COMMAND
          .if [wp] = BTNGO
                    ; code to crypt
             .elseif [wp] = BTNCLEAR
                     invoke SetDlgItemText,[hwnd],EDITMSG,''
           .endif
      .endif
      XOR EAX,EAX
 RET
endp

data resource from 'rsrc.res'
end data
.end main    

What's the correct way of putting resource data inside the flat section?
Post 11 Aug 2007, 21:27
View user's profile Send private message Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel 12 Aug 2007, 08:32
Convert your .rc to .res with the RC utility (you should find it in the /bin directory of MASM32).
Then use it with:
Code:
section '.rsrc' resource from 'rsrc.res'    


BTW, I don't think you need the line:
Code:
include '%fasminc%\macro\if.inc'    
Post 12 Aug 2007, 08:32
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt 12 Aug 2007, 10:09
You need to define an entry point for your code:
Code:
format PE GUI 4.0
entry main ;<-- right here    
Post 12 Aug 2007, 10:09
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.