News:

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

CreateWindowEx Error

Started by raleeper, August 07, 2011, 04:00:27 AM

Previous topic - Next topic

raleeper

#15
@dedndave: re "ret" in the w-proc:  I had already flagged this mistake, but I appreciate the info as to what's going on.

Thanks, ral

[later] Wait a minute, I did correct it.  I had changed "ret" to "retn" before I posted the code.  And I still get the error from CreateWindowEx.

But as I said, I'll figure it out.

[Still later] OK, I see (or have come to believe) that the Child W-proc should pretty much mirror my main W-proc, with just the differences appropriate for the different characteristics and functions of the different window types.  So I need a message handler and exits via DefWondowProc or InvalidateRectangle oe PostQuitMessage, etc.  And, of course, "ret", not "retn".  And probably a lot more "SendMessage"s.

dedndave

try this, Ral....

raleeper

Quote from: dedndave on August 07, 2011, 08:41:57 PM
try this, Ral....


@dedndave: Yours:

CWProc: push    ebp
        mov     ebp,esp
        INVOKE  DefWindowProc,[ebp+8],[ebp+12],[ebp+16],[ebp+20]
        pop     ebp
        ret     16

looks like a worthy alternative, but for now I'm going with the code below:

CWProc proc cwp_hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
   (lots here)
   invoke   DefWindowProc,hWnd,uMsg,wParam,lParam
   ret
   CWProc endp

Too soon to judge whether it works, but it gets rid of the error from CreateWindowEx.

Thanks, ral

[later]
Also, I'm afraid to go into windows with an altered ebp - at least w/o a better understanding of the processes involved.


dedndave

#18
if you disassemble them, they are exactly the same thing   :bg
(well - yours probably uses LEAVE instead of POP EBP)

yours is the right way   :U

ixuta

Quote from: zekyr on August 07, 2011, 10:26:08 AM
mov eax, [hwnd]   ;grab memory pointed to by hwnd and stick it into eax
mov eax, hwnd     ;stick handle into eax (which i thought we wanted here)
mov eax, offset hwnd ;stick address of hwnd which has a handle in it, which could be dereferenced into eax

Yes, zekyr you are correct                                         ;Im using: MASM, TASM, SofTools
mov eax,[myVar]     ;contents of
mov eax,myVar       ;addresss of

There are no dumb questions, always blame it on the 'puter  :green

jj2007

Quote from: ixuta on August 08, 2011, 10:00:49 AM
Yes, zekyr you are correct                                         ;Im using: MASM, TASM, SofTools
mov eax,[myVar]     ;contents of
mov eax,myVar       ;addresss of

Please test your code before posting in the Campus.
include \masm32\include\masm32rt.inc

.data
myvar dd 12345

.code
start:
mov ebx, [myvar]
print str$(ebx), 13, 10
mov ebx, myvar
print str$(ebx), 13, 10
mov ebx, offset myvar
print str$(ebx), 13, 10
inkey "ok?"
exit

end start


12345
12345
4202496
ok?

ixuta

-
-d 0
13AB:0000  CD 20
-r
AX=0000  BX=0000  CX=0400  DX=0000  SP=00B8  BP=0000  SI=0000  DI=0000
DS=13AB  ES=13AB  SS=13BB  CS=13BB  IP=0000   NV UP EI PL NZ NA PO NC


13BB:0000 A10000        MOV     AX,[0000]                          DS:0000=20CD
-t
AX=20CD  BX=0000  CX=0400  DX=0000  SP=00B8  BP=0000  SI=0000  DI=0000
DS=13AB  ES=13AB  SS=13BB  CS=13BB  IP=0003   NV UP EI PL NZ NA PO NC



13BB:0003 B80000        MOV     AX,0000
-t
AX=0000  BX=0000  CX=0400  DX=0000  SP=00B8  BP=0000  SI=0000  DI=0000
DS=13AB  ES=13AB  SS=13BB  CS=13BB  IP=0006   NV UP EI PL NZ NA PO NC

dedndave

wow it's been a while since i've seen that screen   :bg