Rabu, 06 Juli 2011

contoh script VB dari sumber http://vbcodesource.com/vbModules.aspx

NameDescriptionScreenshotDownload

Address Book Database
A basic example I made to show you how to create a database program as a address book. This address book example had a minor update that removed some dead code and set the Data Bar controls DatabaseName location to look for the .mdb database file in the project directory.
Click Here
Audio Level Peak Meter
This is a example from msdn that show the level of the audio playing. This unfortunately only works on some sound cards that has a Peak Input/Output meter. The download is a self-etracting file.
Click Here
Autocomplete Capabilities/Support to Combobox and Textbox Controls
An example of using the SHAutoComplete API to enable textbox and combobox autocomplete capabilities. If you've ever tried to autocomplete comboboxes before and it wouldn't work, its because you need to get the handle to the actual "Edit" window of the control. This example shows how to do that and uses the FindWindowEx API call to get the handle to the combobox edit portion.
Click HereClick Here
Calculator Program

This is a example of a basic, fully working calculator based program with addition, subtraction, division, multiplication, and many more features!

Version 1.1 Update: This update will now clear a previous calculation instead of adding the pressed number to the calculated value. Example: IF you press 1 + 1 and then the = button, it will display 2. But before this update if you pressed another number it would add to the previous number. Lets say you pressed 3, then it would read 23. This update fixes that problem and will start a fresh calculation before adding the pressed number.

Click HereClick Here
CD Class Module with Example v2.1

This is the latest CD player class module I put together with a example. More features added. Added support for selecting cdrom drive. I decided not to put back up the earlier versions.

Click Here
Change and Set Custom Shaped Forms/Applications
An example of using the SetWindowRgn, CreateEllipticRgn, CreateRoundRectRgn, CreateRectRgn, and CreatePolygonRgn - Windows API Calls. This particular example shows how to create a Round Shaped, Rectangle Shaped, and Elliptic Shaped Form in the application.
Click Here
Change Windows Desktop Wallpaper

A example of how to programmatically change the Windows desktop wallpaper. Uses the SystemParametersInfo Api to do this.

Click Here
Check if a File and/or Folder/Directory Exists or Not
This example simply uses the Dir function and the FileSystemObject located in the Windows Script Host Object Model. The example will throw a messagebox with either a true or false message depending on whether specified path exists or not.
Click HereClick Here
Chr$ Code Converter

This is the source code to the Chr$ code converter I made. Simply convert strings into Chr$ code.

Click Here
Change/Set All Controls Settings/Properties on Form
A small example of how to change settings/properties for control of the same type without having to write code for each individual control. Ex: Say you have 5 textbox controls and you want them all to be cleared. You can do them one by one if you want too... But instead create some simple code to automatically go through all textbox controls and clear the textbox controls text without directly writing code for each Textbox. This example shows how to do that and will save lots of coding/time. This example shows how to Clear All Textboxes Text and to Checkmark all Checkbox controls on the form.
Click HereClick Here
Complete MP3 Player Example

This is source code to a complete MP3 Player I made quite along time ago. I don't know how good the code is. Uses the Windows Media Player.

Click Here
CPU RDTSC/Calculate CPU ClockSpeed in Realtime
This is a example that returns the processors timestamp tick value and also calculates the speed of the processor in real-time. The dll is included in this download. It uses my csRDTSC.DLL.
Click Here
CPU Usage using GetSystemTimes API
A small example of how to get the computers total cpu usage. This example uses the GetSystemTimes API call and calculates to get the system cpu or processor usage. This API can only be used to get the total cpu usage from ALL of the computers processors. Example, if CPU #1 is 100% usage and CPU #2 is 0% usage the total usage would be 50%. Also, this API call is available in Windows XP if Service PAck 1 or Above is installed. OBviously Vista and the like will have it.
Click Here
Create Controls at Runtime
A simple example of how to create controls at runtime. This example makes a label and command button control when the form loads.
Click Here
csSoundPlayer Library v1.1 with Example App

This is a example of how to use my csSoundPlayer Library v1.1 Class in your projects. This Class makes it very easy to add support for playing Waveform sound files.

Click Here
Download File
Shows you a couple very easy ways to download files from the internet using the url. Uses api, no controls. You can download files, webpages ect.. If someone has right clicking disabled.
Click Here
Downloading via .NET COM Wrapper Example

