Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/18/2016 in all areas

  1. Jos

    Scite fold within Regions

    In case you or somenbody is interested in a LUA function for this: Add this code to file %localappdata%\AutoIt v3\SciTE\PersonalTools.lua: function PersonalTools:ToggleFoldLevel(x) if editor.Lexer == SCLEX_AU3 then -- clear output pane when debugging --~ output:ClearAll() fldonlev=tonumber(x) --~ print("### Fold toggle fold level ", fldonlev) local savlinlev1=-1 local fldinlev1=0 for a = 0, editor.LineCount-1, 1 do --~ print("--",a+1, editor.FoldLevel[a],editor.FoldParent[a],savlinlev1,fldinlev1) -- outside of a fold again if editor.FoldParent[a+1] < savlinlev1 then --~ print("End of fold block") savlinlev1=editor.FoldParent[a+1] fldinlev1=fldinlev1-1 elseif editor.FoldParent[a+1] > savlinlev1 then --~ print("Start of fold block") savlinlev1=editor.FoldParent[a+1] if fldonlev == fldinlev1 then --~ print("! Toggle fold for line ", a+1) editor:ToggleFold(a) end fldinlev1=fldinlev1+1 end end end end Add these lines to your Sciteuser.properties: the number behind the func is the level to toggle the fold for. #x lua test func command.name.41.$(au3)=ToggleFoldLevel command.mode.41.$(au3)=subsystem:lua,savebefore:no command.shortcut.41.$(au3)=Ctrl+Shift+F command.41.$(au3)=InvokeTool PersonalTools.ToggleFoldLevel 2 The shortcut Ctrl+Shift+f should now do a toggle fold for only the level 2 folds. Jos
    1 point
  2. Apart from that, you don't have to read the whole header and parse it using regexp. You can do this: $metaint = _WinHttpQueryHeaders($hHttpRequest, $WINHTTP_QUERY_CUSTOM, "icy-metaint") ...and this to read content type: _WinHttpQueryHeaders($hHttpRequest, $WINHTTP_QUERY_CONTENT_TYPE)
    1 point
  3. That server that you have issues with uses some earlier versions of the software, where the header is malformed and doesn't comply with HTTP protocol rules. WinHttp refuses to process it for security reasons. "ICY 200 OK" response is wrong here. Sorry.
    1 point
  4. rootx, Look at GUISetAccelerators in the Help file. M23
    1 point
  5. @Deye: Hello there. Not. This area of MCFinclude can itself only be encrypted with a static key, which means a determined attacker may be able to decrypt these lines (which precede your actual script content), so they can (in a worst-case scenario) figure out *how* you define your key (e.g., through a password query, obtaining a hardware ID, server response, etc). Note that the actual content is not (and cannot) be revealed, as only an "evil maid attack" on a machine running in the sanctioned environment could conceivably be vulnerable in that respect (so anyone copying your exe/script and running it elsewhere will never get useful data out). So if you're thinking of using a HWID, it would make more sense to use that as your key, and define the CCkey entry as a call to a function that directly retrieves that HWID from its runtime environment (or server interaction, or combination). Placing a decryption key raw in $CCkey (rather than using a function call or macro to generate at dynamically at runtime) defeats the purpose of runtime decryption. Sorry, can't help you there; I'm a total noob with regard to php (pretty-hopeless-parsing? parrots-helping-people? poignant-but-hapless-punctuation? panting-hush-puppies?)
    1 point
  6. Just took asking to spur me on to more searching. Thanks to a post from Firefox I figured out all I had to do was something like this: #include <GUIConstantsEx.au3> #include <ScreenCapture.au3> Example() Func Example() _GDIPlus_Startup() ;initialize GDI+ Local Const $iWidth = 600, $iHeight = 600 Local $hIA = _GDIPlus_ImageAttributesCreate() ;create an ImageAttribute object ; Local $tColorMatrix = _GDIPlus_ColorMatrixCreateNegative() ;create negative color matrix Local $tColorMatrix = _GDIPlus_ColorMatrixCreateGrayScale() ;create grayscale color matrix _GDIPlus_ImageAttributesSetColorMatrix($hIA, 0, True, $tColorMatrix) ;set negative color matrix Local $hHBmp = _ScreenCapture_Capture("", 0, 0, $iWidth, $iHeight) ;create a GDI bitmap by capturing an area on desktop Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBmp) ;convert GDI to GDI+ bitmap _WinAPI_DeleteObject($hHBmp) ;release GDI bitmap resource because not needed anymore Local $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hBitmap, 0, 0, $iWidth, $iHeight, 0, 0, $iWidth, $iHeight, $hIA) ;draw the bitmap while applying the color adjustment _GDIPlus_ImageSaveToFile($hBitmap, "test.jpg") ;cleanup GDI+ resources _GDIPlus_ImageAttributesDispose($hIA) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() EndFunc ;==>Example
    1 point
  7. llewxam

    CSV Viewer

    I could swear that I saw someone else had a CSV viewer script posted but no amount of searching found it. If someone knows of one that has been done before, please post a link to it. I write many scripts that save information to CSV files, but got tired of using Excel to view them because of having to resize the columns to view all of the information. Yes there are ways of resizing the columns, but I decided to write a viewer to make life a little easier. There are some configurable options, such as font used, font size, weight, and underlining, as well as optional automatic column width resizing thanks to Melba23's StringSize UDF, now built-in rather than having to download the UDF. Please be aware that when using the resize option it will take about twice as long to run the script. For a fairly sane file it is not at all a big deal, but feed it an 8MB file with 130 columns and 11,500 rows (about 1.5 million elements) and it takes quite a long time!! This script also takes a lot of RAM to run, the 8MB file I used above took over 200MB of RAM. I'd like to see other ideas, so please post 'em if you got 'em. Enjoy Ian EDIT: Updated code CSV Viewer.zip
    1 point
  8. One more thing Your timing is good... This example is more relevant to your questions regarding the Outlook multiline listview. To get two or more fonts per line (in this case normal and bold) DrawText is called twice per line. Draw the left most text, set the left rect element to the width of the leftmost text plus a few added pixels to indent, then draw the right most text. Text metrics measuring code is needed to replace the hard coded values used for setting left rect and top rect GetStringWidth code added for left rect The number of drawtext calls can be cut down by using multiline text with linefeeds, but then you can't set indentation and font colour/bold per line The example is optimized for speed with dll pseudo handles for dllcalls, stripped down/optimized listview functions and global resources (fonts/pens/brush) for re-use in the WM_DRAWITEM message handler Edit: added _GUICtrlListView_GetStringWidth Edit: corrected ODS_SELECTED multiple item selection, added optional themed/unthemed custom coloured select bar demonstration (try the listview states in Vista/Win7), closed theme handle, added themes parts and states usage example, added optional remove line separators when item selection themed, clarified a few things Edit: Added combo for Button or *Listview theme parts, Added resize of theme rect for Listview parts *Listview group header theme has a better gradient than button in Vista+ ;coded by rover 2k12 #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <FontConstants.au3> Opt("GUIDataSeparatorChar", "|") Global Const $ODA_SELECT = 0x2 Global Const $ODA_FOCUS = 0x4 Global Const $ODS_SELECTED = 0x0001 Global Const $ODT_LISTVIEW = 102 Global Const $ODA_DRAWENTIRE = 0x1 Global $iDllGDI = DllOpen("gdi32.dll") Global $iDllUSER32 = DllOpen("user32.dll") Global $iDllUxtheme = DllOpen("uxtheme.dll") ;global resources for WM_DRAWITEM - optimize speed Global $aFont[2] $aFont[0] = _WinAPI_CreateFont(16, 0, 0, 0, $FW_HEAVY, False, False, False, _ $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $PROOF_QUALITY, $DEFAULT_PITCH, 'Calibri') $aFont[1] = _WinAPI_CreateFont(16, 0, 0, 0, $FW_MEDIUM, False, False, False, _ $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $PROOF_QUALITY, $DEFAULT_PITCH, 'Calibri') Global $hPen1 = _WinAPI_CreatePen($PS_SOLID, 1, 0xF3EAE7) Global $hPen2 = _WinAPI_CreatePen($PS_SOLID, 1, 0xF4E8E6) Global $hBrush = _WinAPI_CreateSolidBrush(0xEEDDBB) ;Theme Parts and States ;http://msdn.microsoft.com/en-us/library/windows/desktop/bb773210%28v=vs.85%29.aspx ;Part - vsstyle.h Global Const $BP_PUSHBUTTON = 1 Global Const $LVP_GROUPHEADER = 6 ;State - vsstyle.h Global Enum $PBS_NORMAL=1,$PBS_HOT,$PBS_PRESSED,$PBS_DISABLED,$PBS_DEFAULTED Global Enum $LVGH_CLOSEHOT=10,$LVGH_CLOSESELECTED,$LVGH_CLOSESELECTEDHOT,$LVGH_CLOSESELECTEDNOTFOCUSED ;this allows you to theme individual items for your own needs, not just if items are selected ;the same as customdrawing item and subitem colours ;XP+ Global $sTheme = 'Button' Global $iThemePart = $BP_PUSHBUTTON Global $iThemeState = $PBS_NORMAL ; Vista+ ;Global $sTheme = 'Listview' ;Global $iThemePart = $LVP_GROUPHEADER ;Global $iThemeState = $LVGH_CLOSEMIXEDSELECTION Global $hTheme = DllCall($iDllUxtheme, 'ptr', 'OpenThemeData', 'hwnd', 0, 'wstr', $sTheme) $hTheme = $hTheme[0] ;global structs for WM_DRAWITEM - optimize speed ;rect, text buffer and LVITEM structures Global $tLVRect = DllStructCreate($tagRECT) Global $tLVText = DllStructCreate("wchar[4096]") Global $tLVITEM = DllStructCreate($tagLVITEM) Global $pLVITEM = DllStructGetPtr($tLVITEM) DllStructSetData($tLVITEM, "TextMax", 4096) DllStructSetData($tLVITEM, "SubItem", 0) DllStructSetData($tLVITEM, "Text", DllStructGetPtr($tLVText)) ; WM_MEASUREITEM allows setting the row height Global $iListView_row_height = 130 Global $hListView ;must be declared before listview created GUIRegisterMsg($WM_MEASUREITEM, "WM_MEASUREITEM") ; place before listview creation - message sent once for each ownerdrawn control created GUIRegisterMsg($WM_DRAWITEM, "WM_DRAWITEM") ;placed here, WM_MEASUREITEM can now be unregistered in the handler (deleting or adding items after unregistering maintains row height setting this way) ; --------------------------------------------------- $hGUI = GUICreate("Ownerdrawn multiline ListView", 324, 425) $cListView = GUICtrlCreateListView("", 2, 2, 320, 268, BitOR($LVS_REPORT, $LVS_NOCOLUMNHEADER, $LVS_OWNERDRAWFIXED, $LVS_SHOWSELALWAYS)) $hListView = GUICtrlGetHandle($cListView) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_FULLROWSELECT)) ;double buffer improves performance _GUICtrlListView_AddColumn($hListView, "", 298) Global $aTextHdr[4] = ["From:", "Sent:", "To:", "Subject:"] For $row = 1 To 10 _GUICtrlListView_AddItem($hListView, "Rover - AutoIt Forums|Thursday, April 19, 2012 05:0" & $row - 1 & "AM|footswitch|Re: Multiline listview like Outlook|" & _ "This is a rough mock-up of that Outlook listview" & @CRLF & "You will need to add code for the text metrics") Next ;adjust listview size for number of items shown - for efficient painting and to eliminate issue of a click on bottom item causing a jump to next item Local $iY = _GUICtrlListView_ApproximateViewHeight($hListView, _GUICtrlListView_GetCounterPage($hListView)) GUICtrlSetPos($cListView, 2, 2, 320, $iY + 4) Global $cSelect = GUICtrlCreateButton("Themed Select", 2, $iY + 8, 120, 23) Global $cTheme = GUICtrlCreateCombo("Button", 120+2, $iY + 9, 60) GUICtrlSetData(-1, "Listview", "Button") Global $cState = GUICtrlCreateCombo("1 NORMAL", 180+4, $iY + 9, 80) GUICtrlSetData(-1, "2 HOT|3 PRESSED|4 GREYED|5 DEFAULT", "1 NORMAL") Global $cLabel = GUICtrlCreateLabel("Select Item"&@CRLF&"Style", 260+8, $iY + 8) GUISetState() ; Loop until user exits While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $cTheme DllCall($iDllUxtheme, 'uint', 'CloseThemeData', 'ptr', $hTheme) Switch GUICtrlRead($cTheme) Case "Button" $sTheme = "Button" $iThemePart = $BP_PUSHBUTTON GUICtrlSetData($cState, "|1 NORMAL|2 HOT|3 PRESSED|4 GREYED|5 DEFAULT", "1 NORMAL") Case "Listview" $sTheme = "Listview" $iThemePart = $LVP_GROUPHEADER GUICtrlSetData($cState, "|10|11|12|13", "11") EndSwitch $hTheme = DllCall($iDllUxtheme, 'ptr', 'OpenThemeData', 'hwnd', 0, 'wstr', GUICtrlRead($cTheme)) $hTheme = $hTheme[0] $iThemeState = Number(StringLeft(GUICtrlRead($cState), 2)) _WinAPI_InvalidateRect($hListView) Case $cState $iThemeState = Number(StringLeft(GUICtrlRead($cState), 2)) _WinAPI_InvalidateRect($hListView) Case $cSelect If Not $hTheme Then GUICtrlSetData($cSelect, "Themed Select") $hTheme = DllCall($iDllUxtheme, 'ptr', 'OpenThemeData', 'hwnd', 0, 'wstr', $sTheme) $hTheme = $hTheme[0] Else GUICtrlSetData($cSelect, "Unthemed Select") DllCall($iDllUxtheme, 'uint', 'CloseThemeData', 'ptr', $hTheme) $hTheme = 0 EndIf _WinAPI_InvalidateRect($hListView) EndSwitch WEnd GUIDelete() DllCall($iDllUxtheme, 'uint', 'CloseThemeData', 'ptr', $hTheme) _WinAPI_DeleteObject($hPen1) _WinAPI_DeleteObject($hPen2) _WinAPI_DeleteObject($hBrush) For $i = 0 To UBound($aFont) - 1 If $aFont[$i] Then _WinAPI_DeleteObject($aFont[$i]) Next Exit Func WM_MEASUREITEM($hWnd, $Msg, $wParam, $lParam) Local $tMEASUREITEMS = DllStructCreate("uint cType;uint cID;uint itmID;uint itmW;uint itmH;ulong_ptr itmData", $lParam) If DllStructGetData($tMEASUREITEMS, "cType") <> $ODT_LISTVIEW Then Return $GUI_RUNDEFMSG DllStructSetData($tMEASUREITEMS, "itmH", $iListView_row_height) ; row height GUIRegisterMsg($WM_MEASUREITEM, "") ; unregister message handler call this after last ownerdrawn listview created - message no longer sent Return 1 EndFunc ;==>WM_MEASUREITEM Func WM_DRAWITEM($hWnd, $Msg, $wParam, $lParam) Local $tDRAWITEMSTRUCT, $cID, $itmID, $itmAction, $itmState, $hItm, $hDC $tDRAWITEMSTRUCT = DllStructCreate( _ "uint cType;" & _ "uint cID;" & _ "uint itmID;" & _ "uint itmAction;" & _ "uint itmState;" & _ "hwnd hItm;" & _ "handle hDC;" & _ "long itmRect[4];" & _ "ulong_ptr itmData" _ , $lParam) If DllStructGetData($tDRAWITEMSTRUCT, "cType") <> $ODT_LISTVIEW Then Return $GUI_RUNDEFMSG $cID = DllStructGetData($tDRAWITEMSTRUCT, "cID") $itmID = DllStructGetData($tDRAWITEMSTRUCT, "itmID") $itmAction = DllStructGetData($tDRAWITEMSTRUCT, "itmAction") $itmState = DllStructGetData($tDRAWITEMSTRUCT, "itmState") $hItm = DllStructGetData($tDRAWITEMSTRUCT, "hItm") $hDC = DllStructGetData($tDRAWITEMSTRUCT, "hDC") Switch $cID ; will look for ControlID, not window handle. Case $cListView Switch $itmAction Case $ODA_DRAWENTIRE __WM_DRAWITEM_ListView($hItm, $tDRAWITEMSTRUCT, $cID, $itmID, $itmAction, $itmState, $hDC) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_DRAWITEM Func __WM_DRAWITEM_ListView(ByRef $hLV, ByRef $tDRAWITEMSTRUCT, ByRef $cID, ByRef $itmID, ByRef $itmAction, ByRef $itmState, ByRef $hDC) Local $iTxtCol, $bSelected = BitAND($itmState, $ODS_SELECTED), $iTextFormatting = BitOR($DT_LEFT, $DT_WORDBREAK) If Not $bSelected Then $iTxtCol = 0xB79588 Else ;selected $iTxtCol = 0x494949 ;Theme Parts and States ;http://msdn.microsoft.com/en-us/library/windows/desktop/bb773210%28v=vs.85%29.aspx Local $pItemRect = DllStructGetPtr($tDRAWITEMSTRUCT, "itmRect") If $hTheme Then If $sTheme = "Listview" Then Local $tItemRect = DllStructCreate($tagRect, $pItemRect) DllStructSetData($tItemRect, 1, DllStructGetData($tItemRect, 1)+1) DllStructSetData($tItemRect, 2, DllStructGetData($tItemRect, 2)+1) DllStructSetData($tItemRect, 3, DllStructGetData($tItemRect, 3)-1) DllStructSetData($tItemRect, 4, DllStructGetData($tItemRect, 4)-1) $pItemRect = DllStructGetPtr($tItemRect) EndIf DllCall($iDllUxtheme, 'uint', 'DrawThemeBackground', 'ptr', $hTheme, 'hwnd', $hDC, 'int', $iThemePart, 'int', $iThemeState, 'ptr', $pItemRect, 'ptr', 0) Else DllCall($iDllUSER32, "int", "FillRect", "handle", $hDC, "ptr", DllStructGetPtr($tDRAWITEMSTRUCT, "itmRect"), "handle", $hBrush) EndIf EndIf GUICtrlSendMsg($cID, $LVM_GETITEMTEXTW, $itmID, $pLVITEM) Local $aSubItmText = StringSplit(DllStructGetData($tLVText, 1), "|", 2) DllStructSetData($tLVText, 1, "") DllStructSetData($tLVRect, "Top", 0) DllStructSetData($tLVRect, "Left", $LVIR_BOUNDS) GUICtrlSendMsg($cID, $LVM_GETSUBITEMRECT, $itmID, DllStructGetPtr($tLVRect)) Local $iLeft = DllStructGetData($tLVRect, 1) + 6 ;Left Local $iTop = DllStructGetData($tLVRect, 2) ;Top DllStructSetData($tLVRect, 1, $iLeft) ;Left Switch $hLV Case $hListView Local $iColPrev = __WinAPI_SetTextColor($hDC, 0x000000) ;save previous font and text colour Local $hFontOld = __WinAPI_SelectObject($hDC, $aFont[0]) ;Bold ;------------------------------------------------------------ ;multiline, but no per line indentation or colour ;DllStructSetData($tLVRect, 2, $iTop+2) ;__WinAPI_DrawText($hDC, "From:"&@CRLF&"Sent:"&@CRLF&"To:"&@CRLF&"Subject:", $tLVRect, $iTextFormatting) ;------------------------------------------------------------ DllStructSetData($tLVRect, 2, $iTop + 2) __WinAPI_DrawText($hDC, $aTextHdr[0], $tLVRect, $iTextFormatting) DllStructSetData($tLVRect, 2, $iTop + 20) __WinAPI_DrawText($hDC, $aTextHdr[1], $tLVRect, $iTextFormatting) DllStructSetData($tLVRect, 2, $iTop + 38) __WinAPI_DrawText($hDC, $aTextHdr[2], $tLVRect, $iTextFormatting) DllStructSetData($tLVRect, 2, $iTop + 56) __WinAPI_DrawText($hDC, $aTextHdr[3], $tLVRect, $iTextFormatting) __WinAPI_SelectObject($hDC, $aFont[1]) ;Normal ;------------------------------------------------------------ ;multiline, but no per line indentation or colour ;__WinAPI_SetTextColor($hDC, 0x494949) ;DllStructSetData($tLVRect, 1, $iLeft+50) ;DllStructSetData($tLVRect, 2, $iTop+2) ;__WinAPI_DrawText($hDC, $aSubItmText[0]&@CRLF&$aSubItmText[1]&@CRLF&$aSubItmText[2]&@CRLF&$aSubItmText[3], $tLVRect, $iTextFormatting) ;------------------------------------------------------------ __WinAPI_SetTextColor($hDC, 0xFF0000) DllStructSetData($tLVRect, 1, $iLeft + __GUICtrlListView_GetStringWidth($cID, $aTextHdr[0]) + 5) DllStructSetData($tLVRect, 2, $iTop + 2) __WinAPI_DrawText($hDC, $aSubItmText[0], $tLVRect, $iTextFormatting) __WinAPI_SetTextColor($hDC, 0x494949) DllStructSetData($tLVRect, 1, $iLeft + __GUICtrlListView_GetStringWidth($cID, $aTextHdr[1]) + 5) DllStructSetData($tLVRect, 2, $iTop + 20) __WinAPI_DrawText($hDC, $aSubItmText[1], $tLVRect, $iTextFormatting) DllStructSetData($tLVRect, 1, $iLeft + __GUICtrlListView_GetStringWidth($cID, $aTextHdr[2]) + 5) DllStructSetData($tLVRect, 2, $iTop + 38) __WinAPI_DrawText($hDC, $aSubItmText[2], $tLVRect, $iTextFormatting) DllStructSetData($tLVRect, 1, $iLeft + __GUICtrlListView_GetStringWidth($cID, $aTextHdr[3]) + 5) DllStructSetData($tLVRect, 2, $iTop + 56) __WinAPI_DrawText($hDC, $aSubItmText[3], $tLVRect, $iTextFormatting) __WinAPI_SetTextColor($hDC, $iTxtCol) DllStructSetData($tLVRect, 1, $iLeft + 2) DllStructSetData($tLVRect, 2, $iTop + 80) __WinAPI_DrawText($hDC, $aSubItmText[4], $tLVRect, $iTextFormatting) If $bSelected And $hTheme Then Return ;optional - don't paint lines when item selected - in this example only for benefit of themed selected items Local $obj_orig = __WinAPI_SelectObject($hDC, $hPen1) __WinAPI_DrawLine($hDC, $iLeft, DllStructGetData($tLVRect, 4) - 2, 320 - ($iLeft * 2) - 16, DllStructGetData($tLVRect, 4) - 2) __WinAPI_SelectObject($hDC, $hPen2) __WinAPI_DrawLine($hDC, $iLeft, DllStructGetData($tLVRect, 4) - 3, 320 - ($iLeft * 2) - 16, DllStructGetData($tLVRect, 4) - 3) __WinAPI_SelectObject($hDC, $obj_orig) ;__WinAPI_SelectObject($hDC, $hFontOld) ;__WinAPI_SetTextColor($hDC, $iColPrev) EndSwitch Return EndFunc ;==>__WM_DRAWITEM_ListView Func __WinAPI_DrawLine($hDC, $iX1, $iY1, $iX2, $iY2) DllCall($iDllGDI, "bool", "MoveToEx", "handle", $hDC, "int", $iX1, "int", $iY1, "ptr", 0) If @error Then Return SetError(@error, @extended, False) DllCall($iDllGDI, "bool", "LineTo", "handle", $hDC, "int", $iX2, "int", $iY2) If @error Then Return SetError(@error, @extended, False) Return True EndFunc ;==>__WinAPI_DrawLine Func __WinAPI_DrawText(ByRef $hDC, $sText, ByRef $tRect, ByRef $iFlags) DllCall($iDllUSER32, "int", "DrawTextW", "hwnd", $hDC, "wstr", $sText, "int", StringLen($sText), "struct*", $tRect, "int", $iFlags) EndFunc ;==>__WinAPI_DrawText Func __WinAPI_SetTextColor($hDC, $iColor) Local $aResult = DllCall($iDllGDI, "INT", "SetTextColor", "handle", $hDC, "dword", $iColor) If @error Then Return SetError(@error, @extended, -1) Return $aResult[0] EndFunc ;==>__WinAPI_SetTextColor Func __WinAPI_SelectObject($hDC, $hGDIObj) Local $aResult = DllCall($iDllGDI, "handle", "SelectObject", "handle", $hDC, "handle", $hGDIObj) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] EndFunc ;==>__WinAPI_SelectObject Func __GUICtrlListView_GetStringWidth($hWnd, $sString) Local $tBuffer = DllStructCreate("wchar Text[" & StringLen($sString) + 1 & "]") DllStructSetData($tBuffer, "Text", $sString) Local $iRet = GUICtrlSendMsg($hWnd, $LVM_GETSTRINGWIDTHW, 0, DllStructGetPtr($tBuffer)) Return $iRet EndFunc ;==>__GUICtrlListView_GetStringWidth
    1 point
×
×
  • Create New...