Öncelikle Şunu Söyleyeyim Alıntı Değildir.!!
İlk kodumuz çoğu kişinin yapamadığı bi hata ctrl+alt+delete ve ctrl+esc ile kapama sorunu:
Asagidaki kodu projenizin declarations kismina yazin:
Private Declare Function SystemParametersInfo Lib _
"user32" Alias "SystemParametersInfoA" (ByVal uAction _
As Long, ByVal uParam As Long, ByVal lpvParam As Any, _
ByVal fuWinIni As Long) As Long
Sub CtrlAltDeleteKapat(Kapali As Boolean)
Dim X As Long
X = SystemParametersInfo(97, Kapali, CStr(1), 0)
End Sub
Ctrl-Alt-Delete kombinasyonunu kapatmak için:
Call CtrlAltDeleteKapat(True)
Ctrl-Alt-Delete kombinasyonunu açmak için:
Call CtrlAltDeleteKapat(False)
Clientden çıkınca connectöründe kapanması:
bi modül ekliyosunuz:
Option Explicit
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Declare Function Process32First Lib "kernel32" _
(ByVal hSnapshot As Long, lppe As PROCESSENTRY32) As Long
Public Declare Function Process32Next Lib "kernel32" _
(ByVal hSnapshot As Long, lppe As PROCESSENTRY32) As Long
Public Declare Function OpenProcess Lib "Kernel32.dll" _
(ByVal dwDesiredAccessas As Long, ByVal bInheritHandle As Long, _
ByVal dwProcId As Long) As Long
Public Declare Function EnumProcesses Lib "psapi.dll" _
(ByRef lpidProcess As Long, ByVal cb As Long, _
ByRef cbNeeded As Long) As Long
Public Declare Function GetModuleFileNameExA Lib "psapi.dll" _
(ByVal hProcess As Long, ByVal hModule As Long, _
ByVal ModuleName As String, ByVal nSize As Long) As Long
Public Declare Function EnumProcessModules Lib "psapi.dll" _
(ByVal hProcess As Long, ByRef lphModule As Long, _
ByVal cb As Long, ByRef cbNeeded As Long) As Long
Public Declare Function CreateToolhelp32Snapshot Lib "kernel32" _
(ByVal dwFlags As Long, ByVal th32ProcessID As Long) As Long
Public Declare Function GetVersionExA Lib "kernel32" _
(lpVersionInformation As OSVERSIONINFO) As Integer
Public Declare Function TerminateProcess Lib "kernel32" _
(ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Public Declare Function GetExitCodeProcess Lib "kernel32" _
(ByVal hProcess As Long, lpExitCode As Long) As Long
Public Type PROCESSENTRY32
pe32Size As Long
pe32Usage As Long
pe32ProcessID As Long
pe32DefaultHeapID As Long
pe32ModuleID As Long
pe32Threads As Long
pe32ParentProcessID As Long
pe32PriClassBase As Long
pe32Flags As Long
pe32ExeFile As String * 260
End Type
Public Type OSVERSIONINFO
oviOSVersionInfoSize As Long
oviMajorVersion As Long
oviMinorVersion As Long
oviBuildNumber As Long
oviPlatformId As Long
oviCSDVersion As String * 128
End Type
Public Const PROCESS_QUERY_INFORMATION = 1024
Public Const PROCESS_VM_READ = 16
Public Const MAX_PATH = 260
Public Const STANDARD_RIGHTS_REQUIRED = &HF0000
Public Const SYNCHRONIZE = &H100000
'STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &HFFF
Public Const PROCESS_ALL_ACCESS = &H1F0FFF
Public Const TH32CS_SNAPPROCESS = &H2&
Public Const lngNull = 0
Public Const PROCESS_TERMINATE = &H1&
Public Function KillProgramme(strProgrammeName As String) As Boolean
Select Case GetVersion()
Case 1 'Windows 95/98
Dim lngReturn As Long
Dim strName As String
Dim lngSnap As Long
Dim pe32Process As PROCESSENTRY32
lngSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)
If lngSnap = lngNull Then Exit Function
pe32Process.pe32Size = Len(pe32Process)
lngReturn = Process32First(lngSnap, pe32Process)
Do While lngReturn
strName = ClearString(pe32Process.pe32ExeFile)
strName = Trim(Replace(strName, Chr(0), ""))
'Is it our file
'If yes
If Right(strName, Len(strProgrammeName)) = strProgrammeName Then
'Kill it
If KillProcess(pe32Process.pe32ProcessID) Then KillProgramme = True
'Exit
Exit Function
End If
lngReturn = Process32Next(lngSnap, pe32Process)
Loop
Case 2 'Windows NT
Dim lngCB As Long
Dim lngCBNeeded As Long
Dim lngNumElements As Long
Dim arrProcessIDs() As Long
Dim lngCBNeeded2 As Long
Dim arrModules(1 To 200) As Long
Dim lngReturn2 As Long
Dim strModuleName As String
Dim lngSize As Long
Dim lngProcess As Long
Dim lngCounter As Long
lngCB = 8
lngCBNeeded = 96
Do While lngCB <= lngCBNeeded
lngCB = lngCB * 2
ReDim arrProcessIDs(lngCB / 4) As Long
lngReturn2 = EnumProcesses(arrProcessIDs(1), lngCB, lngCBNeeded)
Loop
lngNumElements = lngCBNeeded / 4
For lngCounter = 1 To lngNumElements
lngProcess = OpenProcess(PROCESS_QUERY_INFORMATION Or PROCESS_VM_READ, 0, arrProcessIDs(lngCounter))
If lngProcess <> 0 Then
lngReturn2 = EnumProcessModules(lngProcess, arrModules(1), 200, lngCBNeeded2)
If lngReturn2 <> 0 Then
strModuleName = Space(MAX_PATH)
lngSize = 500
lngReturn2 = GetModuleFileNameExA(lngProcess, arrModules(1), strModuleName, lngSize)
strModuleName = Trim(Replace(strModuleName, Chr(0), ""))
If Right(strModuleName, Len(strProgrammeName)) = strProgrammeName Then
If KillProcess(arrProcessIDs(lngCounter)) Then KillProgramme = True
Exit Function
End If
End If
End If
lngReturn2 = CloseHandle(lngProcess)
'Return
Next
End Select
End Function
Public Function KillProcess(lProcessID As Long) As Boolean
Dim lngHandle As Long
Dim lngReturn As Long
Dim lngExitCode As Long
lngHandle = OpenProcess(PROCESS_TERMINATE, 0, lProcessID)
lngReturn = GetExitCodeProcess(lngHandle, lngExitCode)
lngReturn = TerminateProcess(lngHandle, lngExitCode)
lngReturn = CloseHandle(lngHandle)
If lngReturn <> 0 Then KillProcess = True
End Function
Public Function ProgrammeIsRunning(strProgrammeName) As Long
Select Case GetVersion()
Case 1 'Windows 95/98
Dim lngReturn As Long
Dim strName As String
Dim lngSnap As Long
Dim pe32Process As PROCESSENTRY32
lngSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)
If lngSnap = lngNull Then Exit Function
pe32Process.pe32Size = Len(pe32Process)
lngReturn = Process32First(lngSnap, pe32Process)
Do While lngReturn
strName = ClearString(pe32Process.pe32ExeFile)
strName = Trim(Replace(strName, Chr(0), ""))
If Right(strName, Len(strProgrammeName)) = strProgrammeName Then
'Found
ProgrammeIsRunning = pe32Process.pe32ProcessID
'Exit
Exit Function
End If
lngReturn = Process32Next(lngSnap, pe32Process)
Loop
Case 2 'Windows NT
Dim lngCB As Long
Dim lngCBNeeded As Long
Dim lngNumElements As Long
Dim arrProcessIDs() As Long
Dim lngCBNeeded2 As Long
Dim lngNumElements2 As Long
Dim arrModules(1 To 200) As Long
Dim lngReturn2 As Long
Dim strModuleName As String
Dim lngSize As Long
Dim lngProcess As Long
Dim hProcess As Long
lngCB = 8
lngCBNeeded = 96
Do While lngCB <= lngCBNeeded
lngCB = lngCB * 2
ReDim arrProcessIDs(lngCB / 4) As Long
lngReturn2 = EnumProcesses(arrProcessIDs(1), lngCB, lngCBNeeded)
Loop
lngNumElements = lngCBNeeded / 4
For hProcess = 1 To lngNumElements
lngProcess = OpenProcess(PROCESS_QUERY_INFORMATION Or PROCESS_VM_READ, 0, arrProcessIDs(hProcess))
If lngProcess <> 0 Then
lngReturn2 = EnumProcessModules(lngProcess, arrModules(1), 200, lngCBNeeded2)
If lngReturn2 <> 0 Then
strModuleName = Space(MAX_PATH)
lngSize = 500
lngReturn2 = GetModuleFileNameExA(lngProcess, arrModules(1), strModuleName, lngSize)
strModuleName = Trim(Replace(strModuleName, Chr(0), ""))
If Right(strModuleName, Len(strProgrammeName)) = strProgrammeName Then
'Found
ProgrammeIsRunning = arrProcessIDs(hProcess)
'Exit
Exit Function
End If
End If
End If
lngReturn2 = CloseHandle(lngProcess)
Next
End Select
End Function
Function ClearString(strString As String) As String
ClearString = Left$(strString, Len(strString) - 1)
End Function
Public Function GetVersion() As Long
Dim oviOSInfo As OSVERSIONINFO
Dim lngReturn As Integer
oviOSInfo.oviOSVersionInfoSize = 148
oviOSInfo.oviCSDVersion = Space$(128)
lngReturn = GetVersionExA(oviOSInfo)
GetVersion = oviOSInfo.oviPlatformId
End Function
sonra çıkış butonunada şu kodu ekliyorsunuz:
On Error Resume Next
If ProgrammeIsRunning("clientismi.exe") Then
KillProgramme ("clientismi.exe")
Kill "clientismi.exe"
End If
Unload Me
End
End Sub
Connectörünüzde web site diye bi buton eklemek istiyorsanız web site buttonunun içine şu kodu yazın:
Dim ver
ver = "explorer.exe" & " https://" & "www.xxxx.com/"
Shell ver, vbNormalFocus
End Sub
Şimdilik bunları koyuyorum daha sonra güncelleme yapacağım.Şimdi ise Hata mesajlarının türkçe anlamını koyuyorum:
Kod Mesaj
3 Return without GoSub (GoSub'sız Return)
5 Invalid procedure call (geçersiz procedure çağırması)
6 Overflow (taşma)
7 Out of memory (bellek yetersiz)
9 Subscript out of range (dizi dışı)
10 This array is fixed or temporarily locked (dizi sabit ya da kilitli)
11 Division by zero (sıfıra bölme)
13 Type mismatch (tip uyumsuzluğu)
14 Out of string space (string alanı yetersiz)
16 Expression too complex (ifade çok karışık)
17 Can't perform requested operation (işlem işletilemiyor)
18 User interrupt occurred (kullanıcı kesmesi oluştu)
20 Resume without error (hatasız devam)
28 Out of stack space (yetersiz stack alanı)
35 Sub, Function, or Property not defined (… tanımlanmamış)
47 Too many DLL application clients (çok sayıda DLL uygulama)
48 Error in loading DLL (DLL yüklemede hata)
49 Bad DLL calling convention (DLL hatası)
51 Internal error (iç hata)
52 Bad file name or number (yanlış dosya)
53 File not found (dosya bulunamadı)
54 Bad file mode (kötü dosya biçimi)
55 File already open (dosya zaten açık)
58 File already exists (dosya zaten var)
59 Bad record length (kötü kayıt uzunluğu)
61 Disk full (disk dolu)
62 Input past end of file (dosya sonunu geçme)
63 Bad record number (kötü kayıt numarası)
67 Too many files (çok fazla dosya)
68 Device unavailable (aygıt kullanılamaz durumda)
70 Permission denied (izin yok)
71 Disk not ready (disk hazır değil)
74 Can't rename with different drive (başka bir sürücü adıyla değiştirilemez)
75 Path/File access error (dosya adı hatası)
76 Path not found (yol bulunamadı)
91 Object variable or With block variable not set (nesne değişkeni düzenlenmemiş)
92 For loop not initialized (döngü başlatılmamış)
93 Invalid pattern string (yanlış string düzeni)