PIXNET Logo登入

Edison.X. Blog

跳到主文

YouLoveMe() ? LetItBe() : LetMeFree() ;

部落格全站分類:數位生活

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 12月 15 週三 201011:23
  • [W] Console 視窗控制

這裡主要包出一些函式去控制 Console 視窗,大多都是一邊看 MSDN 一邊去 try。但有些結果我覺得不是很好就註解掉,同時也讓我遇到了一些問題現在還沒辦法解決。下次再研究其它功能的時候,會再發另一篇出來,主要程式碼如下所示...
原始碼
/*
filename: EConsole.h
*/
(繼續閱讀...)
文章標籤

edisonx 發表在 痞客邦 留言(0) 人氣(10,781)

  • 個人分類:Win32-Console
▲top
  • 12月 14 週二 201020:28
  • [W] Console Function

常用 Console Function(截自MSDN)
 





Function
Description


FillConsoleOutputCharacter
Writes a character to the console screen buffer a specified number of times.


GetConsoleTitle
Retrieves the title for the current console window.


GetConsoleWindow
Retrieves the window handle used by the console associated with the calling process.


GetStdHandle
Retrieves a handle for the standard input, standard output, or standard error device.


PeekConsoleInput
Reads data from the specified console input buffer without removing it from the buffer.


ReadConsole
Reads character input from the console input buffer and removes it from the buffer.


ReadConsoleInput
Reads data from a console input buffer and removes it from the buffer.


ReadConsoleOutput
Reads character and color attribute data from a rectangular block of character cells in a console screen buffer.


ReadConsoleOutputCharacter
Copies a number of characters from consecutive cells of a console screen buffer.


ScrollConsoleScreenBuffer
Moves a block of data in a screen buffer.


SetConsoleCursorInfo
Sets the size and visibility of the cursor for the specified console screen buffer.


SetConsoleCursorPosition
Sets the cursor position in the specified console screen buffer.


SetConsoleTitle
Sets the title for the current console window.


SetStdHandle
Sets the handle for the standard input, standard output, or standard error device.


WriteConsole
Writes a character string to a console screen buffer beginning at the current cursor location.


WriteConsoleInput
Writes data directly to the console input buffer.


WriteConsoleOutput
Writes character and color attribute data to a specified rectangular block of character cells in a console screen buffer.


WriteConsoleOutputAttribute
Copies a number of foreground and background color attributes to consecutive cells of a console screen buffer.


WriteConsoleOutputCharacter
Copies a number of characters to consecutive cells of a console screen buffer.


(繼續閱讀...)
文章標籤

edisonx 發表在 痞客邦 留言(3) 人氣(855)

  • 個人分類:Win32-Console
▲top
  • 12月 14 週二 201007:08
  • [W] mouse and keybd

前言
看過 朋友的網誌,決定補充這二個東西。事實上 keybd_event 和 mouse_event 算是最簡單的外掛函式之一,
然而在 Win32 API 與 MFC 裡面仍使用 SendMessage, PostMessage 之方式進行,
(繼續閱讀...)
文章標籤

edisonx 發表在 痞客邦 留言(0) 人氣(3,680)

  • 個人分類:Win32-Console
▲top
  • 12月 07 週二 201000:16
  • [W] 設定 Console 游標位置

WinConsole -002.png
繼上個程式之後,我們已知道所有的步驟都要先取得 Handle,要 "畫" 出字串的時候就用 WriteConsole,但有時並不想從最左上角開始畫,這時我們必須介紹一個指令 SetConsoleCursorPosition
BOOL WINAPI SetConsoleCursorPosition(
  __in          HANDLE hConsoleOutput,
  __in          COORD dwCursorPosition
);

這指令主要就是把游標移到指定的位置上,到時再輸出的時候也能直接從該位置輸出。裡面有用到一個結構是 COORD,原型如下
typedef struct _COORD {
  SHORT
X;
  SHORT
Y;
} COORD,
*PCOORD;
(繼續閱讀...)
文章標籤

edisonx 發表在 痞客邦 留言(0) 人氣(6,919)

  • 個人分類:Win32-Console
▲top
  • 12月 06 週一 201022:07
  • [W] 初學者的 windows.h

WinConsole -001.png
這系列 ( console to windows) 文章並不會說到有關視窗程式設計的技巧,主要提供在 console 底下使用的人一些問題的指引與解決方案,但往往找到的解答都是有些讓初學者震驚的 windows.h ,於是特發此系列文章。若真是想學視窗程式設計,請考慮挑本 win32 視窗程式設計,或 MFC, BCB 視窗程式設計等此類書籍。當然,若評估考量後要用 C#, VB, JAVA... etc,也非常讚同,總之看官學得有興趣就好。
在往下看這系列的文章時,請先至少把基本的 C 或 C++ 學好,不然這部份對您而言沒有任何幫助。另,我該說先去多看看 windows.h 裡面有什麼東西嗎?如果您之前真的翻過 windows.h 裡面有什麼 struct, macro, function, 您會和我一樣,看得愈來愈亂,甚至裡面還有包含其它的 header, 再連過去看,這下真的是亂到不能再亂了!!於是我較建議,有需求的時候再上 MSDN 去查查,不然還是買本有系統的書回來學學,只是鮮少書籍專門在講 windows.h 裡面的 console 函式。
這次,重新先架構第一個程式 - Hello World, 相關說明如下
1. 資料型態 - HANDLE 、DWORD、LPDWORD
(繼續閱讀...)
文章標籤

