Jump to content

Time Control


trancexx
 Share

Recommended Posts

Is there already a 64bit version of this code out there?

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Thanks!

I'll replace the code in my script :-)

Hopefully it also has a positive effect on the flickering effect.

 

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

One more thing.

Could somebody please explain how to force the output to 24h-format in 64-bit mode?

Thanks!

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

3 hours ago, Xenobiologist said:

Could somebody please explain how to force the output to 24h-format in 64-bit mode?

On 10/16/2009 at 7:38 AM, trancexx said:

Regarding code I posted, there is the wrong value for TIME_FORCE24HOURFORMAT constant used. The correct value is 8.

=)

PS:

                "49B9" & SwapEndian(DllStructGetPtr($tSpace, "Format")) & _
                "49C7C0" & SwapEndian(0, 4) & _
                "BA" & SwapEndian( 8 , 4) & _ ; TIME_FORCE24HOURFORMAT
                "B9" & SwapEndian(0, 4) & _

PS2: @trancexx, I'm in the USA and here the am/pm is what is expected. Presenting someone with 18 hours is like what ???, what time is that ?. Could you make the output to show am/pm ?  Thanks  :D

Edited by argumentum

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

1 hour ago, argumentum said:

=)

PS:


                "49B9" & SwapEndian(DllStructGetPtr($tSpace, "Format")) & _
                "49C7C0" & SwapEndian(0, 4) & _
                "BA" & SwapEndian( 8 , 4) & _ ; TIME_FORCE24HOURFORMAT
                "B9" & SwapEndian(0, 4) & _

PS2: @trancexx, I'm in the USA and here the am/pm is what is expected. Presenting someone with 18 hours is like what ???, what time is that ?. Could you make the output to show am/pm ?  Thanks  :D

You would need to change that 8 to 0 and Format string to "hh:mm:ss tt" after making it larger , set Locale to 1033 (en-us), adjust "output size" parameter and "Result" buffer accordingly, and obviously make strings buffer larger to start with.

If you'd be having problems with that I'll spoon-feed you, no worries :D.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

29 minutes ago, trancexx said:

change that 8 to 0 and Format string to "hh:mm:ss tt" after making it larger , set Locale to 1033 (en-us), ..... If you'd be having problems with that I'll spoon-feed you

lol, please do !. All I got to muster is where the 8 goes  :D

PS: "hh:mm tt" works. Can't find how to expand the string size I guess.

PS2: my mods:

Spoiler
Local $pSendMessageW = $aSendMessageW[0], $n = 20 ; <<<<< expanding the string from 9 to ... more, much more

    ; Allocate enough memory with PAGE_EXECUTE_READWRITE for code to run
    $aCall = DllCall("kernel32.dll", "ptr", "VirtualAlloc", _
            "ptr", 0, _
            "dword", ($n * 4) + 256, _ ; 36 bytes for strings + 256 bytes for code
            "dword", 4096, _ ; MEM_COMMIT
            "dword", 64) ; PAGE_EXECUTE_READWRITE
    If @error Or Not $aCall[0] Then Return SetError(6, 0, 0)

    Local $pRemoteCode = $aCall[0]

    ; Make structure in reserved space
    Local $CodeBuffer = DllStructCreate("byte[256]", $pRemoteCode)

    ; Arrange strings in reserved space
    Local $tSpace = DllStructCreate("wchar Format["& $n &"];wchar Result[" & $n & "]", $pRemoteCode + DllStructGetSize($CodeBuffer))
;~  DllStructSetData($tSpace, "Format", "hh:mm:ss tt") ; <<<< does not work
    DllStructSetData($tSpace, "Format", "mm:ss tt") ; <<<< does work

 

 

Edited by argumentum

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

I would go this way:

