日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > c/c++ >内容正文

c/c++

C++ 关于ShowWindow()的疑问

發(fā)布時間:2023/12/18 c/c++ 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 C++ 关于ShowWindow()的疑问 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

IDE: Code::Blocks 16.01

操作系統(tǒng):Windows 7 x64

最初的代碼,目的是為了隱藏窗口出現(xiàn)在任務(wù)欄上的圖標(biāo)。

1 #include <windows.h>2 3 using namespace std;4 5 int main()6 {7 HWND hWnd;8 9 /* Retrieves a handle to the foreground window (the window with which the user is currently working). */ 10 hWnd = GetForegroundWindow(); 11 12 /* Hides the window and activates another window. */ 13 ShowWindow(hWnd, SW_HIDE); 14 15 return 0; 16 }

Build > Run,確實是能隱藏。但似乎出現(xiàn)了一個Bug:Run之后,無法Abort!

好吧,只能開啟Windows任務(wù)管理器,看了進程,沒有出現(xiàn)相應(yīng)的進程,無奈之下,只能關(guān)閉IDE,重新打開。

重復(fù)了幾次,依舊如此!


后來對代碼稍作修改:

1 #include <windows.h>2 #include <conio.h>3 #include <stdio.h>4 5 using namespace std;6 7 int main()8 {9 char cKey; 10 HWND hWnd; 11 12 /* Retrieves a handle to the foreground window (the window with which the user is currently working). */ 13 hWnd = GetForegroundWindow(); 14 15 /* Hides the window and activates another window. */ 16 ShowWindow(hWnd, SW_HIDE); 17 18 cKey = getch(); 19 printf("%c \n", cKey); 20 21 return 0; 22 }

Build > Run,能隱藏,Run之后,仍然無法Abort!

好吧,開啟Windows任務(wù)管理器,看了進程,相應(yīng)的進程出現(xiàn)了,選擇 > 結(jié)束進程。回到IDE,依舊無法Abort!What the hell? 還是得關(guān)閉IDE。

不知道是IDE的問題,還是ShowWindow()的問題導(dǎo)致這種情況。

總結(jié)

以上是生活随笔為你收集整理的C++ 关于ShowWindow()的疑问的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。