|
Control the mouse speed under Windows 98 / 2000
|
Total Hit (3518) |
Under Windows 98 and 2000 you can control the speed of the mouse. The mouse speed determines how far the pointer will move based on the distance the mouse moves. The pvParam parameter must point to an integer that receives a value which ranges between 1 (slowest) and 20 (fastest). A value of 10 is t
....Read More |
Rating
|
|
|
Determine whether a program is 16- or 32-bit
|
Total Hit (3279) |
Even if we're living in a 32-bit world, and closer and closer to the 64-bit day, 16-bit programs are still running out there. Knowing whether a given EXE is 32-bit or not can be useful when you have to arrange version checking routine, for example to detect which version of a product is installed.
....Read More |
Rating
|
|
|
Disable the Ctrl-Alt-Del key combination (Windows 9x only)
|
Total Hit (3727) |
In Windows 95 and 98, when the screen saver is currently active (and the screen is blanked) the Ctrl-Alt-Del key combination doesn't work, in order to force the user to enter her password. You can take advantage of this feature and programmatically disable this key combination, by making Windows bel
....Read More |
Rating
|
|
|
Display the "Shut down Windows" dialog
|
Total Hit (3268) |
To programmatically display the "Shut down Windows" standard dialog box you can use the SHShutDownDialog undocumented API function, whose declaration is:
«Code LangId=1»
Declare Function SHShutDownDialog Lib "shell32" Alias "#60" (ByVal lType As _
Long) As Long
Its only argument can be
....Read More |
Rating
|
|
|
Display the dialog to configure a port
|
Total Hit (2895) |
The ConfigurePort API function lets you programmatically bring up the system dialog box for configuring a COM or LPT port. The function returns a non-zero value if successful (that is, the dialog appears). Here is the Declare of this function, and an example of its usage:
«Code LangId=1»
Privat
....Read More |
Rating
|
|
|
Display the Find system dialog
|
Total Hit (3199) |
If you ever needed to programmatically enable your users to search for files, you certainly found useful the possibility of reusing the system Find dialog integrated in the Start menu and also available through the F3 key within the Explorer. The key to obtain such a dialog is the ShellExecute funct
....Read More |
Rating
|
|
|
Display the Windows Shortcut Wizard
|
Total Hit (2586) |
You can programmatically start the Shortcut Wizard from your code, to give the end user the capability to create a new shortcut:
«Code LangId=1»
Shell "rundll32.exe AppWiz.Cpl, NewLinkHere " & App.Path, 1
«/Code»
|
Rating
|
|
|
Find out the Windows version a program require
|
Total Hit (3659) |
Not all programs may run on all the Windows platforms. Often programs require at least a certain version of Windows. In most cases, this is due to the lack of specific functions in the SDK.
Anyway, to detect yourself whether a given EXE file can run under the current version of Windows (without r
....Read More |
Rating
|
|
|
Format a drive using an undocumented function
|
Total Hit (4118) |
SHFormatDrive is an undocumented but simple API function that allows you to format a drive. This function simply opens "Format Drive" diaolog window. Being undocument you won't find its Declare with the API Viewer utility:
«Code LangId=1»
Private Declare Function SHFormatDrive Lib "Shell32.dll"
....Read More |
Rating
|
|
|
Get login information the easy way (without any API call)
|
Total Hit (2816) |
While you can use many different API function to get user and domain information, if you're running under Windows NT or 2000 Server there is a shortest path, based on the fact that the operating system loads many piece of data into environment variables:
«Code LangId=1»
' this code works only un
....Read More |
Rating
|
|
|
Get the exit code of a process
|
Total Hit (4065) |
In a few cases, in particular when running MsDos batch files from within a VB application, you may want to determine the ERRORLEVEL set by an external application. You can't do it with a plain Shell statement, but the job becomes easy with the support of the GetProcessExitCode API function:
«Code
....Read More |
Rating
|
|
|
Get the Windows main directories (without any API call)
|
Total Hit (3161) |
The usual way to determine the Windows' main directory is based on the GetWindowsDirectory API function, which requires that you set up a buffer for the result, and then extract the null-terminated result. However, there is a much simpler approach, that works equally well under Windows 95, 98 and NT
....Read More |
Rating
|
|
|
Get the Windows temporary directory (without any API call)
|
Total Hit (3074) |
The usual way to determine the Windows' main directory is based on the GetTempPath API function, which requires that you set up a buffer for the result, and then extract the null-terminated result. However, there is a much simpler approach, that works equally well under Windows 95, 98 and NT. It is
....Read More |
Rating
|
|
|
Hide or disable the desktop icons
|
Total Hit (3471) |
The Desktop is a window like any other window in the system, so you can hide/show and enable/disable it. The only details you need to know is how to retrieve the handle to the Desktop window. It turns out that this window is the first child window of the "Program Manager" window, so all you need is
....Read More |
Rating
|
|
|
Hide or disable the Windows' application bar
|
Total Hit (3145) |
The Windows' application bar (or Startbar) is a window like any other window in the system, so you can hide/show and enable/disable it. The only thing you need to know is that that the class name of the Start bar window is "Shell_TrayWnd" and that its window name is a null string. Here is the code t
....Read More |
Rating
|
|
|
Hide the application in the Task List dialog
|
Total Hit (3298) |
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
|
|
|
How did Windows start?
|
Total Hit (2984) |
If you need to know how Windows was started you have just to call an API function: GetSystemMetrics. Passing the SM_CLEANBOOT constant as parameter, the function returns a Long value with this meaning:
«Code LangId=1»
0 = Normal boot
1 = Fail-safe boot
2 = Fail-safe with network boot
«/Code»
....Read More |
Rating
|
|
|
Implement password-protected TextBox that are really secure
|
Total Hit (2910) |
As explained in another tip in this TipBank, users can peek at the contents of password-protected TextBox controls with a simple Spy-like program, or even with a VB program plus some API functions. The problem is that such TextBox controls react to the WM_GETTEXT message and the GetWindowText API fu
....Read More |
Rating
|
|
|
Open a Control Panel dialog or wizard
|
Total Hit (2670) |
Have you ever needed to open a Windows dialog such as Internet Properties, New Hardware, Modem Properties or any other dialog you can find in the Control Panel? Well, it's very simple, onve you know the trick.
All these dialogs are implemented in files with the CPL extension. (They're actually D
....Read More |
Rating
|
|
|
Open MS-DOS prompt from any directory in Explorer
|
Total Hit (2626) |
By adding a couple Registry keys you can add a commond to the context menu that appear when you right-click a directory when inside Windows Explorer. The new command lets you open the MS-DOS prompt and navigate to that directory with just one mouse click:
«Code LangId=1»
---------------------
....Read More |
Rating
|
|
|
Open Windows's Start menu
|
Total Hit (2044) |
By simulating the pressing of the "Windows" menu - or better yet, of the Ctrl-Escape key combination, which also works on older keyboards - you can programmatically bring up the Start menu. You can't use the SendKeys function to do so, though, and you have to resort to the keybd_event API function:
....Read More |
Rating
|
|
|
Provide a free preview of Office Documents
|
Total Hit (1659) |
NOTE that this tip requires Windows 98, Windows 2000, Windows 95/NT 4.0 + Active Desktop. If your application must do a lot of work with Office documents, then chances are that you might need to provide a quick preview of them. I'm not talking about scrolling pages up and down as in Word or Excel bu
....Read More |
Rating
|
|
|
Retrieve CPU information the simple way (NT/2000 only)
|
Total Hit (1532) |
The Windows API includes all the functions you need to retrieve and display information about the CPU the machine is equipped with. However, if you're running under Windows NT or Windows 2000, you don't need to make complicated API calls, because this information is already available in several envi
....Read More |
Rating
|
|
|
Return a Dos error code on exit
|
Total Hit (2167) |
At times you may want to return a Dos ErrorLevel when closing your VB application. This can be necessary, for example, if the EXE is meant to be called from a batch file. Exiting the program with an error code is really simple, and requires only a call to the ExitProcess API function:
«Code Lang
....Read More |
Rating
|
|
|
Show the contents of the Recycle Bin folder
|
Total Hit (1949) |
You can use the ShellExecute API function to programmatically open a window of Explorer and display the contents of the Recycle Bin. This is the function's declare:
«Code LangId=1»
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpO
....Read More |
Rating
|
|
|
Track changes in system time and display resolution
|
Total Hit (3433) |
Whenever the system time or the display resolution changes, Windows sends all the top-level windows (forms, in VB jargon) the WM_TIMECHANGE or WM_DISPLAYCHANGE message, respectively. Therefore, you can easily determine when these system-wide settings change by subclassing any form in your applicatio
....Read More |
Rating
|
|
|
Undocumented dialog box to change screen saver's password
|
Total Hit (2007) |
When you write a screen saver in C and SDK you can use a static library (SCRNSAVE.LIB) that allows you to create custom dialogs to change and request the password. In VB you can't access this library, but if you don't want to create your forms to replace the custom dialogs, you can use a couple of u
....Read More |
Rating
|
|
|
Wait for the termination of a program using Windows Scripting Host
|
Total Hit (2709) |
If you want to execute an application and waiting for its termination, you can follow two approaches. The "classic" approach is based on API functions such as OpenProcess, WaitForSingleObject and CloseHandle. However, there is a simpler technique based on the Windows Scripting Host object model.
....Read More |
Rating
|
|
|
Determine the Windows version (without any API call)
|
Total Hit (3145) |
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
|
|
|
Determine whether a folder is shared
|
Total Hit (3156) |
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
|
|