Click to See Complete Forum and Search --> : full path & file name from handle?
Xiquon
Mar 2nd, 2001, 09:27 AM
Is there a way to get the the full path and file name with only knowing the handle of the window?
Any code/api's will help.
http://www.vbsquare.com/tips/tip307.html
Has anyone found/written a method that works for Windows 2000? I've seen several that work for windows 98 but I need one for windows 2000 compatibility.
Thanks
PatrickCorgan
Mar 2nd, 2001, 10:54 PM
Shouldn't the snippets & functions & API calls & such like that work for 98 also work for 2000?
Not always. There are some pieces of code that work on 9x, but not NT and vice versa.
parksie
Mar 3rd, 2001, 05:19 PM
This one seemed to work when I tried it in 2000.
It only sort of works. On Windows 2000 it will only return the .EXE name of the given handle, but on Windows 9x it returns the entire path of the given handle. Does anyone have one that works for 2000?
parksie
Mar 3rd, 2001, 05:34 PM
DING DING DING!!!!
If in doubt, stick "Ex" on the end of something :rolleyes:
GetModuleFileNameEx
The GetModuleFileNameEx function retrieves the fully qualified path for the specified module.
DWORD GetModuleFileNameEx(
HANDLE hProcess, // handle to process
HMODULE hModule, // handle to module
LPTSTR lpFilename, // path buffer
DWORD nSize // maximum characters to retrieve
);This is definitely only NT4+, though.
Given the exe name, is there an API to get the title (form caption) if the application is running?
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.