|
Running an EXE at a particular position with particular dimensions.
|
Total Hit (3346) |
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
|
|
|
Functions to find if file exists...
|
Total Hit (1534) |
«Code LangId=1»Public Function FileExists(filename As String) As Boolean
FileExists = (Dir(filename, vbNormal Or vbReadOnly Or vbHidden Or vbSystem Or vbArchive) <> "")
End Function
«/Code»
Usage
«Code LangId=1» 'Usage:
Private Sub Command1_Click()
If FileExists("C:\Config.sys"
....Read More |
Rating
|
|
|
|
|
|
|
|
ForceTextBoxCase - Set a textbox's upper/lowercase style
|
Total Hit (1989) |
«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
|
|
|
|
TransposeMatrix - Rotate a bi-dimensional array
|
Total Hit (2246) |
«Code LangId=1»
' evaluate the transposed matrix
'
' a transposed matrix is the array you get when
' you "rotate" a bi-dimensional array
Function TransposeMatrix(arr() As Double) As Double()
Dim startRow As Long, startCol As Long
Dim endRow As Long, endCol As Long
Dim r As Lon
....Read More |
Rating
|
|
|
|
|
|
Get the local IP address using the Internet Transfer Control
|
Total Hit (2515) |
The easiest way to retrieve the IP address assigned to the local machine during an Internet session is by means of the LocalIP property of the Internet Transfer Control:
«Code LangId=1»
MsgBox "IP address= " & Winsock1.LocalIp
«/Code»
Note that getting the same information through API calls
....Read More |
Rating
|
|
|
Retrieve CPU information the simple way (NT/2000 only)
|
Total Hit (1530) |
The Windows API includes all the functions you need to retrieve and display information about the CPU the machine is equipped with. However, if you're running under Windows NT or Windows 2000, you don't need to make complicated API calls, because this information is already available in several envi
....Read More |
Rating
|
|
|
|
Download and save an HTML page with the Internet Transfer control
|
Total Hit (2802) |
You can easily download an HTML page by using the Internet Transfer Control (INet). Here's a reusable routine that uses this control to download the HTML page at the specified URL and optionally save it to a local file. In either case the routine returns the contents of the page as a string:
«Co
....Read More |
Rating
|
|
|
The fastest way to append contents to a TextBox control
|
Total Hit (1916) |
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
|
|
|
Create colorful Command Buttons
|
Total Hit (4164) |
The VB CommandButton control supports neither the ForeColor nor the BackColor properties. If you want to create colorful buttons without resorting to 3rd party controls, you can use an OptionButton control with the Style property set to 1-Graphical. Such OptionButton controls appear to be very simil
....Read More |
Rating
|
|
|
How to sort string Array using CompareString API
|
Total Hit (3064) |
CompareString compares two strings and determines which one would come first in an alphabetic sort. Although this function can use a number of different comparisons, by default it conducts a case-sensitive word sort. In a word sort, all symbols except hyphens and apostrophes come before the letter "
....Read More |
Rating
|
|
|
|
How to Add/Delete Printer Programatically using API?
|
Total Hit (28780) |
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
|
|
|
Tying a Treeview and Listview Together via the Tag Property
|
Total Hit (884) |
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 (868) |
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
|
|
|
Changing the Dropdown Width of a Combo Box, Advanced
|
Total Hit (664) |
Like the routine in Changing the Dropdown Width of a Combo Box, this routine performs the same functionality but adds the ability to resize the list at runtime. By calculating the average width of a character in the listbox based on the current font, the dropdown width can change to accommodate the
....Read More |
Rating
|
|
|
|
vbAccelerator ComboBoxEx Control
|
Total Hit (1641) |
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
|
|
|
Keep Form Titlebars in Focus when ToolWindows are Shown
|
Total Hit (2102) |
The ToolWindow style, introduced with VB4, allowing you to easily create pop-up tool windows with small captions. However, there is (and has always been) a problem with them: whenever the form or a control on it gets the focus, it appears that the main form of your application looses focus. Whilst m
....Read More |
Rating
|
|
|
Drawing with XP Visual Styles
|
Total Hit (1701) |
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
|
|
|
Creating Window Shapes from Bitmaps
|
Total Hit (2744) |
The Windows Shape article shows how to use the SetWindowRgn function to apply a geometric region to a window using the GDI region creation functions. However, beyond using a simple geometric region, things get difficult. How do you specify the exact shape you want?
This article demonstrates how t
....Read More |
Rating
|
|