Hi
When I use RegQueryValue() to get the string to run an executable to which I wish to pass a parameter why must I remove the last character on the return value?
In the following sample program. After the first call to WordPad no file is opened, however on the second call the file opens as expected.
Thanks,
Vytas
// Managing Register services from FiveWin
#ifndef __XPP__
#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
#else
#define HKEY_CLASSES_ROOT 1
#define HKEY_CURRENT_USER 2
#define HKEY_LOCAL_MACHINE 3
#define HKEY_USERS 4
#define HKEY_PERFORMANCE_DATA 5
#define HKEY_CURRENT_CONFIG 6
#define HKEY_DYN_DATA 7
#endif
//---------------------------------------------------------------------------//
function Main()
local nHandle, cValue
if RegOpenKey( HKEY_LOCAL_MACHINE,;
"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths", @nHandle ) == 0
RegQueryValue( nHandle, "WordPad.exe", @cValue )
MsgInfo( cValue )
WaitRun(cValue + " testreg.prg")
WaitRun(SUBSTR(cValue,1,(LEN(cValue)-1)) + " testreg.prg")
RegCloseKey( nHandle )
else
MsgAlert( "Can't open this key" )
endif
return nil
//---------------------------------------------------------------------------//
procedure AppSys // XBase++ requirement
return
//---------------------------------------------------------------------------//
ReqQueryValue behaviour
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: ReqQueryValue behaviour
Because the value returned is a zero-terminated string.
EMG
EMG