Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Finding out if the current user is the Guest account
How to display advanced Task Dialog (Vista)
Locking and unlocking file of a VFP table
Simple MAPI: how to pick an email recipient from Outlook Express address book
Winsock: creating a socket that is bound to a specific service provider
CryptoAPI: Collection of Providers class
Enumerating sessions established on a server
How to create a desktop shortcut (shell link)
How to display the port-configuration dialog box for a port on the specified server
How to generate GUID values
How to retrieve configuration data for a specified printer stored in the registry (PrinterDriverData key)
How to run FoxPro application under different user name (impersonating user)
Retrieving IP statistics for the computer
System and Local Time values
Converting twips to pixels and vice versa
GDI+: Creating thumbnails to preview images in a directory
Passing data records between VFP applications via the Clipboard
Quering a waveform-audio input device
Reading data from INI files
Winsock: how to retrieve the protocol information corresponding to a protocol name
How to block the ALT+TAB shortcut (WinXP)
Pocket PC: custom RAPI class for operating with the Object Store Databases
PocketPC: custom RAPI class for executing routines on remote Windows CE device
Retrieving the name of the default printer for the current user on the local computer (Win NT/XP)
Retrieving information about the main VFP window

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
 
#DEFINE GWL_WNDPROC -4
#DEFINE GWL_HINSTANCE -6
#DEFINE GWL_HWNDPARENT -8
#DEFINE GWL_STYLE -16
#DEFINE GWL_EXSTYLE -20
#DEFINE GWL_USERDATA -21
#DEFINE GWL_ID -12
 
DO declare
 
LOCAL hWindow
hWindow = GetActiveWindow()
 
? "Window procedure:", GetWindowLong (m.hWindow, GWL_WNDPROC)
? "Application instance:", GetWindowLong (m.hWindow, GWL_HINSTANCE)
? "Parent window:", GetWindowLong (m.hWindow, GWL_HWNDPARENT)
? "Window styles:", GetWindowLong (m.hWindow, GWL_STYLE)
? "Extended window styles:", GetWindowLong (m.hWindow, GWL_EXSTYLE)
? "User data associated:", GetWindowLong (m.hWindow, GWL_USERDATA)
? "Identifier of the window:", GetWindowLong (m.hWindow, GWL_ID)
? "Class name:", GetClsName(m.hWindow)
?
 
? "*** Application handle returned by:"
? "    GetModuleHandle:", GetModuleHandle(NULL)
? "    GetWindowLong:", GetWindowLong (m.hWindow, GWL_HINSTANCE)
?
 
* E_MAGIC
* the GetModuleHandle actually returns the address 
* the executable is mapped into memory
LOCAL hModule, cBuffer
hModule = GetModuleHandle(NULL)
cBuffer = REPLICATE(CHR(0),2)
= MemToStr(@cBuffer, hModule, LEN(cBuffer))
 
* as you may expect, the signature is "MZ", 
* the initials of Mark Zbikowski, one of the original architects of MS-DOS.
? "MS-DOS signature:", cBuffer
 
* end of main
 
FUNCTION GetClsName(hWindow)
    LOCAL nBufsize, cBuffer
    cBuffer = Repli(Chr(0), 250)
    nBufsize = GetClassName(hWindow, @cBuffer, Len(cBuffer))
RETURN SUBSTR(cBuffer, 1, nBufsize)
 
PROCEDURE declare
    DECLARE INTEGER GetModuleHandle IN kernel32 STRING @lpModuleName 
    DECLARE INTEGER GetActiveWindow IN user32
 
    DECLARE INTEGER GetClassName IN user32;
        INTEGER hWnd, STRING lpClassName, INTEGER nMaxCount
 
    DECLARE INTEGER GetWindowLong IN user32;
        INTEGER hWindow, INTEGER nIndex
 
    DECLARE RtlMoveMemory IN kernel32 As MemToStr;
        STRING @dst, INTEGER src, INTEGER nLength
 
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1919 bytes  
Created: 2001-08-21 12:00:00  
Modified: 2005-11-23 16:47:56  
Visits in 7 days: 75  
Listed functions:
GetActiveWindow
GetClassName
GetModuleHandle
GetWindowLong
Printer friendly API declarations
My comment:
Recommended reading:
An In-Depth Look into the Win32 Portable Executable File Format by Matt Pietrek
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 (50.16.166.175)
7 sec.Example: 'How to empty the Recycle Bin'
10 sec.Example: 'How to position the GETPRINTER() dialog'
3.92 hrs.Example: 'Accessing LSA Policy object (Local Security Authority)'
 Function: 'LsaOpenPolicy'
 Function: 'FindNextVolume'
Function group: 'File System'
4.47 hrs.Example: 'How to display the port-configuration dialog box for a port on the specified server'
 Example: 'Enhanced GetFont dialog'
5.94 hrs.Function: 'JetEndSession'
 Example: 'Reading and setting Environment variables'
6.16 hrs.Function: 'getnameinfo'
Google
Advertise here!