Sorry but i'm just a newbie. can you guide me on how to use the Findwindow and WM_CLOSE
Currently i just coded
HWND winHandle
winHandle = FindWindow(what should i put here,NULL)
I know thats for the class name but how do i know the class name.
Thanks
or should i do this..
CWnd* pWnd=CWnd::FindWindows(_T("Does anyone know the classfile for WMP",NULL);
if(pWnd)
pWnd->SendMessage(WM_CLOSE);
Try using the Remote Spy++ program in eVC to find out what the window is called
here is what the help file says about closing an app:
Terminating a Process
The most common way to terminate a process is to have it return from a WinMain function call. You can also terminate a process by having the primary thread of the process call the ExitThread function. A Windows CE process automatically terminates if its primary thread is terminated, even if there are other active threads in existence for the process. ExitThread returns the exit code of the process. You can determine the exit code of a process by calling the GetExitCodeProcess function. Specify the handle to the process, which you can obtain by calling the CreateProcess or OpenProcess function; the function returns the exit code. If the process is still running, the function returns the STILL_ACTIVE termination status.
There are also other, less common, ways of terminating a process:
Use interprocess synchronization to instruct the process to terminate itself.
For more information on using interprocess communication to terminate a process, see Interprocess Synchronization.
If the process has a message queue, send a WM_CLOSE message to the main window of the process. An application might not close if it does not receive this message and might display a message box.
Use the TerminateProcess function, which does not notify any attached DLLs that the process is terminating. This method should be used as a last resort.
Note A process immediately terminates if a related secondary thread generates an unhandled exception. This is a change in behavior from Windows CE version 2.10 or earlier.
cryo
Thanx...
I use this
CWnd* pWnd=CWnd::FindWindows(NULL,_T("Windows Media Player");
if(pWnd)
pWnd->SendMessage(WM_CLOSE);