找回密码
 加入
搜索
查看: 2160|回复: 3

[GUI管理] 第三方程序界面样式修改

[复制链接]
发表于 2017-3-10 09:36:11 | 显示全部楼层 |阅读模式
请问如何修改第三方程序的界面样式,例如将运行的记事本程序样式改为$WS_POPUP样式,已知autoit自己绘制的GUI可以用GUISetStyle()来修改。

多谢多谢!
发表于 2017-3-10 10:02:38 | 显示全部楼层
本帖最后由 tubaba 于 2017-3-10 10:07 编辑

回复 1# sellkingfly

        #include <WinAPIConstants.au3>
Local $PID = Run('notepad.exe')
Local $Embed_hWnd = _GetHwndFromPID($PID)
Local $sFuncName = "GetWindowLongW"

If @AutoItX64 Then $sFuncName = "GetWindowLongPtrW"
Local $aResult = DllCall("user32.dll", "long_ptr", $sFuncName, "hwnd", $Embed_hWnd, "int", $GWL_STYLE) ;获取窗口样式
Local $hWindowLong = $aResult[0]
Local $sFuncName = "SetWindowLongW"
If @AutoItX64 Then $sFuncName = "SetWindowLongPtrW"
Local $aResult = DllCall("user32.dll", "long_ptr", $sFuncName, "hwnd", $Embed_hWnd, "int", $GWL_STYLE, "LONG", $hWindowLong - 0xC00000) ;在此样式上去掉窗口标题栏


Func _GetHwndFromPID($PID)
    $hWnd = 0
    $stPID = DllStructCreate("int")
    Do
        $winlist2 = WinList()
        For $i = 1 To $winlist2[0][0]
            If $winlist2[$i][0] <> "" Then
               DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $winlist2[$i][1], "ptr", DllStructGetPtr($stPID))
                If DllStructGetData($stPID, 1) = $PID Then
                    $hWnd = $winlist2[$i][1]
                    ExitLoop
                EndIf
            EndIf
        Next
        Sleep(100)
    Until $hWnd <> 0
    Return $hWnd
EndFunc ;==>_GetHwndFromPID

评分

参与人数 1金钱 +10 收起 理由
nmgwddj + 10

查看全部评分

 楼主| 发表于 2017-3-10 11:16:42 | 显示全部楼层
本帖最后由 sellkingfly 于 2017-3-10 11:28 编辑

回复 2# tubaba

谢谢哈,又学到不少!
不过和$WS_POPUP的边框还有些不一样,对API这块不了解,恕在下愚钝无法举一反三。
发表于 2017-3-30 00:11:25 | 显示全部楼层
没意思,修改了反而不好看
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-20 14:43 , Processed in 0.079556 second(s), 27 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表