Jump to content



Photo

Delphi Wrapper Advanced


  • Please log in to reply
10 replies to this topic

#1 Melloware

Melloware

    Seeker

  • Active Members
  • 21 posts

Posted 29 September 2007 - 04:04 PM

I know Tianpeng Wang wrote a Delphi DLL wrapper for AutoItX but I have also written one that I think is just slightly more robust.

The advantages of the wrapper I have created are:

1. Dynamically loaded so no error with be thrown if DLL is not found on the path. You can query boolean AutoItXDLLLoaded property to find out if it is loaded. This will allow your application to function normally if the DLL is not found. The other wrapper is statically linked to the DLL and throws a cryptic error when the DLL is not found.

if AutoItXDLLLoaded then  ... else  ... end;


2. Defaults for integer parameters as listed in the API spec. So instead of:
AU3_WinWaitActive('Untitled - Notepad', '', 0);

you can use:
AU3_WinWaitActive('Untitled - Notepad', '');

if you want the default.

3. Ability to query for the version of the DLL you are using by the method AutoItXVersion() which return 3.2.8.4 or whatever the version of the AutoItXDll you are using.

4. Has latest procedures and functions from the DLL including the new RegDeleteKey and RegDeleteValue where the old .PAS file has the old API calls.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Attached Files


Edited by Melloware, 14 May 2009 - 03:10 AM.






#2 HPW

HPW

    Seeker

  • Active Members
  • 5 posts

Posted 18 March 2008 - 10:57 AM

I know Tianpeng Wang wrote a Delphi DLL wrapper for AutoItX but I have also written one that I think is just slightly more robust.

The advantages of the wrapper I have created are:

1. Dynamically loaded so no error with be thrown if DLL is not found on the path. You can query boolean AutoItXDLLLoaded property to find out if it is loaded. This will allow your application to function normally if the DLL is not found. The other wrapper is statically linked to the DLL and throws a cryptic error when the DLL is not found.

2. Defaults for integer parameters as listed in the API spec.

3. Ability to query for the version of the DLL you are using by the method AutoItXVersion() which return 3.2.8.4 or whatever the version of the AutoItXDll you are using.

4. Has latest procedures and functions from the DLL including the new RegDeleteKey and RegDeleteValue where the old .PAS file has the old API calls.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-


Nice wrapper!
Is it 'Freeware' like AutoIt itself?


Hans-Peter

#3 Melloware

Melloware

    Seeker

  • Active Members
  • 21 posts

Posted 28 March 2008 - 12:39 PM

Nice wrapper!
Is it 'Freeware' like AutoIt itself?


Hans-Peter


Yes! I just wanted to give something back to the AutoIT community since I wrote this wrapper to be used in my Intelliremote application. Feel free to use it unencumbered!
----------------------------------------------------------------------------------------Melloware Inchttp://www.melloware.comHome of Intelliremote, take back control of your HTPC!www.intelliremote.com-----------------------------------------------------------------------------------------

#4 yinkoh

yinkoh

    Seeker

  • New Members
  • 4 posts

Posted 01 April 2008 - 06:16 AM

hello

your dll works fine but i can't find the "WinList" function, do you plan to add it ?

thx anyway

#5 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,315 posts

Posted 01 April 2008 - 09:40 AM

Nice one.
Thanks for sharing.

#6 Melloware

Melloware

    Seeker

  • Active Members
  • 21 posts

Posted 01 April 2008 - 10:30 PM

Thanks for the compliments!

I don't see a "WinList" function in the AutoITX C header. Is it possible you want this function and its not supported by AutoITX. I think I have implemented every method call available in the DLL?

Edited by Melloware, 01 April 2008 - 10:40 PM.

----------------------------------------------------------------------------------------Melloware Inchttp://www.melloware.comHome of Intelliremote, take back control of your HTPC!www.intelliremote.com-----------------------------------------------------------------------------------------

#7 LDericher

LDericher

    Seeker

  • Active Members
  • 9 posts

Posted 01 May 2009 - 01:22 PM

I'm sorry, but I tried to use your Warapper with AutoItX3.dll in Delphi7, but the only thing your "TestAutoItX.dpr" managed to do was to write pointless sequences of questionmarks into my delphi - I commented the "WinWaitActive" part because it didn't work either.

I only get the DLL to send single Chars, but that isn't enough for what I need it to.

Did anybody of you encounter similar problems?

This is the Code I tested your wrapper with:
   if not AutoItXDLLLoaded then //Returned True.    begin       MessageDlg('AutoItX3 DLL is not found in the path!', mtError, [mbOK], 0);    end    else    begin       AU3_Sleep(1000); // Only Thing that worked^^       AU3_Run('notepad.exe', ''); //didn't work...       //AU3_WinWaitActive('Untitled - Notepad', ''); //Commented: The notepad wasn't opened.       AU3_Send(PAnsiChar('DLL Version: ' + AutoItXVersion + ' {ENTER}')); //wrote sequencves like '???????4????' into my codeeditor       AU3_Send(PAnsiChar('DLL Description: ' + AutoItXDescription)); //Didn't work either       AU3_Sleep(5000); // Only Thing that worked^^       AU3_WinClose('Untitled - Notepad', ''); // I stopped execution at this point.       AU3_WinWaitActive('Notepad', '&No');       AU3_Send('!n');    end;


