當前位置:首頁 » 編程語言 » c語言進程編程

c語言進程編程

發布時間: 2024-05-11 01:58:38

⑴ 用c語言編寫並調試一個模擬的進程調度程序,採用「簡單時間片輪轉法」調度演算法對五個進程進行調度。

#include "stdio.h"
#include "stdlib.h"
#include "string.h"

struct PCB {
char NAME[10]; /*進程名*/
int ROUND; /*進程輪轉時間片*/
int REACHTIME; /*進程到達時間*/
int CPUTIME; /*進程佔用CPU時間*/
int COUNT; /*計數器*/
int NEEDTIME; /*進程完成還要的CPU時間*/
char STATE; /*進程的狀態*/
struct PCB *NEXT; /*鏈指針*/
};

struct LINK { /*PCB的鏈結構*/
struct PCB *RUN; /*當前運行進程指針*/
struct PCB *READY; /*就緒隊列頭指針*/
struct PCB *TAIL; /*就緒隊列尾指針*/
struct PCB *FINISH; /*完成隊列頭指針*/
};

void INIT(LINK *); /*對PCB的鏈結構初始化*/
void INSERT(LINK *); /*將執行了一個單位時間片數且還未完成的進程的PCB插到就緒隊列的隊尾*/
void FIRSTIN(LINK *); /*將就緒隊列中的第一個進程投入運行*/
void PRINT(LINK *); /*列印每執行一個時間片後的所有進程的狀態*/
void PR(PCB *); /*列印一個進程的狀態*/
int CREATE(LINK *,int); /*創建新的進程*/
void ROUNDSCH(LINK *); /*按時間片輪轉法調度進程*/

void main() {
LINK pcbs;
int i;
INIT(&pcbs);
i=0;
printf("創建5個進程\n\n");
while(i<5) {
if(CREATE(&pcbs,i+1)==1) {
printf("進程已創建\n\n");
i++;
}
else
printf("進程創建失敗\n\n");
}
FIRSTIN(&pcbs);
ROUNDSCH(&pcbs);
}

void ROUNDSCH(LINK *p) {
PCB *pcb;
while(p->RUN!=NULL) {
pcb=(PCB *)malloc(sizeof(PCB));
strcpy(pcb->NAME,p->RUN->NAME);
pcb->ROUND=p->RUN->ROUND;
pcb->REACHTIME=p->RUN->REACHTIME;
pcb->CPUTIME=p->RUN->CPUTIME;
pcb->COUNT=p->RUN->COUNT;
pcb->NEEDTIME=p->RUN->NEEDTIME;
pcb->STATE=p->RUN->STATE;
pcb->NEXT=p->RUN->NEXT;
pcb->CPUTIME++;
pcb->NEEDTIME--;
pcb->COUNT++;
if(pcb->NEEDTIME==0) {
pcb->NEXT=p->FINISH->NEXT;
p->FINISH->NEXT=pcb;
pcb->STATE='F';
p->RUN=NULL;
if(p->READY!=p->TAIL)
FIRSTIN(p);
}
else {
p->RUN=pcb;
if(pcb->COUNT==pcb->ROUND) {
pcb->COUNT=0;
if(p->READY!=p->TAIL) {
pcb->STATE='W';
INSERT(p);
FIRSTIN(p);
}
}
}
PRINT(p);
}
}

void INIT(LINK *p) {
p->RUN=NULL;
p->TAIL=p->READY=(PCB *)malloc(sizeof(PCB));
p->READY->NEXT=NULL;
p->FINISH=(PCB *)malloc(sizeof(PCB));
p->FINISH->NEXT=NULL;
}

int CREATE(LINK *p,int n) {
PCB *pcb,*q;
pcb=(PCB *)malloc(sizeof(PCB));
flushall();
printf("請輸入第%d個進程的名稱:\n",n);
gets(pcb->NAME);
printf("請輸入第%d個進程的輪轉時間片數:\n",n);
scanf("%d",&(pcb->ROUND));
printf("請輸入第%d個進程的到達時間:\n",n);
scanf("%d",&(pcb->REACHTIME));
pcb->CPUTIME=0;
pcb->COUNT=0;
printf("請輸入第%d個進程需運行的時間片數:\n",n);
scanf("%d",&(pcb->NEEDTIME));
pcb->STATE='W';
pcb->NEXT=NULL;
if(strcmp(pcb->NAME,"")==0||pcb->ROUND<=0||pcb->NEEDTIME<=0) /*輸入錯誤*/
return 0;
q=p->READY;
while(q->NEXT!=NULL&&q->NEXT->REACHTIME<=pcb->REACHTIME)
q=q->NEXT;
pcb->NEXT=q->NEXT;
q->NEXT=pcb;
if(pcb->NEXT==NULL)
p->TAIL=pcb;
return 1;
}

