Jump to content

translate code is possible?


anib
 Share

Recommended Posts

start:

main proc

    LOCAL swid  :DWORD
    LOCAL shgt  :DWORD
    LOCAL dwid  :DWORD
    LOCAL hDC   :DWORD
    LOCAL cDC   :DWORD
    LOCAL hScr  :DWORD
    LOCAL hBmp  :DWORD
    LOCAL hOld  :DWORD

    mov hScr, 0                                     ; screen handle is zero
    mov hDC,  rv(GetDC,hScr)                           ; get its DC
    mov swid, rv(GetSystemMetrics,SM_CXSCREEN)       ; get screen width
    add eax,  eax                                     ; double it
    mov dwid, eax                                     ; store it in a variable
    mov shgt, rv(GetSystemMetrics,SM_CYSCREEN)       ; get the screen height
    mov hBmp, rv(CreateCompatibleBitmap,hDC,dwid,shgt) ; make double width bitmap
    mov cDC,  rv(CreateCompatibleDC,hDC)               ; create a DC for it
    mov hOld, rv(SelectObject,cDC,hBmp)             ; select compatible bitmap into compatible DC

 ; ----------------------------------------
 ; blit 2 copies of the current screen side
 ; by side onto the compatible bitmap.
 ; ----------------------------------------
    invoke BitBlt,cDC,0,0,swid,shgt,hDC,0,0,SRCCOPY
    invoke BitBlt,cDC,swid,0,swid,shgt,hDC,0,0,SRCCOPY

 ; --------------------------------------------------------
 ; repeatedly blit the shifting image to the current screen
 ; --------------------------------------------------------
    push esi
    mov esi, swid
  @@:
    invoke BitBlt,hDC,0,0,swid,shgt,cDC,esi,0,SRCCOPY
    invoke Sleep, 20                                   ; slow it up a bit
    sub esi, 8
    jns @B

    pop esi

    invoke SendMessage,0,WM_PAINT,hDC,0             ; clean up the mess after

    invoke DeleteObject,hBmp                           ; delete the compatible bitmap
    invoke SelectObject,cDC,hOld                       ; reselect the old one
    invoke DeleteDC,cDC                             ; delete the compatible DC
    invoke ReleaseDC,hScr,hDC                         ; release the screen DC

    exit

main endp

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

end start

expliquer moi

thank a lot

Me frappe pas !! je débute dans le monde du code :)Un novice avertit en vaut dix sans ennuie ;)AuToiT-FR

Link to comment
Share on other sites

Is it really that hard?

#include <WindowsConstants.au3>
#include <WinAPI.au3>

$hScreenDC = _WinAPI_GetWindowDC(0)
$hMemDC = _WinAPI_CreateCompatibleDC($hScreenDC)
$hMemBMP = _WinAPI_CreateCompatibleBitmap($hScreenDC, @DesktopWidth*2, @DesktopHeight)
_WinAPI_DeleteObject(_WinAPI_SelectObject($hMemDC, $hMemBMP))
_WinAPI_BitBlt($hMemDC, 0, 0, @DesktopWidth, @DesktopHeight, $hScreenDC, 0, 0, $SRCCOPY)
_WinAPI_BitBlt($hMemDC, @DesktopWidth, 0, @DesktopWidth, @DesktopHeight, $hScreenDC, 0, 0, $SRCCOPY)

For $i = @DesktopWidth To 0 Step -8
    _WinAPI_BitBlt($hScreenDC, 0, 0, @DesktopWidth, @DesktopHeight, $hMemDC, $i, 0, $SRCCOPY)
    Sleep(20)
Next

_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE+$RDW_ALLCHILDREN)
_WinAPI_ReleaseDC(0, $hScreenDC)
_WinAPI_DeleteObject($hMemBMP)
_WinAPI_DeleteDC($hMemDC)

Exit

"be smart, drink your wine"

Link to comment
Share on other sites

yes ist very hard :)

my translate, but don't functionnality

#include <winapi.au3>
#include <WindowsConstants.au3>
Global $swid = _winapi_GetSystemMetrics($SM_CXSCREEN)
Global $shgt = _winapi_GetSystemMetrics($SM_CYSCREEN)
Global $dwid = $swid * 2

