Jump to content

How Can i Use Autoit Function in C++ ?


Go to solution Solved by funkey,

Recommended Posts

Posted

hi everyone i am a newbie.

i am using c# add references and select AutoItX3.dll after that using AutoItX3Lib;

and call all function easly.

but now i want to use autoit with c++

i am adding #include "C:\Program Files (x86)\AutoIt3\AutoItX\AutoItX3_DLL.h" and saw AU3_ControlClick and all other functions in main function but useless.

Any tutorial for how can i use autoit with c++ ?

 

Thank for helping.

 

 

 

Posted

Did you try the example 'AutoItX.cpp' ?

Did you follow the instructions in example?

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Posted
#include <iostream>
#include <windows.h>
#include "C:\Program Files (x86)\AutoIt3\AutoItX\AutoItX3_DLL.h"



int main()
{
    HINSTANCE hGetProcIDDLL = LoadLibraryA("C:\\Program Files (x86)\\AutoIt3\\AutoItX\\AutoItX3.dll");

    if (!hGetProcIDDLL) {
        std::cout << "could not load the dynamic library" << std::endl;
        
    }

    else
    {
        std::cout << "Loaded" << std::endl;
        AU3_MouseMove(100, 200);
    }
   

Also i added project properties-linker-input-additional dependencies- and adding AutoItX3_DLL.lib in AutoItX folder.

I dont know this way is true but working now for me.İm waiting other simple idea and ways.

Posted

Either link the lib file or load the library as you did. Both should work.

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Posted

 

int main()
{
    loaddll("C:\\Program Files (x86)\\AutoIt3\\AutoItX\\AutoItX3.dll");
    LPCSTR client = "*q.txt - Notepad";
    LPCWSTR clientw = (LPCWSTR)(client);
    LPCSTR text = "TryTothis..";
    LPCWSTR textw = (LPCWSTR)(text);
    LPCSTR edit = "Edit1";
    LPCWSTR edit1 = (LPCWSTR)(edit);

    HWND hwnd =AU3_WinGetHandle(clientw,NULL);

    AU3_ControlSend(clientw,NULL,edit1,textw,0);
    Sleep(3000);
    AU3_Send(textw, 0);
    AU3_MouseMove(1920, 1080);
    

   
    
}

i 'm trying functions but wingethandle return 0000 controlsend not working send function working but writing  牔呹瑯楨⹳. japanese character like that
mousemove working perfectly.

i need help why doing this.

  • Solution
Posted

You cannot cast strings from LPCSTR to LPCWSTR.....

Initialize WStrings like this with the 'L':

LPCWSTR clientw = L"*q.txt - Notepad";

 

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...