还有,并修改此属性呢?另,哪有下载API的资料呀?要求带例程的,谢谢

解决方案 »

  1.   

    GetWindowText 
    SetWindowText
      

  2.   

    to:aha99此两个API我早已经找到,但我对API的应用不是很多,不是太清楚,不过我正在试
      

  3.   

    Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
    Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
    Private Sub Form_Activate()
        Dim MyStr As String
        'Create a buffer
        MyStr = String(GetWindowTextLength(Me.hwnd) + 1, Chr$(0))
        'Get the window's text
        GetWindowText Me.hwnd, MyStr, Len(MyStr)
        MsgBox MyStr
    End Sub
      

  4.   

    getWindowText都需要hwnd值
    取某个程序的hwnd值是麻烦的(至少我不清楚怎么取),也想请教各位不过你可以这样
    getwindowtext me.hwnd,str,255
    返回的只是自己窗体的Caption也可以用于控件
    getwindowtext text1.hwnd,str,255
    这样也可以返回控件的Caption
      

  5.   

    【VB声明】
      Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long【别名】
      GetWindowTextA【说明】
      取得一个窗体的标题(caption)文字,或者一个控件的内容(在vb里使用:使用vb窗体或控件的caption或text属性) 【返回值】
      Long,复制到lpString的字串长度;不包括空中止字符。会设置GetLastError 【备注】
      不能用它从另一个应用程序的编辑控件中获取文字【参数表】
      hwnd -----------  Long,欲获取文字的那个窗口的句柄  lpString -------  String,预定义的一个缓冲区,至少有cch+1个字符大小;随同窗口文字载入
      

  6.   

    【VB声明】
      Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long【别名】
      SetWindowTextA【说明】
      设置窗口的标题文字或控件的内容(在vb里使用:针对vb窗体,应使用caption或text属性) 【返回值】
      Long,非零表示成功,零表示失败。会设置GetLastError 【参数表】
      hwnd -----------  Long,要设置文字的窗口的句柄  lpString -------  String,要设到hwnd窗口中的文字
      

  7.   

    Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
    Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
    Private Sub Form_Activate()
        'KPD-Team 1998
        'URL: http://www.allapi.net/
        'E-Mail: [email protected]
        Dim MyStr As String
        'Create a buffer
        MyStr = String(100, Chr$(0))
        'Get the windowtext
        GetWindowText Me.hwnd, MyStr, 100
        'strip the rest of buffer
        MyStr = Left$(MyStr, InStr(MyStr, Chr$(0)) - 1)
        'Triple the window's text
        MyStr = MyStr + MyStr + MyStr
        'Set the new window text
        SetWindowText Me.hwnd, MyStr
    End Sub
      

  8.   

    to:楼上的各位兄弟我的目的是用程序打开另一个程序,并将另一个程序的CAPTION属性改掉,如下例,但我这样改是不行的,请哪位高手指出问题所在:Private Sub Form_Load()
      Dim nresult As Long
      nresult = Shell(App.Path & "\abc.exe", vbNormalFocus)'打开ABC.exe
      Timer1.Enabled = True
    End SubPrivate Sub Timer1_Timer()
      Dim strTitle As String
      strTitle = GetWindowText(hwnd, lpString, 6)'取回ABC。EXE的主窗体的CAPTION
      If strTitle = "abc" Then                   '判断是不是ABC,
        Call SetWindowText(hwnd, "FXET")         '是则换成FXET
      End If
    End Sub
      

  9.   

    你先findwindow找到窗口的句柄,然后再调用GetWindowText,SetWindowText
      

  10.   

    其实此问题与那个关程序的问题有部分相似之处,就是找HANDLE
      

  11.   

    Private idProcess As Long
    Private hProcess As LongPrivate Sub Form_Load()
      Dim nresult As Long
      nresult = Shell(App.Path & "\ediapv.exe", vbNormalFocus)
      idProcess = nresult
      hProcess = OpenProcess(1, False, idProcess)
      Timer1.Enabled = True
    End SubPrivate Sub Timer1_Timer()
      Dim hw&, cnt&
      Dim rttitle As String * 256
      cnt = GetWindowText(hProcess, rttitle, 255)
      If Left(rttitle, 6) = "EdiAPV" Then
        Call SetWindowText(hProcess, "FXET")
      End If
    End Sub
    以上为我修改后的,但rttitle返回的仍是空的,不对呀哪位高手帮忙看看此程序呀,谢谢
      

  12.   

    to:楼上各位兄弟谢谢大家,我已经想到并解决了此方法,呵呵,此贴现在可以结贴了,用到的API有上面各位提到的,也有各位没提到的,呵呵,不过已经解决了,哈哈,谢谢大家,发分。。