标题:小問題求代碼
只看楼主
w327555162
Rank: 2
等 级:论坛游民
帖 子:45
专家分:43
注 册:2011-1-4
结帖率:85.71%
已结贴  问题点数:20 回复次数:4 
小問題求代碼
一個工程二個窗體form1,form2都處在打開狀態
我想在form1窗體點擊關閉時form2置於所有窗體包含所有別的應用程序最前面,並獲得焦點.
搜索更多相关主题的帖子: 工程 
2012-01-17 15:00
wube
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:23
帖 子:1817
专家分:3681
注 册:2011-3-24
得分:0 
Start Program -> Form1 -> Run Form2.Show

取得Form2 hwnd值:
Public Declare Function GetWindow Lib "user32" Alias "GetWindow" (ByVal hwnd As Long, ByVal wCmd As Long) As Long

Unload Form1 -> Run Form2窗体置顶:
Public Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

置顶 = 獲得焦點 ?

不要選我當版主
2012-01-17 18:05
w327555162
Rank: 2
等 级:论坛游民
帖 子:45
专家分:43
注 册:2011-1-4
得分:0 
这几行代码还不能看懂,要如何转到窗体中去,写在哪个事件下
2012-01-17 19:23
wube
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:23
帖 子:1817
专家分:3681
注 册:2011-3-24
得分:20 
Public Declare Function GetWindow Lib "user32" Alias "GetWindow" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Public Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Form1_Load()
Run Form2.Show
取得Form2 hwnd值:
End Sub

Form1_UnLoad()
Unload Form1
Run Form2窗体置顶:
End Sub

置顶 = 獲得焦點 ?

大概程序是这样~
具体程式码要试才知道~
我家用Win7没VB6~

不要選我當版主
2012-01-18 00:01
w327555162
Rank: 2
等 级:论坛游民
帖 子:45
专家分:43
注 册:2011-1-4
得分:0 
感謝
2012-01-18 11:29



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-359784-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.121536 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved