CODE:#define GRADIENT_FILL_RECT_V 1
#define PS_INSIDEFRAME 6
#define SRCCOPY 13369376
#define RUSSIAN_CHARSET 204
#define OUT_DEFAULT_PRECIS 0
#define CLEARTYPE_QUALITY 5
#define FF_DONTCARE 0
#define CLIP_DEFAULT_PRECIS 0
#define MUTEX_ALL_ACCESS 2031617
#define FLASHW_TRAY 2
#define FLASHW_TIMER 4
#define FLASHW_STOP 0
external(INT, "FlashWindow", "FlashWindowEx", "User32.dll");
external(INT, "CreateMutex", "CreateMutexA", "Kernel32.dll");
external(INT, "OpenMutex", "OpenMutexA", "Kernel32.dll");
external(INT, "ReleaseMutex", "ReleaseMutex", "Kernel32.dll");
external(INT, "CloseHandle", "CloseHandle", "Kernel32.dll");
external(INT, "FindWindow", "FindWindowExA", "user32.dll");
external(INT, "GetModuleFileName", "GetModuleFileNameA", "Kernel32.dll");
external(INT, "GetDC", "GetDC", "User32.dll");
external(INT, "DeleteDC", "DeleteDC", "Gdi32.dll");
external(INT, "ReleaseDC", "ReleaseDC", "User32.dll");
external(INT, "GradientFill", "GradientFill", "Msimg32.dll" );
external(INT, "Rectangle", "Rectangle", "Gdi32.dll");
external(INT, "SelectObject", "SelectObject", "Gdi32.dll");
external(INT, "DeleteObject", "DeleteObject", "Gdi32.dll");
external(INT, "CreateSolidBrush", "CreateSolidBrush", "Gdi32.dll");
external(INT, "CreatePen", "CreatePen", "Gdi32.dll");
external(INT, "CreateCompatibleDC", "CreateCompatibleDC", "Gdi32.dll" );
external(INT, "CreateCompatibleBitmap", "CreateCompatibleBitmap", "Gdi32.dll" );
external(INT, "BitBlt", "BitBlt", "Gdi32.dll" );
external(INT, "TextOut", "TextOutA", "Gdi32.dll" );
external(INT, "SetTextColor", "SetTextColor", "Gdi32.dll" );
external(INT, "SetBkMode", "SetBkMode", "Gdi32.dll" );
external(INT, "CreateFont", "CreateFontA", "Gdi32.dll" );
external(INT, "AlphaBlend", "AlphaBlend", "Msimg32.dll" );
char name[16384];
char buffer[1];
string name_exe;
GetModuleFileName(0, address(#name[0]), sizearray(name));
regexsearch(1, #name_exe, format(#name[0]), "[^\\]+(?=.exe)");
win w=window(name_exe);
int FLASHWINFO1[5]={20, formatwi(w), FLASHW_TRAY | FLASHW_TIMER, 0, 0};
int FLASHWINFO2[5]={20, formatwi(w), FLASHW_STOP, 0, 0};
int my_mutex=Mutex("any_name_mutex");
enabletimer(0);
function SetLoading()
{
char BLENDFUNCTION[4]={0, 0, 20, 0}
int ftn=codhexi(#BLENDFUNCTION[0], 4);
int Display_Color, Display_Width, Display_Height;
getdisplay(Display_Color, Display_Width, Display_Height);
int font = CreateFont(14, 0, 0, 0, 100, 0, 0, 0, RUSSIAN_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, FF_DONTCARE, "Arial");
int coord_rectangle[4]={Display_Width/2-130, Display_Height/2-100, 300, 130};
int hdc, DC, bitmapDC;
hdc = GetDC(0);
DC = CreateCompatibleDC(hdc);
bitmapDC = CreateCompatibleBitmap(hdc, coord_rectangle[2], coord_rectangle[3]);
SelectObject(DC, bitmapDC);
int Select_Pen1, Select_Brush1;
int Object_Pen1, Object_Brush1;
char TRIVERTEX[64];
int coord[8] = {20, 55, 280, 65, 20, 55, 280, 65};
int color[4] = {3329330, 0, 9470064, 65539};
int rect[4] = {0, 1, 2, 3};
Object_Pen1 = CreatePen(PS_INSIDEFRAME, 2, 6908265);
Object_Brush1 = CreateSolidBrush(16777215);
for(int i=0; i<=coord[2]-coord[0]; i=i+(coord[2]-coord[0])/100)
{
int percent = i/(coord[2]-coord[0])*100;
coord[4] = coord[0]+i;
fill_structure(#TRIVERTEX[0], #coord[0], #color[0]);
Select_Pen1 = SelectObject(DC, Object_Pen1);
Select_Brush1 = SelectObject(DC, Object_Brush1);
Rectangle(DC, 0, 0, coord_rectangle[2], coord_rectangle[3]);
SetTextColor(DC, 255);
SetBkMode(DC, 1);
TextOut(DC, 120, 10, "K2019Bot", 8);
TextOut(DC, 240, 70, format(percent)+"%", size(format(percent))+1);
int old_font = SelectObject (DC, font);
TextOut(DC, 20, 70, "Unpack: C:\...\Temp\Image_0.bmp", 31);
SelectObject (DC, old_font);
GradientFill(DC, address(#TRIVERTEX[0]), 4, address(#rect[0]), 2, GRADIENT_FILL_RECT_V);
if(i == 0)
{
looptime(4000)
{
AlphaBlend(hdc, coord_rectangle[0], coord_rectangle[1], coord_rectangle[2], coord_rectangle[3],
DC, 0, 0, coord_rectangle[2], coord_rectangle[3], ftn);
sleep(1);
}
}
looptime(10)
{
BitBlt(hdc, coord_rectangle[0], coord_rectangle[1], coord_rectangle[2], coord_rectangle[3], DC, 0, 0, SRCCOPY);
sleep(1);
}
if(percent == 100)
{
looptime(4000)
{
BitBlt(hdc, coord_rectangle[0], coord_rectangle[1], coord_rectangle[2], coord_rectangle[3], DC, 0, 0, SRCCOPY);
sleep(1);
}
SelectObject(DC, Select_Pen1);
SelectObject(DC, Select_Brush1);
DeleteDC(DC);
DeleteObject(bitmapDC);
ReleaseDC(0, hdc);
createdialog(0);
showdialog(0, "Диалог", 300, 300, 300, 300, 4, 1); // седьмым параметром должно быть 4
}
}
}
function fill_structure(char #Vertex, int #pos, int #c)
{
for(int i=0; i<2; i++)
{
codhex(pos[i*4], #Vertex[i*32]);
codhex(pos[i*4+1], #Vertex[i*32+4]);
codhex(rvalue(c[i*2]) * 256, #Vertex[i*32+8]);
codhex(gvalue(c[i*2]) * 256, #Vertex[i*32+10]);
codhex(bvalue(c[i*2]) * 256, #Vertex[i*32+12]);
codhex(pos[i*4+2], #Vertex[i*32+16]);
codhex(pos[i*4+3], #Vertex[i*32+20]);
codhex(rvalue(c[i*2+1]) * 256, #Vertex[i*32+24]);
codhex(gvalue(c[i*2+1]) * 256, #Vertex[i*32+26]);
codhex(bvalue(c[i*2+1]) * 256, #Vertex[i*32+28]);
}
}
loop()
{
sleep(10);
}
function getmessage(0, WM_CLOSE)
{
ReleaseMutex(my_mutex);
CloseHandle(my_mutex);
close();
}
function Mutex(string s)
{
if(OpenMutex(MUTEX_ALL_ACCESS, 0, s))
{
find_window(name_exe);
close();
}
else
{
SetLoading();
}
return CreateMutex(0, 1, s);
}
function find_window(string name)
{
int handle=FindWindow(0, 0, 0, name);
while (handle != 0)
{
write_buffer('1', handle);
handle=FindWindow(0, handle, 0, name);
}
}
function write_buffer(char cc, int handle)
{
char c[1]={cc}
writebuffer(#c[0], 1, formatiw(handle));
}
CREATE_TIMER(0, 500)
{
readbuffer(#buffer[0], 1);
if(buffer[0]=='1')
{
write_buffer('0', formatwi(w));
FlashWindow(address(#FLASHWINFO1[0]));
pause(2000);
FlashWindow(address(#FLASHWINFO2[0]));
}
}