windows 程序设计

来源:互联网 发布:tensorflow显卡要求 编辑:程序博客网 时间:2024/06/05 03:40
IsWindow
函数功能:该函数确定给定的窗口句柄是否标识一个已存在的窗口。


窗口子类化


    我们知道,在Windows中有个函数叫做CallWindowProc。故名思义,它的作用就是向指定的窗口过程传递一个消息。你

也许会想,既然我已经有了窗口过程的指针,为什么我不可以直接通过这个指针调用该函数(这是C语言的内建功能)?事

实上,在Win16中确实可以这么做,因为GetWindowLong返回的确实是该函数的指针。但在Win32下,GetWindowLong返回的

并不是该函数的指针,而是一个包含函数指针的数据结构的指针(MSDN上说返回的是一个窗口函数地址或它的句柄,就是

指的这种情况)。该数据结构是可变的,但只要你使用CallWindowProc来调用的话是不会出错的。这里我们又看到使用句

柄处理带来的好处。(补充说明一点:微软在这里之所以这么处理,是为了解决16位/32位以及ANSI/UNICODE的转化问题)


关于 子窗口、父窗口、所有者窗口
http://www.cnblogs.com/lidabo/p/3284893.html
http://www.cnblogs.com/lidabo/archive/2013/08/27/3284907.html


WM_CLOSE/WM_DESTROY/WM_QUIT/DestroyWindow


 WM_KEYDOWN和WM_CHAR都是键盘消息。TranslateMessage函数已经将按键消息转换成字符消息了,那么WndProc函数中需要

对事件进行选择。如:键入“D”键,就应该选择WM_CHAR,因为WM_CHAR 只是字母,不包含特殊字符如Ctrl等。
如果键盘键入的是“Ctrl+D”,则应该选择WM_KEYDOWN,因为WM_KEYDOWN既包含字母也包含特殊字符。
       WM_CHAR是由WM_KEYDOWN消息Translate()之后产生的,然后再发送给窗口过程。例如按下“D”键,产生

WM_KEYDOWN消息,此消息经过Translate()处理后变成了WM_KEYDOW、WM_CHAR两个消息传递给窗口过程。

        而WM_SYSKEYDOWN是接受快捷键或系统命令按键的,像Alt键就是。所以捕获Alt键时,在WM_KEYDOWN下是无效的,

要在WM_SYSKEYDOWN中。Ctrl和shift不属于WM_SYSKEYDOWN。



关于命名空间 namespace 的使用形式,及作用域
命名空间的叠加和扩展

COM编程

Dll/Active x

WebService

设计模式 学习

dynamic_cast
static_cast

C++ 中的 template 技术



DestroyWindow
This function destroys the specified window. The function sends a WM_DESTROY message to the window to

deactivate it and removes the keyboard focus from it. The function also destroys the window's menu,

destroys timers, removes clipboard ownership, and breaks the clipboard viewer chain (if the window is at

the top of the viewer chain).

If the specified window is a parent or owner window, DestroyWindow automatically destroys the associated

child or owned windows when it destroys the parent or owner window. The function first destroys child or

owned windows, and then it destroys the parent or owner window.

DestroyWindow also destroys modeless dialog boxes created by the CreateDialog function.



RegisterSuperclass


0 0
原创粉丝点击