PageRenderTime 60ms CodeModel.GetById 36ms RepoModel.GetById 0ms app.codeStats 0ms

/Wrapper/AhkDllFlat.cs

https://github.com/brigand/AhkDll-.NET
C# | 55 lines | 33 code | 14 blank | 8 comment | 0 complexity | d235a6afaa44e428db5bb1042f1f083e MD5 | raw file
  1. using System;
  2. using System.Runtime.InteropServices;
  3. namespace AhkWrapper
  4. {
  5. /// <summary>
  6. /// These functions serve as a flat wrapper for AutoHotkey.dll.
  7. /// They assume AutoHotkey.dll is in the same directory as your
  8. /// executable.
  9. /// </summary>
  10. public class AhkDllFlat
  11. {
  12. private const string DLLPATH = "AutoHotkey.dll";
  13. [DllImport(DLLPATH, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
  14. public static extern uint ahkdll(string Path, string Options, string Parameters);
  15. [DllImport(DLLPATH, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
  16. public static extern bool ahkExec(string code);
  17. [DllImport(DLLPATH, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
  18. public static extern void addScript(string code, byte execute);
  19. // Constant values for the execute parameter of addScript
  20. public struct Execute
  21. {
  22. public const byte Add = 0, Run = 1, RunWait = 2;
  23. }
  24. [DllImport(DLLPATH, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
  25. public static extern uint ahktextdll(string Code, string Options, string Parameters);
  26. [DllImport(DLLPATH, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
  27. public static extern bool ahkReady();
  28. [DllImport(DLLPATH, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
  29. public static extern uint addFile(string FilePath, byte AllowDuplicateInclude, byte IgnoreLoadFailure);
  30. /* ahkLabel and ahkFunction should be added
  31. but they're not a priority */
  32. [DllImport(DLLPATH, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
  33. public static extern bool ahkassign(string VariableName, string NewValue);
  34. [DllImport(DLLPATH, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
  35. public static extern IntPtr ahkgetvar(string VariableName, bool GetPointer);
  36. [DllImport(DLLPATH, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
  37. public static extern void ahkTerminate(bool ForceKill);
  38. [DllImport(DLLPATH, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
  39. public static extern void ahkReload();
  40. }
  41. }