Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Any Idea of how to invoke / use winpopup from VFP ?
Message
De
17/08/1998 10:18:05
 
 
À
13/08/1998 12:44:24
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00126414
Message ID:
00127392
Vues:
30
>>Any Idea of how to invoke / use winpopup from VFP ?
>*
>SEND MESSAGES TO WINPOPUP FROM YOUR APPLICATION
>
>This code is for VB, but it should be relatively painless to convert it to VFox, I use it in VB, but have never tried to work with it in fox...
>If you have an application that you want to alert you if something goes wrong, your application can send you a message through WinPopUp. WinPopUp uses a mail slot to communicate with other computers in the network. Choose a mail slot name, such as \\computername \mailslot\messngr, and use this code:
>
>Option Explicit
>
>Private Declare Function CloseHandle Lib _
> "kernel32" (ByVal hHandle As Long) As Long
>Private Declare Function WriteFile Lib _
> "kernel32" (ByVal hFileName As Long, _
> ByVal lpBuff As Any, _
> ByVal nNrBytesToWrite As Long, _
> lpNrOfBytesWritten As Long, _
> ByVal lpOverlapped As Long) As Long
>Private Declare Function CreateFile Lib _
> "kernel32" Alias "CreateFileA" ( _
> ByVal lpFileName As String, _
> ByVal dwAccess As Long, _
> ByVal dwShare As Long, _
> ByVal lpSecurityAttrib As Long, _
> ByVal dwCreationDisp As Long, _
> ByVal dwAttributes As Long, _
> ByVal hTemplateFile As Long) As Long
>
>Private Const OPEN_EXISTING = 3
>Private Const GENERIC_READ = &H80000000
>Private Const GENERIC_WRITE = &H40000000
>Private Const GENERIC_EXECUTE = &H20000000
>Private Const GENERIC_ALL = &H10000000
>Private Const INVALID_HANDLE_VALUE = -1
>Private Const FILE_SHARE_READ = &H1
>Private Const FILE_SHARE_WRITE = &H2
>Private Const FILE_ATTRIBUTE_NORMAL = &H80
>
>Function SendToWinPopUp(PopFrom As String, _
> PopTo As String, MsgText As String) As Long
> ' parms: PopFrom: user or computer that
> ' sends the message
> ' PopTo: computer that receives the
> ' message
> ' MsgText: the text of the message
> ' to send
> Dim rc As Long
> Dim mshandle As Long
> Dim msgtxt As String
> Dim byteswritten As Long
> Dim mailslotname As String
> ' name of the mailslot
> mailslotname = "\\" + PopTo + _
> "\mailslot\messngr"
> msgtxt = PopFrom + Chr(0) + PopTo + Chr(0) + _
> MsgText + Chr(0)
> mshandle = CreateFile(mailslotname, _
> GENERIC_WRITE, FILE_SHARE_READ, 0, _
> OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)
> rc = WriteFile(mshandle, msgtxt, _
> Len(msgtxt), byteswritten, 0)
> rc = CloseHandle(mshandle)
>End Function
>
>If I get time, I will try and convert it to FOX for you, but that won't be 'til next week....
>
>HTH
>Bob Horkay


Thanx. This is working in VB. But when converted to VFP it is not working properly

--satya
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform