Jump to content
Tuts 4 You

Window In Asm


Guest sonic_00

Recommended Posts

Guest sonic_00
Posted

I'm back (after months :rolleyes: )

well i'm trying to learn MASM and i've copied the code of lioczar's tutorial on a new file in Quick Editor, just to see if it works, but it doesn't. Why?

The code:

.386
.model flat, stdcallinclude \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.incincludelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib.DATA
ClassName db "SimpleWinClass",0
AppName db "Our First Window",0 .DATA?
hInstance HINSTANCE ?
CommandLine LPSTR ?.CODE
start:
invoke GetModuleHandle, NULL
mov hInstance,eax
invoke GetCommandLine
mov CommandLine,eax
invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:SDWORD
LOCAL wc:WNDCLASSEX
LOCAL msg:MSG
LOCAL hwnd:HWNDmov wc.cbSize,SIZEOF WNDCLASSEX
mov wc.style, CS_HREDRAW or CS_VREDRAW
mov wc.lpfnWndProc, OFFSET WndProc
mov wc.cbClsExtra,NULL
mov wc.cbWndExtra,NULL
push hInstance
pop wc.hInstance
mov wc.hbrBackground,COLOR_WINDOW+1
mov wc.lpszMenuName,NULL
mov wc.lpszClassName,OFFSET ClassName
invoke LoadIcon,NULL,IDI_APPLICATION
mov wc.hIcon,eax
mov wc.hIconSm,0
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor,eax
invoke RegisterClassEx, addr wc invoke CreateWindowEx,NULL,
ADDR ClassName,
ADDR AppName,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInst,
NULL
mov hwnd,eax
invoke ShowWindow, hwnd,CmdShow
invoke UpdateWindow, hwnd .WHILE TRUE
invoke GetMessage, ADDR msg,NULL,0,0
.BREAK .IF (!eax)
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
.ENDW
mov eax,msg.wParam
ret
WinMain endpWndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
mov eax,uMsg
.IF eax==WM_DESTROY
invoke PostQuitMessage,NULL
xor eax,eax
.ELSE
invoke DefWindowProc,hWnd,uMsg,wParam,lParam .ENDIF
ret
WndProc endpend start
Posted

what doesn't work?.. maybe u need the .inc files set up.. or the directory's.. be more specific please!

Posted

Give us the error messages you get when compiling.

Guest sonic_00
Posted
Give us the error messages you get when compiling.

Assembling: C:\masm32\apps\test2.asm

\masm32\include\windows.inc(122) : error A2004: symbol type conflict : bool

\masm32\include\windows.inc(7088) : error A2179: structure improperly initialized

\masm32\include\windows.inc(7088) : error A2008: syntax error : in structure

\masm32\include\windows.inc(7990) : error A2179: structure improperly initialized

\masm32\include\windows.inc(7990) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8003) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8003) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8015) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8015) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8020) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8020) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8025) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8025) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8030) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8030) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8035) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8035) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8042) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8042) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8049) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8049) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8056) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8056) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8061) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8061) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8067) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8067) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8075) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8075) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8076) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8076) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8080) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8080) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8086) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8086) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8093) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8093) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8100) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8100) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8105) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8105) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8113) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8113) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8120) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8120) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8128) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8128) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8135) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8135) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8145) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8145) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8146) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8146) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8150) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8150) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8151) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8151) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8156) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8156) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8162) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8162) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8169) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8169) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8176) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8176) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8182) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8182) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8193) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8193) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8201) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8201) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8212) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8212) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8224) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8224) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8232) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8232) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8240) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8240) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8251) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8251) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8262) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8262) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8271) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8271) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8279) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8279) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8288) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8288) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8295) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8295) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8300) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8300) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8306) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8306) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8325) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8325) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8346) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8346) : error A2008: syntax error : in structure

\masm32\include\windows.inc(8375) : error A2179: structure improperly initialized

\masm32\include\windows.inc(8375) : fatal error A1012: error count exceeds 100; stopping assembly

it seems that the errors are in windows.inc file...but i'm not sure...

Posted

What command are you using to compile it?

And (forgive the stupi but obvious question) have you definately installed to c:\MASM?

Guest sonic_00
Posted (edited)

1) from QEDITOR: Project/Assemble ASM file

(or Project/Assemble & Link, same result)

2) C:\masm32... i've not done something strange, just installed it with the setup procedure...

what a mistery... :wacko:

Edited by sonic_00
Posted

Is there a link to this tut online? Googled for lioczar but got nothing

Guest sonic_00
Posted

argh! i've done a mistake! the author is Iczelion... :blush: i'm studying on his tut...third lesson...but my copy of the tut is translated in italian, so if i give you the link i think you wouldn't understand anything...

link to the tut

Posted

There must be something wrong with your setup - have you rebooted since installing MASM? Not sure if it sets up some env variables which require a reboot? Either reboot or reinstall and then reboot - beyond that I'm stumped I'm afraid.

Either way, I just copied the code from tut 3 into QEditor and it compiled and linked fine.

Guest sonic_00
Posted (edited)

oh my god...i'm unlucky as always... :rolleyes:

i'll try to reinstall it and reboot

Edited by sonic_00
Posted (edited)

If installed masm on C:\ only compile C drive from

If no work: installate winasmstudio same drive.

tools -> options -> files&paths:

image2uf5.jpg

Edited by Rumour
Guest sonic_00
Posted

ey! i've copied the code from the original tut and it WORKS! so the code in my version was wrong...sorry for all this and thanks for the patience...

Posted

You forgot one line ;)

however when you're includeding windows.inc, you have to set option casemap:none

so your first lines have to look like this:

.386
.model flat,stdcall
option casemap:none

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...