;...
Global $hLabel = GUICtrlCreateLabel("", 245, 245, 100, 20)
;...
    
    Local Const $sFormat = "hh:mm:ss tt"
    Local $iLenStr = StringLen($sFormat) + 1

    ; Allocate enough memory with PAGE_EXECUTE_READWRITE for code to run
    $aCall = DllCall("kernel32.dll", "ptr", "VirtualAlloc", _
            "ptr", 0, _
            "dword", 2 * $iLenStr + 512, _
            "dword", 4096, _ ; MEM_COMMIT
            "dword", 64) ; PAGE_EXECUTE_READWRITE

    If @error Or Not $aCall[0] Then
        Return SetError(6, 0, 0)
    EndIf

    Local $pRemoteCode = $aCall[0]

    ; Make structure in reserved space
    Local $CodeBuffer = DllStructCreate("byte[512]", $pRemoteCode)

    ; Arrange strings in reserved space
    Local $tSpace = DllStructCreate("wchar Format[" & $iLenStr & "];wchar Result[" & $iLenStr & "]", $pRemoteCode + 512)
    DllStructSetData($tSpace, "Format", $sFormat)

    ; Write assembly
    If @AutoItX64 Then
        DllStructSetData($CodeBuffer, 1, _
                "0x" & _
                "4883EC" & SwapEndian(72, 1) & _
                "C7442428" & SwapEndian($iLenStr, 4) & _
                "48BF" & SwapEndian(DllStructGetPtr($tSpace, "Result")) & _
                "48897C2420" & _
                "49B9" & SwapEndian(DllStructGetPtr($tSpace, "Format")) & _
                "49C7C0" & SwapEndian(0, 4) & _
                "BA" & SwapEndian(0, 4) & _
                "B9" & SwapEndian(1033, 4) & _
                "48B8" & SwapEndian($pGetTimeFormatW) & _
                "FFD0" & _
                "49B9" & SwapEndian(DllStructGetPtr($tSpace, "Result")) & _
                "49C7C0" & SwapEndian(0, 4) & _
                "BA" & SwapEndian(12, 4) & _
                "48B9" & SwapEndian(GUICtrlGetHandle($hControl)) & _
                "48B8" & SwapEndian($pSendMessageW) & _
                "FFD0" & _
                "B9" & SwapEndian(491, 4) & _
                "48B8" & SwapEndian($pSleep) & _
                "FFD0" & _
                "4883C4" & SwapEndian(72, 1) & _
                "E9" & SwapEndian(-136) & _
                "C3" _
                )
    Else
        DllStructSetData($CodeBuffer, 1, _
                "0x" & _
                "68" & SwapEndian($iLenStr) & _ ; push output size
                "68" & SwapEndian(DllStructGetPtr($tSpace, "Result")) & _ ; push pointer to output container
                "68" & SwapEndian(DllStructGetPtr($tSpace, "Format")) & _ ; push pointer to format string
                "68" & SwapEndian(0) & _ ; push NULL
                "68" & SwapEndian(0) & _ ; push 0
                "68" & SwapEndian(1033) & _ ; push en-us Locale
                "B8" & SwapEndian($pGetTimeFormatW) & _ ; mov eax, [$pGetTimeFormatW]
                "FFD0" & _ ; call eax
                "68" & SwapEndian(DllStructGetPtr($tSpace, "Result")) & _ ; push pointer to the result
                "68" & SwapEndian(0) & _ ; push wParam
                "68" & SwapEndian(12) & _ ; push WM_SETTEXT
                "68" & SwapEndian(GUICtrlGetHandle($hControl)) & _ ; push HANDLE
                "B8" & SwapEndian($pSendMessageW) & _ ; mov eax, [$pSendMessageW]
                "FFD0" & _ ; call eax
                "68" & SwapEndian(491) & _ ; push Milliseconds
                "B8" & SwapEndian($pSleep) & _ ; mov eax, [$pSleep]
                "FFD0" & _ ; call eax
                "E9" & SwapEndian(-81) & _ ; jump back 81 bytes (start address)
                "C3" _ ; Ret
                )
    EndIf
    ;...

 

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...