Hi to all,
How can i access Application data folder irrespective of which OS we have using VB6.0 code?
Is there anything like the one 'app.path'?
Please help me on this...
Hi to all,
How can i access Application data folder irrespective of which OS we have using VB6.0 code?
Is there anything like the one 'app.path'?
Please help me on this...
There's a mix-up in the thread between the program's install folder and the OS "Application Data" folder. asked for the Application Data path; is right that App.Path returns the folder where the EXE lives, but that is not the per‑user Application Data folder. 's point about installers is correct for the installation directory (Program Files), but user data and settings should normally go to the OS special folder instead.
Simplest, reliable VB6 approach (returns the per‑user roaming AppData path):
Dim wsh As Object
Dim sAppData As String
Set wsh = CreateObject("WScript.Shell")
sAppData = wsh.SpecialFolders("AppData") ' Roaming AppData for the current user
Set wsh = Nothing A quick fallback that works in many environments is Environ$("APPDATA"), but environment variables can be absent in some service/limited contexts so the WScript.Shell method is more robust.
For full compatibility and to select Roaming vs Local vs Common (all users) explicitly, use the Shell API (SHGetFolderPath with the appropriate CSIDL). A common VB6 declaration and use is:
Private Declare Function SHGetFolderPath Lib "shfolder.dll" Alias "SHGetFolderPathA" _
(ByVal hwndOwner As Long, ByVal nFolder As Long, ByVal hToken As Long, ByVal dwFlags As Long, _
ByVal pszPath As String) As Long
Const CSIDL_APPDATA = &H1A
Const CSIDL_LOCAL_APPDATA = &H1C
Const CSIDL_COMMON_APPDATA = &H23 Then call it with a buffer and trim at the first null to get the real path.
Notes and cautions: prefer AppData for user‑writable settings; avoid writing to Program Files at runtime (modern Windows versions restrict writes without elevation). Use per‑user Roaming AppData for user settings that should roam with profiles, Local AppData for machine‑local caches, and Common AppData for data shared by all users.
Jump to Post— AV Manoharan 0Application path is set by your installation program. Other wise if you want all the applications that are installed under an OS (windows), you have to search the registry and/or the directory ..\Program Files\the name of the directory containing the application. Normally they have the mnemonic names of the applications.
Application path is set by your installation program. Other wise if you want all the applications that are installed under an OS (windows), you have to search the registry and/or the directory ..\Program Files\the name of the directory containing the application. Normally they have the mnemonic names of the applications.
hello Paramasivan S.,
DougT have already answered you in http://www.xtremevbtalk.com/showthread.php?t=284768
Then why're you roaming?
I don't get the question???!!! App.Path will get the application path for you. What else would you need?
Application path is set by your installation program. Other wise if you want all the applications that are installed under an OS (windows), you have to search the registry and/or the directory ..\Program Files\the name of the directory containing the application. Normally they have the mnemonic names of the applications.
I don't think it has anything to do with an installer. He simply asked regarding VB6 Code :)
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.