[ VRKY @ 06.07.2004. 10:06 ] @
Ovaj kod ide u Moduel... On je namjenjen da traži Windows Folder a meni treba taki kod koji traži Program Files... može li neko to napravit za Program Files?

Code:
Public Const max_path = 260
Public Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" _
 (ByVal lpbuffer As String, ByVal nsize As Long) As Long
Public Function WinDir_func() As String
  Dim lpbuffer As String
  Dim windir As String
  lpbuffer = Space$(max_path)
  WinDir_func = Left$(lpbuffer, GetWindowsDirectory(lpbuffer, max_path)) 
' save default windows path in this variable :)
End Function
[ mladenovicz @ 06.07.2004. 10:23 ] @
Windows je sistemski folder i on je jednoznacan na sistemu i zato postoji funkcija kojom mozes da ga dobijes. Kad instaliras neki program, path moze da se customizije (znaci, ne mora da ide u program files, ili moze da bude program files na nekoj drugoj particiji).

Probaj da proveravas da li Program Files folder postoji u rootu svakog od driveova na sistemu (vidi top topic o FSO za neophodne funkcije). Znaci teoretski je moguce da postoji > 1 program Files foldera. Takodje, teoretski je moguce da Program Files ne bude u rootu drivea.
[ VRKY @ 06.07.2004. 10:28 ] @
Ne kužim ja to... Možeš li ti to kako pokušat napravit jer ja nemam pojma kako
[ mladenovicz @ 06.07.2004. 10:44 ] @
U ovoj poruci imas prolazak kroz sve driveove na sistemu. Potrebno je da type drivea bude Fixed. Onda u DriveLetter propertyju imas da li je C,D,E, ... Na DriveLetter konkateniras "Program Files" i proveravas da li postoji folder (FolderExists metod) C:\Program Files, D:\Program Files, ....
[ Ero S Ovoga Sveta @ 16.07.2004. 02:22 ] @
U Registry bazi u :HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir
stoji gdje se nalazi program files. Iscitaj odatle. A mislim da se na isttom mjestu nalazi i u NT platformi a i u WIN 9x platformi windowsa.
[ Shadowed @ 16.07.2004. 10:20 ] @
To ti je najsigurniji nacin a postoji i laksi. Koristi sistemsku promenljivu
%ProgramFiles%. Npr. Shell ("%ProgramFiles%\intenet explorer\iexplore.exe") pokrece IE.
[ VRKY @ 16.07.2004. 11:29 ] @
Kad upišem ovo što si rekao:
Code:

Shell ("%ProgramFiles%\intenet explorer\iexplore.exe")


Dođe mi error:


Run-Time error "53":
File not found
[ Shadowed @ 16.07.2004. 15:16 ] @
Vidi stvarno. Kad sam postovao disam stigao da prethodno proverim. A radi kada u konzoli kucas tu putanju. I u Start>Run... Nemam pojma zasto ne radi. Mislim da sam ranije radio sa ovim sistemskim promenljivima.
Pa nista, onda ti preostaje da procitas onu vrednost iz Registry-a (to je zapravo vrednost te sistemske promenljive).
[ Ero S Ovoga Sveta @ 17.07.2004. 02:19 ] @
Skoni ovaj class module u kome imes sve za rad sa registri-jem.:
http://solair.eunet.yu/~alas/misc/registry.zip

imenuj ga sa npr. "clsReg"


Code:

Dim Registri
Dim strKeyValue As String
Dim strHDD As String

Set Registri = New clsReg
    Registri.hkey = &H80000002
    Registri.KeyRoot = "SOFTWARE"
    Registri.Subkey = "Microsoft\Windows\CurrentVersion"
    
        strKeyValue = Registri.GetRegistryValue("ProgramFilesDir")
       
         strHDD = Left(strKeyValue, 3)
         
 Set Registri = Nothing


I dobio si gdje se nalazi Program Files.




______________________________________
Ero
[ VRKY @ 17.07.2004. 08:15 ] @
Misliš da stavim sve ono što sam skinuo sa tog sajta u class module,eli?
A što onda s ovim.... Di to treba stavit....

Code:

Dim Registri
Dim strKeyValue As String
Dim strHDD As String

Set Registri = New clsReg
    Registri.hkey = &H80000002
    Registri.KeyRoot = "SOFTWARE"
    Registri.Subkey = "Microsoft\Windows\CurrentVersion"
    
        strKeyValue = Registri.GetRegistryValue("ProgramFilesDir")
       
         strHDD = Left(strKeyValue, 3)
         
 Set Registri = Nothing


