windows98中如何编程实现禁止指定程序的运行!

解决方案 »

  1.   

    放一个timer控件,
    uses shellapi;progname:='你要禁止运行的程序名和扩展名';procedure Tfrmmain.Timer1Timer(Sender: TObject);
    var
    m_handle:THandle;
    procEntry32:TProcessEntry32;
    notEnd:Bool;
    hh:hwnd;
    ss:string;
    begin
    m_handle:=createToolhelp32snapshot(TH32CS_SNAPPROCESS,0);
    //TH32CS_SNAPPROCESS代表捕捉进程,给进程照个相
    procEntry32.dwSize:=sizeof(TProcessEntry32);
    notEnd:=Process32First(m_handle,procEntry32);//找第一个进程
    while notEnd do
    begin
    ss:=extractFileName(procEntry32.szExeFile);
    if   AnsiContainsText(progname,ss)   then
    begin
    hh:=OpenProcess(PROCESS_ALL_ACCESS,true,procEntry32.th32ProcessID);
    TerminateProcess(hh,0);
    end;
    notEnd:=Process32Next(m_handle,procEntry32);//继续找下一个进程
    end;
    end;
      

  2.   

    H:=findwindow('nil','程序名');
    sendmessage(h,close,0,0);
      

  3.   

    findwindow不用程序名,而是窗口栏上的名称,只要那个不变就行了。
    --------------------------------------
    看见了么,
    那支蛾子,
    正飞向太阳,
    那就是我!
    --------------------------------------
      

  4.   

    就用l0f(凌风) 的方法
    程序名变了但其内部的窗口类名是不变的
    或者用createmutex
    看看是否存在这个实例了
    如果存在就get
    然后杀掉
      

  5.   

    liguoyiao(我爱编程) 的方法 在NT4.0下不能正常运行!
    98,me,2000都可以,xp没有试过。
      

  6.   

    98够呛,nt系列的,使用ntfs分区,禁止对文件的访问即可(可针对用户)