Jump to content

jcddcjjcd

Active Members
  • Posts

    30
  • Joined

  • Last visited

Everything posted by jcddcjjcd

  1. I think that if you convert the declarations to vb using a free online conversion tool then it will be no different from using it in C#. Convert one declaration first to see if it works then you will know. Please let us know how you get on. Regards, John.
  2. That may be "correct" and I thank you for the comment but the other way works very nicely in my experience and suits a particular need. I am open to extended reasoning however. Regards, John.
  3. Have a look at: It may help you. Regards, John.
  4. When you are developing an app using AnyCPU you need a way to provide the correct 32 for 64 bit implementation of AutoItX3. To do this I include both AutoItX3.dll and AutoItX3_x64.dll in the build but in AutoItX3Declarations I change all references to AutoItX3.dll to AutoItX3_targetted.dll Then in MainForm.Load I copy the AutoItX3.dll orAutoItX3_x64.dll to a new file called AutoItX3_targetted.dll based on whether we are running in 32 bit or 64 bit environment. Here is the code. //So that we can target 32 and 64bit system with AnyCPU we need to provide the correct AutoItX3 dll depending on platform. //We can't refference both of them. string ExecutingAssemblyPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); string fullPath = ""; string newFilePath = Path.Combine(ExecutingAssemblyPath, "AutoItX3_targetted.dll"); if (IntPtr.Size == 4) { fullPath = Path.Combine(ExecutingAssemblyPath, "AutoItX3.dll"); } else { fullPath = Path.Combine(ExecutingAssemblyPath, "AutoItX3_x64.dll"); } if (System.IO.File.Exists(fullPath)) { try { System.IO.File.Copy(fullPath, newFilePath, true); } catch (Exception ex) { Logger.WriteLog("AutoItX3_targetted.dll Creation Failure!", ex); MessageBox.Show("AutoItX3_targetted.dll Creation Failure!rnApplicaction will Exit"); Application.Exit(); } } Regards, John.
  5. Thanks for adding the documentation Joe. I happened by here and was delighted to see your post. Regards, John.
  6. Hi. I just noticed your post. I only check here very occasionally. I suggest you read through this entire thread, somewhere you will see that I updated the code, from memory I think is was when it supported unicode. You will need to use the 3.3 autoitx and the declarations I posted to go with it. With the new declarations things will work again for you. This is from memory, it you try all this and still have problems then post here again, I will keep and eye out. Regards, John.
  7. I first tried this kind of approach: internal static void AU3_Init() { if(IntPtr.Size == 4) { AutoItX3Declarations32.AU3_Init(); } else { AutoItX3Declarations64.AU3_Init(); } } but that does not work because the call to the other dll is partly resolved at runtime and causes an exception. I searched for hours to find a more elegant solution but they were all much uglier. This works nicely and is simple with the advantage of easy updates to the dll's without having to recompile the applications as would be the case if the dll's were embedded in an other assembly which was conditionally loaded. Perhaps others will have some ideas. Regards, John.
  8. I recently decided to give all my applications the ability to load on either 32 or 64 bit machines. Here I present my way of loading the correct dll for the operating system being targeted. If you are not using the AnyCPU compile option and are targeting 32 or 64 directly then this is not needed but you have to maintain 2 development versions. First thing is to make all your declarations like this: [DllImport("AutoItX3_targetted.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_Init(); And to make sure you have the correct dll loaded put this in the MainForm.Load //So that we can target 32 and 64bit system with AnyCPU we need to provide the correct AutoItX3 dll depending on platform. //We can't refference both of them. string ExecutingAssemblyPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); string fullPath = ""; string newFilePath = Path.Combine(ExecutingAssemblyPath, "AutoItX3_targetted.dll"); if (IntPtr.Size == 4) { fullPath = Path.Combine(ExecutingAssemblyPath, "AutoItX3.dll"); } else { fullPath = Path.Combine(ExecutingAssemblyPath, "AutoItX3_x64.dll"); } if (System.IO.File.Exists(fullPath)) { try { System.IO.File.Copy(fullPath, newFilePath, true); } catch (Exception ex) { Logger.WriteLog("AutoItX3_targetted.dll Creation Failure!", ex); MessageBox.Show("AutoItX3_targetted.dll Creation Failure!\r\nApplicaction will Exit"); Application.Exit(); } } So the code always refers to "AutoItX3_x64.dll" In the Visual Studio Solutions Explorer you mark the dll's as Always Copy in Properties. Hope this helps. Regards, John. PS. The 64 bit AutoItX3 works very well in Windows 7 64bit and I did not need to make any changes to the AutoItX3Declarations.cs I presented in the post shown below except to change "AutoItX3.dll" to "AutoItX3_x64.dll" http://www.autoitscript.com/forum/index.php?showtopic=72905&hl=jcddcjjcd&st=0
  9. Just paste the whole class supplied here into a new class you have created and named AutoItX3Declarations.cs This will become part or you project. Inside the supplied code change the "namespace IRhub" near the top to be the same as your own namespace then just use the code as in the examples near the top of the code. Regards, John.
  10. Here is another thought for those having difficulty with returned values. I have not had to use this with AutoIt but it has helped me out with code that used external dll's. Sometimes the Garbage collector can be too quick and you loose your data before it has been used. Seems that this should not happen yet .net provides us with the PINNED mehcanism. int mouseposition; GCHandle gchandle1 = GCHandle.Alloc(mouseposition, GCHandleType.Pinned); //prevent the GC from affecting the variable mouseposition = AutoItX3Declarations.AU3_MouseGetPosX(); //use the value in mouseposition gchandle1.Free(); //let the GC do his thing again If it doesn't help here you may find it useful elsewhere. Regards, John.
  11. Roel. Please send your code snippet to me at: jdekker@xtra.co.nz I will take a look at it. Regards, John.
  12. Hello JLeveille. This is an example how I use the function in my code to do a mouse click: AutoItX3Declarations.AU3_MouseClick("left" , AutoItX3Declarations.AU3_MouseGetPosX() , AutoItX3Declarations.AU3_MouseGetPosY() , 1, 10); Something else to consider is using AutoItX3Declarations.AU3_AutoItSetOption although I have never needed to. It has and option called MouseCoordMode: MouseCoordMode Sets the way coords are used in the mouse functions, either absolute coords or coords relative to the current active window: 0 = relative coords to the active window 1 = absolute screen coordinates (default) 2 = relative coords to the client area of the active window Regards, John.
  13. For an alternate way of using AutoItX3 in C# that does not require registering have a look at this. On page 2 you will see an updated version for 3.3.0.0 which returns Unicode data. Regards, John.
  14. Since I first posted the AutoItX3Declarations class here, AutoIt has gone to version 3.3.0.0 which returns Unicode data. I have made the changes required for this to work with the new AutoItX3.dll and these changes are: 1. public const int version = 110; //was 109 if previous non-unicode version 2. byte[] is superseded by Stringbuilder which means conversions from byte[] to Unicode are no longer required. Users are advised to read the notes at the top. I have done only quick testing so any issues that are encountered should be posted here so that I can respond too them. Regards, John. CODEusing System;using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; namespace IRhub { internal static class AutoItX3Declarations { //NOTE: This is based on AutoItX v3.3.0.0 which is a Unicode version //NOTE: My comments usually have "jcd" appended where I am uncertain. //NOTE: Optional parameters are not supported in C# yet so fill in all fields even if just "". //NOTE: Be prepared to play around a bit with which fields need values and what those value are. //NOTE: In previous versions we used byte[] to return values like this: //byte[] returnclip = new byte[200]; //at least twice as long as the text string expected +2 for null, (Unicode is 2 bytes) //AutoItX3Declarations.AU3_ClipGet(returnclip, returnclip.Length); //clipdata = System.Text.Encoding.Unicode.GetString(returnclip).TrimEnd('\0'); //Now we are returning Unicode we can use StringBuilder instead like this: //StringBuilder clip = new StringBuilder(); //passing a parameter here will not work, we must asign a length //clip.Length = 200; //the number of chars expected plus 1 for the terminating null //AutoItX3Declarations.AU3_ClipGet(clip,clip.Length); //MessageBox.Show(clip.ToString()); //NOTE: The big advantage of using AutoItX3 like this is that you don't have to register //the dll with windows and more importantly you get away from the many issues involved in //publishing the application and the binding to the dll required. //The below constants were found by Registering AutoItX3.dll in Windows //, adding AutoItX3Lib to References in IDE //,declaring an instance of it like this: // AutoItX3Lib.AutoItX3 autoit; // static AutoItX3Lib.AutoItX3Class autoit; //,right clicking on the AutoItX3Class and then Goto Definitions //and seeing the equivalent of the below in the MetaData window. //So far it is working //NOTE: easier way is to use "DLL Export Viewer" utility and get it to list Properties also //"DLL Export Viewer" is from http://www.nirsoft.net // Definitions public const int AU3_INTDEFAULT = -2147483647; // "Default" value for _some_ int parameters (largest negative number) public const int error = 1; public const int SW_HIDE = 2; public const int SW_MAXIMIZE = 3; public const int SW_MINIMIZE = 4; public const int SW_RESTORE = 5; public const int SW_SHOW = 6; public const int SW_SHOWDEFAULT = 7; public const int SW_SHOWMAXIMIZED = 8; public const int SW_SHOWMINIMIZED = 9; public const int SW_SHOWMINNOACTIVE = 10; public const int SW_SHOWNA = 11; public const int SW_SHOWNOACTIVATE = 12; public const int SW_SHOWNORMAL = 13; public const int version = 110; //was 109 if previous non-unicode version ///////////////////////////////////////////////////////////////////////////////// //// Exported functions of AutoItXC.dll ///////////////////////////////////////////////////////////////////////////////// //AU3_API void WINAPI AU3_Init(void); //Uncertain if this is needed jcd [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_Init(); //AU3_API long AU3_error(void); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_error(); //AU3_API long WINAPI AU3_AutoItSetOption(LPCWSTR szOption, long nValue); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_AutoItSetOption([MarshalAs(UnmanagedType.LPWStr)] string Option, int Value); //AU3_API void WINAPI AU3_BlockInput(long nFlag); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_BlockInput(int Flag); //AU3_API long WINAPI AU3_CDTray(LPCWSTR szDrive, LPCWSTR szAction); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_CDTray([MarshalAs(UnmanagedType.LPWStr)] string Drive , [MarshalAs(UnmanagedType.LPWStr)] string Action); //AU3_API void WINAPI AU3_ClipGet(LPWSTR szClip, int nBufSize); //Use like this: //StringBuilder clip = new StringBuilder(); //clip.Length = 4; //AutoItX3Declarations.AU3_ClipGet(clip,clip.Length); //MessageBox.Show(clip.ToString()); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ClipGet([MarshalAs(UnmanagedType.LPWStr)]StringBuilder Clip, int BufSize); //AU3_API void WINAPI AU3_ClipPut(LPCWSTR szClip); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ClipPut([MarshalAs(UnmanagedType.LPWStr)] string Clip); //AU3_API long WINAPI AU3_ControlClick(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl //, LPCWSTR szButton, long nNumClicks, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nX //, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nY); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlClick([MarshalAs(UnmanagedType.LPWStr)] string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)] string Control , [MarshalAs(UnmanagedType.LPWStr)] string Button, int NumClicks, int X, int Y); //AU3_API void WINAPI AU3_ControlCommand(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl //, LPCWSTR szCommand, LPCWSTR szExtra, LPWSTR szResult, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ControlCommand([MarshalAs(UnmanagedType.LPWStr)] string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)] string Control , [MarshalAs(UnmanagedType.LPWStr)] string Command, [MarshalAs(UnmanagedType.LPWStr)] string Extra , [MarshalAs(UnmanagedType.LPWStr)] StringBuilder Result, int BufSize); //AU3_API void WINAPI AU3_ControlListView(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl //, LPCWSTR szCommand, LPCWSTR szExtra1, LPCWSTR szExtra2, LPWSTR szResult, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ControlListView([MarshalAs(UnmanagedType.LPWStr)] string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)] string Control , [MarshalAs(UnmanagedType.LPWStr)] string Command, [MarshalAs(UnmanagedType.LPWStr)] string Extral1 , [MarshalAs(UnmanagedType.LPWStr)] string Extra2, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder Result , int BufSize); //AU3_API long WINAPI AU3_ControlDisable(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlDisable([MarshalAs(UnmanagedType.LPWStr)] string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)] string Control); //AU3_API long WINAPI AU3_ControlEnable(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlEnable([MarshalAs(UnmanagedType.LPWStr)] string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)] string Control); //AU3_API long WINAPI AU3_ControlFocus(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlFocus([MarshalAs(UnmanagedType.LPWStr)] string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)] string Control); //AU3_API void WINAPI AU3_ControlGetFocus(LPCWSTR szTitle, LPCWSTR szText, LPWSTR szControlWithFocus //, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ControlGetFocus([MarshalAs(UnmanagedType.LPWStr)] string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder ControlWithFocus , int BufSize); //AU3_API void WINAPI AU3_ControlGetHandle(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText //, LPCWSTR szControl, LPWSTR szRetText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ControlGetHandle([MarshalAs(UnmanagedType.LPWStr)] string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)] string Control , [MarshalAs(UnmanagedType.LPWStr)] StringBuilder RetText, int BufSize); //AU3_API long WINAPI AU3_ControlGetPosX(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlGetPosX([MarshalAs(UnmanagedType.LPWStr)] string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)] string Control); //AU3_API long WINAPI AU3_ControlGetPosY(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlGetPosY([MarshalAs(UnmanagedType.LPWStr)] string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)] string Control); //AU3_API long WINAPI AU3_ControlGetPosHeight(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlGetPosHeight([MarshalAs(UnmanagedType.LPWStr)] string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)] string Control); //AU3_API long WINAPI AU3_ControlGetPosWidth(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlGetPosWidth([MarshalAs(UnmanagedType.LPWStr)] string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)] string Control); //AU3_API void WINAPI AU3_ControlGetText(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl //, LPWSTR szControlText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ControlGetText([MarshalAs(UnmanagedType.LPWStr)] string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)] string Control , [MarshalAs(UnmanagedType.LPWStr)]StringBuilder ControlText, int BufSize); //AU3_API long WINAPI AU3_ControlHide(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlHide([MarshalAs(UnmanagedType.LPWStr)] string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)] string Control); //AU3_API long WINAPI AU3_ControlMove(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl //, long nX, long nY, /*[in,defaultvalue(-1)]*/long nWidth, /*[in,defaultvalue(-1)]*/long nHeight); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlMove([MarshalAs(UnmanagedType.LPWStr)] string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)] string Control , int X, int Y, int Width, int Height); //AU3_API long WINAPI AU3_ControlSend(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl //, LPCWSTR szSendText, /*[in,defaultvalue(0)]*/long nMode); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlSend([MarshalAs(UnmanagedType.LPWStr)] string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)] string Control , [MarshalAs(UnmanagedType.LPWStr)] string SendText, int Mode); //AU3_API long WINAPI AU3_ControlSetText(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl //, LPCWSTR szControlText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlSetText([MarshalAs(UnmanagedType.LPWStr)] string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)] string Control , [MarshalAs(UnmanagedType.LPWStr)] string ControlText); //AU3_API long WINAPI AU3_ControlShow(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlShow([MarshalAs(UnmanagedType.LPWStr)] string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)] string Control); //AU3_API void WINAPI AU3_ControlTreeView(LPCWSTR szTitle, LPCWSTR szText, LPCWSTR szControl //, LPCWSTR szCommand, LPCWSTR szExtra1, LPCWSTR szExtra2, LPWSTR szResult, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ControlTreeView([MarshalAs(UnmanagedType.LPWStr)] string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)] string Control , [MarshalAs(UnmanagedType.LPWStr)] string Command, [MarshalAs(UnmanagedType.LPWStr)] string Extra1 , [MarshalAs(UnmanagedType.LPWStr)] string Extra2, [MarshalAs(UnmanagedType.LPWStr)]StringBuilder Result, int BufSize); //AU3_API void WINAPI AU3_DriveMapAdd(LPCWSTR szDevice, LPCWSTR szShare, long nFlags //, /*[in,defaultvalue("")]*/LPCWSTR szUser, /*[in,defaultvalue("")]*/LPCWSTR szPwd //, LPWSTR szResult, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_DriveMapAdd([MarshalAs(UnmanagedType.LPWStr)] string Device , [MarshalAs(UnmanagedType.LPWStr)] string Share, int Flags, [MarshalAs(UnmanagedType.LPWStr)] string User , [MarshalAs(UnmanagedType.LPWStr)] string Pwd, [MarshalAs(UnmanagedType.LPWStr)]StringBuilder Result, int BufSize); //AU3_API long WINAPI AU3_DriveMapDel(LPCWSTR szDevice); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_DriveMapDel([MarshalAs(UnmanagedType.LPWStr)] string Device); //AU3_API void WINAPI AU3_DriveMapGet(LPCWSTR szDevice, LPWSTR szMapping, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_DriveMapGet([MarshalAs(UnmanagedType.LPWStr)] string Device , [MarshalAs(UnmanagedType.LPWStr)]StringBuilder Mapping, int BufSize); //AU3_API long WINAPI AU3_IniDelete(LPCWSTR szFilename, LPCWSTR szSection, LPCWSTR szKey); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_IniDelete([MarshalAs(UnmanagedType.LPWStr)] string Filename , [MarshalAs(UnmanagedType.LPWStr)] string Section, [MarshalAs(UnmanagedType.LPWStr)] string Key); //AU3_API void WINAPI AU3_IniRead(LPCWSTR szFilename, LPCWSTR szSection, LPCWSTR szKey //, LPCWSTR szDefault, LPWSTR szValue, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_IniRead([MarshalAs(UnmanagedType.LPWStr)] string Filename , [MarshalAs(UnmanagedType.LPWStr)] string Section, [MarshalAs(UnmanagedType.LPWStr)] string Key , [MarshalAs(UnmanagedType.LPWStr)] string Default, [MarshalAs(UnmanagedType.LPWStr)]StringBuilder Value, int BufSize); //AU3_API long WINAPI AU3_IniWrite(LPCWSTR szFilename, LPCWSTR szSection, LPCWSTR szKey //, LPCWSTR szValue); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_IniWrite([MarshalAs(UnmanagedType.LPWStr)] string Filename , [MarshalAs(UnmanagedType.LPWStr)] string Section, [MarshalAs(UnmanagedType.LPWStr)] string Key , [MarshalAs(UnmanagedType.LPWStr)] string Value); //AU3_API long WINAPI AU3_IsAdmin(void); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_IsAdmin(); //AU3_API long WINAPI AU3_MouseClick(/*[in,defaultvalue("LEFT")]*/LPCWSTR szButton //, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nX, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nY //, /*[in,defaultvalue(1)]*/long nClicks, /*[in,defaultvalue(-1)]*/long nSpeed); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_MouseClick([MarshalAs(UnmanagedType.LPWStr)] string Button, int x, int y , int clicks, int speed); //AU3_API long WINAPI AU3_MouseClickDrag(LPCWSTR szButton, long nX1, long nY1, long nX2, long nY2 //, /*[in,defaultvalue(-1)]*/long nSpeed); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_MouseClickDrag([MarshalAs(UnmanagedType.LPWStr)] string Button , int X1, int Y1, int X2, int Y2, int Speed); //AU3_API void WINAPI AU3_MouseDown(/*[in,defaultvalue("LEFT")]*/LPCWSTR szButton); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_MouseDown([MarshalAs(UnmanagedType.LPWStr)] string Button); //AU3_API long WINAPI AU3_MouseGetCursor(void); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_MouseGetCursor(); //AU3_API long WINAPI AU3_MouseGetPosX(void); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_MouseGetPosX(); //AU3_API long WINAPI AU3_MouseGetPosY(void); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_MouseGetPosY(); //AU3_API long WINAPI AU3_MouseMove(long nX, long nY, /*[in,defaultvalue(-1)]*/long nSpeed); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_MouseMove(int X, int Y, int Speed); //AU3_API void WINAPI AU3_MouseUp(/*[in,defaultvalue("LEFT")]*/LPCWSTR szButton); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_MouseUp([MarshalAs(UnmanagedType.LPWStr)] string Button); //AU3_API void WINAPI AU3_MouseWheel(LPCWSTR szDirection, long nClicks); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_MouseWheel([MarshalAs(UnmanagedType.LPWStr)] string Direction, int Clicks); //AU3_API long WINAPI AU3_Opt(LPCWSTR szOption, long nValue); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_Opt([MarshalAs(UnmanagedType.LPWStr)] string Option, int Value); //AU3_API unsigned long WINAPI AU3_PixelChecksum(long nLeft, long nTop, long nRight, long nBottom //, /*[in,defaultvalue(1)]*/long nStep); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_PixelChecksum(int Left, int Top, int Right, int Bottom, int Step); //AU3_API long WINAPI AU3_PixelGetColor(long nX, long nY); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_PixelGetColor(int X, int Y); //AU3_API void WINAPI AU3_PixelSearch(long nLeft, long nTop, long nRight, long nBottom, long nCol //, /*default 0*/long nVar, /*default 1*/long nStep, LPPOINT pPointResult); //Use like this: //int[] result = {0,0}; //try //{ // AutoItX3Declarations.AU3_PixelSearch(0, 0, 800, 000,0xFFFFFF, 0, 1, result); //} //catch { } //It will crash if the color is not found, have not been able to determin why jcd //The AutoItX3Lib.AutoItX3Class version has similar problems and is the only function to return an object //so contortions are needed to get the data from it ie: //int[] result = {0,0}; //object resultObj; //AutoItX3Lib.AutoItX3Class autoit = new AutoItX3Lib.AutoItX3Class(); //resultObj = autoit.PixelSearch(0, 0, 800, 600, 0xFFFF00,0,1); //Type t = resultObj.GetType(); //if(t == typeof(object[])) //{ //object[] obj = (object[])resultObj; //result[0] = (int)obj[0]; //result[1] = (int)obj[1]; //} //When it fails it returns an object = 1 but when it succeeds it is object[X,Y] [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_PixelSearch(int Left, int Top, int Right, int Bottom, int Col, int Var , int Step, int[] PointResult); //AU3_API long WINAPI AU3_ProcessClose(LPCWSTR szProcess); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ProcessClose([MarshalAs(UnmanagedType.LPWStr)]string Process); //AU3_API long WINAPI AU3_ProcessExists(LPCWSTR szProcess); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ProcessExists([MarshalAs(UnmanagedType.LPWStr)]string Process); //AU3_API long WINAPI AU3_ProcessSetPriority(LPCWSTR szProcess, long nPriority); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ProcessSetPriority([MarshalAs(UnmanagedType.LPWStr)]string Process, int Priority); //AU3_API long WINAPI AU3_ProcessWait(LPCWSTR szProcess, /*[in,defaultvalue(0)]*/long nTimeout); //Not checked jcd [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ProcessWait([MarshalAs(UnmanagedType.LPWStr)]string Process, int Timeout); //AU3_API long WINAPI AU3_ProcessWaitClose(LPCWSTR szProcess, /*[in,defaultvalue(0)]*/long nTimeout); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ProcessWaitClose([MarshalAs(UnmanagedType.LPWStr)]string Process, int Timeout); //AU3_API long WINAPI AU3_RegDeleteKey(LPCWSTR szKeyname); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_RegDeleteKey([MarshalAs(UnmanagedType.LPWStr)]string Keyname); //AU3_API long WINAPI AU3_RegDeleteVal(LPCWSTR szKeyname, LPCWSTR szValuename); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_RegDeleteVal([MarshalAs(UnmanagedType.LPWStr)]string Keyname , [MarshalAs(UnmanagedType.LPWStr)]string ValueName); //AU3_API void WINAPI AU3_RegEnumKey(LPCWSTR szKeyname, long nInstance, LPWSTR szResult, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_RegEnumKey([MarshalAs(UnmanagedType.LPWStr)]string Keyname , int Instance, [MarshalAs(UnmanagedType.LPWStr)]StringBuilder Result, int BusSize); //AU3_API void WINAPI AU3_RegEnumVal(LPCWSTR szKeyname, long nInstance, LPWSTR szResult, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_RegEnumVal([MarshalAs(UnmanagedType.LPWStr)]string Keyname , int Instance, [MarshalAs(UnmanagedType.LPWStr)]StringBuilder Result, int BufSize); //AU3_API void WINAPI AU3_RegRead(LPCWSTR szKeyname, LPCWSTR szValuename, LPWSTR szRetText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_RegRead([MarshalAs(UnmanagedType.LPWStr)]string Keyname , [MarshalAs(UnmanagedType.LPWStr)]string Valuename, [MarshalAs(UnmanagedType.LPWStr)]StringBuilder RetText, int BufSize); //AU3_API long WINAPI AU3_RegWrite(LPCWSTR szKeyname, LPCWSTR szValuename, LPCWSTR szType //, LPCWSTR szValue); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_RegWrite([MarshalAs(UnmanagedType.LPWStr)]string Keyname , [MarshalAs(UnmanagedType.LPWStr)]string Valuename, [MarshalAs(UnmanagedType.LPWStr)]string Type , [MarshalAs(UnmanagedType.LPWStr)]string Value); //AU3_API long WINAPI AU3_Run(LPCWSTR szRun, /*[in,defaultvalue("")]*/LPCWSTR szDir //, /*[in,defaultvalue(1)]*/long nShowFlags); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_Run([MarshalAs(UnmanagedType.LPWStr)]string Run , [MarshalAs(UnmanagedType.LPWStr)]string Dir, int ShowFlags); //AU3_API long WINAPI AU3_RunAsSet(LPCWSTR szUser, LPCWSTR szDomain, LPCWSTR szPassword, int nOptions); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_RunAsSet([MarshalAs(UnmanagedType.LPWStr)]string User , [MarshalAs(UnmanagedType.LPWStr)]string Domain, [MarshalAs(UnmanagedType.LPWStr)]string Password , int Options); //AU3_API long WINAPI AU3_RunWait(LPCWSTR szRun, /*[in,defaultvalue("")]*/LPCWSTR szDir //, /*[in,defaultvalue(1)]*/long nShowFlags); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_RunWait([MarshalAs(UnmanagedType.LPWStr)]string Run , [MarshalAs(UnmanagedType.LPWStr)]string Dir, int ShowFlags); //AU3_API void WINAPI AU3_Send(LPCWSTR szSendText, /*[in,defaultvalue("")]*/long nMode); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_Send([MarshalAs(UnmanagedType.LPWStr)] string SendText, int Mode); //AU3_API void WINAPI AU3_SendA(LPCSTR szSendText, /*[in,defaultvalue("")]*/long nMode); //Not checked jcd [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_SendA([MarshalAs(UnmanagedType.LPStr)] string SendText, int Mode); //AU3_API long WINAPI AU3_Shutdown(long nFlags); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_Shutdown(int Flags); //AU3_API void WINAPI AU3_Sleep(long nMilliseconds); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_Sleep(int Milliseconds); //AU3_API void WINAPI AU3_StatusbarGetText(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText //, /*[in,defaultvalue(1)]*/long nPart, LPWSTR szStatusText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_StatusbarGetText([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)]string Text, int Part, [MarshalAs(UnmanagedType.LPWStr)]StringBuilder StatusText, int BufSize); //AU3_API void WINAPI AU3_ToolTip(LPCWSTR szTip, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nX //, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nY); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ToolTip([MarshalAs(UnmanagedType.LPWStr)]string Tip, int X, int Y); //AU3_API void WINAPI AU3_WinActivate(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinActivate([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)]string Text); //AU3_API long WINAPI AU3_WinActive(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinActive([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)]string Text); //AU3_API long WINAPI AU3_WinClose(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinClose([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text); //AU3_API long WINAPI AU3_WinExists(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinExists([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)]string Text); //AU3_API long WINAPI AU3_WinGetCaretPosX(void); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetCaretPosX(); //AU3_API long WINAPI AU3_WinGetCaretPosY(void); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetCaretPosY(); //AU3_API void WINAPI AU3_WinGetClassList(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText //, LPWSTR szRetText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinGetClassList([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)]string Text, [MarshalAs(UnmanagedType.LPWStr)]StringBuilder RetText, int BufSize); //AU3_API long WINAPI AU3_WinGetClientSizeHeight(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetClientSizeHeight([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)]string Text); //AU3_API long WINAPI AU3_WinGetClientSizeWidth(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetClientSizeWidth([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)]string Text); //AU3_API void WINAPI AU3_WinGetHandle(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText //, LPWSTR szRetText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinGetHandle([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)]string Text, [MarshalAs(UnmanagedType.LPWStr)]StringBuilder RetText, int BufSize); //AU3_API long WINAPI AU3_WinGetPosX(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetPosX([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text); //AU3_API long WINAPI AU3_WinGetPosY(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetPosY([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text); //AU3_API long WINAPI AU3_WinGetPosHeight(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetPosHeight([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text); //AU3_API long WINAPI AU3_WinGetPosWidth(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetPosWidth([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text); //AU3_API void WINAPI AU3_WinGetProcess(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText //, LPWSTR szRetText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinGetProcess([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)]StringBuilder RetText, int BufSize); //AU3_API long WINAPI AU3_WinGetState(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetState([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text); //AU3_API void WINAPI AU3_WinGetText(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText //, LPWSTR szRetText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinGetText([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)]StringBuilder RetText, int BufSize); //AU3_API void WINAPI AU3_WinGetTitle(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText //, LPWSTR szRetText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinGetTitle([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)]StringBuilder RetText, int BufSize); //AU3_API long WINAPI AU3_WinKill(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinKill([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text); //AU3_API long WINAPI AU3_WinMenuSelectItem(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText //, LPCWSTR szItem1, LPCWSTR szItem2, LPCWSTR szItem3, LPCWSTR szItem4, LPCWSTR szItem5, LPCWSTR szItem6 //, LPCWSTR szItem7, LPCWSTR szItem8); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinMenuSelectItem([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)] string Item1 , [MarshalAs(UnmanagedType.LPWStr)] string Item2, [MarshalAs(UnmanagedType.LPWStr)] string Item3 , [MarshalAs(UnmanagedType.LPWStr)] string Item4, [MarshalAs(UnmanagedType.LPWStr)] string Item5 , [MarshalAs(UnmanagedType.LPWStr)] string Item6, [MarshalAs(UnmanagedType.LPWStr)] string Item7 , [MarshalAs(UnmanagedType.LPWStr)] string Item8); //AU3_API void WINAPI AU3_WinMinimizeAll(); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinMinimizeAll(); //AU3_API void WINAPI AU3_WinMinimizeAllUndo(); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinMinimizeAllUndo(); //AU3_API long WINAPI AU3_WinMove(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText //, long nX, long nY, /*[in,defaultvalue(-1)]*/long nWidth, /*[in,defaultvalue(-1)]*/long nHeight); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinMove([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, int X, int Y, int Width, int Height); //AU3_API long WINAPI AU3_WinSetOnTop(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText, long nFlag); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinSetOnTop([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, int Flags); //AU3_API long WINAPI AU3_WinSetState(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText, long nFlags); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinSetState([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, int Flags); //AU3_API long WINAPI AU3_WinSetTitle(LPCWSTR szTitle,/*[in,defaultvalue("")]*/ LPCWSTR szText //, LPCWSTR szNewTitle); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinSetTitle([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)] string NewTitle); //AU3_API long WINAPI AU3_WinSetTrans(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText, long nTrans); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinSetTrans([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, int Trans); //AU3_API long WINAPI AU3_WinWait(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText //, /*[in,defaultvalue(0)]*/long nTimeout); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinWait([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, int Timeout); //AU3_API long WINAPI AU3_WinWaitA(LPCSTR szTitle, /*[in,defaultvalue("")]*/LPCSTR szText //, /*[in,defaultvalue(0)]*/long nTimeout); //Not checked jcd [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinWaitA([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, int Timeout); //AU3_API long WINAPI AU3_WinWaitActive(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText //, /*[in,defaultvalue(0)]*/long nTimeout); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinWaitActive([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, int Timeout); //AU3_API long WINAPI AU3_WinWaitActiveA(LPCSTR szTitle, /*[in,defaultvalue("")]*/LPCSTR szText //, /*[in,defaultvalue(0)]*/long nTimeout); //Not checked jcd [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinWaitActiveA([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, int Timeout); //AU3_API long WINAPI AU3_WinWaitClose(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText //, /*[in,defaultvalue(0)]*/long nTimeout); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinWaitClose([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, int Timeout); //AU3_API long WINAPI AU3_WinWaitCloseA(LPCSTR szTitle, /*[in,defaultvalue("")]*/LPCSTR szText //, /*[in,defaultvalue(0)]*/long nTimeout); //Not checked jcd [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinWaitCloseA([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, int Timeout); //AU3_API long WINAPI AU3_WinWaitNotActive(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText //, /*[in,defaultvalue(0)]*/long nTimeout); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinWaitNotActive([MarshalAs(UnmanagedType.LPWStr)]string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, int Timeout); //AU3_API long WINAPI AU3_WinWaitNotActiveA(LPCSTR szTitle, /*[in,defaultvalue("")]*/LPCSTR szText //, /*[in,defaultvalue(0)]*/long nTimeout); //Not checked jcd [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinWaitNotActiveA([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, int Timeout); } }
  15. Sue. Use the AU3Info.exe tool on your target to get some ideas as to what to put in the first two fields. It can take quite a bit of trial and error to get values that work consistantly and it varies according to the control. Some controls are strangely implemented and won't yeild at all. Good luck. Regards, John.
  16. I just tested the above and it works. Open up Notepad and then add a button to your application thus: private void btnTest_Click(object sender, EventArgs e) { string Title = "Untitled - Notepad"; string Text = ""; string TheControlID = "Edit1"; byte[] RetText = new byte[50]; //a number big enought to hold result, trailing bytes will be 0 AutoItX3Declarations.AU3_ControlGetHandle(Title, Text, TheControlID, RetText, RetText.Length); //may need to convert back to a string or int string TheControlIDasString = System.Text.Encoding.ASCII.GetString(RetText).TrimEnd('\0'); MessageBox.Show(TheControlIDasString); } Regards, John.
  17. Sue. Try this: string Title = "WhateverWorks"; string Text = "WhateverWorks"; string TheControlID = "TheControlID"; byte[] RetText = new byte[50]; //a number big enought to hold result, trailing bytes will be 0 AutoItX3Declarations.AU3_ControlGetHandle(Title, Text, TheControlID, RetText, RetText.Length); //may need to convert back to a string or int string TheControlIDasString = System.Text.Encoding.ASCII.GetString(RetText).TrimEnd('\0'); Regards, John.
  18. Well I looked at the source and it just shows the standard way of doing it. Very simple really. I still get problems though when I use it in my own ClickOnce deployments. Particularly errors stating that the assemblies need to be strong signed. Using the dll with dllImport still gives the same functionality but with no deployment issues. Regards, John.
  19. It is true that the example above does work, I tried it way back and again today. It would be great if the source files were made available so we can see how it was done. I spent a couple of days with settings in VS but never got it to work reliably in my apps. The source may provide the answer. Perhaps the manifest was made manually rather than using the MS suggestion of letting VS do the work. Regards, John.
  20. The previous link refers to a post of mine. I can see where you are coming from, the use of the Autoit COM object is very appealing but I never got it to work in a satisfactory way when deploying to other machines. The RegFree approach does not work well for AutoIt and when you read all the MS documentation about RegFree you can see that is not a solution for every case. That is why I took the trouble to provide the examples of using all of the dll functions via C# calls. Thanks to AutoIt for providing the dll version and I hope that always will be so. Regards, John.
  21. Excuse me for placing this here but the bug ticket was rejected as potential spam?? I have had a look at AutoItx3 v3.2.13.7 and checked some of the functions. The ones that return Unicode text work OK. However I did find an issue with both AU3_ControlGetHandle and AU3_WinGetHandle, and this may apply to others as well. Here is the declaration for C#: //AU3_API void WINAPI AU3_ControlGetHandle(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, const char *szControl, char *szRetText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ControlGetHandle([MarshalAs(UnmanagedType.LPWStr)] string Title , [MarshalAs(UnmanagedType.LPWStr)] string Text, [MarshalAs(UnmanagedType.LPWStr)] string Control , byte[] RetText, int BufSize); Here is the usage: string clip = ""; byte[] returnbytes = new byte[200]; //Note the return value for next function is way to high and wrong AutoItX3Declarations.AU3_WinGetHandle("Untitled - Notepad", "", returnbytes, returnbytes.Length); //clip = new ASCIIEncoding().GetString(returnbytes); clip = System.Text.Encoding.Unicode.GetString(returnbytes).TrimEnd('\0'); MessageBox.Show(clip); The return text is in the correct format ie: 0x1234ABCD but the handle is not correct; Perhaps I am doing something wrong? Regards, John.
  22. Jon. When you say: AutoItX: - Changed: Converted to full unicode - ANSI DLL prototypes removed. (For now, depends on demand for adding in). Do you mean that the AutoItX3.dll can't be used anymore but only the Com implemtation? Regards, John.
  23. When you release that new version I will update the C# declartions recently posted to use the new format. Regards, John.
  24. using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; namespace yourNameSpace { internal static class AutoItX3Declarations { //NOTE: This is based on AutoItX v3.2.12.0 //NOTE: my comments usually have "jcd" appended where I am uncertain. //NOTE: From memory optional parameters are not supported in DotNet so fill in all fields even if just "". //NOTE: Be prepared to play around a bit with which fields need values and what those value are. //NOTE: The big advantage of using AutoItX3 like this is that you don't have to register //the dll with windows and more importantly you get away from the many issues involved in //publishing the application and the binding to the dll required. //The below constants were found by Registering AutoItX3.dll in Windows //, adding AutoItX3Lib to References in IDE //,declaring an instance of it like this: // AutoItX3Lib.AutoItX3 autoit; // static AutoItX3Lib.AutoItX3Class autoit; //,right clicking on the AutoItX3Class and then Goto Definitions //and seeing the equivalent of the below in the MetaData window. //So far it is working //NOTE: easier way is to use "DLL Export Viewer" utility and get it to list Properties also //"DLL Export Viewer" is from http://www.nirsoft.net // Definitions public const int AU3_INTDEFAULT = -2147483647; // "Default" value for _some_ int parameters (largest negative number) public const int error = 1; public const int SW_HIDE = 2; public const int SW_MAXIMIZE = 3; public const int SW_MINIMIZE = 4; public const int SW_RESTORE = 5; public const int SW_SHOW = 6; public const int SW_SHOWDEFAULT = 7; public const int SW_SHOWMAXIMIZED = 8; public const int SW_SHOWMINIMIZED = 9; public const int SW_SHOWMINNOACTIVE = 10; public const int SW_SHOWNA = 11; public const int SW_SHOWNOACTIVATE = 12; public const int SW_SHOWNORMAL = 13; public const int version = 109; ///////////////////////////////////////////////////////////////////////////////// //// Exported functions of AutoItXC.dll ///////////////////////////////////////////////////////////////////////////////// //AU3_API void WINAPI AU3_Init(void); //Uncertain if this is needed jcd [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_Init(); //AU3_API long AU3_error(void); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_error(); //AU3_API long WINAPI AU3_AutoItSetOption(const char *szOption, long nValue); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_AutoItSetOption([MarshalAs(UnmanagedType.LPStr)] string Option, int Value); //AU3_API void WINAPI AU3_BlockInput(long nFlag); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_BlockInput(int Flag); //AU3_API long WINAPI AU3_CDTray(const char *szDrive, const char *szAction); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_CDTray([MarshalAs(UnmanagedType.LPStr)] string Drive , [MarshalAs(UnmanagedType.LPStr)] string Action); //AU3_API void WINAPI AU3_ClipGet(char *szClip, int nBufSize); //Use like this: //byte[] returnclip = new byte[200]; //any sufficiently long lenght will do //AutoItX3Declarations.AU3_ClipGet(returnclip, returnclip.Length); //clipdata = new ASCIIEncoding().GetString(returnclip); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ClipGet(byte[] Clip, int BufSize); //AU3_API void WINAPI AU3_ClipPut(const char *szClip); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ClipPut([MarshalAs(UnmanagedType.LPStr)] string Clip); //AU3_API long WINAPI AU3_ControlClick(const char *szTitle, const char *szText, const char *szControl //, const char *szButton, long nNumClicks, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nX //, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nY); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlClick([MarshalAs(UnmanagedType.LPStr)] string Title ,[MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control ,[MarshalAs(UnmanagedType.LPStr)] string Button, int NumClicks, int X, int Y); //AU3_API void WINAPI AU3_ControlCommand(const char *szTitle, const char *szText, const char *szControl //, const char *szCommand, const char *szExtra, char *szResult, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ControlCommand([MarshalAs(UnmanagedType.LPStr)] string Title ,[MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control ,[MarshalAs(UnmanagedType.LPStr)] string Command, [MarshalAs(UnmanagedType.LPStr)] string Extra ,[MarshalAs(UnmanagedType.LPStr)] byte[] Result, int BufSize); //AU3_API void WINAPI AU3_ControlListView(const char *szTitle, const char *szText, const char *szControl //, const char *szCommand, const char *szExtra1, const char *szExtra2, char *szResult, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ControlListView([MarshalAs(UnmanagedType.LPStr)] string Title ,[MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control ,[MarshalAs(UnmanagedType.LPStr)] string Command, [MarshalAs(UnmanagedType.LPStr)] string Extral1 ,[MarshalAs(UnmanagedType.LPStr)] string Extra2, byte[] Result, int BufSize); //AU3_API long WINAPI AU3_ControlDisable(const char *szTitle, const char *szText, const char *szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlDisable([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control); //AU3_API long WINAPI AU3_ControlEnable(const char *szTitle, const char *szText, const char *szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlEnable([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control); //AU3_API long WINAPI AU3_ControlFocus(const char *szTitle, const char *szText, const char *szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlFocus([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control); //AU3_API void WINAPI AU3_ControlGetFocus(const char *szTitle, const char *szText, char *szControlWithFocus //, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ControlGetFocus([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, byte[] ControlWithFocus, int BufSize); //AU3_API void WINAPI AU3_ControlGetHandle(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, const char *szControl, char *szRetText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ControlGetHandle([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control , byte[] RetText, int BufSize); //AU3_API long WINAPI AU3_ControlGetPosX(const char *szTitle, const char *szText, const char *szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlGetPosX([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control); //AU3_API long WINAPI AU3_ControlGetPosY(const char *szTitle, const char *szText, const char *szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlGetPosY([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control); //AU3_API long WINAPI AU3_ControlGetPosHeight(const char *szTitle, const char *szText, const char *szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlGetPosHeight([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control); //AU3_API long WINAPI AU3_ControlGetPosWidth(const char *szTitle, const char *szText, const char *szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlGetPosWidth([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control); //AU3_API void WINAPI AU3_ControlGetText(const char *szTitle, const char *szText, const char *szControl //, char *szControlText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ControlGetText([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control , byte[] ControlText, int BufSize); //AU3_API long WINAPI AU3_ControlHide(const char *szTitle, const char *szText, const char *szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlHide([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control); //AU3_API long WINAPI AU3_ControlMove(const char *szTitle, const char *szText, const char *szControl //, long nX, long nY, /*[in,defaultvalue(-1)]*/long nWidth, /*[in,defaultvalue(-1)]*/long nHeight); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlMove([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control , int X, int Y, int Width, int Height); //AU3_API long WINAPI AU3_ControlSend(const char *szTitle, const char *szText, const char *szControl //, const char *szSendText, /*[in,defaultvalue(0)]*/long nMode); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlSend([MarshalAs(UnmanagedType.LPStr)] string Title ,[MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control , [MarshalAs(UnmanagedType.LPStr)] string SendText, int Mode); //AU3_API long WINAPI AU3_ControlSetText(const char *szTitle, const char *szText, const char *szControl //, const char *szControlText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlSetText([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control , [MarshalAs(UnmanagedType.LPStr)] string ControlText); //AU3_API long WINAPI AU3_ControlShow(const char *szTitle, const char *szText, const char *szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlShow([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control); //AU3_API void WINAPI AU3_ControlTreeView(const char *szTitle, const char *szText, const char *szControl //, const char *szCommand, const char *szExtra1, const char *szExtra2, char *szResult, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ControlTreeView([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control , [MarshalAs(UnmanagedType.LPStr)] string Command, [MarshalAs(UnmanagedType.LPStr)] string Extra1 , [MarshalAs(UnmanagedType.LPStr)] string Extra2, byte[] Result, int BufSize); //AU3_API void WINAPI AU3_DriveMapAdd(const char *szDevice, const char *szShare, long nFlags //, /*[in,defaultvalue("")]*/const char *szUser, /*[in,defaultvalue("")]*/const char *szPwd //, char *szResult, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_DriveMapAdd([MarshalAs(UnmanagedType.LPStr)] string Device , [MarshalAs(UnmanagedType.LPStr)] string Share, int Flags, [MarshalAs(UnmanagedType.LPStr)] string User , [MarshalAs(UnmanagedType.LPStr)] string Pwd, byte[] Result, int BufSize); //AU3_API long WINAPI AU3_DriveMapDel(const char *szDevice); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_DriveMapDel([MarshalAs(UnmanagedType.LPStr)] string Device); //AU3_API void WINAPI AU3_DriveMapGet(const char *szDevice, char *szMapping, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_DriveMapDel([MarshalAs(UnmanagedType.LPStr)] string Device , byte[] Mapping, int BufSize); //AU3_API long WINAPI AU3_IniDelete(const char *szFilename, const char *szSection, const char *szKey); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_IniDelete([MarshalAs(UnmanagedType.LPStr)] string Filename , [MarshalAs(UnmanagedType.LPStr)] string Section, [MarshalAs(UnmanagedType.LPStr)] string Key); //AU3_API void WINAPI AU3_IniRead(const char *szFilename, const char *szSection, const char *szKey //, const char *szDefault, char *szValue, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_IniRead([MarshalAs(UnmanagedType.LPStr)] string Filename , [MarshalAs(UnmanagedType.LPStr)] string Section, [MarshalAs(UnmanagedType.LPStr)] string Key , [MarshalAs(UnmanagedType.LPStr)] string Default, byte[] Value, int BufSize); //AU3_API long WINAPI AU3_IniWrite(const char *szFilename, const char *szSection, const char *szKey //, const char *szValue); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_IniWrite([MarshalAs(UnmanagedType.LPStr)] string Filename , [MarshalAs(UnmanagedType.LPStr)] string Section, [MarshalAs(UnmanagedType.LPStr)] string Key , [MarshalAs(UnmanagedType.LPStr)] string Value); //AU3_API long WINAPI AU3_IsAdmin(void); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_IsAdmin(); //AU3_API long WINAPI AU3_MouseClick(/*[in,defaultvalue("LEFT")]*/const char *szButton //, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nX, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nY //, /*[in,defaultvalue(1)]*/long nClicks, /*[in,defaultvalue(-1)]*/long nSpeed); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_MouseClick([MarshalAs(UnmanagedType.LPStr)] string Button, int x, int y , int clicks, int speed); //AU3_API long WINAPI AU3_MouseClickDrag(const char *szButton, long nX1, long nY1, long nX2, long nY2 //, /*[in,defaultvalue(-1)]*/long nSpeed); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_MouseClickDrag([MarshalAs(UnmanagedType.LPStr)] string Button , int X1, int Y1, int X2, int Y2, int Speed); //AU3_API void WINAPI AU3_MouseDown(/*[in,defaultvalue("LEFT")]*/const char *szButton); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_MouseDown([MarshalAs(UnmanagedType.LPStr)] string Button); //AU3_API long WINAPI AU3_MouseGetCursor(void); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_MouseGetCursor(); //AU3_API long WINAPI AU3_MouseGetPosX(void); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_MouseGetPosX(); //AU3_API long WINAPI AU3_MouseGetPosY(void); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_MouseGetPosY(); //AU3_API long WINAPI AU3_MouseMove(long nX, long nY, /*[in,defaultvalue(-1)]*/long nSpeed); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_MouseMove(int X, int Y, int Speed); //AU3_API void WINAPI AU3_MouseUp(/*[in,defaultvalue("LEFT")]*/const char *szButton); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_MouseUp([MarshalAs(UnmanagedType.LPStr)] string Button); //AU3_API void WINAPI AU3_MouseWheel(const char *szDirection, long nClicks); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_MouseWheel([MarshalAs(UnmanagedType.LPStr)] string Direction, int Clicks); //AU3_API long WINAPI AU3_Opt(const char *szOption, long nValue); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_Opt([MarshalAs(UnmanagedType.LPStr)] string Option, int Value); //AU3_API long WINAPI AU3_PixelChecksum(long nLeft, long nTop, long nRight, long nBottom //, /*[in,defaultvalue(1)]*/long nStep); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_PixelChecksum(int Left, int Top, int Right, int Bottom, int Step); //AU3_API long WINAPI AU3_PixelGetColor(long nX, long nY); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_PixelGetColor(int X, int Y); //AU3_API void WINAPI AU3_PixelSearch(long nLeft, long nTop, long nRight, long nBottom, long nCol //, /*default 0*/long nVar, /*default 1*/long nStep, LPPOINT pPointResult); //Use like this: //int[] result = {0,0}; //try //{ // AutoItX3Declarations.AU3_PixelSearch(0, 0, 800, 000,0xFFFFFF, 0, 1, result); //} //catch { } //It will crash if the color is not found, have not be able to determin why jcd //The AutoItX3Lib.AutoItX3Class version has similar problems and is the only function to return an object //so contortions are needed to get the data from it ie: //int[] result = {0,0}; //object resultObj; //AutoItX3Lib.AutoItX3Class autoit = new AutoItX3Lib.AutoItX3Class(); //resultObj = autoit.PixelSearch(0, 0, 800, 600, 0xFFFF00,0,1); //Type t = resultObj.GetType(); //if(t == typeof(object[])) //{ //object[] obj = (object[])resultObj; //result[0] = (int)obj[0]; //result[1] = (int)obj[1]; //} //When it fails it returns an object = 1 but when it succeeds it is object[X,Y] [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_PixelSearch(int Left, int Top, int Right, int Bottom, int Col, int Var , int Step, int[] PointResult); //AU3_API long WINAPI AU3_ProcessClose(const char *szProcess); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ProcessClose([MarshalAs(UnmanagedType.LPStr)]string Process); //AU3_API long WINAPI AU3_ProcessExists(const char *szProcess); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ProcessExists([MarshalAs(UnmanagedType.LPStr)]string Process); //AU3_API long WINAPI AU3_ProcessSetPriority(const char *szProcess, long nPriority); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ProcessSetPriority([MarshalAs(UnmanagedType.LPStr)]string Process, int Priority); //AU3_API long WINAPI AU3_ProcessWait(const char *szProcess, /*[in,defaultvalue(0)]*/long nTimeout); //Not checked jde [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ProcessWait([MarshalAs(UnmanagedType.LPStr)]string Process, int Timeout); //AU3_API long WINAPI AU3_ProcessWaitClose(const char *szProcess, /*[in,defaultvalue(0)]*/long nTimeout); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ProcessWaitClose([MarshalAs(UnmanagedType.LPStr)]string Process, int Timeout); //AU3_API long WINAPI AU3_RegDeleteKey(const char *szKeyname); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_RegDeleteKey([MarshalAs(UnmanagedType.LPStr)]string Keyname); //AU3_API long WINAPI AU3_RegDeleteVal(const char *szKeyname, const char *szValuename); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_RegDeleteVal([MarshalAs(UnmanagedType.LPStr)]string Keyname , [MarshalAs(UnmanagedType.LPStr)]string ValueName); //AU3_API void WINAPI AU3_RegEnumKey(const char *szKeyname, long nInstance, char *szResult, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_RegEnumKey([MarshalAs(UnmanagedType.LPStr)]string Keyname ,int Instance, byte[] Result, int BusSize); //AU3_API void WINAPI AU3_RegEnumVal(const char *szKeyname, long nInstance, char *szResult, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_RegEnumVal([MarshalAs(UnmanagedType.LPStr)]string Keyname , int Instance, byte[] Result, int BufSize); //AU3_API void WINAPI AU3_RegRead(const char *szKeyname, const char *szValuename, char *szRetText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_RegRead([MarshalAs(UnmanagedType.LPStr)]string Keyname , [MarshalAs(UnmanagedType.LPStr)]string Valuename, byte[] RetText, int BufSize); //AU3_API long WINAPI AU3_RegWrite(const char *szKeyname, const char *szValuename, const char *szType //, const char *szValue); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_RegWrite([MarshalAs(UnmanagedType.LPStr)]string Keyname , [MarshalAs(UnmanagedType.LPStr)]string Valuename, [MarshalAs(UnmanagedType.LPStr)]string Type , [MarshalAs(UnmanagedType.LPStr)]string Value); //AU3_API long WINAPI AU3_Run(const char *szRun, /*[in,defaultvalue("")]*/const char *szDir //, /*[in,defaultvalue(1)]*/long nShowFlags); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_Run([MarshalAs(UnmanagedType.LPStr)]string Run ,[MarshalAs(UnmanagedType.LPStr)]string Dir, int ShowFlags); //AU3_API long WINAPI AU3_RunAsSet(const char *szUser, const char *szDomain, const char *szPassword, int nOptions); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_RunAsSet([MarshalAs(UnmanagedType.LPStr)]string User , [MarshalAs(UnmanagedType.LPStr)]string Domain, [MarshalAs(UnmanagedType.LPStr)]string Password , int Options); //AU3_API long WINAPI AU3_RunWait(const char *szRun, /*[in,defaultvalue("")]*/const char *szDir //, /*[in,defaultvalue(1)]*/long nShowFlags); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_RunWait([MarshalAs(UnmanagedType.LPStr)]string Run , [MarshalAs(UnmanagedType.LPStr)]string Dir, int ShowFlags); //AU3_API void WINAPI AU3_Send(const char *szSendText, /*[in,defaultvalue(0)]*/long nMode); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_Send([MarshalAs(UnmanagedType.LPStr)] string SendText, int Mode); //AU3_API long WINAPI AU3_Shutdown(long nFlags); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_Shutdown(int Flags); //AU3_API void WINAPI AU3_Sleep(long nMilliseconds); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_Sleep(int Milliseconds); //AU3_API void WINAPI AU3_StatusbarGetText(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, /*[in,defaultvalue(1)]*/long nPart, char *szStatusText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_StatusbarGetText([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)]string Text, int Part, byte[] StatusText, int BufSize); //AU3_API void WINAPI AU3_ToolTip(const char *szTip, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nX //, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nY); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ToolTip([MarshalAs(UnmanagedType.LPStr)]string Tip, int X, int Y); //AU3_API void WINAPI AU3_WinActivate(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinActivate([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)]string Text); //AU3_API long WINAPI AU3_WinActive(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinActive([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)]string Text); //AU3_API long WINAPI AU3_WinClose(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinClose([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text); //AU3_API long WINAPI AU3_WinExists(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinExists([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)]string Text); //AU3_API long WINAPI AU3_WinGetCaretPosX(void); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetCaretPosX(); //AU3_API long WINAPI AU3_WinGetCaretPosY(void); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetCaretPosY(); //AU3_API void WINAPI AU3_WinGetClassList(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, char *szRetText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinGetClassList([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)]string Text, byte[] RetText, int BufSize); //AU3_API long WINAPI AU3_WinGetClientSizeHeight(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetClientSizeHeight([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)]string Text); //AU3_API long WINAPI AU3_WinGetClientSizeWidth(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetClientSizeWidth([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)]string Text); //AU3_API void WINAPI AU3_WinGetHandle(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, char *szRetText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinGetHandle([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)]string Text, byte[] RetText, int BufSize); //AU3_API long WINAPI AU3_WinGetPosX(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetPosX([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text); //AU3_API long WINAPI AU3_WinGetPosY(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetPosY([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text); //AU3_API long WINAPI AU3_WinGetPosHeight(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetPosHeight([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text); //AU3_API long WINAPI AU3_WinGetPosWidth(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetPosWidth([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text); //AU3_API void WINAPI AU3_WinGetProcess(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, char *szRetText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinGetProcess([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, byte[] RetText, int BufSize); //AU3_API long WINAPI AU3_WinGetState(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetState([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text); //AU3_API void WINAPI AU3_WinGetText(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, char *szRetText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinGetText([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, byte[] RetText, int BufSize); //AU3_API void WINAPI AU3_WinGetTitle(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, char *szRetText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinGetTitle([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, byte[] RetText, int BufSize); //AU3_API long WINAPI AU3_WinKill(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinKill([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text); //AU3_API long WINAPI AU3_WinMenuSelectItem(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, const char *szItem1, const char *szItem2, const char *szItem3, const char *szItem4, const char *szItem5 //, const char *szItem6, const char *szItem7, const char *szItem8); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinMenuSelectItem([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Item1 , [MarshalAs(UnmanagedType.LPStr)] string Item2, [MarshalAs(UnmanagedType.LPStr)] string Item3 , [MarshalAs(UnmanagedType.LPStr)] string Item4, [MarshalAs(UnmanagedType.LPStr)] string Item5 , [MarshalAs(UnmanagedType.LPStr)] string Item6, [MarshalAs(UnmanagedType.LPStr)] string Item7 , [MarshalAs(UnmanagedType.LPStr)] string Item8); //AU3_API void WINAPI AU3_WinMinimizeAll(); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinMinimizeAll(); //AU3_API void WINAPI AU3_WinMinimizeAllUndo(); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinMinimizeAllUndo(); //AU3_API long WINAPI AU3_WinMove(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, long nX, long nY, /*[in,defaultvalue(-1)]*/long nWidth, /*[in,defaultvalue(-1)]*/long nHeight); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinMove([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, int X, int Y, int Width, int Height); //AU3_API long WINAPI AU3_WinSetOnTop(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText, long nFlag); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinMove([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, int Flags); //AU3_API long WINAPI AU3_WinSetState(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText, long nFlags); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinSetState([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, int Flags); //AU3_API long WINAPI AU3_WinSetTitle(const char *szTitle,/*[in,defaultvalue("")]*/ const char *szText //, const char *szNewTitle); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinSetTitle([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string NewTitle); //AU3_API long WINAPI AU3_WinSetTrans(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText, long nTrans); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinSetTrans([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, int Trans); //AU3_API long WINAPI AU3_WinWait(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, /*[in,defaultvalue(0)]*/long nTimeout); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinWait([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, int Timeout); //AU3_API long WINAPI AU3_WinWaitActive(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, /*[in,defaultvalue(0)]*/long nTimeout); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinWaitActive([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, int Timeout); //AU3_API long WINAPI AU3_WinWaitClose(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, /*[in,defaultvalue(0)]*/long nTimeout); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinWaitClose([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, int Timeout); //AU3_API long WINAPI AU3_WinWaitNotActive(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, /*[in,defaultvalue(0)]*/long nTimeout); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinWaitNotActive([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, int Timeout); } }
  25. using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; namespace yourNameSpace { internal static class AutoItX3Declarations { //NOTE: This is based on AutoItX v3.2.12.0 //NOTE: my comments usually have "jcd" appended where I am uncertain. //NOTE: From memory optional parameters are not supported in DotNet so fill in all fields even if just "". //NOTE: Be prepared to play around a bit with which fields need values and what those value are. //NOTE: The big advantage of using AutoItX3 like this is that you don't have to register //the dll with windows and more importantly you get away from the many issues involved in //publishing the application and the binding to the dll required. //The below constants were found by Registering AutoItX3.dll in Windows //, adding AutoItX3Lib to References in IDE //,declaring an instance of it like this: // AutoItX3Lib.AutoItX3 autoit; // static AutoItX3Lib.AutoItX3Class autoit; //,right clicking on the AutoItX3Class and then Goto Definitions //and seeing the equivalent of the below in the MetaData window. //So far it is working //NOTE: easier way is to use "DLL Export Viewer" utility and get it to list Properties also //"DLL Export Viewer" is from [url="http://www.nirsoft.net"]http://www.nirsoft.net[/url] // Definitions public const int AU3_INTDEFAULT = -2147483647; // "Default" value for _some_ int parameters (largest negative number) public const int error = 1; public const int SW_HIDE = 2; public const int SW_MAXIMIZE = 3; public const int SW_MINIMIZE = 4; public const int SW_RESTORE = 5; public const int SW_SHOW = 6; public const int SW_SHOWDEFAULT = 7; public const int SW_SHOWMAXIMIZED = 8; public const int SW_SHOWMINIMIZED = 9; public const int SW_SHOWMINNOACTIVE = 10; public const int SW_SHOWNA = 11; public const int SW_SHOWNOACTIVATE = 12; public const int SW_SHOWNORMAL = 13; public const int version = 109; ///////////////////////////////////////////////////////////////////////////////// //// Exported functions of AutoItXC.dll ///////////////////////////////////////////////////////////////////////////////// //AU3_API void WINAPI AU3_Init(void); //Uncertain if this is needed jcd [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_Init(); //AU3_API long AU3_error(void); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_error(); //AU3_API long WINAPI AU3_AutoItSetOption(const char *szOption, long nValue); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_AutoItSetOption([MarshalAs(UnmanagedType.LPStr)] string Option, int Value); //AU3_API void WINAPI AU3_BlockInput(long nFlag); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_BlockInput(int Flag); //AU3_API long WINAPI AU3_CDTray(const char *szDrive, const char *szAction); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_CDTray([MarshalAs(UnmanagedType.LPStr)] string Drive , [MarshalAs(UnmanagedType.LPStr)] string Action); //AU3_API void WINAPI AU3_ClipGet(char *szClip, int nBufSize); //Use like this: //byte[] returnclip = new byte[200]; //any sufficiently long lenght will do //AutoItX3Declarations.AU3_ClipGet(returnclip, returnclip.Length); //clipdata = new ASCIIEncoding().GetString(returnclip); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ClipGet(byte[] Clip, int BufSize); //AU3_API void WINAPI AU3_ClipPut(const char *szClip); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ClipPut([MarshalAs(UnmanagedType.LPStr)] string Clip); //AU3_API long WINAPI AU3_ControlClick(const char *szTitle, const char *szText, const char *szControl //, const char *szButton, long nNumClicks, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nX //, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nY); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlClick([MarshalAs(UnmanagedType.LPStr)] string Title ,[MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control ,[MarshalAs(UnmanagedType.LPStr)] string Button, int NumClicks, int X, int Y); //AU3_API void WINAPI AU3_ControlCommand(const char *szTitle, const char *szText, const char *szControl //, const char *szCommand, const char *szExtra, char *szResult, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ControlCommand([MarshalAs(UnmanagedType.LPStr)] string Title ,[MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control ,[MarshalAs(UnmanagedType.LPStr)] string Command, [MarshalAs(UnmanagedType.LPStr)] string Extra ,[MarshalAs(UnmanagedType.LPStr)] byte[] Result, int BufSize); //AU3_API void WINAPI AU3_ControlListView(const char *szTitle, const char *szText, const char *szControl //, const char *szCommand, const char *szExtra1, const char *szExtra2, char *szResult, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ControlListView([MarshalAs(UnmanagedType.LPStr)] string Title ,[MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control ,[MarshalAs(UnmanagedType.LPStr)] string Command, [MarshalAs(UnmanagedType.LPStr)] string Extral1 ,[MarshalAs(UnmanagedType.LPStr)] string Extra2, byte[] Result, int BufSize); //AU3_API long WINAPI AU3_ControlDisable(const char *szTitle, const char *szText, const char *szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlDisable([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control); //AU3_API long WINAPI AU3_ControlEnable(const char *szTitle, const char *szText, const char *szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlEnable([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control); //AU3_API long WINAPI AU3_ControlFocus(const char *szTitle, const char *szText, const char *szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlFocus([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control); //AU3_API void WINAPI AU3_ControlGetFocus(const char *szTitle, const char *szText, char *szControlWithFocus //, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ControlGetFocus([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, byte[] ControlWithFocus, int BufSize); //AU3_API void WINAPI AU3_ControlGetHandle(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, const char *szControl, char *szRetText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ControlGetHandle([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control , byte[] RetText, int BufSize); //AU3_API long WINAPI AU3_ControlGetPosX(const char *szTitle, const char *szText, const char *szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlGetPosX([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control); //AU3_API long WINAPI AU3_ControlGetPosY(const char *szTitle, const char *szText, const char *szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlGetPosY([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control); //AU3_API long WINAPI AU3_ControlGetPosHeight(const char *szTitle, const char *szText, const char *szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlGetPosHeight([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control); //AU3_API long WINAPI AU3_ControlGetPosWidth(const char *szTitle, const char *szText, const char *szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlGetPosWidth([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control); //AU3_API void WINAPI AU3_ControlGetText(const char *szTitle, const char *szText, const char *szControl //, char *szControlText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ControlGetText([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control , byte[] ControlText, int BufSize); //AU3_API long WINAPI AU3_ControlHide(const char *szTitle, const char *szText, const char *szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlHide([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control); //AU3_API long WINAPI AU3_ControlMove(const char *szTitle, const char *szText, const char *szControl //, long nX, long nY, /*[in,defaultvalue(-1)]*/long nWidth, /*[in,defaultvalue(-1)]*/long nHeight); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlMove([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control , int X, int Y, int Width, int Height); //AU3_API long WINAPI AU3_ControlSend(const char *szTitle, const char *szText, const char *szControl //, const char *szSendText, /*[in,defaultvalue(0)]*/long nMode); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlSend([MarshalAs(UnmanagedType.LPStr)] string Title ,[MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control , [MarshalAs(UnmanagedType.LPStr)] string SendText, int Mode); //AU3_API long WINAPI AU3_ControlSetText(const char *szTitle, const char *szText, const char *szControl //, const char *szControlText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlSetText([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control , [MarshalAs(UnmanagedType.LPStr)] string ControlText); //AU3_API long WINAPI AU3_ControlShow(const char *szTitle, const char *szText, const char *szControl); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ControlShow([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control); //AU3_API void WINAPI AU3_ControlTreeView(const char *szTitle, const char *szText, const char *szControl //, const char *szCommand, const char *szExtra1, const char *szExtra2, char *szResult, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ControlTreeView([MarshalAs(UnmanagedType.LPStr)] string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Control , [MarshalAs(UnmanagedType.LPStr)] string Command, [MarshalAs(UnmanagedType.LPStr)] string Extra1 , [MarshalAs(UnmanagedType.LPStr)] string Extra2, byte[] Result, int BufSize); //AU3_API void WINAPI AU3_DriveMapAdd(const char *szDevice, const char *szShare, long nFlags //, /*[in,defaultvalue("")]*/const char *szUser, /*[in,defaultvalue("")]*/const char *szPwd //, char *szResult, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_DriveMapAdd([MarshalAs(UnmanagedType.LPStr)] string Device , [MarshalAs(UnmanagedType.LPStr)] string Share, int Flags, [MarshalAs(UnmanagedType.LPStr)] string User , [MarshalAs(UnmanagedType.LPStr)] string Pwd, byte[] Result, int BufSize); //AU3_API long WINAPI AU3_DriveMapDel(const char *szDevice); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_DriveMapDel([MarshalAs(UnmanagedType.LPStr)] string Device); //AU3_API void WINAPI AU3_DriveMapGet(const char *szDevice, char *szMapping, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_DriveMapDel([MarshalAs(UnmanagedType.LPStr)] string Device , byte[] Mapping, int BufSize); //AU3_API long WINAPI AU3_IniDelete(const char *szFilename, const char *szSection, const char *szKey); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_IniDelete([MarshalAs(UnmanagedType.LPStr)] string Filename , [MarshalAs(UnmanagedType.LPStr)] string Section, [MarshalAs(UnmanagedType.LPStr)] string Key); //AU3_API void WINAPI AU3_IniRead(const char *szFilename, const char *szSection, const char *szKey //, const char *szDefault, char *szValue, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_IniRead([MarshalAs(UnmanagedType.LPStr)] string Filename , [MarshalAs(UnmanagedType.LPStr)] string Section, [MarshalAs(UnmanagedType.LPStr)] string Key , [MarshalAs(UnmanagedType.LPStr)] string Default, byte[] Value, int BufSize); //AU3_API long WINAPI AU3_IniWrite(const char *szFilename, const char *szSection, const char *szKey //, const char *szValue); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_IniWrite([MarshalAs(UnmanagedType.LPStr)] string Filename , [MarshalAs(UnmanagedType.LPStr)] string Section, [MarshalAs(UnmanagedType.LPStr)] string Key , [MarshalAs(UnmanagedType.LPStr)] string Value); //AU3_API long WINAPI AU3_IsAdmin(void); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_IsAdmin(); //AU3_API long WINAPI AU3_MouseClick(/*[in,defaultvalue("LEFT")]*/const char *szButton //, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nX, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nY //, /*[in,defaultvalue(1)]*/long nClicks, /*[in,defaultvalue(-1)]*/long nSpeed); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_MouseClick([MarshalAs(UnmanagedType.LPStr)] string Button, int x, int y , int clicks, int speed); //AU3_API long WINAPI AU3_MouseClickDrag(const char *szButton, long nX1, long nY1, long nX2, long nY2 //, /*[in,defaultvalue(-1)]*/long nSpeed); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_MouseClickDrag([MarshalAs(UnmanagedType.LPStr)] string Button , int X1, int Y1, int X2, int Y2, int Speed); //AU3_API void WINAPI AU3_MouseDown(/*[in,defaultvalue("LEFT")]*/const char *szButton); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_MouseDown([MarshalAs(UnmanagedType.LPStr)] string Button); //AU3_API long WINAPI AU3_MouseGetCursor(void); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_MouseGetCursor(); //AU3_API long WINAPI AU3_MouseGetPosX(void); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_MouseGetPosX(); //AU3_API long WINAPI AU3_MouseGetPosY(void); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_MouseGetPosY(); //AU3_API long WINAPI AU3_MouseMove(long nX, long nY, /*[in,defaultvalue(-1)]*/long nSpeed); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_MouseMove(int X, int Y, int Speed); //AU3_API void WINAPI AU3_MouseUp(/*[in,defaultvalue("LEFT")]*/const char *szButton); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_MouseUp([MarshalAs(UnmanagedType.LPStr)] string Button); //AU3_API void WINAPI AU3_MouseWheel(const char *szDirection, long nClicks); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_MouseWheel([MarshalAs(UnmanagedType.LPStr)] string Direction, int Clicks); //AU3_API long WINAPI AU3_Opt(const char *szOption, long nValue); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_Opt([MarshalAs(UnmanagedType.LPStr)] string Option, int Value); //AU3_API long WINAPI AU3_PixelChecksum(long nLeft, long nTop, long nRight, long nBottom //, /*[in,defaultvalue(1)]*/long nStep); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_PixelChecksum(int Left, int Top, int Right, int Bottom, int Step); //AU3_API long WINAPI AU3_PixelGetColor(long nX, long nY); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_PixelGetColor(int X, int Y); //AU3_API void WINAPI AU3_PixelSearch(long nLeft, long nTop, long nRight, long nBottom, long nCol //, /*default 0*/long nVar, /*default 1*/long nStep, LPPOINT pPointResult); //Use like this: //int[] result = {0,0}; //try //{ // AutoItX3Declarations.AU3_PixelSearch(0, 0, 800, 000,0xFFFFFF, 0, 1, result); //} //catch { } //It will crash if the color is not found, have not be able to determin why jcd //The AutoItX3Lib.AutoItX3Class version has similar problems and is the only function to return an object //so contortions are needed to get the data from it ie: //int[] result = {0,0}; //object resultObj; //AutoItX3Lib.AutoItX3Class autoit = new AutoItX3Lib.AutoItX3Class(); //resultObj = autoit.PixelSearch(0, 0, 800, 600, 0xFFFF00,0,1); //Type t = resultObj.GetType(); //if(t == typeof(object[])) //{ //object[] obj = (object[])resultObj; //result[0] = (int)obj[0]; //result[1] = (int)obj[1]; //} //When it fails it returns an object = 1 but when it succeeds it is object[X,Y] [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_PixelSearch(int Left, int Top, int Right, int Bottom, int Col, int Var , int Step, int[] PointResult); //AU3_API long WINAPI AU3_ProcessClose(const char *szProcess); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ProcessClose([MarshalAs(UnmanagedType.LPStr)]string Process); //AU3_API long WINAPI AU3_ProcessExists(const char *szProcess); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ProcessExists([MarshalAs(UnmanagedType.LPStr)]string Process); //AU3_API long WINAPI AU3_ProcessSetPriority(const char *szProcess, long nPriority); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ProcessSetPriority([MarshalAs(UnmanagedType.LPStr)]string Process, int Priority); //AU3_API long WINAPI AU3_ProcessWait(const char *szProcess, /*[in,defaultvalue(0)]*/long nTimeout); //Not checked jde [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ProcessWait([MarshalAs(UnmanagedType.LPStr)]string Process, int Timeout); //AU3_API long WINAPI AU3_ProcessWaitClose(const char *szProcess, /*[in,defaultvalue(0)]*/long nTimeout); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_ProcessWaitClose([MarshalAs(UnmanagedType.LPStr)]string Process, int Timeout); //AU3_API long WINAPI AU3_RegDeleteKey(const char *szKeyname); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_RegDeleteKey([MarshalAs(UnmanagedType.LPStr)]string Keyname); //AU3_API long WINAPI AU3_RegDeleteVal(const char *szKeyname, const char *szValuename); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_RegDeleteVal([MarshalAs(UnmanagedType.LPStr)]string Keyname , [MarshalAs(UnmanagedType.LPStr)]string ValueName); //AU3_API void WINAPI AU3_RegEnumKey(const char *szKeyname, long nInstance, char *szResult, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_RegEnumKey([MarshalAs(UnmanagedType.LPStr)]string Keyname ,int Instance, byte[] Result, int BusSize); //AU3_API void WINAPI AU3_RegEnumVal(const char *szKeyname, long nInstance, char *szResult, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_RegEnumVal([MarshalAs(UnmanagedType.LPStr)]string Keyname , int Instance, byte[] Result, int BufSize); //AU3_API void WINAPI AU3_RegRead(const char *szKeyname, const char *szValuename, char *szRetText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_RegRead([MarshalAs(UnmanagedType.LPStr)]string Keyname , [MarshalAs(UnmanagedType.LPStr)]string Valuename, byte[] RetText, int BufSize); //AU3_API long WINAPI AU3_RegWrite(const char *szKeyname, const char *szValuename, const char *szType //, const char *szValue); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_RegWrite([MarshalAs(UnmanagedType.LPStr)]string Keyname , [MarshalAs(UnmanagedType.LPStr)]string Valuename, [MarshalAs(UnmanagedType.LPStr)]string Type , [MarshalAs(UnmanagedType.LPStr)]string Value); //AU3_API long WINAPI AU3_Run(const char *szRun, /*[in,defaultvalue("")]*/const char *szDir //, /*[in,defaultvalue(1)]*/long nShowFlags); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_Run([MarshalAs(UnmanagedType.LPStr)]string Run ,[MarshalAs(UnmanagedType.LPStr)]string Dir, int ShowFlags); //AU3_API long WINAPI AU3_RunAsSet(const char *szUser, const char *szDomain, const char *szPassword, int nOptions); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_RunAsSet([MarshalAs(UnmanagedType.LPStr)]string User , [MarshalAs(UnmanagedType.LPStr)]string Domain, [MarshalAs(UnmanagedType.LPStr)]string Password , int Options); //AU3_API long WINAPI AU3_RunWait(const char *szRun, /*[in,defaultvalue("")]*/const char *szDir //, /*[in,defaultvalue(1)]*/long nShowFlags); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_RunWait([MarshalAs(UnmanagedType.LPStr)]string Run , [MarshalAs(UnmanagedType.LPStr)]string Dir, int ShowFlags); //AU3_API void WINAPI AU3_Send(const char *szSendText, /*[in,defaultvalue(0)]*/long nMode); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_Send([MarshalAs(UnmanagedType.LPStr)] string SendText, int Mode); //AU3_API long WINAPI AU3_Shutdown(long nFlags); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_Shutdown(int Flags); //AU3_API void WINAPI AU3_Sleep(long nMilliseconds); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_Sleep(int Milliseconds); //AU3_API void WINAPI AU3_StatusbarGetText(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, /*[in,defaultvalue(1)]*/long nPart, char *szStatusText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_StatusbarGetText([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)]string Text, int Part, byte[] StatusText, int BufSize); //AU3_API void WINAPI AU3_ToolTip(const char *szTip, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nX //, /*[in,defaultvalue(AU3_INTDEFAULT)]*/long nY); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_ToolTip([MarshalAs(UnmanagedType.LPStr)]string Tip, int X, int Y); //AU3_API void WINAPI AU3_WinActivate(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinActivate([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)]string Text); //AU3_API long WINAPI AU3_WinActive(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinActive([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)]string Text); //AU3_API long WINAPI AU3_WinClose(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinClose([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text); //AU3_API long WINAPI AU3_WinExists(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinExists([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)]string Text); //AU3_API long WINAPI AU3_WinGetCaretPosX(void); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetCaretPosX(); //AU3_API long WINAPI AU3_WinGetCaretPosY(void); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetCaretPosY(); //AU3_API void WINAPI AU3_WinGetClassList(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, char *szRetText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinGetClassList([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)]string Text, byte[] RetText, int BufSize); //AU3_API long WINAPI AU3_WinGetClientSizeHeight(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetClientSizeHeight([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)]string Text); //AU3_API long WINAPI AU3_WinGetClientSizeWidth(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetClientSizeWidth([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)]string Text); //AU3_API void WINAPI AU3_WinGetHandle(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, char *szRetText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinGetHandle([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)]string Text, byte[] RetText, int BufSize); //AU3_API long WINAPI AU3_WinGetPosX(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetPosX([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text); //AU3_API long WINAPI AU3_WinGetPosY(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetPosY([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text); //AU3_API long WINAPI AU3_WinGetPosHeight(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetPosHeight([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text); //AU3_API long WINAPI AU3_WinGetPosWidth(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetPosWidth([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text); //AU3_API void WINAPI AU3_WinGetProcess(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, char *szRetText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinGetProcess([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, byte[] RetText, int BufSize); //AU3_API long WINAPI AU3_WinGetState(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinGetState([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text); //AU3_API void WINAPI AU3_WinGetText(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, char *szRetText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinGetText([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, byte[] RetText, int BufSize); //AU3_API void WINAPI AU3_WinGetTitle(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, char *szRetText, int nBufSize); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinGetTitle([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, byte[] RetText, int BufSize); //AU3_API long WINAPI AU3_WinKill(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinKill([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text); //AU3_API long WINAPI AU3_WinMenuSelectItem(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, const char *szItem1, const char *szItem2, const char *szItem3, const char *szItem4, const char *szItem5 //, const char *szItem6, const char *szItem7, const char *szItem8); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinMenuSelectItem([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string Item1 , [MarshalAs(UnmanagedType.LPStr)] string Item2, [MarshalAs(UnmanagedType.LPStr)] string Item3 , [MarshalAs(UnmanagedType.LPStr)] string Item4, [MarshalAs(UnmanagedType.LPStr)] string Item5 , [MarshalAs(UnmanagedType.LPStr)] string Item6, [MarshalAs(UnmanagedType.LPStr)] string Item7 , [MarshalAs(UnmanagedType.LPStr)] string Item8); //AU3_API void WINAPI AU3_WinMinimizeAll(); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinMinimizeAll(); //AU3_API void WINAPI AU3_WinMinimizeAllUndo(); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern void AU3_WinMinimizeAllUndo(); //AU3_API long WINAPI AU3_WinMove(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, long nX, long nY, /*[in,defaultvalue(-1)]*/long nWidth, /*[in,defaultvalue(-1)]*/long nHeight); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinMove([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, int X, int Y, int Width, int Height); //AU3_API long WINAPI AU3_WinSetOnTop(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText, long nFlag); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinMove([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, int Flags); //AU3_API long WINAPI AU3_WinSetState(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText, long nFlags); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinSetState([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, int Flags); //AU3_API long WINAPI AU3_WinSetTitle(const char *szTitle,/*[in,defaultvalue("")]*/ const char *szText //, const char *szNewTitle); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinSetTitle([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, [MarshalAs(UnmanagedType.LPStr)] string NewTitle); //AU3_API long WINAPI AU3_WinSetTrans(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText, long nTrans); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinSetTrans([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, int Trans); //AU3_API long WINAPI AU3_WinWait(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, /*[in,defaultvalue(0)]*/long nTimeout); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinWait([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, int Timeout); //AU3_API long WINAPI AU3_WinWaitActive(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, /*[in,defaultvalue(0)]*/long nTimeout); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinWaitActive([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, int Timeout); //AU3_API long WINAPI AU3_WinWaitClose(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, /*[in,defaultvalue(0)]*/long nTimeout); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinWaitClose([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, int Timeout); //AU3_API long WINAPI AU3_WinWaitNotActive(const char *szTitle, /*[in,defaultvalue("")]*/const char *szText //, /*[in,defaultvalue(0)]*/long nTimeout); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] static public extern int AU3_WinWaitNotActive([MarshalAs(UnmanagedType.LPStr)]string Title , [MarshalAs(UnmanagedType.LPStr)] string Text, int Timeout); } }
×
×
  • Create New...