News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

64 bits window

Started by felipe, January 14, 2019, 12:57:01 PM

Previous topic - Next topic

felipe

Here it's my first window in windows 64 bits. nothing special i suppose, but can serve as a reference for anyone learning this (maybe). .exe and .asm in .zip file attached.  :icon14:

hutch--

Seems to work OK and it is done the right way. You could probably do it a lot easier but it works fine.

jj2007

Slick :t

But I wonder why M$ introduced structures in MASM some years ago ::)
.data?
wndclasex   dword   20 dup(?)
msg         dword   10 dup(?)


.code
start       proc

            sub     rsp,68h
           
            xor     rcx,rcx
            call    GetModuleHandle
           
            mov     r15,rax                                           ; hinstance.

            mov     dword ptr wndclasex[0],80
            mov     dword ptr wndclasex[4],CS_HREDRAW or CS_VREDRAW
...
            mov     rcx,qword ptr msg[20]                             ; wparam.
            call    ExitProcess

Mikl__

Hi, felipe!
http://masm32.com/board/index.php?topic=4190.msg44523#msg44523

TimoVJL

If you xor one register and use it instead of zero or NULL you save some bytes.

Also think of this C code: WNDCLASSEX wcx;
wcx.cbSize = sizeof(WNDCLASSEX);
GetClassInfoEx(hInstance, MAKEINTRESOURCE(32769), &wcx);
wcx.lpfnWndProc = (WNDPROC)WndProc;
wcx.hbrBackground = (HBRUSH)COLOR_3DSHADOW;
wcx.lpszClassName = szFrameClass;
if (!RegisterClassEx(&wcx))
return 0;
EDIT: wndclasex was global, so it is initially zeroed, so don't have to zero those fields.
May the source be with you

felipe

mikl__ you have great stuff there i will continuing learning from there. I found especially good there what is related to the win api. Good material to learning about that. :icon14:

Structures are useful no doubt. Especially the ones defined in the masm sdk.  :bgrin:

timovjl i like xoring. as regard with the global structure i prefer to initialize all the structure members. but this is useful knowledge, specially if you want to save a few bytes here and there or (maybe) a few cycles.  :icon14:

zedd151

Hi felipe, looks ok.


heres my first 64 bit conversions...

http://masm32.com/board/index.php?topic=7450.msg81456#msg81456