Forum » Programiranje » Visual Basic
Visual Basic
Caniggia ::
Rad bi poganjal en program, ki sem ga napisal v VB prek CD-ja. Na racunalnikih, ki je instaliran VB ni tezav, na drugih pa zahteva neke Dll-je. Ali je mozno, da bere te dll s cd-ja, ker je pomembno, da program dela na vseh rac. brez da ga je potrebno prej instalirat.
webblod ::
Torej, za delovanje potrebuje VB program več RTL (Run Time Library). Poleg osnovnih RTL, pa je potrebno programu priložiti še vse knjižnice in komponente, ki so uporabljene v programu.
Tudi sam pišem mrežne programe, kjer je problem podoben (beri enak).
Zadeva bi vzela kar nekaj prostora, da bi ti jo natančno razložil, saj je možnih pristopov več.
Morda bi bilo najbolje, da me kontaktiraš na e-mail.
LP
No, pa bom vseeno poskusil zadevo razložiti. Morda bom s tem pomagal še komu.
Torej... VB zna izvajati vse "standardne" ukaze brez podpore VB RTL.
Med standardne ukaze spadajo zanke, vejitveni stavki in ostale REZERVIRANE BESEDE.
Tukaj pa se VB izvršna datoteka preneha. Vsi ostali klici PREDMETOV, ki so "vgrajeni" v VB, pa so v bistvu klici razredov in funkcij, ki so deklarirane v raznih zunanjih knjižnicah.
Postopek iskanja teh datotek je sledeč:
- najprej poišče knjižnico v trenutnem delovnem imeniku (t.j. imeniku, v katerem imamo program.exe)
- nato gre iskati v WINDOWSSYSTEM
- nato v WINDOWS
- na koncu pa še v imenike označene v PATH parametrih
Povedano preprosto: ČE SO ČISTO VSE!!! KNJIŽNICE IN KOMPONENTE PROJEKTA V ISTI MAPI KOT EXE DATOTEKA, BO VB PROGRAM DELAL BREZ NAMESTITVENEGA PROGRAMA.
Vendar pa ta pristop pri dostopanju s CD-ja niti ni priporočljiv, saj si znamo predstavljati, koliko časa bi trajalo, da bi za vsak klic neke funkcije iz neke knjižnice, le to vsakič posebej iz CD-ja nalagal v RAM. Ogovor: PREDOLGO!
Lotimo se torej zadeve drugače...
Vsaka knjižnica (*.ocx in *.dll), ki jo je potrebno distribuirati v projektu, ima pridruženo datoteko z istim imenom in končnico .DEP ! (DEP-dependency).
V tej datoteki so (med drugim) naštete vse knjižnice, ki jih ta knjižnica potrebuje, da bo funkcionirala.
Na drugi strani ima VB možnost funkcije main(), ki se izvede kot vstopna točka v program, torej še predno se kreira katerikoli predmet.
Če torej združimo do sedaj našteto, lako v funkciji (oz. bolj natančno - proceduri) main() izvedemo s pomočjo REZERVIRANIH BESED t.i. inicializacijo programa.
Zadeva zgleda približno takole:
__________________________________________________________________________________________________________________________
Option Explicit
'***********************************************************************************
'* Deklaracije uvoznih funkcij in procedur *
'***********************************************************************************
Public Declare Function GetDriveType Lib "kernel32" Alias "GetDriveType" (ByVal lpRootPathName As String) As Long
Public Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Public Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Public Declare Function DLLSelfRegister Lib "vb6stkit.dll" (ByVal lpDllName As String) As Integer
Public Declare Function RegisterTLB Lib "vb6stkit.dll" (ByVal lpTLBName As String) As Integer
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Public Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" (ByVal lpApplicationName As String, ByVal lpCommandLine As String, lpProcessAttributes As SECURITY_ATTRIBUTES, lpThreadAttributes As SECURITY_ATTRIBUTES, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, lpEnvironment As Any, ByVal lpCurrentDriectory As String, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long
Public Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long)
Public Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
Public Declare Sub ExitThread Lib "kernel32" (ByVal dwExitCode As Long)
Public Declare Function GetExitCodeThread Lib "kernel32" (ByVal hThread As Long, lpExitCode As Long) As Long
Public Declare Function GetForegroundWindow Lib "user32" () As Long
Public Declare Function GetNextWindow Lib "user32" Alias "GetWindow" (ByVal hWnd As Long, ByVal wFlag As Long) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hWnd As Long) As Long
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function DestroyWindow Lib "user32" (ByVal hWnd As Long) As Long
Public Declare Function GetLastError Lib "kernel32" () As Long
Public Declare Function FormatMessage Lib "kernel32" Alias "FormatMessageA" (ByVal dwFlags As Long, lpSource As Any, ByVal dwMessageId As Long, ByVal dwLanguageId As Long, ByVal lpBuffer As String, ByVal nSize As Long, Arguments As Long) As Long
'***********************************************************************************
' Deklaracije sistemskih podatkovnih struktur *
'***********************************************************************************
Public Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Public Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessId As Long
dwThreadId As Long
End Type
Public Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Long
End Type
'***********************************************************************************
'* Deklaracije sistemskih konstant *
'***********************************************************************************
Public Const HWND_TOPMOST = -1
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const INFINITE = &HFFFF ' Infinite timeout
Public Const NORMAL_PRIORITY_CLASS = &H20
Public Const SW_SHOWNORMAL = 1
Public Const GW_HWNDNEXT = 2
Public Const GW_HWNDPREV = 3
Public Const GW_HWNDFIRST = 0
Public Const GW_HWNDLAST = 1
Public Const WM_CLOSE = &H10
'***********************************************************************************
'* main *
'***********************************************************************************
Public Sub main()
Dim RootPathLetter As String, RootPathName As String
Dim LetterAsciiCode As Integer
Dim VB60RTLPath As String
Dim CmdLn As String
Dim Secure As SECURITY_ATTRIBUTES
Dim Start As STARTUPINFO
Dim Buffer As String
Dim rc As Long
'Tukaj najprej sicer preverimo ali je v WINDOWSSYSTEM direktoriju
'že nameščena datoteka MSVBVM60 in šele nato sprožimo spodnjo Kodo
'vendar to prepuščam posameznikom
If Not Dir("...MSVBVM60.dll) = "MSVBVM60.dll" Then
'najprej ugotovimo črko pogona CD-ROM in ali je ta pravi,
'tako da poiščemo neko datoteko na pogonu
'(če je slučajno več CD-ROM pogonov)
For LetterAsciiCode = 65 to 94
RootPathName = Chr(LetterAsciiCode) & ":"
If (GetDriveType(RootPathName) = DRIVE_CDROM) And Not(Dir("MyCheckFile") = "") Then Exit For
Next LetterAsciiCode
'nato namestimo VB RTL - predvidevam, da smo package postavili v mapo UTILITIES na CD
VB60RTLPath = RootPathName & "UTILITIESvbrun60sp4.exe"
CmdLn = " /q:a /c:""setup.exe /QN1"""
'inicializiramo podatkovne strukture
Start.cb = Len(Start)
With Secure
.nLength = Len(Secure)
.lpSecurityDescriptor = 0
.bInheritHandle = 0
End With
'zazenemo aplikacijo
rc = CreateProcess(VB60RTLPath, CmdLn, Secure, Secure, 1, NORMAL_PRIORITY_CLASS, ByVal 0, vbNullString, Start, Proc)
'in počakamo da se namestitev konča
rc = WaitForSingleObject(Proc.hProcess, INFINITE)
End If
'Podobno kot zgoraj storimo še z MDAC_TYP.EXE, ki služi dostopanju do podatkovnih baz
'Nato pa Kopiramo in Registriramo ActiveX knjižnice
'Ta ponovimo za vsako ActiveX knjižnico posebej, najbolje skozi zanko
If Not Dir("...MyComponent.ocx") = "MyComponent.ocx" Then
FileCopy(RootPathName & "MapaKjerSoActiveXMyComponent.ocx", "...MyComponent.ocx")
DLLSelfRegister("...MyComponent.ocx")
End If
'Sedaj smo nekako postorili vse potrebno
'in lahko zares zaženemo program
Form1.Show
.
.
.
End Sub
S tremi pikicami (...) sem označeval WINDOWSSYSTEM Direktorij, ki ga najdemo s pomočjo zgoraj deklariranih funkcij GetWindowsDirectory in GetsystemDirectory.
Za morebitne napake v sintaksi se vnaprej opravičujem, saj sem zadevo na hitro stipkal na pamet.
LP
P.S.: Nekdo je požrl "backslashe", zato previdnost pri zdevah, kjer sem pisal zadeve povezane z direktoriji!!!
Tudi sam pišem mrežne programe, kjer je problem podoben (beri enak).
Zadeva bi vzela kar nekaj prostora, da bi ti jo natančno razložil, saj je možnih pristopov več.
Morda bi bilo najbolje, da me kontaktiraš na e-mail.
LP
No, pa bom vseeno poskusil zadevo razložiti. Morda bom s tem pomagal še komu.
Torej... VB zna izvajati vse "standardne" ukaze brez podpore VB RTL.
Med standardne ukaze spadajo zanke, vejitveni stavki in ostale REZERVIRANE BESEDE.
Tukaj pa se VB izvršna datoteka preneha. Vsi ostali klici PREDMETOV, ki so "vgrajeni" v VB, pa so v bistvu klici razredov in funkcij, ki so deklarirane v raznih zunanjih knjižnicah.
Postopek iskanja teh datotek je sledeč:
- najprej poišče knjižnico v trenutnem delovnem imeniku (t.j. imeniku, v katerem imamo program.exe)
- nato gre iskati v WINDOWSSYSTEM
- nato v WINDOWS
- na koncu pa še v imenike označene v PATH parametrih
Povedano preprosto: ČE SO ČISTO VSE!!! KNJIŽNICE IN KOMPONENTE PROJEKTA V ISTI MAPI KOT EXE DATOTEKA, BO VB PROGRAM DELAL BREZ NAMESTITVENEGA PROGRAMA.
Vendar pa ta pristop pri dostopanju s CD-ja niti ni priporočljiv, saj si znamo predstavljati, koliko časa bi trajalo, da bi za vsak klic neke funkcije iz neke knjižnice, le to vsakič posebej iz CD-ja nalagal v RAM. Ogovor: PREDOLGO!
Lotimo se torej zadeve drugače...
Vsaka knjižnica (*.ocx in *.dll), ki jo je potrebno distribuirati v projektu, ima pridruženo datoteko z istim imenom in končnico .DEP ! (DEP-dependency).
V tej datoteki so (med drugim) naštete vse knjižnice, ki jih ta knjižnica potrebuje, da bo funkcionirala.
Na drugi strani ima VB možnost funkcije main(), ki se izvede kot vstopna točka v program, torej še predno se kreira katerikoli predmet.
Če torej združimo do sedaj našteto, lako v funkciji (oz. bolj natančno - proceduri) main() izvedemo s pomočjo REZERVIRANIH BESED t.i. inicializacijo programa.
Zadeva zgleda približno takole:
__________________________________________________________________________________________________________________________
Option Explicit
'***********************************************************************************
'* Deklaracije uvoznih funkcij in procedur *
'***********************************************************************************
Public Declare Function GetDriveType Lib "kernel32" Alias "GetDriveType" (ByVal lpRootPathName As String) As Long
Public Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Public Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Public Declare Function DLLSelfRegister Lib "vb6stkit.dll" (ByVal lpDllName As String) As Integer
Public Declare Function RegisterTLB Lib "vb6stkit.dll" (ByVal lpTLBName As String) As Integer
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Public Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" (ByVal lpApplicationName As String, ByVal lpCommandLine As String, lpProcessAttributes As SECURITY_ATTRIBUTES, lpThreadAttributes As SECURITY_ATTRIBUTES, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, lpEnvironment As Any, ByVal lpCurrentDriectory As String, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long
Public Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long)
Public Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
Public Declare Sub ExitThread Lib "kernel32" (ByVal dwExitCode As Long)
Public Declare Function GetExitCodeThread Lib "kernel32" (ByVal hThread As Long, lpExitCode As Long) As Long
Public Declare Function GetForegroundWindow Lib "user32" () As Long
Public Declare Function GetNextWindow Lib "user32" Alias "GetWindow" (ByVal hWnd As Long, ByVal wFlag As Long) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hWnd As Long) As Long
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function DestroyWindow Lib "user32" (ByVal hWnd As Long) As Long
Public Declare Function GetLastError Lib "kernel32" () As Long
Public Declare Function FormatMessage Lib "kernel32" Alias "FormatMessageA" (ByVal dwFlags As Long, lpSource As Any, ByVal dwMessageId As Long, ByVal dwLanguageId As Long, ByVal lpBuffer As String, ByVal nSize As Long, Arguments As Long) As Long
'***********************************************************************************
' Deklaracije sistemskih podatkovnih struktur *
'***********************************************************************************
Public Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Public Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessId As Long
dwThreadId As Long
End Type
Public Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Long
End Type
'***********************************************************************************
'* Deklaracije sistemskih konstant *
'***********************************************************************************
Public Const HWND_TOPMOST = -1
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const INFINITE = &HFFFF ' Infinite timeout
Public Const NORMAL_PRIORITY_CLASS = &H20
Public Const SW_SHOWNORMAL = 1
Public Const GW_HWNDNEXT = 2
Public Const GW_HWNDPREV = 3
Public Const GW_HWNDFIRST = 0
Public Const GW_HWNDLAST = 1
Public Const WM_CLOSE = &H10
'***********************************************************************************
'* main *
'***********************************************************************************
Public Sub main()
Dim RootPathLetter As String, RootPathName As String
Dim LetterAsciiCode As Integer
Dim VB60RTLPath As String
Dim CmdLn As String
Dim Secure As SECURITY_ATTRIBUTES
Dim Start As STARTUPINFO
Dim Buffer As String
Dim rc As Long
'Tukaj najprej sicer preverimo ali je v WINDOWSSYSTEM direktoriju
'že nameščena datoteka MSVBVM60 in šele nato sprožimo spodnjo Kodo
'vendar to prepuščam posameznikom
If Not Dir("...MSVBVM60.dll) = "MSVBVM60.dll" Then
'najprej ugotovimo črko pogona CD-ROM in ali je ta pravi,
'tako da poiščemo neko datoteko na pogonu
'(če je slučajno več CD-ROM pogonov)
For LetterAsciiCode = 65 to 94
RootPathName = Chr(LetterAsciiCode) & ":"
If (GetDriveType(RootPathName) = DRIVE_CDROM) And Not(Dir("MyCheckFile") = "") Then Exit For
Next LetterAsciiCode
'nato namestimo VB RTL - predvidevam, da smo package postavili v mapo UTILITIES na CD
VB60RTLPath = RootPathName & "UTILITIESvbrun60sp4.exe"
CmdLn = " /q:a /c:""setup.exe /QN1"""
'inicializiramo podatkovne strukture
Start.cb = Len(Start)
With Secure
.nLength = Len(Secure)
.lpSecurityDescriptor = 0
.bInheritHandle = 0
End With
'zazenemo aplikacijo
rc = CreateProcess(VB60RTLPath, CmdLn, Secure, Secure, 1, NORMAL_PRIORITY_CLASS, ByVal 0, vbNullString, Start, Proc)
'in počakamo da se namestitev konča
rc = WaitForSingleObject(Proc.hProcess, INFINITE)
End If
'Podobno kot zgoraj storimo še z MDAC_TYP.EXE, ki služi dostopanju do podatkovnih baz
'Nato pa Kopiramo in Registriramo ActiveX knjižnice
'Ta ponovimo za vsako ActiveX knjižnico posebej, najbolje skozi zanko
If Not Dir("...MyComponent.ocx") = "MyComponent.ocx" Then
FileCopy(RootPathName & "MapaKjerSoActiveXMyComponent.ocx", "...MyComponent.ocx")
DLLSelfRegister("...MyComponent.ocx")
End If
'Sedaj smo nekako postorili vse potrebno
'in lahko zares zaženemo program
Form1.Show
.
.
.
End Sub
S tremi pikicami (...) sem označeval WINDOWSSYSTEM Direktorij, ki ga najdemo s pomočjo zgoraj deklariranih funkcij GetWindowsDirectory in GetsystemDirectory.
Za morebitne napake v sintaksi se vnaprej opravičujem, saj sem zadevo na hitro stipkal na pamet.
LP
P.S.: Nekdo je požrl "backslashe", zato previdnost pri zdevah, kjer sem pisal zadeve povezane z direktoriji!!!
There must be a reason, why I'm so damn dissapointed on M$ Visual Basic
WEBblod.NET :: Slovenska programerska scena
WEBblod.NET :: Slovenska programerska scena
blank3_ ::
No prov fino, da si to tlele objavil....
Zelo sem zaposlen. Potreboval bi brezčasje... Vsaj za nekaj časa.
webblod ::
Uf ... pozabil sem omeniti, da knjižnice vb6stkit.dll na client računalniku ni... To je knjižnica, ki jo uporablja Package and Depoyment wizard in njena vsebina ni nikjer dokumentirana. Torej... Knjižnico je potrebno priložiti našemu programu, da bo zadeva delovala. Najdemo jo v Windows system Direktoriju...
Lahko pa se tudi izognemo uporabi vb6stkit.dll, in sicer na sledeč način:
Vsaka ActiveX knjižnica (dll in ocx) vsebuje izvozno funkcijo DllRegisterServer (Pri imenih izvoznih funkcij je potrebno nameniti pozornost velikim in malim črkam - C namreč razlikuje med velikimi in malimi črkami, izvozne funkcije pa so pisane v, ne boste verjeli, c-ju).
Lahko torej za vsako ActiveX knjižnico posebej deklariramo izvozno funkcijo za vpis v register...
Npr. če bi hoteli registrirati kontrolo MSComCtl.ocx bi deklarirali funkcijo:
Private Declare Sub RegMSComCtl Lib "mscomctl.ocx" Alias "DllRegisterServer" ()
in tako bi deklarirali funkcijo DllRegisterServer za vsako knjižnico posebej... Funkciji smo torej dali čisto drugo ime, pravo ime pa smo podali kot niz za rezerviranko Alias.
V primeru torej, da kličemo funkcije iz izvoznih knjižnic lahko funkcije kličemo eksplicitno po imenu in ne uporabimo Alias "string", lahko pa funkciji damo neko svoje bolj domače ime in pravo ime podamo kot Alias "PravoImeFunkcije".
Poleg tega sem pozabil še naekaj kostant:
Private Const DRIVE_REMOVABLE= 2
Private Const DRIVE_FIXED = 3
Private Const DRIVE_REMOTE = 4 ' Omrezni pogon
Private Const DRIVE_CDROM = 5
Private Const DRIVE_RAMDISK = 6
Uf sem zatežil s temi API funkcijami... OK.. Dost 'mate. Veselo na delo, pa kaj še sami "zgruntajte" !
Lahko pa se tudi izognemo uporabi vb6stkit.dll, in sicer na sledeč način:
Vsaka ActiveX knjižnica (dll in ocx) vsebuje izvozno funkcijo DllRegisterServer (Pri imenih izvoznih funkcij je potrebno nameniti pozornost velikim in malim črkam - C namreč razlikuje med velikimi in malimi črkami, izvozne funkcije pa so pisane v, ne boste verjeli, c-ju).
Lahko torej za vsako ActiveX knjižnico posebej deklariramo izvozno funkcijo za vpis v register...
Npr. če bi hoteli registrirati kontrolo MSComCtl.ocx bi deklarirali funkcijo:
Private Declare Sub RegMSComCtl Lib "mscomctl.ocx" Alias "DllRegisterServer" ()
in tako bi deklarirali funkcijo DllRegisterServer za vsako knjižnico posebej... Funkciji smo torej dali čisto drugo ime, pravo ime pa smo podali kot niz za rezerviranko Alias.
V primeru torej, da kličemo funkcije iz izvoznih knjižnic lahko funkcije kličemo eksplicitno po imenu in ne uporabimo Alias "string", lahko pa funkciji damo neko svoje bolj domače ime in pravo ime podamo kot Alias "PravoImeFunkcije".
Poleg tega sem pozabil še naekaj kostant:
Private Const DRIVE_REMOVABLE= 2
Private Const DRIVE_FIXED = 3
Private Const DRIVE_REMOTE = 4 ' Omrezni pogon
Private Const DRIVE_CDROM = 5
Private Const DRIVE_RAMDISK = 6
Uf sem zatežil s temi API funkcijami... OK.. Dost 'mate. Veselo na delo, pa kaj še sami "zgruntajte" !
There must be a reason, why I'm so damn dissapointed on M$ Visual Basic
WEBblod.NET :: Slovenska programerska scena
WEBblod.NET :: Slovenska programerska scena
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | [C#] Prosim pomagajte! Potrebujem program, ki bi pobiral podatke iz ene straniOddelek: Programiranje | 2746 (2356) | David1994 |
» | Vb6Oddelek: Programiranje | 1329 (1192) | StratOS |
» | API+VBOddelek: Programiranje | 2091 (1795) | webblod |
» | Odpiranje dat.exe v VBOddelek: Programiranje | 2990 (2783) | webblod |
» | Visual basic Progress barOddelek: Programiranje | 1562 (1495) | Lunik |