Opening one instance of a filetype
Hi,
I want to open a file (type-independent), but there should be no more than one instance of the specified file. ie. when one uses ShellExecute( ....,"open", "notepad", ...., SW_SHOWNORMAL ); twice, there should be only one instance of notepad. (Notepad is not the real target program, but used as an example)
I figured that if i could get the window-title from a file name (like notepad.exe to "Untitled - Notepad") then i would be able to use FindWindow to check wether there's an instance running or not. Is this the right way, or should i do this otherwise? Any suggestions?
Re: Opening one instance of a filetype
the window title is bad in most cases. Imagine notepad is open and the user opened file "c:\test.txt". Then, the title is "c:\test.txt - notepad".
The class name of the top-level window of the application is probably better. You can also search for a class name using findwindow.
Re: Opening one instance of a filetype
Hello,
Thank you for your reply. You're absolutely right about the difference between className and title. But even so, how do i find the className given a filename like c:\winnt\notepad.exe?
Once i can retreive the className, my problem is solved, so i you can help me, please...
grthnx,
Paul Kuijer