Эксперт
Покинул форум
Сообщений всего: 4465
Дата рег-ции: Нояб. 2017
Репутация: 585
|
Цитата: создается ли в Киборе Toolbar?
Toolbar (Отобразить)CODE:#define WS_VISIBLE 268435456
#define WS_CHILD 1073741824
#define TB_AUTOSIZE 1057
#define ILC_MASK 1
#define LVSIL_SMALL 1
#define IMAGE_ICON 1
#define LR_LOADFROMFILE 16
#define TB_SETIMAGELIST 1072
#define IDI_INFORMATION 32516
#define IDI_ERROR 32513
#define IDI_WARNING 32515
#define IDI_QUESTION 32514
#define IDI_SHIELD 32518
#define TB_BUTTONSTRUCTSIZE 1054
#define TB_ADDBUTTONSA 1044
#define ILC_COLOR24 24
#define TBSTATE_ENABLED 4
#define WM_USER 1024
external(INT, "CreateWindow", "CreateWindowExA", "User32.dll");
external(INT, "GetWindowLong", "GetWindowLongA", "User32.dll" );
external(INT, "ImageList_Create", "ImageList_Create", "Comctl32.dll");
external(INT, "ImageList_ReplaceIcon", "ImageList_ReplaceIcon", "Comctl32.dll");
external(INT, "LoadIcon", "LoadIconA", "User32.dll");
external(INT, "LoadImage", "LoadImageA", "User32.dll");
int toolbar, ImageList;
char text[3][99];
char TBBUTTON[60];
createdialog(0);
showdialog(0, "Dialog", 300, 300, 400, 300, 1, 1);
sendmessage(TB_AUTOSIZE, 0, 0, formatiw(toolbar));
loop()sleep(100);
function getmessage(0, WM_CREATE)
{
toolbar=CreateWindow(0, "ToolbarWindow32", "",WS_VISIBLE | WS_CHILD, 0, 0, 0, 0, gethwnd(0), 0, 0, 0);
ImageList = ImageList_Create(18, 18, ILC_MASK | ILC_COLOR24 , 3, 1); // 3 - количество изображений
// добавить картинку из файла
// ImageList_ReplaceIcon(ImageList, -1, LoadImage(0, "C:\111.ico", IMAGE_ICON, 0, 0, LR_LOADFROMFILE));
ImageList_ReplaceIcon(ImageList, -1, LoadIcon(0, IDI_ERROR));
ImageList_ReplaceIcon(ImageList, -1, LoadIcon(0, IDI_WARNING));
ImageList_ReplaceIcon(ImageList, -1, LoadIcon(0, IDI_QUESTION));
// текст кнопок
strcpy(#text[0][0], "Error");
strcpy(#text[1][0], "Warning");
strcpy(#text[2][0], "Question");
initialarray(#TBBUTTON[0], 0);
// структура TBBUTTON для первой кнопки
writeaddress(0, address(#TBBUTTON[0])); // iBitmap
writeaddress(WM_USER + 1, address(#TBBUTTON[4])); // idCommand
TBBUTTON[8]=TBSTATE_ENABLED; // fsState
writeaddress(address(#text[0][0]), address(#TBBUTTON[16]));
// структура TBBUTTON для второй кнопки
writeaddress(1, address(#TBBUTTON[20]));
writeaddress(WM_USER + 2, address(#TBBUTTON[24]));
TBBUTTON[28]=TBSTATE_ENABLED;
writeaddress(address(#text[1][0]), address(#TBBUTTON[36]));
writeaddress(2, address(#TBBUTTON[40]));
writeaddress(WM_USER + 3, address(#TBBUTTON[44]));
TBBUTTON[48]=TBSTATE_ENABLED;
writeaddress(address(#text[2][0]), address(#TBBUTTON[56]));
sendmessage(TB_SETIMAGELIST, LVSIL_SMALL, ImageList, formatiw(toolbar)); // установить список изображений
sendmessage(TB_BUTTONSTRUCTSIZE, 20, 0, formatiw(toolbar)); // задать размер структуры TBBUTTON
sendmessage(TB_ADDBUTTONSA, 3, address(#TBBUTTON[0]), formatiw(toolbar)); // добавить 3 кнопки
}
function getmessage(0, WM_COMMAND)
{
if(message.lparam==toolbar)
{
if(message.wparam==WM_USER + 1){messagebox("Нажата Error"); return;}
if(message.wparam==WM_USER + 2){messagebox("Нажата Warning"); return;}
if(message.wparam==WM_USER + 3){messagebox("Нажата Question"); return;}
}
}
|