Thx in advance,
The LDer.

P.S.: I found this topic: http://www.autoitscript.com/forum/index.ph...1&hl=delphi
But it does't solve my problems.

Can anybody of you upload his working set of DLL and delphi-wrapper? Or is mine a problem with Delphi7?

Plz help me, I'm just about to become desperate ^_^
Posted Image

#8 Authenticity

Authenticity

    Universalist

  • MVPs
  • 2,619 posts

Posted 01 May 2009 - 04:30 PM

Why do you call AU3_Run? Use CreateProcess instead. It'll call it internally anyway. If I'm not wrong I think that the second parameter in AU3_Run has to be specified to point to the current working directory... And also AU3_* functions are working with unicode strings so I guess that this the reason why you're getting ???????4???? string. ;]

Edited by Authenticity, 01 May 2009 - 04:31 PM.


#9 martin

martin

    ~~\o/~~~/0\=¬''~~~

  • MVPs
  • 7,199 posts

Posted 01 May 2009 - 04:45 PM

I'm sorry, but I tried to use your Warapper with AutoItX3.dll in Delphi7, but the only thing your "TestAutoItX.dpr" managed to do was to write pointless sequences of questionmarks into my delphi - I commented the "WinWaitActive" part because it didn't work either.

I only get the DLL to send single Chars, but that isn't enough for what I need it to.

Did anybody of you encounter similar problems?

This is the Code I tested your wrapper with:

   if not AutoItXDLLLoaded then //Returned True.     begin        MessageDlg('AutoItX3 DLL is not found in the path!', mtError, [mbOK], 0);     end     else     begin        AU3_Sleep(1000); // Only Thing that worked^^        AU3_Run('notepad.exe', ''); //didn't work...        //AU3_WinWaitActive('Untitled - Notepad', ''); //Commented: The notepad wasn't opened.        AU3_Send(PAnsiChar('DLL Version: ' + AutoItXVersion + ' {ENTER}')); //wrote sequencves like '???????4????' into my codeeditor        AU3_Send(PAnsiChar('DLL Description: ' + AutoItXDescription)); //Didn't work either        AU3_Sleep(5000); // Only Thing that worked^^        AU3_WinClose('Untitled - Notepad', ''); // I stopped execution at this point.        AU3_WinWaitActive('Notepad', '&No');        AU3_Send('!n');     end;

Thx in advance,
The LDer.

P.S.: I found this topic: http://www.autoitscript.com/forum/index.ph...1&hl=delphi
But it does't solve my problems.

Can anybody of you upload his working set of DLL and delphi-wrapper? Or is mine a problem with Delphi7?

Plz help me, I'm just about to become desperate ^_^

I'm a bit confused by your post because your give a link to a thread where the answer to you rp[roblewm is given but the code you post doesn' take any notice of that. Are you saying you tried the solution and it didn't work? Either way, why does your script include code which was pointed out as being faulty by Valik?
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

#10 Melloware

Melloware

    Seeker

  • Active Members
  • 21 posts

Posted 13 May 2009 - 06:33 PM

I'm a bit confused by your post because your give a link to a thread where the answer to you rp[roblewm is given but the code you post doesn' take any notice of that. Are you saying you tried the solution and it didn't work? Either way, why does your script include code which was pointed out as being faulty by Valik?

LDer,

I am using Delphi 7 and I just ran it and it worked fine for me on both a Vista x64 and XP x32 machines. What version of the AutoItX DLL are you using?

I am using 3.2.12.1 and it works. I have not upgraded to 3.3 but from that other post it looks like it has to do with Ansi strings vs Unicode Strings which is new in 3.3

Edited by Melloware, 13 May 2009 - 06:40 PM.

----------------------------------------------------------------------------------------Melloware Inchttp://www.melloware.comHome of Intelliremote, take back control of your HTPC!www.intelliremote.com-----------------------------------------------------------------------------------------

#11 Melloware

Melloware

    Seeker

  • Active Members
  • 21 posts

Posted 14 May 2009 - 03:09 AM

OK so AutoItX 3.3 is now using Unicode strings. All I had to do was update the code to use PWideChar instead of PChar and now you have to wrap strings you call it with StrToOleStr() like so...

AU3_Send(StringToOleStr('DLL Description: ' + AutoItXDescription));


See attached code for use in AutoItX 3.3+.

Attached Files


----------------------------------------------------------------------------------------Melloware Inchttp://www.melloware.comHome of Intelliremote, take back control of your HTPC!www.intelliremote.com-----------------------------------------------------------------------------------------




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users