Jump to content

Autoit in C++


xZZTx
 Share

Recommended Posts

This thread is funny.

Does someone mind answering a uh... better question.

Since you must use AutoItx3.dll as a recource, this means you must have this in the same directory as your compiled AutoIt C++ program? If so, is there anyway to use dll's as an internal recource?

I think that may be a bit hard. Sure, having it embedded in the EXE as a resource is easy, but when it comes time to call a function, you'd have to do that manually. If I'm not mistaken (and of course, I probably am), the Windows API doesn't have any functions for getting the address of a function that has all ready been loaded into memory. So, you'll either have to find the address of the function in memory, typecast it to a typedef of a function pointer (to the function you are trying to call) and then call it, or you can setup the stack, and call it through ASM.

typedef int(*LPADD)(int,int); // typedef for an add function...

int main()
{
       void* address = ...; //get the address of the function...
       LPADD add = (LPADD)address;
       int sum = add(100,200);
}

Or the ASM way, (something like this anyways):

int main()
{
       void* address = ...; //get address of the function...

       __asm
       {
               push 100
               push 200
               call dword ptr [address]
               pop
               pop
       }
}
Link to comment
Share on other sites

  • Replies 55
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Moderators

I think that may be a bit hard. Sure, having it embedded in the EXE as a resource is easy, but when it comes time to call a function, you'd have to do that manually. If I'm not mistaken (and of course, I probably am), the Windows API doesn't have any functions for getting the address of a function that has all ready been loaded into memory.

http://www.autoitscript.com/forum/index.php?showtopic=77463

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

Wow... uh, wow. ;) You shouldn't blatantly disrespect Valik like you did, but rather take the time to LISTEN & COMPREHEND his 'useless comments which aren't helping me solve the ONE error I have'. That one error (as has been stated numerous times thus far) is an error that only someone who has never even glanced at a most basic C++ guide before would make. Now go stand in the corner and think about what you have done.. and bring a C++ book with you; you might actually learn something.

Edited by dandymcgee

- Dan [Website]

Link to comment
Share on other sites

There are plenty of resources out there for learning C++ these days, he just needs the motivation. I started off thinking similar thoughts; I'll just jump right into C++ like I did with AutoIt and figure it all out on my own. That's not possible. Not without some sort of reference or resource. Although AutoIt may have been written in C++, it is an entirely different language. Therefore, one must understand the differences before you can attempt to take advantage of the similarities.

Edited by dandymcgee

- Dan [Website]

Link to comment
Share on other sites

Lame for looking up tuts and buying books? Isnt that what you guys have been trying to tell the op to do??? ;)

Spoiler

 

"If a vegetarian eats vegetables,What the heck does a humanitarian eat?"

"I hear voices in my head, but I ignore them and continue on killing."

"You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring."

An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist.

 

 
Link to comment
Share on other sites

I learned C++ by jumping into it.

Well surely anyone with the capability of simply jumping in and learning C++ without reference would have been able to figure this out:

cannot convert parameter 1 from 'int' to 'const char *'

.. in a matter of seconds.

Edited by dandymcgee

- Dan [Website]

Link to comment
Share on other sites

Well surely anyone with the capability of simply jumping in and learning C++ without reference would have been able to figure this out:

cannot convert parameter 1 from 'int' to 'const char *'

.. in a matter of seconds.

I didn't read all the other posts, so I am sorry for jumping in the middle of a discussion possibly.

I could figure it out if I knew another language that uses data types quite quickly. I would know I would have to convert int to a const char * or replace the function by something that accepts an const char * instead of an integer.

I would then Google a solution. I would then try something with ostringstream and c_str().

So, all in all, it wouldn't be seconds, but it will not take hours either.

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