_WinAPI_FatalExit 去掉返回值; _WinAPI_ExtSelectClipRgn 追加示例
本帖最后由 131738 于 2011-9-21 18:32 编辑如题!看来仅复制也不行。。。。。。。 除了winhttp,其它还没搞呢..
每天弄得不多.winhttp弄了一个晚上多... 除了winhttp,其它还没搞呢..
每天弄得不多.winhttp弄了一个晚上多...
thesnow 发表于 2011-9-21 20:36 http://www.autoitx.com/images/common/back.gif
手工麻烦 回复 3# 131738 #Include <GUITab.au3>
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Opt('TrayAutoPause', 0)
If Not _WinAPI_DwmIsCompositionEnabled() Then
MsgBox(16, 'Error', 'Require Windows Vista or later with enabled Aero theme.')
Exit
EndIf
Global Const $PRF_CLIENT = 0x04
Global $hForm, $hTab, $tMARGINS, $hDll, $pDll, $hProc
OnAutoItExitRegister('OnAutoItExit')
; Create GUI
$hForm = GUICreate('MyGUI', 400, 400)
GUICtrlCreateTab(0, 60, 402, 341, $WS_CLIPCHILDREN)
$hTab = GUICtrlGetHandle(-1)
GUICtrlCreateTabItem('Tab 1')
GUICtrlCreateButton('Button', 150, 167, 100, 26)
_WinAPI_SetParent(GUICtrlGetHandle(-1), $hTab)
GUICtrlCreateTabItem('Tab 2')
GUICtrlCreateEdit('', 14, 34, 372, 292)
_WinAPI_SetParent(GUICtrlGetHandle(-1), $hTab)
GUICtrlCreateTabItem('Tab 3')
GUICtrlCreateTabItem('')
GUISetBkColor(0)
; Register Tab window proc
$hDll = DllCallbackRegister('_WinProc', 'ptr', 'hwnd;uint;wparam;lparam')
$pDll = DllCallbackGetPtr($hDll)
$hProc = _WinAPI_SetWindowLongEx($hTab, $GWL_WNDPROC, $pDll)
; Create the "sheet of glass" effect for the Tab client area. You must call this function whenever DWM composition is toggled.
$tMARGINS = DllStructCreate($tagMARGINS)
DllStructSetData($tMARGINS, 1, 2)
DllStructSetData($tMARGINS, 2, 2)
DllStructSetData($tMARGINS, 3, 82)
DllStructSetData($tMARGINS, 4, 2)
_WinAPI_DwmExtendFrameIntoClientArea($hForm, $tMARGINS)
GUISetState()
Do
Until GUIGetMsg() = -3
Func _WinProc($hWnd, $iMsg, $wParam, $lParam)
If _WinAPI_IsThemeActive() Then
Switch $iMsg
Case $WM_ERASEBKGND
Local $tRECT, $hBrush, $hRgn, $hPrev
$hPrev = _WinAPI_GetClipRgn($wParam)
$hRgn = _CreateClipRgn($hWnd)
_WinAPI_ExtSelectClipRgn($wParam, $hRgn, $RGN_DIFF)
$tRECT = _WinAPI_GetClientRect($hWnd)
$hBrush = _WinAPI_CreateSolidBrush(0)
_WinAPI_FillRect($wParam, DllStructGetPtr($tRECT), $hBrush)
_WinAPI_SelectClipRgn($wParam, $hPrev)
_WinAPI_DeleteObject($hBrush)
_WinAPI_DeleteObject($hRgn)
Return 1
Case $WM_PAINT
Local $tPAINTSTRUCT, $hDC, $hRgn
$hDC = _WinAPI_BeginPaint($hWnd, $tPAINTSTRUCT)
$hRgn = _CreateClipRgn($hWnd)
_WinAPI_ExtSelectClipRgn($hDC, $hRgn, $RGN_AND)
_WinAPI_CallWindowProc($hProc, $hWnd, $WM_PRINTCLIENT, $hDC, $PRF_CLIENT)
_WinAPI_DeleteObject($hRgn)
_WinAPI_EndPaint($hWnd, $tPAINTSTRUCT)
Return 0
EndSwitch
EndIf
Return _WinAPI_CallWindowProc($hProc, $hWnd, $iMsg, $wParam, $lParam)
EndFunc ;==>_WinProc
Func _CreateClipRgn($hWnd)
Local $tRECT, $hTmp, $hRgn, $Ht, $Count, $Sel
$Count = _GUICtrlTab_GetItemCount($hWnd)
$Sel = _GUICtrlTab_GetCurSel($hWnd)
$hRgn = _WinAPI_CreateNullRgn()
For $i = 0 To $Count - 1
$tRECT = _GUICtrlTab_GetItemRectEx($hWnd, $i)
If $i = $Sel Then
$hTmp = _WinAPI_CreateRectRgn(DllStructGetData($tRECT, 1) - 2, DllStructGetData($tRECT, 2) - 2, DllStructGetData($tRECT, 3) + 2, DllStructGetData($tRECT, 4))
$Ht = DllStructGetData($tRECT, 4) - DllStructGetData($tRECT, 2) + 2
Else
If $i = $Count - 1 Then
$hTmp = _WinAPI_CreateRectRgn(DllStructGetData($tRECT, 1), DllStructGetData($tRECT, 2), DllStructGetData($tRECT, 3) - 2, DllStructGetData($tRECT, 4))
Else
$hTmp = _WinAPI_CreateRectRgn(DllStructGetData($tRECT, 1), DllStructGetData($tRECT, 2), DllStructGetData($tRECT, 3), DllStructGetData($tRECT, 4))
EndIf
EndIf
_WinAPI_CombineRgn($hRgn, $hRgn, $hTmp, $RGN_OR)
_WinAPI_DeleteObject($hTmp)
Next
$tRECT = _WinAPI_GetClientRect($hWnd)
$hTmp = _WinAPI_CreateRectRgn(DllStructGetData($tRECT, 1), DllStructGetData($tRECT, 2) + $Ht, DllStructGetData($tRECT, 3) - 2, DllStructGetData($tRECT, 4) - 1)
_WinAPI_CombineRgn($hRgn, $hRgn, $hTmp, $RGN_OR)
_WinAPI_DeleteObject($hTmp)
Return $hRgn
EndFunc ;==>_CreateClipRgn
Func OnAutoItExit()
_WinAPI_SetWindowLongEx($hTab, $GWL_WNDPROC, $hProc)
DllCallbackFree($hDll)
EndFunc ;==>OnAutoItExit
本帖最后由 131738 于 2011-9-25 21:10 编辑
回复 4# netegg
WinAPIEx 3.4函数,除添加 3.4 版本的库文件外,脚本添加:
#Include <APIConstants.au3>
看来 帅版3.3.7.15.1 还没有添加新库文件,估计帅是不会再看这里了 回复 5# 131738
那个常量库我知道,我给放到apiex里了,所以只有一个文件了:) 回复 6# netegg
3.4 有 3 个库文件,丢了再去下。。。 回复 7# 131738
三个?一个主函数,一个常量,还一个error,,我给合并成一个了 回复 9# thesnow
3.3.7.15.1 有些函数示例的包含文件名没改。。。。 一群高人讨论的高深的东东把我搞得云里雾里,4楼代码编译出错了
页:
[1]