我一直在环顾四周,但我无法找到问题的解决方案,即使有一些类似于我的解决问题.
我希望在我的C程序运行时隐藏控制台窗口.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <windows.h>
#define _WIN32_WINNT 0x0500
int main(){
HWND hWnd = GetConsoleWindow();
ShowWindow( hWnd, SW_MINIMIZE ); //won't hide the window without SW_MINIMIZE
ShowWindow( hWnd, SW_HIDE );
}
Run Code Online (Sandbox Code Playgroud)
这是我尝试但编译器给我"初始化使得指针来自整数而没有强制转换"
和致命的一个实际上停止编译"未定义引用'GetConsoleWindow'"
PS我已经检查了wincon.h并定义了GetConsoleWindow函数.