Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to change display settings: screen resolution, screen refresh rate
Enumerating data formats currently available on the clipboard
Custom GDI+ class
Mapping and disconnecting network drives
Winsock: retrieving directory listing from an FTP server using passive data connection (FTP, port 21)
Capturing keyboard activity of another application with the Raw Input API (VFP9)
Winsock: sending email messages (SMTP, port 25)
How to display the Properties dialog box for a file (ShellExecuteEx)
Disk in drive A:
Using Font and Text functions
Detecting changes in connections to removable drives (VFP9)
How to download a file from the FTP server using FtpGetFile
Enumerating raw input devices attached to the system (keyboard, mouse, human interface device)
How to play AVI file on the _screen
Using EnumPrinters function to enumerate locally installed printers
Using Video Capture: displaying on FoxPro form frames and previewing video obtained from a digital camera
Splash Screen for the VFP application
Subclassing CommandButton control to create BackColor property
Running MSDOS Shell as a child process with redirected input and output (smarter RUN command)
Vertical Label control
Creating irregularly shaped FoxPro form using transparency color key
Creating a console window for Visual FoxPro application
Converting Unicode data from the Clipboard to a character string using a given code page
Enumerating network resources
Retrieving information about the specified icon

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
 
DO declare
 
*| typedef struct _ICONINFO { 
*|   BOOL    fIcon;      0:4
*|   DWORD   xHotspot;   4:4
*|   DWORD   yHotspot;   8:4
*|   HBITMAP hbmMask;   12:4
*|   HBITMAP hbmColor;  16:4
*| } ICONINFO; total bytes = 20
#DEFINE ICONINFO_SIZE  20
 
LOCAL lcModule, lnIndex, hIcon, lcBuffer
 
lcModule = GetModuleName()
lnIndex = 0   && icon index
 
* retrieving an icon handle 
hIcon = ExtractAssociatedIcon(0, lcModule, @lnIndex)
 
lcBuffer = REPLICATE(Chr(0), ICONINFO_SIZE)
= GetIconInfo(hIcon, @lcBuffer)
 
? "Module name:", lcModule
? "Icon handle:", hIcon
?
? "*** Icon info"
? "Icon=1, Cursor=0:", buf2dword(SUBSTR(lcBuffer,1,4))
? "X hotspot:", buf2dword(SUBSTR(lcBuffer,5,4))
? "Y hotspot:", buf2dword(SUBSTR(lcBuffer,9,4))
? "Bitmask Bitmap:", buf2dword(SUBSTR(lcBuffer,13,4))
? "Color Bitmap:", buf2dword(SUBSTR(lcBuffer,17,4))
 
= DestroyIcon(hIcon)
* end of main
 
FUNCTION GetModuleName
#DEFINE BUF_SIZE 250
    LOCAL lcFilename, lnLen
    lcFilename = SPACE(BUF_SIZE)
    lnLen = GetModuleFileName(0, @lcFilename, BUF_SIZE)
RETURN  Left(lcFilename, lnLen)
 
FUNCTION buf2dword(cBuffer)
RETURN Asc(SUBSTR(cBuffer, 1,1)) + ;
    BitLShift(Asc(SUBSTR(cBuffer, 2,1)),  8) +;
    BitLShift(Asc(SUBSTR(cBuffer, 3,1)), 16) +;
    BitLShift(Asc(SUBSTR(cBuffer, 4,1)), 24)
 
PROCEDURE declare
    DECLARE SHORT DestroyIcon IN user32 INTEGER hIcon
 
    DECLARE INTEGER GetModuleFileName IN kernel32;
        INTEGER hModule, STRING @lpFilename, INTEGER nSize
 
    DECLARE INTEGER ExtractAssociatedIcon IN shell32;
        INTEGER hInst, STRING lpIconPath, INTEGER @lpiIcon
 
    DECLARE INTEGER GetIconInfo IN user32;
        INTEGER hIcon, STRING @piconinfo
 
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1666 bytes  
Created: 2001-12-07 19:46:30  
Modified: 2007-05-02 06:21:35  
Visits in 7 days: 78  
Listed functions:
DestroyIcon
ExtractAssociatedIcon
GetIconInfo
GetModuleFileName
Printer friendly API declarations
My comment:
First this code retrieves the handle to the icon (index=0) for the VFP executable module. Then it uses the GetIconInfo function to obtain some of this icon`s properties.
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 (23.22.252.150)
6 sec.Example: 'Exporting DLL icon resources as .ICO files'
2.84 hrs.Function: 'FrameRgn'
 Example: 'Starting a dialog box for connecting to network resources and passing input parameters'
6.1 hrs.Function: 'GdipRotateWorldTransform'
 Example: 'Retrieving configuration information for the specified server (Win2000/XP)'
 Example: 'How to retrieve the number of print jobs queued for the printer'
6.57 hrs.Example: 'Moving shortcut to a specified position on the Windows Desktop'
 Function: 'WSAEventSelect'
9.07 hrs.Example: 'Winsock: changing the byte ordering'
13.49 hrs.Example: 'Displaying the associated icons and descriptions for files and folders'
Google
Advertise here!