static VOID CaptureMousePointer(HANDLE ConOutHandle, BOOLEAN Capture) { static BOOL IsClipped = FALSE; // For debugging purposes UNREFERENCED_PARAMETER(IsClipped); if (Capture) { RECT rcClip; // if (IsClipped) return; /* Be sure the cursor will be hidden */ while (ShowConsoleCursor(ConOutHandle, FALSE) >= 0) ; GetClientRect(hConsoleWnd, &rcClip); MapWindowPoints(hConsoleWnd, HWND_DESKTOP /*NULL*/, (LPPOINT)&rcClip, 2 /* Magic value when the LPPOINT parameter is a RECT */); IsClipped = ClipCursor(&rcClip); } else { // if (!IsClipped) return; ClipCursor(NULL); IsClipped = FALSE; /* Be sure the cursor will be shown */ while (ShowConsoleCursor(ConOutHandle, TRUE) < 0) ; } }
void CColorCfg::Configure() { FarMenu mnu( MColors ); mnu.AddItem( MCfg_clNormal )->SetData( iclNormal ); mnu.AddItem( MCfg_clBold )->SetData( iclBold ); mnu.AddItem( MCfg_clItalic )->SetData( iclItalic ); mnu.AddItem( MCfg_clUnderline )->SetData( iclUnderline ); mnu.AddItem( MCfg_clBoldItalic )->SetData( iclBoldItalic ); mnu.AddItem( MCfg_clBoldUnderline )->SetData( iclBoldUnderline ); mnu.AddItem( MCfg_clItalicUnderline )->SetData( iclItalicUnderline ); mnu.AddItem( MCfg_clBoldItalicUnderline )->SetData( iclBoldItalicUnderline ); mnu.AddItem( MCfg_clReverse )->SetData( iclReverse ); mnu.AddItem( MCfg_clReverseBold )->SetData( iclReverseBold ); mnu.AddItem( MCfg_clReverseItalic )->SetData( iclReverseItalic ); mnu.AddItem( MCfg_clReverseUnderline )->SetData( iclReverseUnderline ); mnu.AddItem( MCfg_clReverseBoldItalic )->SetData( iclReverseBoldItalic ); mnu.AddItem( MCfg_clReverseBoldUnderline )->SetData( iclReverseBoldUnderline ); mnu.AddItem( MCfg_clReverseItalicUnderline )->SetData( iclReverseItalicUnderline ); mnu.AddItem( MCfg_clReverseBoldItalicUnderline )->SetData( iclReverseBoldItalicUnderline ); mnu.AddSeparator(); mnu.AddItem( MCfg_clKludges )->SetDisabled(); mnu.AddItem( MCfg_clQuotesEven )->SetData( iclQuotesEven ); mnu.AddItem( MCfg_clQuotesOdd )->SetData( iclQuotesOdd ); mnu.AddItem( MCfg_clSignature )->SetData( iclSignature ); mnu.AddItem( MCfg_clOrigin )->SetData( iclOrigin ); mnu.AddItem( MCfg_clTearline )->SetData( iclTearline ); mnu.AddItem( MCfg_clTagline )->SetData( iclTagline ); mnu.AddItem( Mcfg_clHyperlink )->SetData( iclHyperlink ); mnu.AddSeparator( MCfg__Window ); mnu.AddItem( MCfg_clTitle )->SetData( iclBorderTitle ); mnu.AddItem( MCfg_clBorder )->SetData( iclBorder ); mnu.AddItem( MCfg_clHeaderLines )->SetData( iclHeaderLine ); mnu.AddItem( MCfg_clHeaderEdit )->SetData( iclHeaderEdit ); mnu.AddItem( MCfg_clHeaderEditSel )->SetData( iclHeaderEditSel ); mnu.AddItem( MCfg_clDateTime )->SetData( iclDateTime ); FarMenu::PItem Item; while ( ( Item = mnu.Show() ) != NULL ) { ShowConsoleCursor( TRUE ); int idx = Item->GetData(); CFarColorDialog dlg( m_Palette[ idx ] ); if ( dlg.Execute() ) m_Palette[ idx ] = dlg.GetColorValue(); mnu.SelectItem( Item ); } }
static VOID ShowHideMousePointer(HANDLE ConOutHandle, BOOLEAN ShowPtr) { WCHAR szMenuString[255] = L""; if (ShowPtr) { /* Be sure the cursor will be shown */ while (ShowConsoleCursor(ConOutHandle, TRUE) < 0) ; } else { /* Be sure the cursor will be hidden */ while (ShowConsoleCursor(ConOutHandle, FALSE) >= 0) ; } if (LoadStringW(GetModuleHandle(NULL), (!ShowPtr ? IDS_SHOW_MOUSE : IDS_HIDE_MOUSE), szMenuString, sizeof(szMenuString) / sizeof(szMenuString[0])) > 0) { ModifyMenu(hConsoleMenu, ID_SHOWHIDE_MOUSE, MF_BYCOMMAND, ID_SHOWHIDE_MOUSE, szMenuString); } }
int main() { group_is_off_no(); ShowConsoleCursor(NO); TextColor(240); system("cls"); TextColor(112); DrawBox0(0,1,80,23,177); TXTprintf("ASCS",19,6,121,05); TextColor(55); DrawBox0(19,16,44,5,32); LoadingAnimation(26,17,30,10,"Loading...",55); Sleep(100); TextColor(112); DrawBox0(14,16,44,5,177); main_menu(); return 0; }
void make_ls_schedule() { int ms,i; char file_name[20]=LS_SCHEDULE_FILE_NAME; ls_group grp; Time td,default_morning_start={1,0,0},default_night_start={14,0,0}; gotoxy(1,24); printf("Choose one option."); xnMenu mnu_mls; mnu_mls.lx=25; mnu_mls.ly=2;mnu_mls.width=25;mnu_mls.items=3; mnu_mls.now_pos=1; mnu_mls.last_pos=1; mnu_mls.item_char[1]="Time Duration."; mnu_mls.item_char[2]="One day time"; mnu_mls.item_char[3]="All week time"; print_xnMenu(mnu_mls); ms=handle_xnMenu(mnu_mls); switch(ms){ case 1: TextColor(112); system("cls"); DrawBox1(0,1,80,23,32); gotoxy(1,24); printf("This will make loadshedding schedule using default time."); gotoxy(1,3); printf("Enter Duration of loadshedding(hh/mm/ss):"); ShowConsoleCursor(YES); scanf("%d%d%d",&td.hour,&td.minute,&td.second); ShowConsoleCursor(NO); auto_schedule_make(file_name,td,default_morning_start,default_night_start); Sleep(200); gotoxy(1,24); printf("Schedule made successfuflly.. "); Sleep(1000); main_menu(); break; case 2: TextColor(112); system("cls"); DrawBox1(0,1,80,23,32); gotoxy(1,24); printf("This will make loadshedding schedule using time you provide."); gotoxy(1,3); printf("Enter Duration of loadshedding(hh/mm/ss):"); ShowConsoleCursor(YES); scanf("%d%d%d",&td.hour,&td.minute,&td.second); gotoxy(1,4); printf("Enter least morning time to start loadshedding:"); scanf("%d%d%d",&default_morning_start.hour,&default_morning_start.minute,&default_morning_start.second); gotoxy(1,5); printf("Enter least night time to start loadshedding:"); scanf("%d%d%d",&default_night_start.hour,&default_night_start.minute,&default_night_start.second); ShowConsoleCursor(NO); auto_schedule_make(file_name,td,default_morning_start,default_night_start); Sleep(200); gotoxy(1,24); printf("Schedule made successfuflly.. "); Sleep(1000); main_menu(); break; case 3: TextColor(112); system("cls"); gotoxy(1,24); printf("This will make loadshedding schedule using group-1 time."); for(i=1;i<=7;i++){ DrawBox1(0,1,80,23,32); gotoxy(1,3); ShowConsoleCursor(YES); printf("Enter loadshedding time morning of day %d(hh/mm/ss):",i); scanf("%d%d%d",&grp.day[i].morning[0].hour,&grp.day[i].morning[0].minute,&grp.day[i].morning[0].second); gotoxy(1,4); printf("to (hh/mm/ss):"); scanf("%d%d%d",&grp.day[i].morning[1].hour,&grp.day[i].morning[1].minute,&grp.day[i].morning[1].second); gotoxy(1,5); printf("Enter loadshedding time night of day %d(hh/mm/ss):",i); scanf("%d%d%d",&grp.day[i].night[0].hour,&grp.day[i].night[0].minute,&grp.day[i].night[0].second); gotoxy(1,6); printf("to (hh/mm/ss):"); scanf("%d%d%d",&grp.day[i].night[1].hour,&grp.day[i].night[1].minute,&grp.day[i].night[1].second); } auto_schedule_make_week_time(file_name,grp); Sleep(200); gotoxy(1,24); printf("Schedule made successfuflly.. "); Sleep(1000); main_menu(); break; default: main_menu(); break; } }
void main_menu() { char chs; TextColor(240); system("cls"); int menu_s; xnMenu main_xnMenu; ShowConsoleCursor(NO); TextColor(112); DrawBox0(0,1,80,23,177); TXTprintf("ASCS",19,6,121,0); DrawHorizontalLine2(19,16,42); gotoxy(27,16); printf("AutoShedding Control System."); gotoxy(3,0); cprintf("Main Menu",128); TextColor(240); gotoxy(1,0); printf("%c",240); gotoxy(1,24); printf("Select One Option."); TextColor(128); main_xnMenu.lx=2;main_xnMenu.ly=1,main_xnMenu.items=5;main_xnMenu.width=30;main_xnMenu.now_pos=1; main_xnMenu.item_char[1]="Make LS schedule"; main_xnMenu.item_char[2]="View LS schedule"; main_xnMenu.item_char[3]="Power Control"; main_xnMenu.item_char[4]="-"; main_xnMenu.item_char[5]="Exit"; GO_TOP while(!kbhit()){ TextColor(240); gotoxy(52,0); print_now_nepali_date(); gotoxy(71,24); print_now_nepali_time(); Sleep(10); } chs=getch(); if(chs=='m' || chs=='M' || chs==78){ print_xnMenu(main_xnMenu); menu_s=handle_xnMenu(main_xnMenu); switch(menu_s){ case 1: make_ls_schedule(); break; case 2: show_now_loadshedding(); main_menu(); break; case 3: power_control(); break; case 5: DrawBox2(0,20,80,4,32); gotoxy(2,21); printf("Are you sure to exit?(\"system may crash\")(y/n):"); if(getchar()=='y' || getchar()=='Y') exit(EXIT_SUCCESS); else main_menu(); break; default: main_menu(); break; } } else main_menu(); }