Window message

I have an application with a main window which execute a number of child applications in other windows.
When minimize the main window, I call ::ShowWindow(HWND, SW_HIDE) to hide all the child window (only the main window minimized on task bar).
The problem is some applications are called by a hidden program (proxy). When I call minimize, the proxy programs will hide their sub programs (so this is fine) but when I call restore these hidden programs restore (and restore it's sub program) so on my destop have a pair of window, one is the child application, one is the hidden program which is now visible that show a blank window.

Someone suggest me to make custom message WM_Custom_Wnd with contants WPARAM 0 = Hide, 1 = Restore... so when the proxy program receive "Restore" it will call it's child to restore but not itself.

Can anyone help me with more details about coding ? If you understand what I'm writing please reply and I'll show more about my current code. Thanks
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I think you can use RegisterWindowMessage to register a message that is guaranteed to be unique throughout the system.
The syntax for registerwindowmessage is:
UINT RegisterWindowMessage(LPCTSTR msgString)
You can then use SendMessage/PostMessage functions with the WPARAM and LPARAM as you require.
ahTriAuthor Commented:
Humm I still quite unclear, all information I have about the child windows is in registry (so I can have those window title in the menu "window" drop down) and HWND of those windows.
>>which is now visible that show a blank window.
How it can be visible? Why dont you simly hide it?
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

ahTriAuthor Commented:
When I call "restore" the message is sent to every applications. The hidden window need that message to restore it's subwindow and un-expectedly restore itself. Now I want a custom message and change every application so that when a "restore" message is posted:

normal application: restore
hidden application: restore it's sub application but not itself
you have to write some code like this:
in the main APP you must register Windows message by:

UINT uMyShowMsg = ::RegisterWindowMessage("WM_MY_SHOW_MESSAGE");// any string can be here
now you can use uMyShowMsg in the SendMessage() or PostMessage() instead standard msg (such as WM_SHOWWINDOW and etc),
that is to send msg to the child wnd you can use this:
::SendMessage(hwndChild, uMyShowMsg, (WPARAM) TRUE, 0);
/* I assume that wParam will indicate desired child window state. in example we want bring it to the screen.
in the child app you must call RegisterWindowMessage with the same string as one in the main APP.
that is:
UINT uMyShowMsgChildApp = ::RegisterWindowMessage("WM_MY_SHOW_MESSAGE");
and in the APP message map you have to write following:

    //{{AFX_MSG_MAP( CMyApp )
    ON_REGISTERED_MESSAGE(  uMyShowMsgChildApp, OnMyShow )
// here OnMyShow -method of the your child APP and it must be declared as:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
must be
const UINT uMyShowMsgChildApp = ...;
ahTriAuthor Commented:
Hi Migel, one more stupid question, where/how can I declair the constant for window status to pass through the WPARAM.
just assume that 1 will show window and 0 will hide it (of cource in main app and child app must be assued same things ;-)
or create common header and include it in the both app`s.
ahTriAuthor Commented:
I was asking about sintax, thanks
what syntax?
you can use windows definitions
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.