8411.html

来自「VB技巧问答10000例,是一个教程」· HTML 代码 · 共 27 行

HTML
27
字号
<html>
  <head>
    <title>Re: 如何送一字串至某一视窗</title>
  </head>
  <body bgcolor="#FFFFFF" vlink="#808080">
    <center>
      <h1>Re: 如何送一字串至某一视窗</h1>
    </center>
<hr size=7 width=75%>

<hr size=7 width=75%><p>
Posted by chjichin on December 18, 1998 at 11:51:11:<p>
In Reply to: <a href="8368.html">Re: 如何送一字串至某一视窗</a> posted by 七枷社 on December 16, 1998 at 18:18:10:<p>
: : 如何送一字串至某一视窗<p>: 希望下面的程式能帮到你。<p>: You can use the FindWindow and PostMessage API functions to find a window and then close it. This example show how you can close down a Window with a caption of "Calculator".<p>: Dim winHwnd As Long<br>: Dim RetVal As Long<br>: winHwnd = FindWindow(vbNullString, "Calculator")<br>: Debug.Print winHwnd<br>: If winHwnd <> 0 Then<br>:     RetVal = PostMessage(winHwnd, WM_CLOSE, 0&, 0&)<br>:     If RetVal = 0 Then<br>:         MsgBox "Error posting message."<br>:     End If<br>: Else<br>:     MsgBox "The Calculator is not open."<br>: End If<br>:                     <br>: For this code to work, you must have declared the API functions in a module in your project. You must put the following in the declarations section of the module. <p>: Declare Function FindWindow Lib "user32" Alias _<br>: "FindWindowA" (ByVal lpClassName As String, _<br>: ByVal lpWindowName As String) As Long                    <br>: Declare Function PostMessage Lib "user32" Alias _<br>: "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _<br>: ByVal wParam As Long, lParam As Any) As Long                   <br>: Public Const WM_CLOSE = &H10                    <p><br>谢谢!<br>但是假设我试的结果,并没有办法送出字串,可否指导一下.
<br>
<br><hr size=7 width=75%><p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 8411-->
<!--top: 8420--><li><a href="8420.html">Re: 如何送一字串至某一视窗</a> <b>cww</b> <i>16:47:47 12/18/98</i>
(<!--responses: 8420-->0)
<ul><!--insert: 8420-->
</ul><!--end: 8420-->
</ul><!--end: 8411-->
<br><hr size=7 width=75%><p>

</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?