Click here to Skip to main content
15,892,005 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to design a 2D Map designer in a worskpace MDI application Pin
bouli3-Aug-05 9:44
bouli3-Aug-05 9:44 
GeneralRe: How to design a 2D Map designer in a worskpace MDI application Pin
Blake Miller3-Aug-05 10:26
Blake Miller3-Aug-05 10:26 
AnswerRe: How to design a 2D Map designer in a worskpace MDI application Pin
Graham Bradshaw3-Aug-05 13:00
Graham Bradshaw3-Aug-05 13:00 
Generalpls help: Access Violation Pin
valerie993-Aug-05 9:14
valerie993-Aug-05 9:14 
GeneralRe: pls help: Access Violation Pin
David Crow3-Aug-05 10:18
David Crow3-Aug-05 10:18 
GeneralRe: pls help: Access Violation Pin
valerie993-Aug-05 10:40
valerie993-Aug-05 10:40 
GeneralRe: pls help: Access Violation Pin
Blake Miller3-Aug-05 10:28
Blake Miller3-Aug-05 10:28 
GeneralRe: pls help: Access Violation Pin
valerie993-Aug-05 10:53
valerie993-Aug-05 10:53 
GeneralRe: pls help: Access Violation Pin
valerie993-Aug-05 12:48
valerie993-Aug-05 12:48 
GeneralCalibration in ATM machines Pin
celllllllll3-Aug-05 7:52
celllllllll3-Aug-05 7:52 
GeneralRe: Calibration in ATM machines Pin
Maximilien3-Aug-05 8:15
Maximilien3-Aug-05 8:15 
GeneralRe: Calibration in ATM machines Pin
celllllllll3-Aug-05 8:23
celllllllll3-Aug-05 8:23 
GeneralRe: Calibration in ATM machines Pin
GKarRacer3-Aug-05 8:36
GKarRacer3-Aug-05 8:36 
GeneralRe: Calibration in ATM machines Pin
celllllllll3-Aug-05 12:16
celllllllll3-Aug-05 12:16 
GeneralRe: Calibration in ATM machines Pin
GKarRacer3-Aug-05 13:18
GKarRacer3-Aug-05 13:18 
IsWindow simply returns TRUE or FALSE if the specified window handle is a valid window or not. So, if it suddenly returned FALSE, obviously the window is no longer around.

Example:

HWND hWnd = FindWindow(....);
while( true )
{
   if( ! IsWindow(hWnd) )
      break;     // window is gone;
   Sleep(1000);  // wait a second for window to close
};

This is the quick and crude method. Find the window handle and periodically poll to see if the window still exists.

You can also do the same thing without polling by using a window hook. Lookup SetWindowsHook and CBTProc for more information.

To wait for the process to complete rather than the window. You need to get a process handle that's associated with that window and wait for it to close. This method, of course, will only work if the process doesn't live on after the window is destroyed.

Pseudo Example (error checking removed for brevity):

HWND   hWnd = FindWindow(...);
DWORD  ProcID;
DWORD  ThrdID = 0;
HANDLE hProcess;

ThrdID = GetWindowThreadProcessId( hWnd, &ProcID );
hProcess = OpenProcess( SYNCRONIZE, FALSE, ProcID );

// Wait for the process to complete
WaitForSingleObject( hProcess, INFINITE );
CloseHandle(hProcess);

GeneralRe: Calibration in ATM machines Pin
celllllllll3-Aug-05 14:00
celllllllll3-Aug-05 14:00 
GeneralRe: Calibration in ATM machines Pin
GKarRacer4-Aug-05 6:16
GKarRacer4-Aug-05 6:16 
GeneralRe: Calibration in ATM machines Pin
celllllllll4-Aug-05 8:32
celllllllll4-Aug-05 8:32 
GeneralRe: Calibration in ATM machines Pin
GKarRacer4-Aug-05 9:03
GKarRacer4-Aug-05 9:03 
GeneralRe: Calibration in ATM machines Pin
celllllllll4-Aug-05 11:15
celllllllll4-Aug-05 11:15 
GeneralRe: Calibration in ATM machines Pin
GKarRacer4-Aug-05 11:42
GKarRacer4-Aug-05 11:42 
GeneralRe: Calibration in ATM machines Pin
celllllllll4-Aug-05 12:13
celllllllll4-Aug-05 12:13 
GeneralRe: Calibration in ATM machines Pin
celllllllll5-Aug-05 5:58
celllllllll5-Aug-05 5:58 
GeneralRe: Calibration in ATM machines Pin
GKarRacer5-Aug-05 10:11
GKarRacer5-Aug-05 10:11 
GeneralRe: Calibration in ATM machines Pin
celllllllll5-Aug-05 11:53
celllllllll5-Aug-05 11:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.