Using Win32 functions in Visual FoxPro Image Gallery
Keyboard Input
..msdn
ActivateKeyboardLayout
BlockInput
EnableWindow
GetActiveWindow
GetAsyncKeyState
GetFocus
GetKBCodePage
GetKeyboardLayout
GetKeyboardLayoutList
GetKeyboardLayoutName
GetKeyboardState
GetKeyNameText
GetKeyState
IsWindowEnabled
keybd_event
MapVirtualKey
RegisterHotKey
SetFocus
SetKeyboardState
ToAscii
UnregisterHotKey
VkKeyScan
Code examples:
Adding an ODBC data source with the SQLConfigDataSource; use automatic or interactive mode
Bitmap Class for Visual FoxPro application
Comparing dimensions of the VFP main window with _SCREEN properties
Configuring DEVMODE structure for a printer
Confining Windows calculator inside the VFP main window
Creating a window using CreateWindowEx function
Creating an Open dialog box to specify the drive, directory, and name of a file to open (Shell32 version)
Creating the Open dialog box to specify the drive, directory, and name of a file to open
Creating the Save dialog box to specify the drive, directory, and name of a file to save
Deleting files into the Recycle Bin
Displaying bitmap using the AlphaBlend function
Displaying printer-properties Property Sheet for the specified printer
Displaying system dialog that selects a folder
Drawing a rectangle using Windows regular edges and borders
Drawing a window caption using the DrawCaption routine
Drawing cursors for the classes defined by the system (preregistered): BUTTON, EDIT, LISTBOX etc.
Drawing icons associated with the VFP main window
Drawing Windows frame controls using the DrawFrameControl function
Drawing Windows predefined bitmaps using the LoadBitmap functions
Establishing connection using the SQLDriverConnect
Extended MessageBox Class
FindText -- the hopeless and useless Common Dialog
Form Magnifier
GetFocus returns a HWND value
Getting a bit more than the _CLIPTEXT offers
How to browse and connect to printers on a network (WinNT)
How to change the name and the size of the font in the MessageBox dialog
How to copy the image of a form to the Clipboard using Bitmap API functions
How to display a dialog box with which the user can add a data source (DSN)
How to display picture stored in enhanced-format metafile (*.emf)
How to display the port-configuration dialog box for a port on the specified server
How to display the Properties dialog box for a file (ShellExecuteEx)
How to make the caption of a VFP application flashing in the Windows task bar
How to play AVI file on the _screen
How to position the GETPRINTER() dialog
How to print a bitmap file
How to print picture stored in enhanced-format metafile (*.emf)
How to put a horizontal text scrolling on the form (a news line)
How to put a vertical text scrolling on the form (a movie cast)
How to remove a directory that is not empty
Initiating Inet connection using a modem
Locking mouse and keyboard input for the VFP application
Minimizing all running applications
Obtaining the bounding rectangle for the specified device context
Obtaining window class name for the main VFP window
Placing an arbitrary rectangular area of main VFP window on the Clipboard
Printing text on the client area of the main VFP window
Printing text on the main VFP window
Reading metrics for the currently selected font
Reading the structure of VFP main menu
Retrieving information about the main VFP window
Retrieving long values associated with the class of the VFP window
Retrieving Window Class information for the VFP window
Scanning the hierarchy of child windows down from the main VFP window
Sending a standard message with one or more attached files using default email client
Setting the mouse capture to the specified window
Simple MAPI: how to pick an email recipient from Outlook Express address book
Splash Screen for the VFP application
Starting a dialog box for connecting to network resources (mapping network drive)
Storing content of the Clipboard to a bitmap file
Terminating all running applications from a VFP program
Testing Clipboard functions: emptying the clipboard
The window and its ancestors
Using FlashWindowEx to flash the taskbar button of the VFP application
Using Font and Text functions
Using GetNearestColor
Using InternetGoOnline function
Using IsChild() for testing ThisForm.ShowWindow property
Using the ChooseColor function
Using the DrawText function
Using the GradientFill function
Using the IsWindowEnabled function
Using the LoadImage function to have a bitmap file loaded and displayed on VFP main window
Using the MessageBox Win32 function
Using the RestartDialog function -- restarting Windows
Who is the first in viewing the Clipboard
Who owns the Windows Clipboard
Using the MessageBox Win32 function

