Jump to content

Visual C++ 2010 + AutoItX_x64.dll


Recommended Posts

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.

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?

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

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

Link to post
Share on other sites

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

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...