void FIRSTIN(LINK *p) {
PCB *q;
q=p->READY->NEXT;
p->READY->NEXT=q->NEXT;
q->NEXT=NULL;
if(p->READY->NEXT==NULL)
p->TAIL=p->READY;
q->STATE='R';
p->RUN=q;
}

void INSERT(LINK *p) {
PCB *pcb;
pcb=(PCB *)malloc(sizeof(PCB));
strcpy(pcb->NAME,p->RUN->NAME);
pcb->ROUND=p->RUN->ROUND;
pcb->REACHTIME=p->RUN->REACHTIME;
pcb->CPUTIME=p->RUN->CPUTIME;
pcb->COUNT=p->RUN->COUNT;
pcb->NEEDTIME=p->RUN->NEEDTIME;
pcb->STATE=p->RUN->STATE;
pcb->NEXT=p->RUN->NEXT;
p->TAIL->NEXT=pcb;
p->TAIL=pcb;
p->RUN=NULL;
pcb->STATE='W';
}

void PRINT(LINK *p) {
PCB *pcb;
printf("執行一個時間片後的所有進程的狀態:\n\n");
if(p->RUN!=NULL)
PR(p->RUN);
if(p->READY!=p->TAIL) {
pcb=p->READY->NEXT;
while(pcb!=NULL) {
PR(pcb);
pcb=pcb->NEXT;
}
}
pcb=p->FINISH->NEXT;
while(pcb!=NULL) {
PR(pcb);
pcb=pcb->NEXT;
}
}

void PR(PCB *p) {
printf("進程名:%s\n",p->NAME);
printf("進程輪轉時間片:%d\n",p->ROUND);
printf("進程到達時間:%d\n",p->REACHTIME);
printf("進程佔用CPU時間:%d\n",p->CPUTIME);
printf("計數器:%d\n",p->COUNT);
printf("進程完成還要的CPU時間:%d\n",p->NEEDTIME);
printf("進程的狀態:%c\n\n",p->STATE);
}

⑵ 在Linux下用C語言編程

4。守護進程的創建
如果你在DOS時代編寫過程序,那麼你也許知道在DOS下為了編寫一個常駐內存的程序我們要編寫多少代碼了.相反如果在Linux下編寫一個"常駐內存"的程序卻是很容易的.我們只要幾行代碼就可以做到. 實際上由於Linux是多任務操作系統,我們就是不編寫代碼也可以把一個程序放到後台去執行的.我們只要在命令後面加上&符號SHELL就會把我們的程序放到後台去運行的. 這里我們"開發"一個後台檢查郵件的程序.這個程序每個一個指定的時間回去檢查我們的郵箱,如果發現我們有郵件了,會不斷的報警(通過機箱上的小喇叭來發出聲音). 後面有這個函數的加強版本加強版本
後台進程的創建思想: 首先父進程創建一個子進程.然後子進程殺死父進程(是不是很無情?). 信號處理所有的工作由子進程來處理.

#include
#include
#include
#include
#include
#include
#include

/* Linux 的默任個人的郵箱地址是 /var/spool/mail/用戶的登錄名 */

#define MAIL "/var/spool/mail/hoyt"

/* 睡眠10秒鍾 */

#define SLEEP_TIME 10

main(void)
{
pid_t child;

if((child=fork())==-1)
{
printf("Fork Error:%s\n",strerror(errno));
exit(1);
}
else if(child>0)
while(1);
if(kill(getppid(),SIGTERM)==-1)
{
printf("Kill Parent Error:%s\n",strerror(errno));
exit(1);
}
{
int mailfd;

while(1)
{
if((mailfd=open(MAIL,O_RDONLY))!=-1)
{
fprintf(stderr,"%s","\007");
close(mailfd);
}
sleep(SLEEP_TIME);
}
}
}

你可以在默認的路徑下創建你的郵箱文件,然後測試一下這個程序.當然這個程序還有很多地方要改善的.我們後面會對這個小程序改善的,再看我的改善之前你可以嘗試自己改善一下.比如讓用戶指定郵相的路徑和睡眠時間等等.相信自己可以做到的.動手吧,勇敢的探險者.
好了進程一節的內容我們就先學到這里了.進程是一個非常重要的概念,許多的程序都會用子進程.創建一個子進程是每一個程序員的基本要求!

