PowerBASIC Forums
  Source Code
  Special Folders with COM but without Jazzage

Post New Topic  Post A Reply
profile | register | preferences | faq | search

UBBFriend: Email This Page to Someone! next newest topic | next oldest topic
Author Topic:   Special Folders with COM but without Jazzage
Wayne Diamond
Member
posted December 03, 2001 09:48 PM     Click Here to See the Profile for Wayne Diamond     Edit/Delete Message   Reply w/Quote
#COMPILE EXE
#INCLUDE "win32api.inc"

DECLARE FUNCTION CoInitialize LIB "ole32.dll" ALIAS "CoInitialize"( BYVAL pvReserved AS DWORD ) AS DWORD
DECLARE SUB CoUninitialize LIB "ole32.dll" ALIAS "CoUninitialize"

FUNCTION SpecialFolder(pidl AS DWORD) AS STRING
ON ERROR RESUME NEXT
LOCAL TmpAsciiz AS ASCIIZ * %MAX_PATH
CoInitialize 0
IF ISFALSE(SHGetSpecialFolderLocation(BYVAL %HWND_DESKTOP, BYVAL pidl, BYVAL VARPTR(pidl))) THEN
SHGetPathFromIDList BYVAL pidl, TmpAsciiz
CoTaskMemFree BYVAL pidl
END IF
CoUninitialize
FUNCTION = TmpAsciiz
END FUNCTION

FUNCTION PBMAIN() AS LONG
ON ERROR RESUME NEXT
MSGBOX "Windows Directory = " & SpecialFolder(%CSIDL_WINDOWS)
MSGBOX "System Directory = " & SpecialFolder(%CSIDL_SYSTEM)
MSGBOX "All Users\Start Menu\Programs = " & SpecialFolder(%CSIDL_COMMON_PROGRAMS)
MSGBOX "Current User\Start Menu\Programs = " & SpecialFolder(%CSIDL_PROGRAMS)
'For more folders (there must be about a hundred of them), search win32api.inc for "%CSIDL_DESKTOP"
END FUNCTION


Not taking anything away from the excellent Jazzage package of course


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

IP: Logged

Henk Broekhuizen
Member
posted December 11, 2001 11:57 AM     Click Here to See the Profile for Henk Broekhuizen     Edit/Delete Message   Reply w/Quote
In addition to save anyone else the trouble of cut-n-pasting
from the WIN32API.INC my PBMAIN version to get some more
directories. Please pay attention: on Win NT4 a lot of path
remain empty.


FUNCTION PBMAIN() AS LONG
LOCAL Tekst AS STRING
ON ERROR RESUME NEXT
Tekst= "Windows Directory = " & SpecialFolder(%CSIDL_WINDOWS) +$CR 'werkt niet bij NT?
Tekst=Tekst+ "System Directory = " & SpecialFolder(%CSIDL_SYSTEM)+$CR 'werkt niet bij NT?
Tekst=Tekst+ "Start menu\Programs = " & SpecialFolder(%CSIDL_PROGRAMS)+$CR
Tekst=Tekst+ "Personal = " & SpecialFolder(%CSIDL_PERSONAL)+$CR
Tekst=Tekst+ "Favorites = " & SpecialFolder(%CSIDL_FAVORITES)+$CR
Tekst=Tekst+ "Startup directory = " & SpecialFolder(%CSIDL_STARTUP)+$CR
Tekst=Tekst+ "Recent used documents = " & SpecialFolder(%CSIDL_RECENT)+$CR
Tekst=Tekst+ "Send to directory = " & SpecialFolder(%CSIDL_SENDTO)+$CR
Tekst=Tekst+ "Start menu = " & SpecialFolder(%CSIDL_STARTMENU)+$CR
Tekst=Tekst+ "Desktop directory = " & SpecialFolder(%CSIDL_DESKTOPDIRECTORY)+$CR
Tekst=Tekst+ "Desktop recycle bin = " & SpecialFolder(%CSIDL_BITBUCKET)+$CR
Tekst=Tekst+ "Current User\Start Menu\Programs = " & SpecialFolder(%CSIDL_PROGRAMS)+$CR
Tekst=Tekst+ "Start menu\Programs = " & SpecialFolder(%CSIDL_PROGRAMS)+$CR
Tekst=Tekst+ "All users startmenu = " & SpecialFolder(%CSIDL_COMMON_STARTMENU)+$CR
Tekst=Tekst+ "All Users\Start Menu\Programs = " & SpecialFolder(%CSIDL_COMMON_PROGRAMS)+$CR
Tekst=Tekst+ "All Users\Startup = " & SpecialFolder(%CSIDL_COMMON_STARTUP)+$CR
Tekst=Tekst+ "All Users\Desktop = " & SpecialFolder(%CSIDL_COMMON_DESKTOPDIRECTORY)+$CR
Tekst=Tekst+ "All Users\Application Data = " & SpecialFolder(%CSIDL_COMMON_APPDATA)+$CR
Tekst=Tekst+ "All Users\Templates = " & SpecialFolder(%CSIDL_COMMON_TEMPLATES)+$CR
Tekst=Tekst+ "All Users\Documents = " & SpecialFolder(%CSIDL_COMMON_DOCUMENTS)+$CR
Tekst=Tekst+ "all users\Admin tools <DIR> = " & SpecialFolder(%CSIDL_COMMON_ADMINTOOLS)+$CR
Tekst=Tekst+$CR
Tekst=Tekst+ "User profile = " & SpecialFolder(%CSIDL_PROFILE)+$CR
Tekst=Tekst+ "<user name>\Favorites = " & SpecialFolder(%CSIDL_FAVORITES)+$CR
Tekst=Tekst+ "<user name>\Recent = " & SpecialFolder(%CSIDL_RECENT)+$CR
Tekst=Tekst+ "<user name>\SendTo = " & SpecialFolder(%CSIDL_SENDTO)+$CR
Tekst=Tekst+ "<USER NAME>\Application DATA = " & SpecialFolder(%CSIDL_APPDATA)+$CR
Tekst=Tekst+ "<USER NAME>\PrintHood = " & SpecialFolder(%CSIDL_PRINTHOOD)+$CR
Tekst=Tekst+ "<USER NAME>\Nethood = " & SpecialFolder(%CSIDL_NETHOOD)+$CR
Tekst=Tekst+ "<user name>\Local Settings\Application Data (non roaming) = " & SpecialFolder(%CSIDL_LOCAL_APPDATA)+$CR
Tekst=Tekst+ "<user>\admin tools <DIR> = " & SpecialFolder(%CSIDL_ADMINTOOLS)+$CR
Tekst=Tekst+ "non localized startup = " & SpecialFolder(%CSIDL_ALTSTARTUP)+$CR
Tekst=Tekst+ "non localized common startup = " & SpecialFolder(%CSIDL_COMMON_ALTSTARTUP)+$CR
Tekst=Tekst+ "non roaming, user\Local Settings\Application Data = " & SpecialFolder(%CSIDL_LOCAL_APPDATA)+$CR
Tekst=Tekst+$CR
Tekst=Tekst+ "Common Favorites = " & SpecialFolder(%CSIDL_COMMON_FAVORITES)+$CR
Tekst=Tekst+ "C:\Program Files\Common = " & SpecialFolder(%CSIDL_PROGRAM_FILES_COMMON)+$CR
Tekst=Tekst+ "Internet cache = " & SpecialFolder(%CSIDL_INTERNET_CACHE)+$CR
Tekst=Tekst+ "Cookies = " & SpecialFolder(%CSIDL_COOKIES)+$CR
Tekst=Tekst+ "History = " & SpecialFolder(%CSIDL_HISTORY)+$CR
Tekst=Tekst+ "Program Files directory = " & SpecialFolder(%CSIDL_PROGRAM_FILES)+$CR
Tekst=Tekst+ "My Pictures directory = " & SpecialFolder(%CSIDL_MYPICTURES)+$CR
Tekst=Tekst+ "Windows\fonts = " & SpecialFolder(%CSIDL_FONTS)+$CR
Tekst=Tekst+ "Templates = " & SpecialFolder(%CSIDL_TEMPLATES)+$CR
Tekst=Tekst+ "x86 system directory on RISC = " & SpecialFolder(%CSIDL_SYSTEMX86)+$CR
Tekst=Tekst+ "x86 C:\Program Files on RISC = " & SpecialFolder(%CSIDL_PROGRAM_FILESX86)+$CR
Tekst=Tekst+ "x86 Program Files\Common on RISC = " & SpecialFolder(%CSIDL_PROGRAM_FILES_COMMONX86)+$CR
Tekst=Tekst+ "Network and Dial-up Connections = " & SpecialFolder(%CSIDL_CONNECTIONS)+$CR
Tekst=Tekst+ "Network Neighborhood = " & SpecialFolder(%CSIDL_NETWORK)+$CR
MSGBOX Tekst,,"Overview"
'For more folders (there must be about a hundred of them), search win32api.inc for "%CSIDL_DESKTOP"
END FUNCTION

Many thanks to Wayne and others for sharing their findings!

Regards,

Henk

------------------
Henk Broekhuizen,
pbforums@henkhenk.com
The Netherlands

IP: Logged

Van Cryce
Member
posted October 22, 2004 01:07 AM     Click Here to See the Profile for Van Cryce     Edit/Delete Message   Reply w/Quote
when i try to use this code i have an error:

Error 481 in C:\...\teste.bas(4:95):
Parameter mismatch with prior declaration
Line 4: DECLARE FUNCTION CoInitialize LIB "ole32.dll" ALIAS
"CoInitialize"( BYVAL pvReserved AS DWORD ) AS DWORD

I use PB7.04 in WinXP SP2

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

IP: Logged

Borje Hagsten
Member
posted October 22, 2004 04:35 AM     Click Here to See the Profile for Borje Hagsten     Edit/Delete Message   Reply w/Quote
A version that works with the latest declares exist at following link:

See: http://www.powerbasic.com/support/forums/Forum4/HTML/006408.html

------------------
PowerBASIC Staff
------------------
Private web-site: http://www.tolkenxp.com/pb
Free downloads: POFFS, incLean, PBcodec, custom controls and PB samples.

IP: Logged

All times are EasternTime (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | PowerBASIC BASIC Compilers

Copyright © 1999-2005 PowerBASIC, Inc. All Rights Reserved.


Ultimate Bulletin Board 5.45c