Ako ništa onda ti to napravi kako treba i uplodaj to ispod poruke....
[ Shadowed @ 17.07.2004. 10:27 ] @
Pa u strKeyValue ti se nalazi putanja. Taj kod stavis gde hoces (gde ti treba da pronadjes putanju).
[ mladenovicz @ 17.07.2004. 10:35 ] @
I probaj da koristis break pointe i Debug.Print
[ mladenovicz @ 13.08.2004. 18:10 ] @
Code:

Option Explicit

Private Declare Function SHGetSpecialFolderPath _
   Lib "shell32.dll" _
   Alias "SHGetSpecialFolderPathA" _
   (ByVal hWnd As Long, _
   ByVal lpszPath As String, _
   ByVal nFolder As Integer, _
   ByVal fCreate As Boolean) As Boolean

Private Const CSIDL_PROGRAM_FILES = &H26


Private Sub Form_Load()
 Dim blnReturn As Long
   Dim strBuffer As String
   strBuffer = Space(255)
   blnReturn = SHGetSpecialFolderPath(0, _
      strBuffer, _
      CSIDL_PROGRAM_FILES, _
      False)
      
   strBuffer = Left(strBuffer, InStr(strBuffer, Chr(0)) - 1)
   MsgBox strBuffer
End Sub
[ Aleksandar Ružičić @ 15.08.2004. 01:06 ] @
Ne mogu da skinem taj modul. FlashGet mi izbacuje poruku da path nije valid a kada pokusam bez flashget-a dobijem page not found!

Ako neko moze (ko je skinuo modul) nek mi posalje na mail, i meni treba jedan modul koji ima sve sa rad sa registrijem (ja sam po nekim sajtovima nakupio dosta toga ali nigde nemam modul koji moze da cita\pise binary vrednosti...pitam se dal' moze ovaj?)
[ VRKY @ 04.09.2004. 23:09 ] @
Ni ja nisam uspio skinuti onaj moduel.. a sad mi je potreban....
[ Ero S Ovoga Sveta @ 05.09.2004. 13:39 ] @
Evo u uploadu uz poruku.
[ VRKY @ 12.11.2004. 14:17 ] @
Poz.
Kolko je sigurno tražit lokaciju Program Filesa iz registrija? Isprobavao sam to i čini mi se OK....
[ VRKY @ 12.11.2004. 14:25 ] @
Evo još jedno pitanje, koje nema baš veze sa ovim ali ipak je malo povezano:
Spominjali ste ovu promjenjivu za PF:
Code:

%ProgramFiles%

A sad mene zanima imaju li take promjenjive za disk na kojem je Windows i Documents and Settings?
[ Shadowed @ 12.11.2004. 14:46 ] @
Ima. Sve su Registry-u.
[ mladenovicz @ 12.11.2004. 14:47 ] @
Environ Function Example
This example uses the Environ function to supply the entry number and length of the PATH statement from the environment-string table.

Code:


Dim EnvString, Indx, Msg, PathLen   ' Declare variables.
Indx = 1   ' Initialize index to 1.
Do
   EnvString = Environ(Indx)   ' Get environment 
            ' variable.
   If Left(EnvString, 5) = "PATH=" Then   ' Check PATH entry.
      PathLen = Len(Environ("PATH"))   ' Get length.
      Msg = "PATH entry = " & Indx & " and length = " & PathLen
      Exit Do
   Else
      Indx = Indx + 1   ' Not PATH entry,
   End If   ' so increment.
Loop Until EnvString = ""
If PathLen > 0 Then
   MsgBox Msg   ' Display message.
Else
   MsgBox "No PATH environment variable exists."
End If


Lista environment varijabli: My Computer, right click Properties, Advanced, Environment Variables
[ VRKY @ 13.11.2004. 19:04 ] @
@Shadowed
Možeš li reći točnije, znam za PF, I Windows D. ali me sad zanima za ono drugo (koje sam naveo).
[ Aleksandar Ružičić @ 13.11.2004. 21:17 ] @
Code:

Const CSIDL_DESKTOP = &H0
Const CSIDL_PROGRAMS = &H2
Const CSIDL_CONTROLS = &H3
Const CSIDL_PRINTERS = &H4
Const CSIDL_PERSONAL = &H5
Const CSIDL_FAVORITES = &H6
Const CSIDL_STARTUP = &H7
Const CSIDL_RECENT = &H8
Const CSIDL_SENDTO = &H9
Const CSIDL_BITBUCKET = &HA
Const CSIDL_STARTMENU = &HB
Const CSIDL_DESKTOPDIRECTORY = &H10
Const CSIDL_DRIVES = &H11
Const CSIDL_NETWORK = &H12
Const CSIDL_NETHOOD = &H13
Const CSIDL_FONTS = &H14
Const CSIDL_TEMPLATES = &H15
Const MAX_PATH = 260
Private Type SHITEMID
    cb As Long
    abID As Byte
End Type
Private Type ITEMIDLIST
    mkid As SHITEMID
End Type
Private Declare Function ShellAbout Lib "shell32.dll" Alias "ShellAboutA" (ByVal hWnd As Long, ByVal szApp As String, ByVal szOtherStuff As String, ByVal hIcon As Long) As Long
Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As ITEMIDLIST) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
Private Sub Form_Load()
    'KPD-Team 1998
    'URL: http://www.allapi.net/
    'E-Mail: [email protected]
    'Show an about window
    ShellAbout Me.hWnd, App.Title, "Created by the KPD-Team 1999", ByVal 0&
    'Set the graphical mode to persistent
    Me.AutoRedraw = True
    'Print the folders to the form
    Me.Print "Start menu folder: " + GetSpecialfolder(CSIDL_STARTMENU)
    Me.Print "Favorites folder: " + GetSpecialfolder(CSIDL_FAVORITES)
    Me.Print "Programs folder: " + GetSpecialfolder(CSIDL_PROGRAMS)
    Me.Print "Desktop folder: " + GetSpecialfolder(CSIDL_DESKTOP)
