|
|
|
|
 |
Keeping a Window On Top
|
Total Hit (3177) |
«Code LangId=1»'Place this into your Module:
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
Global Const SWP_NOMOVE = 2
Global Const SWP_NO
....Read More |
Rating
 |
|
|
|
 |
SetWindowShape - Create elliptical or rounded forms
|
Total Hit (3608) |
«Code LangId=1»Private Type POINTAPI
X As Long
Y As Long
End Type
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
' Region API functins
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, _
ByVal Y1 As L
....Read More |
Rating
 |
|
|
|
|
 |
CheckUSState - Validate a US state initial
|
Total Hit (2806) |
«Code LangId=1»Public Function CheckUSState(ByVal State As String) As Boolean
If Len(State) = 2 And InStr(",AL,AK,AZ,AR,CA,CO,CT,DE,DC,FL,GA,HI,ID,IL,IN,I" _
& "A,KS,KY,LA,ME,MD,MA,MI,MN,MS,MO,MT,NE,NV,NH,NJ,NM,NY,NC,ND,OH,OK,OR,P" _
& "A,RI,SC,SD,TN,TX,UT,VT,VA,WA,WV,WI,WY,",
....Read More |
Rating
 |
|
 |
Get login information the easy way (without any API call)
|
Total Hit (2996) |
While you can use many different API function to get user and domain information, if you're running under Windows NT or 2000 Server there is a shortest path, based on the fact that the operating system loads many piece of data into environment variables:
«Code LangId=1»
' this code works only un
....Read More |
Rating
 |
|
 |
Correct usage for binary compatibility settings
|
Total Hit (3138) |
When working on an updated version of a COM component, you should always enforce Binary Compatibility in the Component tab of the Project Properties dialog box. When enforcing binary compatibility there are a number of common mistakes that you should stay clear of:
Always use the last EXE or DLL
....Read More |
Rating
 |
|
 |
Caution when moving or resizing forms
|
Total Hit (2891) |
Any action that affects a form's size or position should be inhibited when the form is minimized or maximized, because this causes a runtime error 384. Always double check your code to ensure that when a form is moved or resized – using a Move method or acting on a form's Left, Top, Width or Height
....Read More |
Rating
 |
|
 |
Fixed-length strings allocate and deallocate faster
|
Total Hit (3066) |
Fixed-length strings are generally slower than conventional strings, because all VB string functions and operators only recognize conventional strings, thus all fixed-length strings must be transparently converted to and from conventional strings.
However, arrays of fixed-length strings occupy a
....Read More |
Rating
 |
|
 |
Use ActiveControl to stop a loop
|
Total Hit (3205) |
Often your user interface includes fields whose contents mutually depends on other fields. A typical example is when you deal with conversions from one measurement unit to another. Let's say that you want to let your users enter a temperature either in Celsius or Fahrenheit degrees, so you provide t
....Read More |
Rating
 |
|
 |
Never use the End statement
|
Total Hit (3783) |
There are a lot of risks involved in using End in VB programs: your databases might not be correctly closed, your objects are not correctly terminated, etc. You should always terminate a program by unloading all the forms. You can do this using the following routine:
«Code LangId=1»
For index = F
....Read More |
Rating
 |
|
|
|
|
 |
Working with Arc API (Arc, ArcTo, AngleArc)
|
Total Hit (5164) |
In this article we will explore 3 APIs (Arc, ArcTo and AngleArc).
An arc is a portion or segment of an ellipse, meaning an arc is a non-complete ellipse. Because an arc must confirm to the shape of an ellipse, it is defined as it fits in a rectangle and can be illustrated as follows:
«BR»«P Al
....Read More |
Rating
 |
|
 |
How to Print a Multiline TextBox with Alignment!
|
Total Hit (5181) |
API Declarations
«Code LangId=1» 'Add this to your Declarations Section:
Public Declare Function SetTextAlign Lib "gdi32.dll" (ByVal hdc As Long, ByVal wFlags As Long) As Long
Public Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wmsg As Long, ByV
....Read More |
Rating
 |
|
 |
Connection strings for various OLEDB Data Providers
|
Total Hit (2801) |
OLE DB Providers for Active Directory Service, Advantage, AS/400 (from IBM), AS/400 and VSAM (from Microsoft), Commerce Server, DB2, DTS Packages, Exchange, Excel, Internet Publishing, Index Server, Microsoft Jet, Microsoft Project, MySQL, ODBC Databases, OLAP Services, Oracle (from Microsoft), Orac
....Read More |
Rating
 |
|
 |
How to Show SubItem Icons in the ListView
|
Total Hit (888) |
In perhaps the strangest (and most useless) of extended example, this code adds to each subitem the same icon displayed as the main item icon. I have yet to determine how (or if) a subitem-specific icon can be shown instead of duplicating the main item icon, or frankly, why one would ever want this
....Read More |
Rating
 |
|
|
 |
Tutorial : Using DLLs and The Windows API
|
Total Hit (2432) |
Windows provides a number of function calls, in the form of DLLs, that are useful to VB programmers. You can also co-opt DLLs from other programs to do work for you. We'll concentrate on using the Windows DLLs here, but what we learn is widely applicable
....Read More |
Rating
 |
|
|
 |
vbAccelerator CommandBar Control
|
Total Hit (2154) |
The vbAccelerator CommandBar control is a full toolbar/menu control which currently offers configurable styles, colours and a full-object model for configuring the buttons and menus. The control can draw in Office 2003, Office XP, MS Money and System styles, supports icons with alpha-channels and ru
....Read More |
Rating
 |
|
|