janus96 Posted October 12, 2007 Share Posted October 12, 2007 Now that I know how to get AutoIt to work under MFC, I'd like to move on to .NET.I've searched this forum back to the year 2005. The closest I could find was an example in C#:http://www.autoitscript.com/forum/index.php?showtopic=26042It gave me some ideas, e.g. using namespace AutoItX3Lib; ............. AutoItX3Lib.AutoItX3Class aix3c = new AutoItX3Lib.AutoItX3Class();and some other combinations, but none of them would work. The project was a CLR/Windows Forms Application project. I've added Interop.AutoItX3Lib.1.0 to the reference.Any help will be greatly appreciated. Thanks. Link to comment Share on other sites More sharing options...
janus96 Posted October 12, 2007 Author Share Posted October 12, 2007 It gave me some ideas, e.g. using namespace AutoItX3Lib; ............. AutoItX3Lib.AutoItX3Class aix3c = new AutoItX3Lib.AutoItX3Class();and some other combinations, but none of them would work. The project was a CLR/Windows Forms Application project. I've added Interop.AutoItX3Lib.1.0 to the reference.Any help will be greatly appreciated. Thanks.Let me add that from the Object Browser in Visual Studio I can see clearly the objects and functions of AutoItXLib. A screen capture is attached here. I think if I can be shown the syntax of object declaration and instanciation, I'll be able to get it going. Thanks. Link to comment Share on other sites More sharing options...
janus96 Posted October 12, 2007 Author Share Posted October 12, 2007 Ok, I got it to work. The coding is much cleaner than using dll in VC++. I love it. AutoItX3Lib::AutoItX3Class^ aix3c = gcnew AutoItX3Lib::AutoItX3Class(); aix3c->MouseMove(-500,500,10); However, in compiling, the compiler asked that "gcnew" be used, instead of "new". "gcnew", however, returns a pointer. Such is the reason why "->" must be used instead of ".". It's ok with me, but I wonder if someone can tell me how to get around this, so that I can get an object instead a pointer to an object. Thanks. Link to comment Share on other sites More sharing options...
janus96 Posted October 12, 2007 Author Share Posted October 12, 2007 Tested more functions. Everything now works right out of the box, even the ControlListView which I had trouble calling from Matlab. I think I'll do Matlab Automation from .NET. Link to comment Share on other sites More sharing options...
Sunaj Posted October 12, 2007 Share Posted October 12, 2007 Hey dude, thanks for sharing your work here, appreciated! Cheers,SunajTested more functions. Everything now works right out of the box, even the ControlListView which I had trouble calling from Matlab. I think I'll do Matlab Automation from .NET. [list=1][*]Generic way to detect full path to default browser, List/ListView Events Using GuiRegisterMsg (detect doubleclick and much more)[*]Using dllcall for full control over fileopendialog, Make DirMove act somewhat normally (by circumventing it...)[*]Avoid problems with "&" (chr(38)) in code, Change desktop maximized area/workspace (fx to make deskbar type app)[*]Change focus behavior when buttons are clicked to work closer to 'standard windows' app[*](Context) Menus With Timed Tooltips, Fast Loops & Operators in AU3[*]Clipboard UDF, A clipboard change notification udf[/list] Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 12, 2007 Share Posted October 12, 2007 gcnew is a keyword to allow the object to be garbage collected (gc). You are supposed to use a pointer when using objects in this nature. When you use .Net, every "object" is a reference type. Your variables are all pointers (references) to the objects. You cannot directly hold an object in .Net, only a reference to it. This is how the garbage collector knows how to clean up, when all references to the object expire. Link to comment Share on other sites More sharing options...
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