var
  s: string;
...
  s := Screen.ActiveForm.Caption;
  Showmessage(s);

解决方案 »

  1.   

    HWND GetActiveWindow(VOID)
    得到活动窗口的handleint GetWindowText(    HWND hWnd, // handle of window or control with text
        LPTSTR lpString, // address of buffer for text
        int nMaxCount  // maximum number of characters to copy
       );
    得到该窗口的标题
      

  2.   

    var
      h1:HWND;
      title:PChar;
      count:integer;
    begin
      count:=256;
      h1:=GetActiveWindow();
      GetWindowText(h1,title,count);
      ShowMessage(title);
    end;
      

  3.   

    showmessage(screen.ActiveForm.Caption);
    就行了
      

  4.   

    var
    wnd:HWnd;
    title:array[0..MAX_PATH] of char
    begin
    wnd:=GetActiveWindow;
    GetWindowText(wnd,@title[0],MAX_PATH];
    showMessage(title);
    end;
      

  5.   

    得到这WM_ACTIVATE消息
    procedure WMActivate(var Msg: TWMACTIVATE);message WM_ACTIVATE;
      

  6.   

    好象都不行呀。显示的都是程序本身的窗口标题。不是活动窗口的标题,比如说我正在用写字板,showmessage(screen.ActiveForm.Caption)应该显示的是写字板吧,但显示的是from1
      

  7.   

    showmessage(screen.ActiveForm.Caption);
    这样只能得到程序自己的窗口标题!我想让程序知道活动窗口的标题。
    比如我在用写定板,程序就显示写字板。