[操作系统]Linux实验三.10 Windows系统下的进程创建

这篇博客介绍了如何在Windows环境下进行Linux进程的创建实践,包括启动记事本和资源管理器进程,以及一般性的应用程序进程创建过程。
摘要由CSDN通过智能技术生成

创建并启动一个记事本进程 

#include<iostream>
#include<windows.h>
 
using namespace std;
 
int main ()
{
    char InChar;
    cout << "输入Y将调用内核函数创建新的进程\n";
    cin >> InChar;
    if (InChar == 'Y'|| InChar == 'y')
    {
        BOOL IsSuccess;
		char FilePath[255]; //存放记事本程序的路径
		UINT uSize=255;
        GetWindowsDirectory(FilePath, uSize);
            //调用API函数GetWindowsDirectory()取得Windows 的系统目录
        strcat(FilePath, "\\notepad.exe");  //取得记事本程序的完整路径
        PROCESS_INFORMATION NewProcessInformation;
            //建立进程信息变量NewProcessInformation
        STARTUPINFO StartUpInformation;  //建立进程启动信息变量StarUpInformation
        memset(&StartUpInformation, 0, sizeof(StartUpInformation));
            //将缓冲区StartUpInformation设置为0
        StartUpInformation.cb=sizeof(StartUpInformation);
        StartUpInformation.wShowWindow=SW_SHOW;
            //新进程的显示方式为正常显示
        StartUpInformatio
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值