Yashied Posted February 12, 2011 Author Share Posted February 12, 2011 All that does this function can be written as follows: If StringLeft($sPath, 2) = '\\' Then ; A network path My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
guinness Posted February 12, 2011 Share Posted February 12, 2011 But if I check K:\ to see if it was a Network Drive then surely that wouldn't work! UDF List:  _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
guinness Posted February 12, 2011 Share Posted February 12, 2011 (edited) Weird, got an Error saying posts were limited and that it hadn't posted, but it had! Hence the double post. Edited February 12, 2011 by guinness UDF List:  _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Yashied Posted February 12, 2011 Author Share Posted February 12, 2011 A small update without changing UDF version.ChangesAdded the following functions. _WinAPI_Create32BitHBITMAP _WinAPI_PathIsContentType _WinAPI_PathIsLFNFileSpec _WinAPI_PathUndecorate _WinAPI_RegDisableReflectionKey _WinAPI_RegEnableReflectionKey _WinAPI_RegQueryReflectionKey _WinAPI_UrlCreateFromPath _WinAPI_UrlEscape _WinAPI_UrlGetPart _WinAPI_UrlFixup _WinAPI_UrlIs _WinAPI_UrlUnescapeAdded examples for the functions above.Removed the _WinAPI_PathIsURL() functions, use _WinAPI_UrlIs().Updated documentation. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
guinness Posted February 13, 2011 Share Posted February 13, 2011 (edited) As ever a nice update This UDF is integral to my Include Folder. Edited February 13, 2011 by guinness UDF List:  _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
guinness Posted February 14, 2011 Share Posted February 14, 2011 No biggy but in the Help File in "Contents" & "Library Reference" expanded you see "Constans" UDF List:  _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Yashied Posted February 15, 2011 Author Share Posted February 15, 2011 (edited) I see. Thanks. Edited February 15, 2011 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
KaFu Posted February 15, 2011 Share Posted February 15, 2011 Not quite sure if these three functions are already included ... expandcollapse popup; http://msdn.microsoft.com/en-us/library/ms724482(VS.85).aspx Global Const $PF_FLOATING_POINT_PRECISION_ERRATA = 0 Global Const $PF_FLOATING_POINT_EMULATED = 1 Global Const $PF_COMPARE_EXCHANGE_DOUBLE = 2 Global Const $PF_MMX_INSTRUCTIONS_AVAILABLE = 3 Global Const $PF_XMMI_INSTRUCTIONS_AVAILABLE = 6 Global Const $PF_3DNOW_INSTRUCTIONS_AVAILABLE = 7 Global Const $PF_RDTSC_INSTRUCTION_AVAILABLE = 8 Global Const $PF_PAE_ENABLED = 9 Global Const $PF_XMMI64_INSTRUCTIONS_AVAILABLE = 10 Global Const $PF_NX_ENABLED = 12 Global Const $PF_SSE3_INSTRUCTIONS_AVAILABLE = 13 Global Const $PF_COMPARE_EXCHANGE128 = 14 Global Const $PF_COMPARE64_EXCHANGE128 = 15 Global Const $PF_CHANNELS_ENABLED = 16 Global Const $PF_XSAVE_ENABLED = 17 $iRet = DllCall("Kernel32.dll", "INT", "IsProcessorFeaturePresent", "DWORD", $PF_NX_ENABLED) ; This feature is not supported until Windows XP with SP2 and Windows Server 2003 with SP1. ConsoleWrite("DEP - Data execution prevention is enabled: " & $iRet[0] & @CRLF) ; http://msdn.microsoft.com/en-us/library/bb736298(VS.85).aspx $iRet = DllCall("Kernel32.dll", "INT", "GetSystemDEPPolicy") ; Windows Vista with SP1, Windows XP with SP3 Switch $iRet[0] Case 0 ConsoleWrite("DEP - Data execution prevention setting: AlwaysOff" & @CRLF) Case 1 ConsoleWrite("DEP - Data execution prevention setting: AlwaysOn" & @CRLF) Case 2 ; This is the default setting for client versions of Windows ConsoleWrite("DEP - Data execution prevention setting: OptIn" & @CRLF) Case 3 ConsoleWrite("DEP - Data execution prevention setting: OptOut" & @CRLF) EndSwitch ; http://msdn.microsoft.com/en-us/library/ms724301(VS.85).aspx #cs typedef enum _COMPUTER_NAME_FORMAT { ComputerNameNetBIOS, ComputerNameDnsHostname, ComputerNameDnsDomain, ComputerNameDnsFullyQualified, ComputerNamePhysicalNetBIOS, ComputerNamePhysicalDnsHostname, ComputerNamePhysicalDnsDomain, ComputerNamePhysicalDnsFullyQualified, ComputerNameMax } COMPUTER_NAME_FORMAT; #ce For $i = 0 To 7 $tBufferSize = DllStructCreate("int") $iRet = DllCall("Kernel32.dll", "INT", "GetComputerNameEx", "INT", $i, "ptr", "", "ptr", DllStructGetPtr($tBufferSize)) ; ConsoleWrite(DllStructGetData($tBufferSize,1) & @CRLF) $tBuffer = DllStructCreate("CHAR Name[" & DllStructGetData($tBufferSize, 1) & "]") $iRet = DllCall("Kernel32.dll", "INT", "GetComputerNameEx", "INT", 0, "ptr", DllStructGetPtr($tBuffer), "ptr", DllStructGetPtr($tBufferSize)) ConsoleWrite("GetComputerNameEx Type " & $i & @TAB & DllStructGetData($tBuffer, 1) & @CRLF) $tBufferSize = 0 $tBuffer = 0 Next  OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Yashied Posted February 25, 2011 Author Share Posted February 25, 2011 (edited) A small update without changing UDF version.ChangesAdded the following functions. _WinAPI_AddClipboardFormatListener _WinAPI_CreatePoint _WinAPI_EnumProcessModules _WinAPI_FileInUse _WinAPI_GetClipboardSequenceNumber _WinAPI_GetDllDirectory _WinAPI_GetFinalPathNameByHandle _WinAPI_GetPhysicallyInstalledSystemMemory _WinAPI_GetProcessShutdownParameters _WinAPI_GetProcessWorkingDirectory _WinAPI_GetRegKeyNameByHandle _WinAPI_GetSystemDEPPolicy _WinAPI_NtStatusToDosError _WinAPI_RemoveClipboardFormatListener _WinAPI_SetDllDirectory _WinAPI_SetProcessShutdownParameters _WinAPI_SetWinEventHook _WinAPI_SfcIsFileProtected _WinAPI_SfcIsKeyProtected _WinAPI_ShutdownBlockReasonCreate _WinAPI_ShutdownBlockReasonDestroy _WinAPI_ShutdownBlockReasonQuery _WinAPI_StretchDIBits _WinAPI_UnhookWinEventAdded examples for the functions above.Added the APIErrors.au3 (optional) that contains the constants of all system error codes.Updated documentation. Edited March 19, 2011 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
netegg Posted March 7, 2011 Share Posted March 7, 2011 this may be better for Link to comment Share on other sites More sharing options...
Yashied Posted March 7, 2011 Author Share Posted March 7, 2011 this may be better for This is the same. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
KaFu Posted March 7, 2011 Share Posted March 7, 2011 PathCreateFromUrl as pointed out by Ascend4nt might be a nice addition too ... Â OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13)Â BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16)Â ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
netegg Posted March 7, 2011 Share Posted March 7, 2011 This is the same.Thanks, and I'm so sorry for that. The Privilege is adjusted in the example. Thanks again! Link to comment Share on other sites More sharing options...
JScript Posted March 10, 2011 Share Posted March 10, 2011 Hello Yashied,Congratulations on your great contribution to the community (greatly facilitating our work ...).I've been trying to make a program to view a remote desktop, I have been quite successful, but walking in the MSDN I found this function that I think would improve enough speed transmission of images that are currently transmitted in uncompressed DIB, but I see that this function has the ability of compression in JPG, I tried to use but I got no success.StretchDIBits FunctionThe StretchDIBits function copies the color data for a rectangle of pixels in a DIB, JPEG, or PNG image to the specified destination rectangle. If the destination rectangle is larger than the source rectangle, this function stretches the rows and columns of color data to fit the destination rectangle. If the destination rectangle is smaller than the source rectangle, this function compresses the rows and columns by using the specified raster operation.Syntaxint StretchDIBits( __in HDC hdc, __in int XDest, __in int YDest, __in int nDestWidth, __in int nDestHeight, __in int XSrc, __in int YSrc, __in int nSrcWidth, __in int nSrcHeight, __in const VOID *lpBits, __in const BITMAPINFO *lpBitsInfo, __in UINT iUsage, __in DWORD dwRop );http://msdn.microsoft.com/en-us/library/dd145121%28v=vs.85%29.aspxBelow is the code I did:Clientexpandcollapse popup#AutoIt3Wrapper_Compression=0 ;Compression parameter 0-4 0=Low 2=normal 4=High. Default=2 #AutoIt3Wrapper_UseUpx=n ;(Y/N) Compress output program. Default=Y Opt('MustDeclareVars', 1) #include <WindowsConstants.au3> #Include <WinAPI.au3> #include <_LZNTCompress.au3> ; #VARIABLES# =================================================================================================================== ; Send Data functions Global $TCP_MainStrSocket Global $TCP_StrSocket = -1 Global $TCP_MaxStrLen = 1048576; 1MB Global $TCP_StrPort = 5909 Global $TCP_MainDataSocket Global $TCP_DataSocket = -1 Global $TCP_MaxDataLen = 1024 Global $TCP_IPAddress ; Global $hForm1, $iLblID Global $hGuiDC Global $aResize[2] Global $iDskTime Global $vAppendHex = "" Global $fChkDim = False Global $bBmpStream Global $tBits Global $hDeskHwnd Global $hDeskDC Global $iChecksum = 0 Global $hBitmapDC, $pBits_Ptr, $hBMP_Hwnd ; Global $iDeskWidth = 800 Global $iDeskHeight = 600 Global $iBits = 16 ; =============================================================================================================================== Global $sCmpName = InputBox("Cliente", "Enter computer name:") If @error Then Exit _SendDeskStream($sCmpName) ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SendDeskStream ; Description ...: ; Syntax ........: _SendDeskStream( $sCmpName ) ; Parameters ....: $sCmpName - A string value. ; Return values .: None ; Author(s) .....: João Carlos (Jscript FROM Brazil) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SendDeskStream($sCmpName) Local $sVariable, $vAspectR Opt("TCPTimeout", 1000) TCPStartup() ; Initialize the Server for an incoming connection. $TCP_MainDataSocket = TCPListen(@IPAddress1, $TCP_StrPort) If $TCP_MainDataSocket = 0 Then _CloseThread() $TCP_IPAddress = TCPNameToIP($sCmpName) $hDeskHwnd = _WinAPI_GetDesktopWindow() $hDeskDC = _WinAPI_GetDC($hDeskHwnd) ; find current aspect ratio (using width / height) $vAspectR = @DesktopWidth / @DesktopHeight If $iDeskHeight * $vAspectR <= $iDeskWidth Then $iDeskWidth = $iDeskHeight * $vAspectR Else $iDeskHeight = $iDeskWidth / $vAspectR EndIf _SendDataDesk($sCmpName, ".SizeXY", $iDeskWidth, $iDeskHeight) $hBitmapDC = _CreateBitmap($iDeskWidth, $iDeskHeight, $pBits_Ptr, $hBMP_Hwnd, $iBits) ; Get initial checksum ;$iChecksum = PixelChecksum(0, 0, @DesktopWidth, @DesktopHeight, 16) $iDskTime = TimerInit() While 1 _Read_SendSocket($sCmpName) WEnd EndFunc ;==>_SendDeskStream ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Read_SendSocket ; Description ...: ; Syntax ........: _Read_SendSocket( $sCmpName ) ; Parameters ....: $sCmpName - A string value. ; Return values .: None ; Author(s) .....: João Carlos (Jscript FROM Brazil) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Read_SendSocket($sCmpName) Local $vRecvData ; If no connection for message, look for one... Select Case $TCP_DataSocket = -1 $TCP_DataSocket = TCPAccept($TCP_MainDataSocket) If $TCP_DataSocket < 0 Then $TCP_DataSocket = -1 If TimerDiff($iDskTime) >= 4000 Then _ReceiveData($sCmpName, 2) EndIf Case Else ; If connected try to read some data $vRecvData = TCPRecv($TCP_DataSocket, $TCP_MaxDataLen) ; IF ERROR OCCURRED, CLOSE SOCKET AND RESET $TCP_DataSocket TO -1 If @error Or $vRecvData = "" Then Return _ResetSocket($TCP_DataSocket) _ReceiveData($sCmpName, $vRecvData) $iDskTime = TimerInit() EndSelect Return 0 EndFunc ;==>_Read_SendSocket ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ReceiveData ; Description ...: ; Syntax ........: _ReceiveData( $sCmpName , $vData ) ; Parameters ....: $sCmpName - A string value. ; $vData - A variant value. ; Return values .: None ; Author(s) .....: João Carlos (Jscript FROM Brazil) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _ReceiveData($sCmpName, $vData) Local $iNewChecksum, $sVariable Switch $vData Case 1 ;$iNewChecksum = PixelChecksum(0, 0, @DesktopWidth, @DesktopHeight, 16) ;If $iChecksum = $iNewChecksum Then Return _SendDataDesk($sCmpName, ".None") $sVariable = _DesktopStream($iDeskWidth, $iDeskHeight, $iBits) _SendStream($sCmpName, $sVariable) ;$iChecksum = $iNewChecksum Case 2 _DeleteBitmap($hBitmapDC, $pBits_Ptr, $hBMP_Hwnd) _WinAPI_ReleaseDC($hDeskHwnd, $hDeskDC) _CloseThread() EndSwitch EndFunc ;==>_ReceiveData ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SendStream ; Description ...: ; Syntax ........: _SendStream( $sCmpName , $vData [, $iPort , $TCPStrPort ] ) ; Parameters ....: $sCmpName - A string value. ; $vData - A variant value. ; $iPort - [optional] A integer value. ; $TCPStrPort - A unknown value. ; Return values .: None ; Author(s) .....: João Carlos (Jscript FROM Brazil) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SendStream($sCmpName, $vData, $iPort = $TCP_StrPort) Local $Socket, $iSize ; Send desktop image $Socket = TCPConnect($TCP_IPAddress, $TCP_StrPort) If Not @error Then $iSize = Int(BinaryLen($vData) / 64510) For $i = 0 To $iSize TCPSend($Socket, BinaryMid($vData, $i * 64510 + 1, 64510)); Max: 65515 bytes Next TCPCloseSocket($Socket) EndIf ; End of image transmission _SendDataDesk($sCmpName, ".Done") Return 1 EndFunc ;==>_SendStream ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SendDataDesk ; Description ...: ; Syntax ........: _SendDataDesk( $sCmpName , $iDataType [, $sData1 [, $sData2 [, $iPort , $TCPStrPort ]]] ) ; Parameters ....: $sCmpName - A string value. ; $iDataType - A integer value. ; $sData1 - [optional] A string value. ; $sData2 - [optional] A string value. ; $iPort - [optional] A integer value. ; $TCPStrPort - A unknown value. ; Return values .: None ; Author(s) .....: João Carlos (Jscript FROM Brazil) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SendDataDesk($sCmpName, $iDataType, $sData1 = "", $sData2 = "", $iPort = $TCP_StrPort) Local $Socket $Socket = TCPConnect($TCP_IPAddress, $iPort) If @error Then Return 0 TCPSend($Socket, $iDataType & "|" & $sData1 & "|" & $sData2) TCPCloseSocket($Socket) Return 1 EndFunc ;==>_SendDataDesk ; #FUNCTION# ==================================================================================================================== ; Name ..........: _DesktopStream ; Description ...: ; Syntax ........: _DesktopStream( $iWidth , $iHeight [, $iBits ] ) ; Parameters ....: $iWidth - A integer value. ; $iHeight - A integer value. ; $iBits - [optional] A integer value. ; Return values .: None ; Author(s) .....: João Carlos (Jscript FROM Brazil) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _DesktopStream($iWidth, $iHeight, $iBits = 16) ;Local $hBitmapDC, $pBits_Ptr, $hBMP_Hwnd, $tBits, $hBitmap Local $hBitmap ;$hBitmapDC = _CreateBitmap($iWidth, $iHeight, $pBits_Ptr, $hBMP_Hwnd, $iBits) DllCall("gdi32.dll", "int", "SetStretchBltMode", "dword", $hBitmapDC, "int", 4) __WinAPI_StretchBlt($hBitmapDC, 0, 0, $iWidth, $iHeight, $hDeskDC, 0, 0, @DesktopWidth, @DesktopHeight, $SRCCOPY) $tBits = DllStructCreate('byte[' & ($iWidth * $iHeight * $iBits) / 8 & ']', $pBits_Ptr) $hBitmap = _LZNTCompress(DllStructGetData($tBits, 1)) ;_DeleteBitmap($hBitmapDC, $pBits_Ptr, $hBMP_Hwnd) Return $hBitmap EndFunc ;==>_DesktopStream ; #FUNCTION# ==================================================================================================================== ; Name ..........: _CreateBitmap ; Description ...: ; Syntax ........: _CreateBitmap( $iWidth , $iHeight , $pBits , $hBitmap [, $iBitCount ] ) ; Parameters ....: $iWidth - A integer value. ; $iHeight - A integer value. ; $pBits - [in/out] A pointer value. ; $hBitmap - [in/out] A handle value. ; $iBitCount - [optional] A integer value. ; Return values .: None ; Author(s) .....: João Carlos (Jscript FROM Brazil) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _CreateBitmap($iWidth, $iHeight, ByRef $pBits, ByRef $hBitmap, $iBitCount = 16) Local $hCompDC, $tBITMAPINFO, $aDIBSec $hCompDC = _WinAPI_CreateCompatibleDC(0) $tBITMAPINFO = DllStructCreate($tagBITMAPINFO) DllStructSetData($tBITMAPINFO, "Size", DllStructGetSize($tBITMAPINFO) - 4); DllStructSetData($tBITMAPINFO, "Width", $iWidth) DllStructSetData($tBITMAPINFO, "Height", -($iHeight)); minus =standard = bottomup DllStructSetData($tBITMAPINFO, "Planes", 1) DllStructSetData($tBITMAPINFO, "BitCount", $iBitCount) DllStructSetData($tBITMAPINFO, 'Compression', 0);$BI_RGB) DllStructSetData($tBITMAPINFO, 'SizeImage', 0) $aDIBSec = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', 0, 'ptr', DllStructGetPtr($tBITMAPINFO), 'uint', 0, 'ptr*', 0, 'ptr', 0, 'uint', 0) ;$DIB_RGB_COLORS = 0 $hBitmap = $aDIBSec[0] $pBits = $aDIBSec[4] $aDIBSec = 0 $tBITMAPINFO = 0 _WinAPI_SelectObject($hCompDC, $hBitmap) Return $hCompDC EndFunc ;==>_CreateBitmap ; #FUNCTION# ==================================================================================================================== ; Name ..........: _DeleteBitmap ; Description ...: ; Syntax ........: _DeleteBitmap( $hCompDC , $pBits , $hBitmap ) ; Parameters ....: $hCompDC - A handle value. ; $pBits - A pointer value. ; $hBitmap - A handle value. ; Return values .: None ; Author(s) .....: João Carlos (Jscript FROM Brazil) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _DeleteBitmap($hCompDC, $pBits, $hBitmap) _WinAPI_DeleteDC($hCompDC) _WinAPI_DeleteObject($hBitmap) $pBits = 0 EndFunc ;==>_DeleteBitmap ; #FUNCTION# ==================================================================================================================== ; Name...........: _WinAPI_StretchBlt ; Description....: Copies a bitmap from a source rectangle into a destination rectangle, stretching or compressing the bitmap ; to fit the dimensions of the destination rectangle, if necessary. ; Syntax.........: _WinAPI_StretchBlt ( $hDestDC, $iXDest, $iYDest, $iWidthDest, $iHeightDest, $hSrcDC, $iXSrc, $iYSrc, $iWidthSrc, $iHeightSrc, $iRop ) ; Parameters.....: $hDestDC - Handle to the destination device context. ; $iXDest - The x-coordinate, in logical units, of the upper-left corner of the destination rectangle. ; $iYDest - The y-coordinate, in logical units, of the upper-left corner of the destination rectangle. ; $iWidthDest - The width, in logical units, of the destination rectangle. ; $iHeightDest - The height, in logical units, of the destination rectangle. ; $hSrcDC - Handle to the source device context. ; $iXSrc - The x-coordinate, in logical units, of the upper-left corner of the source rectangle. ; $iYSrc - The y-coordinate, in logical units, of the upper-left corner of the source rectangle. ; $iWidthSrc - The width, in logical units, of the source rectangle. ; $iHeightSrc - The height, in logical units, of the source rectangle. ; $iRop - The raster-operation code. These codes define how the color data for the source rectangle is ; to be combined with the color data for the destination rectangle to achieve the final color. ; This parameter must be 0 or one of the following values. ; ; $BLACKNESS ; $CAPTUREBLT ; $DSTINVERT ; $MERGECOPY ; $MERGEPAINT ; $NOMIRRORBITMAP ; $NOTSRCCOPY ; $NOTSRCERASE ; $PATCOPY ; $PATINVERT ; $PATPAINT ; $SRCAND ; $SRCCOPY ; $SRCERASE ; $SRCINVERT ; $SRCPAINT ; $WHITENESS ; ; Return values..: Success - 1. ; Failure - 0 and sets the @error flag to non-zero. ; Author.........: Yashied ; Modified.......: ; Remarks........: The system stretches or compresses the bitmap according to the stretching mode currently set in the ; destination device context. ; Related........: ; Link...........: @@MsdnLink@@ StretchBlt ; Example........: Yes ; =============================================================================================================================== Func __WinAPI_StretchBlt($hDestDC, $iXDest, $iYDest, $iWidthDest, $iHeightDest, $hSrcDC, $iXSrc, $iYSrc, $iWidthSrc, $iHeightSrc, $iRop) Local $Ret = DllCall("gdi32.dll", 'int', 'StretchBlt', _ 'hwnd', $hDestDC, _ 'int', $iXDest, _ 'int', $iYDest, _ 'int', $iWidthDest, _ 'int', $iHeightDest, _ 'hwnd', $hSrcDC, _ 'int', $iXSrc, _ 'int', $iYSrc, _ 'int', $iWidthSrc, _ 'int', $iHeightSrc, _ 'dword', $iRop) If (@error) Or (Not $Ret[0]) Then Return SetError(1, 0, 0) EndIf Return 1 EndFunc ;==>__WinAPI_StretchBlt ; #FUNCTION# ==================================================================================================================== ; Name ..........: _CloseThread ; Description ...: ; Syntax ........: _CloseThread( ) ; Parameters ....: ; Return values .: None ; Author(s) .....: João Carlos (Jscript FROM Brazil) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _CloseThread() TCPShutdown() Exit EndFunc ;==>_CloseThread ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ResetSocket ; Description ...: ; Syntax ........: _ResetSocket( $iSocketID ) ; Parameters ....: $iSocketID - [in/out] A integer value. ; Return values .: None ; Author(s) .....: João Carlos (Jscript FROM Brazil) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _ResetSocket(ByRef $iSocketID) Local $vCloseSocket = TCPCloseSocket($iSocketID) $iSocketID = -1 Return $vCloseSocket EndFunc ;==>_ResetSocketServerexpandcollapse popup#AutoIt3Wrapper_Compression=0 ;Compression parameter 0-4 0=Low 2=normal 4=High. Default=2 #AutoIt3Wrapper_UseUpx=n ;(Y/N) Compress output program. Default=Y Opt('MustDeclareVars', 1) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <WinAPI.au3> #include <_LZNTCompress.au3> ; #VARIABLES# =================================================================================================================== ; Send Data functions Global $TCP_MainStrSocket Global $TCP_StrSocket = -1 Global $TCP_MaxStrLen = 1048576; 1MB Global $TCP_StrPort = 5909 Global $TCP_MainDataSocket Global $TCP_DataSocket = -1 Global $TCP_MaxDataLen = 1024 Global $TCP_IPAddress ; Global $hForm1, $iLblID Global $hGuiDC Global $aResize[2] Global $iDskTime Global $vAppendHex = "" Global $fChkDim = False Global $bBmpStream Global $tBits Global $hDeskHwnd Global $hDeskDC Global $iChecksum = 0 Global $hBitmapDC, $pBits_Ptr, $hBMP_Hwnd ; Global $iDeskWidth = 800 Global $iDeskHeight = 600 Global $iBits = 16 ; =============================================================================================================================== Global $sCmpName = InputBox("Sever", "Enter computer name:") If @error Then Exit _RecvDeskStream($sCmpName) ; #FUNCTION# ==================================================================================================================== ; Name ..........: _RecvDeskStream ; Description ...: ; Syntax ........: _RecvDeskStream( $sCmpName ) ; Parameters ....: $sCmpName - A string value. ; Return values .: None ; Author(s) .....: João Carlos (Jscript FROM Brazil) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _RecvDeskStream($sCmpName) Local $tRECT, $X1, $Y1, $X2, $Y2, $aCoord, $iMsg Local $sNoSignal = @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & " Sem Sinal..." Local $sConnecting = @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & " Conectando..." $hForm1 = GUICreate($sCmpName, $iDeskWidth, $iDeskHeight, -1, -1) $iLblID = GUICtrlCreateLabel("", 0, 0, $iDeskWidth, $iDeskHeight) GUICtrlSetFont(-1, 20, 600) GUICtrlSetData($iLblID, $sConnecting) GUICtrlSetState($iLblID, $GUI_SHOW) GUISetState() WinSetOnTop($hForm1, "", 1) $hGuiDC = _WinAPI_GetDC($hForm1) Opt("TCPTimeout", 1000) TCPStartup() ; Initialize the Server for an incoming connection. $TCP_MainStrSocket = TCPListen(@IPAddress1, $TCP_StrPort) ; Verify error and send 'Request Desktop Stream' If $TCP_MainStrSocket = 0 Then;Or _SendData($sCmpName, 100) = 0 Then MsgBox(262160, "NetSend", "Não há uma conexão disponÃvel ou não foi possÃvel iniciar os protocolos de mensagens popup na rede!") _CloseThread() EndIf $TCP_IPAddress = TCPNameToIP($sCmpName) ; Prepare to resize GUI... $tRECT = _WinAPI_GetClientRect($hForm1) $X1 = DllStructGetData($tRECT, "Left") $Y1 = DllStructGetData($tRECT, "Top") $X2 = DllStructGetData($tRECT, "Right") $Y2 = DllStructGetData($tRECT, "Bottom") $tRECT = 0 $aCoord = WinGetPos($hForm1) $aResize[0] = $aCoord[2] - ($X2 - $X1) $aResize[1] = $aCoord[3] - ($Y2 - $Y1) $aCoord = 0 $hBitmapDC = _CreateBitmap($iDeskWidth, $iDeskHeight, $pBits_Ptr, $hBMP_Hwnd, $iBits) $iDskTime = TimerInit() While 1 $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE ;_SendDataDesk($sCmpName, 2) _DeleteBitmap($hBitmapDC, $pBits_Ptr, $hBMP_Hwnd) _WinAPI_ReleaseDC($hForm1, $hGuiDC) _CloseThread() EndSelect _Read_RecvSocket($sCmpName, $sNoSignal) WEnd EndFunc ;==>_RecvDeskStream ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Read_RecvSocket ; Description ...: ; Syntax ........: _Read_RecvSocket( $sCmpName , $sText1 ) ; Parameters ....: $sCmpName - A string value. ; $sText1 - A string value. ; Return values .: None ; Author(s) .....: João Carlos (Jscript FROM Brazil) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Read_RecvSocket($sCmpName, $sText1) Local $vRecvData, $aSplitData ; If no connection for message, look for one... Select Case $TCP_StrSocket = -1 $TCP_StrSocket = TCPAccept($TCP_MainStrSocket) If $TCP_StrSocket < 0 Then $TCP_StrSocket = -1 If TimerDiff($iDskTime) >= 4000 Then WinSetTitle($hForm1, "", $sCmpName & " - Recebendo: 0 Bps.") GUICtrlSetData($iLblID, $sText1) $iDskTime = TimerInit() EndIf EndIf Case Else ; If connected try to read some data $vRecvData = TCPRecv($TCP_StrSocket, $TCP_MaxStrLen) ; IF ERROR OCCURRED, CLOSE SOCKET AND RESET $TCP_DataSocket TO -1 If @error Or $vRecvData = "" Then Return _ResetSocket($TCP_StrSocket) ; Divides the data received to separate information. $aSplitData = StringSplit($vRecvData, "|", 1) If @error Then _ReceiveStream($sCmpName, $vRecvData) Else _ReceiveStream($sCmpName, $aSplitData[1], $aSplitData[2], $aSplitData[3]) EndIf $iDskTime = TimerInit() Return 1 EndSelect Return 0 EndFunc ;==>_Read_RecvSocket ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ReceiveStream ; Description ...: ; Syntax ........: _ReceiveStream( $sCmpName , $vData [, $sData1 [, $sData2 ]] ) ; Parameters ....: $sCmpName - A string value. ; $vData - A variant value. ; $sData1 - [optional] A string value. ; $sData2 - [optional] A string value. ; Return values .: None ; Author(s) .....: João Carlos (Jscript FROM Brazil) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _ReceiveStream($sCmpName, $vData, $sData1 = "", $sData2 = "") Select Case $vData = ".SizeXY" $iDeskWidth = $sData1 $iDeskHeight = $sData2 WinMove($hForm1, "", (@DesktopWidth - $iDeskWidth) / 2, (@DesktopHeight - $iDeskHeight) / 2, $iDeskWidth + $aResize[0], $iDeskHeight + $aResize[1]) _SendDataDesk($sCmpName, 1) Case $vData = ".Done" $bBmpStream = _LZNTDecompress("0X" & $vAppendHex) WinSetTitle($hForm1, "", $sCmpName & " - Recebendo: " & BinaryLen($vAppendHex) & " Bps.") $tBits = DllStructCreate('byte[' & ($iDeskWidth * $iDeskHeight * $iBits) / 8 & ']', $pBits_Ptr) DllStructSetData($tBits, 1, $bBmpStream) _WinAPI_BitBlt($hGuiDC, 0, 0, $iDeskWidth, $iDeskHeight, $hBitmapDC, 0, 0, $SRCCOPY) $vAppendHex = "" $bBmpStream = 0 _SendDataDesk($sCmpName, 1) Case $vData = ".None" Sleep(100) _SendDataDesk($sCmpName, 1) Case IsBinary($vData) $vAppendHex &= Hex($vData) EndSelect Return 1 EndFunc ;==>_ReceiveStream ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SendDataDesk ; Description ...: ; Syntax ........: _SendDataDesk( $sCmpName , $iDataType [, $iPort , $TCP_StrPort ] ) ; Parameters ....: $sCmpName - A string value. ; $iDataType - A integer value. ; $iPort - [optional] A integer value. ; $TCPStrPort - A unknown value. ; Return values .: None ; Author(s) .....: João Carlos (Jscript FROM Brazil) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SendDataDesk($sCmpName, $iDataType, $iPort = $TCP_StrPort) Local $Socket $Socket = TCPConnect($TCP_IPAddress, $iPort) If @error Then Return 0 TCPSend($Socket, $iDataType) TCPCloseSocket($Socket) Return 1 EndFunc ;==>_SendDataDesk ; #FUNCTION# ==================================================================================================================== ; Name ..........: _CreateBitmap ; Description ...: ; Syntax ........: _CreateBitmap( $iWidth , $iHeight , $pBits , $hBitmap [, $iBitCount ] ) ; Parameters ....: $iWidth - A integer value. ; $iHeight - A integer value. ; $pBits - [in/out] A pointer value. ; $hBitmap - [in/out] A handle value. ; $iBitCount - [optional] A integer value. ; Return values .: None ; Author(s) .....: João Carlos (Jscript FROM Brazil) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _CreateBitmap($iWidth, $iHeight, ByRef $pBits, ByRef $hBitmap, $iBitCount = 16) Local $hCompDC, $tBITMAPINFO, $aDIBSec $hCompDC = _WinAPI_CreateCompatibleDC(0) $tBITMAPINFO = DllStructCreate($tagBITMAPINFO) DllStructSetData($tBITMAPINFO, "Size", DllStructGetSize($tBITMAPINFO) - 4); DllStructSetData($tBITMAPINFO, "Width", $iWidth) DllStructSetData($tBITMAPINFO, "Height", -($iHeight)); minus =standard = bottomup DllStructSetData($tBITMAPINFO, "Planes", 1) DllStructSetData($tBITMAPINFO, "BitCount", $iBitCount) DllStructSetData($tBITMAPINFO, 'Compression', 0);$BI_RGB) DllStructSetData($tBITMAPINFO, 'SizeImage', 0) $aDIBSec = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', 0, 'ptr', DllStructGetPtr($tBITMAPINFO), 'uint', 0, 'ptr*', 0, 'ptr', 0, 'uint', 0) ;$DIB_RGB_COLORS = 0 $hBitmap = $aDIBSec[0] $pBits = $aDIBSec[4] $aDIBSec = 0 $tBITMAPINFO = 0 _WinAPI_SelectObject($hCompDC, $hBitmap) Return $hCompDC EndFunc ;==>_CreateBitmap ; #FUNCTION# ==================================================================================================================== ; Name ..........: _DeleteBitmap ; Description ...: ; Syntax ........: _DeleteBitmap( $hCompDC , $pBits , $hBitmap ) ; Parameters ....: $hCompDC - A handle value. ; $pBits - A pointer value. ; $hBitmap - A handle value. ; Return values .: None ; Author(s) .....: João Carlos (Jscript FROM Brazil) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _DeleteBitmap($hCompDC, $pBits, $hBitmap) _WinAPI_DeleteDC($hCompDC) _WinAPI_DeleteObject($hBitmap) $pBits = 0 EndFunc ;==>_DeleteBitmap ; #FUNCTION# ==================================================================================================================== ; Name...........: _WinAPI_StretchBlt ; Description....: Copies a bitmap from a source rectangle into a destination rectangle, stretching or compressing the bitmap ; to fit the dimensions of the destination rectangle, if necessary. ; Syntax.........: _WinAPI_StretchBlt ( $hDestDC, $iXDest, $iYDest, $iWidthDest, $iHeightDest, $hSrcDC, $iXSrc, $iYSrc, $iWidthSrc, $iHeightSrc, $iRop ) ; Parameters.....: $hDestDC - Handle to the destination device context. ; $iXDest - The x-coordinate, in logical units, of the upper-left corner of the destination rectangle. ; $iYDest - The y-coordinate, in logical units, of the upper-left corner of the destination rectangle. ; $iWidthDest - The width, in logical units, of the destination rectangle. ; $iHeightDest - The height, in logical units, of the destination rectangle. ; $hSrcDC - Handle to the source device context. ; $iXSrc - The x-coordinate, in logical units, of the upper-left corner of the source rectangle. ; $iYSrc - The y-coordinate, in logical units, of the upper-left corner of the source rectangle. ; $iWidthSrc - The width, in logical units, of the source rectangle. ; $iHeightSrc - The height, in logical units, of the source rectangle. ; $iRop - The raster-operation code. These codes define how the color data for the source rectangle is ; to be combined with the color data for the destination rectangle to achieve the final color. ; This parameter must be 0 or one of the following values. ; ; $BLACKNESS ; $CAPTUREBLT ; $DSTINVERT ; $MERGECOPY ; $MERGEPAINT ; $NOMIRRORBITMAP ; $NOTSRCCOPY ; $NOTSRCERASE ; $PATCOPY ; $PATINVERT ; $PATPAINT ; $SRCAND ; $SRCCOPY ; $SRCERASE ; $SRCINVERT ; $SRCPAINT ; $WHITENESS ; ; Return values..: Success - 1. ; Failure - 0 and sets the @error flag to non-zero. ; Author.........: Yashied ; Modified.......: ; Remarks........: The system stretches or compresses the bitmap according to the stretching mode currently set in the ; destination device context. ; Related........: ; Link...........: @@MsdnLink@@ StretchBlt ; Example........: Yes ; =============================================================================================================================== Func __WinAPI_StretchBlt($hDestDC, $iXDest, $iYDest, $iWidthDest, $iHeightDest, $hSrcDC, $iXSrc, $iYSrc, $iWidthSrc, $iHeightSrc, $iRop) Local $Ret = DllCall("gdi32.dll", 'int', 'StretchBlt', _ 'hwnd', $hDestDC, _ 'int', $iXDest, _ 'int', $iYDest, _ 'int', $iWidthDest, _ 'int', $iHeightDest, _ 'hwnd', $hSrcDC, _ 'int', $iXSrc, _ 'int', $iYSrc, _ 'int', $iWidthSrc, _ 'int', $iHeightSrc, _ 'dword', $iRop) If (@error) Or (Not $Ret[0]) Then Return SetError(1, 0, 0) EndIf Return 1 EndFunc ;==>__WinAPI_StretchBlt ; #FUNCTION# ==================================================================================================================== ; Name ..........: _CloseThread ; Description ...: ; Syntax ........: _CloseThread( ) ; Parameters ....: ; Return values .: None ; Author(s) .....: João Carlos (Jscript FROM Brazil) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _CloseThread() TCPShutdown() Exit EndFunc ;==>_CloseThread ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ResetSocket ; Description ...: ; Syntax ........: _ResetSocket( $iSocketID ) ; Parameters ....: $iSocketID - [in/out] A integer value. ; Return values .: None ; Author(s) .....: João Carlos (Jscript FROM Brazil) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _ResetSocket(ByRef $iSocketID) Local $vCloseSocket = TCPCloseSocket($iSocketID) $iSocketID = -1 Return $vCloseSocket EndFunc ;==>_ResetSocketIf you can add this function to its UDF with an example, would be very grateful!Thank you for your attention. http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Yashied Posted March 10, 2011 Author Share Posted March 10, 2011 (edited) Why such a complex example? Edited March 10, 2011 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
JScript Posted March 10, 2011 Share Posted March 10, 2011 Why such a complex example?Sorry, just wanted to show how I wanted to use the function: StretchDIBitsI just wanted to know how to use this: StretchDIBits instead of this: StretchBlt http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Yashied Posted March 10, 2011 Author Share Posted March 10, 2011 Just StretchDIBits() is faster than StretchBlt(). My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
JScript Posted March 10, 2011 Share Posted March 10, 2011 Just StretchDIBits() is faster than StretchBlt().What about using JPEG compression?"The StretchDIBits function copies the color data for a rectangle of pixels in a DIB, JPEG, or PNG image to the specified destination rectangle."And how do I use in AutoIt?Thanks for your replies... http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
JScript Posted March 13, 2011 Share Posted March 13, 2011 @YashiedAnd about the "DrawDib Functions"?You can use the DrawDib functions for data-streaming applications...I found these links on MSDN:About the DrawDib FunctionsandDrawDib ReferenceIt could also be part of your UDF would be great... http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
netegg Posted March 22, 2011 Share Posted March 22, 2011 (edited) hi, pls check the example of _WinAPI_GetDriveNumber. ps: it's my result below. and I have 2 hdd ([c,f,g]and[d,e]) and 1 memory virtual drive(I). I remember it's correct with last version. Edited March 22, 2011 by netegg Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now