Rabu, 11 Juni 2008

Membuat Aplikasi Edit Registry (150 lebih Tip dan Trik Registry Terintegrasi didalamnya)

Kita akan mencoba membuat aplikasi Edit Registry yang memiliki kemampuan untuk membuka key, membuat key, hapus key dan value, membaca Value Data dengan Tipe RG_SZ, melakukan seting Value kedalam Tipe Value REG_DWORD, REG_SZ DAN REG_BINARY. Ditambah adanya tutorial tip dan trik registry lebih dari 150 tip trik yang terintegrasi didalam aplikasi sehingga dapat langsung dipraktekan.Yang dibutuhkan pada pembuatan aplikasi ini tidak beda dengan aplikasi standar, yaitu textbox, label, commandbutton, checkbox, optionbutton, listbox, image, timer. Lebih jelasnya dapat dilihat pada gambar di bawah ini.


 Ini linknya Edit Registry
Semoga bermanfaat.

Bagikan

Open Close CD Room

Di bawah ini disajikan source code untuk melakukan Open dan Close CD Room, siapa tahu dari code tersebut dapat menginspirasi anda untuk membuat suatu aplikasi yang lebih baru atau lebih kreatif lagi.
Dalam aplikasi ini yang dibutuhkan adalah :
- 3 Commandbutton, dengan properties name Command1, Command2, Command3
- 1 form, dengan properties name form1
- 1 modul, dengan properties name module1

Masukkan Code Dibawah ini pada module1
Option Explicit
Public Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Public Function OpenCDDoor(ByVal drv As String) As Long
Dim Alias As String
Dim retval As Long
Alias = "Drive" & drv
retval = -1
retval = mciSendString("open " & drv & ": type cdaudio alias " & Alias & " wait", vbNullString, 0&, 0&)
retval = mciSendString("set " & Alias & " door open", vbNullString, 0&, 0&)
OpenCDDoor = retval
End Function
Public Function CloseCDDoor(ByVal drv As String) As Long
Dim Alias As String
Dim retval As Long
Alias = "Drive" & drv
retval = -1
retval = mciSendString("set " & Alias & " door closed", vbNullString, 0&, 0&)
retval = mciSendString("close " & Alias, vbNullString, 0&, 0&)
CloseCDDoor = retval
End Function


Masukkan code di bawah inipada form
Private Sub Command1_Click()
OpenCDDoor "G" 'pastikan drive G adalah drive untuk CD/DVD Room, jika bukan G tinggal anda ubah G tersebut menjadi Huruf sesuai dng Drive CD/DVD Room
End Sub
Private Sub Command2_Click()
CloseCDDoor "G" 'pastikan drive G adalah drive untuk CD/DVD Room, jika bukan G tinggal anda ubah G tersebut menjadi Huruf sesuai dng Drive CD/DVD Room
End Sub
Private Sub Command3_Click()
End
End Sub

Semoga bermanfaat.
Download Project Open Close CD-Room

Cek IP Adress Orang Lain Aktif Atau Tidak

Untuk tulisan kali ini disajikan bagaimana cara pembuatan aplikasi yang berfungsi untuk mengetahui status aktif atau tidak akltif dari Komputer tetangga dengan melakukan pencarian IP Adress.Siapa tahu dengan kita mengetahui IP Adress komputer tetangga, kita dapat mencari file, melakukan Shutdown ataupun tujuan positif lainnya he..he..

Yang dibutuhkan dalam pembuatan aplikasi kali ini adalah :
- 1 listbox dengan properties name List1
- 2 textbox dengan propertie name Text1 dan Text2
- 2 commandbutton dengan properties name Command1 dan Command2
- 2 label dengan properties name label1, properties Caption="Cek IP Aktif dari" dan label2 dengan properties caption="Sampai"
Masukkan code di bawah ini pada form


