永发信息网

C++ 去掉命令行窗口

答案:2  悬赏:0  手机版
解决时间 2021-01-28 12:06
  • 提问者网友:饥饿走向夜
  • 2021-01-28 08:04
#include "stdafx.h"
#include "windows.h"
void main()
{ STARTUPINFO si;
PROCESS_INFORMATION pi;
char DeskName[]="pp";
HDESK hold = GetThreadDesktop(GetCurrentThreadId());
HDESK hhdesk = CreateDesktop( DeskName, NULL, NULL, DF_ALLOWOTHERACCOUNTHOOK, GENERIC_ALL, NULL);
SwitchDesktop( hhdesk);
SetThreadDesktop( hhdesk);
SwitchDesktop( hold);
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
si.lpDesktop = DeskName;
ZeroMemory( &pi, sizeof(pi) );
CreateProcess( NULL, "explorer", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
{
STARTUPINFO si;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
si.lpDesktop = "newdesk";
ZeroMemory( &pi, sizeof(pi) );
if( !CreateProcess( NULL,
"c:\\1.exe",
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&si,
&pi ) )
// {
// MessageBox(NULL,"运行失败","Error",0);
// ExitProcess(1);
// }
}
这段代码 运行后有个黑色的命令行窗口 能不能去掉?
最佳答案
  • 五星知识达人网友:神的生死簿
  • 2021-01-28 09:29
.
全部回答
  • 1楼网友:愁杀梦里人
  • 2021-01-28 10:35
the getfullpathname function retrieves the full path and file name of a specified file. dword getfullpathname( lpctstr lpfilename, dword nbufferlength, lptstr lpbuffer, lptstr* lpfilepart ); parameters lpfilename [in] a pointer to a null-terminated string that specifies a valid file name. this string can use short (the 8.3 form) or long file names. nbufferlength [in] the size of the buffer to receive the null-terminated string for the drive and path, in tchars. lpbuffer [out] a pointer to a buffer that receives the null-terminated string for the drive and path. lpfilepart [out] a pointer to a buffer that receives the address (in lpbuffer) of the final file name component in the path. if lpbuffer points to a directory and not a file, lpfilepart receives 0 (zero). return values if the function succeeds, the return value is the length of the string copied to lpbuffer, not including the terminating null character, in tchars. if the lpbuffer buffer is too small to contain the path, the return value is the size of the buffer that is required to hold the path and the terminating null character, in tchars. therefore, if the return value is greater than nbufferlength, call the function again with a buffer that is large enough to hold the path. if the function fails for any other reason, the return value is 0 (zero). to get extended error information, call getlasterror.
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