ßy ßr0ck
  VB KODLARI
 
 

CD ROM ACMA KAPAMA:


Private Declare Function mciExecute Lib "winmm.dll" (ByVal lpstrCommand As String) As Long

Private Sub Command1_Click()
mciExecute ("set cdaudio door open") 'Cdrom aç
End Sub

 

Private Sub Command2_Click()
mciExecute ("set cdaudio door closed") ' Cdrom kapat
End Sub

 

ÖĞRENCİ NOTU HESAPLAMA(Geçti Kaldı) :


Private Sub Form_Load()
puan = InputBox("öğrencinin notunu girin:")
secim = IIf(puan >= 50, "öğrenci geçti", "ögrenci kaldı")
MsgBox secim
End Sub

 

KES , KOPYALA , YAPIŞTIR , GERİ AL KOMUTU EKLEMEK :

 

Kes, Kopyala, Yapıştır
Bir TextBox'ta Kes, Kopyala, Yapıştır, Geri Al işlemlerinin yapılması için iki tane çok kolay yol mevcut. Aşağıdaki örnekler SendKeys methodunu kullanıyor.

İşte birinci örnek:


Sub DoEditThing(whatThing As String, onWhat As Object)
Select Case whatThing
Case "Copy"
onWhat.SetFocus
SendKeys "^C"
Case "Cut"
onWhat.SetFocus
SendKeys "^X"
Case "Paste"
onWhat.SetFocus
SendKeys "^V"
Case "Undo"
onWhat.SetFocus
SendKeys "^Z"
End Select
End Sub

Aşağıdaki kod aynı işi yapan ikinci örnek:


Sub DoEditThing(whatThing As String, onWhat As Object)
Dim Send$
Select Case whatThing
Case "Copy"
Send = "^C"
Case "Cut"
Send = "^X"
Case "Paste"
Send = "^V"
Case "Undo"
Send = "^Z"
End Select
If Len(Send) Then
onWhat.SetFocus
SendKeys Send
End If
End Sub

Şimdi, yukarıdaki iki örnekten birini formunuza ekledikten sonra aşağıdaki kod satırıyla istediğiniz işlemi yapabilirsiniz.

DoEditThing Copy|Cut|Paste|Undo*, On_Which_Object**

* - Bir tanesini seçin; Copy, Cut, Paste veya Undo
** - TextBox'ı seçin; (ör. Text1)

 

TOPLAMA , ÇIKARMA , ÇARPMA , BÖLME FORMULLERİ :

 

TOPLAMA :

Private Sub topla_Click(Index As Integer)
Text3.Text = Val(Text1.Text) + (Text2.Text)
End Sub

 

CIKARMA :

Private Sub çıkar_Click(Index As Integer)
Text3.Text = Val(Text1.Text) - (Text2.Text)
End Sub

 

ÇARPMA :

Private Sub çarp_Click(Index As Integer)
Text3.Text = Val(Text1.Text) * (Text2.Text)
End Sub

 

BÖLME :

Private Sub böl_Click(Index As Integer)
Text3.Text = Val(Text1.Text) / (Text2.Text)
End Sub

 

RAM BİLGİLERİNİ ÖĞRENMEK :

 

'Ram bilgilerini öğrenmek için;
'Bir adet timer ve 4 adet textbox ekleyin, Timerin intervalini 1000 yapın

Private Declare Sub GlobalMemoryStatus Lib "kernel32" (lpBuffer As RamBilgileri)
Private Type RamBilgileri
boyut As Long
yuzderam As Long
toplamram As Long
bosram As Long
End Type
Private Sub Timer1_Timer()
Dim bilgiler As RamBilgileri
GlobalMemoryStatus bilgiler
Text1.Text = "% " & bilgiler.yuzderam 'yüzde ram kullanımı
Text2.Text = bilgiler.toplamram / 1024 / 1024 & " MB" 'toplam ram
Text3.Text = bilgiler.toplamram / 1024 / 1024 - bilgiler.bosram / 1024 / 1024 & " MB" 'kullanılan ram
Text4.Text = bilgiler.bosram / 1024 / 1024 & " MB" ' boş ram
End Sub

 

YAPTIĞINIZ PROGRAMA TARİH VE SAAT EKLEMEK :

 

'Öncelikle bir adet label nesnesi ve bir adet timer ekleyin. Timer nesnesinin interval özelliğini 1000 yapın.
'Timer1 i çift tıklatınca açılan kod sayfasına label1.caption=time diyin. Label üzerinde saat çalışacaktır.
'Tarih için ise label1.caption=date demelisiniz.

Private Sub Timer1_Timer()
Label1.Caption = Date
Label2.Caption = Time
End Sub

 

FORMU TRANS PARAN YAPMAK :

 

transparan form (programınız transparan olsun)
Private Declare Function SetWindowLong Lib "USER32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "USER32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long

Private Sub Command1_Click()
SetWindowLong Me.hWnd, (-20), &H80000
SetLayeredWindowAttributes Me.hWnd, 0, sc1.Value, &H2
End Sub

Private Sub Form_Load()
'Command1_Click
End Sub

Private Sub sc1_Change()
Text1.Text = sc1.Value
Command1_Click

End Sub

 

 
  Bugün 13 ziyaretçi (31 klik) kişi burdaydı!  
Toplamda Tekil 258772 ziyaretçi ANASAYFA
  Bu web sitesi ücretsiz olarak Bedava-Sitem.com ile oluşturulmuştur. Siz de kendi web sitenizi kurmak ister misiniz?
Ücretsiz kaydol