惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
Cyber Attacks, Cyber Crime and Cyber Security
The Last Watchdog
The Last Watchdog
Forbes - Security
Forbes - Security
S
Security @ Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog
T
Troy Hunt's Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
W
WeLiveSecurity
WordPress大学
WordPress大学
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
N
News | PayPal Newsroom
D
DataBreaches.Net
博客园_首页
Y
Y Combinator Blog
F
Fortinet All Blogs
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research
T
Tailwind CSS Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Hugging Face - Blog
Hugging Face - Blog
The GitHub Blog
The GitHub Blog
B
Blog RSS Feed
C
CERT Recently Published Vulnerability Notes
P
Privacy & Cybersecurity Law Blog
Help Net Security
Help Net Security
S
SegmentFault 最新的问题
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
N
News and Events Feed by Topic
Schneier on Security
Schneier on Security
V
Vulnerabilities – Threatpost
A
About on SuperTechFans
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
L
LangChain Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
GbyAI
GbyAI
L
LINUX DO - 热门话题
Simon Willison's Weblog
Simon Willison's Weblog
雷峰网
雷峰网
G
Google Developers Blog
Cyberwarzone
Cyberwarzone
I
Intezer
Google DeepMind News
Google DeepMind News
AWS News Blog
AWS News Blog
C
Check Point Blog
AI
AI
博客园 - 【当耐特】
有赞技术团队
有赞技术团队
博客园 - 司徒正美

博客园 - huangyi

垃圾回收 Winform程序中打开控制台 心目中软件开发的未来 把新闻系统转到CommunityServer下的几点体会 css学习笔记 Float css学习笔记 Position CommunityServer下的新闻系统 qq 被人骗走了啊 狗日的 2千多个小时啊 Enterprise Library CommunityServer如何管理Url CommunityServer如何实现属性的动态扩展 CommuntyServer架构分析 web2.0 与 未来网 论坛 博客 相册 留言本 开发计划 微软技术一个共同点 学习avalon的第一个小程序 献丑了 与delphi有关 看到Agent Oriented Programmig感想 Introduce Longhorn to developers(The Longhorn Application Model)[翻译]
郁闷 MyConsole 白做了
huangyi · 2005-11-27 · via 博客园 - huangyi

前些天希望在winform中打开控制台 
查api  搞清楚流程基本是 

AllocConsole

GetStdHandle

ReadConsole

WriteConsole

FreeConsole

然后转成 c# 代码写了个MyConsole的类  自我感觉还不错

今天翻出System.Console的代码一看就郁闷了。
MyConsole根本不需要,因为Console本身也是通过调用GetStdHandle获得输入输出缓冲的,所以应用程序只需要调用AllocConsole创建一个控制台,然后就可以直接使用Console的代码了。

不过有个小惊喜就是看Console代码的时候发现内部使用了一个叫Win32NativeMethod的类,主要是对一些io方面的api的简单封装, 顺手就复制出来了,稍微做了点修改,主要是两个用到unsage代码的方法注释掉了,两个用到 System.Evionment.GetResourceString内部方法的方法注释掉了,然后把AllocConsole和 FreeConsole加上去。


posted on 2005-11-27 20:02  huangyi  阅读(697)  评论(1)    收藏  举报