News:

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

Child Window Makes Parent Inactive - Third try

Started by raleeper, August 19, 2011, 04:35:35 PM

Previous topic - Next topic

raleeper

1.  I still have the same problem and have not made progress on it.

2.  in Topic: Child Window Makes Parent Inactive - Another try, I was seeking help with respect to my large complicated program, lfw.  The code was obscure, convoluted, non-standard and non-functional without additional files.

qWord, in Reply #10 on: August 10, 2011, 05:52:41 pm, pointed out some of these problems, and I quite understand that I should not be asking for help for such a program.  He suggested that I rewrite the whole thing, and gave some guidelines.  I won't address the specifics here, but I think I have an alternative that is a better approach, unless and until I undertake a massive rewrite of lfw.

What I have done is to write a small simple program, less idiosyncratic, more readable, self-contained, that illustrates the particular problem.  I'm sure the style is still below Forum standards and of course I am very open to suggestions for improvement, from the point of view or with the objective of making it easier for you to help with.  My plan is to take what I learn and use it in my big program.

That smaller program is testp and attached are zips for both asm and exe.

3.  The opening screen of testp contains a command summary and and a brief problem description.  It should enable you to see the problem.

The problem is that after the child window is opened and command 'back' returns keyboard focus to the parent, the main window does not redisplay.

On child command back, the child does:

        invoke  SetFocus,cfown
        or      eax, eax
          jnz   @F
        invoke  Beep,0800,0B0
        and     BYTE PTR [flgs+2],not 10 ;reset flag s,14: child active
        jmp     CWP_end


where cfown is a global variable set to the return from CreateWindowEx that creates the main window, and CWP_end sets eax to 0 and returns (ret, not retn).

I have tried several things to be executed when the main window's message handler in WProc encounters WM_SETFOCUS with the child existing,
        invoke UpdateWindow, wp_hWnd            Nope
        invoke SetActiveWindow,wp_hWnd          Nope
        invoke SetForegroundWindow, wp_hWnd     Nope
        invoke ShowWindow,wp_hWnd,SW_SHOW       Nope
        invoke InvalidateRect,wp_hWnd,0,0       Nope
where wp_hWnd is first parameter of WProc, the main window procedure.

WProc proc wp_hWnd,uMsg,wParam,lParam


I am hoping for a suggestion to return display focus to the parent.

Thank you, Robert

[LATER] THERE IS A BUG IN THE VERSION POSTED.  I WILL REPOST WHEN CORRECTED.  THANKS.

OK

baltoro

This is from: Window Features, MSDN

QuoteWhen the user is working with a child window, the system activates the top-level parent window associated with the child window.
Baltoro

raleeper

Quote from: baltoro on August 19, 2011, 10:34:31 PM
This is from: Window Features, MSDN

QuoteWhen the user is working with a child window, the system activates the top-level parent window associated with the child window.

Thanks Baltoro.  I don't get the quote, but the link looks just like the general overview I need to understand what I;m doing.  The SDK help has a windows overview, but it didn't explain much to me.

raleeper

Preliminary review of the MSDN Overview linked by baltoro has 95% convinced me that what I really need are dialog boxes, and I don't think I'll have any trouble researching that.

So, thanks to baltoro, apologies to everyone.


Best wishes, robert

qWord

Have you tried to create the child window invisible and then make it visible using ShowWindow(hWnd,SW_SHOWNA)?
FPU in a trice: SmplMath
It's that simple!

ToutEnMasm

Quote
2.  in Topic: Child Window Makes Parent Inactive - Another try, I was seeking help with respect to my large complicated program, lfw.  The code was obscure, convoluted, non-standard and non-functional without additional files.
It's true.
Try to use  a masm32 sample and modify it.


raleeper

