Console相关

今天本意想把HOOK放在一个CONSOLE里,最终没能搞定....

但是,在搞这个的过程中,看到了相关CONSOLE的一些操作.(http://szfzafa.blog.163.com/blog/static/11895416720113115202437/)

记录如下..

 1 #include "stdafx.h"
 2 #include "resource.h"
 3 
 4 
 5 
 6 int _tmain( int argc, _TCHAR* argv[] )
 7 {
 8     HINSTANCE hInstance = ::GetModuleHandle( NULL );
 9     HWND hWnd = ::GetConsoleWindow();
10 
11     SetConsoleTitle( TEXT( "123..........." ) );
12 
13     Sleep( 6000 );
14 
15     SendMessage( hWnd, WM_SETTEXT, ( WPARAM )0, ( LPARAM )TEXT( "456..........." ) );
16     SendMessage( hWnd, WM_SETICON, ICON_SMALL, ( LPARAM )LoadIcon( hInstance, MAKEINTRESOURCE( IDI_ICON1 ) ) );
17     SendMessage( hWnd, WM_SETICON, ICON_BIG, ( LPARAM )LoadIcon( hInstance, MAKEINTRESOURCE( IDI_ICON1 ) ) );
18 
19     while ( getchar() != 'Q' )
20     {
21         Sleep( 200 );
22     }
23 
24     return 0;
25 }

后来,,在MSDN里查SetConsole...下面列出了一堆函数..都很有用..有时间再看下..

其中,涉及事件的有一个,还挺有意思..SetConsoleCtrlHandler. 试了一下,也能用.

原文地址:https://www.cnblogs.com/javado/p/2672440.html