整数变量& HA1 [英] Integet variable &HA1

查看:91
本文介绍了整数变量& HA1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Me.Capture = False
Dim msg As Message = Message.Create(Me.Handle, &HA2, New IntPtr(2), IntPtr.Zero)
Me.DefWndProc(msg)





这是在mousemove事件中移动表单的代码,但是它是如何工作的?





This is the code of moving form in mousemove event,but how its work??

推荐答案

要么学习Win32(与.NET无关),然后学习如何System.Window.Forms.Form与Windows API一起使用.但是,这样编写代码根本没有任何意义.怎样移动表格?使用类System.Window.Forms.Form的实例属性:LocationLeftTop,仅此而已.请参阅:
http://msdn.microsoft.com/en-us/library/system. windows.forms.form.aspx [ ^ ].

您应该了解,发送和处理所谓的Windows消息(尤其是在不同进程之间)是古老的,尤其是Windows机制.微软人很难摆脱它,最大的步骤是创建WPF,另一方面,创建新颖的OS(例如Singularity)并开发新的OS(例如Midory(代号),Barrelfish等) .

通过直接在您的应用程序中使用Windows消息,您将冒着应用程序平台兼容性的风险.您知道吗,尽管System.Window.Forms不是标准库,但如果您准确地编写Form应用程序,您仍然可以在许多平台上运行此类应用程序(例如Windows,Linux,Mac OS X等不同版本,使用不同的指令集体系结构)无需重新编译? (您可以通过Mono, http://en.wikipedia.org/wiki/Mono_%28software%29 [ ^ ],http://www.mono-project.com/Main_Page [
Either learn Win32 (without any concern to .NET) and then learn how System.Window.Forms.Form works with Windows API. However, writing the code like this makes no sense at all. What to move a form? Use the instance properties of the class System.Window.Forms.Form: Location or Left and Top, that''s all. Please see:
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.aspx[^].

You should understand that sending and handling so called Windows messages (especially between different processes) is old and specifically Windows mechanism. Microsoft people having hard time trying to get rid of it, and the biggest steps are creation of WPF, and, from the other hand, creation of novel OS like Singularity and working on new ones, like Midory (code name), Barrelfish, etc.

By using Windows messages directly in your application, you risk platform compatibility of your application. Did you know that, if you write a Form application accurately, despite the fact that System.Window.Forms is not a standard library, you still can run such application on many platforms (like different versions of Windows, Linux, Mac OS X and more, with different instruction-set architectures) without recompilation? (You can do it through Mono, http://en.wikipedia.org/wiki/Mono_%28software%29[^], http://www.mono-project.com/Main_Page[^]). Why spoiling all that? Try to use pure .NET.

—SA


这篇关于整数变量& HA1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