Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Writing to INI file
GDI+: saving image of FoxPro form to graphics file (BMP, GIF, JPG, PNG, TIF)
Simple Window Viewer
Using vendor-neutral SQL constructs
Enumerating print processors and supporting data types installed on the specified server
How to find when the application started
How to retrieve list of system DSNs (Data Source Name) with parameters
Locking and unlocking file of a VFP table
Removing FTP directory
Retrieving the User Datagram Protocol (UDP) listener table
Writing entries to custom Event Log
Accessing examples contained in this reference from a VFP application
How to retrieve number of objects in the Recycle Bin
Reading the structure of VFP main menu
Retrieving the name and type of all available RAS-capable devices
Verifying a file using the Authenticode policy provider
Displaying printer-properties Property Sheet for the specified printer
Reading and setting Environment variables
Retrieving country-specific dialing information from the Windows Telephony list of countries
Round FoxPro form
The DetectAutoProxyUrl function identifies the auto-config script location
Setting the date and time that a file was created
Using named pipes for interprocess communication
Winsock: resolving an address to a host name
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: 152  
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 (107.22.156.205)
3 sec.Function: 'BlockInput'
Function group: 'Keyboard Input'
33.82 min.Function: 'SHFileOperation'
33.87 min.Function: 'mciGetErrorString'
Function group: 'Windows Multimedia'
4.11 hrs.Function: 'AttachVirtualDisk'
6.07 hrs.
 Example: 'Locking and unlocking file of a VFP table'
22.33 hrs.Example: 'How to intercept window messages sent to VFP form'
1 day(s)Example: 'How to print FoxPro form'
 Example: 'Dial the Net Automatically'
 Example: 'How to print FoxPro form -- II'
Google
Advertise here!