Page 1 of 1

GETPROGDIR()

PostPosted: Mon Sep 17, 2007 3:42 pm
by Romeo
Hi,
is it possible to kwnow where VISTA puts (the folder) the program menu installed ?

Undex XP i used the function GETPROGDIR() the retrieve it, but undex VISTA it does not work.

Undex XP i usually got the folder:

C:\Documents and Settings\All Users\Starts Menu\Programs\MY-FODER

where MY-FOLDER is my searched folder.

Any help ?
tks
Romeo/Zingoni



--------------------------------------------------------------------------------

Salve,
sapete dove mette VISTA i programmi che si installano con la procedura di FWIN/HARBOUR ?
Per intenderci quelli che usano:
*************
DEFINE DDE oDDE ;
SERVICE "Progman" ;
TOPIC "Progman"
ACTIVAT DDE oDDe

oDDE:Execute(....)
.
.
RELEASE DDE oDDE
***************
Con XP va tutto bene, mantre con VISTA creo correttamente il gruppo ma non so (in che cartella) lo va a scrivere.

Usavo la funzione recuperata sul forum GESTPROGDIR() per saperlo e con XP funziona ma VISTA la va a mettere in una stranissima cartella.

C'e' in giro qualche funzione per recuperarla !

Grazie

Romeo/Zingoni

PostPosted: Mon Sep 24, 2007 8:52 am
by Antonio Linares
Romeo,

> Undex XP i used the function GETPROGDIR() the retrieve it

What function is that one ? It does not seems to be a FW/FWH one

PostPosted: Mon Sep 24, 2007 10:40 am
by Enrico Maria Giordano
I think it's mine:

Code: Select all  Expand view
#define HKEY_CURRENT_USER  2147483649
#define HKEY_LOCAL_MACHINE 2147483650

#define KEY_ALL_ACCESS 983103


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

PostPosted: Mon Sep 24, 2007 10:50 am
by Antonio Linares
Enrico,

Thanks! :-)

PostPosted: Mon Sep 24, 2007 12:42 pm
by nageswaragunupudi
Mr. Enrico

Excellant.

I am now using the following for the above purpose.
Code: Select all  Expand view
GetObject('WScript.Shell'):SpecialFolders:Item('AllUsersPrograms')


(Getobject is my function which is nothing but try GetActiveObect cach createobject ... )

This is working on XP and 2000/2003. I personally dont have access to other windows versions.

Can you or anyone else please advise if this works on other versions too? In particular Vista ?

Regards

Nageswara Rao