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,672)

  • 個人分類: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,917)

  • 個人分類: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,146)

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

個人資訊

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

熱門文章

  • (4,979)多測資處理
  • (21,951)bitset 整理
  • (444,417)[C] printf 引數說明
  • (39,455)[C] scanf 引數說明
  • (49,754)VBA Procedure 簡述
  • (45,791)VBA 活頁簿(Workbooks)管理
  • (58,121)[浮點數] IEEE754 , C/C++ 浮點數誤差
  • (80,139)[C] 計時器整理
  • (53,341)[Poker] 撲克牌遊戲設計介紹
  • (143,109)C/C++ 學習歷程分享

文章分類

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

動態訂閱

文章精選

文章搜尋

誰來我家

參觀人氣

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

留言板