News:

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

Error on paint windows

Started by 5k3l3t0r, May 16, 2012, 10:16:22 PM

Previous topic - Next topic

5k3l3t0r

Hi all, i have a problem on child windows paint wen i drag one over the other here are some images:

http://screensnapr.com/v/bA3Dfa.png

http://screensnapr.com/v/vaOpTG.png


this append wen i drag the down window...

some help will be very nice...

best regards

5k3l3t0r


qWord

Any code?
Maybe it is something trivial like missing DefMDIChildProc()?
FPU in a trice: SmplMath
It's that simple!

5k3l3t0r

hi, tkx for fast reply.

this isn't mdi, the darkest rect is a child window created just for host dialogs

here is how the dialogs are created:

invoke CreateDialogParam,hInstance,1100,hWnd,addr TestWindowProc,NULL
invoke CreateDialogParam,hInstance,1100,hWnd,addr TestWindowProc2,NULL

and here is the dialog funcs

TestWindowProc proc hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM

.if uMsg == WM_INITDIALOG

.elseif uMsg == WM_LBUTTONDOWN
.elseif uMsg == WM_COMMAND
.elseif uMsg == WM_MOUSEMOVE
invoke BringWindowToTop,hWnd
invoke UpdateWindow,hWnd
invoke RTLogMessage,s("Updated"),TRUE
.elseif uMsg==WM_MOVE
invoke BringWindowToTop,hWnd
invoke RTLogMessage,s("Updated"),TRUE
.elseif uMsg == WM_CLOSE
invoke EndDialog,hWnd,0
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
TestWindowProc endp

TestWindowProc2 proc hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM

.if uMsg == WM_INITDIALOG
.elseif uMsg == WM_LBUTTONDOWN

.elseif uMsg == WM_COMMAND
.elseif uMsg == WM_MOUSEMOVE
invoke BringWindowToTop,hWnd
invoke UpdateWindow,hWnd
invoke RTLogMessage,s("Updated"),TRUE
.elseif uMsg==WM_MOVE
invoke BringWindowToTop,hWnd
invoke RTLogMessage,s("Updated"),TRUE
.elseif uMsg == WM_CLOSE
invoke EndDialog,hWnd,0
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
TestWindowProc2 endp


i have tried a lot of things but nothing (as you have said maybe something trivial...)

tkx

5k3l3t0r



qWord

These BringWindowToTop's seems to be not correct ...  the common way to force redrawing of a window or control, is to invalidate its client area using InvalidateRect(hWnd,0,TRUE).
FPU in a trice: SmplMath
It's that simple!

5k3l3t0r

hi have changed the code:

.elseif uMsg==WM_MOVE
invoke InvalidateRect,hWnd,0,TRUE
invoke UpdateWindow,hWnd


but stays the same...

something with the style of the child windows?


IDD_LOG DIALOGEX 253,40,346,50
FONT 9,"Trebuchet MS",400,0,0
STYLE 0x50C80004
EXSTYLE 0x00000188
BEGIN
  CONTROL "",IDC_LSVLOG,"SysListView32",0x50010003,0,4,346,46,0x00000200
END


or the parent

IDD_DLG1 DIALOGEX 10,10,297,172
FONT 8,"MS Sans Serif",0,0,0
STYLE 0x56000000
BEGIN
END


?????

tkx

5k3l3t0r

dedndave

you shouldn't have to do anything like that for WM_MOVE
when you drag a window, it becomes the foreground window and gets keyboard focus

for WM_MOUSEMOVE...
you will drive that thing nuts in processor time if you do that - lol
WM_MOUSEMOVE happens hundreds of times when you move the mouse across a window
so - use SetForegroundWindow, and set a flag
test the flag so you only have to do it once
to keep track of the mouse leaving, use SetCapture
when the mouse is outside the window, use ReleaseCapture
then, respond by clearing the flag in WM_CAPTURECHANGED

could you show use the resource template for 1100 ?

5k3l3t0r

hi.
this is the resource(the name IDD_LOG just come from some experiments):

IDD_LOG DIALOGEX 253,40,346,50
FONT 9,"Trebuchet MS",400,0,0
STYLE 0x50C80004
EXSTYLE 0x00000188
BEGIN
  CONTROL "",IDC_LSVLOG,"SysListView32",0x50010003,0,4,346,46,0x00000200
END


tkx
5k3l3t0r

dedndave

sorry - i see it was in the previous post   :P

5k3l3t0r

hi,
it seems that the problem is that the child window never become active, even wen dragged around.(the caption bar never changes his state, and the window don't come to top)

i have tried to call SetActiveWindow, but without results...

is there a way to force a child window to become active?

tkx in advance

5k3l3t0r

dedndave

IDD_DLG1 DIALOGEX 10,10,297,172
FONT 8,"MS Sans Serif",0,0,0
STYLE 0x56000000
BEGIN
END


this is the template for the parent ???
you have the WS_CHILD bit set   :P

i am just trying to get the thing to display - lol
it might be easier if you would post a complete program

not to worry - i will get there   :bg

5k3l3t0r

hi...

here is the full project(radasm3)

https://www.box.com/s/68caba58160304a683e7


tkx
5k3l3t0r

dedndave

that helps a lot   :bg

the template you posted above as the parent is for the log window - lol

at any rate.....

you are using CreateDialogParam, creating 2 modeless dialog boxes as child windows
these require a message loop - and a little bit special, if you want it to handle certain keyboard stuff, as it requires IsDialogMessage

as a parent, you have a modal dialog, which requires no message loop
i am not sure there is a way to use that specific window hierarchy  :red

but - the solutions seem easy enough
you could create a modeless dialog as the parent, followed by a message loop, something like this...
    LOCAL   msg:MSG

;--------------------------

;
;other code
;

    .while TRUE
        INVOKE  GetMessage,addr msg,edi,edi,edi
        .break .if !eax
        INVOKE  IsDialogMessage,hWin,addr msg
        .if eax==FALSE
            INVOKE  TranslateMessage,addr msg
            INVOKE  DispatchMessage,addr msg
        .endif
    .endw

    INVOKE  ExitProcess,msg.wParam

normally, a message loop handles messages for all windows in a process
that may not work so well, in this case, as IsDialogMessage is window-specific
although, you could probably make a loop with a call to IsDialogMessage for each modeless dialog

or - you could create modal dialogs as children - probably the easy way

the problems you are having are caused by the fact that no messages are being dispatched for the child windows

personally, i would not use dialogs at all - lol
i like to use CreateWindowEx for everything

5k3l3t0r

hi,
tkx for the explanation, but i don't understand very well... ;(

can you make a simple example with a main window and two childs windows, so i can study the code and try to understand how things work? or give a link with some working code.

tkx in advance

5k3l3t0r

dedndave

i will post a couple examples, shortly

there are different ways to go
one way would be an MDI window - a bit tricky - lol

another way would be to use the same class/WndProc for both children
another way would be to use seperate class/WndProc's for each child
it depends on the desired functionality of the children
if they are to behave the same, or nearly the same, it might be best to use the same class/WndProc for both

qWord

Activating the WS_CLIPSIBLINGS-Style for the IDD_LOG-Window solves the problem.
FPU in a trice: SmplMath
It's that simple!