Jump to content

SueImWeb

Members
  • Posts

    9
  • Joined

  • Last visited

SueImWeb's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. I do understand that I am able to call API functions from C# too. What I primarily was looking for was an ability of sending keystrokes (combinations) to not active windows. Trying to find a solution I played with .NET SendKeys and API methods SendInput and PostMessage (with WM_KEYDOWN, WM_CHAR etc). But I had to end up with the information, that this is not possible because you can't simulate holding a key pressed respectivly simulate key combinations with WM_KEYDOWN. Besides SendInput and keybd_event are sent to the active window and WM_CHAR does only support ascii codes or ALT + 1 ascii key. So for the first I changed my application code to send messages only to active windows. Because I am less of time and using AutoItX for that is more comfortable than using API methods directly I implemented it. My next step is to learn how to register hotkeys. I hope WM_HOTKEY could be the solution for my problem. Any other idea? Sue
  2. I got it...have to send the window's handle in hex format.
  3. That's very nice, but afaik C# does only support the SendKeys method. I need to send keystrokes to different (text control) windows outside of my application, e. g. CTRL + SHIFT + RIGHT which marks one word to the right. Those windows can be a Word document, a new email, a textbox within another application etc. And this has to work also if the regarding window is not the active (foreground) window and if another window has the same title. Therefore I need to address the window by it's handle.
  4. Thank you very much ... that works. But there is one thing left. Using the dll this way I am not able to look for a window by its handle. I tried it in different ways (got the handle through API's GetForegroundWindow method): AU3_WinExists("[HANDLE:" + hWnd.toString() + "]", ""); AU3_WinExists("handle=" + hWnd.toString(), ""); AU3_WinExists(hWnd.toString(), ""); Every call returns 0. Do you have any idea? Sue
  5. Hello Richard, according to the postings I linked to, I used the type of string. But a few month ago (also with version 3) I also tried it with StringBuilder. The first example shows it like this: [DllImport(dllpath, SetLastError = true, CharSet = CharSet.Auto)] private static extern int AU3_WinExists([MarshalAs(UnmanagedType.LPStr)]string Title, [MarshalAs(UnmanagedType.LPStr)]string Text); public static int WinExists(string vsTitle, string vsText) { return AU3_WinExists(vsTitle, vsText); } Sue
  6. Hello, since yesterday I am trying to use AutoItX by DllImport for the umpteenth time - no success again. It's the same like before, registering the dll and referencing it, there are no problems. Using my old AutoIt.dll from 2002 by DllImport does also work. But using AutoItX V3 by DllImport...nothing happens. Would someone please tell me, what's wrong? This is what I do: 1. Stored the AutoItX3.dll into the program folder of my C# Project(tried the system32 folder also). 2. Created a class like this one or that one and named it "AutoItX". 3. Tried to call different methods. ...none of them seem to work... Sue
  7. Thank you very much, it works. But unfortunately I have the same problem as with using the registered version of AutoItX. The method returns an empty string instead of the control's handle. If I only knew what's the reason.... Until a few days ago everything worked without any problem. Regards Sue
  8. Hello, first of all I want to say THANK YOU for your very helpful article! Would you please additionally help me understanding some parameters? //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); Using the registered version I do only need 3 parameters, the dll expects 5. What do I have to put in for byte[] RetText and int BufSize ? Greetings from Germany Sue Ups.....sorry for mistyping the word use in the headline....
  9. Hello, i am using AutoItX as a registered COM Object for about 1,5 years now and everything worked fine, also after upgrading to version 3.2.12.1. Yesterday I detected, that some methods of AutoItX didn't work anymore (there was no Windows Update on my computer, no changes of my code in the regarding classes). Because i was working on the design of my application during the last few days, I tested older versions of my program back to 30. Sep to exclude a bug. The same problem appeared through all versions. ------------------------------------------------------------------------------------------- The first problem (ControlGetHandle): // C# Code public class MyClass { private AutoItX3Lib.AutoItX3Class ait3 = new AutoItX3Lib.AutoItX3Class(); public MyClass() { ait3.AutoItSetOption("WinTitleMatchMode", 4); } // trying to get the handle of a control // in another application public string GetTheControlHandle() { // Suddenly returns an empty string // and sets error to 1 // The ControlId is definitely 2008! // Testing the ClassNameNN "Edit122" // was causing the same return string hwnd = ait3.ControlGetHandle("", "", "2008"); } } ------------------------------------------------------------------------------------------ The second problem (WinSetTitle): I designed an interface to enable communication between 2 applications. One of these programs comes from an extern software vendor and allows creating own forms with VBScript for individual purposes. This is where I use AutoItX to send some Text to a hidden window in my .NET application, where a hook (WndProc) catches the message and fires an event if the message number is 12 (WM_SETTEXT). Yesterday I found out, that suddenly no WM_SETTEXT arrives my hook in the hidden window. Monitoring the operations with WinspectorSpy I also missed my message. But then the unbelievable: The title of my hidden window get set to the new text out of my message!!! I then ran tests on 3 other computers - everywhere the same result. ----------------------------------------------------------------------------------------------- As far as I know yet, every other methods do still work fine. Does anybody have an idea what could cause these problems? Thank you in advance. Sue
×
×
  • Create New...