Jump to content

use autoit with c++


 Share

Recommended Posts

-hi, everyone , i tried to use autoit with c++ follwing this advice:

Dev C++

1. start a new project

2. go to your Autoit directory (usually C:\Program Files\AutoIt\ )

3. go to the AutoItX/StandardDLL/DevC folder within your Autoit directory

4. copy the following files to your project directory: AutoIt3.h libautoitx3.a AutoItX3.dll main.cpp

5. in Dev-C++, go to Project->Add to project

6. Add the following files to the project: main.cpp AutoIt3.h

Quote:

NOTE: You may need to remove the "main.cpp" file that Dev-C++ automatically adds before adding the autoit example. just go to Project->Remove from project or right click on the file on the left hand side and click "remove". If it asks you to save click no.

7. Now go to Project->Project Options and click on the Parameters tab

8. Click the button that says "Add library or object"

9. Select the libautoitx3.a file

10. the program should now compile and run. the example opens notepad and sends some text to it.

-my code is :

// Empty project additions:

// Added "AutoIt3.h" include

// Added "AutoItX3.lib" to the input linker libraries

//

// AutoItX3.dll needs to be in the run path during execution

#include <Windows.h>

#include "AutoIt3.h"

int APIENTRY WinMain(HINSTANCE hInstance,

HINSTANCE hPrevInstance,

LPSTR lpCmdLine,

int nCmdShow)

{

// You can now call AutoIt commands, e.g. to send the keystrokes "hello"

AU3_Sleep(1000);

AU3_Run("notepad.exe", "", 1);

AU3_WinWaitActive("Untitled -", "", 0);

AU3_Send("Hello{!}", 0);

// Get the text in the status bar

//char szText[1000];

//AU3_StatusbarGetText("Untitled -", "", 2, szText, 1000);

//MessageBox(NULL, szText, "Text:", MB_OK);

return 0;

}

-but i reveived unexpected error :

C:\Documents and Settings\UserI\Desktop\New Folder\main.cpp In function `int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)':

17 C:\Documents and Settings\UserI\Desktop\New Folder\main.cpp cannot convert `const char*' to `const WCHAR*' for argument `1' to `long int AU3_Run(const WCHAR*, const WCHAR*, long int)'

18 C:\Documents and Settings\UserI\Desktop\New Folder\main.cpp cannot convert `const char*' to `const WCHAR*' for argument `1' to `long int AU3_WinWaitActive(const WCHAR*, const WCHAR*, long int)'

19 C:\Documents and Settings\UserI\Desktop\New Folder\main.cpp cannot convert `const char*' to `const WCHAR*' for argument `1' to `void AU3_Send(const WCHAR*, long int)'

- and the dev c++ i used is 4.9.9.2 , can anybody help me , thanks

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