BOOL CreateMonitor() { WNDCLASS wc; HBRUSH bgBrush; char Text[80]; if (hMonitor) { ShowWindow(hMonitor, SW_SHOWNORMAL); SetForegroundWindow(hMonitor); return FALSE; // Alreaqy open } bgBrush = CreateSolidBrush(BGCOLOUR); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = MonWndProc; wc.cbClsExtra = 0; wc.cbWndExtra = DLGWINDOWEXTRA; wc.hInstance = hInst; wc.hIcon = LoadIcon( hInst, MAKEINTRESOURCE(BPQICON) ); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = bgBrush; wc.lpszMenuName = NULL; wc.lpszClassName = ClassName; RegisterClass(&wc); hMonitor=CreateDialog(hInst,ClassName,0,NULL); if (!hMonitor) return (FALSE); wsprintf(Text, "Chat %s Monitor", Session); SetWindowText(hMonitor, Text); readbuff = zalloc(1000); readbufflen = 1000; hMenu=GetMenu(hMonitor); CheckMenuItem(hMenu,MONBBS, MonBBS ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hMenu,MONCHAT, MonCHAT ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hMenu,MONTCP, MonTCP ? MF_CHECKED : MF_UNCHECKED); DrawMenuBar(hWnd); // Retrieve the handlse to the edit controls. hwndOutput = GetDlgItem(hMonitor, 121); // Set our own WndProcs for the controls. wpOrigOutputProc = (WNDPROC)SetWindowLong(hwndOutput, GWL_WNDPROC, (LONG)OutputProc); if (cfgMinToTray) { AddTrayMenuItem(hMonitor, Text); } ShowWindow(hMonitor, SW_SHOWNORMAL); if (MonitorRect.right < 100 || MonitorRect.bottom < 100) { GetWindowRect(hMonitor, &MonitorRect); } MoveWindow(hMonitor,MonitorRect.left,MonitorRect.top, MonitorRect.right-MonitorRect.left, MonitorRect.bottom-MonitorRect.top, TRUE); MoveWindows(); return TRUE; }
void InitTrayMenus(void) { TMenuParam tmp; OptParam op; //Tray menu memset(&tmp,0,sizeof(tmp)); tmp.cbSize=sizeof(tmp); tmp.CheckService=NULL; tmp.ExecService="CLISTMENUSTRAY/ExecService"; tmp.name="Tray Menu"; hTrayMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT,(WPARAM)0,(LPARAM)&tmp); CreateServiceFunction("CLISTMENUSTRAY/ExecService",TrayMenuExecService); CreateServiceFunction("CLISTMENUSTRAY/FreeOwnerDataTrayMenu",FreeOwnerDataTrayMenu); CreateServiceFunction("CLISTMENUSTRAY/TrayMenuonAddService",TrayMenuonAddService); CreateServiceFunction(MS_CLIST_ADDTRAYMENUITEM,AddTrayMenuItem); CreateServiceFunction(MS_CLIST_REMOVETRAYMENUITEM,RemoveTrayMenuItem); CreateServiceFunction(MS_CLIST_MENUBUILDTRAY,BuildTrayMenu); hPreBuildTrayMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDTRAYMENU); op.Handle=hTrayMenuObject; op.Setting=OPT_USERDEFINEDITEMS; op.Value=TRUE; CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); op.Handle=hTrayMenuObject; op.Setting=OPT_MENUOBJECT_SET_FREE_SERVICE; op.Value=(INT_PTR)"CLISTMENUSTRAY/FreeOwnerDataTrayMenu"; CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); op.Handle=hTrayMenuObject; op.Setting=OPT_MENUOBJECT_SET_ONADD_SERVICE; op.Value=(INT_PTR)"CLISTMENUSTRAY/TrayMenuonAddService"; CallService(MO_SETOPTIONSMENUOBJECT,(WPARAM)0,(LPARAM)&op); { //add exit command to menu CLISTMENUITEM mi; memset(&mi,0,sizeof(mi)); mi.cbSize=sizeof(mi); mi.position=900000; mi.pszService="CloseAction"; mi.pszName=LPGEN("E&xit"); AddTrayMenuItem((WPARAM)0,(LPARAM)&mi); memset(&mi,0,sizeof(mi)); mi.cbSize=sizeof(mi); mi.position=100000; mi.pszService=MS_CLIST_SHOWHIDE; mi.pszName=LPGEN("&Hide/Show"); hHideShowMainMenuItem=(HANDLE)AddTrayMenuItem((WPARAM)0,(LPARAM)&mi); memset(&mi,0,sizeof(mi)); mi.cbSize=sizeof(mi); mi.position=200000; mi.hIcon=LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_FINDUSER)); mi.pszService="FindAdd/FindAddCommand"; mi.pszName=LPGEN("&Find/Add Contacts..."); AddTrayMenuItem((WPARAM)0,(LPARAM)&mi); memset(&mi,0,sizeof(mi)); mi.cbSize=sizeof(mi); mi.position=300000; mi.pszService=""; mi.pszName=LPGEN("&Main Menu"); hTrayMainMenuItemProxy=(HANDLE)AddTrayMenuItem((WPARAM)0,(LPARAM)&mi); memset(&mi,0,sizeof(mi)); mi.cbSize=sizeof(mi); mi.position=300100; mi.pszService=""; mi.pszName=LPGEN("&Status"); hTrayStatusMenuItemProxy=(HANDLE)AddTrayMenuItem((WPARAM)0,(LPARAM)&mi); memset(&mi,0,sizeof(mi)); mi.cbSize=sizeof(mi); mi.position=400000; mi.hIcon=LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_OPTIONS)); mi.pszService="Options/OptionsCommand"; mi.pszName=LPGEN("&Options..."); AddTrayMenuItem((WPARAM)0,(LPARAM)&mi); memset(&mi,0,sizeof(mi)); mi.cbSize=sizeof(mi); mi.position=500000; mi.hIcon=LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_CLIENTMIRANDA)); mi.pszService="Help/AboutCommand"; mi.pszName=LPGEN("&About"); AddTrayMenuItem((WPARAM)0,(LPARAM)&mi); } }
BOOL CreateConsole(int Stream) { WNDCLASS wc; HBRUSH bgBrush; HMENU hMenu; struct ConsoleInfo * Cinfo = &CINFO; if (Cinfo->hConsole) { ShowWindow(Cinfo->hConsole, SW_SHOWNORMAL); SetForegroundWindow(Cinfo->hConsole); return FALSE; // Alreaqy open } Cinfo->BPQStream = Stream; /* Vallen=80; RegQueryValueEx(hKey,"ConsoleSize",0, (ULONG *)&Type,(UCHAR *)&Size,(ULONG *)&Vallen); Vallen=4; RegQueryValueEx(hKey,"Bells",0, (ULONG *)&Type,(UCHAR *)&Bells,(ULONG *)&Vallen); Vallen=4; RegQueryValueEx(hKey,"StripLF",0, (ULONG *)&Type,(UCHAR *)&StripLF,(ULONG *)&Vallen); Vallen=4; RegQueryValueEx(hKey,"CloseWindowOnBye",0, (ULONG *)&Type,(UCHAR *)&CloseWindowOnBye,(ULONG *)&Vallen); Vallen=4; RegQueryValueEx(hKey,"WarnWrap",0, (ULONG *)&Type,(UCHAR *)&WarnWrap,(ULONG *)&Vallen); Vallen=4; RegQueryValueEx(hKey,"WrapInput",0, (ULONG *)&Type,(UCHAR *)&WrapInput,(ULONG *)&Vallen); Vallen=4; RegQueryValueEx(hKey,"FlashOnConnect",0, (ULONG *)&Type,(UCHAR *)&FlashOnConnect,(ULONG *)&Vallen); */ bgBrush = CreateSolidBrush(BGCOLOUR); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = ConsWndProc; wc.cbClsExtra = 0; wc.cbWndExtra = DLGWINDOWEXTRA; wc.hInstance = hInst; wc.hIcon = LoadIcon( hInst, MAKEINTRESOURCE(IDI_BPQMailChat) ); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = bgBrush; wc.lpszMenuName = NULL; wc.lpszClassName = ClassName; RegisterClass(&wc); Cinfo->hConsole=CreateDialog(hInst,ClassName,0,NULL); if (!Cinfo->hConsole) return (FALSE); hMenu=GetMenu(Cinfo->hConsole); Cinfo->hMenu = hMenu; CheckMenuItem(hMenu,BPQBELLS, (Cinfo->Bells) ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hMenu,BPQStripLF, (Cinfo->StripLF) ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hMenu,IDM_WARNINPUT, (Cinfo->WarnWrap) ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hMenu,IDM_WRAPTEXT, (Cinfo->WrapInput) ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hMenu,IDM_Flash, (Cinfo->FlashOnConnect) ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hMenu,IDM_CLOSEWINDOW, (Cinfo->CloseWindowOnBye) ? MF_CHECKED : MF_UNCHECKED); DrawMenuBar(hWnd); // Retrieve the handlse to the edit controls. Cinfo->hwndInput = GetDlgItem(Cinfo->hConsole, 118); Cinfo->hwndOutput = GetDlgItem(Cinfo->hConsole, 117); // Set our own WndProcs for the controls. Cinfo->wpOrigInputProc = (WNDPROC) SetWindowLong(Cinfo->hwndInput, GWL_WNDPROC, (LONG) InputProc); Cinfo->wpOrigOutputProc = (WNDPROC)SetWindowLong(Cinfo->hwndOutput, GWL_WNDPROC, (LONG)OutputProc); if (cfgMinToTray) AddTrayMenuItem(Cinfo->hConsole, "Mail/Chat Console"); ShowWindow(Cinfo->hConsole, SW_SHOWNORMAL); if (Cinfo->ConsoleRect.right < 100 || Cinfo->ConsoleRect.bottom < 100) { GetWindowRect(Cinfo->hConsole, &Cinfo->ConsoleRect); } MoveWindow(Cinfo->hConsole,Cinfo->ConsoleRect.left,Cinfo->ConsoleRect.top, Cinfo->ConsoleRect.right-Cinfo->ConsoleRect.left, Cinfo->ConsoleRect.bottom-Cinfo->ConsoleRect.top, TRUE); MoveWindows(Cinfo); Cinfo->Console = zalloc(sizeof(CIRCUIT)); Cinfo->Console->Active = TRUE; Cinfo->Console->BPQStream = Stream; strcpy(Cinfo->Console->Callsign, SYSOPCall); user = LookupCall(SYSOPCall); if (user == NULL) { user = AllocateUserRecord(SYSOPCall); if (user == NULL) return 0; // Cant happen?? } time(&user->TimeLastCOnnected); Cinfo->Console->UserPointer = user; Cinfo->Console->lastmsg = user->lastmsg; Cinfo->Console->paclen=236; Cinfo->Console->sysop = TRUE; Cinfo->Console->PageLen = user->PageLen; Cinfo->Console->Paging = (user->PageLen > 0); nodeprintf(Cinfo->Console, BBSSID, Ver[0], Ver[1], Ver[2], Ver[3], ALLOWCOMPRESSED ? "B" : "", "", "", "F"); if (user->Name[0] == 0) { Cinfo->Console->Flags |= GETTINGUSER; SendUnbuffered(-1, NewUserPrompt, strlen(NewUserPrompt)); } else SendWelcomeMsg(-1, Cinfo->Console, user); return TRUE; }