How do I invoke netmessagebuffersend to send a message?
Problem Description:
How do I invoke the API function under WINNT/2K/XP netmessagebuffersend the analog net send command to send a message?
Solution:
The following code has been successfully tested to import PBL directly
$PBExportHeader $W_MAIN.SRW
Forward
Global type W_main from Window
End Type
Type mle_1 from Multilineedit within W_main
End Type
Type cb_1 from CommandButton within W_main
End Type
Type sle_1 from Singlelineedit within W_main
End Type
Type st_2 from Statictext within W_main
End Type
Type st_1 from Statictext within W_main
End Type
End forward
Type icmp_echo_reply from structure
Unsignedlong Address
Unsignedlong status
Unsignedlong Roundtriptime
Unsignedlong datasize
Unsignedlong Reserved[3]
Character Data[250]
End Type
Global type W_main from Window
int x=1056
int y=484
int width=1531
int height=1152
Boolean titlebar=true
String title= "Netmessagesend"
Long backcolor=80269524
Boolean controlmenu=true
Boolean minbox=true
Boolean resizable=true
Mle_1 Mle_1
Cb_1 cb_1
Sle_1 Sle_1
St_2 st_2
St_1 st_1
End Type
Global W_main W_main
Type prototypes
Function ulong Netmessagebuffersend (ulong servername, ref char Msgname[],ulong fromname, ref char buf[], ulong Buflen) Lib Rary "Netapi32.dll" Alias for "Netmessagebuffersend"
Function ulong Icmpcreatefile () Library "Icmp.dll"
Function Long Icmpsendecho (ulong icmphandle, ulong destinationaddress, String Requestdata,long requestsize, Long Request Options, Ref icmp_echo_reply replybuffer, Long replysize, long Timeout) Library "Icmp.dll" Alias for "Icmpsendecho"
Function Long Icmpclosehandle (ulong icmphandle) Library "Icmp.dll"
Function ULONG inet_addr (string cp) Library "Ws2_32.dll" Alias for "inet_addr"
End prototypes
Type variables
CONSTANT ULONG nerr_success = 0
End variables
Forward prototypes
Public subroutine Wf_string_to_unicode (string as_string, ref character ac_unicode[])
Public subroutine Wf_string_to_unicode (string as_string, ref character ac_unicode[])
Public Function Boolean Wf_netmessagebuffersend (String as_sendto, String as_msgtext)
Public Function Boolean wf_ping (String as_ipaddress, String as_echomsg)
End prototypes
Public subroutine Wf_string_to_unicode (string as_string, ref character ac_unicode[]), Integer Li_loop, Li_len, Li_uni
Li_len = Len (as_string)
For li_loop = 1 to Li_len
Li_uni = Li_uni + 1
Ac_unicode[li_uni] = Mid (as_string, Li_loop, 1)
Li_uni = Li_uni + 1
Ac_unicode[li_uni] = Char (0)
NEXT
Li_uni = Li_uni + 1
Ac_unicode[li_uni] = Char (0)
Li_uni = Li_uni + 1
Ac_unicode[li_uni] = Char (0)
End subroutine
Public Function Boolean Wf_netmessagebuffersend (String as_sendto, string as_msgtext); Ulong Lul_result, Lul_buflen
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.