Kibor Bot Autoclicker » Kibor - Integrated development environment for bots » About Kibor » Version 4.13 Connecting your DLLs. Using API functions in a script from standard libraries

Страниц (1): [1]
 

1. Kibor - 26 Июля, 2018 - 07:01:27 - перейти к сообщению
There was an opportunity of connection of external DLL and a call from a script of their functions.
You can connect both your own libraries and any standard ones using Win API after writing scripts in Kibor.

This significantly expands the range of tasks solved in Kibron, as almost all Api become available which can be used directly by programming in Kibor and part of the program can be written in any language and compiled into Dll, which can then be connected in a script and used.

Its Dll can be packed into the resources of the assembled exe and then it will not have to be distributed separately with the program.

external (INT,"my_message","MessageBoxA","user32.dll"); //Get a pointer to the MessageBoxA function

It connects user32.dll, receives a pointer to the Api function MessageBoxA, indicates that in the script we will call it using the symbolic name my_message and return this function to the type int

Example of creating and connecting your dialog box created in Visual Studio

Open link
CODE:
external (INT,"ShellExecute","ShellExecuteA","Shell32.dll");
ShellExecute (0,"Open","http:/"+"/kibor-bot.com/education-kibor.php", 0,"", 61728);


Creating a Folder ..
CODE:
external (INT,"CreateDirectory","CreateDirectoryA","kernel32.dll");
CreateDirectory ("C:\mu_fol", 0);


delete file
CODE:
external (INT,"DeleteFile","DeleteFileA","kernel32.dll");
DeleteFile ("C:\ttt.txt");


rename
CODE:
external (INT,"MoveFile","MoveFileA","kernel32.dll");
MoveFile ("C:\This_ Rename.txt","C:\In_This.txt");


Scrolling mouse wheel
CODE:
external (VOID,"mouse_event","mouse_event","user32.dll");
mouse_event (2048, 0, 0, -500, 0);


Move folder 5 from folder 1 to 2
CODE:
external (VOID,"MoveFile","MoveFileA","kernel32.dll");
MoveFile ("C:\New folder\1\5","C:\New folder\2\5");


Simultaneous playback of wav or mp3 files
CODE:
external (INT,"mciSendString","mciSendStringA","Winmm.dll");

mciSendString ("open C:\1\b.wav", 0, 1, 0); //Long
mciSendString ("open C:\1\h.wav", 0, 1, 0); //Short
loop ()
{
mciSendString ("play C:\1\b.wav", 0, 1, 0);
loop (20)
{
mciSendString ("play C:\1\h.wav", 0, 1, 0);
sleep (100);
mciSendString ("close C:\1\h.wav", 0,1, 0);
}
mciSendString ("close C:\1\b.wav", 0,1, 0);
}


Playback loop
CODE:
external (INT,"mciSendString","mciSendStringA","Winmm.dll");