Global $hDC, $cDC, $hScr = 0, $hBmp, $hOld

$hDC= _winapi_GetDC($hScr)
$hBmp = _winapi_CreateCompatibleBitmap($hDC,$dwid,$shgt)
$cDC = _winapi_CreateCompatibleDC($hDC)
$hOld = _winapi_SelectObject($cDC,$hBmp)

_winapi_BitBlt($cDC,0,0,$swid,$shgt,$hDC,0,0,$SRCCOPY)
_winapi_BitBlt($cDC,$swid,0,$swid,$shgt,$hDC,0,0,$SRCCOPY)

For $i = $swid to 0 step - 8
    _winapi_BitBlt($hDC,0,0,$swid,$shgt,$cDC,$swid,0,$SRCCOPY)
    Sleep(20)
next

_SendMessage(0,$WM_PAINT,$hDC,0)
_winapi_DeleteObject($hBmp)
_winapi_SelectObject($cDC,$hOld)
_winapi_DeleteDC($cDC)
_winapi_ReleaseDC($hScr,$hDC)
exit

thank Siao :)

your translate is perfect, greet

But function getdc => _WinAPI_GetWindowDC

SendMessage is not necessaire?

excuse me for my english, 'im difficult to speak (writing)

thanks a lot

ps : rhaaa i'm to resolve my error ^__^

for $i = $swid to 0 step - 8

_winapi_BitBlt($hDC,0,0,$swid,$shgt,$cDC,$i,0,$SRCCOPY)

Sleep(20)

next

Edited by anib

Me frappe pas !! je débute dans le monde du code :)Un novice avertit en vaut dix sans ennuie ;)AuToiT-FR

Link to comment
Share on other sites

is not possible to inverse horizontal?

#include <winapi.au3>
#include <WindowsConstants.au3>
Global $swid = _winapi_GetSystemMetrics($SM_CXSCREEN)
Global $shgt = _winapi_GetSystemMetrics($SM_CYSCREEN)
Global $dwid = $swid * 2

Global $hDC, $cDC, $hScr = 0, $hBmp, $hOld

$hDC= _winapi_GetDC($hScr)
$hBmp = _winapi_CreateCompatibleBitmap($hDC,$dwid,$shgt)
$cDC = _winapi_CreateCompatibleDC($hDC)
$hOld = _winapi_SelectObject($cDC,$hBmp)

_winapi_BitBlt($cDC,0,0,$swid,$shgt,$hDC,0,0,$SRCCOPY)
_winapi_BitBlt($cDC,0,0,$swid,$shgt,$hDC,$swid,0,$SRCCOPY)

For $i = $swid to 0 step - 8
    _winapi_BitBlt($hDC,$i,0,$swid,$shgt,$cDC,0,0,$SRCCOPY)
    Sleep(20)
next

_SendMessage(0,$WM_PAINT,$hDC,0)
_winapi_DeleteObject($hBmp)
_winapi_SelectObject($cDC,$hOld)
_winapi_DeleteDC($cDC)
_winapi_ReleaseDC($hScr,$hDC)
exit

Me frappe pas !! je débute dans le monde du code :)Un novice avertit en vaut dix sans ennuie ;)AuToiT-FR

Link to comment
Share on other sites

Excuse me,

Questions concerning structures or even new function should be put in which party forum?

Here or activx ?

Thanks in advance.

How can i Help ? please.

Me frappe pas !! je débute dans le monde du code :)Un novice avertit en vaut dix sans ennuie ;)AuToiT-FR

Link to comment
Share on other sites

Excuse me,

Questions concerning structures or even new function should be put in which party forum?

Here or activx ?

Thanks in advance.

How can i Help ? please.

Activx forum?? Never heard of it... AutoItX Forum I have though. If you are using a different language other than AutoIt with the AutoItX dll, then it goes there, other wise it can belong here... I think thats what you mean >.<
Link to comment
Share on other sites

Thanks bert, I was not too sure, to ask the question in the right part of the forum.

