原创 Win32學習筆記——消息處理

一 Win32消息機制 1.消息機制 過程驅動:程序是按照我們預先定義好的順序執行 事件驅動:程序的執行順序是無序的。某個時間點所執行的代碼,是由外界通知。 Win32的消息機制 —— 事件驅動 2.Win32消息程序 2.1Win32窗

原创 Win32學習筆記——定時器消息

1 定時器消息 WM_TIMER 按照定時器設置時間段,自動向窗口發送一個定時器消息WM_TIMER。優先級比較低。 精度比較低,毫秒級別。產生時間精度也比較低。 2 消息和函數 WM_TIMER —— 消息ID;  wParam

原创 WIN32學習筆記——鍵盤消息

1. 鍵盤消息 WM_KEYDOWN WM_KEYUP WM_SYSKEYDOWNALT/F10 WM_SYSKEYUP WM_CHAR 當有字符鍵被按下時產生。Translate會將WM_KEYDOW中的可以顯示的字符轉換爲WM_CHA

原创 關於wprintf無法打印unicod中文字符的解決方法

void PrintUnicode() { HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE) ; wchar_t *pszText = L"好好學習" ; WriteConsoleW(hOu

原创 Win32學習筆記——鼠標消息

一 鼠標消息 1 鼠標消息 WM_LBUTTONDOWN WM_LBUTTONUP WM_RBUTTONDOWN WM_RBUTTONUP WM_LBUTTONDBLCLK WM_RBUTTONDBLCLK

原创 Win32學習筆記——WM_PAINT

1. WM_PAINT 的產生 WM_PAINT 由於窗口的互相覆蓋等,產生需要繪製的區域,那麼就會產生WM_PAINT消息。 一般情況下通過API聲明需要繪製的區域,來產生WM_PAINT 。 例如,可以使用InvalidateRect

原创 boost——string_algo字符串的操作(三)

#include <boost/format.hpp> #include <boost/algorithm/string.hpp> using namespace boost; using namespace std; int _tm

原创 調試常用方法

方法一 :WriteConsole void NewConsole() { AllocConsole() ; g_hStdOut = GetStdHandle(STD_OUTPUT_HANDLE) ; TCHAR szText[

原创 Win32學習筆記——菜單

1 菜單的使用 1.1 菜單的創建 菜單創建後,會返回HMENU句柄 CreateMenu MENU 菜單 CreatePopupMenuPOPUPMENU 彈出式菜單 菜單項 每個菜單項都會有一個ID號,可以根據這個I

原创 boost——format格式化字符串

#include <boost/format.hpp> using namespace boost; using namespace std; int _tmain(int argc, _TCHAR* argv[]) { cout <

原创 跟我一起寫 Makefile

陳皓 概述 —— 什麼是makefile?或許很多Winodws的程序員都不知道這個東西,因爲那些Windows的IDE都爲你做了這個工作,但我覺得要作一個好的和professional的程序員,makefile還是要懂。這就好像現在有這

原创 boost——string_alog字符串的操作(四)

#include <boost/algorithm/string.hpp> using namespace boost; using namespace std; int _tmain(int argc, _TCHAR* argv[]

原创 boost——字符串與數字的轉換

#include <boost/lexical_cast.hpp> using namespace boost; using namespace std; int _tmain(int argc, _TCHAR* argv[]) { i

原创 boost——string_alog字符串的操作(五)

#include <boost/algorithm/string.hpp> #include <boost/typeof/typeof.hpp> using namespace boost; using namespace std;

原创 boost——sting_algo字符串的操作(二)

#include <boost/format.hpp> #include <boost/algorithm/string.hpp> using namespace boost; using namespace std; int _tm