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
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)
Custom GDI+ class
Establishing connection using the SQLDriverConnect
Custom FTP Class for Visual FoxPro application
Detecting changes in connections to removable drives (VFP9)
Splash Screen for the VFP application
Winsock: sending email messages (SMTP, port 25)
How to create non-blocking Winsock server
How to print a bitmap file
GDI+: copying to the Clipboard (a) image of active FoxPro window/form, (b) image file
Sending email messages with Simple MAPI
Custom HttpRequest class (WinINet)
Peer-to-peer LAN messenger built with Mailslot API functions
How to create MD-5 and SHA-1 hash values from a string
Displaying animated images on FoxPro form with BitBlt and StretchBlt functions
Displaying bitmap using the AlphaBlend function
Enumerating raw input devices attached to the system (keyboard, mouse, human interface device)
Enumerating data formats currently available on the clipboard
How to put a vertical text scrolling on the form (a movie cast)
Mapping and disconnecting network drives
How to prevent users from accessing the Windows Desktop and from switching to other applications
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: 141  
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 (54.224.75.101)
3 sec.Function: 'ImageList_Destroy'
Function group: 'Windows Controls'
3 hrs.
Function group: 'Network Management'
5.61 hrs.
Function group: 'Power Management'
 Example: 'Capturing keyboard activity of another application with the Raw Input API (VFP9)'
Language: 'C#'
 Function: 'CeFindFirstDatabaseEx'
8.71 hrs.Example: 'Drawing cursors for the classes defined by the system (preregistered): BUTTON, EDIT, LISTBOX etc.'
8.72 hrs.Function: 'SCardEstablishContext'
11.48 hrs.Function: 'GetEnvironmentVariable'
Function group: 'Process and Thread'
11.49 hrs.Function: 'FindFirstPrinterChangeNotification'
15.97 hrs.Example: 'How to play AVI file on the _screen'
Language: 'Visual FoxPro'
Google
Advertise here!