-
Posts
1,487 -
Joined
-
Last visited
-
Days Won
3
Reputation Activity
-
PhoenixXL got a reaction from kemo1987 in Database UDF
Hey Every 1
When I was a Beginner I always had a Hard Time to Understand the SQLite
I have made a UDF for SQLite so that Beginners Would Also Be Able to Do the Stuff .
Much Of Description is Given in the UDF.
To Understand Read It.
For Advanced Users it may not be sooo goood But Then Also Have a Look .
Thumbs Up if it Helped..
The UDF is Attached for Download..
N herez the Index
#region -Functions For User- ;_Insert ;_Update ;_Delete ;_FetchData ;_LoadDatabase ;_UnLoadDatabase ;_Cryptor #endregion -Functions For User- #region -Internal Functions- ;_DefaultAnalyser() #endregion -Internal Functions-
1 more Request
If You Use the Script Please Reply me of any Bugs or any Further Modifications for Betterment...
The UDF
v0.3 Database.7z
[Previous Downloads : 388]
Regards
Phoenix XL
-
PhoenixXL got a reaction from Zarion in Runas System
I tried to run an app under LSA
using impersonate user, Runas Func and much more
but nothing helped
finally i found how to go ahead
Herez the script for anyone having the same problem
As per the License
Q: How many copies of Sysinternals utilities may I freely load or use on computers owned by my company?
A: There is no limit to the number of times you may install and use the software on your devices or those you support.
Installation and use will not cause any violation of the License
#NoTrayIcon #include-once Opt("MustDeclareVars", 1) _Runas_SYSTEM('notepad.exe', '-heya') ;$sRunProgramAsSystem : The Program which has to be run under LSA ;$sParams : The parameters which have to be passed to the specific program ;$sSession : if the program is GUI based then the Session should be the Current Session Usually 1 , if null Console Session is used ;$sPriority : -low, -belownormal, -abovenormal, -high, -background or -realtime Func _Runas_SYSTEM($sRunProgramAsSystem, $sParams = '', $sSession = 1, $sPriority = '-abovenormal'); Your Program Goes here. Local $sPath = @ScriptDir & '\PsExec.exe' If Not FileExists($sPath) Then MsgBox(16, 'Error', 'Please download the PsExec.exe from the upcoming site') ShellExecute('http://technet.microsoft.com/en-us/sysinternals/bb897553') Return SetError(1, 0, -1) EndIf If $sParams Then $sParams = ' ' & $sParams Local $aResult = ShellExecuteWait($sPath, '-i ' & $sSession & ' ' & $sPriority & ' -d -s -h "' & $sRunProgramAsSystem & '"' & $sParams, @SystemDir, 'open', @SW_HIDE) If @error Then ConsoleWrite('! > Error Occured Error Code: ' & @error) Return $aResult EndFunc ;==>_Runas_SYSTEM Regards
Phoenix XL
-
PhoenixXL got a reaction from dustinisgod in Can you make a GUI always on top but not focusable? (Toast like)
This will satisfy
#include <WindowsConstants.au3> #include <WinAPI.au3> #include <GuiListBox.au3> #include <ScrollBarConstants.au3> #include <Misc.au3> Global Const $WS_EX_NOACTIVATE = 0x08000000 GUICreate("", 300, 400, -1, -1, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_NOACTIVATE)) GUISetBkColor(0xC0CCFF) Global $iExit = GUICtrlCreateButton("Exit", 10, 10) GUISetState(@SW_SHOWNOACTIVATE) Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $iExit ExitLoop Case $GUI_EVENT_PRIMARYDOWN ConsoleWrite("Mouse Down over GUI" & @CRLF) EndSwitch Until 0 Note: with WS_EX_NOACTIVATE there would be no taskbar icon. You have to Or the ex-style with WS_EX_APPWINDOW to make it appear on taskbar. But be aware that clicking the taskbar icon would make the window active
Thumbs up if it helped.
Regards
-
PhoenixXL got a reaction from Inpho in Predict Text for an Edit Control _PredictText.au3 (UDF)
Predict Text UDF
Working
It sub classes the edit control and matches the current word through the Database
& sets selection in accordance.
Functions
Predicts Text from an User-Defined Database. Sets the Predicted Text when Enter is pressed. * Pressing Backspace deletes the current selection. Support Editing, Overwriting, Updating, Deleting the List. Has the Feature to add New words the user types in the control, to the List. Supports Sensitive and In-Sensitive Prediction. Supports Auto-completion and Auto-Suggestion. Edit and Input controls supported >Support RichEdit Controls. Automatically limit the New Words. Supports Phrase (Post-Space) Prediction Future Updates
Support Auto-suggestion. [Coming soon]Done Note That if you set a Password Char for the Edit Box the Prediction will automatically get Unregistered.
* Enter is supported Only in Edit Controls.
For Input Control the user can use GuiSetAccelerators [Thanks to M23].Check Example 3
; #CURRENT# ===================================================================================================================== ;_RegisterPrediction ;_UpdatePredictList ;_UnRegisterPrediction ;_RegisterListingSpaceWords ;_RegisterListingNewWords ;_GetSelectedText ;_GetListCount ;_GetCurrentWord ;_GetCaretOffset ; SetSuggestion_Dimensions ; =============================================================================================================================== ; #INTERNAL_USE_ONLY# =========================================================================================================== ;_New_WndProc ; AddToArray ; MakeArray ;_Edit_SubClass ;_AutoExit ;_PredictText ;_GetSpaceText ;_SetSelection ;_CtrlSetStyle ;_CtrlGetStyle ;_RemoveBit ; GetLineHeight ; Suggest_Show ; Suggest_PopuplateItems ; Suggest_SetPos ; =============================================================================================================================== Screen Shots
Example 1 - Multiple Edits and Basic Functionality
Example 2 - Adding New Words
Example 3 - Password Char & Input Controls
Example 4 - Supports Post-Space Prediction
Example 5 - AutoSuggestion
Please Notify for any other Updates and Bugs.
ChangeLog
V1.0
-First Release
V1.1
-Now Supports New Words added by Pressing Enter
-Supports Input Controls for Enter Key [Thanks to M23]
V1.2
-Now Supports Prediction after Space
-New Words are now Automatically Limited
V1.3
-Converted to Iterative
-Now is more faster
V1.4
-Rewritten the UDF with Regular expressions.
-Added support for Auto-Suggestion
-Bug for incorrect insertion when inbetween typing is now cleared
V1.5
-Fixed the bug for which MouseMove wasn't detected.
V1.6
-Fixed: Scroll Bar unaccessible.
-Fixed: Suggestion doesn't hide when space is typed in non-space text suggestion.
V1.7
-Changed: Searching is now done with regular expressions. Lot of speed is increased.
PredictText V1.7
v1.7 PredictText(UDF).7z
Previous Downloads: 890
Regards
Phoenix XL
-
PhoenixXL got a reaction from Professor_Bernd in Regular expression, strip quoted string literals
Almost the same
#include <Constants.au3> Local $sData = FileRead(@ScriptFullPath) $sData = StringRegExpReplace($sData, "([""']).*?\1", "") MsgBox($MB_SYSTEMMODAL, '', $sData)Have a look
Check the function to strip the Comments and Strings
Regards
-
PhoenixXL got a reaction from JoeBar in Predict Text for an Edit Control _PredictText.au3 (UDF)
Predict Text UDF
Working
It sub classes the edit control and matches the current word through the Database
& sets selection in accordance.
Functions
Predicts Text from an User-Defined Database. Sets the Predicted Text when Enter is pressed. * Pressing Backspace deletes the current selection. Support Editing, Overwriting, Updating, Deleting the List. Has the Feature to add New words the user types in the control, to the List. Supports Sensitive and In-Sensitive Prediction. Supports Auto-completion and Auto-Suggestion. Edit and Input controls supported >Support RichEdit Controls. Automatically limit the New Words. Supports Phrase (Post-Space) Prediction Future Updates
Support Auto-suggestion. [Coming soon]Done Note That if you set a Password Char for the Edit Box the Prediction will automatically get Unregistered.
* Enter is supported Only in Edit Controls.
For Input Control the user can use GuiSetAccelerators [Thanks to M23].Check Example 3
; #CURRENT# ===================================================================================================================== ;_RegisterPrediction ;_UpdatePredictList ;_UnRegisterPrediction ;_RegisterListingSpaceWords ;_RegisterListingNewWords ;_GetSelectedText ;_GetListCount ;_GetCurrentWord ;_GetCaretOffset ; SetSuggestion_Dimensions ; =============================================================================================================================== ; #INTERNAL_USE_ONLY# =========================================================================================================== ;_New_WndProc ; AddToArray ; MakeArray ;_Edit_SubClass ;_AutoExit ;_PredictText ;_GetSpaceText ;_SetSelection ;_CtrlSetStyle ;_CtrlGetStyle ;_RemoveBit ; GetLineHeight ; Suggest_Show ; Suggest_PopuplateItems ; Suggest_SetPos ; =============================================================================================================================== Screen Shots
Example 1 - Multiple Edits and Basic Functionality
Example 2 - Adding New Words
Example 3 - Password Char & Input Controls
Example 4 - Supports Post-Space Prediction
Example 5 - AutoSuggestion
Please Notify for any other Updates and Bugs.
ChangeLog
V1.0
-First Release
V1.1
-Now Supports New Words added by Pressing Enter
-Supports Input Controls for Enter Key [Thanks to M23]
V1.2
-Now Supports Prediction after Space
-New Words are now Automatically Limited
V1.3
-Converted to Iterative
-Now is more faster
V1.4
-Rewritten the UDF with Regular expressions.
-Added support for Auto-Suggestion
-Bug for incorrect insertion when inbetween typing is now cleared
V1.5
-Fixed the bug for which MouseMove wasn't detected.
V1.6
-Fixed: Scroll Bar unaccessible.
-Fixed: Suggestion doesn't hide when space is typed in non-space text suggestion.
V1.7
-Changed: Searching is now done with regular expressions. Lot of speed is increased.
PredictText V1.7
v1.7 PredictText(UDF).7z
Previous Downloads: 890
Regards
Phoenix XL
-
PhoenixXL got a reaction from PoojaKrishna in Test url if is valid
Example
$sURL = "http://test/21-04-2014" InetGetSize($sURL) If @error Then ConsoleWrite("Invalid URL" & @CRLF) Else ConsoleWrite("Valid URL" & @CRLF) EndIf Regards
Phoenix XL
-
PhoenixXL got a reaction from El-Masry in Receive Enter from Edit
I want to receive when Enter is pressed within the Edit control
for it i used a KeyHook
But,
If the edit control didn't had the $ES_WANTRETURN style then it eats up the Enter pressed
whereas if it has $ES_WANTRETURN then always a @CR is inserted
With the following code the Edit is not created with $ES_WANTRETURN therefore enter isnt detected,
Just place a $ES_WANTRETURN and then the code works
#include-once #include <WindowsConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WINAPI.au3> Global $Edit_Handle Global $Func_Name Global $_KeyPressed=0 Local $_hStub_KeyProc = DllCallbackRegister("_KeyProc", "long", "int;wparam;lparam") Local $_hmod = _WinAPI_GetModuleHandle(0) Local $_hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($_hStub_KeyProc), $_hmod) OnAutoItExitRegister("_OnAutoItExit") Func _KeyProc($nCode, $wParam, $lParam) Local $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam) If $nCode < 0 Then Return _WinAPI_CallNextHookEx($_hHook, $nCode, $wParam, $lParam) EndIf If $wParam = $WM_KEYDOWN Or $wParam=$WM_KEYUP Then $vkKey = DllStructGetData($tKEYHOOKS, "vkCode") $_KeyPressed=$vkKey EndIf Return _WinAPI_CallNextHookEx($_hHook, $nCode, $wParam, $lParam) EndFunc Func _OnAutoItExit() _WinAPI_UnhookWindowsHookEx($_hHook) DllCallbackFree($_hStub_KeyProc) EndFunc Local $GUi=GUICreate('Predict Text - Phoenix XL') Local $Edit=GUICtrlCreateEdit('',10,10,400-20,300,BitOR($WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL)) ; If $ES_WANTRETURN is used then Enter is Detected But @CR is automatically inserted Local $_Words[3]=['Hello','Abhishek','Now & Then'] $Edit_Handle=GUICtrlGetHandle($Edit) GUIRegisterMsg($WM_COMMAND,'WM_COMMAND') GUISetState() Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg Local $iCode, $hWndEdit , $IDFrom $iCode = BitShift($iwParam, 16) $IDFrom= BitAND($iwParam, 0xFFFF) Switch $ilParam Case $Edit_Handle Switch $iCode Case $EN_CHANGE ;Sent when the user has taken an action that may have altered text in an edit control Switch $_KeyPressed Case 13 ;Enter ConsoleWrite('Enter Pressed'&@CR) Case 8 ;BackSpace ConsoleWrite('BackSpace Pressed'&@CR) EndSwitch EndSwitch EndSwitch Return Call($Func_Name,$hWnd, $iMsg, $iwParam, $ilParam) EndFunc ;==>WM_COMMAND While GUIGetMsg()<>-3 Sleep(10) WEnd
I just wanted to detect when the enter is pressed inside the Edit control without the Carriage Return
Please help me
thanks for your time and help
-
PhoenixXL got a reaction from mLipok in ClipBoard Extendor
Hey I just made a more Better Way for ClipBoard Monitoring
I havent added the save and send Functions
Its very Easy Ahead to Modify
#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: Zedna Modified: Phoenix XL Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <GUIConstants.au3> #include <WindowsConstants.au3> Global $origHWND,$lastCopied='',$WM_CLIPUPDATE=0x031D,$DefMsG='__•¯¯' $gui = GUICreate("Clip Hook",400,400,-1,-1,BitOR($WS_CAPTION,$WS_SYSMENU)) Global $label=GUICtrlCreateLabel('Clipboard Contains',30,30,340,30) Global $label1=GUICtrlCreateEdit('Clipboard Contains',30,80,340,210) ; remember last clip viewer in queue and set our GUI as first in queue $origHWND = DLLCall("user32.dll","int","AddClipboardFormatListener","hwnd",$gui) $origHWND = $origHWND[0] GUIRegisterMsg($WM_CLIPUPDATE,"OnClipBoardChange") WinSetOnTop($gui,'',1) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Exit Func OnClipBoardChange($hWnd, $Msg, $wParam, $lParam) ; do what you need when clipboard changes _write(ClipGet()) EndFunc Func _write($data) If $data<>$lastCopied Then $lastCopied=$data Return GUICtrlSetData($label1,$data) Else Return $DefMsG EndIf EndFunc -
PhoenixXL got a reaction from mLipok in Monitoring clipboard?
Hey !! I added a Format Listener Instead of a ClipBoardViewer Windows
Its a bit less complicated coz there is no need of the maintenance of the Chains.....
Here is the code
#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: Zedna (Modified By Me) Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <GUIConstants.au3> #include <WindowsConstants.au3> Global $origHWND,$lastCopied='',$WM_CLIPUPDATE=0x031D,$DefMsG='__•¯¯' $gui = GUICreate("Clip Hook",400,400,-1,-1,BitOR($WS_CAPTION,$WS_SYSMENU)) Global $label=GUICtrlCreateLabel('Clipboard Contains',30,30,340,30) Global $label1=GUICtrlCreateEdit('Clipboard Contains',30,80,340,210) ; remember last clip viewer in queue and set our GUI as first in queue $origHWND = DLLCall("user32.dll","int","AddClipboardFormatListener","hwnd",$gui) $origHWND = $origHWND[0] GUIRegisterMsg($WM_CLIPUPDATE,"OnClipBoardChange") WinSetOnTop($gui,'',1) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Exit Func OnClipBoardChange($hWnd, $Msg, $wParam, $lParam) ; do what you need when clipboard changes _write(ClipGet()) EndFunc Func _write($data) If $data<>$lastCopied Then $lastCopied=$data Return GUICtrlSetData($label1,$data) Else Return $DefMsG EndIf EndFunc -
PhoenixXL got a reaction from Skysnake in RestrictEdit_SRE (UDF)
mLipok,
with the new version your example could be modified as follows (three regexes)
#include <GUIConstants.au3> #include <RestrictEdit.au3) #include <MsgBoxConstants.au3> #cs [0]|m121/12, [1]|1231/12, [2]|p1/12, [3]|2/13, [4]|s1/14, [5]|o121/10 #ce _Main() Func _Main() #cs Pattern in text that should follow the first character can be any of 'm' 'p' 's' 'o' 'n' or a no. of digits followed by a "/" and then followed by two digits. Then if comma again the above pattern is expected otherwise, if EOL the pattern is satisfied. #ce ;our main GUI GUICreate("Restrict Edit | Phoenix XL", 200, 70) GUICtrlCreateLabel("Test", 10, 10, 200, 30) GUICtrlCreateInput("", 10, 30, 180, 20) ;subclass the control and set the SRE restriction. _Restrict_Edit(GUICtrlGetHandle(-1), SRE_Array, "InCorrect Syntax.") If @error Then MsgBox($MB_ICONERROR, "Error Code: " & @error, "Extended: " & @extended) GUISetState() Do Sleep(10) Until GUIGetMsg() = $GUI_EVENT_CLOSE ;unsubclass the control _Restrict_Edit(GUICtrlGetHandle(-1)) EndFunc ;==>_Main Func SRE_Array($hEdit, $s_CurrentText) ;return an non-array non zero to block processing ;return zero to block restriction Local $aPatterns[3][2] = [ _ ["(^|(?<=/\d{2}),)[mpson]?\d*(/|$)", True], _ ;here True signifies +ve match, the string should match the pattern ["((\D)\2|/\d{3}|/\d?\D|/\d{2}[^,]|(?<=\D)/)", False], _ ;here False signifies -ve match, the string should NOT match the pattern ["[^mpson\d,/]", False]] ;Lets decode the above patterns #cs First Pattern +ve match 1st Capturing group (^|(?<=/\d{2}),) : by start of string or comma( that too should be preceeded by a slash and two digits [look-behind assertion]) [mpson]? : if present should be preceeded by 1st capturing group. \d* : any no. of digits 2nd Capturing group ((/|$) : Either the end of the string, or a slash If the above pattern is not satisfied, processing is blocked. Second Pattern -ve match 1st Capturing group ((\D)\2|/\d{3}|/\d?\D|/\d{2}[^,]) : consists of five different patterns nested. When either of the three is satisfied the pattern is matched 1st NestedPattern (\D)\2 : second capturing group, the first char is any non-digit, the second char is the same non-digit 2nd NestedPattern /\d{3} : after slash three digits are present. 3rd NestedPattern /\d?\D : after slash a non-digit is there or after slash a digit and then a non digit is present 4th NestedPattern /\d{2}[^,] : after slash two digits and anything other than comma is present. 5th NestedPattern (?<=\D)/ : slash preceeded by any non-digit If the above pattern is satisfied, processing is blocked. Third Pattern -ve match [^mpson\d,/] : match anything other than m p s o n digit , / if the above is satisfied, processing is blocked #ce ;You can also block processing using this function. ;Say you don't want characters to exceed 20 then If StringLen($s_CurrentText) > 20 Then Return 1 Return $aPatterns EndFunc ;==>SRE_Array Though the straight away method is more simple and better conceptualized with nested conditionals, it modifies as follows
#include <GUIConstants.au3> #include <RestrictEdit.au3> #include <MsgBoxConstants.au3> #cs [0]|m121/12, [1]|1231/12, [2]|p1/12, [3]|2/13, [4]|s1/14, [5]|o121/10 #ce _Main() Func _Main() #cs Pattern in text that should follow the first character can be any of 'm' 'p' 's' 'o' 'n' or a no. of digits followed by a "/" and then followed by two digits. Then if comma again the above pattern is expected otherwise, if EOL the pattern is satisfied. #ce ;our main GUI GUICreate("Restrict Edit | Phoenix XL", 200, 70) GUICtrlCreateLabel("Test", 10, 10, 200, 30) GUICtrlCreateInput("", 10, 30, 180, 20) ;subclass the control and set the SRE restriction. _Restrict_Edit(GUICtrlGetHandle(-1), SRE_Array, "InCorrect Syntax.") If @error Then MsgBox($MB_ICONERROR, "Error Code: " & @error, "Extended: " & @extended) GUISetState() Do Sleep(10) Until GUIGetMsg() = $GUI_EVENT_CLOSE ;unsubclass the control _Restrict_Edit(GUICtrlGetHandle(-1)) EndFunc ;==>_Main Func SRE_Array($hEdit, $s_CurrentText) ;return an non-array non zero to block processing ;return zero to block restriction Local $aPatterns[1][2] = [ ["^([mpson]?(?(?=\d+)\d+(?(?=/)/(?(?=\d)\d{0,2}(,|$)|$)|$)|$))*$", True]] Return $aPatterns EndFunc ;==>SRE_Array Regards
Phoenix XL
-
PhoenixXL got a reaction from nybegblya in why cant i drag my gui?
Have a look - Stopwatch stops when the user starts dragging
#include <SendMessage.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Date.au3> ;better to declare Globals outside the script Global $iLabel, $iHour, $iMin, $iSec, $iTimer Global Const $SC_DRAGMOVE = 0xF012 timer() Func timer() Local $iWidth = 200, $iHeight = 60 Local $hWin = GUICreate('', $iWidth, $iHeight, -1, -1, BitOR($WS_POPUP, $WS_BORDER), $WS_EX_TOPMOST) GUISetBkColor(0x000000) WinSetTrans($hWin, "", 170) GUICtrlCreateGroup('', 0, -5, $iWidth, $iHeight + 5, $WS_THICKFRAME) GUICtrlCreateGroup('', -99, -99, 1, 1) $iLabel = GUICtrlCreateLabel("00:00:00", 5, 0, 190, 60, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 20, 700, 2, "DINPro-Regular") GUICtrlSetColor(-1, 0x00FF00) GUISetState() ;we can create a better neat and short stopwatch using Timers. $iTimer = TimerInit() AdlibRegister("_UpdateStopWatch", 1000) Do Sleep(10) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_PRIMARYDOWN _SendMessage($hWin, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndSwitch Until $nMsg = $GUI_EVENT_CLOSE AdlibUnRegister("_UpdateStopWatch") EndFunc ;==>timer ; call back function Func _UpdateStopWatch() _TicksToTime(TimerDiff($iTimer), $iHour, $iMin, $iSec) GUICtrlSetData($iLabel, StringFormat("%02d:%02d:%02d",$iHour , $iMin , $iSec)) EndFunc ;==>_UpdateStopWatch To enable the update process simultaneously with that of the drag we would have to use timer associated with the current window, since Autoit is single threaded
#include <SendMessage.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Date.au3> #include <Timers.au3> ;better to declare Globals outside the script Global $iLabel, $iHour, $iMin, $iSec, $iTimer Global Const $SC_DRAGMOVE = 0xF012 timer() Func timer() Local $iWidth = 200, $iHeight = 60 Local $hWin = GUICreate('', $iWidth, $iHeight, -1, -1, BitOR($WS_POPUP, $WS_BORDER), $WS_EX_TOPMOST) GUISetBkColor(0x000000) WinSetTrans($hWin, "", 170) GUICtrlCreateGroup('', 0, -5, $iWidth, $iHeight + 5, $WS_THICKFRAME) GUICtrlCreateGroup('', -99, -99, 1, 1) $iLabel = GUICtrlCreateLabel("00:00:00", 5, 0, 190, 60, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 20, 700, 2, "DINPro-Regular") GUICtrlSetColor(-1, 0x00FF00) GUISetState() ;we can create a better neat and short stopwatch using Timers. $iTimer = TimerInit() _Timer_SetTimer($hWin, 1000, "_UpdateStopWatch") Do Sleep(10) $nMsg = GUIGetMsg() _TicksToTime(TimerDiff($iTimer), $iHour, $iMin, $iSec) Switch $nMsg Case $GUI_EVENT_PRIMARYDOWN _SendMessage($hWin, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndSwitch Until $nMsg = $GUI_EVENT_CLOSE _Timer_KillAllTimers($hWin) EndFunc ;==>timer ; call back function Func _UpdateStopWatch($hWnd, $Msg, $iIDTimer, $dwTime) #forceref $hWnd, $Msg, $iIDTimer, $dwTime _TicksToTime(TimerDiff($iTimer), $iHour, $iMin, $iSec) GUICtrlSetData($iLabel, StringFormat("%02d:%02d:%02d", $iHour, $iMin, $iSec)) EndFunc ;==>_UpdateStopWatch Regards
-
PhoenixXL got a reaction from meoit in Creating Buttons with GDI+
Use WM_PAINT to draw on the GUI, orelse with your code try to minimize + restore you will find that all the graphics disappear.
For your question check the function CheckPointer in the example.
Example
#include <GUIConstantsEx.au3> #include <GDIPlus.au3> #include <WindowsConstants.au3> #include <WinAPIGdi.au3> Global $hGraphic, $hBrush, $hBrushFont, $hFont, $hFormat, $hFamily, $hGUI, $tRect_Coords[4] ;would be used in two functions therefore declared as global. Global $iTheme = 0 Example() Func Example() ; Create GUI $hGUI = GUICreate("GDI+", 400, 300) ; Fill a rectangle _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hBrush = _GDIPlus_BrushCreateSolid(0xAA43A6DF) $hBrushFont = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate("Segoe UI Light") $hFont = _GDIPlus_FontCreate($hFamily, 20, 2) $tRect_Coords[0] = 10 $tRect_Coords[1] = 10 $tRect_Coords[2] = 100 $tRect_Coords[3] = 100 ;Register for painting GUIRegisterMsg($WM_PAINT, "WM_PAINT") ;$WM_PAINT GUISetState() ; Loop until the user exits. Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYDOWN If CheckPointer($tRect_Coords) Then SetTheme(1) Case $GUI_EVENT_PRIMARYUP SetTheme(0) Case $GUI_EVENT_MOUSEMOVE If GetTheme() = 1 Then ContinueLoop If CheckPointer($tRect_Coords) Then SetTheme(2) Else SetTheme(0) EndIf EndSwitch Until 0 ; Clean up resources _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_BrushDispose($hBrush) _GDIPlus_BrushDispose($hBrushFont) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Example Func WM_PAINT($hGUI, $iMsg, $wParam, $lParam) _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_UPDATENOW) ;Your Code must lie below ;Paint the string _GDIPlus_GraphicsClear($hGraphic, 0xFFF0F0F0) _GDIPlus_GraphicsFillRect($hGraphic, $tRect_Coords[0], $tRect_Coords[1], $tRect_Coords[2], $tRect_Coords[3], $hBrush) _GDIPlus_GraphicsDrawStringEx($hGraphic, "Hello world", $hFont, _GDIPlus_RectFCreate($tRect_Coords[0], $tRect_Coords[1], $tRect_Coords[2], $tRect_Coords[3]), $hFormat, $hBrushFont) ;End of your code _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_VALIDATE) Return 0;'GUI_RUNDEFMSG' EndFunc ;==>WM_PAINT Func CheckPointer(ByRef $aiCoords_ClientRel) Return _WinAPI_PtInRectEx(_WinAPI_GetMousePosX(True, $hGUI), _WinAPI_GetMousePosY(True, $hGUI), $aiCoords_ClientRel[0], $aiCoords_ClientRel[1], $aiCoords_ClientRel[2] + $aiCoords_ClientRel[0], $aiCoords_ClientRel[3] + $aiCoords_ClientRel[1]) EndFunc ;==>CheckPointer Func GetTheme() Return $iTheme EndFunc ;==>GetTheme Func SetTheme($Theme, $f_Redraw = true) If GetTheme() = $Theme Then Return 1 If $Theme = 0 Then ;Idle _GDIPlus_BrushSetSolidColor($hBrush, 0xAA43A6DF) _GDIPlus_BrushSetSolidColor($hBrushFont, 0xFFFFFFFF) ;Default Dimensions $tRect_Coords[0] = 10 $tRect_Coords[1] = 10 $tRect_Coords[2] = 100 $tRect_Coords[3] = 100 ElseIf $Theme = 1 Then ;MouseDown _GDIPlus_BrushSetSolidColor($hBrush, 0xFF3685B2) _GDIPlus_BrushSetSolidColor($hBrushFont, 0xFFFFFFFF) ;Compress a Bit $tRect_Coords[0] = 12 $tRect_Coords[1] = 12 $tRect_Coords[2] = 96 $tRect_Coords[3] = 96 ElseIf $Theme = 2 Then ;MouseOver _GDIPlus_BrushSetSolidColor($hBrush, 0xBB7BC1E9) _GDIPlus_BrushSetSolidColor($hBrushFont, 0xFFFFFFFF) ;Enlarge a Bit $tRect_Coords[0] = 8 $tRect_Coords[1] = 8 $tRect_Coords[2] = 104 $tRect_Coords[3] = 104 Else Return SetError(1, 0, 0) EndIf $iTheme = $Theme ConsoleWrite("CurTheme: " & $iTheme & @CRLF) If $f_Redraw Then _WinAPI_RedrawWindow($hGUI, 0, 0, BitOR($RDW_INTERNALPAINT, $RDW_ERASE)) endfunc ;==>SetTheme Thumbs up if it helped.
Regards
Phoenix XL
-
PhoenixXL got a reaction from guiltyking in Remove string after x
Func RemoveStringFrom($String, $S_From, $Case_Sense = 0, $iOccurance = 1) Return StringLeft($String, StringInStr($String, $S_From, $Case_Sense, $iOccurance) - 1) ;Check the helfile for more info about these functions EndFunc ;==>RemoveStringAfter MsgBox(0, 0, RemoveStringFrom("Atext & PAnotherU & Dontoer_HKSCS", " ")) MsgBox(0, 0, RemoveStringFrom("Fatang & FatangDhe & GungRuh & GangsuhChe", " ")) MsgBox(0, 0, RemoveStringFrom("Normal string without commercial e", " ", 0, -1))Hope it helps Ask if any queries
Regards
-
PhoenixXL got a reaction from orax in Transparent Background Edit Control WinAPI/GDI+ Implementation Issues
Tried with a RichEdit Control
Till the time it works
#include-once #include <GuiRichEdit.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> Main() Func Main() Local $hGui, $hRichEdit, $iMsg $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, 4) & ")", 320, 350, -1, -1, 0, $WS_EX_COMPOSITED) $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a a transparent Rich Edit Control." & @CRLF & _ "Press Esc To Exit", 10, 10, 300, 220, BitOR($ES_MULTILINE, $ES_AUTOVSCROLL), $WS_EX_TRANSPARENT) CreateBackground_Static($hGui, 0, 0) GUISetState() While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd _GUICtrlRichEdit_Destroy($hRichEdit) GUIDelete() EndFunc ;==>Main Func CreateBackground_Static($hWnd, $iX, $iY, $iWidth = -1, $iHeight = -1, $iColor_Start = 0xAA000000, $iColor_End = 0x70000000, $iMode = 1) _GDIPlus_Startup() If $iWidth < 0 Then $iWidth = _WinAPI_GetWindowWidth($hWnd) If $iHeight < 0 Then $iHeight = _WinAPI_GetWindowHeight($hWnd) $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd) $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic) _GDIPlus_GraphicsDispose($hGraphic) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap) ;********************** ; Create Line Brush Using minimum number of settings- Brush size same size as Rectangle to fill $hBrushLin = GDIPlus_CreateLineBrushFromRect(0, 0, $iWidth, $iHeight, -1, -1, $iColor_Start, $iColor_End, 1) ;Fill a rectangle using the above brush _GDIPlus_GraphicsFillRect($hGraphic, 0, 0, $iWidth, $iHeight, $hBrushLin) ;*************************** Local Const $_STM__SETIMAGE = 0x0172, $_SS__BITMAP = 0x0E $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) $iRet = GUICtrlCreatePic('', $iX, $iY, $iWidth, $iHeight, $_SS__BITMAP) Local Const $__IMAGE_BITMAP = 0 GUICtrlSendMsg(-1, $_STM__SETIMAGE, $__IMAGE_BITMAP, $hHBitmap) _GDIPlus_GraphicsDispose($hGraphic) _WinAPI_DeleteObject($hHBitmap) _GDIPlus_Shutdown() GUICtrlSetState(-1, $GUI_DISABLE) Return $iRet EndFunc ;==>CreateBackground_Static Func GDIPlus_CreateLineBrushFromRect($iX, $iY, $iWidth, $iHeight, $aFactors, $aPositions, _ $iArgb1 = 0xFF0000FF, $iArgb2 = 0xFFFF0000, $LinearGradientMode = 0x00000001, $WrapMode = 0) Local $tRect, $pRect, $aRet, $tFactors, $pFactors, $tPositions, $pPositions, $iCount If $iArgb1 = -1 Then $iArgb1 = 0xFF0000FF If $iArgb2 = -1 Then $iArgb2 = 0xFFFF0000 If $LinearGradientMode = -1 Then $LinearGradientMode = 0x00000001 If $WrapMode = -1 Then $WrapMode = 1 $tRect = DllStructCreate("float X;float Y;float Width;float Height") $pRect = DllStructGetPtr($tRect) DllStructSetData($tRect, "X", $iX) DllStructSetData($tRect, "Y", $iY) DllStructSetData($tRect, "Width", $iWidth) DllStructSetData($tRect, "Height", $iHeight) ;Note: Withn _GDIPlus_Startup(), $ghGDIPDll is defined $aRet = DllCall($ghGDIPDll, "int", "GdipCreateLineBrushFromRect", "ptr", $pRect, "int", $iArgb1, _ "int", $iArgb2, "int", $LinearGradientMode, "int", $WrapMode, "int*", 0) If IsArray($aFactors) = 0 Then Dim $aFactors[4] = [0.0, 0.4, 0.6, 1.0] If IsArray($aPositions) = 0 Then Dim $aPositions[4] = [0.0, 0.3, 0.7, 1.0] $iCount = UBound($aPositions) $tFactors = DllStructCreate("float[" & $iCount & "]") $pFactors = DllStructGetPtr($tFactors) For $iI = 0 To $iCount - 1 DllStructSetData($tFactors, 1, $aFactors[$iI], $iI + 1) Next $tPositions = DllStructCreate("float[" & $iCount & "]") $pPositions = DllStructGetPtr($tPositions) For $iI = 0 To $iCount - 1 DllStructSetData($tPositions, 1, $aPositions[$iI], $iI + 1) Next $hStatus = DllCall($ghGDIPDll, "int", "GdipSetLineBlend", "hwnd", $aRet[6], _ "ptr", $pFactors, "ptr", $pPositions, "int", $iCount) Return $aRet[6] ; Handle of Line Brush EndFunc ;==>GDIPlus_CreateLineBrushFromRect Better Example
#include-once #include <GuiRichEdit.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <Constants.au3> Main() Func Main() Local $hGui, $hRichEdit, $iMsg $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, 4) & ")", 320, 350, -1, -1, 0, $WS_EX_COMPOSITED) If FileExists(@ScriptDir & "\cute.jpg") = 0 Then InetGet("http://www.picgifs.com/graphics/c/cute/graphics-cute-920618.jpg", @ScriptDir & "\cute.jpg") If @error Then Exit 1 _GDIPlus_Startup() Local $hBitmap = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\cute.jpg") $hRichEdit = _GUICtrlRichEdit_Create($hGui, @CRLF & @CRLF & "This is a a transparent Rich Edit Control." & @CRLF & _ "Press Esc To Exit" & @CRLF & @CRLF & "Phoenix XL", 10, 190, 280, 80, BitOR($ES_MULTILINE, $ES_AUTOVSCROLL), $WS_EX_TRANSPARENT) CreateBackground_Static($hGui, 10, 190, 280, 80) ;comment this to get pure transparency CreateBackground_Static($hGui, 0, 0, 320, 350, $hBitmap) _GDIPlus_BitmapDispose($hBitmap) GUISetState() While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd _GUICtrlRichEdit_Destroy($hRichEdit) _GDIPlus_Shutdown() GUIDelete() EndFunc ;==>Main Func CreateBackground_Static($hWnd, $iX, $iY, $iWidth = -1, $iHeight = -1, $hBitmap = 0, $iColor_Start = 0xAA000000, $iColor_End = 0x70000000, $iMode = 1) If $iWidth < 0 Then $iWidth = _WinAPI_GetWindowWidth($hWnd) If $iHeight < 0 Then $iHeight = _WinAPI_GetWindowHeight($hWnd) Local $hGraphic If $hBitmap = 0 Then $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd) $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic) _GDIPlus_GraphicsDispose($hGraphic) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap) ;********************** ; Create Line Brush Using minimum number of settings- Brush size same size as Rectangle to fill Local $hBrushLin = GDIPlus_CreateLineBrushFromRect(0, 0, $iWidth, $iHeight, -1, -1, $iColor_Start, $iColor_End, 1) ;Fill a rectangle using the above brush _GDIPlus_GraphicsFillRect($hGraphic, 0, 0, $iWidth, $iHeight, $hBrushLin) ;*************************** EndIf Local Const $_STM__SETIMAGE = 0x0172, $_SS__BITMAP = 0x0E Local $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) $iRet = GUICtrlCreatePic('', $iX, $iY, $iWidth, $iHeight, $_SS__BITMAP) Local Const $__IMAGE_BITMAP = 0 GUICtrlSendMsg(-1, $_STM__SETIMAGE, $__IMAGE_BITMAP, $hHBitmap) If $hGraphic Then _GDIPlus_GraphicsDispose($hGraphic) _WinAPI_DeleteObject($hHBitmap) GUICtrlSetState(-1, $GUI_DISABLE) Return $iRet EndFunc ;==>CreateBackground_Static Func GDIPlus_CreateLineBrushFromRect($iX, $iY, $iWidth, $iHeight, $aFactors, $aPositions, _ $iArgb1 = 0xFF0000FF, $iArgb2 = 0xFFFF0000, $LinearGradientMode = 0x00000001, $WrapMode = 0) Local $tRect, $pRect, $aRet, $tFactors, $pFactors, $tPositions, $pPositions, $iCount If $iArgb1 = -1 Then $iArgb1 = 0xFF0000FF If $iArgb2 = -1 Then $iArgb2 = 0xFFFF0000 If $LinearGradientMode = -1 Then $LinearGradientMode = 0x00000001 If $WrapMode = -1 Then $WrapMode = 1 $tRect = DllStructCreate("float X;float Y;float Width;float Height") $pRect = DllStructGetPtr($tRect) DllStructSetData($tRect, "X", $iX) DllStructSetData($tRect, "Y", $iY) DllStructSetData($tRect, "Width", $iWidth) DllStructSetData($tRect, "Height", $iHeight) ;Note: Withn _GDIPlus_Startup(), $ghGDIPDll is defined $aRet = DllCall($ghGDIPDll, "int", "GdipCreateLineBrushFromRect", "ptr", $pRect, "int", $iArgb1, _ "int", $iArgb2, "int", $LinearGradientMode, "int", $WrapMode, "int*", 0) If IsArray($aFactors) = 0 Then Dim $aFactors[4] = [0.0, 0.4, 0.6, 1.0] If IsArray($aPositions) = 0 Then Dim $aPositions[4] = [0.0, 0.3, 0.7, 1.0] $iCount = UBound($aPositions) $tFactors = DllStructCreate("float[" & $iCount & "]") $pFactors = DllStructGetPtr($tFactors) For $iI = 0 To $iCount - 1 DllStructSetData($tFactors, 1, $aFactors[$iI], $iI + 1) Next $tPositions = DllStructCreate("float[" & $iCount & "]") $pPositions = DllStructGetPtr($tPositions) For $iI = 0 To $iCount - 1 DllStructSetData($tPositions, 1, $aPositions[$iI], $iI + 1) Next $hStatus = DllCall($ghGDIPDll, "int", "GdipSetLineBlend", "hwnd", $aRet[6], _ "ptr", $pFactors, "ptr", $pPositions, "int", $iCount) Return $aRet[6] ; Handle of Line Brush EndFunc ;==>GDIPlus_CreateLineBrushFromRect -
PhoenixXL got a reaction from buymeapc in File manager listview icon help
I got some free time
Here is what I have for you
Features Added
AutoSuggestion and AutoAppend upon entering in the Edit. Pressing backspace in the GUI goes to the last folder. Pressing Enter in the edit makes the text the current directory. Icons with folders and files.
MainScript.au3 ;by Phoenix XL 15/05/2013 ;Features Added ; AutoSuggestion and AutoAppend upon entering in the Edit. ; Pressing backspace in the GUI goes to the last folder. ; Pressing Enter in the edit makes the text the current directory. ; Icons with folders and files. ; -- Created with ISN Form Studio 2 for ISN AutoIt Studio -- ; #include "MyHeader.au3" #include <GUIConstantsEx.au3> #include <EditConstants.au3> Opt("TrayIconDebug", 1) ;hover the trayicon and find where Autoit is. $Xplore_file_manager = GUICreate("Xplore file manager", 400, 565) GUISetBkColor(0xFFFFFF, $Xplore_file_manager) GUICtrlSetBkColor(-1, 0xBFBFFF) ;create a dummy for backspace and enter Local $iBackSpace = GUICtrlCreateDummy() Local $iEnter = GUICtrlCreateDummy() Local Const $aAccel[2][2] = [["{BACKSPACE}", $iBackSpace],["{ENTER}", $iEnter]] GUISetAccelerators($aAccel, $Xplore_file_manager) $iListView = GUICtrlCreateListView("", 10, 100, 380, 420, 0) $hListView = GUICtrlGetHandle($iListView) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES)) ; Add columns _GUICtrlListView_AddColumn($hListView, "Name", 260) _GUICtrlListView_AddColumn($hListView, "Size", 100) UpdateList() $iInput_DirPath = GUICtrlCreateEdit("", 110, 70, 280, 30, $ES_AUTOHSCROLL, 512) ;Input controls will block ENTER processing GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") _SHAutoComplete(-1) ; $iBtn_Back = GUICtrlCreateButton("Back", 10, 70, 100, 30, -1, -1) GUIRegisterMsg($WM_NOTIFY, "_Update_on_Dblclick") GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $iEnter $hfocus = _WinAPI_GetFocus() $iControlID = _WinAPI_GetDlgCtrlID($hfocus) If $iControlID = $iInput_DirPath Then $sRead = GUICtrlRead($iControlID) If IsDirectory($sRead) Then UpdateList($sRead) Else ShellExecute($sRead) EndIf Else ControlSend($Xplore_file_manager, "", $iControlID, "{ENTER}") EndIf Case $iBtn_Back, $iBackSpace Go_PrevDir() EndSwitch WEnd MyHeader.au3
#OnAutoItStartRegister "CoInitialize" #include <WinAPIEx.au3> #include <GUIListView.au3> #include <GUIImageList.au3> #include <Misc.au3> #include <File.au3> #include <WindowsConstants.au3> OnAutoItExitRegister("CoUnInitialize") ;global variables Global $s_Selected_Folder, $ag_Size[1], $Xplore_file_manager, $hListView, $iListView, $iInput_DirPath, $iBtn_Back Func Get_Files_Folders($s_Directory = '') $aRet = _Iif($s_Directory = "", DriveGetDrive('all'), _FileListToArray($s_Directory)) If @error Or IsArray($aRet) = 0 Then Return SetError(1, 0, 0) ReDim $ag_Size[UBound($aRet)] For $i = 1 To UBound($aRet) - 1 If IsDirectory($aRet[$i]) Then ;Takes a lot of time ;~ $ag_Size[$i] = DirGetSize($aRet[$i]) Else $ag_Size[$i] = FileGetSize($aRet[$i]) EndIf Next $s_Selected_Folder = $s_Directory Return $aRet EndFunc ;==>Get_Files_Folders Func UpdateList($s_Directory = "") If $s_Directory And StringRight($s_Directory, 1) <> "\" Then $s_Directory &= "\" $array = Get_Files_Folders($s_Directory) If IsArray($array) = 0 Then Return 0 ;always pass a handle as $list otherwise there might be an error. _GUICtrlListView_DeleteAllItems($hListView) Static $hImageList If $hImageList Then _GUIImageList_Destroy($hImageList) $hImageList = _GUIImageList_Create() _GUICtrlListView_SetImageList($hListView, $hImageList, 1) ;small icons only $iubound = UBound($array) - 1 For $i = 1 To $iubound $hImage = _IconExtract_FromFile_Return_hHBmp($s_Selected_Folder & $array[$i]) _GUICtrlListView_AddItem($hListView, $array[$i], _GUIImageList_Add($hImageList, $hImage)) _GUICtrlListView_AddSubItem($hListView, $i - 1, $ag_Size[$i], 1) _WinAPI_DeleteObject($hImage) Next EndFunc ;==>UpdateList Func _Update_on_Dblclick($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView Switch $iCode Case $NM_DBLCLK $aHitTest = _GUICtrlListView_HitTest($hWndFrom) If @error Or $aHitTest[0] = -1 Then Return $s_ItemText = _GUICtrlListView_GetItemText($hWndFrom, $aHitTest[0]) If IsDirectory($s_Selected_Folder & $s_ItemText) Then $s_Selected_Folder &= $s_ItemText & "\" UpdateList($s_Selected_Folder) GUICtrlSetData($iInput_DirPath, $s_Selected_Folder) Else ShellExecute($s_Selected_Folder & $s_ItemText) EndIf EndSwitch EndSwitch EndFunc ;==>_Update_on_Dblclick ;======== Added Functions ======================================================= Func CoInitialize() DllCall('ole32.dll', 'long', 'CoInitialize', 'ptr', '') EndFunc ;==>CoInitialize Func CoUnInitialize() DllCall('ole32.dll', 'long', 'CoUnInitialize', 'ptr', '') EndFunc ;==>CoUnInitialize ;make the script to go to the previous directory Func Go_PrevDir() $iBack_Dir = StringRegExpReplace($s_Selected_Folder, '(.*\\).+', "$1") If @extended = 0 Then $iBack_Dir = "" UpdateList($iBack_Dir) GUICtrlSetData($iInput_DirPath, $iBack_Dir) EndFunc ;==>Go_PrevDir Func _SHAutoComplete($ControlID, $dwFlags = -1) If $dwFlags = -1 Then Local Const $SHACF_AUTOAPPEND_FORCE_ON = 0x40000000, $SHACF_AUTOSUGGEST_FORCE_ON = 0x10000000, $SHACF_FILESYSTEM = 0x00000001 $dwFlags = BitOR($SHACF_AUTOAPPEND_FORCE_ON, $SHACF_AUTOSUGGEST_FORCE_ON, $SHACF_FILESYSTEM) EndIf Local $aRet = DllCall('shlwapi.dll', "long", "SHAutoComplete", "hwnd", GUICtrlGetHandle($ControlID), "int", $dwFlags) Return $aRet[0] EndFunc ;==>_SHAutoComplete Func _IconExtract_FromFile_Return_hHBmp($S_File, $iSmallIcon = True) $hIcon = _WinAPI_ShellExtractAssociatedIcon($S_File, $iSmallIcon) ;Get the respective icon $hHbmp = _WinAPI_Create32BitHBITMAP($hIcon, 1, 1) _WinAPI_DestroyIcon($hIcon) Return $hHbmp EndFunc ;==>_IconExtract_FromFile_Return_hHBmp Func IsDirectory($S_File) Return StringInStr(FileGetAttrib($S_File), "d") <> 0 EndFunc ;==>IsDirectory ;======== Added Functions End =======================================================
Thumbs up if it helped
Regards
-
PhoenixXL got a reaction from mesale0077 in How to change window title color ?
This should finally solve the problem - the theme was overriding the colors
#include <WinAPI.au3> ; http://www.autoitscript.com/forum/index.php?showtopic=62641&view=findpost&p=469512 Global Const $COLOR_ACTIVECAPTION = 2 Global Const $COLOR_GRADIENTACTIVECAPTION = 27 Local $aElements[3] = [$COLOR_ACTIVECAPTION, $COLOR_GRADIENTACTIVECAPTION] ; Red and Yellow Local $aColors[3] = [255, 65535], $aSaveColors[2] $hGui = GUICreate("My GUI", 300, 200) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $hGui, "wstr", 0, "wstr", 0) $aSaveColors[0] = _WinAPI_GetSysColor($COLOR_ACTIVECAPTION) $aSaveColors[1] = _WinAPI_GetSysColor($COLOR_GRADIENTACTIVECAPTION) _WinAPI_SetSysColors($aElements, $aColors) GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case -3 ; $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd _WinAPI_SetSysColors($aElements, $aSaveColors) -
PhoenixXL got a reaction from mesale0077 in Transparent Background Edit Control WinAPI/GDI+ Implementation Issues
Tried with a RichEdit Control
Till the time it works
#include-once #include <GuiRichEdit.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> Main() Func Main() Local $hGui, $hRichEdit, $iMsg $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, 4) & ")", 320, 350, -1, -1, 0, $WS_EX_COMPOSITED) $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a a transparent Rich Edit Control." & @CRLF & _ "Press Esc To Exit", 10, 10, 300, 220, BitOR($ES_MULTILINE, $ES_AUTOVSCROLL), $WS_EX_TRANSPARENT) CreateBackground_Static($hGui, 0, 0) GUISetState() While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd _GUICtrlRichEdit_Destroy($hRichEdit) GUIDelete() EndFunc ;==>Main Func CreateBackground_Static($hWnd, $iX, $iY, $iWidth = -1, $iHeight = -1, $iColor_Start = 0xAA000000, $iColor_End = 0x70000000, $iMode = 1) _GDIPlus_Startup() If $iWidth < 0 Then $iWidth = _WinAPI_GetWindowWidth($hWnd) If $iHeight < 0 Then $iHeight = _WinAPI_GetWindowHeight($hWnd) $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd) $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic) _GDIPlus_GraphicsDispose($hGraphic) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap) ;********************** ; Create Line Brush Using minimum number of settings- Brush size same size as Rectangle to fill $hBrushLin = GDIPlus_CreateLineBrushFromRect(0, 0, $iWidth, $iHeight, -1, -1, $iColor_Start, $iColor_End, 1) ;Fill a rectangle using the above brush _GDIPlus_GraphicsFillRect($hGraphic, 0, 0, $iWidth, $iHeight, $hBrushLin) ;*************************** Local Const $_STM__SETIMAGE = 0x0172, $_SS__BITMAP = 0x0E $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) $iRet = GUICtrlCreatePic('', $iX, $iY, $iWidth, $iHeight, $_SS__BITMAP) Local Const $__IMAGE_BITMAP = 0 GUICtrlSendMsg(-1, $_STM__SETIMAGE, $__IMAGE_BITMAP, $hHBitmap) _GDIPlus_GraphicsDispose($hGraphic) _WinAPI_DeleteObject($hHBitmap) _GDIPlus_Shutdown() GUICtrlSetState(-1, $GUI_DISABLE) Return $iRet EndFunc ;==>CreateBackground_Static Func GDIPlus_CreateLineBrushFromRect($iX, $iY, $iWidth, $iHeight, $aFactors, $aPositions, _ $iArgb1 = 0xFF0000FF, $iArgb2 = 0xFFFF0000, $LinearGradientMode = 0x00000001, $WrapMode = 0) Local $tRect, $pRect, $aRet, $tFactors, $pFactors, $tPositions, $pPositions, $iCount If $iArgb1 = -1 Then $iArgb1 = 0xFF0000FF If $iArgb2 = -1 Then $iArgb2 = 0xFFFF0000 If $LinearGradientMode = -1 Then $LinearGradientMode = 0x00000001 If $WrapMode = -1 Then $WrapMode = 1 $tRect = DllStructCreate("float X;float Y;float Width;float Height") $pRect = DllStructGetPtr($tRect) DllStructSetData($tRect, "X", $iX) DllStructSetData($tRect, "Y", $iY) DllStructSetData($tRect, "Width", $iWidth) DllStructSetData($tRect, "Height", $iHeight) ;Note: Withn _GDIPlus_Startup(), $ghGDIPDll is defined $aRet = DllCall($ghGDIPDll, "int", "GdipCreateLineBrushFromRect", "ptr", $pRect, "int", $iArgb1, _ "int", $iArgb2, "int", $LinearGradientMode, "int", $WrapMode, "int*", 0) If IsArray($aFactors) = 0 Then Dim $aFactors[4] = [0.0, 0.4, 0.6, 1.0] If IsArray($aPositions) = 0 Then Dim $aPositions[4] = [0.0, 0.3, 0.7, 1.0] $iCount = UBound($aPositions) $tFactors = DllStructCreate("float[" & $iCount & "]") $pFactors = DllStructGetPtr($tFactors) For $iI = 0 To $iCount - 1 DllStructSetData($tFactors, 1, $aFactors[$iI], $iI + 1) Next $tPositions = DllStructCreate("float[" & $iCount & "]") $pPositions = DllStructGetPtr($tPositions) For $iI = 0 To $iCount - 1 DllStructSetData($tPositions, 1, $aPositions[$iI], $iI + 1) Next $hStatus = DllCall($ghGDIPDll, "int", "GdipSetLineBlend", "hwnd", $aRet[6], _ "ptr", $pFactors, "ptr", $pPositions, "int", $iCount) Return $aRet[6] ; Handle of Line Brush EndFunc ;==>GDIPlus_CreateLineBrushFromRect Better Example
#include-once #include <GuiRichEdit.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <Constants.au3> Main() Func Main() Local $hGui, $hRichEdit, $iMsg $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, 4) & ")", 320, 350, -1, -1, 0, $WS_EX_COMPOSITED) If FileExists(@ScriptDir & "\cute.jpg") = 0 Then InetGet("http://www.picgifs.com/graphics/c/cute/graphics-cute-920618.jpg", @ScriptDir & "\cute.jpg") If @error Then Exit 1 _GDIPlus_Startup() Local $hBitmap = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\cute.jpg") $hRichEdit = _GUICtrlRichEdit_Create($hGui, @CRLF & @CRLF & "This is a a transparent Rich Edit Control." & @CRLF & _ "Press Esc To Exit" & @CRLF & @CRLF & "Phoenix XL", 10, 190, 280, 80, BitOR($ES_MULTILINE, $ES_AUTOVSCROLL), $WS_EX_TRANSPARENT) CreateBackground_Static($hGui, 10, 190, 280, 80) ;comment this to get pure transparency CreateBackground_Static($hGui, 0, 0, 320, 350, $hBitmap) _GDIPlus_BitmapDispose($hBitmap) GUISetState() While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd _GUICtrlRichEdit_Destroy($hRichEdit) _GDIPlus_Shutdown() GUIDelete() EndFunc ;==>Main Func CreateBackground_Static($hWnd, $iX, $iY, $iWidth = -1, $iHeight = -1, $hBitmap = 0, $iColor_Start = 0xAA000000, $iColor_End = 0x70000000, $iMode = 1) If $iWidth < 0 Then $iWidth = _WinAPI_GetWindowWidth($hWnd) If $iHeight < 0 Then $iHeight = _WinAPI_GetWindowHeight($hWnd) Local $hGraphic If $hBitmap = 0 Then $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd) $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic) _GDIPlus_GraphicsDispose($hGraphic) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap) ;********************** ; Create Line Brush Using minimum number of settings- Brush size same size as Rectangle to fill Local $hBrushLin = GDIPlus_CreateLineBrushFromRect(0, 0, $iWidth, $iHeight, -1, -1, $iColor_Start, $iColor_End, 1) ;Fill a rectangle using the above brush _GDIPlus_GraphicsFillRect($hGraphic, 0, 0, $iWidth, $iHeight, $hBrushLin) ;*************************** EndIf Local Const $_STM__SETIMAGE = 0x0172, $_SS__BITMAP = 0x0E Local $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) $iRet = GUICtrlCreatePic('', $iX, $iY, $iWidth, $iHeight, $_SS__BITMAP) Local Const $__IMAGE_BITMAP = 0 GUICtrlSendMsg(-1, $_STM__SETIMAGE, $__IMAGE_BITMAP, $hHBitmap) If $hGraphic Then _GDIPlus_GraphicsDispose($hGraphic) _WinAPI_DeleteObject($hHBitmap) GUICtrlSetState(-1, $GUI_DISABLE) Return $iRet EndFunc ;==>CreateBackground_Static Func GDIPlus_CreateLineBrushFromRect($iX, $iY, $iWidth, $iHeight, $aFactors, $aPositions, _ $iArgb1 = 0xFF0000FF, $iArgb2 = 0xFFFF0000, $LinearGradientMode = 0x00000001, $WrapMode = 0) Local $tRect, $pRect, $aRet, $tFactors, $pFactors, $tPositions, $pPositions, $iCount If $iArgb1 = -1 Then $iArgb1 = 0xFF0000FF If $iArgb2 = -1 Then $iArgb2 = 0xFFFF0000 If $LinearGradientMode = -1 Then $LinearGradientMode = 0x00000001 If $WrapMode = -1 Then $WrapMode = 1 $tRect = DllStructCreate("float X;float Y;float Width;float Height") $pRect = DllStructGetPtr($tRect) DllStructSetData($tRect, "X", $iX) DllStructSetData($tRect, "Y", $iY) DllStructSetData($tRect, "Width", $iWidth) DllStructSetData($tRect, "Height", $iHeight) ;Note: Withn _GDIPlus_Startup(), $ghGDIPDll is defined $aRet = DllCall($ghGDIPDll, "int", "GdipCreateLineBrushFromRect", "ptr", $pRect, "int", $iArgb1, _ "int", $iArgb2, "int", $LinearGradientMode, "int", $WrapMode, "int*", 0) If IsArray($aFactors) = 0 Then Dim $aFactors[4] = [0.0, 0.4, 0.6, 1.0] If IsArray($aPositions) = 0 Then Dim $aPositions[4] = [0.0, 0.3, 0.7, 1.0] $iCount = UBound($aPositions) $tFactors = DllStructCreate("float[" & $iCount & "]") $pFactors = DllStructGetPtr($tFactors) For $iI = 0 To $iCount - 1 DllStructSetData($tFactors, 1, $aFactors[$iI], $iI + 1) Next $tPositions = DllStructCreate("float[" & $iCount & "]") $pPositions = DllStructGetPtr($tPositions) For $iI = 0 To $iCount - 1 DllStructSetData($tPositions, 1, $aPositions[$iI], $iI + 1) Next $hStatus = DllCall($ghGDIPDll, "int", "GdipSetLineBlend", "hwnd", $aRet[6], _ "ptr", $pFactors, "ptr", $pPositions, "int", $iCount) Return $aRet[6] ; Handle of Line Brush EndFunc ;==>GDIPlus_CreateLineBrushFromRect -
PhoenixXL got a reaction from Fr33b0w in Toggle "Always On Top"
Here is an Example
#include <GUIConstants.au3> $hGUI = GUICreate( @ScriptName ) $iBtn = GUICtrlCreateButton( "Toggle State", 10, 10 ) $iState = 0 ;Current state not on top GUISetState( @SW_SHOW ) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() Exit Case $iBtn $iState = Not $iState ;Toggle WinSetOnTop( $hGUI, '', $iState ) EndSwitch WEnd
P.S. _WinAPI_SetWindowPos or changing the Ex-Style of the GUI would also do
Regards
-
PhoenixXL got a reaction from Palestinian in Test url if is valid
Example
$sURL = "http://test/21-04-2014" InetGetSize($sURL) If @error Then ConsoleWrite("Invalid URL" & @CRLF) Else ConsoleWrite("Valid URL" & @CRLF) EndIf Regards
Phoenix XL
-
PhoenixXL got a reaction from JohnOne in Test url if is valid
Example
$sURL = "http://test/21-04-2014" InetGetSize($sURL) If @error Then ConsoleWrite("Invalid URL" & @CRLF) Else ConsoleWrite("Valid URL" & @CRLF) EndIf Regards
Phoenix XL
-
PhoenixXL got a reaction from incepator in png image design
Does this help? Double-click the Min,Max or Close buttons(or png) and see them in action
#include-once #include <Misc.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <ButtonConstants.au3> #region ### START Koda GUI secti Global Const $SC_DRAGMOVE = 0xF012 _GDIPlus_Startup() #region $aRes1 = DisplayImage("1.png", -1, -1, 0, True, True) $aRes2 = DisplayImage("bara.png", 251 - 30, -30) ;min $aRes3 = DisplayImage("patrat.png", 251 - 60, -30) ;max $aRes4 = DisplayImage("inchide.png", 251, -30) ;close _Fader($aRes1) ;_Fader($aRes1, False) #endregion While True $nMsg = GUIGetMsg(1) ;check helpfile for GUIGetMsg in advanced mode Switch $nMsg[0] Case $GUI_EVENT_PRIMARYDOWN ;mouse down event Switch $nMsg[1] Case $aRes1[0] _SendMessage($aRes1[0], $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) ;for window drag Case $aRes2[0] WinSetState($aRes1[0], "", @SW_MINIMIZE) Case $aRes3[0] WinSetState($aRes1[0], "", @SW_MAXIMIZE) Case $aRes4[0] ExitLoop EndSwitch EndSwitch WEnd ReleaseResources($aRes1) ReleaseResources($aRes2) ReleaseResources($aRes3) ReleaseResources($aRes4) _GDIPlus_Shutdown() Exit Func DisplayImage($sFile, $iPosX = -1, $iPosY = -1, $iAlpha = 0xFF, $bTopmost = True, $bMain = False) Static $hMainWin Local Const $hBmp_Background = _GDIPlus_BitmapCreateFromFile($sFile) ;load the image If @error Then Return SetError(1, 0, 0) ;image cannot be loaded Local Const $iW = _GDIPlus_ImageGetWidth($hBmp_Background), $iH = _GDIPlus_ImageGetHeight($hBmp_Background) ;get the dimension of the background image Local $hGUI If $hMainWin Then $hGUI = GUICreate("", $iW, $iH, $iPosX, $iPosY, -1, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST * $bTopmost, $WS_EX_TOOLWINDOW, $WS_EX_MDICHILD), $hMainWin) Else $hGUI = GUICreate("", $iW, $iH, $iPosX, $iPosY, -1, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST * $bTopmost, $WS_EX_TOOLWINDOW)) EndIf If $bMain Then $hMainWin = $hGUI ;the following would conflict with main GUI mousedown message ;///If $bMovable Then GUICtrlCreateLabel("", 0, 0, $iW, $iH, Default, $GUI_WS_EX_PARENTDRAG) ;create a hidden label for GUI dragging GUISetState(@SW_SHOW, $hGUI) ;show GUI Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) ;define an empty bitmap where all the gfx stuff will copied to Local Const $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap) ;get the context to the bitmap to be able to copy / draw to the bitmap _GDIPlus_GraphicsDrawImageRect($hGfx, $hBmp_Background, 0, 0, $iW, $iH) ;draw background image to the empty bitmap Local Const $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) ;convert GDI+ image to GDI to display it on the screen using GDI functions Local Const $hScrDC = _WinAPI_GetDC($hGUI) ;get the device context (dc) handle of the GUI Local Const $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) ;create a compatible dc handle Local Const $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) ;selects the GDI bitmap object into the specified device context Local Const $tSize = DllStructCreate($tagSIZE) ;create a $tagSIZE struct (x = width, y = height) DllStructSetData($tSize, "X", $iW) ;set data for width DllStructSetData($tSize, "Y", $iH) ;set data for height Local $tSource = DllStructCreate($tagPOINT) ;create a $tagPOINT struct (x = x position, y = y position) Local $tBlend = DllStructCreate($tagBLENDFUNCTION) ;create $tagBLENDFUNCTION struct -> see help file for more info DllStructSetData($tBlend, "Alpha", $iAlpha) ;set the alpha channel of the GUI -> 255 = opaque, 0 = transparent DllStructSetData($tBlend, "Format", 1) ;set the format to 1 -> bitmap has alpha channels DllCall("user32.dll", "bool", "UpdateLayeredWindow", "hwnd", $hGUI, "handle", $hScrDC, "ptr", 0, "struct*", $tSize, "handle", $hMemDC, "struct*", $tSource, "dword", 0, "struct*", $tBlend, "dword", $ULW_ALPHA) ;display bitmap on screen ;release resources otherwise memory will filled up (memory leak) _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_BitmapDispose($hBitmap) Local $aResource[7] = [$hGUI, $hScrDC, $hHBitmap, $hMemDC, $tBlend, $tSize, $tSource] ;return the handle to release it later Return $aResource EndFunc ;==>DisplayImage Func ReleaseResources(ByRef $aResource) If Not IsArray($aResource) Then Return SetError(1, 0, 0) If UBound($aResource) <> 7 Then Return SetError(2, 0, 0) _WinAPI_ReleaseDC($aResource[0], $aResource[1]) _WinAPI_DeleteDC($aResource[3]) _WinAPI_DeleteObject($aResource[2]) GUIDelete($aResource[0]) EndFunc ;==>ReleaseResources Func _Fader($res1, $bIn = True, $iTrans = 255, $speed = 3, $delay = 10) If Not IsArray($res1) Then Return SetError(1, 0, 0) If UBound($res1) <> 7 Then Return SetError(2, 0, 0) For $a = 0 To $iTrans Step _Iif($bIn, $speed, -$speed) DllStructSetData($res1[4], "Alpha", $a) DllCall("user32.dll", "bool", "UpdateLayeredWindow", "hwnd", $res1[0], "handle", $res1[1], "ptr", 0, "struct*", $res1[5], "handle", $res1[3], "struct*", $res1[6], "dword", 0, "struct*", $res1[4], "dword", $ULW_ALPHA) ;display bitmap on screen Sleep($delay) Next EndFunc ;==>_Fader #region GDI and GDI+ functions Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iPixelFormat = $GDIP_PXF32ARGB, $iStride = 0, $pScan0 = 0) Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $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 ;==>_GDIPlus_BitmapCreateFromScan0 #endregion GDI and GDI+ functions Regards
-
PhoenixXL got a reaction from Lupo73 in Predict Text for an Edit Control _PredictText.au3 (UDF)
Fixed the two of the bugs (courtesy - Lupo73 and theTony). Check the first post for more information.
I was delaying for the reason of finding out a way to make asynchronous finding of the text in the list, so as to populate words efficiently when the size is more than 1000(as posted by ValeryVal). I could find out an appropriate way, but now I'm running out of time to implement it in the UDF. For the time being, I had fixed up the bugs.
Regards
Phoenix XL
-
PhoenixXL got a reaction from iamtheky in RestrictEdit_SRE (UDF)
RESTRICT EDIT UDF
Restrict the text that can be entered in an editbox through a String Regular Expression.
The UDF works be subclassing the control. >Here is a similar UDF based on Windows Message.
Functions
The UDF is pretty simple and could be modified with ease. User can set their SRE pattern to block the text entered in the editbox Tooltips can be used in case of an error. The title of the Tooltip is Error_2 where the number(2) signifies the pattern that caused the error. The script is made to use function pointer variables rather than direct patterns, to make it more flexible and broader. Supports +ve and -ve SRE pattern matches. See example for better understanding.
Note : The Pattern should be made such that every phase of typing is met,
Example, if the user wants The second letter should be always a digit. Then he should make sure that the pattern is also satisfied when user enters the first character, as through the process of typing.
Index
; #INDEX# ======================================================================================================================= ; Title .........: RestrictEdit ; Version........: 1.0 ; AutoIt Version : 3.3.8.0++ ; Language ......: English ; Author(s)......: Phoenix XL ; Librarie(s)....: WinAPI, Array and GUIEdit ; Description ...: Functions for restricting the text typed in an Edit control through SRE. ; The edit control is subclassed and the original processing is blocked when pattern isn't satisfied. ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ;_Restrict_Edit ; =============================================================================================================================== ; #INTERNAL_USE_ONLY# =========================================================================================================== ; HideToolTip_Edit ;_NewWnd_Proc_ ;_SubClass_ ; =============================================================================================================================== ChangeLog
v1.0 - First Release
v2.0 - Replaced the SRE pattern parameter(2nd parameter) with function pointer parameter[A script Breaking change]. Added support for positive and negative pattern matches
Download
v2.0 RestrictEdit(UDF).7z
Previous downloads : 161
-
PhoenixXL got a reaction from onlineth in Progress Bar | Help
If you want to just get an static idle icon besides an progress bar, use
GuiCtrlCreateIcon and if you want an animated one use
_GUICtrlButton_SetImageList Besides, I feel, I could not get exactly what you are asking. Please explain a bit more of what you want to do.
Regards