Jump to content
Sign in to follow this  
SlimShady

DllCall and GUI

Recommended Posts

SlimShady

I was just wondering.

Can we add Windows controls in a GUI dialog?

Thinking about it... DllCall can run any function.

So we can create a GUI from scratch using Createwindow.

I know where I would bump into a problem: There are functions that need other info than numbers or strings, like "long", "byte", "pointer", "dword", etc.

Share this post


Link to post
Share on other sites
this-is-me

You would probably be able to add them, but not be able to check when someone did something with them like clicking. A person could make a funny joke program to add buttons to messageboxes.


Who else would I be?

Share this post


Link to post
Share on other sites
SlimShady

Conclusion:

There are 2 things we can do.

1. Beg the developers to add a Windows control

2. Learn C++ and add them ourselves in AutoIt.

Share this post


Link to post
Share on other sites
this-is-me

3. Learn c++ and expand dllcall.

The above is what I am currently learning c++ for.


Who else would I be?

Share this post


Link to post
Share on other sites
Valik

I hope thats not your only reason because if it is, thats a complete waste of time. There are technical limitations to the language that (rightly) prevent the sort of trickery necessary to acheive a satisfactory result. About the only solution is to literally write your own DLL and hard code read/write access points along with object factories for every type you wish to support.

For example, given the following structure (Fictional):

struct HoldData
{
    int a;
    // Other members
}

In order to wrap that, you would need to export the following from a DLL:

void Create_HoldData(void **out)
{
    *out = new HoldData;  
    // Must be a pointer, unsafe to pass objects across DLL/EXE line
}

void Destroy_HoldData(void *in)
{
    delete in;
}

int Get_a(void *in)
{
    return (HoldData*)in->a;
}

void Set_a(void *in, int _a)
{
    (HoldData*)in->a = _a;
}

// Other members

My casts may be off, ignore that, its concept code.

Basically, you'd have to create a function to create the object, one to destroy it, then any member you wish to read/write to would need wrapped in a function as well. You would then compile this into a DLL and then use DllCall() to create objects (Assuming Jon adds a place to store a void* in the Variant class).

Share this post


Link to post
Share on other sites
this-is-me

No, it's not my only reason. I aslo have a great many projects that just can't be done in VB because of the complexity in comparison to C++. Yes, I know c++ is complex but forcing VB to do something that it doesn't normally support is very taxing to the mind. I am learning C++ to be able to do things that I normally couldn't. If I happen to run up on a problem with autoit like this that nobody else seems interested in, I will also try to contribute.


Who else would I be?

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  

×