- Fill in Irregularly Shaped Areas, Ask the VB Pro, August 2001
- Restore QuickBasic's handy-dandy Paint statement to Visual Basic with this
drop-in module that emulates it using the Windows ExtFloodFill API. Just
provide the coordinates and color, and your floodfill begins from that point
outward. Explore aspects of moving items from one Listbox to another, and
build your own dual-list custom control with buttons to move selected or all
items either way. Reduce flicker in your textboxes when you add new text to
the end.
Download original code sample.
See also: DualList, Flood.
- Preview Uninstalled Fonts, Ask the VB Pro, July 2001
- Solve the age-old mystery of previewing uninstalled TrueType fonts by using
the drop-in ready class provided in this column. This month we explore the
twisted storage within TTF files, and put together the tools necessary to take
them apart, table by table. You will gain a better understanding of what big-endian
and little-endian really mean. TTF is a format originally designed for use on
Motorola-based systems, but knowing how to reverse byte pairs allows you, and
Windows, to use them at will. The solution presented here dives into any given
TTF to retrieve many of its unique characteristics, such as Font Name, Family,
Subfamily, Trademark, and so on. And, it provides a way to temporarily tell
the system the font is installed so you can use it within your own app, but
others don't see it.
Download original code sample.
See also: FontPre.
- Soup Up Office VBA, Ask the VB Pro, June 2001
- Do you miss the Clipboard object when you shift gears into VBA? I did too,
and did something about it. This issue we reproduce this classic object so
that it can be fully used within Office applications. Techniques demonstrated
in the last couple columns are heavily exercised here, combining to form a
really nice solution. For a final demonstration, we loop through a selected
Range within an Excel worksheet, convert it to HTML, and copy it onto the
clipboard so it's ready to be pasted into FrontPage (or any other editor).
Download original code sample.
See also: ClipEx, MemoryDC,
StrBldr.
- Build Strings Faster, Ask the VB Pro, May 2001
- Okay, I admit it - some of the .net stuff is pretty darned cool. For
instance, the StringBuilder class. It's always been common knowledge that
concatenating strings was inefficient and for the best possible speed you
should preallocate a buffer and stuff it appropriately. This month's column
recreates a Classic VB version of the StringBuilder class, and it positively
smokes when building large strings from many smaller parts. We also revisit
raising events from arrays of objects - this time by creating an intermediate
notification object. This method avoids the potentially deadly issue of
circular references.
Download original code sample.
See also: ObjArrays, StrBldr.
- Work With Memory Bitmaps, Ask the VB Pro, April 2001
- Explore ways to manipulate your standard picture objects in memory. The
example used shows how to retrieve and set the colors of individual pixels of
an invisible StdPicture object. Another example shows how to disassociate a
bitmap from its StdPicture container, so that you can hand it off to other
processes or the Windows clipboard. The core of these solutions lies in
creating a memory-based device context, and using that to manipulate bitmaps
any way you wish - very powerful. The last tip in this column concerns
highlighting controls upon receiving focus - for example, dropping a Combobox
list or changing the BackColor of a textbox.
Download original code sample.
See also: MemoryDC.
- Don't Depend on SysInfo Control, Ask the VB Pro, March 2001
- Lose an extra dependency by directly querying the system for the information
it provides, or have the system notify you, rather than asking a flaky OCX to
do the job for you. Set up your DLLs so they're automatically notified when
certain system events occur. You can create a hidden, top-level window that
will receive all the routine notifications Windows provides, so you're always
aware of the system state. Use the ExitProcess API safely, so that you can
return an exit code to calling applications. The demo app for this recreates
the classic Hello World app Charles Petzold wrote, so it covers
much more than just providing an exit code. Get by VB's limitation of not
allowing direct assignment of a function address, such as to an element of a
UDT, with a simple custom function.
Download original code sample.
See also: Hello.
- Look Into Raw Memory Contents, Ask the VB Pro, February 2001
- Ever wished VB would show you the contents of any random area in memory?
This column shows you can produce a memory dump into the Immediate window,
similar to those you'll see in most hex editors. Also included in the handy
debugging module are functions to dereference pointers to both ANSI and
Unicode string data and DWORD values. With these tools, you can conquer any
API! Also included is a technique to turn your command buttons into
auto-repeaters that will continue firing events as long as the user holds
their mouse button down.
Download original code sample.
See also: HexDump, NetDomain.
- Add a Window to the Taskbar, Ask the VB Pro, January 2001
- Explore window style bits. Learn how to modify dialogs from other
applications, such as control panel applets, to have them appear in the
Taskbar. Overcome many other "read-only at runtime" properties of
provided by your forms, as well. Toggle the ShowInTaskbar property at runtime.
Uncover the name of your domain controller in Windows 2000.
Download original code sample.
See also: FormBdr, NetDomain.
- Manipulate Your Message Boxes, Ask the VB Pro, December 2000
- Position your message boxes wherever you'd like to, specifying precise
screen coordinates or centering them over your main form. Pop your message
boxes up on top of even topmost windows. Learn how to add a Clone method to
your objects, so you can get precise copies without multiple references.
Download original code sample.
See also: CloneObjs, MovedMsg.
- Toggle the Titlebar (and Other Form Tricks), Ask the VB Pro, November 2000
- The production ready class that is demonstrated in this column is called
FormBorder, as it originally dealt with the sorts of properties associated
with different border styles, but it has grown to far beyond that! Learn how
to toggle most of the "read-only at runtime" properties offered by
your forms. This column specifically talks about setting window style bits to
enable toggling the titlebar on and off at runtime, allowing sizing and
control boxes, turning your form into a toolwindow, making it topmost, and
many other things not normally accessible at runtime. After you've made your
window captionless, you can decide to let the user drag it around the screen
anyway, or pop the system menu by right-clicking. Lots of "silly form
tricks," here!
Download original code sample.
See also: FormBdr.
- Produce Translucent Effects, Ask the VB Pro, October 2000
- Windows 2000 introduced the concept of translucent, or layered, windows. Put
the drop-in ready class presented in this column to add this functionality to
your own application's forms. Another drop-in class offered in this column
provides all the standard mathematical functions necessary to do math with
rational numbers (fractions). This class holds special meaning to me, as it
was the first one I stepped through using the F8 key -- early in the VB4 beta
days -- to learn how VB classes worked.
Download original code sample.
See also: Fraction, Translucent.
- Is That App Hung? Find Out, Ask the VB Pro, September 2000
- Check whether another application is hung the same was as Task Manager uses
to inform you that something is "not responding." Offer your users
the chance to start another process by invoking Windows standard Run dialog.
Hook the creation of foreign dialogs so that you can customize their
appearance before your users see them. Stuff a standard textbox with more than
64K characters on NT systems.
Download original code sample.
See also: TaskList.
- Listen to Objects With Interface, Ask the VB Pro, August 2000
- Raise events from arrays of custom objects. Control which field of a
DateTimePicker control receives focus when the user tabs into it. Learn the
basic of setting and clearing individual bits of a integral variable, and
explore the bonus code for scads more bit manipulation possibilities,
including rotation and shifting.
Download original code sample.
See also: ObjArrays, Twiddle.
- Detect Library Startup and Shutdown, Ask the VB Pro, July 2000
- Create psuedo Initialize and Terminate events for your ActiveX libraries, so
you can perform startup and teardown activities. React as the user moves the
highlighted selection within a CombBox dropdown. Figure out the App.Path of
the parent application from within a UserControl. Take complete charge of the
mouse for demos -- move the cursor anywhere, click with any button on any
window, spin the mousewheel.
Download original code sample.
See also: MouseEvent.
- Draw Bitmaps on Device Contexts, Ask the VB Pro, June 2000
- Discover how easy it is to create bitmaps in memory, and load them onto the
Windows clipboard. This provides the perfect method to create Commandbar
buttons at runtime. Explore several options for displaying the full text of
ListBox items when the list is too narrow. Define your own custom message
values to use with SendMessage. Assign an icon to the EXE even when you don't
have any forms in your project.
Download original code sample.
See also: ClipEx.
- Mine Your Resources, Ask the VB Pro, May 2000
- Enumerate and extract bitmap, icon, and string resources from EXE and DLL
files. Learn how to redirect system callbacks and enumerations into the
appropriate form and class instances, rather than have them all dump back into
a standard BAS module.
Download original code sample.
See also: EnumRes.
- Copy Several Files Into One, Ask the VB Pro, April 2000
- Overcome the limitations of FileCopy by performing a manual copy with your
own code. This method allows lots more possibilities, such as monitoring
progress, concatenating multiple files, or even cancelling the copy operation,
all while allowing your application to remain responsive. Determine whether
the user has a CD-ROM drive. Check to see whether a given file exists on an
FTP server.
Download original code sample.
See also: FtpExists, NetUrl.
- Retrieve Windows Font Specification, Ask the VB Pro, March 2000
- Use a production-ready class to convert system fonts, such as those used in
window titles, to StdFont objects accessible to any controls or forms in your
project. Query the system for the current Alt-Tab order of applications.
Update your application icon at runtime, including the depiction used in
Windows Alt-Tab dialog.
Download original code sample.
See also: AltTab, AppIcon,
NCMetrics.
- Extend Scrollbar Range With Class, Ask the VB Pro, February 2000
- One legacy of Windows 95 not being fully 32-bit, is that many of the Integer
properties in VB4/32 could've been updated to Long, but weren't. Probably no
such limitation is so frustrating as that of VB's intrinsic Scrollbar
controls. This column provides a drop-in class that offers full 32-bit support
to native Scrollbars. Also demonstrated is just how easy it was (not
applicable to Win2000+) to read behind the asterisks and recover passwords.
The column concludes with a demonstration of how just two instances of an
application with a GDI resource leak can actually bring NT to its knees.
Download original code sample.
See also: LongScroll, PassSniff.
- Find and Convert a Drive Letter, Ask the VB Pro, January 2000
- Check whether a drive letter is mapped to a network share, and if so convert
it to Universal Naming Convention (UNC) format. Convert older style Windows
Metafiles (WMF) to the newer, more versatile Enhanced Metafile (EMF) format.
Download original code sample.
See also: UncName, Wmf2Emf.
- Load Arrays With Values Quickly, Ask the VB Pro, December 1999
- Initialize an array of constants by reading them from a resource file,
similar to QuickBasic's lost Data command. Abstract a recordset behind a class
that provides the user interface with easily queried First and Last properties
it can use to enable navigation controls. Attach a subform onto a main form,
so that it moves and minimizes in sync. Trick Windows into painting the
titlebars of your paired forms as if both are active if either is active.
Download original code sample.
See also: FormPair.
- Who Says VB Can't Use Pointers?, Ask the VB Pro, November 1999
- An unusual Q&A column, in that it only covers a single subject -- making
use of pointers within VB. For this example, iterating the Internet cache is
used, as it returns a rich memory-based structure that we can pick apart into
strings and numbers.
Download original code sample.
See also: NetUser, NetWksta.
- Move Data With Memory-Mapped Files, Ask the VB Pro, October 1999
- Map the contents of any disk-based file directly into your process's memory
space, allowing near instantaneous access to any bytes within. This technique
allows you to process multiple megabytes of data in a fraction of the time
required for more standard disk i/o techniques. Decode obscure API error code
values into (potentially?) more meaningful textual error messages.
Download original code sample.
See also: ApiErrMsg, ListSearch,
MapFile.
- Call the Right Function, Ask the VB Pro, September 1999
- Make sure API functions are actually exported from the DLL before attempting
to call them. For example, use GetDiskFreeSpaceEx instead of the earlier
incarnation GetDiskFreeSpace, when its available. Learn how to use 8-byte
Currency variables with APIs that require LARGE_INTEGER parameters. Adjust the
height of Combobox dropdown windows so that all items are visible, and the
user won't have to scroll.
Download original code sample.
See also: DrvInfo, FullDrop.
- Use a Label Control as a Hyperlink, Ask the VB Pro, August 1999
- The often-neglected DragDrop functionality provides the means to offer the often-requested
MouseLeave notification, which is needed to properly implement a hyperlink's
visual behaviors. Compile WAV files into your application, or into a DLL used
by your application, to avoid network traffic reaching out to load them
individually from the server.
Download original code sample.
See also: HyperLabel, HyperJmp.
- Use Smart Text Tricks, Ask the VB Pro, July 1999
- Create graphics on the fly using symbol fonts to "trick"
MSFlexGrid controls into using "multiple" fonts. Add new properties
to fonts, drawing text using only outlines, adding drop shadows, or different
fill and outline colors. Force your controls to use a fixed-pitch font for
even spacing of columnar data. Use a barely documented method of the IFont
interface to Clone StdFont objects, breaking the bonds of shared references.
Download original code sample.
See also: TextOutline.
- Get a Grip With Subclassing, Ask the VB Pro, June 1999
- Explore a number of methods to add a size grip, or Shangle as Alan Cooper
calls them, to your VB forms. Avoid firing intense code such as painting on
every Resize event, waiting instead until the user finishes resizing the
window. Produce a demo DLL that can only be used within specific VB IDE(s),
restricting the potential customer from distributing it with their finished
application.
Download original code sample.
See also: Grabber.
- Repair Distorted, Shrunken Icons, Ask the VB Pro, April 1999
- Learn some of the mysteries of how VB chooses which icon resource to use for
what purpose -- in particular, how to design a dual-resource icon that VB can
interpret correctly, so that it uses the 16x16 or 32x32 images without
distortion. Come to a better understanding of GlobalMultiUse objects, so that
your library consumers can make use of always-available classes. Determine the
current time zone name, daylight savings and stardard time dates, offset from
GMT, and more. Convert relative dates such as "first Sunday in
April" or "last Sunday in October" to actual values.
Download original code sample.
See also: TimeZone.
- Run on Reboot, Ask the VB Pro, March 1999
- Instruct Windows to start your application automatically the next, or every,
time the current or any user logs in by writing to the Run or RunOnce registry
keys. Limit usercontrols such that no more than a single instance may be
placed on any given form.
Download original code sample.
See also: DrvMap, RunOnce.
- Force Your Way to the Foreground, Ask the VB Pro, February 1999
- Overcome the limitations imposed on SetForegroundWindow in Windows 98 and
2000, so that you can truly force your application to the front in cases where
you just can't resist irritating your users. Enumerate all top-level windows
to approximate the list of applications presented by NT's Task Manager. Use
recursive callbacks to uncover the handle to the VB IDE's Immediate window, in
a fruitless attempt to clear it. Open the common file dialogs at system
folders, such as Network Neighborhood, My Computer, or Control Panel, by
passing their unique CLSIDs as the InitDir.
Download original code sample.
See also: ForceFore, TaskList.
- Print Text at an Angle, Ask the VB Pro, January 1999
- Create a logical font at any specified angle, and use it within your forms,
Picture boxes, or even memory device contexts. Set a default timeout period
for standard MsgBox's, so that they are automatically dismissed if the user
isn't present. Calculate "great circle" distances with a simple
class-based approach.
Download original code sample.
See also: RotText, TimedMsg.
- Verifying Internet Access, Ask the VB Pro, December 1998
- Use WinInet functions to determine whether a connection to the internet is
active, to autodial the default connectoid, or to hang-up. This column
stresses the need, and demonstrates how, to "try the wire" by
actually attempting to connect to known-good sites. Become familiar with the
CF_HDROP clipboard format so that you can read and write lists of files placed
on the clipboard.
Download original code sample.
See also: ClipFileCopy, NetConnect.
- VB
Can't Can Do That!, Ask the VB Pro, October 1998
- Display the correct name of your usercontrol at design-time, just like VB
does with its intrinsic controls, by paying attention to the AmbientChanged
event. Force VB's native Scrollbar to correctly paint its background on NT
systems by subclassing the owner form. Convert a PIDL to a SafeArray, so that
it may be used with the WebBrowser control's Navigate2 method to open one of
Windows special folders.
Download original code sample.
See also: HookMe.
- Solve These Irregular Problems, Ask the VB Pro, September 1998
- Build a polygonal button control, generating a MaskPicture at runtime to
provide areas that are considered outside the bounds of the usercontrol.
Transform a memory-based bitmap into a StdPicture object. Call Control Panel
applets from within your application. Find the ListIndex for whichever item in
a ListBox is under the cursor.
Download original code sample.
See also: PolyBtn, Shell32.
- Sounds Like Trouble, Ask the VB Pro, August 1998
- Play system defined sounds, like those associated with the standard
messagebox types. Learn the basics of playing MIDI files, to avoid the initial
hurdles with Multimedia Control Interface (MCI). Access the implemented
abstract classes of your UserControl through its Object property. Overcoming
problems with multiple string tables in a resource file for proper
localization. Translate API error codes into meaningful messages.
Download original code sample.
See also: ApiErrMsg, SysSnd.
- Share Data Between Object Instances, Black Belt Programming, August 1998
- This column examines three different strategies for sharing data and even
events between separate object instances. Find out how simple it is to share
static data that each control instance relies upon. With a bit more strategy,
you can even share events, such as system callbacks.
Download original code sample.
See also: SyncEvts.
- Handle Strings, Dates, and Colors, Ask the VB Pro, July 1998
- Pass strings between instances of your application, tossing the command line
of a new instance to a previous instance, for example. Plus, two techniques
that are quite useful for setting properties of your UserControls: Interpret a
date from a wide variety of possible user-input types, and offer the standard
color dropdown in the Properties window.
Download original code sample.
See also: PrevInst.
Co-authored with Phil Weber.
- List Your Higher Windows, Ask the VB Pro, June 1998
- Make the most of VB5's AddressOf operator to start taking advantage of the
many callbacks offered by Windows. In this column, explore the use of
EnumWindows to collect an list of all top-level windows. Play any WAV file
with a single API call. Or with just a few more APIs, play any system-defined
sound.
Download original code sample.
See also: FindPart, SysSnd.
Co-authored with Phil Weber.
- Who's My Parent?, Ask the VB Pro, May 1998
- Various methods to establish parent-child relationships between COM objects,
including nasty circular referencing, and even nastier (but far cleaner!)
temporary theft of object references by storing a pointer to the parent
object. Use ShellExecute to fire off LNK (shortcut) files. Prevent a Textbox
from gaining focus, so the text it contains can't be copied, without having it
appear grayed out. Drill down to get the hWnd of the taskbar's clock
window.
Download original code sample.
- Getting Out Of a Dither, Ask the VB Pro, April 1998
- Come to a better understanding of VB's PaletteMode property, so that you can
avoid Windows default dithering on 256-color displays. Determine whether any
given COM object is running locally or remotely. Use the new ScaleX and ScaleY
methods of a UserControl to ensure the coordinates you return in Mouse events
match those of your control's container. Take advantage of new WinInet
functionality to automatically connect to the internet whenever you need to.
Download original code sample.
See also: NetConnect.
Co-authored with Phil Weber.
- Tailor Your Displays, Ask the VB Pro, March 1998
- VB's Statusbar control doesn't act as a control container, so how can you
show a Progressbar there, like so many applications commonly do? Easily, if
you use the drop-in CProgBarEx class provided with this column. This class can
be used in any application when the author would prefer not shipping the
common controls OCX, or would otherwise like to draw a custom progress
indicator.
Download original code sample.
See also: StatProg, ProgBar.
Co-authored with Phil Weber.
- Spool, Shell, and Hook, Ask the VB Pro, February 1998
- Submit files that were "printed to disk" directly to Windows print spooler
for printing on-demand. Learn what that value returned from VB's Shell
function actually means, and how to use it to find the top-level window of the
spawned application by enumerating all top-level windows using two different
methods. Explore different
ways to "shell and wait" for an application to finish. Subclass
a Combobox in order to find it's dropdown window, so that it can be resized
appropriately.
Download original code sample.
See also: FullDrop, Shell32,
Spool.
Co-authored with Phil Weber.
- Write Your Own Animation Control, COMponent Builder, January 1998
- Construct a simple class that acts as an Animation control and supports
playing both AVI files and resources. This technique allows you to distribute
one less OCX with your application.
Download original code sample.
See also: AniCtrl.
- Copy and Paste with RichTextBox, Ask the VB Pro, December 1997
- Standardize your clipboard operations, including Undo, so the same routines
work with either standard or rich Textbox controls. Learn about VB5's new
Template offerings, and how they greatly expand on the older default project
concept. (I always hated the name they changed this column to, with this
issue, btw.)
Download original code sample.
See also: ClipView, RMenu.
- Display Text with Property Settings, Q&A, October 1997
- Populate the standard Properties window, for your UserControl, with an
enumerated list that contains values defined with spaces in their names. Or,
use one of VB's standard enumerated types for your UserControl property
settings. Extract all properties of an Access database field, including the
field's Description. Use OLE Automation to manipulate Word documents.
Decompiling an old VB3 application to recover the source, and coping with
early VB version's binary file format.
Download original code sample.
- Let Users Automate File Pasting, Q&A, September 1997
- Rereading this article, it amazes me the name given to it by the editors.
The guts of the first answer involve picking a window, hWnd actually, by
dragging a cursor around on screen, similar to how Spy++ works. The final
result being the ability to paste a text string from the clipboard into a
foreign window. The second topic shows how to detect when a Listbox has been
scrolled by subclassing and watching for WM_VSCROLL.
Download original code sample.
See also: WndPick.
- Name the Domain, Q&A, 1997 Enterprise Edition
- Crack the secrets of calling the 'W' functions with String parameters,
overcoming VB's inherent desire to convert all such data from Unicode to
ANSI. Functions such as NetWkstaGetInfo accept only Unicode parameters,
but can by called from 32-bit VB by using byte arrays. Dereference Unicode
string pointers with a custom PointerToStringW function. Avoid the dreaded
"Invalid Use of Null" error with a simple precaution. Count by
fives. Seemlessly tile a bitmap across a Form or Picture box.
Download original code sample.
See also: CustomBlt, NetUser,
NetWksta.
- The Keys to Your Controls, Q&A, August 1997
- Refer to and operate on any control or control array by name, by referencing
its key within VB4's Controls collection. This technique makes possible
generic routines that can iterate any control array, for example clearing an
array of textboxes. Leverage the FindFirstFile API in a recursive function to
ProperCase filenames and complete paths for more friendly display. Hand-edit
references to comctl32.ocx in your VBP files to overcome "issues"
associated with sharing source amongst developers using slightly different
versions of this common control.
Download original code sample.
See also: FileInfo.
- Make the Most of Resources, Programming Techniques, January 1997
- Learn how to start utilizing the new ability offered in VB4 to include
resource files within your application. Some techniques shown include bundling
an assortment of icons into the EXE which can be associated with the
application, use embedded icons for simple animation with DrawIcon, and play
WAV files directly from within your application. Also shown is a way to load a
bitmap from your resource file into a memory-based device context (DC), and
then tile it across the background of your form. An update on the SysTray
technique presented in November 1996.
Download original code sample.
See also: CustomBlt, ResDemo,
Tray.
- Stay in the Tray, Programming Techniques, November 1996
- Learn the proper way to put your application in the system tray, and handle
the notification messages sent to it through subclassing. Conserve system
resources by storing icons in hidden Label controls. Find the directory
Windows is using for temporary files.
Download original code sample.
See also: Tray.
- Unicode Strings You Along, Programming Techniques, September 1996
- Avoid automatic conversion of String parameters to avoid corruption when
calling "Wide" APIs. Determine whether you're running on Windows 95
or NT with the GetVersion API. Create a simple bar chart using an array of
Label controls.
Download original code sample.
See also: OpSys.
- Out of Context, Programming Techniques, July 1996
- Subclass the WM_CONTEXTMENU message to properly replace default
context menus with your own customized offerings. Add Undo support to your
Textbox and Richtext box controls. Restore a previously running instance of
your application, rather than allow a new one to start. Define your own SysInt
datatype which adapts its length to either 16- or 32-bits depending on what
Windows platform your code is compiled for (shades of what Microsoft should
have done rather than redefine the intrinsic Integer and Long datatypes for
the .NET platform!). Overcome a bug in VB2 and VB3 that prevented you from
updating the caption of a minimized MDI form at runtime.
Download original code sample.
See also: RMenu, PrevInst.
- Step up the pace of code-intense
routines, First Looks, May 1996
- A product review of PowerBasic's
new PB/DLL product. They have since expanded the line into a full set of
(Windows) 32-bit offerings, and I'm told to expect more platforms as time goes
on. Definitely worth a look for BASIC devotees, as future directions are
contemplated.
- Chef's Surprise, Programming Techniques, May 1996
- A potpourri of VB3 tips and tricks, published to offset the overwhelming
balance of VB4 content in the remainder of the magazine this month, and a test
for Unicode-induced String corruption. Keep a window minimized if it doesn't
need to have an active interface, accept notification whenever the system
colors are changed, and emulate the Sleep API in 16-bits. (This article is the
first-known published use of the term "UniMess" as well, which was
coined by yours truly during the VB4 beta as it became apparent that
Microsoft had essentially broken billions of lines of binary data handling
code with the redefinition of the fundamental String datatype.)
Download original code sample.
- Don't Be Square, Programming Techniques, April 1996
- There's no reason windows need to be rectangular. Learn how to make
irregularly shaped windows with a few simply API calls. How's your
trigonometry holding up? Remember how to calculate an (x,y) pair given an
origin, distance, and direction? Restrict the cursor to a given rectangle
onscreen to really frustrate your users! And finally, back in the (g)olden
days of Classic VB, you could actually erase the Debug window from within your
application.
Download original code sample.
See also: WinRgn.
- Making Progress, Programming Techniques, March 1996
- Create a Progress Bar "control", using a class module which draws
on a dedicated Picture box control, which will work in both 16- and 32-bit
versions of VB4 (and later).
Download original code sample.
See also: ProgBar.
- Subclassing?, Programming Techniques, January 1996
- Explore the new world of class module based subclassing, by wrapping the “Type-A-Matic”
listbox technique shown in November 1995 into a conditionally-compiled
Win16/Win32 drop-in ready class.
Download original code sample.
See also: ListSearch.
- Coercion Aversion, Programming Techniques, November 1995
- In the new version of Visual Basic, watch out for ETC, unaffectionately known as “Evil Type Coercion.”
Plus, build a “Type-A-Matic” listbox, that searches for
entries as your user types. Find out whether a given executable file is
currently running.
Download original code sample.
- Playing the Shell Game, Programming Techniques, September 1995
- Build a better Shell function, in order to know when the application you've
started has finished (ie, "Shell and Wait"). Enumerate all the
top-level windows in the system, in order to build a better AppActivate
function by finding windows that start with or contain a given string.
Download original code sample.
See also: ListSearch.
- Subclass Your Way Around VB's Limitations, Feature Article, September 1995
- Venture beyond the customization capabilities of VB code by subclassing Windows messages. Find out how
to do eight popular subclassing tasks:
- Showing statusbar information for menu commands
- Adding a command to a form's system menu
- Supporting drag-and-drop from File Manager
- Left-justify caption text
- Restricting a window's size range
- Painting the background of an MDI Form
- Drawing custom menu commands
- Hooking into the clipboard viewer chain
- Dynamically change menu width (Bonus!)
- Detect system color changes (Bonus!)
- Force an application to remain minimized (Bonus!)
- Prevent a window from being resized or moved (Bonus!)
Download original code sample, which included four bonus topics.
Article and code sample co-authored with Jonathan
Wood.
- Creeping Versionitis, Programming Techniques, July 1995
- Beginning the transition to 32-bits, this column shows how to determine
whether your Win16 application is running under Windows 3.x or NT, thunking
techniques from Win16 code to Win32 DLLs, and illustrates problems with the
keyword IIf in VB3.
Download original code sample, which includes the CALL32.DLL library.
|