Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Alerting User of an overdue task from VFP app to the Net
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00930276
Message ID:
01034681
Views:
31
>Hi,
>
>>Is there a way to alert authenticated users in a network from a task being due recorded with VFP App?
>
>You can use the following program to send messages across the network:
>
>*========================================================
>* Send a message to a computer. Same as NET SEND.
>*========================================================
>PROCEDURE SendMsg
>LParameter tcTarget, tcSender, tcReceipient, tcMessage
>
>  *------------------------------------------------------
>  * Open the mailslot that is used by NET SEND
>  *------------------------------------------------------
>  #DEFINE GENERIC_WRITE                        0x40000000
>  #DEFINE FILE_SHARE_READ                      0x00000001
>  #DEFINE OPEN_EXISTING                                 3
>  #DEFINE FILE_ATTRIBUTE_NORMAL                0x00000080
>  #DEFINE INVALID_HANDLE_VALUE                         -1
>  Local lnHandle, llOK
>  Declare Long CreateFile in Win32API ;
>    String, Long, Long, Long, Long, Long, Long
>  lnHandle = CreateFile( ;
>    "\\"+m.tcTarget+"\mailslot\messngr", ;
>    GENERIC_WRITE, ;
>    FILE_SHARE_READ, ;
>    0, ;
>    OPEN_EXISTING, ;
>    FILE_ATTRIBUTE_NORMAL, ;
>    0 ;
>  )
>  llOK = (m.lnHandle#INVALID_HANDLE_VALUE)
>
>  *------------------------------------------------------
>  * Write the message into the mailslot.
>  *------------------------------------------------------
>  Local lcMessage, lnBytes
>  If m.llOK
>    lcMessage = m.tcSender + Chr(0) + m.tcReceipient + ;
>      Chr(0) + m.tcMessage + Chr(0)
>    Declare Long WriteFile in Win32API ;
>      Long, String, Long, Long@, Long
>    lnBytesWritten = 0
>    llOK = WriteFile( m.lnHandle, ;
>    	m.lcMessage, ;
>      Len(m.lcMessage), ;
>      @lnBytes, ;
>      0 ;
>    ) # 0
>  Endif
>
>  *------------------------------------------------------
>  * Close mailslot
>  *------------------------------------------------------
>  If m.lnHandle # INVALID_HANDLE_VALUE
>    Declare CloseHandle in Win32API Long
>    CloseHandle( m.lnHandle )
>  Endif
>
>Return m.llOK
>
>Call the program like this:
>
>SendMsg("computername","your name","recipient's name","the message")
>
>
>--
>Christof

Christof,

The CreateFile function creates a file successfully, but then WriteFile function fails. What should I take into consideration to use your code?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform