Jump to content

AutoItXdll and BCX


BGM
 Share

Recommended Posts

Hello! I am using a language called BCX, which is written like BASIC, but is converted to C for compiling. I want to use the AutoItX dll. I have the old AutoItDLL and the new AutoItX. The first function below, from AutoItDLL works fine, but the second function from AutoItX returns 0. What am I missing? I don't understand dlls and pointers as well as I should, but I am learning. If anyone can shed me some light (even though I know not many people use BCX) I would be appreciative. These functions are written in BCX code.

'this function returns the active window's title, as it should

Function GetTitle$()

dim ActWin$ as string * 16384

DECLARE FUNCTION AUTOIT_WinGetActiveTitle LIB "AutoItDLL.dll" ALIAS "AUTOIT_WinGetActiveTitle" (ActWin$)

AUTOIT_WinGetActiveTitle(ActWin$)

Function = ActWin$

End Function

'this function returns 0, using AutoItX

Function GetTitle2$()

dim raw ActWin$ as string * 1000

Declare Function AU3_WinGetTitle LIB "AutoItX3.dll" alias "AU3_WinGetTitle" (szTitle$, szText$, ActWin$, nBufSize)

AU3_WinGetTitle("", "", ActWin$, len(ActWin$)+1)

Function = ActWin$

End Function

Thanks y'all. - BGM

- Brother Gabriel-Marie

Link to comment
Share on other sites

Thank you very much, Mr. Robertson. I moved those function declarations out of the functions as you suggested, but the AutoItX3DLL still returns the 0 for no window found. I understand that the third variable in the function call is a pointer to a string variable to hold it - that is, the function will fill that variable with the retrieved window title. Could it be a problem with trying to match the active window (which is what I want) by sending the first parameter as "" ?

First of all, a problem I see is that you are declaring the AutoItX function inside another function. Those DECLARE statements should not be inside your other functions.

- Brother Gabriel-Marie

Link to comment
Share on other sites

Well, I tried that, and to no avail. Now, one thing I did see was when I try to use AU3_Send, instead of sending the string I specify, it sends this: ??????????????????????????? So I think maybe there is a problem due to unicode. I don't understand unicode problems very well, but I notice that I don't have the same problem using the AutoItDLL.dll, which doesn't use any unicode - the problem is only with the AutoIt3X.dll.

- Brother Gabriel-Marie

Link to comment
Share on other sites

Well, I figured out another way to capture the active window. I can send characters to it using AUTOITDLL.dll, but not with AutoIt3X. So, I guess I will go with what works. Thanks for your help, Mr. Robertson.

Ah yes. Unicode could be the problem.

I don't know anything about BCX, but try using _T("[ACTIVE]"). A page I found shows that as converting to unicode strings.

- Brother Gabriel-Marie

Link to comment
Share on other sites

Oh, gosh, I don't know what version. I found it somewhere. It does work! I'd rather use the newer one, but it doesn't work. I do notice, however, in the old one, that it doesn't even have the parameter in the send method for specifying whether keys are sent raw or not raw!

AutoItDLL is ancient... What version of AutoIt is that from?

- Brother Gabriel-Marie

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...