Jump to content

What would this be in Autoit?


AzKay
 Share

Recommended Posts

Private Enum SOMETHING
    _SOMETHING1 = 0
    _SOMETHING2 = 1
End Enum

Private Declare Function SomeFunction Lib "user32.dll" Alias "_SomeFunction" (somevar As SOMETHING) As Long

Edited by AzKay
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

  • Developers

Depends on what you really want to do. maybe show some code you are working on and needs this in?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Well, In the case of the first post; It would be something like:

$someVar = "adsfasfdf"
DllCall("user32.dll", "long", "_SomeFunction", "SOMETHING", $somevar)

The SOMETHING, would be;

Private Enum SOMETHING
    _SOMETHING1 = 0
    _SOMETHING2 = 1
End Enum

I dont see how that works in autoit.

Edited by AzKay
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

  • Developers

Still lost as to what you expect as a result of this shown SOMETHING call.

To me Enum is a function to enumurate something and you are calling it with a string as input ?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I have no idea whats going on here. Which is why I was asking if anyone knew what the VB6 code in the first post, would be in autoit. SOMETHING, is apparently a data type, which to me doesnt make sense.

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

in VB you can use ENUMs as datatypes and only values which are available in the enum are accepted. in AutoIt this would be:

Global Enum $_SOMETHING1=0, $_SOMETHING2
DllCall("some.dll","long","SomeFunction","dword",$_SOMETHING1)
; or 
DllCall("some.dll","long","SomeFunction","dword",$_SOMETHING2)

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

The short answer would be that you can use "int" instead of "SOMETHING" for the variable type.

The longer answer is that Enum(erated types) in some other languages are similar, but not quite the same as Enum in AutoIt. When you define an Enum in some other languages, it actually creates a new type. Something like

enum color { RED, ORANGE, YELLOW, GREEN, BLUE, INDIGO, VIOLET };

in C++ creates a new type called "color" by which you can create new variables of that type (see Wikipedia for more details).

I guess you don't need to worry about the distinction here, though :) It's just to explain that AutoIt's Enum doesn't have the same type-creation behavior that VB's Enum has. In the end, you can still work around that because enumerated types have constant values that people (usually?) associate with integers, so you can just send the associated integer for the enumerated constant you want (you'll notice that in your example VB code, _SOMETHING1 is associated 0, and _SOMETHING2 is associated with 1).

Edited by -Ultima-

[ WinINet.au3 | Array.au3 (Optimized) | _UnixTimeParse() ]

Link to comment
Share on other sites

maybe a dll struct ??

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

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