You were right. If I give the process a small amount of time to open 
Notepad, it works just fine. And I've now succeeded in removing the 
maximize, minimize and close buttons.
My last challenge is to delete various options from the drop-down 
menus in Notepad, such as File->New, File->Open, etc. If I have a 
handle to Notepad, how can I get access to its menus and alter them?

Thank again.


--- In [email protected], Thomas Hruska <[EMAIL PROTECTED]> wrote:
>
> remarknibor wrote:
> > Once I've done 'CreateProcess()' to open Notepad, it's process id 
can 
> > be found at pi.dwProcessId (where pi is the PROCESS_INFORMATION 
> > structure)?
> > Therefore, I should use EnumWindows to compare windows' 
processids to 
> > that one? Something like:
> > 
> > HWND notepadHandle;
> > 
> > BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam) {
> >     DWORD processId;
> >     DWORD threadId = GetWindowThreadProcessId(hWnd,&processId);
> >     if(processId == pi.dwProcessId) {
> >         notepadHandle = hWnd;
> >         return FALSE;  //Correct window - stop enum
> >     }
> >     return TRUE; //Continue enum
> > }
> > 
> > EnumWindows(EnumWindowsProc, 0); (in main())
> > 
> > Then I will have the correct handle to the Notepad window stored 
> > at 'notepadHandle?
> > (Obviously, something is wrong with this as it doesn't work. 
Could 
> > you help me to figure out what it is?)
> > 
> > Thanks.
> 
> It should work.  The problem is most likely you aren't waiting for 
the 
> process to actually create the window.
> 
> -- 
> Thomas Hruska
> CubicleSoft President
> Ph: 517-803-4197
> 
> *NEW* MyTaskFocus 1.1
> Get on task.  Stay on task.
> 
> http://www.CubicleSoft.com/MyTaskFocus/
>


Reply via email to