Page 1 of 1

GetWindow/GetModuleFileName

PostPosted: Fri Jul 28, 2006 8:43 am
by Otto
Tested with XP.
This code works here with FW but not with FWH.
FHW: msginfo(cTask) has always the same value.


Regards
Otto


#INCLUDE "BOX.CH"
#INCLUDE "FILEIO.CH"
#INCLUDE "FIVEWIN.CH"
#INCLUDE "FOLDER.CH"
#INCLUDE "INKEY.CH"
#INCLUDE "REPORT.CH"
#define BIF_RETURNONLYFSDIRS 1
#define BIF_DONTGOBELOWDOMAIN 2
#define MAX_PATH 260

#DEFINE SW_MINNOACTIVE 7
#DEFINE INCHES 1
#DEFINE CMETERS 2
#define GHW_HWNDFIRST 0
#define GHW_HWNDNEXT 2
#define GWW_HINSTANCE -6

static oWnd

function Main()
LOCAL oWnd

SET CENTURY ON
SET DELETED on

DEFINE WINDOW oWnd from 1,1 TO 30,60 TITLE "Start";
MENU bldMenu()
ACTIVATE WINDOW oWnd

return nil

function bldMenu()
LOCAL oMenu
MENU oMenu
MENUITEM "Start" ;
ACTION f_code()
ENDMENU

return oMenu

func f_code
LOCAL hWnd := GetWindow( GetActiveWindow(), GHW_HWNDFIRST )
LOCAL cTask := ""
*--------------------------------------------

while hWnd != 0
cTask = GetModuleFileName( GetWindowWord( hWnd, GWW_HINSTANCE ) )
msginfo(cTask)
hWnd = GetWindow( hWnd, GHW_HWNDNEXT )
end


return nil

PostPosted: Fri Jul 28, 2006 8:53 am
by Antonio Linares
Otto,

In 32 bits you have to use GetWindowLong() instead of GetWindowWord():

cTask = GetModuleFileName( GetWindowLong( hWnd, GWW_HINSTANCE ) )

PostPosted: Fri Jul 28, 2006 9:22 am
by Otto
Do you have a list of all the function I have to change.
Thanks in advance
Otto

PostPosted: Fri Jul 28, 2006 12:30 pm
by Antonio Linares
Otto,

I suggest you to use and review Microsoft help files for Win16 and Win32 APIs. Its not a FWH issue.

Basically if we move from 16 bits to 32 bits, then we are going to use longs (32 bits) instead of words (16 bits).

You may find in Google a complete list of differences between both APIs.