to prometheusphinx(白日梦):
   多谢,99分归你了。请再赐教如果我想取得浏览器中打开的word文件的句柄又该如何呢?

解决方案 »

  1.   

    同意楼上的!用API:GetClassName
    var
      ClassName: PChar;
      NameSize: Integer;
    begin
      NameSize := 256;
      NameSize := GetClassName( Handle, ClassName, NameSize );
      ShowMessage( IntToStr( NameSize ) + ':' + ClassName );
    end;
      

  2.   

    var
      Hnd: Integer;
    begin
      Hnd := FindWindow( 'OpusApp', nil );
      if hnd<>0 then
        ShowMessage( '发现Word文档窗口句柄:' + IntToStr(Hnd) );
    end;
      

  3.   

    var
      Hnd: Integer;
    begin
      Hnd := FindWindow( 'OpusApp', nil );
      if hnd<>0 then
        ShowMessage( '发现Word文档窗口句柄:' + IntToStr(Hnd) );
    end;
      

  4.   

    to chinajavis(我选择 我喜欢):
        佩服。再请赐教我在程序中用twebbrowser打开一个word文件,有没有方法使它不能被修改?
      

  5.   

    有什么问题一起问嘛!说赐教可不敢当,呵呵...
    WebBrowser1.Navigate('file:///C:/text.doc');
    不论怎样被修改也不好保存,当然不会对原文件有改动了。有意义么?
      

  6.   

    没有意义只是影响用户的观感,我只能给100分,请你参与我的另一个问题:http://www.csdn.net/Expert/TopicView1.asp?id=601417我在那个里面给你分。
      

  7.   

    function IsClass(Wnd:HWnd):bool;
    var classname:array[1..30]of char;
    begine
      result:=false;
      GetClassName(wnd,classname,30);
      if(stricomp(classname,'Twebbrowser')=0)then begin
          result:=true;
        end;
    end;
    wnd就是你说的句柄!
    如果做一下改动:
    function IsClass(Wnd:HWnd;classname:string):bool;
    var tmpclassname:array[1..30]of char;
    begine
      result:=false;
      GetClassName(wnd,classname,30);
      if(stricomp(tmpclassname,classname)=0)then begin
          result:=true;
        end;
    end;
    则可以判断各种情况
      

  8.   

    to anyiflyer(安逸飞):
        多谢,不过Twebbrowser通过getclassname得到的不是'Twebbrowser',而是'Internet Explorer_server'.getclassname得到的对delphi自身控件名称均正确,但是对Twebbrowser就不一样。还是多谢你的热心帮助。谢谢