FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour GetWindow/GetModuleFileName
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
GetWindow/GetModuleFileName
Posted: Fri Jul 28, 2006 08:43 AM

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

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
GetWindow/GetModuleFileName
Posted: Fri Jul 28, 2006 08:53 AM

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
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
GetWindow/GetModuleFileName
Posted: Fri Jul 28, 2006 09:22 AM

Do you have a list of all the function I have to change.
Thanks in advance
Otto

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
GetWindow/GetModuleFileName
Posted: Fri Jul 28, 2006 12:30 PM

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

Continue the discussion