End Sub
Private Function GetSpecialfolder(CSIDL As Long) As String
    Dim r As Long
    Dim IDL As ITEMIDLIST
    'Get the special folder
    r = SHGetSpecialFolderLocation(100, CSIDL, IDL)
    If r = NOERROR Then
        'Create a buffer
        Path$ = Space$(512)
        'Get the path from the IDList
        r = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal Path$)
        'Remove the unnecessary chr$(0)'s
        GetSpecialfolder = Left$(Path, InStr(Path, Chr$(0)) - 1)
        Exit Function
    End If
    GetSpecialfolder = ""
End Function

CSIDL_PERSONAL ti je za MyDocuments.
[ VRKY @ 13.11.2004. 21:22 ] @
Ma to je sve OK, ali meni sam treba ona mala promjenjiva poput one:

Code:

%ProgramFiles%


I niš više. I još nešto, kolko je sigurno čitat putanju PF iz registrija
[ Aleksandar Ružičić @ 13.11.2004. 23:27 ] @
Ne razumem bas sta 'oces, al evo ocx kontrole koju sam napisao. Kontrola je zamena (nije bas neka, al dobro) za Comdlg.ocx i ima funkcije:
OpenFile
SaveFile
PickFolder
GetSpecialFolder
Jednostavno je postavis na formu (a mozez i da iscupas parce koda koje ti treba) i koristis GetSpecialFolder f-ju.

http://www.elitesecurity.org/poruka/fajluzporuku/494604
[ VRKY @ 14.11.2004. 08:12 ] @
Ma nije to to! Krivo si me shvatio. Meni treba ona promjenjiva ko ona koju je Shadowed prvu postovao... Znači:
Code:

%ProgramFiles%


To radi u DOS-u, ja znam tako promjenjivu i za win folder, ali mi još treba za Documents and Settings i disk na kojem je Win. Znam da to postoji jer sam negdje vidio ali sam zaboravio gdje....
[ reiser @ 14.11.2004. 14:08 ] @
Startuj Delphi, zatim idi Tools -> Environment Options i jezicak Environment Variables.
[ Shadowed @ 14.11.2004. 14:09 ] @
VRKY, toga u Registry-u ima na dosta mesta pa me, pravo da ti kazem, mrzi da sakupljam sve kljuceve (ne znam ni ja bas, bas ceo Registry napamet :)).
Evo nekih sistemskih promenljivih a ti potrazi jos:
%AppData%
%UserProfile%
%AllUsersProfile%
%ProgramFiles%
%SystemRoot%
%SystemDrive%
%Temp%
%Tmp%
[ VRKY @ 14.11.2004. 14:45 ] @
@Shadowed
Hvala, to mi je trebalo.