|
|
|
|
|
|
|
Moving a Window Without a Titlebar
|
Total Hit (3522) |
«Code LangId=1»'Place this code in the declarations section of your form:
Option Explicit
Declare Function ReleaseCapture Lib "user32" () As Long
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As _
Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Lo
....Read More |
Rating
|
|
|
|
|
SaveImageList - Save the images in an ImageList control
|
Total Hit (3902) |
«Code LangId=1»
' Save all the images in an ImageList control to a disk file
' Images can be later loaded in the same ImageList control using the
' LoadImageList routine
'
' Note 1: if the file exists, it is overwritten
' Note 2: this routine always save the contents of the ListImages collecti
....Read More |
Rating
|
|
|
|
|
WindowsDirectory - The path of the Windows directory
|
Total Hit (1994) |
«Code LangId=1»Private Declare Function GetWindowsDirectory Lib "kernel32" Alias _
"GetWindowsDirectoryA" (ByVal lpBuffer As String, _
ByVal nSize As Long) As Long
' Return the path of the Windows directory
Function WindowsDirectory() As String
Dim buffer As String * 512, lengt
....Read More |
Rating
|
|
|
AddBackslash - Append a backslash to a path if needed
|
Total Hit (3164) |
«Code LangId=1»' Append a backslash (or any character) at the end of a path
' if it isn't there already
Function AddBackslash(Path As String, Optional Char As String = "\") As String
If Right$(Path, 1) <> Char Then
AddBackslash = Path & Char
Else
AddBackslash = Path
....Read More |
Rating
|
|
|
Setting a pixel color
|
Total Hit (3604) |
The PSet method is much slower than it should actually be, and in most cases you will find it convenient to substitute it with direct calls to the SetPixel API functions. This function is about twelve times faster than the VB's method, at least when you can set the form's ScaleMode to Pixels, for mo
....Read More |
Rating
|
|
|
Create and delete DSN at runtime
|
Total Hit (10634) |
If you're developing a VB database application, you're probably using a DSN (data source name) because it makes the access to your database file easier. Of course, when you distribuite your application, you must create the DSN.
There are some installation programs that offers the possibility to
....Read More |
Rating
|
|
|
|
Storing objects in the Tag property
|
Total Hit (4558) |
The Tag property exposed by many Windows Common Controls (including TreeView's Node objects and ListView's ListItem objects) is more versatile than the ListBox and ComboBox controls' ItemData property, because it is of Variant type and can therefore accept values of most data types.
However, it
....Read More |
Rating
|
|
|
Don't test auto-instancing variables using Is Nothing
|
Total Hit (2995) |
You can't reliably test an auto-instancing object variable using the Is Nothing test, because as soon as you reference the variable Visual Basic silently creates an object of the given class, and the test always returns False:
«Code LangId=1»
Dim x As New MyClass
If x Is Nothing Then
' this
....Read More |
Rating
|
|
|
Prevent dragging elements in a ListView control
|
Total Hit (3206) |
The ListView control doesn't expose any property that lets you disable the dragging of its elements. To do so, you must trap the WM_NOTIFY message that the ListView control sends its parent form when the drag operation begins, and "eat" it. Using the MSGHOOK.DLL subclassing library it's easy to acco
....Read More |
Rating
|
|
|
Change caret size and blink rate
|
Total Hit (4059) |
You can alter the size of the caret (this is the name of the cursor within text boxes, not to be confused with the mouse cursor), for instance to ease visibility on notebook computers, or to signal that the text box is in overwrite mode. All you need is a couple of API functions:
«Code LangId=1»
....Read More |
Rating
|
|
|
Using GetPath and PolyDraw API to extract and draw path segments.
|
Total Hit (5617) |
GDI Paths are different than most of GDI objects. Path doesn't have handle but they always bound to device context. Path can be generated by calling BeginPath and EndPath API. Here the example how path can be generated.
«code LangId=1»BeginPath(Me.hDc)
'//....
'//Draw Lines
'//Draw Polygon
'/
....Read More |
Rating
|
|
|
|
Optimize Parametrized Queries With ADO Objects
|
Total Hit (3144) |
When you write Insert statements, it can be difficult to accommodate the possible values end users might enter into a textbox. The most common task is replacing single quotes with double quotes. However, parameterized queries provide two benefits: You do not have to parse data entered by users—excep
....Read More |
Rating
|
|
|
|
|
|
Tutorial : Drawing & Animation
|
Total Hit (1573) |
These tutorials are were originally developed as part of a VB Game Programming for beginners book Soren and I were working on. For a variety of reasons the book idea never came to fruition and so we decided to post the material that is finished as a series of tutorials in the hopes that you would fi
....Read More |
Rating
|
|
|
Binding a socket : Winsock API Test Bench sample application
|
Total Hit (3627) |
Today we will learn how to use the bind Winsock API function that allows to associate a local address with a socket. We'll modify the Winsock API TestBench sample application in order to give the user of the program to specify local host address and port number for a socket.
....Read More |
Rating
|
|
|
279815 - How To Validate User Credentials from Visual Basic by ...
|
Total Hit (3034) |
A user's credentials are made up of his or her user name and password, which can be used to validate the user on a given Microsoft Windows NT, Microsoft Windows 2000, or Microsoft Windows XP domain. This article demonstrates how to call the Security Support Provider Interface (SSPI) functions from M
....Read More |
Rating
|
|