User rating: 9.5/10 (2 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
 
* MessageBox() Flags
#DEFINE MB_OK                 0
#DEFINE MB_OKCANCEL           1
#DEFINE MB_ABORTRETRYIGNORE   2
#DEFINE MB_YESNOCANCEL        3
#DEFINE MB_YESNO              4
#DEFINE MB_RETRYCANCEL        5
 
*| icons
#DEFINE MB_ICONSTOP          16
#DEFINE MB_ICONQUESTION      32
#DEFINE MB_ICONEXCLAMATION   48
#DEFINE MB_ICONINFORMATION   64
#DEFINE MB_USERICON         128
 
*| default buttons
#DEFINE MB_DEFBUTTON1 0
#DEFINE MB_DEFBUTTON2 0x100
#DEFINE MB_DEFBUTTON3 0x200
#DEFINE MB_DEFBUTTON4 0x300
 
*| modality
#DEFINE MB_APPLMODAL          0
#DEFINE MB_SYSTEMMODAL  0x1000
#DEFINE MB_TASKMODAL  0x2000
#DEFINE MB_HELP  0x4000  && Help Button
 
*| misc
#DEFINE MB_NOFOCUS  0x8000
#DEFINE MB_SETFOREGROUND  0x10000
#DEFINE MB_DEFAULT_DESKTOP_ONLY 0x20000
 
*| positioning
#DEFINE MB_TOPMOST  0x40000
#DEFINE MB_RIGHT  0x80000
#DEFINE MB_RTLREADING 0x100000
 
*| notif.
#DEFINE MB_SERVICE_NOTIFICATION   0x200000
#DEFINE MB_SERVICE_NOTIFICATION_NT3X   0x40000
 
*| masks
#DEFINE MB_TYPEMASK  0x0f
#DEFINE MB_ICONMASK 0xF0
#DEFINE MB_DEFMASK 0xF00
#DEFINE MB_MODEMASK 0x3000
#DEFINE MB_MISCMASK 0xC000
 
    DECLARE INTEGER MessageBox IN user32 As MsgBox;
        INTEGER hwnd,;
        STRING  lpText,;
        STRING  lpCaption,;
        INTEGER wType
 
    DECLARE INTEGER GetActiveWindow IN user32
 
    hwnd = GetActiveWindow()
    ? MsgBox (0, "Message Text", "Message Caption",;
        MB_ABORTRETRYIGNORE + MB_ICONEXCLAMATION +;
        MB_DEFBUTTON3 + MB_SYSTEMMODAL)
 
 
 

User rating: 9.5/10 (2 votes)
Rate this code sample:
  • ~
1496 bytes  
Created: 2001-07-18 12:00:00  
Modified: 2005-12-27 10:16:48  
Visits in 7 days: 64  
Listed functions:
GetActiveWindow
MessageBox
Printer friendly API declarations
My comment:
In this example the dialog box is placed above all open windows.

The main window of VFP is unavailable for input while the dialog exists. But all other open windows are accessible, though the dialog window keeps staying on the top.

After closing the dialog, the VFP main window may not acquire a focus automatically, depending on both OS and VFP versions in use.

Notice that HWND value used in this example is zero. That means that the dialog has no parent window. You can find HWND of the VFP Main window through the GetActiveWindow, or GetFocus (conditionally) functions.

A HWND passed to this function as a parameter -- I guess -- implies that you can take this value from any other window.
Word Index links for this example:
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
User Contributed Notes:
There are no notes on this subject.


Copyright © 2001-2013 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.1.55-log), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.234.42.16)
6 sec.Function: 'midiOutClose'
Function group: 'Windows Multimedia'
55.82 min.Example: 'How to retrieve adapter information for the local computer (including MAC address)'
55.92 min.Function: 'NetLocalGroupEnum'
Function group: 'Network Management'
5.49 hrs.Function: 'CryptProtectData'
7.32 hrs.Function: 'GetSystemMetrics'
13.87 hrs.Function: 'getprotobyname'
13.98 hrs.Example: 'Subclassing CommandButton control to create BackColor property'
18.94 hrs.Example: 'How to view icons stored in executable files (Icon Viewer)'
23.85 hrs.Function: 'SetDlgItemInt'
Function group: 'Dialog Box'
1 day(s)Example: 'Printing text on the client area of the main VFP window'
Google
Advertise here!