Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/21/2013 in all areas

  1. see my greatness :sweating: #include <WinAPI.au3> #include <WinAPIeX.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GuiImageList.au3> #include <GuiButton.au3> Local $upperBody = 0, $e = 0 $a = SubFunction__CpeateBalloonToolTipEX("dsgafhgadfhzdhzhdcxcxcxc", @DesktopWidth/2-55,@DesktopHeight/2, $upperBody) $b = SubFunction__CpeateBalloonToolTipEX("dsgafhgadfhzdhzhdcxcxcxc", @DesktopWidth/2,@DesktopHeight/2+55, $upperBody) While $e < 2 $nMsg = GUIGetMsg() Switch $nMsg Case $a[3];$GUI_EVENT_CLOSE $e += GUIDelete ( $a[0] ) Case $b[3];$GUI_EVENT_CLOSE $e += GUIDelete ( $b[0] ) EndSwitch WEnd Func SubFunction__CpeateBalloonToolTipEX($text, $pointX,$pointY, ByRef $upperBody) Local $R, $Rn2, $thick, $beakLenX, $beakLenY, $textOffset, $ToolTipDeltaY, $ToolTipButtonH, $ToolTipButtonW, $textStringHeightMax Local $ToolTipX, $ToolTipY, $ToolTipWidth, $ToolTipHeight, $ToolTipButtonY, $ToolTipLastButtonX, $ToolTipWidthRAW, $ToolTipHeightRAW, $ToolTipXRAW, $ToolTipYRAW Local $tip, $Btn_Func, $Btn_EditPattern, $Btn_Close, $hDC, $hBrush, $rgn1, $rgn2, $ctrl_pos, $ctrl_rgn, $ctrlAttay, $testGUI, $testLabel, $LabelSize, $aPoint[3][2] $R = 16 $Rn2 = $R*2 $thick = 24 $beakLenX = 33 $beakLenY = 33 $textOffset = 8 $ToolTipDeltaY = 0 $ToolTipButtonH = 24 $ToolTipButtonW = 24 $testGUI = GUICreate("",16,16,0,0) $testLabel = GUICtrlCreateLabel("",0,0) Local $LabelSize[2] = [ 333, 33];_GetTabbedStringSizeEx($testLabel, $text) GUIDelete ( $testGUI ) $textStringHeightMax = $LabelSize[1]+8 $ToolTipX = 0 If $pointY < $upperBody Then $ToolTipY = $upperBody - $pointY + $ToolTipDeltaY + $ToolTipButtonH/2 + 2 Else $ToolTipY = $beakLenY + $ToolTipButtonH/2 + 2 EndIf $ToolTipWidth = $LabelSize[0] + $R*2 + $textOffset*2 $ToolTipHeight = $ToolTipY + $textStringHeightMax + 16 $ToolTipButtonY = $ToolTipY - $ToolTipButtonH/2 $ToolTipLastButtonX = $ToolTipWidth - $R - $ToolTipButtonW $ToolTipWidthRAW = $ToolTipWidth + $beakLenX $ToolTipHeightRAW = $ToolTipHeight $ToolTipXRAW = $pointX - $ToolTipWidthRAW If $ToolTipXRAW+$R < 0 Then $ToolTipXRAW = -$R $ToolTipYRAW = $pointY $upperBody = $ToolTipYRAW + $ToolTipDeltaY + $ToolTipHeight If ($ToolTipHeight - $R) < $thick Then $thick = $ToolTipHeight - $R EndIf #Region ### START Koda GUI section ### Form= $tip = GUICreate("Tip", $ToolTipWidthRAW, $ToolTipHeightRAW, $ToolTipXRAW, $ToolTipYRAW, BitOR($WS_POPUP,$DS_MODALFRAME,$DS_SETFOREGROUND),$WS_EX_TOPMOST) WinSetTrans($tip, "", 255) $Btn_Func = GUICtrlCreateButton("", $ToolTipLastButtonX-64, $ToolTipButtonY, $ToolTipButtonW, $ToolTipButtonH) SubFunction__GUICtrlSetImage($Btn_Func, "shell32.dll", 55*4-3, 0) $Btn_EditPattern = GUICtrlCreateButton("", $ToolTipLastButtonX-32, $ToolTipButtonY, $ToolTipButtonW, $ToolTipButtonH) SubFunction__GUICtrlSetImage($Btn_EditPattern, "shell32.dll", 42*4-3, 0) $Btn_Close = GUICtrlCreateButton("", $ToolTipLastButtonX, $ToolTipButtonY, $ToolTipButtonW, $ToolTipButtonH) SubFunction__GUICtrlSetImage($Btn_Close, "shell32.dll", 28*4-3, 0) GUICtrlCreateLabel("", $R+3, $ToolTipY + $ToolTipButtonH/2, $ToolTipWidth - $R - $R - 3, $textStringHeightMax, $SS_ETCHEDFRAME ) GUICtrlCreateLabel($text, $R+8+2, $ToolTipY + $ToolTipButtonH/2+2, $ToolTipWidth - $R - $R - 8-5, $textStringHeightMax-5 ) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $hDC = _WinAPI_GetWindowDC($tip) $hBrush = _WinAPI_CreateSolidBrush(_WinAPI_GetSysColor($COLOR_ACTIVEBORDER)) Dim $aPoint[3][2] = [[$ToolTipWidth-$R, $ToolTipY],[$pointX-$ToolTipXRAW, 0],[$ToolTipWidth-$R/2, $ToolTipY+$thick]] $rgn1 = _WinAPI_CreatePolygonRgn($aPoint) $rgn2 = _WinAPI_CreateRoundRectRgn($ToolTipX, $ToolTipY, $ToolTipWidth, $ToolTipHeight, $Rn2, $Rn2) _WinAPI_CombineRgn($rgn1, $rgn1, $rgn2, $RGN_OR) _WinAPI_DeleteObject($rgn2) $ctrl_pos = ControlGetPos($tip, "", $Btn_Func) $ctrl_rgn = _WinAPI_CreateRectRgn($ctrl_pos[0], $ctrl_pos[1], $ctrl_pos[0] + $ctrl_pos[2], $ctrl_pos[1] + $ctrl_pos[3]) _WinAPI_CombineRgn($rgn1, $rgn1, $ctrl_rgn, $RGN_OR) $ctrl_pos = ControlGetPos($tip, "", $Btn_EditPattern) $ctrl_rgn = _WinAPI_CreateRectRgn($ctrl_pos[0], $ctrl_pos[1], $ctrl_pos[0] + $ctrl_pos[2], $ctrl_pos[1] + $ctrl_pos[3]) _WinAPI_CombineRgn($rgn1, $rgn1, $ctrl_rgn, $RGN_OR) $ctrl_pos = ControlGetPos($tip, "", $Btn_Close) $ctrl_rgn = _WinAPI_CreateRectRgn($ctrl_pos[0], $ctrl_pos[1], $ctrl_pos[0] + $ctrl_pos[2], $ctrl_pos[1] + $ctrl_pos[3]) _WinAPI_CombineRgn($rgn1, $rgn1, $ctrl_rgn, $RGN_OR) _WinAPI_FrameRgn ( $hDC, $rgn1, $hBrush, 1, 1 ) _WinAPI_SetWindowRgn($tip, $rgn1) _WinAPI_DeleteObject($hBrush) _WinAPI_ReleaseDC($tip, $hDC) Dim $ctrlAttay[4] = [$tip,$Btn_Func,$Btn_EditPattern,$Btn_Close] Return $ctrlAttay EndFunc Func SubFunction__GUICtrlSetImage($hButton, $sFileIco, $iIndIco = 0, $iSize = 0) Switch $iSize Case 0 $iSize = 16 Case 1 $iSize = 32 Case Else $iSize = 16 EndSwitch Local $hImage = _GUIImageList_Create($iSize, $iSize, 5, 3, 6) _GUIImageList_AddIcon($hImage, $sFileIco, $iIndIco) _GUICtrlButton_SetImageList($hButton, $hImage,4) Return $hImage EndFunc
    1 point
  2. Gawish, I would do something like this: HotKeySet("q", "myfunceq") HotKeySet("w", "myfuncew") HotKeySet("{F1}", "FSet") HotKeySet("{F2}", "FSet") $fF1 = True While 1 ; endless Loop Sleep(10) ; avoid high CPU usag WEnd Func myfunceq() ; Depending on the flag setting, run the appropriate code If $fF1 Then ConsoleWrite("funceq - F1" & @CRLF) ;Send("{F4 2}{2 2}{3 2}") ;Send("{F1 2}{1 2}") Else ConsoleWrite("funceq - F2" & @CRLF) ;Send("{F4 2}{2 2}{3 2}") ;Send("{F1 2}{1 2}") EndIf EndFunc ;==>myfunceq Func myfuncew() If $fF1 Then ConsoleWrite("funcew - F1" & @CRLF) ;Send("{F4 2}{2 2}{3 2}") ;Send("{F1 2}{2 2}") Else ConsoleWrite("funcew - F2" & @CRLF) ;Send("{F4 2}{2 2}{3 2}") ;Send("{F1 2}{2 2}") EndIf EndFunc ;==>myfuncew Func FSet() ; Set or clear the flag depending on the HotKey If @HotKeyPressed = "{F1}" Then $fF1 = True Else $fF1 = False EndIf EndFunc But you will have to change your HotKeys - you use F1 in the Send command so it will fire itself if you use it as a HotKey. M23
    1 point
  3. I think the OP wants the th & rd part raised up, just like you would using <sup> in HTML.
    1 point
  4. Thank you for correcting my vocabulary Now I correct my mistake
    1 point
  5. I said comment out ConsoleWrite, I didn't say comment out the whole error handler. Your error function should be: Func _ErrFunc() ; ConsoleWrite("! COM Error ! Number: 0x" & Hex($oCOMError.number, 8) & " ScriptLine: " & $oCOMError.scriptline & " - " & $oCOMError.windescription & @CRLF) EndFunc Do you understand now? The messages you get are there for purpose and so is COM error handler. ...This way your code is backward and forward compatible. If you aren't interested in backward compatibility and want even better forward compatibility then use beta AutoIt and remove COM error handler and AutoItObject dependency completely by switching to built-in ObjCreateInterface,
    1 point
×
×
  • Create New...