Sign in to follow this  
Followers 0
ligorlwow

Visual C++ 2010 + AutoItX_x64.dll

19 posts in this topic

When in C++ I use LoadLibrary("AutoItX3.dll") functions work , but not correct, for example :

void N_Send(LPCWSTR szSendText, /*[in,defaultvalue("")]*/long nMode)
{
typedef void (CALLBACK* temp)(LPCWSTR szSendText, /*[in,defaultvalue("")]*/long nMode);
HMODULE hDLL;
    hDLL=LoadLibrary("AutoItX3.dll");
temp r;
r=(temp)GetProcAddress(hDLL,"AU3_Send");
r(szSendText,nMode);
}

if N_Send("HELLO WORLD",0) - > result : 慤摳獡D | why??

if N_Send("A",0) -> result: A | work correct(If one character)

If I use a function with int(long) argument, function work correct, for example AU3_Sleep(long nMilliseconds), N_PixelGetColor(long nx,long ny) ...

If I use AutoItX_x64.dll in LoadLibrary, it return NULL | why?? ( Windows 7 64-bit)

Thanks for your help.

Share this post


Link to post
Share on other sites



You need to use Unicode strings. Prepend an L on the quotes.

L"HELLO WORLD"

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

You call LoadLibrary each time the function is entered, but CloseHandle is never called. By the way, why don't you link to the dll to create a hard dependency?

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

You call LoadLibrary each time the function is entered, but CloseHandle is never called. By the way, why don't you link to the dll to create a hard dependency?

how to do it?

Share this post


Link to post
Share on other sites

hDLL=LoadLibrary("AutoItX3.dll");

//do stuff;

CloseHandle(hDLL);

You are interesting person.

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

how to do it?

I forgot that AutoItX doesn't come with the required .lib files and it is a bit tricky to create them from the dll, but it should be possible.

http://gnuwin32.sourceforge.net/msimport.html


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

Want to join my cult?

Posted Image

Sure. What's it called like? Cult of Free Library?

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Thanks for your help.

Share this post


Link to post
Share on other sites

You need to use Unicode strings. Prepend an L on the quotes.

L"HELLO WORLD"

How work 'L' with variables ?

Share this post


Link to post
Share on other sites

Can you use dynamic variables?

And please example, because if I use LPWSTR var, I can not change them and for WCHAR too.

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

Thanks, but i have two problems:

1) I can't save 'space' in WCHAR variables.("HELLO WORLD" -> result : HELLO )

2) some function do not work, for example wstrcpy()....

I some edited your example:

wchar_t var[256];
wcin>>var;
N_Send((LPCWSTR)var,0);

Give an example of how you get your variables into your code.

For example : file or

InputBox().

Edited by ligorlwow

Share this post


Link to post
Share on other sites

Then your method of reading a file or InputBox() (which I'm sure is not a C++ standard windows function) would

need to be read into a var of type LPWSTR.

I don't think you need an explicit constness cast either.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Thanks, I figured.

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