MTNT Posted October 4, 2022 Posted October 4, 2022 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.
funkey Posted October 5, 2022 Posted October 5, 2022 Did you try the example 'AutoItX.cpp' ? Did you follow the instructions in example? Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning.
MTNT Posted October 5, 2022 Author Posted October 5, 2022 where is the location AutoITX.cpp? i can't see in main folder and sub folder.
MTNT Posted October 5, 2022 Author Posted October 5, 2022 #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.
funkey Posted October 5, 2022 Posted October 5, 2022 Either link the lib file or load the library as you did. Both should work. Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning.
MTNT Posted October 5, 2022 Author Posted October 5, 2022 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 funkey Posted October 6, 2022 Solution Posted October 6, 2022 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 tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now