|
How to add path to the PATH environment variable using VB/VBScript
|
Total Hit (5601) |
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 (7996) |
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 Add/Delete Printer Programatically using API?
|
Total Hit (29197) |
This article will show you step by step approch to Add and Delete Printer Programatically without any user interaction.
When writing a Win32 application that installs a network printer connection, you must take into consideration differences in printing if the application will be run under both W
....Read More |
Rating
|
|
|
|
|
|
|
ForceTextBoxCase - Set a textbox's upper/lowercase style
|
Total Hit (2085) |
«Code LangId=1»Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) A
....Read More |
Rating
|
|
|
ShortPathName - Convert a long file name to 8.3 format
|
Total Hit (3402) |
«Code LangId=1»Private Declare Function GetShortPathName Lib "kernel32" Alias _
"GetShortPathNameA" (ByVal lpszLongPath As String, _
ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
Const MAX_PATH = 260
' Convert a long file/path name to a short 8.3 name
' the path m
....Read More |
Rating
|
|
|
|
|
Power2 - A power of 2
|
Total Hit (1830) |
«Code LangId=1»
' Raise 2 to a power
' the exponent must be in the range [0,31]
Function Power2(ByVal exponent As Long) As Long
Static res(0 To 31) As Long
Dim i As Long
' rule out errors
If exponent < 0 Or exponent > 31 Then Err.Raise 5
' initialize the arr
....Read More |
Rating
|
|
|
|
Sending Email Using CDO and MAPI
|
Total Hit (4138) |
Sending emails via code used to be cool, but now it is a necessity. Below is code to send email via CDO. If the CDO call fails, it will send using MAPI. NOTE: You must have CDO for NT referenced in your project for this to work.
«Code LangId=1»
' Sends an email to the appropriate person(s)
'
'
....Read More |
Rating
|
|
|
The fastest way to append contents to a TextBox control
|
Total Hit (1984) |
The most intuitive way to append a string to the current contents of a TextBox is through the & string operator, as in:
«Code LangId=1»
Text1.Text = Text1.Text & "more text"
«/Code»
However, you can reach the same result about 4 times faster with the following method: «Code LangId=1»
Tex
....Read More |
Rating
|
|
|
Running an EXE at a particular position with particular dimensions.
|
Total Hit (3448) |
This sample code will show you how to control a shelled application using API.
I have used several tricks in this sample code. Once you know these tricks, you can also use them in your programs. This code will open «b»Notepad«/b» at a specified position with specified window size. You will also
....Read More |
Rating
|
|
|
Listening for and accepting connection requests
|
Total Hit (2900) |
What the title of this article is talking about? Who is listening? Why should it accept any requests? To answer these questions just imagine that you are going to develop a server application that servers one or many client applications via a network. You'll find out that you know nothing about how
....Read More |
Rating
|
|
|
Tying a Treeview and Listview Together via the Tag Property
|
Total Hit (970) |
Unlike most of the other treeview and listview code examples here on VBnet, this one doesn't use APIs. Its creation was prompted by a newsgroup question by someone wanting to have a treeview and listview with similar items, and to behave such that when the user selected a treeview item, the correspo
....Read More |
Rating
|
|
|
Toggling Checkbox Visibility in a Treeview
|
Total Hit (986) |
So now that the ability to display checkboxes has been added to the application (Adding Checkboxes to a TreeView via API), there may be times when it is desirable to hide this functionality. Simply resetting the TVS_CHECKBOXES flag does not do this, as the state image icons are still attached to the
....Read More |
Rating
|
|
|
Obtaining the Combo Box Edit Window Handle
|
Total Hit (1528) |
This method shows how you can obtain the handle to the edit portion of a combo box using the FindWindowEx API. Unlike the GetComboBoxInfo method linked above, this method will work with all versions of Windows 95/98/NT4/2000/XP so far released.
As a further check against the handle returned, you c
....Read More |
Rating
|
|
|
|
Creating a Common Control Progress Bar via API
|
Total Hit (977) |
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
|
|
|
Cellular Automata - Catalytic Reactions
|
Total Hit (876) |
This sample shows demonstrates a cellular automata which was initially designed to mimic catalytic reactions and in particular the Belousov-Zhabotinsky or "Clock" reaction. It produces a great variety of continuously varying, wave-like patterns.
|
Rating
|
|
|
vbAccelerator ComboBoxEx Control
|
Total Hit (1711) |
This article presents an implementation of the Common Controls ComboBoxEx control from scratch in Visual Basic. Although this control is available with some versions of VB, this version provides a number of enhancements including pre-built styles (drive picking, font picking, colour picking) and hel
....Read More |
Rating
|
|
|
vbAccelerator Drop-Down and Popup Form Control
|
Total Hit (1850) |
This control allows you to use any form as a drop-down window, and optionally to drag the form off and float it over the form. The form behaves just like the drop-down windows in Office, albeit you cannot currently dock them (yet!) The code includes a VB titlebar modifier class which ensures that an
....Read More |
Rating
|
|
|
Shell an application and wait asynchronously for completion
|
Total Hit (2724) |
Surprisingly often it comes in handy to be able to shell another application and wait for it to complete. This sample shows what I think is the best way to do it. At least, this method has been totally reliable for me. Its better than some methods I have seen because the application isn't frozen whi
....Read More |
Rating
|
|
|
Drawing with XP Visual Styles
|
Total Hit (1777) |
This sample demonstrates using the UxTheme API calls to draw the various objects provided by current Windows XP Theme. This can be a very powerful and simple technique to providing the latest UI effects in controls and applications, as demonstrated by the No Status Bar and No Progress Bar samples.
....Read More |
Rating
|
|
|
Reading and Saving .ICO files and resources in VB
|
Total Hit (2359) |
VB allows you to load an save .ICO files through the LoadPicture and SavePicture methods, which are implemented in the StdPicture object. Unfortunately, this object was really written for 16 bit Windows and doesn't understand Win32 icons at all. A .ICO resource can contain many different images, at
....Read More |
Rating
|
|
|
|