Jump to content

Recommended Posts

Posted (edited)

Hi there

I have this vb6 code

Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

I tried to bring it to autoit (nearly guessing all the thing) and I got this:

Func PostMessage($hwnd,$wMsg,$wParam,$lParam)
    DllCall("user32.dll", "Long", "PostMessageA", "Long", $hwnd, "Long", $wMsg, "Long", $wParam, "Long", $lParam)
EndFunc

Is this right ?

'cause it is't working :P

thanks in advance

Edited by torels

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Posted

$aResult = DllCall("User32.dll", "int", "PostMessageA", "hwnd", $hWnd, "int", $iMsg, "int", $iwParam, "int", $ilParam)

Return $aResult[0]

Posted

why does Long become Int ???

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Posted (edited)

You can use long if you like but I'm using int because you can use it for basically everything.

int a 32 bit integer

long a 32 bit integer

The problem was type "hwnd".

@ zorphnog

A stands for ANSI.

From the helpfile:

By default, AutoIt tries to use the ANSI version of a function name, i.e. MessageBoxA is attempted when MessageBox is given as the function name. To call the unicode version use MessageBoxW.

Edited by Pain
Posted

Thanks

And... are there right ?

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Func FindWindow($Classname,$windowname)
    $dc = DllCall("User32.dll", "Long", "FindWindow", "String", $Classname, "String", $windowname)
    MsgBox(0,"",$dc[0])
    Return $dc[0]
EndFunc

?

thanks in advance

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Posted

Seems right but there is no type called "string", try with "str".

DllCall("user32.dll", "long", "FindWindow", "str", $Classname, "str", $windowname)

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
×
×
  • Create New...