Option Explicit
Const SOCKET_ERROR = 0
Private Declare Function GetHostByName Lib "wsock32.dll" Alias "gethostbyname" (ByVal HostName As String) As Long
Private Declare Function WSAStartup Lib "wsock32.dll" (ByVal wVersionRequired&, lpWSAdata As WSAdata) As Long
Private Declare Function WSACleanup Lib "wsock32.dll" () As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvdest As Any, hpvSource As Any, ByVal cbCopy As Long)
Private Declare Function IcmpCreateFile Lib "icmp.dll" () As Long
Private Declare Function IcmpCloseHandle Lib "icmp.dll" (ByVal HANDLE As Long) As Boolean
Private Declare Function IcmpSendEcho Lib "ICMP" (ByVal IcmpHandle As Long, ByVal DestAddress As Long, ByVal RequestData As String, ByVal RequestSize As Integer, RequestOptns As IP_OPTION_INFORMATION, ReplyBuffer As IP_ECHO_REPLY, ByVal ReplySize As Long, ByVal TimeOut As Long) As Boolean

'type data tambahan
Private Type WSAdata
wVersion As Integer
wHighVersion As Integer
szDescription(0 To 255) As Byte
szSystemStatus(0 To 128) As Byte
iMaxSockets As Integer
iMaxUdpDg As Integer
ipVendorInfo As Long
End Type

Private Type Hostent
h_name As Long
h_aliases As Long
h_addrtype As Integer
h_length As Integer
h_addr_list As Long
End Type

Private Type IP_OPTION_INFORMATION
TTL As Byte
Tos As Byte
Flage As Byte
OptionsSize As Long
OptionsData As String * 128
End Type

Private Type IP_ECHO_REPLY
Address(0 To 3) As Byte
Status As Long
RoundTripTime As Long
DataSize As Integer
Reserved As Integer
data As Long
Options As IP_OPTION_INFORMATION
End Type

Public dir As String
Public Function doPing(ByVal HostName As String) As Boolean
Dim hFile As Long, lpWSAdata As WSAdata
Dim hHostent As Hostent, AddrList As Long
Dim Address As Long, rIP As String
Dim OptInfo As IP_OPTION_INFORMATION
Dim EchoReply As IP_ECHO_REPLY

Call WSAStartup(&H101, lpWSAdata)

If GetHostByName(HostName + String(64 - Len(HostName), 0)) <> SOCKET_ERROR Then
CopyMemory hHostent.h_name, ByVal GetHostByName(HostName + String(64 - Len(HostName), 0)), Len(hHostent)
CopyMemory AddrList, ByVal hHostent.h_addr_list, 4
CopyMemory Address, ByVal AddrList, 4
End If
hFile = IcmpCreateFile()

If hFile = 0 Then
MsgBox " Unable to create file handle", vbCritical + vbOKOnly
doPing = False
Exit Function
End If

OptInfo.TTL = 255
If IcmpSendEcho(hFile, Address, String(32, "A"), 32, OptInfo, EchoReply, Len(EchoReply) + 8, 2000) Then
rIP = CStr(EchoReply.Address(0)) + "." + CStr(EchoReply.Address(1)) + "." + CStr(EchoReply.Address(2)) + "." + CStr(EchoReply.Address(3))
Else
doPing = False
End If

If EchoReply.Status = 0 Then
doPing = True
Else
doPing = False
End If

Call IcmpCloseHandle(hFile)
Call WSACleanup
End Function

Private Sub Command1_Click()
Dim i As Integer
Dim x, y
Dim result As Boolean
Dim resultString As String

If Trim(Text1) = "" Then
MsgBox "Isikan Alamat IP", vbCritical + vbOKOnly
Text1.SetFocus
Exit Sub
End If

If Trim(Text2) = "" Then
MsgBox "Isikan Batasan/Range Alamat IP", vbCritical + vbOKOnly
Text2.SetFocus
Exit Sub
End If
List1.Clear
x = Split(Text1.Text, ".")
y = Split(Text2.Text, ".")
For i = CInt(x(3)) To CInt(y(3))
dir = x(0) & "." & x(1) & "." & x(2) & "." & i
result = doPing(dir)
If result = True Then
resultString = "Aktif"
Else
resultString = "NonAktif"
End If
List1.AddItem "Pinging " & dir & "..." & resultString
List1.Refresh
Next
End Sub

Private Sub Command2_Click()
List1.Clear
Text1.Text = ""
Text2.Text = ""
List1.Refresh
End Sub

Terimakasih, semoga bermanfaat.
 Download Cek IP Aktif

Menambah Sound Wav Pada Aplikasi misal Sound Pada Tombol