A simple Legacy(5.0/6.0) VB example of how to use the COMClass I made with VB 2005 to give the VB.COM(5.0/6.0) versions simple download capabilites by Interopting (Fusion) with the .NETFramework. The 2005 project and VB 5.0/6.0 Example of using the wrapper is included with this zip.

Click HereClick Here
Drag and Drop
This example show a way you can fake a drag/drop with listboxes. It does not use the official Drag/Drop features of VB.
Click Here
Drawing Example
I updated this example and it has now been improved. You no longer have to move the mouse slow to keep from skipping. This example shows how to draw using the mouse.
Click HereClick Here
Environment Variables - Getting/Retrieving Hardware/System Information
This example simply shows how to use the GetEnvironmentVariable API to lookup pre-defined variables and get/retrieve their values. To view some available variables go to Start / Settings and Control Panel and then click on the System icon under the Control Panel. Click on the Advanced tab and click the Environment Variables button which will display a window with the variables and their values.
Click Here
FX.DLL with SDK - Version 1.03
The FX technology offers you fast, powerful and safe Graphical Device Interface (GDI) based solutions. The FX library is written in Microsoft Visual C++ 6.0 and is designed for the Win32 subsystem. The FX library supports all Windows platforms.
Click Here
Get/Save Settings

Shows you how to use the Get Setting and Save Setting functions in VB 6.0.

Click Here
Get Low-Level Memory Performance Information Example
A small example of using the GetPerformanceInfo API Function with the PERFORMANCE_INFORMATION structure converted from C++ to VB to get some low-level information about the computers memory based data. Gives you the Total/Available Physical Memory (Ram), Handle Count, Thread Count, Processes, Kernel Related Memory Data, Commit Charges, System Cache and more.
Click Here
Get the Last Time the User was Active
This is a small example of using the GetLastInputInfo API call, that returns the current tickcount value of when the user was active and if the user is sitting idle, or reading something, or away from the computer and what-not. This example monitors the tickcount value and if the value has changed since the last check, it will display the actual Time of Day the user did something. This API mainly checks for Mouse and Keyboard activity in case you wanted to know. :)
Click HereClick Here
Hide and Show Caret in Combobox and Textbox Controls
This is a small example of using the HideCaret and ShowCaret API calls to hide the caret (or blinking cusor) in the textbox or combobox control. Remember that the control whose caret you want to hide or show Must have caret ownership at the time of calling or it will fail. Also when the control loses ownership it will reset and you will have to call the APIs again.
Note: IF you always want the caret to be hidden in the control, try putting the HideCaret code in the GotFocus event of the control.
Click Here
Load Textfile in Listbox
Shows how you can load a textfile in a listbox control.
Click Here
Login/Logon a Application with Username and Password Protection
A small example of using both Inputboxes or using a Form to require proper username and password credentials for authorization. A option is available to require case sensitive username and password or non case sensitive.
Click Here
Meta Tag Generator
This is the source to my Meta Tag Maker. Simply enter the keywords and descriptions you want, and it will do the rest. Then just copy and paste the output code.

Click Here
Misc/Various Windows Information
Uses api to show you how to get some Windows based information. Get the Windows Directory, System Directory, Temporary Directory, User name and Computer name.
Click Here
Movie Module with Example
This is a example of using my movie module to play various movie formats. You can install new codecs to play even the most recent formats too.
Click Here
MP3 Encoder Example
This is great example of encoding a wave file to a mp3 file using a C++ DLL. The C++ .dll is based around the Lame Encoder If I remember correctly.
Click Here
MP3 Player
This example shows how to play mp3's with the window media player control. It uses the Windows Media Player control.
Click Here
MP3 Player with Module
This example shows how to use my MP3 Class Module for playback of MP3 files.
Click Here
Music Player with Module v2.2
This example shows how to use my Music Module. Shows how to get started to make a full-featured music style application.
Click Here
MP3 Tag Editor
This is a example of Reading and Writing MP3 Tags. This example is for version 1.0/1.1 Tag version. NOT 2.0 and above.
Click Here
Multi-Media Module Example
This is a example of how to use my Multi-Media Module to make a media based player.
Pinging Example a using Fusion Wrapper from .NET
A example of using Fusion which is a VB 2005 comclass wrapper that gives Visual Basic 5.0/6.0 basic Ping capabilities. The wrapper contains 2x Functions available to VB 5/6, one that Pings a Network Address and Returns True or False depending on whether the Ping got a reply from the url. The other function is similar to the first except it will return the time it took to get the reply from the url (RoundTripTime). This project includes a Bin directory with the .TLB and .DLL .net files. The source code to the Fusion Wrapper is located under the Visual Basic.NET - Controls sections. The .NETFramework needs to be installed on the target computer for Fusion to work.

