Closing AND HANDLING WINDOWS Multiple Open Delphi exe AND HANDLING WINDOWS
Posted on 2006-07-19
You help me with opening multiple exe and closing them. The reason why I opening this question again is as follows.
I have a EXE that acts as a Main Menu, the main menu call differnet delphi exe from the main form , depend on the user selection. PLEASE NOTE my main
menu form IS MY MENU APPLICATION, that's its only purpose to act as a MAIN MENU..
NOW I have a desktop ICON on the client computers that points to the main menu e.g c:\ABC\MainMenu.exe.
Once the user clicks on the Shortcut it will open the Main Menu. If a user click on a menu item, it will create a new process and a new window will show .....
This mean their will be currently two windows open.. (TheRealLoki help me to opening new windows and it work 100% and Also closing them work 100%).
NOW MY NEW QUESTION IS AS FOLLOWS:::
If the user open a menu item and the new window show, then I want this windows to act as a child form of the main menu, or vice versa. What I want to accomplish is the following. If the user minimize the main form or any other window created from my main menu it must minimize ALL the windows,
OR IF THE USER CLICK ON THE SAME MENU ITEM CREATED PREVIOUSLY IT MUST MAXIMIZED THAT WINDOW. I want to limit the user of handling this windows created by my application, because currently now, if he opens a menu item from the main menu that already exists it just make a beep and it does not maximize that window. here is my code what I try to accomplish from my main menu..
procedure TfrmMain.FormCreate(Sender: TObject);
prgName := ExtractFileName(Application.ExeName);
//Check if other instance exist
hMutex := CreateMutex(nil, False, pchar(prgName));
foundApp := not (WaitForSingleObject(hMutex, 0) <> wait_TimeOut);
if foundApplication then
instHdl := StrToInt(strHwnd);
PostMessage(Application.Handle, WM_QUIT, 0, 0);
To make this question as simple as possible. I want the following.
If My main menu are already running, and the user click on the desktop shortcut IT must not create the window again, IT MUST MAXIMIZE THE CURRENT MAIN MENU AND SET IT AS THE FOCUS WINDOW ON THE DESKTOP.. the same for menu items if the menu item are already opened, and the user have ALT-TAB back to the main menu and try to open the same menu item, it must maximized that open window.
AND FOR A BONUS IF IT IS POSSIBLE, if the user minimize one of my windows it must minimize all the windows, the reason for this IS SOMETIMES will the user is busy with my application a client phones and the client reuest a document from word, NOW the user must go and minimize all my application windows ONE BY ONE, and that is quite BAD..
THANK YOU for trying to help me