edisonx 發表在 痞客邦 留言(1) 人氣(31,150)

  • 個人分類:Win32-Console
▲top
1

個人資訊

edisonx
暱稱:
edisonx
分類:
數位生活
好友:
累積中
地區:

熱門文章

  • (444,466)[C] printf 引數說明
  • (83,007)[C&++] 亂數基本使用
  • (80,151)[C] 計時器整理
  • (58,126)[浮點數] IEEE754 , C/C++ 浮點數誤差
  • (53,349)[Poker] 撲克牌遊戲設計介紹
  • (49,857)VBA Procedure 簡述
  • (45,792)VBA 活頁簿(Workbooks)管理
  • (39,455)[C] scanf 引數說明
  • (21,953)bitset 整理
  • (4,979)多測資處理

文章分類

toggle 開發手札 (2)
  • 未實作的想法 (4)
  • 心得筆記 (2)
toggle C/C++ (8)
  • C/C++ Note (52)
  • 亂數 (10)
  • Debug (9)
  • Hidden Features in C (6)
  • OO NOTE (0)
  • 面試題庫 (12)
  • C/C++ FAQ (4)
  • STL Note (3)
toggle 應用軟體/工具 (1)
  • Office (1)
toggle 數值分析 (9)
  • 非線性方程式求解 (10)
  • 矩陣運算 (7)
  • 深入質數 (5)
  • 浮點數 (9)
  • 複數 Complex (2)
  • 積分法 (2)
  • 多項式內差法 (2)
  • 常見關於數 (5)
  • math.h/cmath application (8)
toggle 程式之美 (1)
  • 遊戲之樂 (3)
toggle VB.Net (1)
  • VB.Net Note (1)
toggle 英文 (1)
  • 專題單字 (1)
toggle AutoIt!! (2)
  • AutoIt!! Note (13)
  • Auto-Dll (9)
toggle VBA (4)
  • VBA FAQ (5)
  • VBA Note (9)
  • VBA tec. (1)
  • VBA_Note2 (3)
toggle MFC (1)
  • MFC雜記 (4)
toggle Win32 (8)
  • Process (10)
  • Win32-Console (5)
  • 檔案系統 (1)
  • 音效 (1)
  • 隱喻外掛 (3)
  • System undoc. (0)
  • GDI (2)
  • 記憶體管理 (1)
toggle 環境與Script (4)
  • visual studio (6)
  • 批次檔batch (2)
  • 程式環境架構 (3)
  • Library (3)
toggle 數學整理 (2)
  • 常用公式 (1)
  • 有趣數學 (2)
toggle 演算法 (7)
  • Bit-Hacks (1)
  • AI (13)
  • 大數 (5)
  • 資料結構 (0)
  • 影像 (2)
  • 遞迴-recursive (2)
  • 回溯.列舉.遞迴 (2)
toggle 程設亂語 (1)
  • 胡言亂語 (10)
toggle SmallTalk (1)
  • SmallTalk (27)
  • 未分類文章 (1)

最新文章

  • 轉戰 python
  • [MFC] CArray 注意事項
  • 你真的很狠...
  • [開發手札] tool 整理 <NOTE>
  • [開發手札] vs dll 相容性
  • [開發手札] vc 效率問題
  • [開發手札] 修改 exe 裡面的 constant
  • [開發手札] 受不了 IDE 常當機問題...
  • [Job] Job Journal 130501
  • [面試] some tips

最新留言

  • [25/02/13] 訪客 於文章「[C語言數值分析] cmath / ma...」留言:
    您好,在最后的建表法趋近中, sin_tablePI2[i]...
  • [22/10/28] 訪客 於文章「C/C++ 學習歷程分享...」留言:
    abombterry(at)gmail.com...
  • [22/10/28] 訪客 於文章「C/C++ 學習歷程分享...」留言:
    請問現在還有教c語言嗎? 我有興趣,可否來信告知,謝謝 ...
  • [22/05/31] 五月花 於文章「[Poker] 撲克牌遊戲設計介紹...」留言:
    幫作者推一個 撲克遊戲真的很有趣 個人也是長年愛打牌的其...
  • [22/04/15] 訪客 於文章「[C語言數值分析] 非線性方程式求解 -...」留言:
    原本在搜尋引擎找出一堆 Blog 文章,不知哪幾篇值得花時間...
  • [21/12/27] RIYO 於文章「[Poker] 撲克牌遊戲設計介紹...」留言:
    感覺好酷!! 雖然不懂這些 但身為一個熱愛撲克的玩家覺得...
  • [21/10/01] 訪客 於文章「[GA] 基因演算法(Genetic A...」留言:
    只是想與板主和網友補充交流一下敝人拜讀完的拙見, 我想版主...
  • [21/06/19] 訪客 於文章「[亂數] <細說> C/C++ 亂數基本...」留言:
    請問要怎麼讓檔案第一次執行跑出10個亂數,二次執行跑出20個...
  • [20/09/24] 訪客 於文章「VBA Procedure 簡述...」留言:
    老師 您好 上述撰寫程式的示範,我能理解為何這樣演化,但我...
  • [20/06/25] 訪客 於文章「VBA Procedure 簡述...」留言:
    您好,我想請教一下 我在網路教學裡看到許多老師教製作Exc...

動態訂閱

文章精選

文章搜尋

誰來我家

參觀人氣

  • 本日人氣:
  • 累積人氣:

留言板