GetWindow/GetModuleFileName

Post Reply
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

GetWindow/GetModuleFileName

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Otto,

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

cTask = GetModuleFileName( GetWindowLong( hWnd, GWW_HINSTANCE ) )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Do you have a list of all the function I have to change.
Thanks in advance
Otto
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply