Advertisement
Firex

AutoIt imWindow UDF

Dec 6th, 2014
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 14.17 KB | None | 0 0
  1. #Include <GDIPlus.au3>
  2. #Include <WinAPIEx.au3>
  3. #Include <APIConstants.au3>
  4.  
  5. _GDIPlus_Startup()
  6. ; ---
  7. Global $Kernel32Dll = DllOpen( "kernel32.dll" )
  8. Global Const $tagCWPSTRUCT = "lparam lParam;wparam wParam;uint iMsg;hwnd hWnd"
  9.  
  10. Global Enum $im_hWnd, $im_tClassEx, $im_hModule, $im_cbProc, $im_IsDwm, $im_hParent, _
  11.     $im_sName, $im_sClass, $im_iStyle, $im_iExStyle, $im_iDefColor, _
  12.     $im_fInit, $im_iMsg, $im_iMsgExt, $im_aCtrl, _
  13.     $im_hGraph, $im_hFont, $im_hBrush, $im_hCursor, $imUB
  14. ; *
  15. Global $__im_cbHook = DllCallbackRegister( '__imWnd_Hook', 'lresult', 'int;wparam;lparam' ), _
  16.     $__im_cbCtrlProc = DllCallbackRegister( '__imCtrl_Proc', 'lresult', 'hwnd;uint;wparam;lparam' ), _
  17.     $__im_hHook = _WinAPI_SetWindowsHookEx( $WH_CALLWNDPROC, DllCallbackGetPtr( $__im_cbHook ), 0, _WinAPI_GetCurrentThreadId() )
  18.  
  19. Global Const $__imWnd[$imUB] = [ 0 ]
  20. Global $Wnd = _imWnd_Init() ;Default imWindow|+INTERNAL_WNDPROC
  21.  
  22. #Region imWnd.Public
  23. Func _imWnd_Init()
  24.     Return $__imWnd
  25. EndFunc
  26.  
  27. Func _imWnd_Create( ByRef $Wnd, $iW = 0, $iH = 0, $iX = -1, $iY = -1 )
  28.     If Not __imWnd_DefParams( $Wnd ) Then _
  29.         Return
  30.  
  31.     If $iW < 1 Or $iH < 1 Then
  32.         $iW = 150
  33.         $iH = 150
  34.     EndIf
  35.     If $iX = -1 Or $iY = -1 Then
  36.         $iX = ( @DesktopWidth / 2 ) - ( $iW / 2 )
  37.         $iY = ( @DesktopHeight/ 2 ) - ( $iH / 2 )
  38.     EndIf
  39.     ; ---
  40.     Local $tClass = DllStructCreate( 'wchar[' & StringLen( $Wnd[$im_sClass] ) + 1 & ']' )
  41.         DllStructSetData( $tClass, 1, $Wnd[$im_sClass] )
  42.  
  43.     $Wnd[$im_cbProc] = DllCallbackRegister( $Wnd[$im_cbProc], 'lresult', 'hwnd;uint;wparam;lparam' )
  44.     $Wnd[$im_tClassEx] = DllStructCreate( $tagWNDCLASSEX )
  45.     With $Wnd[$im_tClassEx]
  46.         .Size = DllStructGetSize( $Wnd[$im_tClassEx] )
  47.         .Style = 0
  48.         .hWndProc = DllCallbackGetPtr( $Wnd[$im_cbProc])
  49.         .ClsExtra = 0
  50.         .WndExtra = 0
  51.         .hInstance = $Wnd[$im_hModule]
  52.         .hIcon = 0
  53.         .hCursor = $Wnd[$im_hCursor]
  54.         .hBackground = $Wnd[$im_hBrush]
  55.         .MenuName = 0
  56.         .ClassName = DllStructGetPtr( $tClass )
  57.         .hIconSm = 0
  58.     EndWith
  59.     _WinAPI_RegisterClassEx( $Wnd[$im_tClassEx] )
  60.     ; ---
  61.     Local $hWnd = DllCall( 'user32.dll', 'hwnd', 'CreateWindowExW', _
  62.         'dword', $Wnd[$im_iExStyle], _ ;Extended style
  63.         'wstr', $Wnd[$im_sClass], _ ;Window class
  64.         'str', $Wnd[$im_sName], _ ;Window name
  65.         'dword', $Wnd[$im_iStyle], _ ;Window style
  66.         'int', $iX, 'int', $iY, _ ;Window pos
  67.         'int', $iW, 'int', $iH, _ ;Window size
  68.         'hwnd', $Wnd[$im_hParent], _ ;Parent window
  69.         'hwnd', 0, _ ;Window menu
  70.         'hwnd', $Wnd[$im_hModule], 'ptr', 0 )
  71.     If Not @Error And $hWnd[0] Then
  72.         Local $aCtrl[99][4] = [[0]]
  73.         ; -
  74.         $Wnd[$im_hWnd] = $hWnd[0]
  75.         $Wnd[$im_aCtrl] = $aCtrl
  76.         ; -
  77.         $Wnd[$im_hGraph] = _GDIPlus_GraphicsCreateFromHWND( $hWnd[0] )
  78.         ;If _WinAPI_DwmIsCompositionEnabled() Then
  79.             $Wnd[$im_IsDwm] = False
  80.             ;_WinAPI_DwmExtendFrameIntoClientArea( $hWnd[0] )
  81.         ;EndIf
  82.         ; -
  83.         _imWnd_SetState( $Wnd, @SW_HIDE )
  84.         Return True
  85.     EndIf
  86.     Return SetError( @Error, 0, False )
  87. EndFunc
  88.  
  89. Func _imWnd_MsgBox( $iFlags, $sTitle, $sText, $hInstance, $hParent = 0 )
  90.     Local $aRet, $tMBP = DllStructCreate($tagMSGBOXPARAMS), _
  91.         $tTitle = DllStructCreate('wchar[' & (StringLen($sTitle) + 1) & ']')
  92.         $tText = DllStructCreate('wchar[' & (StringLen($sText) + 1) & ']')
  93.     ; ---
  94.     DllStructSetData($tTitle, 1, $sTitle)
  95.     DllStructSetData($tText, 1, $sText)
  96.     $tMBP.Size = DllStructGetSize($tMBP)
  97.     $tMBP.hOwner = $hParent
  98.     $tMBP.hInstance = $hInstance
  99.     $tMBP.Text = DllStructGetPtr($tText)
  100.     $tMBP.Caption = DllStructGetPtr($tTitle)
  101.     $tMBP.Style = BitAND($iFlags, 0xFFFFBFF8)
  102.     $tMBP.Icon = 0
  103.     $tMBP.ContextHelpId = 0
  104.     $tMBP.MsgBoxCallback = 0
  105.     $tMBP.LanguageId = 0
  106.  
  107.     $aRet = DllCall( $Kernel32Dll, 'ptr', 'GetModuleHandleW', 'wstr', 'user32.dll' )
  108.     If Not @Error And $aRet[0] Then
  109.         $aRet = DllCall( $Kernel32Dll, 'ptr', 'GetProcAddress', 'ptr', $aRet[0], 'str', 'MessageBoxIndirectW' )
  110.         If Not @Error And $aRet[0] Then _
  111.             $aRet = DllCall( $Kernel32Dll, 'ptr', 'CreateThread', 'ptr', 0, 'dword_ptr', 0, 'ptr', $aRet[0], 'ptr', DllStructGetPtr($tMBP), 'dword', 0, 'dword*', 0 )
  112.     EndIf
  113.     Return Sleep( 10 )
  114. EndFunc
  115.  
  116. Func _imWnd_Destroy( ByRef $Wnd, $fFree = True )
  117.     Local $Id, $aCtrl = $Wnd[$im_aCtrl]
  118.     ; -
  119.     For $Id = 1 To $aCtrl[0][0] Step 1
  120.         _imCtrl_Destroy( $Wnd, $Id )
  121.     Next
  122.     __imWnd_Proc( $Wnd[$im_hWnd], $WM_CLOSE, 1, 1, $Wnd )
  123.     ; -
  124.     _WinAPI_DestroyCursor( $Wnd[$im_hCursor] )
  125.     _WinAPI_DeleteObject( $Wnd[$im_hBrush] )
  126.     _GDIPlus_GraphicsDispose( $Wnd[$im_hGraph] )
  127.     ; -
  128.     _WinAPI_UnregisterClass( $Wnd[$im_sClass], $Wnd[$im_hModule] )
  129.     DllCallbackFree( $Wnd[$im_cbProc] )
  130.     If $fFree Then _
  131.         $Wnd = 0
  132. EndFunc
  133.  
  134. Func _imWnd_SetState( ByRef $Wnd, $iState = @SW_SHOW )
  135.     Local $iRet = _WinAPI_ShowWindow( $Wnd[$im_hWnd], $iState )
  136.     ; ---
  137.     If $iState = @SW_SHOW Then _
  138.         _imWnd_DefProc( $Wnd, $WM_PAINT, 0, 0 )
  139.  
  140.     Return $iRet
  141. EndFunc
  142.  
  143. Func _imWnd_AddMsg( ByRef $Wnd, $iMsgId, $iMsgExt = 0 )
  144.     If Not $Wnd[$im_iMsg] And Not $Wnd[$im_iMsgExt] Then
  145.         $Wnd[$im_iMsg] = $iMsgId
  146.         $Wnd[$im_iMsgExt] = $iMsgExt
  147.     EndIf
  148. EndFunc
  149.  
  150. Func _imWnd_FreeMsg( ByRef $Wnd )
  151.     $Wnd[$im_iMsg] = 0
  152.     $Wnd[$im_iMsgExt] = 0
  153. EndFunc
  154.  
  155. Func _imWnd_DefProc( ByRef $Wnd, $iMsg, $wParam, $lParam )
  156.     Return __imWnd_Proc( $Wnd[$im_hWnd], $iMsg, $wParam, $lParam, $Wnd )
  157. EndFunc ;Feature is experimental, possible unexpected errors/crashes.
  158. #EndRegion imWnd.Public
  159.  
  160.  
  161. #Region imWnd.CtrlPublic
  162. Func _imCtrlEdit_Create( ByRef $Wnd, $iColor, $sText, $iX, $iY, $iW, $iH, $iStyle = 0x003010C4, $iExStyle = 0x00000200 )
  163.     Return _imCtrl_CreateEx( $Wnd, "Edit", 0, $iColor, $sText, $iX, $iY, $iW, $iH, $iStyle, $iExStyle )
  164. EndFunc
  165.  
  166. Func _imCtrlButton_Create( ByRef $Wnd, $iId, $sText, $iX, $iY, $iW, $iH, $iStyle = 0, $iExStyle = 0 )
  167.     Return _imCtrl_CreateEx( $Wnd, "Button", 0, $iId, $sText, $iX, $iY, $iW, $iH, $iStyle, $iExStyle )
  168. EndFunc
  169.  
  170. Func _imCtrlLabel_Create( ByRef $Wnd, $iColor, $sText, $iX, $iY, $iW, $iH, $iStyle = 0x00020000, $iExStyle = 0 )
  171.     Return _imCtrl_CreateEx( $Wnd, "Static", "Label", $iColor, $sText, $iX, $iY, $iW, $iH, $iStyle, $iExStyle )
  172. EndFunc
  173.  
  174. Func _imCtrlListbox_Create( ByRef $Wnd, $iX, $iY, $iW, $iH, $iStyle = 0x20000000, $iExStyle = 0x00000200 )
  175.     $iStyle = BitOr( $iStyle, $LBS_NOTIFY )
  176.     ; ---
  177.     Return _imCtrl_CreateEx( $Wnd, "ListBox", 0, 0, '', $iX, $iY, $iW, $iH, $iStyle, $iExStyle )
  178. EndFunc
  179.  
  180. Func _imCtrlPic_Create( ByRef $Wnd, ByRef $hImg, $iX, $iY, $iW = 0, $iH = 0, $iStyle = 0x0002000E, $iExStyle = 0 )
  181.     Local $hWnd, _
  182.         $iImgW = _GDIPlus_ImageGetWidth( $hImg ), _
  183.         $iImgH = _GDIPlus_ImageGetHeight( $hImg )
  184.     ; -
  185.     If $iW And $iH Then
  186.         If $iImgW <> $iW Or $iImgH <> $iH Then
  187.             Local $hTmp = $hImg
  188.             ; -
  189.             $hImg = _GDIPlus_ImageResize( $hImg, $iW, $iH )
  190.             _GDIPlus_ImageDispose( $hTmp )
  191.         EndIf
  192.     Else
  193.         $iW = $iImgW
  194.         $iH = $iImgH
  195.     EndIf
  196.     $hWnd = _imCtrl_CreateEx( $Wnd, "Static", "Pic", $hImg, '', $iX, $iY, $iW, $iH, $iStyle, $iExStyle )
  197.     _imCtrl_SetBitmap( $hWnd, $hImg )
  198.     ; -
  199.     Return $hWnd
  200. EndFunc
  201.  
  202. Func _imCtrl_CreateEx( ByRef $Wnd, $sWndClass, $sImClass, $iExtOpt, $sText, $iX, $iY, $iW, $iH, $iStyle, $iExStyle )
  203.     Local $hWnd, $aCtrl = $Wnd[$im_aCtrl], _
  204.         $iCtrlID = Random( 10000, 19999, 1 ), _
  205.         $iImId = $aCtrl[0][0] + 1
  206.     ; *
  207.     $iStyle = BitOr( 0x40000000, 0x10000000, $iStyle )
  208.     If Not $sImClass Then _
  209.         $sImClass = $sWndClass
  210.     ; ---
  211.     $hWnd = _WinAPI_CreateWindowEx( $iExStyle, $sWndClass, "", $iStyle, $iX, $iY, $iW, $iH, $Wnd[$im_hWnd], $iCtrlID, $Wnd[$im_hModule] )
  212.     $aCtrl[0][0] = $iImId
  213.     $aCtrl[$iImId][0] = $hWnd
  214.     $aCtrl[$iImId][1] = $sImClass
  215.     $aCtrl[$iImId][2] = $iExtOpt
  216.     $aCtrl[$iImId][3] = 0
  217.     $Wnd[$im_aCtrl] = $aCtrl
  218.     ; *
  219.     _imCtrl_SetFont( $hWnd, $Wnd[$im_hFont] )
  220.     If $sText Then _
  221.         _imCtrl_SetText( $hWnd, $sText )
  222.     If Not $Wnd[$im_IsDwm] Then _
  223.         DllCall( "UxTheme.dll", "int", "SetWindowTheme", "hwnd", $hWnd, "wstr", 0, "wstr", 0 )
  224.     ; ---
  225.     Return $hWnd
  226. EndFunc
  227.  
  228. Func _imCtrl_Destroy( ByRef $Wnd, $iId = 0, $hWnd = 0 )
  229.     Local $aCtrl = $Wnd[$im_aCtrl]
  230.     ; ---
  231.     For $Id = 1 To $aCtrl[0][0] Step 1
  232.         If $Id = $iId Or $hWnd = $aCtrl[$Id][0] Then
  233.             Switch $aCtrl[$Id][1]
  234.                 Case "Pic"
  235.                     _imCtrl_SetBitmap( $aCtrl[$Id][0], 0 )
  236.                     _GDIPlus_ImageDispose( $aCtrl[$Id][2] )
  237.             EndSwitch
  238.             _WinAPI_DestroyWindow( $aCtrl[$Id][0] )
  239.             $aCtrl[$Id][0] = 0
  240.             $aCtrl[$Id][1] = 0
  241.             $aCtrl[$Id][2] = 0
  242.             $aCtrl[$Id][3] = 0
  243.             ; -
  244.             $Wnd[$im_aCtrl] = $aCtrl
  245.             Return True
  246.         EndIf
  247.     Next
  248.     Return False
  249. EndFunc
  250.  
  251. Func _imCtrl_FindMe( ByRef $aCtrl, $hWnd, $iRet = 0 )
  252.     Local $Id
  253.     ; ---
  254.     For $Id = 1 To $aCtrl[0][0] Step 1
  255.         If $aCtrl[$Id][0] = $hWnd Then
  256.             Switch $iRet
  257.                 Case -1
  258.                     Local $aRet[4] = [ _
  259.                         $aCtrl[$Id][0], _
  260.                         $aCtrl[$Id][1], _
  261.                         $aCtrl[$Id][2], _
  262.                         $aCtrl[$Id][3] ]
  263.                     Return $aRet
  264.                 Case 1 To 3
  265.                     Return $aCtrl[$Id][$iRet]
  266.                 Case Else ;
  267.                     Return $Id
  268.             EndSwitch
  269.         EndIf
  270.     Next
  271.     Return 0
  272. EndFunc
  273.  
  274. ; ## CONTROL_MACROSES
  275. Func _imCtrl_SetFont( $hWnd, $hFont )
  276.     _SendMessage( $hWnd, $WM_SETFONT, $hFont, True )
  277. EndFunc
  278.  
  279. Func _imCtrl_SetText( $hWnd, $sText )
  280.     _SendMessage( $hWnd, $WM_SETTEXT, 0, $sText, 0, "wparam", "wstr")
  281. EndFunc
  282.  
  283. Func _imCtrl_SetBitmap( $hWnd, $hImg, $fCleanup = True )
  284.     Local $hBitmap, $hRet
  285.     ; ---
  286.     If $hImg Then _
  287.         $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap( $hImg )
  288.  
  289.     $hRet = _SendMessage( $hWnd, 0x172, 0, $hBitmap )
  290.     If $fCleanup Then _
  291.         _WinAPI_DeleteObject( $hRet )
  292. EndFunc
  293.  
  294. Func _imCtrl_GetText( $hWnd )
  295.     Local $iLength = _SendMessage( $hWnd, $WM_GETTEXTLENGTH ) + 1, _
  296.         $tText = DllStructCreate("wchar Text[" & $iLength & "]")
  297.     ; ---
  298.     _SendMessage($hWnd, $WM_GETTEXT, $iLength, $tText, 0, "wparam", "struct*")
  299.     Return DllStructGetData( $tText, 'Text' )
  300. EndFunc
  301.  
  302. Func _imEdit_Appbegin($hWnd, $sText, $fEndRn = True )
  303.     If $fEndRn Then $sText &= @CRLF
  304.     ; ---
  305.     _SendMessage( $hWnd, $EM_SETSEL, 0, 0 )
  306.     _SendMessage( $hWnd, $EM_REPLACESEL, True, $sText, 0, "wparam", "wstr" )
  307. EndFunc
  308.  
  309. Func _imEdit_Append($hWnd, $sText, $fEndRn = True )
  310.     Local $iLength = _SendMessage( $hWnd, $WM_GETTEXTLENGTH )
  311.     If $fEndRn Then $sText &= @CRLF
  312.     ; ---
  313.     _SendMessage( $hWnd, $EM_SETSEL, $iLength, $iLength )
  314.     _SendMessage( $hWnd, $EM_REPLACESEL, True, $sText, 0, "wparam", "wstr" )
  315. EndFunc   ;==>_GUICtrlEdit_AppendText
  316.  
  317. Func _imListBox_AddString($hWnd, $sText)
  318.     Return _SendMessage($hWnd, $LB_ADDSTRING, 0, $sText, 0, "wparam", "wstr")
  319. EndFunc   ;==>_GUICtrlListBox_AddString
  320.  
  321. Func _imListBox_BeginUpdate($hWnd)
  322.     Return _SendMessage($hWnd, 0x000B ) = 0
  323. EndFunc   ;==>_GUICtrlListBox_BeginUpdate
  324.  
  325. Func _imListBox_EndUpdate($hWnd)
  326.     Return _SendMessage($hWnd, 0x000B, 1, 0) = 0
  327. EndFunc   ;==>_GUICtrlListBox_EndUpdate
  328.  
  329. Func _imListBox_GetCurSel($hWnd)
  330.     Return _SendMessage($hWnd, $LB_GETCURSEL)
  331. EndFunc   ;==>_GUICtrlListBox_GetCurSel
  332.  
  333. ; ## CONTROL_INTERNAL MACROSES
  334. Func _imCtrl_SetColor( ByRef $Wnd, $hWnd, $iColor )
  335.     Local $aCtrl = $Wnd[$im_aCtrl], _
  336.         $Id = _imCtrl_FindMe( $aCtrl, $hWnd )
  337.     ; -
  338.     If $Id Then
  339.         $aCtrl[$Id][2] = $iColor
  340.         $Wnd[$im_aCtrl] = $aCtrl
  341.         ; -
  342.         _WinAPI_RedrawWindow($hWnd)
  343.     EndIf
  344. EndFunc
  345. #EndRegion imWnd.CtrlPublic
  346.  
  347.  
  348. #Region imWnd.Callbacks
  349. Func __imWnd_Proc($hWnd, $iMsg, $wParam, $lParam, $Wnd)
  350.     If $Wnd[$im_fInit] Then
  351.         Switch $iMsg
  352.             Case $WM_PAINT
  353.                 ; Custom draw
  354.  
  355.             Case $WM_CLOSE
  356.                 If Not $wParam Or Not $lParam Then
  357.                     _imWnd_AddMsg( $Wnd, -3 )
  358.                     Return
  359.                 Else
  360.                     $wParam = 0
  361.                     $lParam = 0
  362.                 EndIf
  363.             Case $WM_COMMAND
  364.                 Switch BitShift( $wParam, 16 )
  365.                     Case 0 ;BN_CLICKED
  366.                         Local $aInfo = _imCtrl_FindMe( $Wnd[$im_aCtrl], $lParam, -1 )
  367.                         If IsArray( $aInfo ) Then
  368.                             Switch $aInfo[1]
  369.                                 Case "Button"
  370.                                     _imWnd_AddMsg( $Wnd, $aInfo[2] )
  371.                             EndSwitch
  372.                         EndIf
  373.                 EndSwitch
  374.             Case $WM_CTLCOLORSTATIC, $WM_CTLCOLORBTN, $WM_CTLCOLOREDIT ;$WM_CTLCOLORLISTBOX
  375.                 Local $aInfo = _imCtrl_FindMe( $Wnd[$im_aCtrl], $lParam, -1 )
  376.                 Switch $aInfo[1]
  377.                     Case "Label", "Edit"
  378.                         _WinAPI_SetTextColor( $wParam, $aInfo[2] )
  379.                         _WinAPI_SetBkColor( $wParam, $Wnd[$im_iDefColor] )
  380.                         ContinueCase
  381.                     Case "Pic", "Button" ;"ListBox"
  382.                         Return _WinAPI_CreateSolidBrush( $Wnd[$im_iDefColor] )
  383.                 EndSwitch
  384.         EndSwitch
  385.     EndIf
  386.     Return _WinAPI_DefWindowProc($hWnd, $iMsg, $wParam, $lParam)
  387. EndFunc
  388.  
  389. Func __imCtrl_Proc($hWnd, $iMsg, $wParam, $lParam, $Wnd)
  390.     Local $vProcRet
  391.     ; ---
  392.     If $Wnd[$im_fInit] Then
  393.         Local $aCtrl = $Wnd[$im_aCtrl], _
  394.             $Id = _imCtrl_FindMe( $aCtrl, $hWnd )
  395.         ; -
  396.         If $Id Then
  397.  
  398.  
  399.             ; -
  400.             _WinAPI_SetWindowLong( $hWnd, $GWL_WNDPROC, $aCtrl[$Id][3] )
  401.             $aCtrl[$Id][3] = 0
  402.             $Wnd[$im_aCtrl] = $aCtrl
  403.         EndIf
  404.     EndIf
  405.     Return $vProcRet
  406. EndFunc ;imCtrl_INTERNAL_PROC
  407.  
  408. Func __imWnd_Hook( $iCode, $wParam, $lParam )
  409.     If $Wnd[$im_fInit] Then
  410.         Local $tCWPS = DllStructCreate( $tagCWPSTRUCT, $lParam ), _
  411.             $hWnd = DllStructGetData( $tCWPS, 'hWnd' ), _
  412.             $aCtrl = $Wnd[$im_aCtrl], $fCatch, _
  413.             $Id = _imCtrl_FindMe( $aCtrl, $hWnd )
  414.         ; -
  415.         If $Id Then
  416.             Switch $aCtrl[$Id][1]
  417.                 Case "Edit" ;Example: blocking messages
  418.                     Switch DllStructGetData( $tCWPS, 'iMsg' )
  419.                         Case $WM_CONTEXTMENU
  420.                             $fCatch = True
  421.                     EndSwitch
  422.             EndSwitch
  423.             If $fCatch Then
  424.                 If Not $aCtrl[$Id][3] Then
  425.                     $aCtrl[$Id][3] = _WinAPI_SetWindowLong( $hWnd, $GWL_WNDPROC, DllCallbackGetPtr( $__im_cbCtrlProc ) )
  426.                 EndIf
  427.                 $Wnd[$im_aCtrl] = $aCtrl
  428.             EndIf
  429.         EndIf
  430.     EndIf
  431.     Return _WinAPI_CallNextHookEx( $__im_hHook, $iCode, $wParam, $lParam )
  432. EndFunc
  433. #EndRegion imWnd.Callbacks
  434.  
  435.  
  436. #Region imWnd.Internal
  437. Func __imWnd_DefParams( ByRef $Wnd )
  438.     If UBound( $Wnd ) <> $imUB Then _
  439.         Return False
  440.     ; ---
  441.     For $imId = 1 To $imUB - 1
  442.         If Not $Wnd[$imId] Then
  443.             Switch $imId
  444.                 Case $im_cbProc
  445.                     $Wnd[$imId] = '__imWnd_Proc'
  446.                 ; -
  447.                 Case $im_sName
  448.                     $Wnd[$imId] = "imWindow"
  449.                 Case $im_sClass
  450.                     $Wnd[$imId] = "imClass"
  451.                 Case $im_iStyle
  452.                     $Wnd[$imId] = 0x96CB00CC ;0x96CB00CC
  453.                 Case $im_iExStyle
  454.                     $Wnd[$imId] = 0x00050181
  455.                 Case $im_iDefColor
  456.                     $Wnd[$imId] = 0xFFFFFF
  457.                 ; -
  458.                 Case $im_hModule
  459.                     $Wnd[$imId] = _WinAPI_GetModuleHandle( 0 )
  460.                 Case $im_hFont
  461.                     $Wnd[$imId] = _WinAPI_GetStockObject( 17 )
  462.                 Case $im_hBrush
  463.                     $Wnd[$imId] = _WinAPI_CreateSolidBrush( $Wnd[$im_iDefColor] )
  464.                 Case $im_hCursor
  465.                     $Wnd[$imId] = _WinAPI_LoadCursor( 0, 32512 )
  466.             EndSwitch
  467.         EndIf
  468.     Next
  469.     ; ---
  470.     Return True
  471. EndFunc
  472. #EndRegion imWnd.Internal
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement