当前位置:首页
开发技术指南» 文章正文
    引言:

 ·有请斑竹等高手进来探讨    »显示摘要«
    摘要: 在我的form中我建了一个强类型的dataset(ds),并且在其中创建了两个表分别为purchasemaster,purchasedetail并且为两个表建立了关联,名为purchasemasterpurchasedetail,关系的更新、删除规则都设为cascade,接受/拒绝规则设为默认。 在我的form中有几个textbox(已经和purchasemaster的对应字段做了帮定)和......
 ·这个sql语句为什么不行    »显示摘要«
    摘要: select top 20 seq_no from (select top 909 * from (select *, 1 as type from guanli.dbo.tm_object_data where (order_no is null and order_deno is null) and section_no = 8110 order by seq_no desc......


在delphi中如何获取所有已运行程序的名称和该程序的窗口标题

在delphi中如何获取所有已运行程序的名称和该程序的窗口标题,有谁知道,非常感谢!

NO.1   作者: sirous

//以下MEMO1列出进程名单  
   
  uses     TlHelp32  
   
  var  
      p:   pProcessInfo;  
      ContinueLoop:   BOOL;  
      FSnapshotHandle,   hProcess:   THandle;  
      FProcessEntry32:   TProcessEntry32;  
   
  begin  
      New(p);  
      FSnapshotHandle:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);  
      FProcessEntry32.dwSize:=Sizeof(FProcessEntry32);  
      ContinueLoop:=Process32First(FSnapshotHandle,FProcessEntry32);  
      while   integer(ContinueLoop)<>0   do  
      begin  
          p.ExeFile:=   FProcessEntry32.szExeFile;  
          memo1.lines.add(p.ExeFile);  
          ContinueLoop:=Process32Next(FSnapshotHandle,FProcessEntry32);  
      end;  
      CloseHandle(FSnapshotHandle);  
  end;  
   
  //以下MEMO2列出窗口名单  
     
  function   GetWindow1(btitle:string):boolean;  
  var   winhandle:   Hwnd;  
          winprocess:   Dword;  
          title:pchar;  
  begin  
      result:=false;  
      Getmem(title,255);  
      winhandle:=GetWindow(GetForeGroundWindow,GW_HWNDFIRST);  
      while   winhandle<>0   do  
      begin  
        if   (IsWindowEnabled(winhandle)   and   IsWindow(winhandle))   then  
          begin  
        //   GetWindowThreadProcessId(winhandle,@winprocess);  
          GetWindowText(winhandle,title,255);  
            if   length(title)>0   then  
            begin  
                memo2.lines.add(title);  
            end;  
          end;  
   
          winhandle:=GetWindow(winhandle,GW_HWNDNEXT);  
      end;  
   
  Freemem(title);  
  CloseHandle(winHandle);  
  result:=true;  
  end;  
   
 

NO.2   作者: hugoon

unit   Unit1;  
   
  interface  
   
  uses  
      Windows,   Messages,   SysUtils,   Classes,   Graphics,   Controls,   Forms,   Dialogs,  
      StdCtrls;  
   
  type  
      TForm1   =   class(TForm)  
          WindowsNameListBox:   TListBox;  
          ListButton:   TButton;  
          procedure   ListButtonClick(Sender:   TObject);  
      private  
          {   Private   declarations   }  
      public  
          {   Public   declarations   }  
      end;  
   
  var  
      Form1:   TForm1;  
   
  implementation  
   
  {$R   *.DFM}  
   
  procedure   TForm1.ListButtonClick(Sender:   TObject);  
  var  
      hCurrentWindow:   HWnd;  
      szText:   array[0..254]   of   char;  
  begin  
      WindowsNameListBox.Clear;  
      //获取第一个窗口的句柄  
      hCurrentWindow   :=   GetWindow(Handle,   GW_HWNDFIRST);    
      while   hCurrentWindow   <>   0   do    
          begin  
          //获取窗口的名称  
          if   GetWindowText(hCurrentWindow,   @szText,   255)>0   then  
              WindowsNameListBox.Items.Add(StrPas(@szText));  
          //获取下一窗口的句柄  
          hCurrentWindow:=GetWindow(hCurrentWindow,   GW_HWNDNEXT);  
          end;  
  end;  
   
   
  end.  
   
   
   
  接分ing。。。。


    摘要: 关于asp 与 js参数传递的问题 父页面 表单名字和 文本域的名字都含有变量 当我要父页面传递参数时表单名字 文本域的名字该怎么写?下面是简单的代码 请各位帮帮忙 父页面a.asp <% for formid=1 to 10 %> <table width=100%> <form name="form<%=i%>" metho......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE