|
Tray to Title and Title to Tray Effect using DrawAnimatedRects API
|
Total Hit (4476) |
This little snippet will give you an effect so it looks like that your window is flying from system tray or minimizing to system tray depending on which flag you pass to DrawAnimatedRects API.
Create a standard exe project and place the following code in form1 and run the project to see the effec
....Read More |
Rating
|
|
|
Working with file time APIs
|
Total Hit (9685) |
The date and time functions retrieve and set the date and time for the system and individual files.
There are five time formats. Time-related functions return time in one of these formats. You can also use the time functions to convert between time formats for ease of comparison and display. The
....Read More |
Rating
|
|
|
How to disable form's Close button (X)?
|
Total Hit (5304) |
To modify an item in the Visual Basic Control menu (also known as the System menu), you need to use the SetMenuItemInfo API function. You can use ModifyMenuItem or EnablemenuItem api, both functions work. However it appears that Visual Basic re-enables the menu item whose ID is SC_CLOSE. This is why
....Read More |
Rating
|
|
|
|
|
|
|
|
GetNodeRelationship - Check if two nodes are relatives
|
Total Hit (2114) |
«Code LangId=1»
' Returns a value >0 if Node1 is a parent (or grandparent) of Node2
' Returns a value <0 if Node1 is a child (or grandchild) of Node2
' in both cases the number reflects the number of levels
' between the two nodes
' Returns 0 if the two Nodes are the same or
' if they be
....Read More |
Rating
|
|
|
|
Split - A replacement for VB6's Split function under VB5
|
Total Hit (1907) |
«Code LangId=1»
' A replacement for the Split function under VB4 and VB5
'
' Note that the return value is a Variant that contains
' an array of strings
Function Split(ByVal Text As String, Optional ByVal Delimiter As String = " ", _
Optional ByVal Limit As Long = -1, Optional CompareMe
....Read More |
Rating
|
|
|
BitClear - Clear a bit in a value
|
Total Hit (2786) |
«Code LangId=1»Function BitClear(ByVal value As Long, ByVal bit As Long) As Long
' simply AND with the negation of the bit mask
' Range checking is performed in Power2()
BitClear = (value And Not Power2(bit))
End Function
' Raise 2 to a power
' the exponent must be in the range [
....Read More |
Rating
|
|
|
GetObjectContext.CreateInstance is obsolete in COM+
|
Total Hit (3660) |
CreateInstance was necessary in COM to provide a COM object activation mechanism that could be hooked by the MTS runtime before the activation request reached the COM runtime. So that MTS could apply some pre and post activation magic to put a wrapper around the real object and return this wrapper t
....Read More |
Rating
|
|
|
Determine whether a folder is shared
|
Total Hit (3272) |
The Windows shell provides a simple way to detect whether a given folder is shared or not. You must call the SHGetFileInfo() API function and analyze the way it fills out a given structure.
«Code LangId=1»
Type SHFILEINFO
hIcon As Long
iIcon As Long
dwAttributes As Long
szD
....Read More |
Rating
|
|
|
Always run a component using Full-Compile
|
Total Hit (2840) |
When testing a component in the IDE, always perform a full compilation. This ensures that VB checks the syntax of all the code in the component, which in turn guarantees that no syntax error will break the program while it is serving another application.
You can activate the full compilation opti
....Read More |
Rating
|
|
|
How to apply the flat style to a toolbar
|
Total Hit (2768) |
All recent Windows applications use a flat toolbar similar to Internet Explorer 's and Microsoft Word's ones. Visual Basic 6 includes a Toolbar control that supports the flat look, but if you are still using VB4 or VB5 and you want to use a flat toolbar without buying a new ActiveX control, you just
....Read More |
Rating
|
|
|
Multiple compilation constants
|
Total Hit (2315) |
Visual Basic's documentation does not explain how to specify more than just one conditional compilation constant in the Advanced tab of the Options dialog. The correct way is using a colon as a delimiter, as in:
demo = -1: version = 100
Note that you can only assign integer numeric values, an
....Read More |
Rating
|
|
|
Extract words with the RegExp object
|
Total Hit (3863) |
The following routine extracts all the words from a source string and returns a collection. Optionally, the result contains only unique words.
This code is remarkably simpler than an equivalent "pure" VB solution because it takes advantage of the RegExp object in the Microsoft VBScript Regular Expr
....Read More |
Rating
|
|
|
Terminate the process with an ErrorLevel code
|
Total Hit (3721) |
If your VB application is meant to be called from within a Ms-Dos batch file, you must be able to return Dos an error code. This can be accomplished using the ExitProcess API function:
«Code LangId=1»
Private Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long)
' terminate the pro
....Read More |
Rating
|
|
|
Interpreted or Compiled?
|
Total Hit (4144) |
It is highly unfortunate that Visual Basic doesn't offer a way to execute a group of statements only when the program is interpreted in the environment or only when it has been compiled (indifferently as native code or p-code) to an EXE file. What we badly need is a conditional compilation constant
....Read More |
Rating
|
|
|
|
|
|
Copy the entire contents of a PictureBox to the clipboard
|
Total Hit (3234) |
VB does not allow you to copy the full picture of a Form, UserControl or PictureBox to the clipboard. If you use Clipboard.SetData, it only copies a bitmap loaded into these objects. You can get around this limitation and ensure the entire contents are copied, including any graphics you have drawn,
....Read More |
Rating
|
|
|
Setting Your Application to Automatically Run When Windows Starts
|
Total Hit (1875) |
This source code shows how to automatically start an application when Windows starts using the registry. You can either have the application Auto-Start once next time Windows starts, or everytime Windows starts. The method uses my cRegistry class to make it easy to get the registry information.
....Read More |
Rating
|
|
|
Sending files inside e-mail messages
|
Total Hit (2203) |
We have published the introduction to UUCode algorithm and tutorial that shows how to add new feature of dealing with attachments to our sample applications Simple MailSender and MailChecker.
|
Rating
|
|
|
Review of “Network Programming for Microsoft® Windows®”
|
Total Hit (2472) |
If you are, as I was, looking for the book that covers the Winsock API and gives examples of how to use it with Visual Basic, you have found what you were looking for. That is, this title is a single one on the market today that keeps in mind that there are thousands of the Visual Basic programmers
....Read More |
Rating
|
|
|
How to Select the Entire Row in a ListView
|
Total Hit (1630) |
By setting a ListView style bit using the Windows API SendMessage with the message LVS_EX_FULLROWSELECT, selecting an item will cause the selection rectangle to highlight and span the entire row. Removing this bit restores the default selection style.
....Read More |
Rating
|
|
|
Mimicking the PrintScreen Function Using OLE
|
Total Hit (665) |
This code makes use of the OLE standard interface in Windows95/Windows98 to copy the contents of the desktop (the screen) into a PictureBox and save it to disk. To use this code, you must assure that the Standard OLE Types Reference to file \Windows\System\OLEPRO32.DLL is included in the project's r
....Read More |
Rating
|
|
|
Populating a Font Menu and Splitting a Long Menu into Columns
|
Total Hit (1406) |
In attempting to display a font selection menu on a system with many installed fonts, the menu, due to the number of installed fonts, often exceeds the screen height truncating the font list. This page is an extension of the code in How to Split a Long Menu into Columns. Here, we'll use the EnumFont
....Read More |
Rating
|
|