Jump to content

C++ help: LNK2019 and ControlClick


CmdrVimes
 Share

Recommended Posts

I have a small issue with ControlClick throwing up a LNK2019 error in Visual C++ 2010 Express. I'm a bit new to C++ (started learning 3 days ago to be precise) but I've done some C, Java, and of course AutoIT. I've already written this in AutoIT and it worked fine, I am just porting it to C++.

void tabSelect()
{
int selected = 0;
wchar_t tabText[5];
while (selected == 0)
{
AU3_ControlClick(L"", L"", L"[CLASS:SysTabControl32]", L"",1,175,30);
AU3_WinGetText(L"",L"RS232",tabText,5);
if (tabText == L"RS232")
selected = 1;
else
AU3_ControlClick(L"", L"", L"[CLASS:SysTabControl32]", L"",1,175,10);
}
}

To summarise: I'm selecting a tab labeled "RS232". The tab is designed (by the company who made it, badly) so that all of the tabs are merged into one large object so I have to click co-ordinates. Once clicked, I then have to check for the specific text "RS232" to be present on the whole screen.

Anyway, this throws up an error:

1>------ Build started: Project: CTA5, Configuration: Debug Win32 ------
1>main.obj : error LNK2019: unresolved external symbol _AU3_ControlClick@28 referenced in function "void __cdecl tabSelect(void)" (?tabSelect@@YAXXZ)
1>ocz.ocz.ukexportHardwareA001H05ExperimentsCPPCTA5DebugCTA5.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I've come across the LNK2019 before (I hadn't included the AutoITX3.lib file), but this time around I'm stumped as to what the issue is.

Edit: I know I posted this in general help, but someone said it would be better in here so I've reposted. Sorry that it's a repost.

Edit 2: After some trial and error (i.e. running some other AU3_ code) I've determined it is a problem with ControlClick only... which, as far as I can tell, probably means there is an error in the dll or lib file.

Edited by CmdrVimes
Link to comment
Share on other sites

Looks like a linker error. I hate those... I have not done any development with AutoItX, or dlls at all for that matter - are you loading the DLL (LoadLibrary()) ?

[font="Comic Sans MS"]My code does not have bugs! It just develops random features.[/font]My Projects[list][*]Live Streaming (Not my project, but my edited version)[right]AutoIt Wrappers![/right][/list]Pure randomness[list][*]Small Minds.......................................................................................................[size="1"]Simple progress bar that changes direction at either sides.[/size][*]ChristmasIt AutoIt Christmas Theme..........................................................[size="1"]I WAS BOOOORED![/size][*]DriveToy..............................................................................................................[size="1"]Simple joke script. Trick your friends into thinking their computer drive is haywire![/size][/list]In Development[list][*]Your Background Task Organiser[*]AInstall Second Generation[/list]BEFORE POSTING ON THE FORUMS, TRY THIS:

%programfiles%/AutoIt3/autoit3.chm
Link to comment
Share on other sites

Looks like a linker error. I hate those... I have not done any development with AutoItX, or dlls at all for that matter - are you loading the DLL (LoadLibrary()) ?

I'm not loading the library directly, but I must assume that it is being loaded at some point: other functions like AU3_Run work, it's just AU3_ControlClick that does not.

Edit: it's being loaded by the Header File.

Edited by CmdrVimes
Link to comment
Share on other sites

  • 4 weeks later...

Use AutoItX3.dll in C++

1. Open Windows Forms Application

2. New Reference and browse AutoItX3.dll

3.Import AutoItX3Lib;

4.Write code to Button1

Example:

String^ au3 = AutoItX3;

au3->ControlClick(L"", L"", L"[CLASS:SysTabControl32]", L"",1,175,30);

My Sample Script

Download: VistaDesktopIconsChangerForXp.au3 (Com,Doc and Bin only) http://www.4shared.com/rar/NMHYL5Igba/VistaDesktopIconsChangerForXp_.html

                     VistaDesktopIconsChangerForXp.exe (Resources) http://www.4shared.com/rar/nzs7Mb1gba/VistaDesktopIconsChangerForXp_.html

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