long ScanMessage(UINT message, WPARAM wParam, LPARAM lParam);
HMENU menu;
HMENU hSubMenu;
HMENU iSubMenu;
HWND headwindow;
HWND* color_menu[36];
char szFile[MAX_PATH];
char text[3];
int len;
var headwindow_size = 80;
#define WS_EX_TOOLWINDOW 0x80
#define WS_EX_CONTROLPARENT 0x10000
#define WS_EX_WINDOWEDGE 0x100
#define WS_EX_LEFT 0x00000000
#define ES_NUMBER 0x2000
#define BS_NOTIFY 0x4000
#define SS_SUNKEN 0x00001
#define BST_CHECKED 0x0001
#define BST_UNCHECKED 0x0000
RECT recta;
DWORD flag_edit_st;
DWORD flag_text_st;
DWORD flag_checkbox_st;
DWORD flag_edit;
DWORD flag_text;
void set_api_main()
{
wait(1);
on_scanmessage = ScanMessage;
menu=CreateMenu();
hSubMenu=CreateMenu();
iSubMenu=CreateMenu();
//file 1-19
InsertMenu(hSubMenu,0,MF_BYPOSITION|MF_STRING,1,"New");
InsertMenu(hSubMenu,1,MF_BYPOSITION|MF_SEPARATOR,0,"");
InsertMenu(hSubMenu,2,MF_BYPOSITION|MF_STRING,2,"Load");
InsertMenu(hSubMenu,3,MF_BYPOSITION|MF_SEPARATOR,0,"");
InsertMenu(hSubMenu,4,MF_BYPOSITION|MF_STRING,3,"Save");
InsertMenu(hSubMenu,5,MF_BYPOSITION|MF_STRING,4,"Save as...");
InsertMenu(hSubMenu,6,MF_BYPOSITION|MF_SEPARATOR,0,"");
InsertMenu(hSubMenu,20,MF_BYPOSITION|MF_STRING,19,"Quit");
//end file
//insert 20-39
InsertMenu(iSubMenu,1,MF_BYPOSITION|MF_STRING,20,"Field from image");
// InsertMenu(iSubMenu,0,MF_BYPOSITION|MF_SEPARATOR,0,"");
//end insert
//main_menu
InsertMenu(menu,0,MF_BYPOSITION|MF_STRING|MF_POPUP,hSubMenu,"File");
InsertMenu(menu,1,MF_BYPOSITION|MF_STRING|MF_POPUP,iSubMenu,"Insert");
InsertMenu(menu,2,MF_BYPOSITION|MF_STRING,40,"Run");
SetMenu(hWnd,menu);
//Change Window style to activate Maximize button
SetWindowLong(hWnd,GWL_STYLE,WS_SYSMENU+WS_CAPTION+WS_MAXIMIZEBOX);
ShowWindow(hWnd,SW_SHOWMAXIMIZED);
UpdateWindow(hWnd);
GetClientRect(hWnd,&recta);
video_set(recta.right-recta.left,recta.bottom-recta.top-sys_metrics(SM_CYCAPTION), 32,2);
SetForegroundWindow(hWnd);
}
long ScanMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
if(message == WM_MOVE)
{
GetWindowRect(hWnd,&recta);
SetWindowPos(headwindow,NULL,recta.right-180,recta.top+43,180-3,headwindow_size,NULL);
}
if(message == WM_COMMAND)
{
if(wParam == 19){sys_exit("");}
//run
if(wParam == 40)
{
if(!st_mode){HiliteMenuItem(hWnd,menu,40,MF_UNHILITE);}
else{HiliteMenuItem(hWnd,menu,40,MF_HILITE);}
}
}
}