#6
Quote from: qWord on August 20, 2011, 12:31:46 PM
Have you tried to create the child window invisible and then make it visible using ShowWindow(hWnd,SW_SHOWNA)?
No. I want the window to be visible if and only if it is active.  The problem seems to be that SetFocus {handle to main window} invoked by child upon receipt of the back key,  makes the main window active for keyboard input but evidently not visible.  And I have tried ShowWindow {handle to main window},SW_SHOW (at the point where the main windows should be processing the WM_SETFOCUS message received after exit from the child, and several other things, none of which works, to make the main window visible, specificall, as listed in my original post,

        invoke UpdateWindow, wp_hWnd
        invoke SetActiveWindow,wp_hWnd
        invoke SetForegroundWindow, wp_hWnd
        invoke ShowWindow,wp_hWnd,SW_SHOW
        invoke InvalidateRect,wp_hWnd,0,0


Thanks, Robert

raleeper

#7
Quote from: ToutEnMasm on August 20, 2011, 12:40:32 PM

It's true.
Try to use  a masm32 sample and modify it.


The only source of masm32 samples  I know of  is Iczelion's tutorials, and while I think he does have a couple with child windows, they are special types. My memory is that all his examples of child windos use predefined types.  I'll have another look, though.

If there is another source of sample programs I would be glad to know of it.  I'll look back at the original masm32 package and try searching the Forum for variations on "sample program".

Thank you. Robert

BogdanOntanu

Quote from: raleeper on August 20, 2011, 02:30:12 PM
The only source of masm32 samples  I know of  is Iczelion's tutorials, and while I think he does have a couple with child windows, they are special types. My memory is that all his examples of child windos use predefined types.  I'll have another look, though.

If there is another source of sample programs I would be glad to know of it.  I'll look back at the original masm32 package and try searching the Forum for variations on "sample program".

Thank you. Robert


Iczelion tutorials are a very good learning source ... but the masm32 package has an folder named "examples" ...

Inside that folder one can find a lot of sample programs that are simple and designed to teach a beginner a few tricks.

Also plese DO NOT ask us to download and execute your programs in order to understand what your problem is. We might not have the time to do that or security dictates that we do not.

Instead please learn to explain your problem is simple words and with as many details as needed but not more.

Let us assume that I did not followed the original thread and in consequence I am not aware what your problem is .... in this case at a first glance at this meassage I can not find enouh information on the issue at hand but I do find a lot of non relevant info abou your "lfw". Please do not redirect me or the reader  to yet another message.

Be brief, exact, correct and concise HERE in this message.

So what exactly is your "problem"?

You want to have a parent and a child window displayed on screen and when a button is pressed in the child you want the parent window to become the foreground window obtaining the focus and being on top of your just pressed child window  ?

Try to explain more exactly.



Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro

raleeper

Quote from: BogdanOntanu on August 20, 2011, 04:14:09 PM
Quote from: raleeper on August 20, 2011, 02:30:12 PM
The only source of masm32 samples  I know of  is Iczelion's tutorials, and while I think he does have a couple with child windows, they are special types. My memory is that all his examples of child windos use predefined types.  I'll have another look, though.

If there is another source of sample programs I would be glad to know of it.  I'll look back at the original masm32 package and try searching the Forum for variations on "sample program".

Thank you. Robert


Iczelion tutorials are a very good learning source ... but the masm32 package has an folder named "examples" ...

Inside that folder one can find a lot of sample programs that are simple and designed to teach a beginner a few tricks.

Ah!  Such as one folder called bcraven.  I'll look at them.  Thanks.

Quote

Also plese DO NOT ask us to download and execute your programs in order to understand what your problem is. We might not have the time to do that or security dictates that we do not.
OK
Quote

Instead please learn to explain your problem is simple words and with as many details as needed but not more.

Let us assume that I did not followed the original thread and in consequence I am not aware what your problem is .... in this case at a first glance at this meassage I can not find enouh information on the issue at hand but I do find a lot of non relevant info abou your "lfw". Please do not redirect me or the reader  to yet another message.
OK
Quote
Be brief, exact, correct and concise HERE in this message.

So what exactly is your "problem"?

You want to have a parent and a child window displayed on screen and when a button is pressed in the child you want the parent window to become the foreground window obtaining the focus and being on top of your just pressed child window  ?

Try to explain more exactly.


I want 2 windows, one and only one of which is displayed and active at any time.  I want each window to be able, by a button or key or whatever, to transfer active and on-top status to the other.  What you said:

Quote
You want to have a parent and a child window displayed on screen and when a button is pressed in the child you want the parent window to become the foreground window obtaining the focus and being on top of your just pressed child window  ?
is just right for half of the objective - but it is the half that isn't working, as far as display status is concerned.

Thanks, ral

dedndave

well - sometimes you get more help if you post complete code

qWord

Quote from: raleeper on August 20, 2011, 11:14:57 PMI want 2 windows, one and only one of which is displayed and active at any time.  I want each window to be able, by a button or key or whatever, to transfer active and on-top status to the other.
see attachment - maybe this is it ...
FPU in a trice: SmplMath
It's that simple!

raleeper

Quote from: qWord on August 21, 2011, 12:52:00 AM
Quote from: raleeper on August 20, 2011, 11:14:57 PMI want 2 windows, one and only one of which is displayed and active at any time.  I want each window to be able, by a button or key or whatever, to transfer active and on-top status to the other.
see attachment - maybe this is it ...

Thanks qWord!
It will take me a while to digest this, but I think I get the idea.  Instead of parent-child we have parallel windows, both, I guess, children of the desktop.

I'll try it.  Thanks, robert

raleeper

Quote from: dedndave on August 21, 2011, 12:06:00 AM
well - sometimes you get more help if you post complete code
When I wasn't posting attaching complete code I often got the impression that people thought I ought to be.  And a member whose opinion I respect once said "- supplying an EXE is also often useful".  My attitude - perhaps not conveyed - was "It's there if you think it will help, if not, please ignore it.

But BogdanOntanu has a point.  Rereading my post, it does look as if I'm asking people to download and run the exe, and maybe I was.

Anyway thanks to all of you for your patience as well as your help.  robert

raleeper

Quote from: qWord on August 21, 2011, 12:52:00 AM
Quote from: raleeper on August 20, 2011, 11:14:57 PMI want 2 windows, one and only one of which is displayed and active at any time.  I want each window to be able, by a button or key or whatever, to transfer active and on-top status to the other.
see attachment - maybe this is it ...

What is "m2m"?