⑶ )用C語言(或其它語言,如Java)編程實現對N個進程採用某種進程調度演算法(如動態優先權調度

公眾:類PrivilegeProcess {
公共靜態無效的主要(字串[] args){

MyQueue的MyQueue的新MyQueue的();/ /聲明隊列

印刷電路板[PCB = {新的PCB(001 ,8,1),新的PCB(002,7,9),新的PCB(003,3,8),新的PCB(004,1,7),新的PCB(005,7,4)};
> PCB段=新的PCB();

(INT I = 0; <pcb.length; + +){/ /初始化先進行排序,選擇排序這里使用的是高優先順序的一線隊

(J =我; <pcb.length; J + +){

(PCB [I]。特權<PCB [J]。特權){

段= PCB [1];

PCB [I] = PCB [J];

PCB [J] =段;

}

}

}

體系。通過out.println(「入隊後第一時間的進程的順序:」);

(INT I = 0; <pcb.length; + +){

的System.out調用println(第一次入隊#程序名稱:「+ PCB [我]。名稱+ totaltime:」+ PCB [I]。totaltime +「的」特權「+ PCB [我]。特權); }

();

myqueue.start(PCB);

}

}

類MyQueue的{

INT指數= 0;

PCB [] PC =新的PCB [5];

PCB [] PC1 =新的PCB [4];

PCB溫度=新的PCB() BR />公共無效排隊(PCB工藝){/ /排隊演算法

(指數== 5){

(「出界!」);

返回

}

PC [索引] =進程;

指數+ +;

}

公共:PCB DEQUEUE(){/ /出隊演算法(索引== 0)

返回空;

(INT I = 0; <pc1.length; + +){

PC1 [I] = PC [ +1];

}

指數 -

溫度= PC [0];

(INT I = 0; <pc1.length; + +){ BR /> PC [I] = PC1 [I];

}

回報條件;

}

公共無效啟動(PCB [] PC){/ /進程表演算法

(PC [0]。isNotFinish ==真| | PC [1 isNotFinish ==真| | PC [2 isNotFinish ==真| | PC [3]。時isNotFinish ==真| | PC [4]。isNotFinish ==){

/ / *註:| |運算符都是假的,所有的表達式結果為假,否則真

(INT I = 0; <PC長度; + +){

PC [I]。運行(這一點); />} 的System.out.println();

(INT I = 0; <pc.length; + +){/ /處理每個運行一次運行的時間片的長度重新排序優先一旦

(J =我; <pc.length; J + +){

如果(PC [I]特權<PC [J]。特權){

溫度= PC [I];

PC [I] = PC [J];

PC [J] =溫度;

}

}

}

}

}

}

類PCB {/ /聲明過程級

和int名,totaltime ,運行時特權;

布爾isNotFinish的;

公眾PCB(){

}

公開PCB(名稱,詮釋totaltime特權){

this.name =的名稱;/ /進程名

this.totaltime = totaltime ;/ /

this.privilege =特權;/ /總時間優先 this.runtime = 2 ;/ /時間片值是2

this.isNotFinish =真;/ /是否執行完成

(「初始值:程序名稱:」+名+「totaltime:」+ totaltime +「特權」+特權);

System.out的。調用println();

}

MyQueue的MQ公共無效的run(){/ /處理的基礎上實施的時間片演算法

(totalTime> 1){ totaltime =運行;/ /總時間大於1,總時間=總時間 - 時間片

特權 -

(「程序名稱:」+姓名+「 remaintime:「+ +」特權「+特權); totaltime

的} else if(totaltime == 1){

totaltime - ;/ /總時間為1時,執行時間為1
>特權 -

(「程序名稱:」+姓名+「remaintime:」+ totaltime +「特權」+特權);

}其他{

isNotFinish =假;/ / 0,將isNotFinish標志設置為假

}

如果(isNotFinish ==真){br mq.deQueue();

mq.enQueue(本);

}

}
}

⑷ c語言編寫進程的創建與撤銷

struct pb
{int n;
int k;
int cha;};
typedef struct pb PCB;
PCB a[10];void creat()
{static int pi=1;
int k,l=0,m;
printf("plase input n0:");
scanf("%d",&m);
for(k=1;k<=10;k++)
if (a[k].n==m)
l=1;
if (l==1)
{printf("error!\n");
creat(); }
else
{a[pi].n=m;
printf("\n");
printf("plase input k0:");
scanf("%d",&a[pi].k);
printf("\n");
a[pi++].cha=4;}}void destory()
{int i,num,k=0;
printf(" plase input destory number:");
scanf("%d",&num);
for(i=1;i<=10;i++)
if(a[i].n==num) k=i;
if(k!=0)
{a[k].n=0;a[k].k=0;a[k].cha=0;}
else
printf("No have this destory number!\n");}void wakeup()
{int i,k,m,l;
printf("請輸入n0:");
scanf("%d",&m);
for(k=1;k<=10;k++)
if (a[k].n==m)
l=k;
a[l].cha=1; /*喚醒->靜止就緒*/}void active()
{int i,k,m,l;
printf("請輸入n0:");
scanf("%d",&m);
for(k=1;k<=10;k++)
if (a[k].n==m)
l=k;
a[l].cha=3; /*激活->活動就緒*/}void dse()
{int i,k,m,l;
printf("請輸入n0:");
scanf("%d",&m);
for(k=1;k<=10;k++)
if (a[k].n==m)
l=k;
a[l].cha=4; /*阻塞->活動阻塞*/}void swpend()
{int i,k,m,l;
printf("請輸入n0:");
scanf("%d",&m);
for(k=1;k<=10;k++)
if (a[k].n==m)
l=k;
a[l].cha=2; /* 掛起->靜止阻塞 */}void look()
{int i;
printf("\t\t�pcb n0 k0 cha\n");
for (i=1;i<=10;i++)
printf("\t\t%d\t%d\t%d\t%d\n",i,a[i].n,a[i].k,a[i].cha);
printf("\t1--靜止就緒 2--靜止阻塞 3--活動就緒 4--活動阻塞 5--運行\n");}void zt() /* 改變狀態*/
{int i,k,m,l;
printf("請輸入n0:");
scanf("%d",&m);
for(k=1;k<=10;k++)
if (a[k].n==m)
l=k;
printf("請輸入當前狀態:");
scanf("%d",&a[l].cha);
look();}void yxs() /*改變優先數*/
{int i,k,m,l;
printf("請輸入n0:");
scanf("%d",&m);
for(k=1;k<=10;k++)
if (a[k].n==m)
l=k;
printf("請輸入優先數:");
scanf("%d",&a[l].k);
look();}main()
{int d;
clrscr();
do
{
printf("\t\t*************** CHOICE *****************\n");
printf("\t\t* 1--------------進程創建 *\n");
printf("\t\t* 2--------------進程撤消 *\n");
printf("\t\t* 3--------------阻塞 *\n");
printf("\t\t* 4--------------喚醒 *\n");
printf("\t\t* 5--------------掛起 *\n");
printf("\t\t* 6--------------激活 *\n");
printf("\t\t* 7--------------查看狀態 *\n");
printf("\t\t* 8--------------改變狀態 *\n");
printf("\t\t* 9--------------改變優先數 *\n");
printf("\t\t* 0--------------退出 *\n");
printf("\t\t****************************************\n");
printf("\t\t�請選擇(0-9):");
scanf("%d",&d);
printf("\n");
switch(d)
{
case 1: creat();break;
case 2: destory();break;
case 3: dse();break;
case 4: wakeup();break;
case 5: swpend();break;
case 6: active();break;
case 7:look();break;
case 8:zt();break;
case 9:yxs();break;
case 0: exit(0);
}
}
while(d!=0);
}

⑸ 求進程調度先來先服務演算法,短進程優先演算法完整c語言代碼

/*(一)進程調度

進程調度演算法有FIFO,優先數調度演算法,時間片輪轉調度演算法,分級調度演算法,

輸入:進程流文件,其中存儲的是一系列要執行的進程,
每個作業包括三個數據項:
進程名 所需時間 優先數(0級最高)
輸出:
進程執行流 等待時間 平均等待時間

本程序包括:FIFO,優先數調度演算法,時間片輪轉調度演算法

進程流文件process_stream.txt
測試數據:
p0 16 2
p1 5 1
p2 4 3
p3 8 0
p4 9 4
p5 7 6

VC++調試通過
*/
#include <stdio.h>
#include <string.h>
#include <iostream.h>
#include <stdlib.h>

const int Quatum=2;//定義時間片的長度為2秒
const int MAXPCB=100;//定義最大進程數

//定義進程結構體
typedef struct node
{
char name[20];//進程名
int time; //進程運行時間
int privilege;//進程優先順序(靜態)
int finished;//進程完成標志,0-未完成,1-已完成
int wait_time;//進程等待時間
}pcb;

pcb pcbs[MAXPCB];
int quantiry;//進程流文件中的進程總數

void initial()
{
int i;
for (i=0;i<MAXPCB;i++)
{
strcpy(pcbs[i].name,"");
pcbs[i].time=0;
pcbs[i].privilege=0;
pcbs[i].finished=0;
pcbs[i].wait_time=0;
}
quantiry=0;
}

int readData()
{
FILE *fp;
char fname[20];
int i;
cout<<"請輸入進程流文件名:"<<endl;
cin>>fname;
if ((fp=fopen(fname,"r"))==NULL)
{
cout<<"錯誤,文件打不開,請檢查文件名"<<endl;
}
else
{
while (!feof(fp))
{
fscanf(fp,"%s %d %d %d",pcbs[quantiry].name,
&pcbs[quantiry].time,&pcbs[quantiry].privilege);
quantiry++;
}
//輸出所讀入得數據
cout<<"輸出所讀入的數據"<<endl;
cout<<"進程流文件中的進程總數="<<quantiry<<endl;
cout<<"進程名 所需時間 優先數"<<endl;

for (i=0;i<quantiry;i++)
{
cout<<" "<<pcbs[i].name<<" "<<pcbs[i].time<<" "<<pcbs[i].privilege<<endl;
}

return 1;
}

return 0;
}

//重置數據,以供另一個演算法使用
void init()
{
int i;
for (i=0;i<MAXPCB;i++)
{
pcbs[i].finished=0;
pcbs[i].wait_time=0;
}
}

void FIFO()
{
int i,j;

int total;
//輸出FIFO演算法執行流
cout<<endl<<"---------------------------------------------------------------"<<endl;
cout<<"FIFO演算法執行流:"<<endl;
cout<<"進程名 等待時間"<<endl;

for (i=0;i<quantiry;i++)
{
cout<<" "<<pcbs[i].name<<" "<<pcbs[i].wait_time<<endl;
for (j=i+1;j<quantiry;j++)
{
pcbs[j].wait_time+=pcbs[i].time;
}
}

total=0;
for (i=0;i<quantiry;i++)
{
total+=pcbs[i].wait_time;
}
cout<<"總等待時間:"<<total<<" "<<"平均等待時間:"<<total/quantiry<<endl;
}

//優先度調度演算法
void privilege()
{
int i,j,p;
int passed_time=0;
int total;

int queue[MAXPCB];
int current_privielege=1000;

for (i=0;i<quantiry;i++)
{
current_privielege=1000;
for (j=0;j<quantiry;j++)
{
if ((pcbs[j].finished==0)&&(pcbs[j].privilege<current_privielege))
{
p=j;
current_privielege=pcbs[j].privilege;
}
}
queue[i]=p;
pcbs[p].finished=1;
pcbs[p].wait_time+=passed_time;
passed_time+=pcbs[p].time;

}
//輸出優先數調度執行流
cout<<endl<<"-----------------------------------------"<<endl;
cout<<"優先數調度執行流:"<<endl;
cout<<"進程名 等待時間"<<endl;

for (i=0;i<quantiry;i++)
{
cout<<" "<<pcbs[queue[i]].name<<" "<<pcbs[queue[i]].wait_time<<"--"<<queue[i]<<endl;
}

total=0;
for (i=0;i<quantiry;i++)
{
total+=pcbs[i].wait_time;
}

cout<<"總等待時間:"<<total<<" 平均等待時間:"<<total/quantiry<<endl;
}

//時間片輪轉調度演算法
void timer()
{
int i,j,sum,flag=1;
int passed_time=0;
int max_time=0;
int round=0;

int queue[1000];
int total=0;

while(flag==1)
{
flag=0;
for (i=0;i<quantiry;i++)
{
if (pcbs[i].finished==0)
{
flag=1;
queue[total]=i;
total++;
if (pcbs[i].time<=Quatum*(round+1))
pcbs[i].finished=1;
}
}
round++;
}

cout<<endl<<"---------------------------------------------------------------"<<endl;
cout<<"時間片輪轉調度執行流:";
for(i=0;i<total;i++)
{
cout<<pcbs[queue[i]].name<<" ";
}
cout<<endl;
cout<<"進程名 結束時間 運行時間 等待時間"<<endl;

sum=0;

for (i=0;i<quantiry;i++)
{
for(j=total-1;j>=0;j--)//從輪轉調度執行流序列由後往前比較,找到同名進程即可計算其完成時間
{
if (strcmp(pcbs[queue[j]].name,pcbs[i].name)==0)
{
cout<<" "<<pcbs[i].name<<" "<<(j+1)*Quatum<<" ";
cout<<pcbs[i].time<<" "<<(j+1)*Quatum-pcbs[i].time<<endl;
sum+=(j+1)*Quatum-pcbs[i].time;
break;
}
}
}

cout<<"總等待時間:"<<sum<<" "<<"平均等待時間:"<<sum/quantiry<<endl;
}

//顯示版權信息函數
void version()
{
cout<<endl<<endl;

cout<<" ┏━━━━━━━━━━━━━━━━━━━━━━━┓"<<endl;
cout<<" ┃ 進程調度模擬系統 ┃"<<endl;
cout<<" ┠───────────────────────┨"<<endl;
cout<<" ┃ version 2011 ┃"<<endl;
cout<<" ┗━━━━━━━━━━━━━━━━━━━━━━━┛"<<endl;
cout<<endl<<endl;
}
//主函數

int main()
{
int flag;
version();
initial();
flag=readData();
if(flag==1){
FIFO();
init();
privilege();
init();
timer();
}
cout<<endl;
system("pause");
return 0;
}

⑹ 使用C語言編程實現:父進程創建二個子進程,三個進程各自列印出其進程


#include <stdio.h>

#include <sys/types.h>

#include <unistd.h>

int main()

{

int i=2;

int pid=0;

printf("father id=%ld ",getpid());

while(i-->0){

pid = fork();

if(pid==0){

printf("son id=%ld ",getpid());

return 0;

}

}

return 0;

}

⑺ 怎麼用C語言寫一個關閉後台某進程的程序

//kill進程from名字
BOOL KillProcessFromName(LPCSTR lpProcessName)
{
//創建進程快照(TH32CS_SNAPPROCESS表示創建所有進程的快照)
HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
//PROCESSENTRY32進程快照的結構體
PROCESSENTRY32 pe;
//實例化後使用Process32First獲取第一個快照的進程前必做的初始化操作
pe.dwSize = sizeof(PROCESSENTRY32);

//下面的IF效果同:
//if(hProcessSnap == INVALID_HANDLE_VALUE) 無效的句柄
if(!Process32First(hSnapShot,&pe))
{
return FALSE;
}
CString strProcessName = lpProcessName;
//將字元串轉換為小寫
strProcessName.MakeLower();

//如果句柄有效 則一直獲取下一個句柄循環下去
while (Process32Next(hSnapShot,&pe))
{
//pe.szExeFile獲取當前進程的可執行文件名稱
CString scTmp = pe.szExeFile;

//將可執行文件名稱所有英文字母修改為小寫
scTmp.MakeLower();
//比較當前進程的可執行文件名稱和傳遞進來的文件名稱是否相同
//相同的話Compare返回0
if(!scTmp.Compare(strProcessName))
{
//從快照進程中獲取該進程的PID(即任務管理器中的PID)
DWORD dwProcessID = pe.th32ProcessID;
HANDLE hProcess = ::OpenProcess(PROCESS_TERMINATE,FALSE,dwProcessID);
::TerminateProcess(hProcess,0);
CloseHandle(hProcess);
return TRUE;
}
scTmp.ReleaseBuffer();
}
strProcessName.ReleaseBuffer();
return FALSE;
}
以殺死qq程序為例,我們可以通過下列方式:
KillProcessFromName("qq.exe");

熱點內容
解壓剃發 發布:2024-05-21 03:16:27 瀏覽:640
伺服器怎麼連接到電腦顯示屏上 發布:2024-05-21 02:38:21 瀏覽:285
織夢安裝資料庫連接失敗 發布:2024-05-21 02:37:45 瀏覽:258
python編程入門經典pdf 發布:2024-05-21 02:31:45 瀏覽:6
arm編譯添加驅動 發布:2024-05-21 02:02:28 瀏覽:476
安卓設置頁面是怎麼 發布:2024-05-21 01:32:51 瀏覽:521
學生成績管理系統資料庫設計 發布:2024-05-21 01:14:41 瀏覽:43
我的世界什麼指令直接出現伺服器 發布:2024-05-21 01:10:00 瀏覽:397
星等演算法 發布:2024-05-21 00:53:06 瀏覽:509
李興華的java視頻 發布:2024-05-21 00:49:55 瀏覽:605