|
Create a VB Picture from a GDI Picture Handle
|
Total Hit (2757) |
This tip shows you how create a VB Picture object from an GDI bitmap handle (hBitmap). This is useful if you are trying to provide VB users with a picture they can use from a GDI class.
|
Rating
|
|
|
Blend Two Colours Together Using Alpha
|
Total Hit (1535) |
If you're not using GDI+ for drawing, then there isn't an easy way to determine what colour you would get if you blended two colours together with a specified alpha amount. This article provides a routine that allows you to do it using straight VB code.
....Read More |
Rating
|
|
|
Moving, Clicking and Tracking the MousePointer in Code
|
Total Hit (2711) |
VB doesn't provide any way to determine where the mouse is regardless of which control its over. Neither does it allow you to move the cursor or emulate mouse clicks on objects. This tip provides a simple class which uses API functions to add this functionality.
....Read More |
Rating
|
|
|
|
Create New GUIDs
|
Total Hit (2536) |
This sample, from Dion Wiggins (dionwiggins@hotmail.com) shows how to use the CoCreateGuid and StringFromGUID2 functions to create a GUID.
The code is compiled into an ActiveX DLL which gives the interesting possibility of using the code from an ASP page, or from other ActiveX-enabled scripting
....Read More |
Rating
|
|
|
Copy the entire contents of a PictureBox to the clipboard
|
Total Hit (3205) |
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
|
|
|
|
Detecting Windows Settings Changes
|
Total Hit (2464) |
This tip demonstrates how to detect windows settings changes in your application. You will need to have installed and registered the Subclassing and Timer Assistant (SSubTmr.DLL for VB5 and SSubTmr6.DLL for VB6), available from this site at Subclassing without the crashes to run this sample.
....Read More |
Rating
|
|
|
System Internet Connection - Determining How and If Connected
|
Total Hit (2555) |
If you are designing a project which can use an Internet connection, it can be useful to know whether the system is connected or not. There are various methods of doing this, however the most informative and reliable method is to use the WinInet.DLL InternetGetConnectedStateEx API call. The only pro
....Read More |
Rating
|
|
|
Create an API hFont from a VB StdFont object
|
Total Hit (2350) |
If you are working with API based controls you will find that to set fonts you need a GDI hFont handle to the font. The StdFont object does not directly supply you with this handle. Although it is possible to cast the StdFont object as an IFont object, which does have a hFont handle property, you st
....Read More |
Rating
|
|
|
Compact a Long Path Name to fit a given space
|
Total Hit (1879) |
Often there is not enough room to display all of a long path name. A neat way to format a path name in a given space is to show some of the beginning of the path and the filename itself, whilst missing out some of the central folders and replacing them with ellipses (..) This method is used in many
....Read More |
Rating
|
|
|
|
Implementing Unsigned Right and Left Shift Operators
|
Total Hit (1310) |
When translating C code to VB, often you come across the Right Shift and Left Shift operators ( << and >> respectively ). There is no inbuilt support for Right and Left Shift in VB, so you have to code your own. One of the main problems with replacing these functions is that C code often uses them i
....Read More |
Rating
|
|
|
HiWords and LoWords from Long Values
|
Total Hit (724) |
When translating C code to VB, you quite often come across the HiWord and LoWord operators, used to pack two integers into a long value. A simple translation of HiWord code will run into difficulties when unsigned integer arithmetic is being used in the C code and the highest bit of the long value c
....Read More |
Rating
|
|
|
Determine whether a file is in the Internet Explorer cache
|
Total Hit (2267) |
If you are creating a shortcut to an Internet file, you will want to know whether it has been visited or not so you can colour it appropriately. This tip shows you how to determine whether a file is in the cache so you can do this.
|
Rating
|
|
|
Detect when a Combo Box Drops Down or Closes Up
|
Total Hit (1995) |
This tip demonstrates how to detect a Combo Box drop down or close up by using subclassing. You will need to have installed and registered the Subclassing and Timer Assistant, available from this site at Subclassing without the crashes to run this sample.
....Read More |
Rating
|
|
|
Add a Check Box to the Left Hand Side of a Drop-Down Combo Box
|
Total Hit (1832) |
In Microsoft's Outlook Express, there is a find window which allows you to set a date range to search in. You turn this date range on and off by clicking a check box which is embedded in the left hand side of the combo box. The text of the combo box is moved to the left to accommodate the check box.
....Read More |
Rating
|
|
|
Make a ComboBox drop down when you press the down arrow key
|
Total Hit (1823) |
Drop-down combo boxes by default drop down when you press the F4 key. However, not many users know this, and you can make a combo box easier to use by making it drop down in response to the down arrow key instead.
|
Rating
|
|
|
Dealing with Circular References
|
Total Hit (1687) |
VB and COM makes a lot of things easy to do, particularly using and dealing with objects: you just create them and normally they clear themselves up automatically once you're finished with them. However, one side effect of the way COM works is that it is possible to create objects which cannot termi
....Read More |
Rating
|
|
|
Link Spoof
|
Total Hit (1544) |
LinkSpoof is a sample from Robert Heinig (rheinig@gmx.net) demonstrating one technique to take over the VB6 compile process in order to compile your own code into the finished executable.
|
Rating
|
|
|
Storing Objects Against ItemData and Tag properties
|
Total Hit (1936) |
ListBox and Combo boxes have an ItemData property to allow you to store an additional long value against each ListItem. Similarly, ListView items and TreeView nodes have a Tag property which can be used to store a string. But what if you want to associate more data along with an item? Clearly you ca
....Read More |
Rating
|
|
|
SendKeys using the API
|
Total Hit (3496) |
VB provides the SendKeys command which is supposed to create key events in the focus control. However, in practice SendKeys sometimes doesn't work correctly, it is missing some keys and doesn't offer much flexibility in controlling the sequence of key strokes that gets sent. This article demonstrate
....Read More |
Rating
|
|
|
Responding to AppCommands
|
Total Hit (1771) |
The WM_APPCOMMAND message was added to Windows 2000 and ME to provide a mechanism to send the events from extended keys on newer keyboards to applications on the system. Extended keys are things like the back, forward and search button. This tip demonstrates how to intercept events from these keys i
....Read More |
Rating
|
|
|
Change The Width of Items in a Listbox
|
Total Hit (2458) |
Normally in a VB ListBox, if a ListItem is too long to fit, it is clipped by the display. This tip demonstrates how to modify a ListBox so it displays a longer items with a horizontal scroll bar.
|
Rating
|
|
|
Working with Multiple Monitors
|
Total Hit (2898) |
Windows 98/2000 systems and above provide support for multiple monitors. This is a great thing except that it messes up old programs which attempt to do things like centre Windows or otherwise restrict their position to the visible area of the screen. This tip provides some simple code to allow you
....Read More |
Rating
|
|
|
|
Detecting Mouse XButton Clicks
|
Total Hit (2137) |
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
|
|
|
|
Text Box Balloon tip support in XP
|
Total Hit (967) |
This tip demonstrates how to to use the new Balloon Tip support provided for TextBoxes under XP. Cue Banners may also work, but only if you don't have multiple language support installed.
|
Rating
|
|
|
Creating a new GDI Bitmap from a VB Picture or DC
|
Total Hit (3259) |
If you're creating some code which works with VB but draws with the more powerful GDI functions, it's often very handy to be able to create a new bitmap handle from a VB StdPicture object or from an area of a DC. This article demonstrates how to do this with a few lines of GDI code.
....Read More |
Rating
|
|