ligorlwow Posted July 7, 2012 Posted July 7, 2012 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.
Richard Robertson Posted July 8, 2012 Posted July 8, 2012 You need to use Unicode strings. Prepend an L on the quotes. L"HELLO WORLD"
ProgAndy Posted July 8, 2012 Posted July 8, 2012 (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 July 8, 2012 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
ligorlwow Posted July 8, 2012 Author Posted July 8, 2012 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?
JohnOne Posted July 8, 2012 Posted July 8, 2012 hDLL=LoadLibrary("AutoItX3.dll"); //do stuff; CloseHandle(hDLL); AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
trancexx Posted July 8, 2012 Posted July 8, 2012 hDLL=LoadLibrary("AutoItX3.dll");//do stuff;CloseHandle(hDLL);You are interesting person. ♡♡♡ . eMyvnE
ProgAndy Posted July 8, 2012 Posted July 8, 2012 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
JohnOne Posted July 8, 2012 Posted July 8, 2012 You are interesting person.Want to join my cult? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
trancexx Posted July 8, 2012 Posted July 8, 2012 Want to join my cult?Sure. What's it called like? Cult of Free Library? ♡♡♡ . eMyvnE
JohnOne Posted July 8, 2012 Posted July 8, 2012 Ah! It's now called the cult of "I blame ProgAndy" AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
JohnOne Posted July 8, 2012 Posted July 8, 2012 But wait, should be FreeLibrary(hDLL) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
ligorlwow Posted July 9, 2012 Author Posted July 9, 2012 You need to use Unicode strings. Prepend an L on the quotes.L"HELLO WORLD"How work 'L' with variables ?
JohnOne Posted July 9, 2012 Posted July 9, 2012 You would need to ensure your variables are LPWSTR to begin with or perform some sort of cast. I think if your vars are WCHAR var[n] you can pass *var. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
ligorlwow Posted July 9, 2012 Author Posted July 9, 2012 Can you use dynamic variables?And please example, because if I use LPWSTR var, I can not change them and for WCHAR too.
JohnOne Posted July 9, 2012 Posted July 9, 2012 Give an example of how you get your variables into your code. One example might be... wchar var[256]; wcin >> var; N_Send(*var,0); AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
ligorlwow Posted July 10, 2012 Author Posted July 10, 2012 (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 July 10, 2012 by ligorlwow
JohnOne Posted July 10, 2012 Posted July 10, 2012 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.
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