|
How to add path to the PATH environment variable using VB/VBScript
|
Total Hit (5358) |
Many times we need to add application path to the existing environment PATH variable. This can be very tedious job if you have to do for several machine. I came up with some handy script which makes my life easy and hopefully you can use too.
The sample code was used in VB6 but you can use it wit
....Read More |
Rating
|
|
|
Get list of installed ODBC drivers using ODBC API.
|
Total Hit (7727) |
Here is a small code snippet to list all installed ODBC Drivers (name and attribute). On my machine I got the following output.
«code LangId=0»
SQL Server
UsageCount=3 : SQLLevel=1 : FileUsage=0 : DriverODBCVer=02.50 : ConnectFunctions=YYY : APILevel=2 : CPTimeout=60
--------------------------
....Read More |
Rating
|
|
|
How to retrive only visible items of treeview control?
|
Total Hit (5712) |
If you want to retrive only visible item count for treeview control then you can use TreeView1.GetVisibleCount but the problem is this will only return items which are 100% visible so it wont give you exact number.
In this article I will show you the trick to get only visible items of treeview u
....Read More |
Rating
|
|
|
Retriving ICMP statistics using GetIcmpStatistics API
|
Total Hit (2752) |
This code will show you use of GetIcmpStatistics API which can give you some important information regarding ICMP information.
Here is the sample output of this program
«code LangId=0»# Messages [in/out] : 9/11
# Error [in/out] : 0/0
# Redirects [in/out] : 0/0
# Echos [in/out] :
....Read More |
Rating
|
|
|
Working with file time APIs
|
Total Hit (9522) |
The date and time functions retrieve and set the date and time for the system and individual files.
There are five time formats. Time-related functions return time in one of these formats. You can also use the time functions to convert between time formats for ease of comparison and display. The
....Read More |
Rating
|
|
|
Setting Custom Paper Size using Printer API
|
Total Hit (33624) |
Here is the alternate method which shows how to use printer APIs to set custom papersize and other printer properties using API. This code will work with Win9x and WinNT both.
|
Rating
|
|
|
|
|
|
|
GetDirectories - Returns all the subdirectories of a directory
|
Total Hit (3206) |
«Code LangId=1»' Returns a collection holding all the subdirectories in a path
' that match search attributes (optionally it returns the entire path).
Function GetDirectories(path As String, Optional Attributes As VbFileAttribute, _
Optional IncludePath As Boolean) As Collection
Dim d
....Read More |
Rating
|
|
|
RLECompress - Compress a block of memory using RLE algorithm
|
Total Hit (3560) |
«Code LangId=1»Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (dest As _
Any, source As Any, ByVal Bytes As Long)
' compress a block of memory (a string, an array, a bitmap)
' using the RLE compression algorithm
'
' Returns True if the block has been compressed,
'
....Read More |
Rating
|
|
|
Silent install with VB6 Deployment and Packaging Wizard
|
Total Hit (2127) |
VB6 Deployment and Packaging Wizard's resulting setup.exe has a command line switch that allows for a silent install. This feature is virtually undocumented except in the source code for Setup1.exe. The default path for the project file of Setup1 is:
C:\Program Files\Microsoft Visual Studio\VB98\
....Read More |
Rating
|
|
|
Create UDL files the easy way
|
Total Hit (2063) |
The standard way to create a UDL file is to right-click in the directory where you want to create it and select the New-Microsoft Data Link menu command. Unfortunately, on many computers, this manual procedure won't work, because the file type "Microsoft Data Link" does not appear on the "New" menu.
....Read More |
Rating
|
|
|
Play a CD Audio track
|
Total Hit (3568) |
If you want to play a track of an audio CD from VB you can use MCI functions. The main MCI function is mciSendString, that sends command strings to the system and execute them:
«Code LangId=1»
Declare Function mciSendString Lib "winmm" Alias "mciSendStringA" (ByVal _
lpstrCommand As String,
....Read More |
Rating
|
|
|
Determine maximum size and the position of a maximized form
|
Total Hit (2367) |
When the user resizes a form with the mouse or the keyboard, or maximizes it, Windows sends the form a WM_GETMINMAXINFO message, with lParam pointing to a MINMAXINFO structure that the form must fill with information about the minimum and maximum size that it is willing to be resized. Using a subcla
....Read More |
Rating
|
|
|
Counting characters in a file
|
Total Hit (3724) |
Ever needed to count how many characters of a given type are in a file? For instance, how many alphabetical characters, or digits, or spaces? You might read each line of the file using Line Input, but you will probably to load the whole file in memory using one single operation:
«Code LangId=1»
....Read More |
Rating
|
|
|
Write concise code with Boolean expressions
|
Total Hit (2995) |
When setting a Boolean value based upon the result of an expression, avoid using an unnecessary If/Then/Else structure.
«Code LangId=1»
'Instead of using this lengthy syntax . . .
If SomeVar > SomeOtherVar Then
BoolVal = True
Else
BoolVal = False
End If
'Use this one, which is easi
....Read More |
Rating
|
|
|
Create Controls at RunTime
|
Total Hit (4629) |
API Declarations
«Code LangId=1» 'API Calls
Public Declare Function CreateWindowEx Lib "user32.dll" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal n
....Read More |
Rating
|
|
|
Tile image in MDI Background.
|
Total Hit (3022) |
This code Requires MDIForm and 1 Picturebox.
Set Picture property of picturebox. This picture will be used for MDI Background
|
Rating
|
|
|
|
Review of “Network Programming for Microsoft® Windows®”
|
Total Hit (2303) |
If you are, as I was, looking for the book that covers the Winsock API and gives examples of how to use it with Visual Basic, you have found what you were looking for. That is, this title is a single one on the market today that keeps in mind that there are thousands of the Visual Basic programmers
....Read More |
Rating
|
|
|
Creating a Common Control Progress Bar via API
|
Total Hit (862) |
The advantages of this implementation are obviously beneficial. First and foremost the need to distribute Comctl32.ocx with an application is eliminated, reducing distribution size. Also an application's memory footprint is significantly reduced by not loading an ActiveX control. And finally, there
....Read More |
Rating
|
|
|
Mimicking the PrintScreen Function Using OLE
|
Total Hit (589) |
This code makes use of the OLE standard interface in Windows95/Windows98 to copy the contents of the desktop (the screen) into a PictureBox and save it to disk. To use this code, you must assure that the Standard OLE Types Reference to file \Windows\System\OLEPRO32.DLL is included in the project's r
....Read More |
Rating
|
|
|
Determine whether a file is in the Internet Explorer cache
|
Total Hit (2199) |
If you are creating a shortcut to an Internet file, you will want to know whether it has been visited or not so you can colour it appropriately. This tip shows you how to determine whether a file is in the cache so you can do this.
|
Rating
|
|
|
Reading and Writing MP3 ID3v1 and ID3v2 Tags
|
Total Hit (1043) |
This article describes the MP3 ID3v1 and ID3v2 tags and provides a sample application which can read and write both types from MP3 files, along with two reusable classes wrapping up the tag functionality.
|
Rating
|
|
|
vbAccelerator Visual Studio Style Tab Control
|
Total Hit (1472) |
This control reimplements the tab drawing code used in the vbAccelerator MDITabs Control as a fully-featured Visual Studio style Tab Control, with a fully-typed object interface. It also supports pinning and unpinning tabs, so when they're unpinned they show a small vertical tab-bar which slides-out
....Read More |
Rating
|
|
|
Creating ListView Style Groups with SGrid 2
|
Total Hit (2383) |
This sample demonstrates how to use owner-draw to customise the appearance of grouping rows, and to ensure that they remain open in the style of the Windows XP ListView in grouped mode. It also demonstrates adding new rows to a grouped grid and moving them to the correct position given the current s
....Read More |
Rating
|
|
|
|