Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to change display settings: screen resolution, screen refresh rate
Adding and deleting Scheduled Tasks using NetScheduleJob API functions
Custom GDI+ class
Converting Unicode data from the Clipboard to a character string using a given code page
Capturing keyboard activity of another application with the Raw Input API (VFP9)
Enumerating data formats currently available on the clipboard
Winsock: sending email messages (SMTP, port 25)
How to download a file from the FTP server using FtpGetFile
Detecting changes in connections to removable drives (VFP9)
Custom FTP Class for Visual FoxPro application
Enumerating raw input devices attached to the system (keyboard, mouse, human interface device)
How to play AVI file on the _screen
Custom HttpRequest class (WinHTTP)
How to activate Windows Calculator
Splash Screen for the VFP application
Custom HttpRequest class (WinINet)
Using Font and Text functions
Deleting files into the Recycle Bin
Creating the Open dialog box to specify the drive, directory, and name of a file to open
Mapping and disconnecting network drives
Establishing connection using the SQLDriverConnect
How to display the Properties dialog box for a file (ShellExecuteEx)
How to convert a bitmap file to monochrome format (1 bpp)
Displaying bitmap using the AlphaBlend function
How to display a user-defined icon in the MessageBox 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
Versions:
click to open
Before you begin:
Download ResourceContainer.dll before testing this code. This DLL is nothing more but a resource storage containing five icons. It does not require any installation procedure; just copy it to your FoxPro directory.

Download MsgBox FLL
See also:
  • How to change font name and size in the MessageBox dialog
  • Extended MessageBox Class
  • Storing registration key in the resources of an executable file
  • Icon Viewer
  •  
      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:
    • ~
    2931 bytes  
    Created: 2005-11-21 17:16:13  
    Modified: 2009-11-04 17:31:32  
    Visits in 7 days: 153  
    Listed functions:
    FreeLibrary
    GetLastError
    GlobalAlloc
    GlobalFree
    GlobalSize
    LoadLibraryEx
    MessageBox
    MessageBoxIndirect
    Printer friendly API declarations
    My comment:
    A resource-only DLL can be created in VC++. It contains virtually no executable code but resources, such as icons, bitmaps, strings, and dialog boxes. The file created with the /NOENTRY linker option is always light-weighted with an overhead below 3K (Portable Executable headers).

    Any other file containing compatible icon resources can be used, for example Shell32.dll. Normally this file locates in System32 directory and contains plenty colorful icons the system readily uses itself.



    Change the code sample as shown below:

    hResource = LoadLibraryEx(GETENV("windir") + "\system32\shell32.dll",;
            0, LOAD_LIBRARY_AS_DATAFILE)
    ...
    cBuffer = num2dword(MSGBOXPARAMS_SIZE) +;
            num2dword(_screen.HWnd) +;
            num2dword(hResource) +;
            num2dword(oText.GetAddr()) +;
            num2dword(oCaption.GetAddr()) +;
            num2dword(MB_USERICON+MB_YESNO+MB_DEFBUTTON2) +;
            num2dword(47) +;
            num2dword(0) +;
            num2dword(0) +;
            num2dword(VAL(SYS(3004)))

    which should provide this or similar result



    * * *
    Changing the dialog icon by sending the STM_SETICON message to the icon window is another approach (requires extra programming in C++). The STM_SETICON is usually sent before the dialog activates. The WMPARAM in this message is the HICON handle.

    There are several ways of obtaining the HICON: loading icon from ICO file (call LoadIcon or LoadImage ), get an icon resource from executable or DLL (call LoadLibrary and then LoadImage). The SHGetFileInfo returns HICON handles for the file or for the file type specified.

    On the screenshot below, the icon inside the MessageBox is retrieved from the Skype executable by calling the SHGetFileInfo. Such functionality can be programmed in FLL or DLL library.

    Download MsgBox FLL
    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.76.170)
    4 sec.Example: 'Deleting a file stored on the FTP server'
    55.75 min.Example: 'GDI+: Scrolling through large image using the mouse'
    1.62 hrs.Example: 'Obtaining provider name for a specific type of network'
     Example: 'Enumerating network resources'
     Example: 'Configuring DEVMODE structure for a printer'
    5.88 hrs.Function: 'CeRegOpenKeyEx'
     Example: 'Verifying a file using the Authenticode policy provider'
    6.11 hrs.Example: 'Confining Windows calculator inside the VFP main window'
    6.12 hrs.Function: 'NetGroupEnum'
    8.94 hrs.Example: 'GetProcessVersion points at target OS'
    Google
    Advertise here!