Page 1 of 1
How to detect the programs folder
Posted: Sat Feb 04, 2006 10:58 am
by Piscicelli Zingoni
Hi, i forgot how to detect the standard folder programs, example C:\PROGRAMS (english) or
C:\PROGRAMMI (ITALIAN)
In particular i installed a PDF995 printer driver and i need to know where it is located to modify at runtime a pdf995.ini file.
It seems placed in c:\programs\pdf995 under w2000 but under XP i found it in c:\pdf995 (!).
and under Win9x ?
tks
Piscicelli/zingoni
Re: How to detect the programs folder
Posted: Sat Feb 04, 2006 12:27 pm
by Enrico Maria Giordano
Piscicelli Zingoni wrote:Hi, i forgot how to detect the standard folder programs, example C:\PROGRAMS (english) or
C:\PROGRAMMI (ITALIAN)
Code: Select all
#define HKEY_CURRENT_USER 2147483649
#define HKEY_LOCAL_MACHINE 2147483650
#define KEY_ALL_ACCESS 983103
FUNCTION GETDESKDIR()
LOCAL hKey := 0
LOCAL nType := 0
LOCAL cData := SPACE( 256 )
LOCAL nSize := LEN( cData )
REGOPENKEY( HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", 0, KEY_ALL_ACCESS, @hKey )
REGQUERYVALUE( hKey, "Desktop", 0, @nType, @cData, @nSize )
REGCLOSEKEY( hKey )
RETURN LEFT( cData, AT( CHR( 0 ), cData ) - 1 )
FUNCTION GETPROGDIR()
LOCAL hKey := 0
LOCAL nType := 0
LOCAL cData := SPACE( 256 )
LOCAL nSize := LEN( cData )
IF !ISWINNT()
REGOPENKEY( HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", 0, KEY_ALL_ACCESS, @hKey )
REGQUERYVALUE( hKey, "Programs", 0, @nType, @cData, @nSize )
ELSE
REGOPENKEY( HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", 0, KEY_ALL_ACCESS, @hKey )
REGQUERYVALUE( hKey, "Common Programs", 0, @nType, @cData, @nSize )
ENDIF
REGCLOSEKEY( hKey )
RETURN LEFT( cData, AT( CHR( 0 ), cData ) - 1 )
DLL32 FUNCTION REGOPENKEY( hKey AS LONG, cSubKey AS LPSTR, nOptions AS DWORD, nSamDesired AS DWORD, @nHandle AS PTR ) AS LONG;
PASCAL FROM "RegOpenKeyExA" LIB "advapi32.dll"
DLL32 FUNCTION REGQUERYVALUE( hKey AS LONG, cValueName AS LPSTR, nReserved AS LONG, @nType AS PTR, @cData AS LPSTR, @nSize AS PTR ) AS LONG;
PASCAL FROM "RegQueryValueExA" LIB "advapi32.dll"
DLL32 FUNCTION REGCLOSEKEY( hKey AS LONG ) AS LONG;
PASCAL FROM "RegCloseKey" LIB "advapi32.dll"
EMG
Posted: Sat Feb 04, 2006 1:16 pm
by Piscicelli Zingoni
Questa non mi vanno bene perche' mi dicono dove e' il folder del menu' avvio\programmi.
Forse ho posto io male la domanda: installando il pdf995 non mi chiede nessuna conferma di cartella di installazione ma crea su c:\programmi\pdf995 (cartella) dove mette dentro il programma mentre in
C:\Documents and Settings\All-Users\Menu Avvio\Programmi mette altre cose (link htm) a me interessa sapere DI C:\PROGRAMMI (se italiano) o C:\PROGRAMS (se inglese) ecc.. insomma dove si trova effettivamente il software.
Per un possibile test puoi scaricarti da
www.pdf995.com (area download) pdf995 Printer Driver e il Free Converter
Grazie
Posted: Sat Feb 04, 2006 1:19 pm
by Enrico Maria Giordano
Piscicelli Zingoni wrote:Questa non mi vanno bene perche' mi dicono dove e' il folder del menu' avvio\programmi.
No, le funzioni che ti ho messo sono due. Quella che serve a te รจ la GETPROGDIR().
EMG