Tambahkan Sound Wave pada aplikasi anda agar aplikasi akan terlihat lebih menarik.Misal command buttons yang berbunyi pada saat diklik.

Untuk proyek kita kali ini membutuhkan controll, yaitu :
- 2 text box dengan propertis name text1 dan text2
- 4 command buttons dengan properties namenya standar/default tanpa perubahan.
- 3 label dengan properties name default
- contoh-contoh file sound wav yang diletakan di luar aplikasi
- timer dengan properties name timer1 dan dengan interval 100.

Tuliskan code di bawah ini pada modul

Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_NODEFAULT = &H2
Const SND_LOOP = &H8
Const SND_NOSTOP = &H10

Sub PlayWaveSoundOkExit_Click()
soundfile$ = "audio\rain_tag_water.wav"
wFlags% = SND_ASYNC Or SND_NODEFAULT
HaHa = sndPlaySound(soundfile$, wFlags%)
End Sub

Sub StopTheSound_Click()
StopTheSoundNOW = sndPlaySound(soundfile$, wFlags%)
End Sub

Sub PlayWaveSoundIntro_Click()
soundfile$ = "audio\a_sparrow.wav"
wFlags% = SND_ASYNC Or SND_NODEFAULT
HaHa = sndPlaySound(soundfile$, wFlags%)
End Sub

Sub PlayWaveSoundLblTxt_Click()
soundfile$ = "audio\e_twigs.wav"
wFlags% = SND_ASYNC Or SND_NODEFAULT
HaHa = sndPlaySound(soundfile$, wFlags%)
End Sub

Sub PlayWaveSoundAyam_Click()
soundfile$ = "audio\Ayam berkokok.wav"
wFlags% = SND_ASYNC Or SND_NODEFAULT
HaHa = sndPlaySound(soundfile$, wFlags%)
End Sub

Tuliskan code di bawah ini pada Form

Private Sub Command1_Click()
PlayWaveSoundOkExit_Click
End
End Sub
Private Sub Command2_Click()
PlayWaveSoundAyam_Click
End Sub
Private Sub Command3_Click()
StopTheSoundNOW = sndPlaySound(soundfile$, wFlags%)
End Sub
Private Sub Command4_Click()
PlayWaveSoundOkExit_Click
Timer1.Enabled = False
Command2.Visible = True
Command3.Visible = True
Command4.Visible = False
Command1.Visible = True
End Sub
Private Sub Form_Load()
PlayWaveSoundIntro_Click
MsgBox "Sound Wav Intro telah berbunyi, selanjutnya Sound Wav saat menekan Ok", vbOKOnly, "Info"
PlayWaveSoundOkExit_Click
End Sub
Private Sub Text1_Change()
PlayWaveSoundLblTxt_Click
End Sub
Private Sub Text2_Change()
PlayWaveSoundLblTxt_Click
End Sub
Private Sub Timer1_Timer()
If Not Text1.Text = "" And Not Text2.Text = "" Then
Command4.Visible = True
Else
Command4.Visible = False
End If
If Label3.ForeColor = &HFFFFFF Then
Label3.ForeColor = &H80000008
Else
Label3.ForeColor = &HFFFFFF
End If
End Sub


Terimakasih, semoga bermanfaat.
Download Menambah Sound Wav

Sabtu, 01 September 2007

Best 20 Visual Basic Tutorial

Dibawah ini merupakan 20 kumpulan situs visual basic terbaik yang bisa jadi acuan bagi yang ingin lebih mendalami visual basic.



A1VBCode
- VB Source Code Site:
Provides hundreds free Visual Basic source
code snippets and applications in all categories. Submit your own
code and win monthly VB prizes.



VB Wire: A
Visual Basic news source. This site provides Visual Basic news which
is updated daily. The site also provides a weekly VB newsletter which
is delivered to your inbox with all of the past weeks VB news.



AppDev Training:
Developer Training for Visual Basic, ASP, XML, SQL Server, VBA,
Microsoft Access, Visual InterDev, and FoxPro through CD’s,
videos, classes and licensing.


ITtoolbox
Portal for Visual Basic:
Content, community, and service for
Visual Basic professionals. Providing technical discussion, job
postings, an integrated directory, news, and much more.


