Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Reading virtual key status values and key names
Retrieving configuration information for the specified server (Win98/Me)
Retrieving the name of the primary domain controller (PDC) and join status information (NT/2000/XP)
Simulating DOEVENTS
Using Multimedia Command Strings to play MIDI files
Winsock: initializing the service in the VFP application
Enumerating MIDI output devices
Obtaining the bounding rectangle for the specified device context
Pocket PC: creating new database in the Object Store and copying Contacts Database records into it
Reading data from INI files
Saving available locale records into a cursor
Accessing a CD device (cdaudio) with Multimedia Command Strings
Current directory of the application
GDI+: converting text strings to images and saving in a graphics file
Managing Cookies
Copying files as a transacted operation (Vista)
How to hide your program from the Close Program dialog (Win9* only)
Retrieving the IP-to-physical address mapping table
Current System information
GDI+: loading image file, drawing on it, saving the result to another file
Retrieving the rectangle area where the mouse cursor is confined
Retrieving window and menu help context identifiers
Using LoadLibrary
Reading Internet Query options
Creating a mailslot

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
Before you begin:
A mailslot is a mechanism for one-way interprocess communications (IPC). Applications are able to exchange data through mailslots.

A mailslot is a pseudofile that resides in memory (RAM). Standard file functions, like CreateFile, ReadFile, and WriteFile, are used to access mailslots.
 
DO decl
 
#DEFINE INVALID_HANDLE_VALUE  -1
 
LOCAL hms, lcName
 
lcName = "\\.\mailslot\testing\my_comments"
hms = CreateMailslot (lcName, 250,500,0)
 
IF hms = INVALID_HANDLE_VALUE
    * 123 = ERROR_INVALID_NAME
    ? "Error code:", GetLastError()
    RETURN
ENDIF
 
* resetting the time-out value
= SetMailslotInfo (hms, 1000)
 
? "Handle to the mailslot:", hms
 
LOCAL lnMsgSize, lnNextSize, lnMsgCount, lnTimeout
STORE 0 TO lnMsgSize, lnNextSize, lnMsgCount, lnTimeout
 
IF GetMailslotInfo (hms, @lnMsgSize, @lnNextSize,;
    @lnMsgCount, @lnTimeout) <> 0
    ? "maximum message, bytes:", lnMsgSize
    ? "next message, bytes:", lnNextSize
    ? "messages waiting:", lnMsgCount
    ? "time-out value, msec:", lnTimeout
ENDIF
 
= CloseHandle (hms)
 
PROCEDURE  decl
    DECLARE INTEGER GetLastError IN kernel32
    DECLARE INTEGER CloseHandle IN kernel32 INTEGER
 
    DECLARE INTEGER CreateMailslot IN kernel32;
        STRING lpName, INTEGER nMaxMessageSize,;
        INTEGER lReadTimeout, INTEGER lpSecurityAttributes
 
    DECLARE INTEGER GetMailslotInfo IN kernel32;
        INTEGER hMailslot, INTEGER @lpMaxMessageSize,;
        INTEGER @lpNextSize, INTEGER @lpMessageCount,;
        INTEGER @lpReadTimeout
 
    DECLARE INTEGER SetMailslotInfo IN kernel32;
        INTEGER hMailslot, INTEGER lReadTimeout
 
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1277 bytes  
Created: 2002-01-26 14:08:00  
Modified: 2011-12-10 09:20:22  
Visits in 7 days: 142  
Listed functions:
CloseHandle
CreateMailslot
GetLastError
GetMailslotInfo
SetMailslotInfo
Printer friendly API declarations
My comment:
When a process creates a mailslot, the name must have the following form.:
\\.\mailslot\[path]name

In this example the "dot" means "local machine". "testing" and "my_comments" are path and name to be picked by your application
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.212.158)
3 sec.Example: 'Using InternetGoOnline function'
4.75 hrs.Function: 'PeekMessage'
 Example: 'How to Start a Process as Another User (NT/XP/2K)'
8.2 hrs.Example: 'Obtaining names and positions for shortcuts located on the Windows Desktop'
9.25 hrs.Example: 'Using Font and Text functions'
 Function: 'PathBuildRoot'
Function group: 'Shell Lightweight Utility APIs -- Path Functions'
10.34 hrs.Function: 'DeleteFileTransacted'
 Function: 'GetDefaultPrinter'
21.45 hrs.Function: 'SetMonitorBrightness'
Function group: 'Monitor Configuration (Vista)'
 Example: 'Using the Semaphore object to allow only one instance of VFP application running'
Google
Advertise here!