Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to position the GETPRINTER() dialog
How to read email messages using Simple MAPI
Retrieving graphic capabilities of default printer
Sending email messages with Simple MAPI
Setting and retrieving the double-click time for the mouse
Using Beep and Sleep functions to make the old tin buzz sing (WinNT only?)
Attaching menu to a top-level form
Drawing Windows frame controls using the DrawFrameControl function
How to assemble an array of strings and pass it to external function
How to initiate System shutdown
How to ping a remote site using IP Helper API calls
Retrieving information about the specified icon
Who is the first in viewing the Clipboard
Copying strings through the global memory block
Enumerating network sessions established on a server
GDI+: printing image file
How to browse and connect to printers on a network (WinNT)
How to Start a Process as Another User (NT/XP/2K)
Using MessageBeep
A procedure for setting file times
Enumerating print processors and supporting data types installed on the specified server
Enumerating the subkeys of a user-specific key
Minimizing all running applications
Number of clipboard formats available
How to position the GETPRINTER() dialog

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Before you begin:
The GETPRINTER() dialog normaly appears at the left top corner of the main window of FoxPro.

What if you want it to popup in the middle of the screen?

The interface has no input parameters that can be used to position the dialog. Still the Timer control and several API calls can solve this small problem.

The same technique is used in another example Using Extended MessageBox() Class. First you start a Timer, then call the GETPRINTER(). Amazingly, the Timer keeps ticking behind this otherwise perfectly modal window. So from the Timer event you can access the dialog and move it.

This is not the ideal solution, because the dialog may "jump" -- fixed [May 9, 2006] by locking and subsequently unlocking drawing in the Windows desktop.

See also:
  Members area. Log in to view this example.
  User name:
  Forgot your password?
  Sign up for
the Membership

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
2233 bytes  
Created: 2005-03-04 09:08:20  
Modified: 2011-12-10 09:20:22  
Visits in 7 days: 67  
Listed functions:
Printer friendly API declarations
My comment:
Try this approach with other dialogs, like GETFONT(), GETFILE(). Note that in case of another dialog you must use the window title constant different from GETPRINTER_CAPTION.

Technically, you can even play an AVI on the dialog. Take a look at How to play AVI file on the _screen example. BTW, the TAvi also inherits the Timer class.
Word Index links for this example:
Translate this page:
  Spanish    Portuguese    German    French    Italian offers instant, free translations of text or web pages.
User Contributed Notes:
Victor Espinoza | 2006-05-05 13:32:53
Easily fixed dialog "jump" by adding the following lines Right before call to Messagebox() :

hWin = GetDeskTopWindow()

Unlocked drawing by adding the following line right after "This.Setposition" in Timer procedure:


A.M. | 2006-05-09 08:59:30
Proved right. Victor, thanks!

Copyright 2001-2018 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

Privacy policy
Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.6.39), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (
24 sec.Function: 'GetCurrentProcessId'
Function group: 'Process and Thread'
44 sec.Function: 'UnhookWindowsHookEx'
Function group: 'Hook'
1.07 min.Function: 'GdipGetImageHeight'
Function group: 'GDI+ Image'
1.4 min.Example: 'How to print picture stored in enhanced-format metafile (*.emf)'
1.73 min.Solutions
2 min.Examples
2.7 min.Example: 'Using WM_COPYDATA for interprocess communication (VFP9)'
3.05 min.Function: 'SQLSetConfigMode'
Function group: 'ODBC API'
3.4 min.Project
3.77 min.Function: 'WSACloseEvent'
Function group: 'Windows Sockets 2 (Winsock)'
Advertise here!