VB Chat: A
place where you can go and chat live about Visual Basic with other
Visual Basic programmers around the world.


Just VB Jobs:
This is an excellent new job site. It contains a huge database of
nothing but VB jobs. It also contains numerous other VB resources
which you'll find very helpful.


VBShop -
The Visual Basic Shop:
Tools and tips for VB programmers.
Optimization, documentation, add-ins.


Programmers
Heaven - Where programmers go:
The Internet's most complete
source of free downloadable programming files, source codes,
utilities, Visual Basic, C/C++, JAVA, and other tools for programmers
and developers. All files and links are organized in an easy-to-find
format.



Visual
Basic Jobs:
Another excellent VB job site which you can use to
search through a huge list of Visual Basic jobs across the U.S.


ProgrammingTutorials.com:
Excellent site offering programming tutorials in many categories.


VB Code: This
very popular site contains many VB code samples and snippets which
you can search through.


VB Web
Directory:
Contains a huge index of Visual Basic Resources.
Contains links, books, VB forums, job bank, and much more.


CodeGuru:
An information resource for Visual Basic programmers. Contains
information on all aspects of Visual Basic.


VB
Accelerator:
An excellent general Visual Basic site providing up
to date VB news, tips, and many source code samples.


Visual
Basic Expert:
This site is for serious VB developers, huge
amounts of professional code for download, help forum, developer
resources, book reviews, online training and more..


Developers
Domain:
This site contains free code downloads, message boards,
links, and much more.


Visual Basic
Bookmark:
A comprehensive directory of programming resources and
development information for Visual Basic programmers, Database
developers & web designers.


CodeArchive.com-
The Source Code Site:
The largest amount of Visual Basic source
code on the Internet. Other features include a chat room and message
board. You can get 50 MB for your own web site on CodeArchive.com .


Planet
Source Code:
Contains thousands of lines of source code which you
can copy and paste directly into your own applications. Some of the
code is in downloadable zip files.


VB Web - The online guide to VB-
Over 120 downloads, and Tutorials on Commands, Controls, Windows API,
Subclassing, Debugging and more. We also have Links, a Free
Newsletter and Book Reviews. Fully Searchable.






Dari semua yang terbaik diatas menurut saya yang paling terbaik adalah planet-source-code.com



Sumber:http://www.visualbasicbooks.com


Rabu, 29 Agustus 2007

Mengubah ukuran tampilan form (Sizable toolwindow) menggunakan SetWindowLong API function

'Paste kode ini pada Modul



Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd
As Long, ByVal nIndex As Long) As Long

Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd
As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Public Const WS_EX_TOOLWINDOW = &H80&

Public Const GWL_EXSTYLE = (-20)



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 Const SWP_FRAMECHANGED = &H20

Public Const SWP_NOMOVE = &H2

Public Const SWP_NOZORDER = &H4

Public Const SWP_NOSIZE = &H1





'Paste code ini pada form code



Private Sub Form_Load()

Dim xx As Long



xx = GetWindowLong(hwnd, GWL_EXSTYLE)

xx = SetWindowLong(hwnd, GWL_EXSTYLE, _

xx Or WS_EX_TOOLWINDOW)



SetWindowPos hwnd, 0, 0, 0, 0, 0, _

SWP_FRAMECHANGED Or SWP_NOMOVE Or _

SWP_NOZORDER Or SWP_NOSIZE

End Sub

 

Menjalankan form selalu berada paling depan "alwasy on top"

Ada kalanya kita ingin menampilkan form kita selalu berada paling depan, untuk
mempermudah hal tersebut om akan memberikan solusinya



Deklarasi



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)



Code yang digunakan



'Code ini akan menampilkan form selalu didepan

rtn = SetWindowPos(OnTop.hwnd, -2, 0, 0, 0, 0, 3)



'Code ini untuk mengembalikan fungsi diatas

rtn = SetWindowPos(OnTop.hwnd, -1, 0, 0, 0, 0, 3)





Cara Menjalankan : Copy code di bawah pada form code)



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)



Private Sub Form_Load()

 this code makes the window stay on top

 rtn = SetWindowPos(OnTop.hwnd, -2, 0, 0, 0, 0, 3)

End Sub




Tag: Always on top