vbnet 句柄解决创建大于分辨率的窗体

因项目需要,要创建个窗体大于分辨率,几经折腾,实现,现记录于此;

   Declare Auto Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Int32, ByVal nIndex As Int32, ByVal dwNewLong As Int32) As Int32

   Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hwnd As Int32, ByVal nIndex As Int32) As Int32

   Declare Function MoveWindow Lib "user32" Alias "MoveWindow" (ByVal hwnd As Int32, ByVal x As Int32, ByVal y As Int32,ByVal nWidth As Int32, ByVal nHeight As Int32, ByVal bRepaint As Int32) As Int32

Private Const WS_THICKFRAME As Int32 = &H40000
Private Const WS_POPUP As Int32 = &H80000000

Dim hwnd = FindWindow("目标类", vbNullString)   ‘注:目标类可通过VS-工具-Spy++(+) 查看

Dim style = GetWindowLong(hwnd, GWL_STYLE)

            style = style And (Not WS_THICKFRAME)

            style = style Or WS_POPUP

            SetWindowLong(hwnd, GWL_STYLE, style)

            MoveWindow(hwnd, “point x”,“point y”, "form.width", “form.height", 1)



大学的时候就注册了CSDN,但我这第一次在CSDN上面写博客时工作已经快3年,因经常得益于此,现也将自己遇到的问题及解决的方法记录下来,供交流与参考;

发布了13 篇原创文章 · 获赞 3 · 访问量 6005

猜你喜欢

转载自blog.csdn.net/vszys/article/details/44593127