AC130 Posted August 16, 2012 Posted August 16, 2012 AU3_API void WINAPI AU3_WinActivate(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText); I converted it to VB.NET, but it won't work. Here are my parameters: (ByVal Title As String, Optional ByVal Text As String = "") As IntPtr MouseMove and Sleep work fine. Any reason why WinActivate isn't working?
AC130 Posted August 17, 2012 Author Posted August 17, 2012 I want to try WinTitleMatchMode, but I can't because AutoItSetOption also won't work. (ByVal Mode As String, ByVal Value As Long) As Integer Any ideas?
AC130 Posted August 17, 2012 Author Posted August 17, 2012 Well, still can't get this working. Would be awesome if someone would look into it. Richard, you know everything about AutoItX. Help a brother!
Richard Robertson Posted August 18, 2012 Posted August 18, 2012 (edited) I don't claim to know everything about it. In fact, I haven't even touched it in a very long time. Get rid of As IntPtr and declare it as a sub instead. It doesn't return anything. Edited August 18, 2012 by Richard Robertson
AC130 Posted August 18, 2012 Author Posted August 18, 2012 I don't claim to know everything about it. In fact, I haven't even touched it in a very long time.Get rid of As IntPtr and declare it as a sub instead. It doesn't return anything.I was really hoping that would work, but it didn't. I PM'ed you the whole declaration, if you don't mind.
Richard Robertson Posted August 18, 2012 Posted August 18, 2012 You forgot the Unicode attribute in the sub version.
AC130 Posted August 18, 2012 Author Posted August 18, 2012 You forgot the Unicode attribute in the sub version.Ugh, that didn't work, either. I don't understand how some functions work and some don't.
AC130 Posted August 19, 2012 Author Posted August 19, 2012 (edited) Any other ideas... Anyone? I'm going to get a bad grade lol... Edited August 19, 2012 by AC130
Richard Robertson Posted August 20, 2012 Posted August 20, 2012 Grade? We're not here to do your homework.
AC130 Posted August 20, 2012 Author Posted August 20, 2012 Grade? We're not here to do your homework.I just need help with one declaration... After that, I'll be able to look at why my declarations didn't work and fix the others. C'mon, help! You know you want to.
Richard Robertson Posted August 20, 2012 Posted August 20, 2012 I tried. I haven't touched VB.Net in years so honestly I was guessing.
AC130 Posted August 20, 2012 Author Posted August 20, 2012 I tried. I haven't touched VB.Net in years so honestly I was guessing.I see. Owell, I got it working. Now I'm only having problems with AU3_Error. I used:(ByVal Value As Integer) As IntegerI call it like this:(AU3_Error(0))I receive error:Unable to find an entry point named 'AU3_Error' in DLL 'AutoItX3'.My guess is the declaration is incorrect. I tried removing the ByVal, but that resulted in the same error. Any tips?
Richard Robertson Posted August 21, 2012 Posted August 21, 2012 There is no function named AU3_Error.
AC130 Posted August 21, 2012 Author Posted August 21, 2012 There is no function named AU3_Error.In the exported functions list for AutoIt:AU3_API long AU3_error(void);It's in the same spot as the rest of the API. Right?
Richard Robertson Posted August 21, 2012 Posted August 21, 2012 Err.. well no parameters. It returns int.
AC130 Posted August 21, 2012 Author Posted August 21, 2012 Err.. well no parameters. It returns int.I don't entirely understand.AU3_Error As Integer... (No paramaters)Results in error: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Richard Robertson Posted August 21, 2012 Posted August 21, 2012 You may need to change the calling convention to match the dll. I don't remember what convention you need though because I don't have AutoIt installed.
AC130 Posted August 21, 2012 Author Posted August 21, 2012 You may need to change the calling convention to match the dll. I don't remember what convention you need though because I don't have AutoIt installed.Why should I have to do that? All the other functions work fine, thus far. The paramter in c++ is (void), that means "nothing" in VB.NET. I should only have to change the parameters, but none work.
AC130 Posted August 21, 2012 Author Posted August 21, 2012 Ok, let's scrap that question for now. Are these the correct paramters for WinGetHandle?AU3_API void WINAPI AU3_WinGetHandle(LPCWSTR szTitle, /*[in,defaultvalue("")]*/LPCWSTR szText, LPWSTR szRetText, int nBufSize);(ByVal Title As String, ByVal Text As String, ByVal szText As String, ByVal Buffer As Integer) As IntegerIn the original AutoIt language, there are only two parameters; the last two don't exist, so I'm not sure on what to put for "szText". From google, I understand the buffer size, and 256 seems to be efficient. What should I put for sztext?
Richard Robertson Posted August 21, 2012 Posted August 21, 2012 If the others work fine then calling convention isn't it. You need to pass it a character array and not a string for the szRetText parameter and the nBufSize would be the length of the array. I don't believe you are ready for P/Invoke.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now