duminică, 28 octombrie 2012
Utilizare ADOX pentru a adauga un tabel DBF la o baza de date MsAcces
Cat = CreateObject("ADOX.Catalog")
oTab = CreateObject("ADOX.Table")
cPathDB = "Provider=Microsoft.Jet.OLEDB.4.0;"+ "Data Source=C:\BaseDatos.mdb;"
* Deschidere catalog
oCat.ActiveConnection = cPath
* Creare tabel nou
With oTab
.Name =
"Linked Table dBASE"
.ParentCatalog = oCat
EndWith
* Setarea proprietatilor pentru a crea legatura cu tabela dBASE
With oTab
.Properties("Jet OLEDB:Link Datasource") = "C:\"
.Properties("Jet OLEDB:Remote Table Name") ="vacunas#dbf"
.Properties("Jet OLEDB:Create Link") = .T.
.Properties("Jet OLEDB:Link Provider String") = "dBASE 5.0;"
EndWith
* adaugare tabel la colectia Tabele
oCat.Tables.Append(oTbl)
oCat = Null
=MessageBox("Legatura tabelului a reusit.")
Refresh form cu API
#Define RDW_INVALIDATE 0x0001
#Define RDW_INTERNALPAINT 0x0002
#Define RDW_ERASE 0x0004
#Define RDW_VALIDATE 0x0008
#Define RDW_NOINTERNALPAINT 0x0010
#Define RDW_NOERASE 0x0020
#Define RDW_NOCHILDREN 0x0040
#Define RDW_ALLCHILDREN 0x0080
#Define RDW_UPDATENOW 0x0100
#Define RDW_ERASENOW 0x0200
#Define RDW_FRAME 0x0400
#Define RDW_NOFRAME 0x0800
*Wait Window Bitor(RDW_NOFRAME ,Bitor(RDW_FRAME ,Bitor(RDW_ERASENOW,RDW_ALLCHILDREN )))
Declare Integer RedrawWindow In WIN32API As ApiRedrawWindow ;
Integer HWnd, ;
Integer nUpdateRect, ;
Integer nUpdateRegion, ;
Integer nFlags
ApiRedrawWindow(ThisForm.HWnd, 0, 0, RDW_INTERNALPAINT + RDW_ALLCHILDREN + RDW_UPDATENOW)
Clear Dlls 'ApiRedrawWindow'
Executarea unei comenzi MSDOS fără a arăta fereastra
Declare Long WinExec In kernel32 STRING lpCmdLine, Long nCmdShow
cCmd = "RegSvr32.exe micontrol.ocx"
=WinExec(cCmd, 0)
Restartare PC
Declare SetupPromptReboot In setupapi.dll ; Long FileQueue,
Long Owner,
Long ScanOnly
* Pentru reboot cu aprobarea utilizatorului
SetupPromptReboot (0, _Screen.hWnd, 0)
* Pentru reboot fortat
SetupPromptReboot (0, _Screen.hWnd, 1)
Long Owner,
Long ScanOnly
* Pentru reboot cu aprobarea utilizatorului
SetupPromptReboot (0, _Screen.hWnd, 0)
* Pentru reboot fortat
SetupPromptReboot (0, _Screen.hWnd, 1)
Descarcare fisierer de pe Iinternet
Declare DoFileDownload In shdocvw.Dll STRING lpszFile
Local lcFile As String
*lcFile = "expertsoft.eu/versiuni.txt"
lcFile = "update.expert-net.ro/IcasUpdate/versiuni.txt"
DoFileDownload(StrConv(lcFile, 12))
Sau
oInet = Create("InetCtls.Inet")
oInet.RemotePort = "8080"
oInet.RequestTimeOut = 1000
* oInet.Proxy = "192.168.6.3"
cUrl = "http://update.expert-net.ro/IcasUpdate/versiuni.txt"
oDatos = oInet.OpenURL(cUrl, 1)
StrToFile(oDatos, 'sterge.txt')
Modify File Sterge.txt
Verifica daca exista conxiune de Internet
Local lOnline
oShell = CreateObject("WScript.Shell")
lOnline = oShell.Run("ping www.google.com",0,"True")
If lOnline = 0
MessageBox("ping OK!")
Else
MessageBox("ping Error!")
EndIf
sâmbătă, 6 octombrie 2012
Abonați-vă la:
Postări (Atom)