But if you run this code:MSDN wrote:GetWindowModuleFileName
The GetWindowModuleFileName function retrieves the full path and file name of the module associated with the specified window handle.
ParametersCode: Select all
UINT WINAPI GetWindowModuleFileName( HWND hwnd, // handle to window LPTSTR lpszFileName, // file name buffer UINT cchFileNameMax // max size of file name buffer );
hwnd
[in] Handle to the window whose module file name will be retrieved.
lpszFileName
[out] Pointer to a buffer that receives the path and file name.
cchFileNameMax
[in] Specifies the maximum number of TCHARs that can be copied into the lpszFileName buffer.
Return Values
The return value is the total number of TCHARs copied into the buffer.
Code: Select all
Procedure.l EnumWindowsProc_(lhWnd.l, lJunk.l)
If GetWindowModuleFileName_(lhWnd, @sFileName.s{#MAX_PATH}, #MAX_PATH)
If GetWindowText_(lhWnd, @sWindowTitle.s{#MAX_PATH}, #MAX_PATH)
WriteString(0, Trim(StrU(lhWnd, #Long))+#TAB$)
WriteString(0, Trim(sFileName)+#TAB$)
WriteStringN(0, Trim(sWindowTitle))
EndIf
EndIf
ProcedureReturn #True
EndProcedure
If CreateFile(0, GetPathPart(ProgramFilename())+"WindowList.csv")
WriteString(0, "WindowHandle"+#TAB$)
WriteString(0, "FileName"+#TAB$)
WriteStringN(0, "WindowTitle")
EnumWindows_(@EnumWindowsProc_(), #Null)
CloseFile(0)
EndIf
EndAny ideas or am I doing something wrong?

