Sign in to follow this  
Followers 0
AzKay

What would this be in Autoit?

12 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



I dont see how it works.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

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 ?


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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- #

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

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() ]

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Thanks :3


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
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
Sign in to follow this  
Followers 0