Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/13/2015 in all areas

  1. doesnt seem to exist on Win 8.1 found on web
    1 point
  2. heh, that's pretty clever! another way to solve this is.. create copies of GUICtrlListView_SortItems(), _GUICtrlListView_RegisterSortCallBack() and __GUICtrlListView_Sort() and implement whatever you need! dirty, but its working thank you for your reply!
    1 point
  3. JohnOne

    AudBox

    Things like... If $Aud=1 Then $auSOUND=@WindowsDir & "\Media\chimes.wav" If $Aud=2 Then $auSOUND=@WindowsDir & "\Media\Windows Error.wav" If $Aud=3 Then $auSOUND=@WindowsDir & "\Media\Windows Notify.wav" If $Aud=4 Then $auSOUND=@WindowsDir & "\Media\Windows Ding.wav" If $Aud=5 Then $auSOUND=@WindowsDir & "\Media\Windows User Account Control.wav" If $Aud=6 Then $auSOUND=@WindowsDir & "\Media\Windows Balloon.wav" If $Aud=7 Then $auSOUND=@WindowsDir & "\Media\Windows Default.wav" If $Aud=8 Then $auSOUND=@WindowsDir & "\Media\Windows Exclamation.wav" If $Aud=9 Then $auSOUND=@WindowsDir & "\Media\Windows Navigation Start.wav" You should use If,, elseIf Or a switch case block, otherwise you are making a lot of comparisons that are not needed.
    1 point
  4. funkey

    getaddrinfo timeout

    Hello. Here is the WSAAsyncGetHostByName() function to use with timeout. I tried to make the function as easy as possible. Hope this now works for you. Global Const $AF_INET = 2 Global Const $tagHostent = "ptr h_name;ptr h_aliases;short h_addrtype;short h_length;ptr h_addr_list" Global $WSAAsyncGetHostByName_lParam = 0 TCPStartup() Local $sAddress = "..localmachine" Global $Timeout = 1000 ; 1 second timeout Global $sIP = _WSAAsyncGetHostByName_Timeout($sAddress, $Timeout) If @error Then MsgBox(0, $sAddress, "Error: " & @error) Else MsgBox(0, $sAddress, "IP address: " & $sIP) EndIf TCPShutdown() Func _WSAAsyncGetHostByName_Timeout($sNodeName = "..localmachine", $iTimeout = 0, $hGui = Default, $wMsg = Default) ;funkey 2015.04.13 Local Const $WM_USER = 0x400 Local Const $MAXGETHOSTSTRUCT = 1024 Local $bGuiDelete = False If $wMsg = Default Then $wMsg = $WM_USER + 0x99 If $hGui = Default Then $hGui = GUICreate("_WSAAsyncGetHostByName_Timeout") $bGuiDelete = True EndIf GUIRegisterMsg($wMsg, "_WSAAsyncGetHostByName_Callback") Local $tBuf = DllStructCreate("char buffer[" & $MAXGETHOSTSTRUCT & "]") Local $aRet = DllCall("ws2_32.dll", "HANDLE", "WSAAsyncGetHostByName", "HWND", $hGui, "UINT", $wMsg, "str", $sNodeName, "struct*", $tBuf, "int", $MAXGETHOSTSTRUCT) If $aRet[0] == 0 Then Return SetError(1, 0, 0) Local $IsInTime = False Local $iTimeStart = TimerInit() While 1 If $WSAAsyncGetHostByName_lParam <> 0 Then $IsInTime = True ExitLoop EndIf Sleep(10) If $iTimeout > 0 And TimerDiff($iTimeStart) > $iTimeout Then ExitLoop WEnd If Not $IsInTime Then DllCall("ws2_32.dll", "int", "WSACancelAsyncRequest", "HANDLE", $aRet[0]) $WSAAsyncGetHostByName_lParam = 0 Return SetError(2, 0, 0) EndIf Local $WSAGETASYNCERROR = BitShift($WSAAsyncGetHostByName_lParam, 16) Local $WSAGETASYNCBUFLEN = BitAND($WSAAsyncGetHostByName_lParam, 0xFFFF) $WSAAsyncGetHostByName_lParam = 0 If $WSAGETASYNCERROR Then Return SetError($WSAGETASYNCERROR, $WSAGETASYNCBUFLEN, 0) Local $sIP, $iIP, $tIPs Local $tHostent = DllStructCreate($tagHostent, DllStructGetPtr($tBuf)) Local $ptrList = DllStructGetData($tHostent, "h_addr_list") If $ptrList = 0 Then Return SetError(3, 0, 0) Local $tAddressList = DllStructCreate("ptr", $ptrList) Local $firstAddr = DllStructGetData($tAddressList, 1) If DllStructGetData($tHostent, "h_addrtype") = $AF_INET Then $tIPs = DllStructCreate("UINT", DllStructGetData($tAddressList, 1)) $iIP = DllStructGetData($tIPs, 1) If $iIP = 0 Then Return SetError(4, 0, 0) $sIP = _inet_ntoa($iIP) EndIf Return SetError(0, 0, $sIP) EndFunc ;==>_WSAAsyncGetHostByName_Timeout Func _WSAAsyncGetHostByName_Callback($hWnd, $iMsgID, $wParam, $lParam) $WSAAsyncGetHostByName_lParam = $lParam EndFunc ;==>_WSAAsyncGetHostByName_Callback Func _inet_ntoa($In_Addr) ;only IPv4 (deprecated) --> use _inet_ntop() instead Local $aRet = DllCall("ws2_32.dll", "str", "inet_ntoa", "long", $In_Addr) Return $aRet[0] EndFunc ;==>_inet_ntoa
    1 point
  5. $sPath = 'c:\\ Alo ha\Ciao \XinChao"\Hello' $aPath = stringsplit($sPath , "\" , 2) $sOut = $aPath[0] For $i = 1 to ubound($aPath) - 1 If stringlen($aPath[$i]) > 1 Then $sOut &= "\" & stringregexpreplace(stringstripws($aPath[$i] , 3) , '\\|\/|\:|\*|\?|\"|\<|\>|\||' , "") Next msgbox(0, '' , $sOut) If you want all the rules, i think you may have to bust it up first. At least until a regex wizard shows up. And I was just showing that your stringreplace that handled trailing spaces was unnecessary.
    1 point
  6. $sPath = 'c:\\ Aloha\Ciao \XinChao"\Hello' msgbox(0, '' , stringreplace(stringreplace(stringstripws($sPath , 8) , '"' , "") , "\\" , "\"))
    1 point
  7. More gently said : please post a runnable code
    1 point
  8. And again a new update is out. Please test... -> Also the () should work now. (Again only available via online update)
    1 point
×
×
  • Create New...