|
Undocumented Shell Path APIs (Extracting Component Parts).
|
Total Hit (4615) |
Way back when Microsoft released Internet Explorer 4.0, they bundled with it a number of upgrades to the operating system including a new DLL called SHLWAPI.DLL (Shell Lightweight Utility APIs). That DLL provided programmers with some useful path manipulation functions (amongst other things), but ob
....Read More |
Rating
|
|
|
Dynamically Add Controls to a Form with Visual Basic 6.0
|
Total Hit (28471) |
Visual Basic 6.0 allows you to dynamically add control to a form at run- time using the new Add method of the Controls collection. This article shows how to dynamically add intrinsic and ActiveX controls.
«pre»«b»Control«/b» «b»ProgID«/b»
==========================================
CheckB
....Read More |
Rating
|
|
|
How to Obtain the name of the computer...
|
Total Hit (3023) |
API Declarations
«Code LangId=1» Private Declare Function GetComputerName Lib "kernel32.dll" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
«/Code»
Module
«Code LangId=1»
Public Function ComputerName() As String
Dim cn As String
Dim ls As Long
Di
....Read More |
Rating
|
|
|
|
|
|
Right Click PopUp Menu
|
Total Hit (1532) |
«Code LangId=1»'First, create a menu using menueditor. Add all of your menu items as if you were just making
'a regular menu. Now set the VISIBLE property of the main menu item to false (see below, set
'the MNUEDIT item's VISIBLE to false). Like this:
'mnuEdit
'---mnuUndo
'---mnuRedo
'---m
....Read More |
Rating
|
|
|
Filter - A replacement for VB6's Filter function under VB5
|
Total Hit (2115) |
«Code LangId=1»' A replace for the Filter function under VB4 and VB5
'
' Note that the source array is modified. For this reason
' this is declared as a Sub rather than a Function
Sub Filter(arr() As String, ByVal Search As String, Optional ByVal Include As _
Boolean, Optional ByVal Comp
....Read More |
Rating
|
|
|
|
|
CComplexNumber - A class for dealing with complex numbers
|
Total Hit (2673) |
«Code LangId=1»Option Explicit
'------------------------------------------
' A class for dealing with complex numbers
'------------------------------------------
' The main properties
Public Real As Double
Public Imaginary As Double
' Initialize this complex number
' (returns Me)
Fu
....Read More |
Rating
|
|
|
|
Print the WebBrowser's contents
|
Total Hit (2983) |
The WebBrowser control doesn't expose any method to directly print its contents. You can achieve this effect through the ExecWB method, by passing the OLECMDID_PRINT constant in its first argument:
«Code LangId=1»
' display the Print dialog
WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_PROMP
....Read More |
Rating
|
|
|
Don't hard-code font names and size
|
Total Hit (1712) |
Unless you have good reason to do otherwise, you should always use standard fonts in your programs, because this ensures that your application will work on every Windows system.
If you want to use non-standard fonts, you should at least adopt the following guidelines:
«Code LangId=1»
Assign
....Read More |
Rating
|
|
|
Write concise code: a collection of simple tips
|
Total Hit (2116) |
If you fully understand how VB and VBA work, you can often save some statements. This makes your listings more concise and more readable, and indirectly optimizes your program. Here is a short list of the many tricks you can use with this goal. You don't need to initialize a numeric variable to 0 or
....Read More |
Rating
|
|
|
Missing Option Explicit directives
|
Total Hit (3234) |
The single statement that is most useful to avoid bugs is Option Explicit. Always use it in every module of your applications. Even better, let the Visual Basic IDE automatically add one whenever you create a new module to your project. You can do it by selecting the "Require Variable Declarations"
....Read More |
Rating
|
|
|
|
How to handle the Mouse Wheel events in your projects (improved)
|
Total Hit (3089) |
API Declarations
«Code LangId=1»
'==============inside a MODULE
Option Explicit
'************************************************************
'API
'************************************************************
Private Declare Function CallWindowProc Lib "user32.dll" Alias "CallWindowProcA"
....Read More |
Rating
|
|
|
Common Dialog Templates - Create a WinZip Style File Add Dialog
|
Total Hit (1070) |
This sample, from Cayce Cochran (cayce@fastlane.net), demonstrates how to use a dialog template with a File Open or Save CommonDialog. It takes advantage of the CommonDialog/Direct DLL component which now (versions dated 1 November 1999 and higher) includes the relevant support for templates.
....Read More |
Rating
|
|
|
|
Using the GetSaveFileName Common Dialog API
|
Total Hit (1428) |
This page provides the code required for the Common Dialog GetSaveFileName API method. OPENFILENAME member descriptions, as well as commented code, are covered in the pages above. Except for the Flags and API name, the code is pretty well a duplicate of the GetOpenFileName code.
....Read More |
Rating
|
|
|
Killing the Default Combo Box Context Menu
|
Total Hit (1124) |
For this to work we have to borrow from the combo method that deals with retrieving the handle to the edit portion of the control (see related topics above). The edit handle is stored, where it is compared to the hWnd passed by the WindowProc procedure. If the handle is that of the edit control, the
....Read More |
Rating
|
|
|
Change the drop-down width of a Combo Box
|
Total Hit (1974) |
This tip shows you how to get and set the width of the drop down portion of a combo box. It also includes code to automatically set the drop down width based on the contents of a combo box by measuring the size of the text in each combo box item.
|
Rating
|
|
|
Detecting Mouse XButton Clicks
|
Total Hit (2085) |
Recently I discovered that my mouse had two strange buttons on the left-hand side (until then I'd thought that the mouse's case just wasn't very well put together). Turns out these are the 'X Buttons' and can be used for moving backwards and forwards in Explorer and IE. This sample demonstrates how
....Read More |
Rating
|
|
|
Slow Grow
|
Total Hit (1649) |
This sample models diffusion-limited aggregation and demonstrates that random behaviours can lead to rather less random-looking results with hardly any constraints on the random behaviour.
|
Rating
|
|
|
vbAccelerator Scroll Buttons Control
|
Total Hit (1290) |
This control provides an implementation of an API scroll bar control which can be extended to display completely configurable buttons at either end of the scroll bar. This way you can add extra functionality like the VB code editor's Procedure/Full Module view buttons or zoom in and out buttons like
....Read More |
Rating
|
|
|
|
Adding Scroll Bars to Forms, PictureBoxes and User Controls
|
Total Hit (2428) |
In the Win32 API, all windows can have scroll bars. However, this feature is not exposed in any way in Visual Basic. Its not too hard to enable, though provided you can intercept WM_HSCROLL and WM_VSCROLL messages sent to the window. This project provides a small, self-contained class which extends
....Read More |
Rating
|
|
|
Making VB Apply XP Visual Styles at Design and Debug Time
|
Total Hit (1410) |
If you want to use XP Visual Styles in a VB application, the fact that the controls don't draw using the new styles at design- or debug-time can be a problem, as your form looks different when once you've compiled. Luckily you can persuade both VB5 and VB6 IDEs to use XP Visual Styles too.
....Read More |
Rating
|
|
|
Text At Any Angle
|
Total Hit (2376) |
VB doesn't provide you with any method to change the angle text is written out at on a Form or PictureBox. This seems to be a curious oversight of the OLE StdFont object, because it is in fact very simple to create a font with angles other than horizontal. This article shows you how to do it. The so
....Read More |
Rating
|
|