devxlogo

Send Messages to WinPopUp from Your Application

Send Messages to WinPopUp from Your Application

If you have an application that must run “unattended” and you want it 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 \computernamemailslotmessngr, and use this code:

 Option ExplicitPrivate Declare Function CloseHandle Lib _	"kernel32" (ByVal hHandle As Long) As LongPrivate 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 LongPrivate 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 LongPrivate Const OPEN_EXISTING = 3Private Const GENERIC_READ = &H80000000Private Const GENERIC_WRITE = &H40000000Private Const GENERIC_EXECUTE = &H20000000Private Const GENERIC_ALL = &H10000000Private Const INVALID_HANDLE_VALUE = -1Private Const FILE_SHARE_READ = &H1Private Const FILE_SHARE_WRITE = &H2Private 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 + _		"mailslotmessngr" 	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
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist