易截截图软件、单文件、免安装、纯绿色、仅160KB

VB实现全窗体移动

Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTCAPTION = 2
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
ReleaseCapture
SendMessage hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0
End If
End Sub
http://topic.csdn.net/t/20030524/18/1829023.html
http://zhidao.baidu.com/question/93411647.html?fr=qrl&cid=867&index=5&fr2=query
我想把form5移动到form3中picture1的位置,下面是我的代码(在form3的code中):
Dim r2 As RECT
GetWindowRect Picture1.hwnd, r2
Form5.ScaleMode = vbPixels '设置坐标单位为像素
Form5.Move r2.Left, r2.Top
Form5.Show
为什么移动的坐标仍然是默认的缇而不是屏幕像素呢?
请指教!
问题补充:
要实现窗口的正确移动,应该怎么做?
将form5的左上角的位置挪到form3中picture1左上角的位置
 'form3中
Private Type rect
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As rect) As Long
Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
Private Sub Command1_Click()
Dim wrect As rect
Dim picrect As rect
GetWindowRect Picture1.hwnd, picrect
GetWindowRect Form5.hwnd, wrect
MoveWindow Form5.hwnd, picrect.Left, picrect.Top, wrect.Right - wrect.Left, wrect.Bottom - wrect.Top, True
Form5.Show
End Sub


相关文档:

VB操作WORD

 Dim wdapp As Word.Application
    Dim wddoc As Word.Document
    Dim wdtable As Word.Table
   
    Set wdapp = CreateObject("word.application")
   
    Set wddoc = wdapp.Documents.Add
   ......

VB六个数取最大值和最小数

mxl=1                          && 最大的文本框编号
mnl=1                  &n ......

VB 单实例运行

VB6
在程序运行时用如下语句:
if   app.PrevInstance=true   then  
            end    
end   if
VB 2005:
1. 在VB2005中,打开"属性"页,启用"应用程序“框架, 选中"
单实例应用程序"前面复选框,就行了。
......

VB MSHFLEXGRID MSHFLEXGRID 同时选中不连续的多行

  在工程中添加一个类模块,名为   Selection  
  然后加入以下代码:  
   
  Dim   colRows   As   Collection  
  Dim   ControlKey   As   Boolean  
  Public   WithEvents   flx   As   M ......

vb程序中webbrowser 接受SendMessage 的消息

webbrowser 不能收到SendMessage的消息
主要是因为1webbrowser 的句柄找不到。经过努力搜索,终于解决了。做个记录.
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号