Sign in to follow this  
Followers 0
madshiva

Using C/C++ function in Autoit script

4 posts in this topic

Dear all,

I have search but found nothing about this. There is a way, to add C++ code (few line) to a AutoIt script without a dll call ?

I would write a script that benchmark one hard drive, I got one source in C++ for help me.

Link to the source in C++ :

http://www.benchmarkhq.ru/fclick/fclick.php?fid=250

I have search in the fonction of AutoIt but there is no fonction to read the disk by sector, it's why I would like to create this fonction, but I don't know how I could transform this to AutoIt :

char buf[10];
wsprintf(buf,"\\\\.\\%c:",name[0]);
return (int)CreateFile(buf,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL|FILE_FLAG_NO_BUFFERING,NULL);

I hope someone could help me, to find the right way to do this.

Thanks in advance.

Share this post


Link to post
Share on other sites



Relatively easy to do. Check out the Plugins interface. Valik even updated the VS projects, so if you have Visual Studio Express, you should be able to adapt your code in a matter of minutes.

This will let you create a function with the plugin interface that will be treated exactly like a native function in AutoIt.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Ok, I will try.

Thanks you for your help JRowe !

Edited by madshiva

Share this post


Link to post
Share on other sites

Dear all,

I have search but found nothing about this. There is a way, to add C++ code (few line) to a AutoIt script without a dll call ?

I would write a script that benchmark one hard drive, I got one source in C++ for help me.

Link to the source in C++ :

http://www.benchmarkhq.ru/fclick/fclick.php?fid=250

I have search in the fonction of AutoIt but there is no fonction to read the disk by sector, it's why I would like to create this fonction, but I don't know how I could transform this to AutoIt :

char buf[10];
wsprintf(buf,"\\\\.\\%c:",name[0]);
return (int)CreateFile(buf,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL|FILE_FLAG_NO_BUFFERING,NULL);

I hope someone could help me, to find the right way to do this.

Thanks in advance.

In AutoIt:

$hFile = FileOpen("\\.\C:", 16)
ConsoleWrite(FileRead($hFile, 10) & @CRLF)
FileClose($hFile)

Or just:

ConsoleWrite(FileRead("\\.\C:", 10) & @CRLF)

Have in mind requirements of your system regarding admin privileges needed for running that code.


♡♡♡

.

eMyvnE

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