Note: I forgot to mention that you will need to compile the VB 2005 project which will register the control as a COM object and then add a reference to its TLB file or Register the TLB File in the Registry. The target computer will likewise have to register the .tlb/.dll control.
Click Here
OCX Example
This is a older example of how to make a ocx file. This example makes a AOL style Command Button.
Click Here
Play Wave File
This is a example from msdn that plays a wave file. If I remember right, it uses the PlaySound API.
Click Here
Search Listbox
A example on how to search a listbox or combobox. Shows you two methods.
Click Here
Set/Scroll Textbox to the Bottom and the Top of its Contents
A simple example of just making a multi-line textbox control scroll to the bottom of its contents and also scroll/move to the Top of its contents.
Click Here
Shutdown, Restart, and Log Off ALL versions of Windows (XP too) using ExitWindowsEX API - VB5/VB6

A short, sweet, and simple example of using the ExitWindowsEx API to Shutdown, Restart, and Log Off Windows INCLUDING Windows 2000/XP, and should work with Vista as well. If you've ever had the problem of ExitWindowsEx not working with Windows 2000/XP and above then check out this example to see Why :) The short answer is you need to adjust your application token to give it the proper priviledges before Windows will respond.

Click Here
Shutdown, Restart, Log Off - Windows XP
This is a example of how to Shutdown, Restart, and Log Off Windows XP using code. This uses Shell code. It works very well. I only tested the Shutdown code but the others should work. Note: The shutdown service will obviously need to be running for this to work. It is by default so you shouldn't see to many cases of this code not working.
Click Here Click Here
Timing - Standard Resolution using GetTickCount
A example of using the GetTickCount() API function to time Visual Basic code. There are obviously other reasons for using the counter as well. But anyways, this timer has a resolution of about 15-16 milli-seconds but should Not use all that many resources. This example shows how to get the timers resolution and to see how long it takes to complete some looping based code.
Click Here
Timing - Better Resolution using timeGetTime
A example of using the timeGetTime API function to time Visual Basic code. It also uses the timeBeginPeriod and timeEndPeriod APIs to specify the resolution to set the counter too. This counter/timer supports up to 1 milli-second resolutions which is Much higher and more accurate compared to the GetTickCount counter. Depending on what you will use the timer for, it may use more resources than the less accurate GetTickCount timer. The extent is probably very low, especially if you are not using the timer all that much. This example shows how to get the timers resolution and to see how long it takes to complete some looping based code.
Click Here
Timing - High Resolution using QueryPerformanceCounter/QueryPerformanceFrequency
This is a basic example of how to get much higher resolution timing using the QueryPerformanceCounter and QueryPerformanceFrequency API calls. This counter supports sub-millisecond resolutions so it is obviously more precise than the getTickCount and timeGetTime API timers. Most of the time this counter/timer will try to use a clock on the computers motherboard which is usually about 3.6mhz. But sometimes this timer will use the CPUs actual RDTSC Counter which will obviously be even better resolutions. Simply call the QueryPerformanceFrequency api and examine the Byref parameter value to see what the counts are per second to determine which timer is used. 3579545 tps (ticksPerSecond) is the most likely value. IF a 0 is returned then the computer most likely does NOT support this timer/counter or the API calls parameter is not passed Byref which is what this API requires. Do NOT pass these 2x QueryPerformance API parameters ByVal (By Value). They will fail if you do. MUST be passed ByRef (By Reference). :)
Click Here
Tone Generator
Example of how to generate tones with different frequencys and durations. Could be good for morse code.
Click Here
Using Modules/BAS Files
This is a example I put together to show how to use a bas file. I made it for someone that wanted to know how to use a module. This is very basic.
Click Here
Volume Example
This is a example from msdn that show how to control the volume bar.
Click Here




Ditulis Oleh : Adi Paryanto // 21.08
Kategori:

0 komentar:

Poskan Komentar

 
Jababeka Komputer 2008. Diberdayakan oleh Blogger.