GetWindow/GetModuleFileName

GetWindow/GetModuleFileName

Postby Otto » Fri Jul 28, 2006 8: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
User avatar
Otto
 
Posts: 6322
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » Fri Jul 28, 2006 8: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42077
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Otto » Fri Jul 28, 2006 9:22 am

Do you have a list of all the function I have to change.
Thanks in advance
Otto
User avatar
Otto
 
Posts: 6322
Joined: Fri Oct 07, 2005 7:07 pm

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 77 guests