News:

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

Fixing a window

Started by Nordwind64, February 16, 2006, 11:00:32 PM

Previous topic - Next topic

Nordwind64

Hi,

what's the best way to fix a window agains moving by the user?

Best regards,
Nordwind64
Greetings, Nordwind.
Windows 7 (64Bit), JWASM/PoLink

zooba

Probably to intercept WM_MOVING and return TRUE (indicating that you've handled it). Though I haven't tried this before.

Tedd

Nope, that doesn't work. Neither does WM_MOVE.

The following is a bit of a hack, but it does work. It causes the titlebar to be seen as the client area, but the buttons still work. You can easily add extra checks to prevent sizing, etc - if you need to.

WndProc proc hwnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
    mov eax,uMsg
    .IF (eax==WM_NCHITTEST)
        invoke DefWindowProc, hwnd,uMsg,wParam,lParam    ;this will return the HT_ value for where the pointer currently is
        .IF (eax==HTCAPTION)
            mov eax,HTCLIENT    ;if it's on the caption, say it's on the client-area
        .ENDIF
        ret
    .
    .
    .

No snowflake in an avalanche feels responsible.

Nordwind64

Hi,

I tried WM_MOVE and WM_MOVING before. Don't work.
Tedd, the close button don't work with your solution. And I can open system menu and move window from there. Sorry.

What about removing "Move window" from system menu? Could that work?
Greetings, Nordwind.
Windows 7 (64Bit), JWASM/PoLink

Nordwind64

Hehe, found the solution:

   
.elseif uMsg==WM_MOVING
  invoke ReleaseCapture
  mov eax,FALSE
  ret


Best regards,
Nordwind64
Greetings, Nordwind.
Windows 7 (64Bit), JWASM/PoLink