| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1008 人关注过本帖
标题:这个程序,用户定义类型如何定义?
取消只看楼主 加入收藏
yuma
Rank: 12Rank: 12Rank: 12
来 自:银河系
等 级:贵宾
威 望:37
帖 子:1934
专家分:3012
注 册:2009-12-22
结帖率:89.13%
收藏
 问题点数:0 回复次数:2 
这个程序,用户定义类型如何定义?
这个程序,用户定义类型如何定义?

这个程序是通过API的方法,最小化窗口。用于操作第三方程序的最大化、最小化、还原?


Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowPlacement Lib "user32" (ByVal hwnd As Long, lpwndpl As WINDOWPLACEMENT) As Long
    Private Const SW_SHOWMINIMIZED = 2
    Private Const SW_SHOWMAXIMIZED = 3
    Private Const SW_SHOWNORMAL = 1
   

Private Sub Form_Load()
Dim hwnd As Long, Thwnd As Long
Shell "notepad.exe", 1 '打开一个记事本
hwnd = FindWindow("Notepad", "无标题 - 记事本") '得到记事本句柄
SetWindowPlacement hwnd, 2
End Sub

[此贴子已经被作者于2023-2-9 15:15编辑过]

搜索更多相关主题的帖子: hwnd Long 定义 用户 Private 
2023-02-09 15:14
yuma
Rank: 12Rank: 12Rank: 12
来 自:银河系
等 级:贵宾
威 望:37
帖 子:1934
专家分:3012
注 册:2009-12-22
收藏
得分:0 
代码废了。

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowPlacement Lib "user32" (ByVal hwnd As Integer, ByRef lpwndpl As WINDOWPLACEMENT) As Integer
Private Declare Function SetWindowPlacement Lib "user32" (ByVal hwnd As Long, lpwndpl As WINDOWPLACEMENT) As Long
Private Const SW_SHOWMINIMIZED = 2
Private Const SW_SHOWMAXIMIZED = 3
Private Const SW_SHOWNORMAL = 1
   
Private Type POINTAPI
        x As Long
        y As Long
End Type

Private Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
End Type

Private Type WINDOWPLACEMENT
        Length As Long
        flags As Long
        showCmd As Long
        ptMinPosition As POINTAPI
        ptMaxPosition As POINTAPI
        rcNormalPosition As RECT
End Type

Private Sub Form_Load()
Dim app_hwnd As Long
Dim wp As WINDOWPLACEMENT
Shell "notepad.exe", 1 '打开一个记事本
app_hwnd = FindWindow("Notepad", "无标题 - 记事本") '得到记事本句柄
wp.showCmd = SW_SHOWMINIMIZED
SetWindowPlacement app_hwnd, wp.showCmd
End Sub



心生万象,万象皆程序!
本人计算机知识网:http://bbs.为防伸手党,本站已停止会员注册。
2023-02-09 19:02
yuma
Rank: 12Rank: 12Rank: 12
来 自:银河系
等 级:贵宾
威 望:37
帖 子:1934
专家分:3012
注 册:2009-12-22
收藏
得分:0 
可以,WIN10下测试通过。

心生万象,万象皆程序!
本人计算机知识网:http://bbs.为防伸手党,本站已停止会员注册。
2023-02-09 20:55
快速回复:这个程序,用户定义类型如何定义?
数据加载中...
 
   



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

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