如何在MFC/SDK中编写系统功能? [英] How can I write a system fucion in MFC/SDK?

查看:77
本文介绍了如何在MFC/SDK中编写系统功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我编写了一个控制台应用程序代码,如下所示:

Hello,
I have written a console application code as follow:

#include<windows.h>
#include<stdio.h>
{
    system("route -p add 0.0.0.0 mask 0.0.0.0 192.168.15.23");
}


当我将其转换为MFC/SDK时,该应用程序仍显示为黑色控制台窗口.但这不是我想要的,因为黑窗"并不漂亮.我想隐藏它或编写具有相同功能的其他函数来替换


When I turn it into MFC/SDK,the application still appears the black console window. But that is not what I want because the Black Window is not beautiful. I want to hide it or write other function having the same funcion to repalce

system("route -p add 0.0.0.0 mask 0.0.0.0 192.168.15.23");


有人可以告诉我该怎么做吗?告诉我您的代码.
预先谢谢您.


Could someone tell me How to do it ? Show me your code.
Thank you in advance.

推荐答案

使用CreateProcess API代替system函数.
STARTUPINFO结构参数中,将dwFlags设置为STARTF_USESHOWWINDOW,将wShowWindow设置为SW_HIDE.
Use the CreateProcess API instead of the system function.
In the STARTUPINFO structure parameter, set dwFlags as STARTF_USESHOWWINDOW and wShowWindow as SW_HIDE.


这篇关于如何在MFC/SDK中编写系统功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