flat assembler
Message board for the users of flat assembler.

Index > Windows > converting czelion's win32 tutorial 8 ex:1 to FASM

Author
Thread Post new topic Reply to topic
mns



Joined: 20 Dec 2007
Posts: 101
Location: Piliyandala,Sri lanka
mns
Hello,I tried to convert example 1 in tutorial 8 to FASM syntax.Although there was no errors during compiling(with FASM),when running the application menu wasn't showed.Please help me to figure out the problem.(file is attached with this post) Confused Confused [/b]


Description:
Download
Filename: win32p11.ASM
Filesize: 6.44 KB
Downloaded: 56 Time(s)

Post 05 May 2019, 18:26
View user's profile Send private message Send e-mail Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 380
Location: Russian Federation, Sochi
ProMiNick
that will helps
Code:
         ;mov         [wc.lpszMenuName],MenuName ; cutoff this
         mov         [wc.lpszClassName],ClassName
         invoke      LoadIcon, NULL, IDI_APPLICATION
         mov         [wc.hIcon], eax
         mov         [wc.hIconSm], eax
         invoke      LoadCursor, NULL, IDC_ARROW
         mov         [wc.hCursor], eax

       ;----Registering window class----------
         invoke      RegisterClassEx, wc
         or          eax,eax
         jz          err1;end_loop
; insert next line
invoke  LoadMenu,[wc.hInstance],IDR_MAINMENU
       ;----Create a window-------------------
         invoke      CreateWindowEx,0,ClassName,AppName,WS_VISIBLE+WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,0,eax,[wc.hInstance],0 ; instead of invoke CreateWindowEx,0,ClassName,AppName,WS_VISIBLE+WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,0,0,[wc.hInstance],0
    
Post 05 May 2019, 18:58
View user's profile Send private message Send e-mail Reply with quote
mns



Joined: 20 Dec 2007
Posts: 101
Location: Piliyandala,Sri lanka
mns
Thank you very much for the response but according to the czelion's win32 tutorial 8 (http://win32assembly.programminghorizon.com/tut8.html) there are two methods in creating a menu. You mentioned the 2nd one and I tried the 1st one. Since I am learning I like to experiment with both methods.and I want to figure out what is wrong with my code.thanks.


Last edited by mns on 06 May 2019, 10:37; edited 1 time in total
Post 05 May 2019, 19:10
View user's profile Send private message Send e-mail Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 380
Location: Russian Federation, Sochi
ProMiNick
It is possible too, but a bit complex.

In masm resources are identified by IDs and names.
In fasm standard macroses realized only case with identification by ID.
I realized somewhere in this forum additional ones.

so, mns.
thour resource section a bit incorrect translated to fasm syntax - no one resource identified with string 'mainMenu'.
may be replace "mov [wc.lpszMenuName],MenuName" with "mov [wc.lpszMenuName],RT_MENU"
edited:
not with RT_MENU, with IDR_MAINMENU.
Post 05 May 2019, 20:38
View user's profile Send private message Send e-mail Reply with quote
mns



Joined: 20 Dec 2007
Posts: 101
Location: Piliyandala,Sri lanka
mns
Thank you very much ProMiNick. Your solution worked like a charm. Very Happy I have attached corrected file with this post (I have added MenuName = IDR_MAINMENU in data section ).Thanks again.


Description:
Download
Filename: win32p11.ASM
Filesize: 6.44 KB
Downloaded: 62 Time(s)

Post 06 May 2019, 10:35
View user's profile Send private message Send e-mail 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-2019, Tomasz Grysztar.

Powered by rwasa.