Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Using the NetMessageBufferSend to send messages on the network
Converting characters in a URL into corresponding escape sequences and backwards
Creating a console window for Visual FoxPro application
How to display the port-configuration dialog box for a port on the specified server
Simple printer queue monitor: deletes, pauses, resumes print jobs for local printer
Placing a button on the VFP form as a new child window
Enumerating ODBC Data Sources available on the local computer
How to draw custom Window Caption on FoxPro form
How to display a user-defined icon in the MessageBox dialog
Using the SystemParametersInfo function
Bitmap Class for Visual FoxPro application
Using the ChooseColor function
Using the DrawText function
How to assemble an array of strings and pass it to external function
How to retrieve the number of print jobs queued for the printer
Subclassing CommandButton control to create BackColor property
Enumerating print jobs and retrieving information for default printer (JOB_INFO_1 structures)
How to remove a directory that is not empty
Using Extended MessageBox() Class
Transparent Menu Class (requires VFP9)
How to enumerate cookies and URL History entries in the cache of the local computer
How to ping a remote site using IP Helper API calls
Setting the mouse capture to the specified window
Starting an external application in VFP using WinExec
Using the NetMessageBufferSend to send messages on the network

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:
This example shows how to broadcast system alerts using the NetMessageBufferSend as an alternative to NET SEND command.

On Windows XP computer, make sure that the Messenger service is running:


If the Messenger service is not running, upon creating an instance of the NetMessages object you will get error code 2184 (The service has not been started).

If a service is stopped and not disabled, you can start it programmatically using VFP Windows Services class library :

#DEFINE SERVICE_WIN32 0x30
#DEFINE SERVICE_RUNNING 4

LOCAL ws As winservices, srv As winservice
ws = CREATEOBJECT("winservices",;
        Null, Null, SERVICE_WIN32)

srv = ws.GetService("Messenger")
IF srv.currentstate <> SERVICE_RUNNING
        = MESSAGEBOX("The Messenger service is off!")
*        srv.StartService
ENDIF


See also:
  • Using mailslots to send messages on the network
  • Peer-to-peer LAN messenger built with Mailslot API functions
  • How to create non-blocking Winsock server
  • A client for testing non-blocking Winsock server
  • Using WM_COPYDATA for interprocess communication

  •  
      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:
    • ~
    4070 bytes  
    Created: 2005-09-14 13:41:48  
    Modified: 2011-12-10 09:20:22  
    Visits in 7 days: 161  
    Listed functions:
    GetLastError
    NetApiBufferFree
    NetApiBufferSize
    NetMessageBufferSend
    NetMessageNameAdd
    NetMessageNameDel
    NetMessageNameEnum
    Printer friendly API declarations
    My comment:
    Note that this code sample does not work on Win9* computers.

    Sending a message:
    obj = CREATEOBJECT("NetMessages")
    IF obj.errorno = 0
            obj.SendMessage("WKSTATION1", "Test message")
    ENDIF

    Sending a message from a server (must have admin rights):
    obj = CREATEOBJECT("NetMessages", "MYSERVER")
    IF obj.errorno = 0
            obj.SendMessage("WKSTATION1", "Test message")
    ENDIF

    Sending a message to all domain computers (note an asterick after the domain name):
    obj = CREATEOBJECT("NetMessages")
    IF obj.errorno = 0
            obj.SendMessage("MYDOMAIN*", "Test message")
    ENDIF

    Sometimes it takes time for the NetMessageBufferSend to return control. The mailslot approach turns around much faster.

    Use [domain name]* to broadcast a message to all domain computers.

    On the target computer, TCP port 139 (NetBIOS) is assigned to receive messages.

    * * *
    C# version contains classes NetMessage and NetMessageThread.

    The first class sends messages while staying in the main thread of the calling process. Exactly as FoxPro does. It causes the process wait until the NetMessageBufferSend returns. Sometimes this delay becomes noticeable -- up to 1 minute -- especially when the message receipient is disconnected or the network name is invalid or does not exist.

    The NetMessageThread class sends messages using a separate thread it creates for each message. The calling process immediately gets the control back, because the delay belongs to another thread.
    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.234.126.92)
    7.39 hrs.Function: 'PostQuitMessage'
    Function group: 'Message and Message Queue'
    12.18 hrs.Function: 'waveOutGetNumDevs'
     Example: 'Retrieving graphic capabilities of default printer'
    12.78 hrs.Function: 'GetFullPathName'
    Function group: 'File Management'
     Function: 'GetWindowRect'
    13.24 hrs.Example: 'Placing On-screen Alert on top of all windows'
     Example: 'Building a tree of subdirectories for a given path using FindFile functions'
    13.78 hrs.Function: 'SetFilePointer'
    Function group: 'File Management'
     Example: 'Using EnumPrinters function to enumerate locally installed printers'
     Function: 'MapVirtualKey'
    Function group: 'Keyboard Input'
    Google
    Advertise here!