|
|
|
|
|
SetMenuBitmap - Add a bitmap to a menu item
|
Total Hit (3834) |
«Code LangId=1»
Private Declare Function GetMenu Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, _
ByVal nPos As Long) As Long
Private Declare Function SetMenuItemBitmaps Lib "user32" (ByVal hMenu As Long, _
ByVal nPositio
....Read More |
Rating
|
|
|
|
AlwaysOnTheTop - Move a form on top of all other windows
|
Total Hit (2235) |
«Code LangId=1»
Private 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
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const SWP_SHOWW
....Read More |
Rating
|
|
|
|
Monday - retrieving the date of the Monday for a specified week
|
Total Hit (2793) |
«Code LangId=1»
' Return the date of the Monday for a specified week..
' This function can be tweaked to return any weekday. I use it in Access to
' subdivide reports into weekly units, since Access displays only a number
' between 1 and 53 for the week when you group dates by week.
'
' Note
....Read More |
Rating
|
|
|
ArrayStdDev - The standard deviation of a numeric array
|
Total Hit (3243) |
«Code LangId=1»' The standard deviation of an array of any type
'
' if the second argument is True or omitted,
' it evaluates the standard deviation of a sample,
' if it is False it evaluates the standard deviation of a population
'
' if the third argument is True or omitted, Empty values are
....Read More |
Rating
|
|
|
|
Correctly restore mouse cursor
|
Total Hit (3407) |
When you write lengthy procedures, it is a good habit to change the mouse cursor to an hourglass, and restore it to the original shape when the procedure exits. However, this cursor tracking may be rather difficult when the procedure has multiple exit points, or when it can exit abruptly because of
....Read More |
Rating
|
|
|
Compound member attributes
|
Total Hit (2762) |
The Procedure Attributes dialog includes a Procedure ID combo box, that lets you associate a particular ID to a given member of the class. You usually use this combo to make a property or a method the default item of a class or an ActiveX control, but there are other uses as well. For instance, you
....Read More |
Rating
|
|
|
Passing Public class variables by reference
|
Total Hit (3002) |
Under VB4 Public variables in form and class modules were implemented in the same manner as variables in BAS modules, that is, as direct references to memory locations. This allowed VB programmers to create procedures that modified values passed by reference, as in:
«Code LangId=1»
'--- the CIn
....Read More |
Rating
|
|
|
Provide a short description of the menu item being highlighted
|
Total Hit (2396) |
Visual Basic lacks of the capability to display a short description of the menu command being highlighted with the mouse or the keyboard, a feature that all professional applications should have. To add menu descriptions to your program, you must subclass the form and trap the WM_MENUSELECT message.
....Read More |
Rating
|
|
|
Incremental searches within list boxes
|
Total Hit (2600) |
The DBList and DBCombo controls expose a MatchEntry property, that - when set to True - permits to perform quick incremental searches by simply typing the searched sequence of characters. If MatchEntry is set to False, any time the user presses a key, the next item that begins with that character be
....Read More |
Rating
|
|
|
Print an Image contained in a Picture Box or a Form
|
Total Hit (2448) |
Module
«Code LangId=1» 'Print the Picture contained in a PictureBox or a Form
Public Sub PrintImage(p As IPictureDisp, Optional ByVal x, Optional ByVal y, Optional ByVal resize)
If IsMissing(x) Then x = Printer.CurrentX
If IsMissing(y) Then y = Printer.CurrentY
If IsMissing(resiz
....Read More |
Rating
|
|
|
How to read data from Excel file
|
Total Hit (3713) |
Many times we have requirements to load data from CSV file, text file or Excel file...
In this article I will show a sample code which reads a specified rows and columns from excel file.
«code LangId=1»Private Sub Command1_Click()
ImportExcelToSQL "c:\temp\diamond_upload.xls", 0, 20, True
....Read More |
Rating
|
|
|
How to change printer port using API ?
|
Total Hit (4501) |
«code LangId=1»Option Explicit
Private Type PRINTER_DEFAULTS
pDatatype As String
pDevMode As Long 'DEVMODE
DesiredAccess As Long
End Type
Private Declare Function GetPrinter Lib "winspool.drv" Alias "GetPrinterA" (ByVal hPrinter As Long, ByVal Level As Long, pPrinter As Long
....Read More |
Rating
|
|
|
Working with string APIs
|
Total Hit (2423) |
«code LangId=1»Private Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" ( _
ByVal lpString1 As String, _
ByVal lpString2 As String) As Long
Private Declare Function lstrcmp Lib "kernel32" Alias "lstrcmpA" ( _
ByVal lpString1 As String, _
ByVal lpString2
....Read More |
Rating
|
|
|
How to check whether your program is running on Windows NT/2000 ?
|
Total Hit (2114) |
This simple code will tell you whether your program is running on NT/2000 platform or Win9x/ME.
«b»Step-By-Step Example«/b»
- Create a standard exe project
- Add the following code in the form1 code window
«b»Form1.frm«/b»
«code LangId=1»' Types, constants and functions for OS version d
....Read More |
Rating
|
|
|
How To Use High-Level Access Control APIs from Visual Basic
|
Total Hit (4784) |
The Win32 API provides two sets of APIs for working with security descriptors (SDs) and access control lists (ACLs). Low-level as well as high-level access control API sets provide an interface for working with SDs and ACLs. For Microsoft Windows 2000 and MIcrosoft Windows XP, the high-level access
....Read More |
Rating
|
|
|
|
|
|
Creating a Common Control Status Bar via API
|
Total Hit (980) |
In this second article written for VBnet by Brad Martinez, Brad works out the magic behind the Win32 Status Bar common control (window) exposed by the common control library Comctl32.dll without the use of Comctl32.ocx. Subsequent pages will introduce more functionality in creating the control.
T
....Read More |
Rating
|
|
|
|
Using Popup Menu ActiveX DLL to create SysTray Menus with Icons
|
Total Hit (2521) |
This sample shows how to use the newly introduced ShowPopupAbsolute method of the PopupMenu ActiveX DLL to implement a icon menu in the SysTray.
The code expands upon the "SysTray the Easy Way" sample. Essentially this project uses a VB form as a class which exposes an easy to use interface for a
....Read More |
Rating
|
|
|
Add Your App to the Systray the Easy Way
|
Total Hit (2624) |
This sample application presents a small form which you can drop into your project to get immediate SysTray support. A lot of the source code I've seen for VB SysTray interfaces has used an OCX or DLL and subclassed for a SysTray message, however, it turns out you don't need to do this, because you
....Read More |
Rating
|
|
|
Enabling Mouse Gestures with a WH_MOUSE hook
|
Total Hit (2337) |
Use of mouse gestures to control application is becoming increasingly common in the more sophisticated web browsers. This sample demonstrates how you can support a range of mouse gestures in a Visual Basic application using a Windows Hook.
|
Rating
|
|