flat assembler
Message board for the users of flat assembler.

Index > Windows > Child inside child controls?

Author
Thread Post new topic Reply to topic
Adam Kachwalla



Joined: 01 Apr 2006
Posts: 150
Adam Kachwalla 24 Aug 2007, 09:46
Hello. I am making a Web browser, and I need help with the UI. This is the situation:

I know how to create child controls:
Code:
;Browser Box
invoke CreateWindowEx,WS_EX_CLIENTEDGE+WS_EX_STATICEDGE,_static,0,WS_VISIBLE+WS_CHILD,16,16,0,0,[hwnd],0,[wc.hInstance],NULL
MOV     [hwndBrowser],EAX
;Web page container
invoke CreateWindowEx,0,_static,0,WS_VISIBLE+WS_CHILD,0,0,10,10,[hwndBrowser],0,[wc.hInstance],NULL
MOV     [hwndPage],EAX    

All I need to know is how to capture events (messages, whatever you wanna call them) from controls created like this:
Code:
invoke CreateWindowEx,0,_button,0,WS_VISIBLE+WS_CHILD,16,64,34,12,[hwndPage],0,[wc.hInstance],NULL
MOV     [hwndPageControls+4]    


Here are some notes:

Code:
hwndPageControls  RD 64 ;Storage space for up to 64 web page form controls
hwndBrowser       DD 0  ;Browser container handle
hwndPage          DD 0  ;Handle for placeholder for Web page contents    
Post 24 Aug 2007, 09:46
View user's profile Send private message Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel 24 Aug 2007, 11:21
Isn't the 'standard' WindowProc way working for you?
You can check the hwnd to know which control is being used and then umsg to know what it's doing. It's all there.
Post 24 Aug 2007, 11:21
View user's profile Send private message Reply with quote
FrozenKnight



Joined: 24 Jun 2005
Posts: 128
FrozenKnight 24 Aug 2007, 11:28
Well there are 2 ways one. some messages are sent to the controls parent window. the other requires subclassing.

below is part of one of my sources where i subclassed a window. (the window was used as a hex edit control.

Code:
proc InitDlg  hDlg
  push   0
  push     8
  push     EM_LIMITTEXT
  push  DlgEdithexWnd
  push [hDlg]
  call        [SendDlgItemMessage]


  push  DlgEdithexWnd    ;*
  push   [hDlg]           ;*
  call   [GetDlgItem]     ;*this gets the window from the dialog

  push   hexnum             ;push window proc interceptor
  push      GWL_WNDPROC
  push   eax                ;push window handle
  call        [SetWindowLong]
  mov        [prcOrgEdit], eax  ;save origonal proc address you will need to
                           ;you will need to pass messages here after your
                           ;done with them. unless you do all the handling your self.

  ret
endp    
Post 24 Aug 2007, 11:28
View user's profile Send private message Reply with quote
Adam Kachwalla



Joined: 01 Apr 2006
Posts: 150
Adam Kachwalla 24 Aug 2007, 22:00
ManOfSteel: I am not sure how to get the control hwnd and find out what event is there. I think I tried getting the hwnd from [hwnd] and message from [wmsg] but it didn't work:
Code:
proc WindowProc hwnd,wmsg,wparam,lparam
        push    ebx esi edi
        cmp     [wmsg],WM_VSCROLL
        je      .wmVSCROLL
        cmp     [wmsg],WM_HSCROLL
        je      .wmHSCROLL
        cmp     [wmsg],WM_CREATE
        je      .wmcreate
        cmp     [wmsg],WM_SIZE
        je      .wmsize
        cmp     [wmsg],WM_SETFOCUS
        je      .wmsetfocus
        cmp     [wmsg],WM_RBUTTONDOWN
        je      .wmRBDown
        cmp     [wmsg],WM_COMMAND
        je      .wmcommand
        cmp     [wmsg],WM_DESTROY
        je      .wmdestroy
  .defwndproc:
        invoke  DefWindowProc,[hwnd],[wmsg],[wparam],[lparam]
        jmp     .finish    

It only seems to recognize events from the direct child controls (WINDOW\CHILD, not WINDOW\CHILD\CHILD)
Can you explain a little further?

FrozenKnight: So what are the references to DlgEdithexWnd and hDlg about?
Post 24 Aug 2007, 22:00
View user's profile Send private message Reply with quote
resoftw



Joined: 26 Dec 2005
Posts: 12
Location: .id
resoftw 30 Aug 2007, 15:47
it's just my thought,I dont know if it works but how about using WS_EX_CONTROLPARENT in ExStyle of the parent control..
if it doesnt a subclassing like ManOfSteel said is the way, I guess Smile

_________________
Image Loading my signature, please wait...
^_^
Post 30 Aug 2007, 15:47
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 789
Location: Adelaide
sinsi 30 Aug 2007, 16:01
You mean something like a notification code?
Quote:

The STN_CLICKED notification message is sent when the user clicks a static control that has the SS_NOTIFY style. The parent window of the control receives this notification message through the WM_COMMAND message.

Syntax

STN_CLICKED

WPARAM wParam
LPARAM lParam;

Parameters

wParam
The low-order word is a static control identifier. The high-order word is the notification message.
lParam
Handle to the static control.
Return Value

No return value.
Post 30 Aug 2007, 16:01
View user's profile Send private message Reply with quote
FrozenKnight



Joined: 24 Jun 2005
Posts: 128
FrozenKnight 31 Aug 2007, 09:37
when you create the control it returns it's hwnd. if it's in a Dialog you can get the hwnd from it's identifier using GetDlgItem.

example (From one of my programs where i created a floating point edit box)
Code:
  push IDI_FLOATNUMBER
  push       [hdlg]
  call        [GetDlgItem]
  push  fltedit_proc
  push  GWL_WNDPROC
  push   eax
  call   [SetWindowLong]
  cmp        eax, 0
  jz  .wmclose
  mov       [proc_edit], eax    
Post 31 Aug 2007, 09:37
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.