Registry function - something changed ?

Registry function - something changed ?

Postby Marco Turco » 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
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: Registry function - something changed ?

Postby Otto » Wed Nov 04, 2009 1: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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6329
Joined: Fri Oct 07, 2005 7:07 pm

Re: Registry function - something changed ?

Postby Marco Turco » Wed Nov 04, 2009 1: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
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: Registry function - something changed ?

Postby James Bott » Wed Nov 04, 2009 3:45 pm

Marco,

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

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Registry function - something changed ?

Postby Marco Turco » Wed Nov 04, 2009 4:05 pm

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

Marco Turco
SOFTWARE XP LLP
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: Registry function - something changed ?

Postby James Bott » Wed Nov 04, 2009 4: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Registry function - something changed ?

Postby Marco Turco » Wed Nov 04, 2009 4: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
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: Registry function - something changed ?

Postby Antonio Linares » Wed Nov 04, 2009 6: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: Select all  Expand view

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 76 guests