这个函数怎么用?(20分)

  • 主题发起人 主题发起人 Carem
  • 开始时间 开始时间
C

Carem

Unregistered / Unconfirmed
GUEST, unregistred user!
function<br>NetMessageBufferSend(servername:PWideChar;msgname:PWideChar;<br>fromname:PWideChar;buf:PWideChar;buflen:DWORD):DWORD;stdcall;external 'netapi32.dll'<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>&nbsp; &nbsp;Msg:WideString;<br>begin<br>&nbsp; &nbsp;Msg:=combobox2.Text ;<br>&nbsp; &nbsp;NetMessageBufferSend(NIL,'s',Nil,PWideChar(Msg),Length(String(Msg)));<br>end;<br><br>想将's'那里变成s:=string;的s怎么修改??<br><br>谢谢!!
 
这样写 PCHAR(S)
 
NetMessageBufferSend(NIL,'s',Nil,PWideChar(Msg),Length(String(Msg)));<br><br>会出错!<br><br>相反的类型 &nbsp;char widechar
 
通过pchar函数处理一下,pchar(string)
 
procedure TForm1.Button1Click(Sender: TObject);<br>var<br>&nbsp; Msg:WideString;<br>&nbsp; Target: WideStrign;<br>begin<br>&nbsp; Msg:=combobox2.Text ;<br>&nbsp; Target:= 's';<br>&nbsp; NetMessageBufferSend(NIL,PWidechar(Target),Nil,PWideChar(Msg),Length(String(Msg)));<br>end;<br><br>
 
谢谢各位!
 
多人接受答案了。
 
后退
顶部