Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Converting path to original case
Copying picture of the active form to the Clipboard using Enhanced Metafile API functions
How to make application automatically close all documents it opened
Downloading files from the FTP server using InternetReadFile
Encapsulating access to the Windows Services in a class
Reading and setting Environment variables
Sending email messages with Simple MAPI
Creating an Open dialog box to specify the drive, directory, and name of a file to open (Shell32 version)
How to download this reference`s archive through WinInet functions using InternetOpenUrl
How to find the application associated with a file name
Using FoxTray ActiveX control: System Tray Icon and menu attached to VFP form
Using the DeleteFile
How to retrieve the number of print jobs queued for the printer
Placing a button on the VFP form as a new child window
DiskFreeSpace class
How to block the PrintScreen key
Using the CreateFile
Connecting a local device to a network resource
Enumerating print jobs and retrieving information for default printer (JOB_INFO_1 structures)
How to print a bitmap file
Printing Image File, programmatically set print page orientation to landscape
Printf-style formatted text output in VFP
Using Month Calendar Control (VFP9, Comctl32.dll)
Wininet last error description
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: 125  
    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 (23.20.196.179)
    4 sec.Example: 'Using FrameRgn for displaying system colors'
    34.77 min.Example: 'System Image List Viewer'
    34.82 min.Example: 'Printing Image File, programmatically set print page orientation to landscape'
    1.04 hrs.Example: 'Comparing file times'
     Function: 'GetDC'
    Function group: 'Device Context'
    1.05 hrs.Example: 'Creating an Open dialog box to specify the drive, directory, and name of a file to open (Shell32 version)'
    4.63 hrs.Example: 'Reading metrics for the currently selected font'
     Example: 'Retrieving a universal form for the drive-based path for a network resource'
    5.55 hrs.Example: 'Simple MAPI: how to pick an email recipient from Outlook Express address book'
     Example: 'Custom HttpRequest class (WinINet)'
    Google
    Advertise here!