Sign in to follow this  
Followers 0
AC130

WinActivate

55 posts in this topic

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?

Share this post


Link to post
Share on other sites



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?

Share this post


Link to post
Share on other sites

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! :D

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by Richard Robertson

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

You forgot the Unicode attribute in the sub version.

Share this post


Link to post
Share on other sites

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. :(

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Any other ideas... Anyone? I'm going to get a bad grade lol...

Edited by AC130

Share this post


Link to post
Share on other sites

Grade? We're not here to do your homework.

Share this post


Link to post
Share on other sites

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. :D

Share this post


Link to post
Share on other sites

I tried. I haven't touched VB.Net in years so honestly I was guessing.

Share this post


Link to post
Share on other sites

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 Integer

I 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?

Share this post


Link to post
Share on other sites

There is no function named AU3_Error.

Share this post


Link to post
Share on other sites

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? :(

Share this post


Link to post
Share on other sites

Err.. well no parameters. It returns int.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 Integer

In 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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0