Happy New Year to Everybody,
I have attached an asm module. There, I created buttons which parent is a static control. But it isn't visible. But with Dev-Cpp it is viewing.
Regards
I have attached an asm module. There, I created buttons which parent is a static control. But it isn't visible. But with Dev-Cpp it is viewing.
Regards
Hi CakMak,
INVOKE CreateWindowEx, WS_EX_CONTROLPARENT, addr StaticClass, NULL,\
WS_CHILD or WS_VISIBLE or WS_BORDER,\
5, 98, 233, 50, hwnd, 2003, hInst, NULL
mov hGroup01, eax
;---------- ----------
INVOKE CreateWindowEx, NULL, addr ButtClass, addr szText02,\
WS_CHILD or WS_VISIBLE or WS_TABSTOP,\
152, 114, 75, 26, hwnd, 2002, hInst, NULL
mov hButt02, eax
;---------- ----------
INVOKE CreateWindowEx, NULL, addr ButtClass, addr szText01,\
WS_CHILD or WS_TABSTOP or WS_VISIBLE,\
15, 114, 75, 26, hwnd, 2001, hInst, NULL
mov hButt01, eax
:)WS_CHILD or WS_VISIBLE or WS_BORDER,\
5, 98, 233, 50, hwnd, 2003, hInst, NULL
mov hGroup01, eax
;---------- ----------
INVOKE CreateWindowEx, NULL, addr ButtClass, addr szText02,\
WS_CHILD or WS_VISIBLE or WS_TABSTOP,\
152, 114, 75, 26, hwnd, 2002, hInst, NULL
mov hButt02, eax
;---------- ----------
INVOKE CreateWindowEx, NULL, addr ButtClass, addr szText01,\
WS_CHILD or WS_TABSTOP or WS_VISIBLE,\
15, 114, 75, 26, hwnd, 2001, hInst, NULL
mov hButt01, eax
Thank You Arkane,
But, I wanted to create buttons as parent is Static control ;) And this is possible in C (API). I attached a Dev-Cpp example is equivalence the masm project. So, what do you guess?
note: However, in test2.zip unfortunatly couldn't catch enter key in subclassed procedure, it may catch already in WndProc. I confused. But most important, WHY MASM CAN NOT? Where am I do wrong?
Regards
But, I wanted to create buttons as parent is Static control ;) And this is possible in C (API). I attached a Dev-Cpp example is equivalence the masm project. So, what do you guess?
note: However, in test2.zip unfortunatly couldn't catch enter key in subclassed procedure, it may catch already in WndProc. I confused. But most important, WHY MASM CAN NOT? Where am I do wrong?
Regards
I really don't know what's wrong with your code... but I have another exmaple that works...
Anyway, if I can find some extra time to go through all your code I'll have a second look. :)
Here's a screenshot of the code above...
[size=9][b]edited for clarity[/b]
.686
.MODEL FLAT, STDCALL
OPTION SCOPED
OPTION CASEMAP:NONE
INCLUDE \dev\include\windows.inc
INCLUDE \dev\include\kernel32.inc
INCLUDELIB \dev\lib\kernel32.lib
INCLUDE \dev\include\user32.inc
INCLUDELIB \dev\lib\user32.lib
INCLUDE main.inc
.CONST
.DATA
g_cStatic DB "static", 0
g_cButton DB "button", 0
g_lpszButton1 DB "Button 1", 0
g_lpszButton2 DB "Button 2", 0
.DATA?
g_hStatic DD ?
g_hButton1 DD ?
g_hButton2 DD ?
.CODE
start:
invoke LoadCursor, NULL, IDC_ARROW
mov wcx.hCursor, eax
sub esp, 48
mov DWORD PTR [esp], WS_EX_STATICEDGE
mov DWORD PTR [esp+4], OFFSET g_dbWndClass
mov DWORD PTR [esp+8], OFFSET g_dbWndClass
mov DWORD PTR [esp+12], WS_VISIBLE or WS_CAPTION or WS_SYSMENU or WS_BORDER
mov esi, 500
mov DWORD PTR [esp+24], esi
mov DWORD PTR [esp+28], esi
invoke GetSystemMetrics, SM_CXSCREEN
shr esi, 1
shr eax, 1
sub eax, esi
mov DWORD PTR [esp+16], eax
invoke GetSystemMetrics, SM_CYSCREEN
shr eax, 1
sub eax, esi
mov DWORD PTR [esp+20], eax
xor ecx, ecx
mov DWORD PTR [esp+32], ecx
mov DWORD PTR [esp+36], ecx
invoke GetModuleHandle, NULL
push eax
invoke LoadIcon, eax, IDI_WINLOGO
mov wcx.hIcon, eax
mov wcx.hIconSm, eax
pop eax
mov wcx.hInstance, eax
mov DWORD PTR [esp+40], eax
mov DWORD PTR [esp+44], 0
invoke RegisterClassEx, OFFSET wcx
call CreateWindowEx
mov hMainWnd, eax
push eax
invoke ShowWindow, eax, SW_SHOWNORMAL
call UpdateWindow
__msg_pump:
sub esp, 16
mov DWORD PTR [esp], OFFSET msg
sub eax, eax
mov DWORD PTR [esp+4], eax
mov DWORD PTR [esp+8], eax
mov DWORD PTR [esp+12], eax
call GetMessage
test eax, eax
jz __msg_pump_exit
push OFFSET msg
call TranslateMessage
push OFFSET msg
call DispatchMessage
jmp __msg_pump
__msg_pump_exit:
mov eax, msg.wParam
invoke ExitProcess, eax
MainProc PROC hWnd:DWORD, uMsg:DWORD, lParam:DWORD, wParam:DWORD
mov eax, uMsg
cmp eax, WM_CREATE
je __create
cmp eax, WM_DESTROY
je __destroy
invoke DefWindowProc, hWnd, uMsg, lParam, wParam
ret
__create:
[color=blue]invoke CreateWindowEx, WS_EX_CONTROLPARENT + WS_EX_STATICEDGE, \
OFFSET g_cStatic, NULL, WS_VISIBLE + WS_CHILD, \
12, 17, 361, 165, hWnd, 2000, wcx.hInstance, NULL
mov g_hStatic, eax
invoke CreateWindowEx, NULL, OFFSET g_cButton, OFFSET g_lpszButton1, \
WS_VISIBLE + WS_CHILD + BS_PUSHLIKE + WS_TABSTOP, \
33, 113, 86, 27, [color=red]g_hStatic[/color], 2000, wcx.hInstance, NULL
mov g_hButton1, eax[/color]
jmp __main_msg_exit
__destroy:
invoke PostQuitMessage, 0
__main_msg_exit:
xor eax, eax
ret
MainProc ENDP
end start[/size]
just change the paths of the includes.
Anyway, if I can find some extra time to go through all your code I'll have a second look. :)
Here's a screenshot of the code above...
btw here's main.inc
WINDOW_WIDTH EQU 500
WINDOW_HEIGHT EQU 500
_DATA SEGMENT
g_dbWndClass DB "win", 0
g_dbWndName DB "win", 0
wcx WNDCLASSEX<SIZEOF WNDCLASSEX, CS_CLASSDC, OFFSET MainProc, NULL, NULL, NULL,\
NULL, NULL, COLOR_WINDOW+2, NULL, OFFSET g_dbWndClass, NULL>
_DATA ENDS
_BSS SEGMENT
hMainWnd DD ?
msg MSG<>
_BSS ENDS
MainProc PROTO :DWORD, :DWORD, :DWORD, :DWORD
Thank You arkane,
I will try ASAP what you suggested.
Best Regards
I will try ASAP what you suggested.
Best Regards
Hi,
I'm too careless, found it. After changing the parent I forgot to change the relative TOP position. It has gone to da*n deep of bottom. I would be almost cross-eyed. Would be look for easiest parts. Again thanks arkane.
:stupid:
I'm too careless, found it. After changing the parent I forgot to change the relative TOP position. It has gone to da*n deep of bottom. I would be almost cross-eyed. Would be look for easiest parts. Again thanks arkane.
:stupid: