本帖最后由 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
|