FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Registry function - something changed ?
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Registry function - something changed ?
Posted: Wed Nov 04, 2009 11:33 AM

Hi,
is something changed into the FWH registry functions ?
I need to find the winword.exe path and this function that scan the windows registry doesn't runs anymore with FWH9.10

Any ideas ?

define HKEY_CLASSES_ROOT 2147483648

define HKEY_CURRENT_USER 2147483649

define HKEY_LOCAL_MACHINE 2147483650

define HKEY_USERS 2147483651

define HKEY_PERFORMANCE_DATA 2147483652

define HKEY_CURRENT_CONFIG 2147483653

define HKEY_DYN_DATA 2147483654

include "FiveWin.ch"

function Main()

cPath:=FileFind("WINWORD.EXE")
msginfo(cPath)

RETURN

function filefind
paramet cFile

local cValue,nhandle

cValue:=""
if RegOpenKey( HKEY_LOCAL_MACHINE,"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths", @nHandle ) == 0
    RegQueryValue( nHandle, cFile, @cValue )
    RegCloseKey( nHandle )
    msginfo(cValue)
    cValue:=ansitooem(cValue)
    cValue:=alltrim(cValue)
    cValue:=substr(cvalue,1,len(cvalue)-1)
endif
return(cValue)
Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Registry function - something changed ?
Posted: Wed Nov 04, 2009 01:22 PM

Hello Marco,
I create a word-object to get the path.
Best regards,
Otto

       oWord := CREATEOBJECT( "Word.Application" )
        if VAL(oword:Version) < 12
           msginfo("Sie haben nicht die notwendige WINWORD-Version installiert!")
           WritePProString( "SETUPDATEN", "TXTProgramm",  "kein WINWORD installiert", ".\INI\WINHOTEL.INI" )
        else
           if MsgYesNo( oword:path  + CRLF + "   Soll der Pfad gespeichert werden?") = .t.
              WritePProString( "SETUPDATEN", "TXTProgramm",  oword:path+"\WINWORD.EXE", ".\INI\WINHOTEL.INI" )
              WritePProString( "SETUPDATEN", "WORD_12", "erledigt", ".\INI\UPDATE.INI"  )
           endif
        endif
        oWord := NIL
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: Registry function - something changed ?
Posted: Wed Nov 04, 2009 01:54 PM

Hello Otto,
thank for your suggest.

Unfortunately I need to find also executables that hasn't an OLE capacity
so I need to search the path into the windows registry in any case.

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Registry function - something changed ?
Posted: Wed Nov 04, 2009 03:45 PM

Marco,

Have you checked manually to make sure that Winword.exe is in the registry?

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: Registry function - something changed ?
Posted: Wed Nov 04, 2009 04:05 PM

Yes, this is a standard registry path and with FWH May 2009 it runs fine

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Registry function - something changed ?
Posted: Wed Nov 04, 2009 04:09 PM

Marco,

I suggest looking at \source\winapi\registry.prg in the two FWH versions and checking the dates to see if it has been changed.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: Registry function - something changed ?
Posted: Wed Nov 04, 2009 04:18 PM

Checking. I think there is a bug in FWH9.10.
There is also testreg.prg into the samples FWH dir that doesn't runs with FWH9.10 but runs well with FWH April 2009

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Registry function - something changed ?
Posted: Wed Nov 04, 2009 06:16 PM
Marco,

We worked on the registry function and left a bug there. This is the right fix for source\winapi\regedit.c:
Code (fw): Select all Collapse
HB_FUNC( REGOPENKEY ) // ( nkey, cSubKey, @nHandle ) --> nResult
{
   HKEY hKey = ( HKEY ) hb_parnl( 1 );
   HKEY hResult;
 
   #ifndef UNICODE
      hb_retnl( RegOpenKey( hKey, hb_parc( 2 ), &hResult ) );
      hb_stornl( ( LONG ) hResult, 3 );
   #else
      LPWSTR pW = AnsiToWide( hb_parc( 2 ) );
      hb_retnl( RegOpenKeyEx( hKey, pW, 0, ( REGSAM ) hb_parnl( 3 ), &hResult ) );   
      hb_stornl( ( LONG ) hResult, 3 );
      hb_xfree( pW );
   #endif   
}

FWH\samples\TestReg.prg is properly working here now, thanks :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion