system32

forum.td.development (2005-2010)
Cheung Li

system32

Post by Cheung Li » 26 Nov 2009, 17:32

 Posted by:  Cheung Li 

Hi,

A very silly question : how to gte the windows system32 directory name by
using code?

Thanks and best regards,

KC

Jeff Luther
Site Admin
Site Admin
United States of America
Posts: 2166
Joined: 04 Mar 2017, 18:34
Location: Palm Springs, California

system32

Post by Jeff Luther » 26 Nov 2009, 19:28

 Posted by:  Jeff Luther 

Something like this should work. Find a file in system32 it should be
guaranteed to contain:

! include VT.apl

Set sWinSystem32 = VisFileFind( 'user32.dll' )

Then parse off the "\user32.dll" portion, since the return string includes
that.

- Jeff

Thomas Lauzi

system32

Post by Thomas Lauzi » 27 Nov 2009, 09:23

 Posted by:  Thomas Lauzi 

sWinDir = VisDosGetEnvString('WINDIR')
Set sDir = sWinDir || '\\System32'

Regards,
Thomas L.

Stefan Beltrame

system32

Post by Stefan Beltrame » 28 Nov 2009, 23:47

 Posted by:  Stefan Beltrame 

...and if you like to use a windows API function...

external function declaration:

!!CB!! 81
Library name: shell32.dll
ThreadSafe: No
Function: SHGetFolderPathA
Description:
Export Ordinal: 0
Returns
Number: LONG
Parameters
Window Handle: HWND
Number: INT
Number: HANDLE
Number: DWORD
Receive String: LPSTR
! Unicode version (>= TD 5.0)
! Function: SHGetFolderPathW
Description:
Export Ordinal: 0
Returns
Number: LONG
Parameters
Window Handle: HWND
Number: INT
Number: HANDLE
Number: DWORD
Receive String: LPWSTR

constants used:

!!CB!! 208
Number: CSIDL_SYSTEM = 0x25
Number: SHGFP_TYPE_CURRENT = 0
Number: MAX_PATH = 260

and how to call:

!!CB!! 174
Call SalStrSetBufferLength(sSystem32, MAX_PATH)
Call SHGetFolderPathA(hWndNULL, CSIDL_SYSTEM, 0, SHGFP_TYPE_CURRENT,
sSystem32)
Call SalMessageBox(sSystem32, 'Debug', MB_Ok)

sSystem32 must be declared ass a string variable of course.

In this way you are able to get diffrent windows predefined / standard
directories.

Regards
Stefan

Cheung Li

system32

Post by Cheung Li » 30 Nov 2009, 18:18

 Posted by:  Cheung Li 

Thank you

Return to “td.development”

Who is online

Users browsing this forum: [Ccbot] and 0 guests