News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

iczelion Tut 12 problem with EditID

Started by Dogim, November 13, 2010, 06:44:30 PM

Previous topic - Next topic

Dogim

Hello to the masters.  :wink
I have another problem which i can't figure out, i have started with iczelions tutorials,( Petzolds book C code 2 asm conversion, seems a little bit harsh for a beginner as myself  :bg) and learning as i go, but i can't seem to get this one fully working, the program works, but it's not showing the menu.
When i debug it with gobug, i see that when creating the child window, i get an exception when the hMenu parameter is pushed.
Don't look at the Winproc please, there could be errors in there, because i sucks when it comes to understanding .IF /.ELSE macros, in time maybe, but for now ..... :naughty:.
I have changed the ID , but it still trows an exception.

donkey

EditID is a constant, you are using it as a memory address in the CreateWindowEx call of the WM_CREATE handler. Remove the brackets and it should work, I'll have a look at the menu issue a bit later.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

donkey

For the menu issue, you have to link the res file to your executable. In RadAsm this is done by changing the link command in "Project Options" to

5,O,$B\GoLink.EXE /debug coff /entry Start ,3,4

The ,4 at the end of the line includes "project.res" in the link command line

Note that @gfl.txt is no longer necessary to build a project as the header files will pass the DLL names to GoLink when LINKFILES is defined (as it is in your program).

Also in your RC file you identified the menu using 1001, you have to use that ID in WNDCLASSEX.lpszMenuName...

mov D[wc.lpszMenuName],1001

Finally the ID's you gave your menu items (1, 2 and 3) should not be used as they are usually used for Predefined IDs (though it will probably not break an app to use them). You might think about starting them at 5000 or something.

Predefined ID's from WinUser:

#define IDOK  1
#define IDCANCEL  2
#define IDABORT  3
#define IDRETRY  4
#define IDIGNORE  5
#define IDYES  6
#define IDNO  7
#define IDCLOSE  8
#define IDHELP  9
#define IDTRYAGAIN  10
#define IDCONTINUE  11
#define IDTIMEOUT 32000

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Dogim

Hi Donkey,the menu is now visible, thank you for your answer, now i have to figure out why the savefile doesn't save anything, file keeps at o bytes.
Thanks for your answer. :U