Hi there , i have a big problem.Im trying to code in asm32 a prog which opens a window (with menu etc...).This was no problem at all.But the window contains an edit control. But for some strange reason my edit control doesnt appear. The code is for tasm but i hope there are some people here who can help me out. ------------------------------ .586 .model flat, stdcall include windows.inc IDI_MAINICON EQU 1 CM_QUIT EQU 101 CM_ABOUT EQU 301 CM_REGISTER EQU 201 WM_CREATE EQU 0001h WM_DESTROY EQU 0002h WM_PAINT EQU 000Fh WM_COMMAND EQU 0111h WS_EX_CLIENTEDGE EQU 00000200h WS_EX_ACCEPTFILES EQU 00000010h WS_EX_APPWINDOW EQU 00040000h SW_SHOWNA EQU 8 extrn GetModuleHandleA:proc extrn LoadIconA:proc extrn LoadCursorA:proc extrn RegisterClassA:proc extrn CreateWindowExA:proc extrn ShowWindow:proc extrn UpdateWindow:proc extrn GetMessageA:proc extrn TranslateMessage:proc extrn DispatchMessageA:proc extrn ExitProcess:proc extrn DefWindowProcA:proc extrn PostQuitMessage:proc extrn InvalidateRect:proc extrn BeginPaint:proc extrn EndPaint:proc extrn TextOutA:proc extrn MessageBoxA:proc extrn SetFocus:proc ; Fensterklasse AWindow struc AWStyle dd ? AWlpfnWndProc dd ? AWcbClsExtra dd ? AWcbWndExtra dd ? AWhInst dd ? AWhIcon dd ? AWhCursor dd ? AWhbrBackground dd ? AWlpszMenuName dd ? AWlpszClassName dd ? AWindow ends ; Nachricht AMsg struc AMhwnd dd ? AMtype dd ? AMwParam dd ? AMlParam dd ? AMtime dd ? AMx dd ? AMy dd ? AMsg ends ; ein Rechteck ARect struc ARLeft dd ? ARTop dd ? ARRight dd ? ARBottom dd ? ARect ends ; Struktur für Paint APaintStruct struc APShdc dd ? APSfErase dd ? APSrcPaint db size ARect dup(?) APSfRestore dd ? APSfIncUpdate dd ? APSrgbReserved db 32 dup(?) APaintStruct ends .data hInst dd 0 hMainWin dd 0 hwndEdit dd 0 crackmewindow AWindow appname db "Crackme",0 editclassname db "EDIT",0 caption db "BeLiALs Crackme",0 msg AMsg msgtring db "Enter Serial",0 aboutstring db "The About Window",0 aboutstring2 db "Coded by BeLiAL ",0 .code public WinProc start: push 0 call GetModuleHandleA mov dword ptr hInst,eax mov crackmewindow.AWStyle,CS_VREDRAW + CS_HREDRAW + CS_DBLCLKS + \ CS_BYTEALIGNCLIENT + CS_BYTEALIGNWINDOW mov crackmewindow.AWlpfnWndProc,offset WinProc mov crackmewindow.AWcbClsExtra,0 mov crackmewindow.AWcbWndExtra,0 mov eax,dword ptr hInst mov dword ptr crackmewindow.AWhInst,eax call LoadIconA, hInst, 00000001h mov crackmewindow.AWhIcon,eax call LoadCursorA,00000000,00007f00h mov crackmewindow.AWhCursor,eax mov crackmewindow.AWhbrBackground,4 ;Hintergrundfarbe!!! mov dword ptr crackmewindow.AWlpszMenuName,offset appname mov dword ptr crackmewindow.AWlpszClassName,offset appname call RegisterClassA, offset crackmewindow cmp eax,0 jne make_window push 0ffffffffh call ExitProcess make_window: call CreateWindowExA,WS_EX_ACCEPTFILES + WS_EX_APPWINDOW,\ offset appname,offset caption, \ WS_CLIPCHILDREN or WS_OVERLAPPEDWINDOW or WS_VISIBLE, \ large 300,large 200,large 300,large 100, \ large 0,large 0,dword ptr hInst,large 0 mov dword ptr hMainWin,eax call ShowWindow,dword ptr hMainWin,00000001h call UpdateWindow, dword ptr hMainWin message_loop: call GetMessageA, offset msg,00000000h,00000000h,00000000h or eax,eax je exit2 call TranslateMessage,offset msg call DispatchMessageA,offset msg jmp message_loop exit2: push dword ptr msg.AMwParam call ExitProcess WinProc proc stdcall arg hWnd:dword, msgType:dword, wParam:dword, lParam:dword local hDC:
Posted on 2001-05-10 14:29:00 by belial
Obvious thing to check is that you have the WS_VISIBLE style in the .RC definition! Something like:
CONTROL "", IDC_EDIT, "EDIT", ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 3, 68, 270, 161
If you ALREADY have WS_VISIBLE could you post the .RC file too! Mirno
Posted on 2001-05-11 06:13:00 by Mirno
CreateWindowEx sends a WM_CREATE message before returning and entering the message loop. This means hMainWin is still 0 when you try to create the edit window. Use the hWnd passed to WinProc as your parent window.
Posted on 2001-05-11 15:37:00 by tank