Is it possible to do the opposite effect than the one presented above?

Me frappe pas !! je débute dans le monde du code :)Un novice avertit en vaut dix sans ennuie ;)AuToiT-FR

Link to comment
Share on other sites

What do you mean the opposite effect? Move the screen the other way? If so, just look at the For loop. If "For $i = @DesktopWidth To 0 Step -8" moves it one way. Then "For $i = 0 to @DesktopWidth Step 8" should move it the other way.

Link to comment
Share on other sites

Thank you covaks,

I tried this formula, however, I am wrong somewhere,

I thought it was necessary to use the second parameter bilblt: (

Eg: _winapi_BitBlt ($hDC, $i, 0, $swid, $shgt, $cDC, 0.0, $SRCCOPY)

Thanks again

Me frappe pas !! je débute dans le monde du code :)Un novice avertit en vaut dix sans ennuie ;)AuToiT-FR

Link to comment
Share on other sites

Modifications to Siao's example gives upwards movement.

#include <WindowsConstants.au3>
#include <WinAPI.au3>

$hScreenDC = _WinAPI_GetWindowDC(0)
$hMemDC = _WinAPI_CreateCompatibleDC($hScreenDC)
$hMemBMP = _WinAPI_CreateCompatibleBitmap($hScreenDC, @DesktopWidth, @DesktopHeight*2)
_WinAPI_DeleteObject(_WinAPI_SelectObject($hMemDC, $hMemBMP))
_WinAPI_BitBlt($hMemDC, 0, 0, @DesktopWidth, @DesktopHeight, $hScreenDC, 0, 0, $SRCCOPY)
_WinAPI_BitBlt($hMemDC, 0, @DesktopHeight,  @DesktopWidth, @DesktopHeight, $hScreenDC, 0, 0, $SRCCOPY)

For $i = 0 To @DesktopHeight  Step 8 ;scroll Up
;For $i =  @DesktopHeight To 0 Step -8 ;scroll Down
    _WinAPI_BitBlt($hScreenDC, 0, 0, @DesktopWidth, @DesktopHeight, $hMemDC, 0, $i, $SRCCOPY)
    Sleep(20)
Next

_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE+$RDW_ALLCHILDREN)
_WinAPI_ReleaseDC(0, $hScreenDC)
_WinAPI_DeleteObject($hMemBMP)
_WinAPI_DeleteDC($hMemDC)

Exit
Link to comment
Share on other sites

  • 2 months later...

thanks Malkey

hello everybody is possible to help me for this ?

bhwnd = True

if(bhwnd || messagebox(....)==idok) ...

my conversion is no good

$bhwnd = true

if ($bhwnd) then $reponse = msgbox(33,"title","text")

if $reponse = 1 then ...

How translate them || in autoit ?

Me frappe pas !! je débute dans le monde du code :)Un novice avertit en vaut dix sans ennuie ;)AuToiT-FR

Link to comment
Share on other sites

  • Moderators

It means "Or" for AutoIt.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

thanks Smoke_N :)

$bhwnd = True

if($bhwnd or msgbox(....)==1) ...

but is not fonctionnel, dialogbox is not display

I'm to change or to and (is correct :P )

$bhwnd = True

if($bhwnd And msgbox(....)==1) ...

thank you

Me frappe pas !! je débute dans le monde du code :)Un novice avertit en vaut dix sans ennuie ;)AuToiT-FR

Link to comment
Share on other sites

  • Moderators

thanks Smoke_N :)

$bhwnd = True

if($bhwnd or msgbox(....)==1) ...

but is not fonctionnel, dialogbox is not display

I'm to change or to and (is correct :P )

$bhwnd = True

if($bhwnd And msgbox(....)==1) ...

thank you

What are you talking about... you're making no sense at all.

bhwnd = True
if(bhwnd || messagebox(....)==idok) ...

The code roughly translates to:

$bhwnd = True
If (($bhwnd) Or MsgBox(64, "info", "something here") = 1) Then

Now the code above is quite redundant because MsgBox(number, title, text) ... if there is only an OK button, then "If" statement will ALWAYS be true.

Where are you translating this code from?

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...