Using Win32 functions in Visual FoxPro Image Gallery
Window Class
..msdn
GetClassInfo
GetClassInfoEx
GetClassLong
GetClassName
GetWindowLong
RegisterClassEx
SetWindowLong
UnregisterClass
Code examples:
Adding user-defined items to the Control Menu of VFP form (requires VFP9)
Browsing Windows Known Folders (Special Folders)
Capturing keyboard activity of another application with the Raw Input API (VFP9)
Creating irregularly shaped FoxPro form using transparency color key
Customizing the frame of top-level form: removing the standard frame (VFP9, Vista)
Detecting changes in connections to removable drives (VFP9)
Displaying dimmed window behind VFP top-level form
Displaying hypertext links with the SysLink control (VFP9, Comctl32.dll)
Displaying icons in the system tray (VFP9)
Displaying the associated icons and descriptions for files and folders
Dragging files from Explorer window and dropping them on FoxPro control (requires VFP9)
Extended MessageBox Class
How to block the PrintScreen key
How to disable the Windows Clipboard (VFP9)
How to hot-track menu item selection in top-level form (requires VFP9)
How to make a VFP form fading out when released (GDI version)
How to make a VFP form fading out when released (GDI+ version)
How to view icons stored in executable files (Icon Viewer) - II
Locking the workstation
Placing a button on the VFP form as a new child window
Retrieving information about the main VFP window
Semi-transparent Form
Setting properties of the window: caption and user-defined value
Switching between keyboard layouts
System Image List Viewer
Transparent Menu Class (requires VFP9)
Using Common Controls: the Header Control
Using FoxTray ActiveX control: System Tray Icon and menu attached to VFP form
Using Month Calendar Control (VFP9, Comctl32.dll)
Using WM_COPYDATA for interprocess communication (VFP9)
Windows Shell Icons displayed and exported to ICO files (Vista)
Extended MessageBox Class

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
Versions:
click to open
Before you begin:

There is more advanced version of this code.
Click to open the Extended MessageBox Library (FLL) web page.

Download Extended <A href='/vfp/?group=-1&function=73&PHPSESSID=717a731c6bcf1a7a0a98f0e1c8e2b678' target='_top'>MessageBox</A> .NET Assembly
Click to open the Extended MessageBox .NET Assembly web page.

* * *
For all VFP versions this class extends regular MessageBox() function with:
- dialog timeout interval
- adjustable button captions
- dialog window positioning on start


MessageBox() with changed button captions:


MessageBox() with timeout:


Here is a sample code showing how to use this class.

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


User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
4216 bytes  
Created: 2003-08-07 10:28:23  
Modified: 2010-05-11 14:17:25  
Visits in 7 days: 109  
Listed functions:
GetActiveWindow
GetWindow
GetWindowLong
GetWindowText
IsWindow
SendMessage
SetDlgItemText
SetWindowPos
Printer friendly API declarations
My comment:
Even better MessageBox customization can be achieved by creating an external library (ActiveX, DLL or FLL) and calling it from VFP application.
Download MsgBox FLL
The background color, the message text font & color, button fonts and captions, not to mention other customizable parameters, can be controlled by the calling application.

* * *
C# and C++ versions of this code use the SetWindowsHookEx API function to monitor either window messages or CBT notifications within the thread. Upon detecting the WM_INITDIALOG message the code moves the recipient window -- a MessageBox dialog.



* * *
To close the dialog through virtually pressing a button, consider also sending BM_CLICK message. This message causes the button to receive the WM_LBUTTONDOWN and WM_LBUTTONUP messages, and the button"s parent window to receive a BN_CLICKED notification message.

More common way of closing the dialog is calling the EndDialog function.

* * *
The MessageBox dialog consists of several windows.



The Dialog Window is the parent window, and all others are its children.

All Button Windows and three Static Windows (the Icon Window, the Message Window and the window surrounding the buttons) have very specific window identifiers (control ids). These values appear to be undocumented though stay unchanged through the all Windows versions since Windows 95.

The Tool window (its Control ID 0x0000CAFE always makes me feel good) is an addition to the MessageBox child windows that came with the Vista.

* * *
CodeProject links:
How to change the MessageBox window (Add controls and change texts) by dSolariuM
"Do not ask again" Message Boxes by Nicolas Bonamy

* * *
Starting with the FVP version 8, the MESSAGEBOX() function can accept the Timeout parameter.

When the MESSAGEBOX() is called without the Timeout parameter, it runs on VFP default thread. When the Timeout parameter is passed, VFP creates a separate thread for the MESSAGEBOX().

No mater how subtle this difference may appear, it renders the GetActiveWindow useless for finding the dialog window. Calling the SetWindowsHookEx should also be performed with the consideration for the separate thread.

* * *
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.242.188.217)
8.38 hrs.Example: 'Deleting files into the Recycle Bin'
16.86 hrs.Example: 'How to delete IE cookies, clear IE history and delete files in Temporary Internet Files directory'
17.22 hrs.Example: 'Winsock: connecting to a news server (NNTP, port 119)'
1 day(s)Function: 'SQLInstallerError'
Function group: 'ODBC API'
2 day(s)Function: 'GdiGetBatchLimit'
Function group: 'Painting and Drawing'
 Example: 'Winsock: how to retrieve the protocol information corresponding to a protocol name'
 Function: 'SQLBrowseConnect'
 Example: 'Converting command-line string to a set of Unicode argument strings (WinNT only)'
 
Function group: 'Window Procedure'
 Function: 'GetProcessTimes'
Function group: 'Process and Thread'
Google
Advertise here!