|
|
Working with Resource file
|
Total Hit (6036) |
Resource file is embedded into you compiled exe, dll, ocx etc. You can store Icon, Cursor, AVI, GIF, Bitmap word document or any thing you want. VB provides few function to access application resource but these functions (LoadResData, LoadResPicture and LoadResString) not enough if you want more fle
....Read More |
Rating
|
|
|
|
How to add your own menu item in System menu ?
|
Total Hit (4761) |
This sample code will show you
- How to add a new menuitem in the system menu using InsertMenuItem API
- How to respond to the events generated by new menuitem with the subclassing technique
- How to get/set item state using GetMenuState and SetMenuItemInfo APIs
- How to remove menuitem from
....Read More |
Rating
|
|
|
How to Write Multiple String to Windows NT EventLog ?
|
Total Hit (3353) |
This example code will show you how to write to EventLog. If you have defined Message with multiple parameter substitutions then you have to pass pointer to array of string pointers....!!! Sounds little complicate huhhhhh.. Lets see actual code to clear this confusion.
Note : Before you write to
....Read More |
Rating
|
|
|
|
|
|
|
|
RandomString - Generate a random string using a mask
|
Total Hit (2350) |
«Code LangId=1»' generate a random string
'
' the mask can contain the following special chars
' ? : any ASCII character (1-127)
' # : a digit
' A : an alphabetic char
' N : an alphanumeric char
' H : an hex char
' all other chars are taken literally
' Example: a random-ge
....Read More |
Rating
|
|
|
BinToDec - Convert from binary to decimal
|
Total Hit (4121) |
«Code LangId=1»' convert from binary to decimal
'
Function BinToDec(value As String) As Long
Dim result As Long, i As Integer, exponent As Integer
For i = Len(value) To 1 Step -1
Select Case Asc(Mid$(value, i, 1))
Case 48 ' "0", do nothing
Case 4
....Read More |
Rating
|
|
|
Any2Dec - Convert from any numeric base to decimal
|
Total Hit (3330) |
«Code LangId=1»' convert from any base to decimal
' BASE can be in the range 2-36
Function Any2Dec(ByVal otherBaseNumber As String, ByVal base As Integer) As Long
Dim index As Long
Dim digits As String
Dim digitValue As Long
' check base
If base < 2 Or base > 36 T
....Read More |
Rating
|
|
|
Generating IDL code to overcome binary compatibility issues
|
Total Hit (3571) |
Among the different COM details that VB hides to the programmers, one of the most problematic one is that it doesn't let you take control on interface GUIDs. Binary compatibility settings in VB try to make you follow COM rules (as a fact breaking such rules with the interface forward mechanism it si
....Read More |
Rating
|
|
|
Hide the application in the Task List dialog
|
Total Hit (3373) |
As you know, when you press CTRL+ALT+CANC the Task List window appears. This dialog allows you to see all the running processes and also to terminate them. If you don't want that your application be closed, you can prevent the application from being displayed in the Task List dialog, by using the Re
....Read More |
Rating
|
|
|
Determine the Windows version (without any API call)
|
Total Hit (3244) |
You can use the GetVersion or GetVersionEx API functions to determine which Windows version the application is running on. However, there is a much simpler solution, based on the fact that Windows NT creates an environment variable named "OS" while Windows 95/98 don't. So you can quickly discern bet
....Read More |
Rating
|
|
|
Copy the contents of the WebBrowser control to the Clipboard
|
Total Hit (7581) |
To programmatically copy text from the WebBrowser control you can use its ExecWB method, to which you must pass the OLECMDID_COPY constant as its first argument.
WebBrowser1.ExecWB OLECMDID_COPY, OLECMDEXECOPT_DODEFAULT
You can also select the entire WebBrowser's contents by invoking the Exec
....Read More |
Rating
|
|
|
Copy a directory tree
|
Total Hit (3043) |
Creating a VB routine that copies a whole directory tree can be a time-consuming job, but fortunately you don't have to do it. In fact, you can quickly create an entire folder, including all its subfolders, using the CopyFolder method of the FileSystemObject object, that is exposed by the Microsoft
....Read More |
Rating
|
|
|
Logging under a different name makes your add-ins disappear
|
Total Hit (2212) |
After you install Visual Basic and log on to the machine as a different user (with or without administrator privileges), you cannot see any Add-Ins in the Add-In dialog in Visual Basic.
I ran across this problem when I logged in and installed VB6 on NT Workstation under my User, for a developer
....Read More |
Rating
|
|
|
Use Sleep API to add pauses to your programs
|
Total Hit (4043) |
Don't use an empty For...Next loop to add pauses to your programs; instead, use the Sleep API function, that releases the CPU and lets other apps in the system effectively multitask:
«Code LangId=1»
Declare Sub Sleep Lib "kernel32" (ByVal milliseconds As Long)
' pause for 5 seconds
Sleep 5000
....Read More |
Rating
|
|
|
Static Variables are slower than Dynamic ones
|
Total Hit (3978) |
Referencing a static local variable in a procedure is 2-3 times slower than a regular local, dynamic variable; if you want to really speed up your procedures, convert all static variables into module-level variables.
The only drawback to this approach is that the procedure become less self-conta
....Read More |
Rating
|
|
|
Tunnel graphical effect
|
Total Hit (1799) |
Usage
«Code LangId=1»
'Create a Form and place this code inside
'Sorry but the comments are in german :((
Option Explicit
Dim offx% ' x-offset zur mitte
Dim offy% ' y-offset zur mitte
Dim anz% ' anzahl sterne
Dim bahnx%(100, 180)
....Read More |
Rating
|
|
|
Compact and Repair Access MDB.
|
Total Hit (2955) |
Following code requires Microsoft DAO 3.6 reference.
To add this reference goto Project->Reference
example:
«Code LangId=1»
Call DBCompact("OLt.mdb", "tmpOLT.mdb", , , ";pwd=mypwd")
«/Code»
|
Rating
|
|
|
DNS Inside Out (DNS Client sample application)
|
Total Hit (2578) |
Today we are going to find out what is going on behind the scenes when our application calls such Winsock API functions as gethostbyname and gethostbyaddr. In other words, we’ll explore the communication session model between a client application and a DNS server. Afterwards, you’ll be able to devel
....Read More |
Rating
|
|
|
How to create folder on remote machine using WMI
|
Total Hit (1191) |
Hey, AN. Life is full of mysteries. To name one, what possessed somebody to think that the world was clamoring for Clamato juice, an unholy concoction combining tomato juice and clam juice? (As long as we’re on the subject: clam juice?) To name another, why is it that neither the FileSystemObject no
....Read More |
Rating
|
|
|
Pre-selecting a Folder using the Browse Callback
|
Total Hit (1513) |
Add a callback routine to your VB5/6 code to allow pre-selecting of a file system object when displaying the Browse for Folders dialog. Added version-detecting code and necessary changes to allow the String method to function on NT
|
Rating
|
|
|
Enumerating Windows Fonts with Preview
|
Total Hit (1307) |
This is the code required to enumerate the system fonts into a listbox using a callback routine, and provide a sizeable preview of the font selected.
|
Rating
|
|
|
ComCtl32.DLL HotKey Control
|
Total Hit (800) |
The hotkey control is one of the controls provided as part of COMCTL32.DLL, but, being of somewhat limited utility, has never found its way into Visual Basic's controls. If you need one, however, it does the job really well.
When it has focus, you can press CTRL, ALT and SHIFT key combinations,
....Read More |
Rating
|
|
|
Custom Drag-Drop Images Using ImageLists
|
Total Hit (2269) |
The standard VB drag-drop functionality provides a cursor to indicate that a drag-drop function is in progress. This article demonstrates how to add an image of the object being dragged to the drag-drop control, in the same way that Explorer does using the ImageList APIs.
....Read More |
Rating
|
|
|
Complete Registry control
|
Total Hit (2177) |
The cRegistry class is an easy, self-contained way to get complete access to the Windows registry. Simple methods allow you to create, enumerate and delete keys and values in the registry, without restriction. You can even read/write binary data to the registry. To see how powerful this library is,
....Read More |
Rating
|
|