char SST [256];
int adr=address (#SST [0]);
mciSendString ("open C:\1\b.wav", 0, 1, 0);

loop ()
{
mciSendString ("play C:\1\b.wav", 0, 1, 0);
mciSendString ("status C:\1\b.wav mode", adr, 256, 0);
while (format (#SST [0])=="playing") mciSendString ("status C:\1\b.wav mode", adr, 256, 0);
mciSendString ("close C:\1\b.wav", 0,1, 0);


messagebox ("Truncate, possible first"); //Comment for looping


}


The first parameter is INT DOUBLE STRING CHAR VOID. What the function returns. VOID says that the function does not return anything.
The second is the symbolic name by which we will use this function in the script.
Third - The original name of the function in the library
The fourth is a plug-in library.

An example of using Api in a script and transferring part of the code to its external Dll, which was packed into the resource of the assembled exe. Download the assembled EXE from the Dll packed into it, which will be unzipped the first time it is launched into the program folder [url=http: //kibor-bot.com/files/KiborDll.rar] http://kibor-bot.com/files/KiborDll. rar [/url]
 Цитата:
unpack ("C:\MuDll.dll", pathfolder () +"MuDll.dll", 0); //Unpack your Dll from the resources in the program folder

//This is a connection of standard dynamically linked libraries (user32.dll, kernel32.dll, etc.) for working with Win API
external (INT,"my_message","MessageBoxA","user32.dll"); //Get a pointer to the MessageBoxA function
external (VOID,"my_exit","ExitProcess","kernel32.dll"); //Obtaining a pointer to the ExitProcess function

//This is the connection of their Dlls that should be in the program folder. All the same.
external (INT,"my_add","Add","MuDll.dll"); //Getting a pointer to the Add function
external (VOID,"my_pisk","DllCod","MuDll.dll"); //Obtaining a pointer to the DllCod function

//After connecting the Dll and defining the addresses of the functions to be called (the third parameter) with Dll, they can be called with Kibor by the username specified in the second parameter.
messagebox ("sum 57 + 7="+ format (my_add (57, 7))); //Call the Add function from its Dll
char c [250];
strcpy (#c [0],"This code works with the DLL, the text was passed in the function parameter.");
my_pisk (2000, 1000, address (#c [0])); //Call the DllCod function from its Dll

//Here we use in the script call Api functions with user32.dll and kernel32.dll
int a;
s: a=my_message (0,"Close the program ??????","Title", 6); //Call the MessageBoxA with user32.dll
if (a==10) goto s;
if (a==11) my_exit (0); //Call ExitProcess from kernel32.dll

RESOURCE
{
"C:\MuDll.dll"//We'll pack our DLL into the resources of the assembled exe
}


and this is the code of MuDll.dll itself
 Цитата:
#include


extern"C"__declspec (dllexport) int Add (int i1, int i2)
{
return i1 + i2;
}

extern"C"__declspec (dllexport) void DllCod (int p1, int p2, char * c)
{

Beep (p1, p2);
MessageBox (0, c,"Window with DLL", 0);
}


=====================================================

Filling the structure for transmission as a parameter in GetSaveFileNameA .. Used by COMDLG32.

CODE:
external (VOID,"GetSaveFile","GetSaveFileNameA","COMDLG32.DLL");
char b [100];
strcpy (#b [0],"file");
char f [256];
for (int n=0; n <256; n ++) f [n]=0;
char a [77];
for (n=0; n <77; n ++) a [n]=0;

writeaddress (76, address (#a [0]));
writeaddress (0, address (#a [4]));
writeaddress (0, address (#a [8]));
writeaddress (address (#b [0]), address (#a [12]));
writeaddress (0, address (#a [16])));
writeaddress (1634928, address (#a [20])));
writeaddress (1000, address (#a [24])));
writeaddress (0, address (#a [28])));


writeaddress (0, address (#a [32])));
writeaddress (address (#f [0]), address (#a [36]));
writeaddress (6148, address (#a [40])));

GetSaveFile (address (#a [0]));
messagebox (format (#f [0]));



Select file to open it
CODE:
external (VOID,"GetOpenFileName","GetOpenFileNameA","COMDLG32.DLL");

char b [512];
b [0]=formatic (0);

char a [77];
for (int n=0; n <77; n ++) a [n]=0;

writeaddress (76, address (#a [0]));
writeaddress (0, address (#a [4]));
writeaddress (0, address (#a [8]));
writeaddress (0, address (#a [12]));
writeaddress (0, address (#a [16])));
writeaddress (1634928, address (#a [20])));
writeaddress (1000, address (#a [24])));
writeaddress (address (#b [0]), address (#a [28]));
writeaddress (512, address (#a [32])));
writeaddress (0, address (#a [36]));
writeaddress (6148, address (#a [40])));

GetOpenFileName (address (#a [0]));
messagebox (format (#b [0]));


The main problem is to correctly fill the structure, the pointer to which must be passed in the form of a function parameter ..

Powered by ExBB FM 1.0 Final