1:同上,其中hnd由GetActivewindow函数得到,enumChild为一自定函数。
   提示为:[Error] Unit1.pas(173): Variable required。2:当按下Ctrl+c 时,是发了什么消息给目标窗体。谢谢!

解决方案 »

  1.   

    1、把你的 Unit1.pas 的第 173 行贴出来;
    2、如果是所选的是文本的话,应该是 WM_COPY 吧。
      

  2.   

    你的enumChild函数的原型是??
      

  3.   

    瞅瞅,enumChild是在一个类里面定义的吧,不要把它放在类里面
      

  4.   

    你的enumChild一定是在类的成员吧,把它拿出来
      

  5.   

    look:function EnumWindowsProc(aWindow:HWND;pInfo:PENUMINFO):boolean;stdcall;
    const
        TEXTLENGTH=200;
    var
        pText:array [0..TEXTLENGTH] of WCHAR;
        Text:string;
    begin
        Result := TRUE;
        if aWindow <=0 then
            exit;
        InternalGetWindowText(aWindow,PWChar(@pText),TEXTLENGTH);
        Text:=WideCharToString(PWChar(@pText));
        Text:=Trim(Text);
        if Pos(pInfo.Caption ,Text)>0 then
        begin
            pInfo.Handle :=aWindow;
            Result := FALSE;
        end
        else
            Result := TRUE;
    end;function FindChildHandleByCaption(hParent:THandle;Caption:String):THandle;
    var
        EnumInfo:TENUMINFO;
    begin
        EnumInfo.Handle :=0;
        EnumInfo.Caption :=Caption;
        EnumChildWindows(hParent,TFNWndEnumProc(@EnumWindowsProc),LPARAM(@EnumInfo));
        Result:=EnumInfo.Handle ;
    end;
      

  6.   

    patch:type
        TENUMINFO = packed record
            Caption:String;
            Handle:THandle;
        end;
        PENUMINFO = ^TENUMINFO;
      

  7.   

    你的函数EnumChildWindows(hnd,@enumChild,0) 第三个参数不能为0,必须是一个指针变量,回调函数通过这个参数来传递变量
      

  8.   

    use shellapi;
    试试:EnumChildWindows(hParent,TFNWndEnumProc(@EnumWindowsProc),longint(@EnumInfo));
      

  9.   

    我是楼主:不好意思,是我的错,原来我把enumChild 函数在接口部分的 private中申明了一次,呵呵
    画蛇添足。但我还是不明白第二个问题。等会结贴。
      

  10.   

    你是控制台程序么??按Ctrl+C?没有什么效果咧?
      

  11.   

    TO:  Eastunfail(恶鱼杀手) 如果有文本被选中,按下Ctrl+C 将把文本拷贝到剪切板中。
      

  12.   

    和获得handle发送wm_copy一个效果