flat assembler
Message board for the users of flat assembler.

Index > Windows > ?? Moving DialogBox Without Caption ??

Author
Thread Post new topic Reply to topic
sam_des



Joined: 23 Jul 2009
Posts: 2
Location: India
sam_des
Hello Everyone,

This is my first post. I've learned a lot from reading many discussions on this forum, thanks a lot. So here is my question,
All I want is to 'move' my dialogbox using a child window on dialogbox. I googled about it & found out that I need to pass HTCAPTION whenever mouse is within desired area, but I wasn't able to do it. Here is my code...

Code:
uglobal
  gRectMove     RECT    ?
  ghMove        dd      ?
endg

proc AboutDialogProc hdlg,umsg,wp,lp
  local pt:POINT

  ;-- --------------------------------------------------------------------------------
  .if [umsg] = WM_INITDIALOG
  ;----------------------------------------------------------------------------------
    invoke  GetDlgItem,[hdlg],IDD_ABOUT_MOVE
    mov     [ghMove],eax                                ; Handle to move window
    invoke  GetClientRect,eax,gRectMove   ; Screen co-ordinates relative to upper-left of client

    mov     eax,TRUE 
  ;----------------------------------------------------------------------------------
  .elseif [umsg] = WM_NCHITTEST
  ;----------------------------------------------------------------------------------
    mov     eax,[lp]                             ; x = LOWORD(lp), y = HIWORD(lp)
    push    eax
    and     eax,0ffffh
    mov     [pt.x],eax
    pop     eax
    shr     eax,16
    and     eax,0ffffh
    mov     [pt.y],eax                                  ; Fill point struct

    invoke  ScreenToClient,[ghMove],addr pt             ; Convert screen-coords to coords relative to our client area
    invoke  PtInRect,gRectMove,[pt.x],[pt.y]            ; Check if mouse within 'move' window
    .if eax                                             ; Yes !
      ; We must pass HTCAPTION to default handler to allow dragging & moving of our dlg-window.
      ; But how ????
   .endif

    mov     eax,TRUE
  ;----------------------------------------------------------------------------------
  .else                                                ; Default msg processing
  ;----------------------------------------------------------------------------------
    xor     eax,eax
  .endif

  ret
endp
    


I must be doing something wrong Sad Question
Any help will be greatly appreciated... Idea

regards,
sam_des[/code]
Post 30 Aug 2009, 18:12
View user's profile Send private message Reply with quote
Fanael



Joined: 03 Jul 2009
Posts: 168
Fanael
You can pass it to DefWindowProc - it should work.
Post 30 Aug 2009, 22:51
View user's profile Send private message Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 619
cod3b453
You should be able to do it by capturing WM_LBUTTONDOWN and then doing:
Code:
    ...
.lbuttondown:
    invoke ReleaseCapture
    invoke SendMessage,[hWnd],WM_NCLBUTTONDOWN,HTCAPTION,NULL 
    ...    
Post 31 Aug 2009, 08:47
View user's profile Send private message Reply with quote
sam_des



Joined: 23 Jul 2009
Posts: 2
Location: India
sam_des
Thanks cod3b453 Laughing
I just used WM_NCHITTEST insted of WM_LBUTTONDOWN.

Code:
 .elseif [umsg] = WM_NCHITTEST
  ;----------------------------------------------------------------------------------
    mov     eax,[lp]
    push    eax
    and     eax,0ffffh
    mov     [pt.x],eax
    pop     eax
    shr      eax,16
    and     eax,0ffffh
    mov     [pt.y],eax

    invoke  ScreenToClient,[ghMove],addr pt
    invoke  PtInRect,gRectMove,[pt.x],[pt.y] 
    .if eax 
      invoke  SendMessage,[hdlg],WM_NCLBUTTONDOWN,HTCAPTION,NULL
    .endif
    xor    eax,eax                      
    


Now it's working just fine.
Thanks again...

regards,
sam_des
Post 31 Aug 2009, 18:27
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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.