Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/15/2016 in all areas

  1. Here some graphical examples written completely in FreeBasic just for fun. _WinAPI_SetWindowTitleIcon Check for Numeric Entry in an EditBox using RegEx CreateWindowEx (hGUI) Example FB 3D Starfield Rotating Flight FB File2Bas Code Generator FB Fire Particles FB Fireworks FB GFX Examples FB Image to Trapezoid Transformation FB Layered Parallax Effect FB Plasma FB Puristic Clock FB Rotating Cube FB Rotating Earth FB Rutt Etra Izer Effect FB Simple Recursive Tree Generator FB Snowfall FB Tunnel Flight FB Water Effect FMOD Examples GDI - GDI+ 3D Sinus Wave GDI - GDI+ Animated Pythagoras Tree GDI - GDI+ Bezier Lines GDI - GDI+ Particles - Repulsive Force Sim v2.0 GDI - GDI+ Plasma v5 Booster GDI - GDI+ Random Pattern GDI - GDI+ Space Flight GDI - GDI+ Tunnel Flight - WipeOut Style GDI Classic Raytraced Tunnel GDI Elastic Twister Effect GDI Exploding Pixels GDI Infinite Image Zoom Flight GDI Liquid Pixels GDI Mandelbrot GDI Particle Repulsion Grid GDI Particles Mouse Attraction GDI Starfield GDI The Nautilus Raymarcher GDI Worm Tunnel Flight GDI+ 3D Starfield Scrolling v1 Booster GDI+ 3D Starfield Scrolling v3 Booster GDI+ Convert Bitmap to ASCII GDI+ GIF Anim to ASCII Player GDI+ Image Painting GDI+ Impossible Possible GDI+ Kaleidoscope GDI+ Performance Test - Au3 vs FB GDI+ Polar Clock GDI+ Rotating Earth GDI+ Spiral Text GDI+ Star Wars Scroller GDI+ Streamer GDI+ Swiss Railway Clock GDI+ The MATRIX Ini Read - Write Rutt_Etra_Izer_Booster Stack TitchySID uFMOD Download: FreeBasic Examples build 2019-05-08.rar I will add new examples from time to time. FreeBasic source codes are also included.
    2 points
  2. Ok, here is what i came up with after 3-4 hours of scripting well ok, it has been long time since then, so... after an year or so of hard scripting/testing!!! (inspired by this topic)... GUICtrlSetOnHover UDF... Syntax: _GUICtrl_OnHoverRegister(ControlID [, OnHoverFunc [, OnLeaveHoverFunc [, PrimaryDownFunc [, PrimaryUpFunc [, KeepCall_PrDn_Func [, KeepCall_Hover_Func]]]]]]) ControlID can be -1 as in Build-In functions! Example: #include "GUICtrlOnHover.au3" Opt("GUIOnEventMode", 1) $Btn_Color = 0x7A9DD8 $Hover_Color = 0xFF0000 ;0x7AC5D8 $GUIMain = GUICreate("Letters Hovering Example", 570, 200) GUISetOnEvent(-3, "Quit") _CreateLetters_Proc(10, 60, 18, 20) GUICtrlCreateButton("Close", 30, 120, 100, 30) GUICtrlSetOnEvent(-1, "Quit") GUICtrlSetFont(GUICtrlCreateLabel("Letter: ", 35, 170, 200, 20), 9, 800) $Status_Label = GUICtrlCreateLabel("", 80, 171, 200, 20) GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetFont(-1, 8.5, 800) GUISetState() While 1 Sleep(100) WEnd Func _CreateLetters_Proc($iLeft, $Top, $Width=15, $Height=15) Local $iLeft_Begin = $iLeft Local $iAsc_Char = 64 For $i = 0 To 25 $iLeft_Begin += 20 $iAsc_Char += 1 GUICtrlCreateButton(Chr($iAsc_Char), $iLeft_Begin, $Top, $Width, $Height) _GUICtrl_OnHoverRegister(-1, "_Hover_Func", "_Leave_Hover_Func") GUICtrlSetOnEvent(-1, "_Letter_Events") GUICtrlSetBkColor(-1, $Btn_Color) GUICtrlSetFont(-1, 6) Next EndFunc Func _Letter_Events() MsgBox(64, "Pressed", "Letter = " & GUICtrlRead(@GUI_CtrlId)) EndFunc Func _Hover_Func($iCtrlID) GUICtrlSetBkColor($iCtrlID, $Hover_Color) GUICtrlSetData($Status_Label, GUICtrlRead($iCtrlID)) Beep(1000, 20) EndFunc Func _Leave_Hover_Func($iCtrlID) GUICtrlSetBkColor($iCtrlID, $Btn_Color) GUICtrlSetData($Status_Label, "") EndFunc Func Quit() Exit EndFunc Attachments: [The archive include few nice examples, and the UDF itself of course .] * New (v2.1) (Redirection to Zip-file, 159 kb) _GUICtrlSetOnHover.html GUICtrlSetOnHover.zip GUICtrlSetOnHover_UDF.au3 GuiCtrlSetOnHover.zip GUICtrlSetOnHover_UDF_For_3.2.10.0.au3 Old Beta - GUICtrlSetOnHover_UDF_beta.zip Enjoy! P.S Thanks to piccaso for the greatest CallBack tool! Without it, this UDF would never been created! ============================================ History version:
    1 point
  3. There was a thread in general support forum the other day about possibility of compiled executable to verify binary integrity of itself when run. I can't find the topic now to link it, but meh never mind. Logical solution is to calculate checksum of the exe and save it somewhere. Later when the executable is run the checksum is calculated again and compared to the saved value. If they match, all is ok, and if they don't the exe was altered and verification fails. The obvious problem is how and where to store the hash value. Alternate data stream seems the simplest solution. That way the hash is bound to the exe only and the risks of unwanted manipulations are relatively low. The problem could be if the exe is saved and run from non-NTFS file systems. Another problem is that any read/write action on exe file usually ends up with ADS being deleted. The other solution is registry writing, but that bounds exe and hash to the system. For another system (or even user) the checking wouldn't be valid. Third solution is using some sort of ini file. But that means ini has to go everywhere exe goes, otherwise again the check wouldn't make sense. And it would be too simple for someone to manipulate data, to the level the check wouldn't make sense. So, this is kind of fourth option. CheckSumVerify2.a3x script below is include file that will calculate the hash of the executable on the first run, save it directly inside that executable using special technique and recheck the hash on every new run. If the new hash wouldn't match the saved one, the script will show message box saying that and further execution will be aborted. CheckSumVerify2.a3x Just to say that I haven't done any complicated tests to see if it would work in outer space, or even on all supported systems. However my guess is it should work. Don't UPX the compiled executables, because I'm calculating checksum of the image on disk and not the one in memory. Here's small example of usage: #include "CheckSumVerify2.a3x" If @Compiled Then MsgBox(64 + 262144, "Aha!", "This is an example exe that does nothing except showing this message." & @CRLF & @CRLF & _ "But if you change the binary of me I will show error message and won't allow further execution." & @CRLF & _ $cmdlineraw) Else MsgBox(64 + 262144, "Hey", "This is an example script that does nothing except showing this message." & @CRLF & @CRLF & _ "But if you compile me I will check binary integrity of the compiled executable every time its run.") EndIf If something wouldn't work, or if you have any questions - simply post here. I'll do my best to answer.
    1 point
  4. czardas

    Roman (Again)

    I wrote this Roman numeral conversion function a while ago, but never got round to writing the reverse function. This is a very simple example aimed more at beginners: sometimes you need a break from trying to figure out the more complicated stuff. I decided to post this mini UDF just in case someone might make use of it. The regexp in the _IsRoman() validation function might also be of interest to some of the more advanced members. Maybe it can be improved. #include-once ; #INDEX# ====================================================================================================================== ; Title .........: Roman ; AutoIt Version : 3.3.14.2 ; Language ......: English ; Description ...: Roman numeral conversion and validation. ; Notes .........: Roman numerals range between 1 and 3999. ; Author(s) .....: czardas ; ============================================================================================================================== ; #CURRENT# ==================================================================================================================== ; _IsRoman ; _Roman ; _RomanToDec ; ============================================================================================================================== ; #FUNCTION# =================================================================================================================== ; Name...........: _IsRoman ; Description ...: Tests if a string is a roman numeral. ; Syntax.........: _IsRoman($sRoman) ; Parameters.....; $sRoman - The string to test. ; Return values .: Returns True or False and sets @error to 1 if the parameter is an empty string. ; Author ........: czardas ; ============================================================================================================================== Func _IsRoman($sRoman) If $sRoman = '' Then Return SetError(1, 0, False) $sRoman = StringRegExpReplace($sRoman, '(?i)(\A)(M{0,3})?(CM|DC{0,3}|CD|C{0,3})?(XC|LX{0,3}|XL|X{0,3})?(IX|VI{0,3}|IV|I{0,3})?', '') Return $sRoman = '' EndFunc ;==>_IsRoman ; #FUNCTION# =================================================================================================================== ; Name...........: _Roman ; Description ...: Converts a decimal integer to a roman numeral. ; Syntax.........: _Roman($iInt) ; Parameters.....; $iInt - The integer to convert. ; Return values .: Returns the integer converted to a Roman numeral. ; Sets @error to 1 and returns an empty string if the integer is out of bounds. ; Author ........: czardas ; ============================================================================================================================== Func _Roman($iInt) If Not StringIsInt($iInt) Or $iInt > 3999 Or $iInt < 1 Then Return SetError(1, 0, "") $iInt = Int($iInt) ; in case the string contains leading zeros Local $aNumeral[10][4] = _ [["","","",""], _ ["M","C","X","I"], _ ["MM","CC","XX","II"], _ ["MMM","CCC","XXX","III"], _ ["","CD","XL","IV"], _ ["","D","L","V"], _ ["","DC","LX","VI"], _ ["","DCC","LXX","VII"], _ ["","DCCC","LXXX","VIII"], _ ["","CM","XC","IX"]] Local $iOffset = StringLen($iInt) -4, $sRoman = "", $aDecimal = StringSplit($iInt, "", 2) For $i = 0 To UBound($aDecimal) -1 $sRoman &= $aNumeral[$aDecimal[$i]][$i -$iOffset] Next Return $sRoman EndFunc ;==>_Roman ; #FUNCTION# =================================================================================================================== ; Name...........: _RomanToDec ; Description ...: Converts a roman numeral to a decimal integer. ; Syntax.........: _RomanToDec($sRoman) ; Parameters.....; $sRoman - The Roman numeral to convert. ; Return values .: Returns the Roman numeral converted to an integer. ; Sets @error to 1 and returns an empty string if the Roman numeral is invalid. ; Author ........: czardas ; ============================================================================================================================== Func _RomanToDec($sRoman) If Not _IsRoman($sRoman) Then Return SetError(1, 0, '') Local $aChar = StringSplit($sRoman, '') For $i = 1 To $aChar[0] Switch $aChar[$i] Case 'I' $aChar[$i] = 1 Case 'V' $aChar[$i] = 5 Case 'X' $aChar[$i] = 10 Case 'L' $aChar[$i] = 50 Case 'C' $aChar[$i] = 100 Case 'D' $aChar[$i] = 500 Case 'M' $aChar[$i] = 1000 EndSwitch Next Local $iCount = 0, $iCurr, $iNext For $i = 1 To $aChar[0] $iCurr = $aChar[$i] If $i < $aChar[0] Then $iNext = $aChar[$i +1] If $iNext > $iCurr Then $iCurr = $iNext - $iCurr $i += 1 ; skip the next element EndIf EndIf $iCount += $iCurr Next Return $iCount EndFunc ;==>_RomanToDec Simple Demo #include <Array.au3> #include 'Roman.au3' Local $aRoman[4000] = [3999] For $i = 1 To 3999 $aRoman[$i] = _Roman($i) Next _ArrayShuffle($aRoman, 1) ; shuffle the array starting from Row 1 _ArrayDisplay($aRoman, "Shuffled") RomanSort($aRoman, 1) ; sort the roman numerals by size _ArrayDisplay($aRoman, "Sorted") Func RomanSort(ByRef $aArray, $iStart = Default, $iStop = Default) If Not IsArray($aArray) Or UBound($aArray, 0) <> 1 Then Return SetError(1) ; simple 1D array demo $iStart = ($iStart = Default ? 0 : Int($iStart)) $iStop = ($iStop = Default ? UBound($aArray) -1 : Int($iStop)) If $iStart < 0 Or $iStart > $iStop Or $iStop > UBound($aArray) -1 Then Return SetError(2) ; out of bounds For $i = $iStart To $iStop If Not _IsRoman($aArray[$i]) Then Return SetError(3) ; Roman numerals only [other solutions are beyond the scope of this simple demo] $aArray[$i] = _RomanToDec($aArray[$i]) ; convert to decimal Next _ArraySort($aArray, 0, $iStart, $iStop) ; sort integers For $i = $iStart To $iStop $aArray[$i] = _Roman($aArray[$i]) ; convert back to Roman numerals Next EndFunc ;==> RomanSort
    1 point
  5. When i try to run your code it always fails. Also the JSON object returns 'undefined' when i try to extract it with eval like below: MsgBox(0, "", $ohJS.eval("typeof JSON")) I hate to sound like a broken record, but why "Shell.Explorer.2" and not "ScriptControl"? Some requirements IE is better suited for in your scenario? Edit: Here's an example: $oSC = ObjCreate("ScriptControl") $oSC.Language = "JScript" $oSC.AddCode(BinaryToString(InetRead("https://raw.githubusercontent.com/douglascrockford/JSON-js/master/json2.js"))) $oSC.Eval("Array.prototype.Item = function(i){return this[i];}"); enable fetching of array item with Array.Item function $myArray = $oSC.Eval('["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]') For $i=0 To $myArray.length-1 ConsoleWrite( $myArray.Item($i) & @CRLF ) Next MsgBox(0, "", $oSC.Eval("JSON").stringify($myArray))
    1 point
  6. The last comment in link is a code example with Bluetooth calls. Just to give you a starting point here's the code extracted from Christoph54 on autoit.de: #include <WinAPI.au3> Local $phRadio $hFind = _BluetoothFindFirstRadio($phRadio) If $hFind = 0 Then MsgBox(16, "Hardware error", "Unable to find compatible bluetooth radio(s) on this machine.") _WinAPI_CloseHandle($phRadio) _BluetoothFindRadioClose($hFind) Exit Else _WinAPI_CloseHandle($phRadio) _BluetoothFindRadioClose($hFind) EndIf _BluetoothFindFirstDevice() Sleep(10000) _BluetoothRegisterForAuthenticationEx() Func _BluetoothFindFirstDevice($REMEMBER = False) Local $HRESULT[3], $tBLUETOOTH_DEVICE_INFO $tBLUETOOTH_DEVICE_SEARCH_PARAMS = DllStructCreate('DWORD;BOOL;BOOL;BOOL;BOOL;BOOL;BYTE;HANDLE') DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 1, DllStructGetSize($tBLUETOOTH_DEVICE_SEARCH_PARAMS)) DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 2, False) DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 3, $REMEMBER) DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 4, True) DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 5, True) DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 6, True) DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 7, 6) DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 8, 0) $tBLUETOOTH_DEVICE_INFO = DllStructCreate('DWORD;UINT64;ULONG;BOOL;BOOL;BOOL;word[8];word[8];WCHAR[248]') DllStructSetData($tBLUETOOTH_DEVICE_INFO, 1, DllStructGetSize($tBLUETOOTH_DEVICE_INFO)) $RESULT = DllCall("bthprops.cpl", "handle", "BluetoothFindFirstDevice", "struct*", $tBLUETOOTH_DEVICE_SEARCH_PARAMS, "struct*", $tBLUETOOTH_DEVICE_INFO) $HRESULT[0] = DllStructGetData($tBLUETOOTH_DEVICE_INFO, 9) $HRESULT[1] = DllStructGetData($tBLUETOOTH_DEVICE_INFO, 2) $HRESULT[2] = DllStructGetData($tBLUETOOTH_DEVICE_INFO, 3) Do $ULTRA = _BluetoothFindNextDevice($RESULT[0]) Until $ULTRA = "0" Return $HRESULT EndFunc ;==>_BluetoothFindFirstDevice Func _BluetoothFindFirstRadio(ByRef $phRadio) $tBLUETOOTH_FIND_RADIO_PARAMS = DllStructCreate('DWORD') DllStructSetData($tBLUETOOTH_FIND_RADIO_PARAMS, 1, DllStructGetSize($tBLUETOOTH_FIND_RADIO_PARAMS)) $aResult = DllCall("bthprops.cpl", "handle", "BluetoothFindFirstRadio", "struct*", $tBLUETOOTH_FIND_RADIO_PARAMS, "handle*", 0) If @error Then Return SetError(2, @error, 0) $phRadio = $aResult[2] Return SetError($aResult[0] = 0, 0, $aResult[0]) EndFunc ;==>_BluetoothFindFirstRadio Func _BluetoothFindRadioClose($hBtFind) Local $aResult = DllCall("bthprops.cpl", "bool", "BluetoothFindRadioClose", "handle", $hBtFind) If @error Then Return SetError(2, @error, 0) Return SetError($aResult[0] = 0, 0, $aResult[0]) EndFunc ;==>_BluetoothFindRadioClose Func _BluetoothFindNextDevice($HANDLE) $t1BLUETOOTH_DEVICE_INFO = DllStructCreate('DWORD;UINT64;ULONG;BOOL;BOOL;BOOL;word[8];word[8];WCHAR[248]') $RESULTX = DllCall("bthprops.cpl", "Bool", "BluetoothFindNextDevice", "handle", $HANDLE, "struct*", $t1BLUETOOTH_DEVICE_INFO) Return $RESULTX[0] EndFunc ;==>_BluetoothFindNextDevice Func _BluetoothRegisterForAuthenticationEx() Local $ZRESULT, $tBLUETOOTH_DEVICE_REG $tBLUETOOTH_DEVICE_REG = DllStructCreate('DWORD;UINT64;ULONG;BOOL;BOOL;BOOL;word[8];word[8];WCHAR[248]') DllStructSetData($tBLUETOOTH_DEVICE_REG, 1, DllStructGetSize($tBLUETOOTH_DEVICE_REG)) DllStructSetData($tBLUETOOTH_DEVICE_REG, 2, 560) DllStructSetData($tBLUETOOTH_DEVICE_REG, 3, 550377916751) DllStructSetData($tBLUETOOTH_DEVICE_REG, 4, 9600) DllStructSetData($tBLUETOOTH_DEVICE_REG, 5, False) DllStructSetData($tBLUETOOTH_DEVICE_REG, 6, False) DllStructSetData($tBLUETOOTH_DEVICE_REG, 7, False) $ZRESULT = DllCall("bthprops.cpl", "handle", "BluetoothRegisterForAuthenticationEx", "struct*", $tBLUETOOTH_DEVICE_REG, "handle*", 0) Return $ZRESULT EndFunc ;==>_BluetoothRegisterForAuthenticationEx
    1 point
  7. Look for unatentded instalation switches
    1 point
  8. 1 point
  9. @youtuber you have been around long enough now to know the forum etiquette; please do not bump your threads without waiting 24 hours. Everyone wants their answer right now, but you need to show a bit of patience.
    1 point
  10. Hello. Does diskpart work in your MiniXP Os? Let me know if this works #include <Array.au3> Local $aDisk = _GetDiskName() _ArrayDisplay($aDisk) Func _GetDiskName() Local $iCount = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\disk\Enum", "Count") Local $sDiskKey = "" Local $sDiskName = "" Local $aDisk[$iCount] For $i = 1 To $iCount $sDiskKey = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\disk\Enum", String($i - 1)) $sDiskName = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\" & $sDiskKey, "FriendlyName") If $sDiskName="" Then $sDiskName=RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\" & $sDiskKey, "DeviceDesc") $aDisk[$i - 1] = $sDiskName Next Return $aDisk EndFunc ;==>_GetDiskName Saludos
    1 point
  11. Does it work for you? Saludos
    1 point
  12. Beege

    Flicker Free Labels

    Version 1.6 Lately I have been working on my and the demo GUI for it has a lot labels that get updated frequently and really ends up looking like shit when all your labels are flickering. I put this UDF together trying to go by the same format as native GUICtrlCreateLabel(), this way I can go back to previous guis and swap with new Flicker Free Labels. As always feedback is welcome and let me know if you have and problems. Thanks for looking. Update 6-27 So recently I learned that the stringformat of the GDI+ labels we are creating do not have equal character spaceing and also are not excepting tab keys. This was a nightmare for me and is still being one. I found a good artical here that helped a little but not completely. At the bottom of the page it talks about displaying adjacent text and recomends using GenericTypographic stringformat. I tried it and It is allowing tab keys, but now the align stopped working. And for the life of me I could never figure out how to set all characters to have equal widths, and also a blank space " " measure out to the same width as a char. So if someone knows how plz let me know. For the time being I have the udf using the method that allows tabs(mainly cause of this example I want to show), but I left the orginal stringformat call commented out so if you need your labels aligned center, left, right just uncomment it and comment out the GenericTypographic call. Its located in _GuiCtrlFFLabel_Create(). Some other Benefits Now I want to go over a couple benifits that the non flickering labels could extend to you that didnt nessasarly jump right out at u at first. To start with lets go over static labels. Majority of the time that you have some data you want to display you will want a it to have a title. The longer your string is the more obvios the flicker becomes so breaking that label up into two lables Title: Data, can reduce flicker significatly. Now I cant sit hear and say that they are getting broke up soley because of flicker cause thats just not always true, but I can definatly say that they are not being left together because of flicker. Having no flicker we can leave the title and data as one if we want. And we dont have to stop there because string length dosnt matter now. We can just as easily put 3 or 4 labels into one if we want reducing are code even more. take a look at the size difference in the examples. Easier GUI layout was also a benifit (at least for me) that I didnt think of till recenty. I know plenty of people like to layout there GUI manually. Theres also people that would like to but just arnt good at it. Im one of them. I always end wasting to much time starting, adjusting, starting etc.. I love koda, but it can also gobble up my time. The example shows another option. By making all the labels the full width of the GUI, I can then use tabs and StringFormat() to aliagn all my labels. The only coordinates I have to work with is y, the vertical distance between the labels making it no big deal. Example: UDF: Source: FFLabels.zip Update 12/06/11 Added option for NO alignment to text. Need if using tabs Update 6/27/11 Added _GUICtrlFFLabel_Move() Changed color parameters. Any function that excepts ARGB will also except RGB Problem found with character width. Update 6/21/11 Added function to establish default background color (Thanks MrCreatoR) Added Delete function and changed function names (Thanks MrCreatoR) changed default color values so -1 and 0 (black and white) can be used as parameters fixed delete problem again. SetData function was not checking if item was deleted. if you try writing to deleted label like example does nothing should happen Update 6/24/11 Added ability to add Labels to multiple GUI's Labels will now automatically refresh themselves when needed Added new functions _GUICtrlFFLabel_GUISetBkColor (Thanks MrCreatoR) , _GUICtrlFFLabel_SetTextColor Labels will not be redraw if window is minimized. This can save quite a bit of CPU usage. Watch CPU% drop if minimized during examples
    1 point
×
×
  • Create New...