nsresult os2FrameWindow::SetTitle(const nsAString& aTitle) { PRUnichar* uchtemp = ToNewUnicode(aTitle); for (uint32_t i = 0; i < aTitle.Length(); i++) { switch (uchtemp[i]) { case 0x2018: case 0x2019: uchtemp[i] = 0x0027; break; case 0x201C: case 0x201D: uchtemp[i] = 0x0022; break; case 0x2014: uchtemp[i] = 0x002D; break; } } nsAutoCharBuffer title; int32_t titleLength; WideCharToMultiByte(0, uchtemp, aTitle.Length(), title, titleLength); if (titleLength > MAX_TITLEBAR_LENGTH) { title[MAX_TITLEBAR_LENGTH] = '\0'; } WinSetWindowText(mFrameWnd, title.Elements()); // If the chrome is hidden, set the text of the titlebar directly if (mChromeHidden) { WinSetWindowText(mTitleBar, title.Elements()); } nsMemory::Free(uchtemp); return NS_OK; }
VOID Mouse_Focus_CreatePage( VOID ) { // Указатель на страницу. PPAGE Page = Enhancer.Pages.Mouse_focus; // Создаем страницу. CHAR Page_class_name[] = "Mouse_Focus_WndClass"; WinRegisterClass( Enhancer.Application, Page_class_name, (PFNWP) Mouse_Focus_WndProc, 0, 0 ); Page->Window = WinCreateWindow( Enhancer.Client_window, Page_class_name, NULL, 0, 0, 0, 0, 0, NULLHANDLE, HWND_TOP, 0, NULL, NULL ); // Задаем шрифт. SetCommonEnhancerFont( Page->Window ); // Узнаем страну, в которой работает приложение. LONG Code_page = Enhancer.Code_page; // Создаем поля ввода. LitCreateLayout( &Page->Layout, Page->Window ); CreateCtlButtons( Page ); { for( INT Count = 0; Count < 5; Count ++ ) { LTBRICK Space_brick; LitPrepareBrick( &Space_brick ); Space_brick.hwnd = WinCreateWindow( Page->Window, WC_STATIC, NULL, SS_TEXT, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, 0, NULL, NULL ); Space_brick.prpWidthInParent = LTM_FULL_WIDTH; Space_brick.prpHeightInParent = EMPTY_LINE_HEIGHT; LitJoinBrick( &( Page->Layout ), &Space_brick ); LitCompleteRow( &( Page->Layout ) ); } } { LTBRICK Checkbox_brick; LitPrepareBrick( &Checkbox_brick ); Checkbox_brick.hwnd = WinCreateWindow( Page->Window, WC_BUTTON, NULL, BS_CHECKBOX, LTM_X, LTM_Y, LTM_CX, LTM_CY, Page->Window, HWND_TOP, Mouse_Focus.Settings.Scrolling_ID, NULL, NULL ); Checkbox_brick.prpWidthInParent = LTM_COMMON_WIDTH; Checkbox_brick.prpHeightInParent = LTM_COMMON_HEIGHT; SetCommonEnhancerColors( Checkbox_brick.hwnd ); if( Code_page == RUSSIAN ) WinSetWindowText( Checkbox_brick.hwnd, StrConst_RU_Pages_Mouse_focus_Scrolling ); else WinSetWindowText( Checkbox_brick.hwnd, StrConst_EN_Pages_Mouse_focus_Scrolling ); LitJoinBrick( &( Page->Layout ), &Checkbox_brick ); LitCompleteRow( &( Page->Layout ) ); } if( Code_page == RUSSIAN ) CreatePromptText( Page, StrConst_RU_Pages_Mouse_focus_Prompt ); else CreatePromptText( Page, StrConst_EN_Pages_Mouse_focus_Prompt ); CompleteCreation( Page ); // Возврат. return; }
MRESULT EXPENTRY PrefGeneralDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { ULONG h, m, s; switch (msg) { case WM_INITDLG: WinSendDlgItemMsg(hwnd, DID_COMMENT_STRN, EM_SETTEXTLIMIT, MPFROMSHORT(COMMENT_MAXLEN), NULL); WinSendDlgItemMsg(hwnd, DID_SEND_KEYSRV_STRN, EM_SETTEXTLIMIT, MPFROMSHORT(CCHMAXPATH), NULL); WinSendDlgItemMsg(hwnd, DID_EDITOR_STRN, EM_SETTEXTLIMIT, MPFROMSHORT(CCHMAXPATH), NULL); WinSendDlgItemMsg(hwnd, DID_CACHE_SPIN_HOUR, SPBM_SETLIMITS, (MPARAM) 100, (MPARAM) 0); WinSendDlgItemMsg(hwnd, DID_CACHE_SPIN_MIN, SPBM_SETLIMITS, (MPARAM) 59, (MPARAM) 0); WinSendDlgItemMsg(hwnd, DID_CACHE_SPIN_SEC, SPBM_SETLIMITS, (MPARAM) 59, (MPARAM) 0); h = ProfileData.Flags.CacheTime / 3600; m = (ProfileData.Flags.CacheTime % 3600) / 60; s = (ProfileData.Flags.CacheTime % 3600) % 60; WinSendDlgItemMsg(hwnd, DID_CACHE_SPIN_HOUR, SPBM_SPINUP, (MPARAM) h, NULL); WinSendDlgItemMsg(hwnd, DID_CACHE_SPIN_MIN, SPBM_SPINUP, (MPARAM) m, NULL); WinSendDlgItemMsg(hwnd, DID_CACHE_SPIN_SEC, SPBM_SPINUP, (MPARAM) s, NULL); WinSetWindowText(WinWindowFromID(hwnd, DID_COMMENT_STRN), TempData.ASCIIComment); WinSetWindowText(WinWindowFromID(hwnd, DID_SEND_KEYSRV_STRN), TempData.SendKeyServer); WinSetWindowText(WinWindowFromID(hwnd, DID_EDITOR_STRN), TempData.EditorFile); WinCheckButton(hwnd, DID_ENCRYPT_TO_SELF, TempData.Flags.PgpEncryptToSelf); WinCheckButton(hwnd, DID_ALWAYS_ON_TOP, TempData.Flags.AlwaysOnTop); WinCheckButton(hwnd, DID_SHOW_HINT_WINDOW, !TempData.Flags.SuppressHint); WinCheckButton(hwnd, DID_SMALL_ICONS, TempData.Flags.SmallIcons); if (!PGPKeysToolExists) { WinEnableWindow(WinWindowFromID(hwnd, DID_SEND_KEYSRV_GRP), FALSE); WinEnableWindow(WinWindowFromID(hwnd, DID_SEND_KEYSRV_STRN), FALSE); } break; default: return WinDefDlgProc (hwnd, msg, mp1, mp2); } return (MRESULT)FALSE; }
/**************************************************************************** * SetText * * - Used by KeyDlgProc to set the text in control windows * * in those dialog boxes. * ****************************************************************************/ VOID SetText(HWND hwnd, INT id, KEY *key) { CHAR tmp[2]; if (key->vk) WinSetWindowText(WinWindowFromID(hwnd, id), VKEY[key->vk].name); else if (key->chr) { tmp[0] = key->chr;tmp[1] = 0; WinSetWindowText(WinWindowFromID(hwnd, id), tmp); } else WinSetWindowText(WinWindowFromID(hwnd, id), "???"); }
/********************************************************************** * Function: PrefSetStrings * Info : (Re)Set strings preferences from profile structure * Result : **********************************************************************/ static void PrefSetStrings(HWND hwnd, PRFDATA *pTempData) { HWND hwndText; /* Set text entries and entry maxlen */ hwndText = WinWindowFromID(hwnd, DID_PUBLIC_FILE_STRN); WinSetWindowText(hwndText, pTempData->PublicKeyFile); hwndText = WinWindowFromID(hwnd, DID_PRIVATE_FILE_STRN); WinSetWindowText(hwndText, pTempData->PrivateKeyFile); hwndText = WinWindowFromID(hwnd, DID_RANDOM_FILE_STRN); WinSetWindowText(hwndText, pTempData->RandomSeedFile); }
void SetWindowTitle( HWND hwndWnd ) { CHAR szWinTitle[MAX_STRING_BYTES]; CHAR szUntitled[MAX_STRING_BYTES]; /* * Use the application title as the first part of the window title */ strncpy( szWinTitle, szAppName, MAX_STRING_BYTES ); /* * If there is an allocated data buffer, concatenate a dash ( '-' ) and * either the name of the file or the string "(untitled)" to the window * title string. */ if ( pbFileBuffer != NULL ) { strncat( szWinTitle, " - ", MAX_STRING_BYTES ); if ( *szFileName == '\0' ) { WinLoadString( habAnchor, NULLHANDLE, IDS_UNTITLED, sizeof( szUntitled ), szUntitled ); strncat( szWinTitle, szUntitled, MAX_STRING_BYTES ); } else { strncat( szWinTitle, szFileName, MAX_STRING_BYTES ); } } WinSetWindowText( WinQueryWindow( hwndWnd, QW_PARENT), szWinTitle ); }
static void internal_SetPwdProtWindowText(HWND hwnd) { char *pchTemp; // Set new window texts! if (DosRequestMutexSem(hmtxUseNLSTextArray, SEM_INDEFINITE_WAIT)==NO_ERROR) { pchTemp = apchNLSText[SSMODULE_NLSTEXT_PWDPROT_ASK_TITLE]; if (pchTemp) WinSetWindowText(hwnd, pchTemp); pchTemp = apchNLSText[SSMODULE_NLSTEXT_PWDPROT_ASK_TEXT]; if (pchTemp) WinSetDlgItemText(hwnd, ST_PLEASEENTERTHEPASSWORD, pchTemp); pchTemp = apchNLSText[SSMODULE_NLSTEXT_PWDPROT_ASK_OKBUTTON]; if (pchTemp) WinSetDlgItemText(hwnd, PB_OK, pchTemp); pchTemp = apchNLSText[SSMODULE_NLSTEXT_PWDPROT_ASK_CANCELBUTTON]; if (pchTemp) WinSetDlgItemText(hwnd, PB_CANCEL, pchTemp); DosReleaseMutexSem(hmtxUseNLSTextArray); } }
void ProcessHexCommand(SHORT comm) { double temp; if (bShiftMode) { bShiftMode = FALSE; WinSetWindowText(hwndSmode, ""); EntryToStackHex(); bLift = TRUE; switch (comm ) { case K_BS: /* CLx */ if (bError) { UpdateDisplay(stack[0]); } else { UpdateDisplay(0.0); bLift = FALSE; } /* endif */ break; case K_DOT: /* lastx */ LiftStack(); UpdateDisplay(lastx); break; default: } } else {
void AddToPlaylist(HWND hWnd, PSZ pszFilespec) { HDIR hFind = HDIR_SYSTEM; FILEFINDBUF3 FindBuffer = {0}; ULONG ulResultBufLen = sizeof(FILEFINDBUF3); ULONG ulFindCount = 1; APIRET rc = NO_ERROR; ULONG flAtttribute = FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN | FILE_READONLY; PSZ pszFilepath = new char[CCHMAXPATH]; PSZ pTemp = NULL; MakePathFromFilepath(pszFilepath, pszFilespec); pTemp = pszFilepath + strlen(pszFilepath); rc = DosFindFirst(pszFilespec, &hFind, flAtttribute, &FindBuffer, ulResultBufLen, &ulFindCount, FIL_STANDARD); while(rc == NO_ERROR) { strcpy(pTemp, FindBuffer.achName); if(IsValidFile(pszFilepath)) { plAddEntry(hWnd, pszFilepath); WinSetWindowText(WinQueryWindow(hWnd, QW_PARENT), pTemp); } ulFindCount = 1; rc = DosFindNext(hFind, &FindBuffer, ulResultBufLen, &ulFindCount); } DosFindClose(hFind); delete pszFilepath; }
static void NewFilter(HWND hwnd) { const HWND ebox = WinWindowFromID(hwnd, DID_FFILTER_CB); const HWND name = WinWindowFromID(hwnd, DID_FILENAME_ED); // // Get new selection // const int item = WinQueryLboxSelectedItem(ebox); const int len = WinQueryLboxItemTextLength(ebox, item) + 1; // // set corresponding text in entry field // char *txt = malloc(len); WinQueryLboxItemText(ebox, item, txt, len); WinSetWindowText(name, strrchr(txt, '>') + 2); lib_free(txt); // // set focus to entry field and simulate an Apply // WinSetFocus(HWND_DESKTOP, name); WinDefFileDlgProc(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPFROM2SHORT(CMDSRC_PUSHBUTTON, TRUE)); }
extern MRESULT EXPENTRY ShrInstallDlgProc (HWND hwndDlg, ULONG msg, MPARAM mp1, MPARAM mp2) { MRESULT mr = NULL; CHAR szDLL[CCHMAXPATH]; CHAR szText[256]; PSZ psz; HWND hwndEntryField; switch (msg) { case WM_INITDLG: hwndEntryField = WinWindowFromID(hwndDlg, ID_PATH); WinSetWindowText(hwndEntryField, (PSZ) mp2); mr = (MRESULT) WinSetFocus(HWND_DESKTOP, hwndEntryField); break; case WM_CLOSE: WinDismissDlg(hwndDlg, MBID_CANCEL); break; case WM_COMMAND: if (SHORT1FROMMP(mp1) == MBID_OK) { WinQueryDlgItemText(hwndDlg, ID_PATH, sizeof(szDLL), szDLL); if (strlen(szDLL) >= 2) { psz = strchr(szDLL, '\0') - 1; if (*psz == '\\') strcat(szDLL, "SHARE.DLL"); else strcat(szDLL, "\\SHARE.DLL"); strupr(szDLL); if (ShrInstall(szDLL)) WinDismissDlg(hwndDlg, MBID_OK); } else { sprintf(szText, "The path must include the drive letter." " For example, %s. Please try again.", vszSysDLLPath); WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, szText, vszMessageTitle, 0, MB_ENTER | MB_MOVEABLE | MB_WARNING); } } else if (SHORT1FROMMP(mp1) == MBID_CANCEL) { WinDismissDlg(hwndDlg, MBID_CANCEL); } break; default: mr = WinDefDlgProc(hwndDlg, msg, mp1, mp2); break; } return mr; }
// Message - сообщение. VOID Log_PrintLogMessage( PCHAR Message ) { // Отводим память для текста. PCHAR Window_text = NULL; INT Length = 65536; if( DosAllocMem( (PPVOID) &Window_text, Length, PAG_ALLOCATE ) != NO_ERROR ) return; // Узнаем текст в поле ввода. HWND Field = Log_LogWindow(); WinQueryWindowText( Field, Length, Window_text ); // Добавляем сообщение в поле ввода. strcat( Window_text, Message ); strcat( Window_text, "\n" ); WinEnableWindowUpdate( Field, 0 ); WinSetWindowText( Field, Window_text ); WinEnableWindowUpdate( Field, 1 ); // Освобождаем память. DosFreeMem( Window_text ); Window_text = NULL; // Запоминаем, что поле ввода изменено. Log.RTSettings.Field_is_changed = 1; // Возврат. return; }
static void setFormat(HWND hwndDlg) { HWND hwnd = WinWindowFromID(hwndDlg, IDD_OPT_FORMAT) ; FMTPTR p ; for (p = tabFormat ; p->str != NULL ; p++) { WinSendMsg(hwnd, LM_INSERTITEM, MPFROM2SHORT(LIT_END, 0), MPFROMP(p->str)) ; } for (p = tabFormat ; p->str != NULL ; p++) { if (p->fmt == SessPixelFormat) { WinSetWindowText(hwnd, p->str) ; return ; } } WinSetWindowText(hwnd, tabFormat[0].str) ; }
static void setEncode(HWND hwndDlg) { HWND hwnd = WinWindowFromID(hwndDlg, IDD_OPT_ENCODE) ; ENCPTR p ; for (p = tabEncode ; p->str != NULL ; p++) { WinSendMsg(hwnd, LM_INSERTITEM, MPFROM2SHORT(LIT_END, 0), MPFROMP(p->str)) ; } for (p = tabEncode ; p->str != NULL ; p++) { if (p->enc == SessPreferredEncoding) { WinSetWindowText(hwnd, p->str) ; return ; } } WinSetWindowText(hwnd, tabEncode[0].str) ; }
ULONG HEFind(HWND hwnd) { static char findStr[ 256 ] = { 0, }; static char replaceStr[ 256 ] = { 0, }; ULONG ulrc; HWND hwndDlg; HWND hwndFind; HWND hwndReplace; //char str[255]; //int hanmode,kbdtype; hwndDlg = WinLoadDlg(HWND_DESKTOP,hwnd,&HEFindDlgProc,NULLHANDLE,IDD_FIND,NULL); hwndFind = WinWindowFromID( hwndDlg, IDHEF_FIND ); hwndReplace = WinWindowFromID( hwndDlg, IDHEF_REPLACE ); WinSetWindowText( hwndFind, findStr ); // WinSendMsg( hwndFind, HEM_SETSEL, MPFROM2SHORT( 0, strlen( findStr )), 0 ); // WinSendMsg( hwndFind, HEM_REFRESH, 0, 0 ); WinSetWindowText( hwndReplace, replaceStr ); // WinSendMsg( hwndReplace, HEM_SETSEL, // MPFROM2SHORT( strlen( replaceStr ), strlen( replaceStr )), 0 ); // WinSendMsg( hwndReplace, HEM_REFRESH, 0, 0 ); WinSetFocus(HWND_DESKTOP,WinWindowFromID(hwndDlg, DID_OK )); ulrc = WinProcessDlg(hwndDlg); // if (ulrc == DID_OK) // { // } WinQueryWindowText( hwndFind, sizeof( findStr ), findStr ); WinQueryWindowText( hwndReplace, sizeof( replaceStr ), replaceStr ); WinDestroyWindow(hwndDlg); // hanmode = (int)WinSendMsg(hwndHMLE,HMLM_QUERYHANINPUTMODE,0,0); // kbdtype = (int)WinSendMsg(hwndHMLE,HMLM_QUERYKBDTYPE,0,0); // WinPostMsg(hwndStatbar,STATBAR_USERM_SETHANMODE,MPFROMLONG(hanmode),0L); // WinPostMsg(hwndStatbar,STATBAR_USERM_SETKBDTYPE,MPFROMLONG(kbdtype),0L); WinSetFocus(HWND_DESKTOP,hwndHMLE); return 0L; }
static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, MPARAM mParam) { CPlugin * pPlugin = (CPlugin *)mParam; WinSetWindowPtr(hWnd, QWL_USER, (PVOID)pPlugin); int iTopMargin = 188; WinSetWindowPos(hWnd, NULL, 0, iTopMargin, 0, 0, SWP_SHOW ); WinSetWindowText(WinWindowFromID(hWnd, IDC_EDIT_SCRIPT_FILE_NAME), pPlugin->m_Pref_szScriptFile); WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_REPETITIONS_LEFT), ""); WinShowWindow(WinWindowFromID(hWnd, IDC_STATIC_REPETITIONS_LABEL), FALSE); WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_GO), TRUE); WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_STOP), FALSE); return TRUE; }
/****************************************************************\ * Initialization routine *-------------------------------------------------------------- * * Name: Init() * * Purpose: Performs initialization functions. * * Usage: Called once before the message queue is queried. * * Method: * - starts processing thread * - registers all window classes * * Returns: * TRUE - initialization is successful * FALSE - initialization failed \****************************************************************/ BOOL Init(int argc, char *argv[]) { PTIB ptibDummy; PIB *ppibProcess; ULONG flCtlData; /* frame control data */ /* load application name from resource file */ if(!WinLoadString(hab, NULLHANDLE, IDS_APPNAME, MAXNAMEL, (PSZ)szAppName)) return FALSE; /* register the main client window class */ if(!WinRegisterClass(hab, (PSZ)szAppName, MainWndProc, CS_SIZEREDRAW | CS_CLIPCHILDREN, 0UL)) { return FALSE; } flCtlData = FCF_STANDARD | FCF_VERTSCROLL | FCF_HORZSCROLL; hwndMainFrame = WinCreateStdWindow(HWND_DESKTOP, WS_VISIBLE, &flCtlData, (PSZ)szAppName, (PSZ)NULL, WS_VISIBLE, NULLHANDLE, IDR_MAIN, &hwndMain); if (NULLHANDLE == hwndMainFrame) return FALSE; WinSetWindowText(hwndMainFrame, (PSZ)szAppName); if (DosGetInfoBlocks(&ptibDummy, &ppibProcess) || !(hqQ = InitQ((*ppibProcess).pib_ulpid, /* process that will send WM_CLOSE command */ hwndMainFrame))) /* window to post to */ return FALSE; if (argc > 1) { RESULTCODES resc; CHAR pszBuff[CCHMAXPATH]; if ((BOOL)DosExecPgm((PSZ)pszBuff, CCHMAXPATH, EXEC_ASYNC, NULL, NULL, &resc, argv[1])) { MessageBox(hwndMain, IDMSG_CANNOT_EXEC_CLIENT, MB_CUAWARNING | MB_OK, TRUE); } } InitHelp(); return TRUE; } /* Init() */
HWND bookSetup( ULONG idInitialPage ) { HWND hwndFrame; if( hwndBook ) { hwndFrame = PARENT( hwndBook ); // For some reason it is necessary to restore the notebook before // setting the frame as the active window if the frame is being // restored from a minimized state. WinSetWindowPos( hwndBook, NULLHANDLE, 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE ); WinSetWindowPos( hwndFrame, NULLHANDLE, 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE | SWP_ACTIVATE ); } else { FRAMECDATA fcdata; memset( &fcdata, 0, sizeof fcdata ); fcdata.cb = sizeof( FRAMECDATA ); fcdata.flCreateFlags = FRAME_FLAGS; fcdata.idResources = ID_NBFRAME; hwndFrame = WinCreateWindow( HWND_DESKTOP, WC_FRAME, NULL, WS_ANIMATE, 0, 0, 0, 0, NULLHANDLE, HWND_TOP, ID_NBFRAME, &fcdata, NULL ); if( hwndFrame ) { pfnwpFrame = WinSubclassWindow( hwndFrame, wpNBFrame ); if( pfnwpFrame ) if( CreateNotebookWindow( hwndFrame ) ) WinSetWindowText( hwndFrame, BOOK_TITLE ); else { WinDestroyWindow( hwndFrame ); hwndFrame = NULLHANDLE; } else { WinDestroyWindow( hwndFrame ); Msg( "bookSetup WinSubclassWindow RC(%X)", HWNDERR(hwndFrame) ); hwndFrame = NULLHANDLE; } } else Msg( "bookSetup WinCreateWindow of frame window RC(%X)", HABERR(0)); } if( hwndBook ) TurnToPage( idInitialPage ); return hwndFrame; }
MRESULT clbCommand(PCLBOX pclb, ULONG id) { HWND hOwner = WinQueryWindow(pclb->hwnd, QW_OWNER); SHORT i = 0; PSZ psz; switch (id) { case FID_ADD: // alloca buffer per testo entryfield if (!(psz = (PSZ)malloc(pclb->cchef + 1))) break; WinQueryWindowText(pclb->hentry, pclb->cchef + 1, psz); if (!WinSendMsg(hOwner, WM_CONTROL, MPFROM2SHORT(pclb->id, CLBXN_ADD), (MPARAM)psz)) { SHORT ins; // controlla che la stringa non sia gi… presente if (pclb->fl & CLBXS_NODUP && LIT_NONE != (SHORT)pclb->pflbx(pclb->hlbx, LM_SEARCHSTRING, MPFROM2SHORT(0, LIT_FIRST), (MPARAM)psz)) { free(psz); break; } // end if // se stile lo richiede converte stringa in uppercase if (pclb->fl & CLBXS_INSUPPER) WinUpper(pclb->hab, 0, 0, psz); // setta flag inserzione secondo stile if (pclb->fl & CLBXS_INSSORTUP) i = LIT_SORTASCENDING; else if (pclb->fl & CLBXS_INSSORTDN) i = LIT_SORTDESCENDING; else if (pclb->fl & CLBXS_INSEND) i = LIT_END; ins = (SHORT)pclb->pflbx(pclb->hlbx, LM_INSERTITEM, (MPARAM)i, (MPARAM)psz); WinSetWindowText(pclb->hentry, ""); WinSendMsg(hOwner, WM_CONTROL, MPFROM2SHORT(pclb->id, CLBXN_ADDED), (MPARAM)ins); } // end if free(psz); break; case FID_REMOVE: i = (SHORT)pclb->pflbx(pclb->hlbx, LM_QUERYSELECTION, (MPARAM)LIT_FIRST, MPVOID); if (!WinSendMsg(hOwner, WM_CONTROL, MPFROM2SHORT(pclb->id, CLBXN_REM), (MPARAM)i)) { while (i >= 0) { pclb->pflbx(pclb->hlbx, LM_DELETEITEM, (MPARAM)i, MPVOID); i = (SHORT)pclb->pflbx(pclb->hlbx, LM_QUERYSELECTION, (MPARAM)LIT_FIRST, MPVOID); } /* end while */ } /* end if */ pclb->is.remon = 0; WinEnableWindow(pclb->hrem, FALSE); break; case FID_FIND: WinSendMsg(hOwner, WM_CONTROL, MPFROM2SHORT(pclb->id, CLBXN_FIND), (MPARAM)pclb->hwnd); break; } /* endswitch */ return (MRESULT)FALSE; }
/* ** dialog to set read/write timeouts */ MRESULT EXPENTRY fnwpHdwTimeoutDlg(HWND hwnd,USHORT msg,MPARAM mp1,MPARAM mp2) { static DCB stComDCB; static bAllowClick; static COMCTL *pstComCtl; switch (msg) { case WM_INITDLG: // CenterDlgBox(hwnd); // WinSetFocus(HWND_DESKTOP,hwnd); bAllowClick = FALSE; pstComCtl = PVOIDFROMMP(mp2); if (GetDCB(pstComCtl->pstIOctl,pstComCtl->hCom,&stComDCB)) { WinDismissDlg(hwnd,FALSE); return(FALSE); } if (pstComCtl->pszPortName != NULL) WinSetWindowText(hwnd,pstComCtl->pszPortName); WinPostMsg(hwnd,UM_INITLS,(MPARAM)0L,(MPARAM)0L); break; case UM_INITLS: FillHdwTimeoutDlg(hwnd,&stComDCB); bAllowClick = TRUE; break; case WM_CONTROL: if (SHORT2FROMMP(mp1) == BN_CLICKED) if (bAllowClick) if (!TCHdwTimeoutDlg(hwnd,SHORT1FROMMP(mp1))) return(FALSE); break; case WM_COMMAND: switch(SHORT1FROMMP(mp1)) { case DID_OK: UnloadHdwTimeoutDlg(hwnd,&stComDCB); SendDCB(pstComCtl->pstIOctl,pstComCtl->hCom,&stComDCB); WinDismissDlg(hwnd,TRUE); break; case DID_CANCEL: WinDismissDlg(hwnd,FALSE); break; case DID_HELP: DisplayHelpPanel(pstComCtl); break; default: return WinDefDlgProc(hwnd,msg,mp1,mp2); } break; default: return(WinDefDlgProc(hwnd,msg,mp1,mp2)); } return FALSE; }
BOOL mwpLoad(HWND hWnd) { ULONG ulError = 0; MCI_LOAD_PARMS mciLoadParms; PSTRINGLIST pEntry = (PSTRINGLIST)WinQueryWindowPtr(hWnd, QWP_CURRENTENTRY); USHORT usDeviceID = WinQueryWindowUShort(hWnd, QWS_DEVICEID); BOOL fSuccess = TRUE; WinSetPBValue(WinWindowFromID(hWnd, PB_PROGRESS), 0); memset((void*)&mciLoadParms, 0, sizeof(MCI_LOAD_PARMS)); mciLoadParms.pszElementName = pEntry->pszString; ulError = mciSendCommand(usDeviceID, MCI_LOAD, MCI_WAIT | MCI_OPEN_ELEMENT | MCI_READONLY, (PVOID)&mciLoadParms, (USHORT)0); if(LOUSHORT(ulError) != MCIERR_SUCCESS) fSuccess = FALSE; if(fSuccess) { MCI_STATUS_PARMS msp; memset((void*)&msp, 0, sizeof(msp)); msp.ulItem = MCI_STATUS_LENGTH; ulError = mciSendCommand(usDeviceID, MCI_STATUS, MCI_WAIT | MCI_STATUS_ITEM, (PVOID)&msp, (USHORT)0); if(LOUSHORT(ulError) == MCIERR_SUCCESS) { WinSetPBLimits(WinWindowFromID(hWnd, PB_PROGRESS), 0, msp.ulReturn); } } if(fSuccess) { MCI_POSITION_PARMS mppPos; memset((void*)&mppPos, 0, sizeof(mppPos)); mppPos.hwndCallback = hWnd; mppPos.ulUnits = MSECTOMM(500); ulError = mciSendCommand(usDeviceID, MCI_SET_POSITION_ADVISE, MCI_NOTIFY | MCI_SET_POSITION_ADVISE_ON, (PVOID)&mppPos, (USHORT)0); if(LOUSHORT(ulError) != MCIERR_SUCCESS) fSuccess = FALSE; } if(fSuccess) { PSZ pszTitle = new char[128]; MakeWndTitleFromPathName(pszTitle, pEntry->pszString); WinSetWindowText(WinQueryWindow(hWnd, QW_PARENT), pszTitle); delete pszTitle; } return fSuccess; }
/************************************************************************* * Name : InitializeDialog * * Description : This function performs the necessary initializations and * setups that are required to show/run a dialog box as a * main window. The message queue will be created, as will * the dialog box. * * Concepts : Secondary Windows is used to create and show a dialog box. * A system clock is displayed till the application is loaded. * * MMPM/2 API's : WinLoadSecondaryWindow * WinQuerySecondaryHWND * * Parameters : None. * * Return : None. * *************************************************************************/ void InitializeDialog() { CHAR achTitle[STRING_SIZE] = ""; CHAR achDefaultSize[STRING_SIZE] = ""; /* Initialize the Dialog window */ hab = WinInitialize(0); /* create a message queue for the window */ hmq = WinCreateMsgQueue(hab,0); /* Load the Dialog - This will return the Handle to the Frame */ hwndFrame = WinLoadSecondaryWindow(HWND_DESKTOP ,HWND_DESKTOP ,(PFNWP)MainDialogProc ,(HMODULE)NULL ,ID_SAMPLE ,(PVOID)NULL); /* * By specifying the QS_DIALOG flag we will get the handle to the Dialog of * the frame */ hwndDiag = WinQuerySecondaryHWND(hwndFrame,QS_DIALOG); /* Get the string for default size */ WinLoadString( hab, (HMODULE) NULL, IDS_DEFAULT_SIZE, (SHORT) sizeof( achDefaultSize), achDefaultSize); /* Add Default Size menu item to system menu of the secondary window. */ WinInsertDefaultSize(hwndFrame, achDefaultSize); /* * Get the window title string from the Resource string table * and set it as the window text for the dialog window. */ WinLoadString( hab, (HMODULE) NULL, IDS_MAIN_WINDOW_TITLE, (SHORT) sizeof( achTitle), achTitle); /* Set the Title of the Dialog */ WinSetWindowText( hwndFrame, achTitle); }
BOOL OpenThemeInfo(HWND hwnd, char szFilename[]) { PLUGIN_LIST List; char szError[128]; int i; if (!getThemeInfo(szFilename, &List, szError)) { PSUTErrorFunc(NULLHANDLE, "Error", "OpenThemeInfo", szError, 0UL); return FALSE; } //search the list of Attributes for the "Name" attribute. for (i = 0; i < List.pPluginAttributes[0].cbAttributes; i++) { if (strcmp(List.pPluginAttributes[0].keyValue[i].key, "Name") == 0) { WinSendMsg(WinWindowFromID(hwnd, EFID_THEMENAME), EM_SETTEXTLIMIT, (MPARAM) CCHMAXPATH, (MPARAM) 0); WinSetWindowText(WinWindowFromID(hwnd, EFID_THEMENAME), List.pPluginAttributes[0].keyValue[i].value); continue; } if (strcmp(List.pPluginAttributes[0].keyValue[i].key, "Author") == 0) { WinSendMsg(WinWindowFromID(hwnd, EFID_THEMEAUTHOR), EM_SETTEXTLIMIT, (MPARAM) CCHMAXPATH, (MPARAM) 0); WinSetWindowText(WinWindowFromID(hwnd, EFID_THEMEAUTHOR), List.pPluginAttributes[0].keyValue[i].value); continue; } if (strcmp(List.pPluginAttributes[0].keyValue[i].key, "Version") == 0) { WinSetWindowText(WinWindowFromID(hwnd, EFID_THEMEVERSION), List.pPluginAttributes[0].keyValue[i].value); continue; } } CBZFreePLUGIN_LIST(&List); return TRUE; }
MRESULT EXPENTRY FileDialogProc( HWND hwndDlg, ULONG msg, MPARAM mp1, MPARAM mp2) { MRESULT mr; PFILEDLG pfiledlg; HWND hwndTypeCombo; INT i; SWP swp; PMYDATA pmydata; switch ( msg ) { case WM_INITDLG: /* Create another dropdown that we manage */ mr = WinDefFileDlgProc(hwndDlg, msg, mp1, mp2); hwndTypeCombo = WinWindowFromID(hwndDlg, DID_FILTER_CB); WinQueryWindowPos(hwndTypeCombo, &swp); WinSetWindowPos(hwndTypeCombo, NULLHANDLE, 0, 0, 0, 0, SWP_HIDE); hwndTypeCombo = WinCreateWindow( hwndDlg, WC_COMBOBOX, "", WS_VISIBLE | WS_PARENTCLIP | WS_SYNCPAINT | WS_TABSTOP | CBS_DROPDOWNLIST, swp.x, swp.y, swp.cx, swp.cy, hwndDlg, swp.hwndInsertBehind, 290, NULL, NULL ); WinSendMsg( hwndTypeCombo, LM_DELETEALL, (MPARAM)0, (MPARAM)0 ); pfiledlg = (PFILEDLG)WinQueryWindowULong( hwndDlg, QWL_USER ); pmydata = (PMYDATA)pfiledlg->ulUser; i = 0; while (*(pfiledlg->papszITypeList[i]) != NULL) { WinSendMsg( hwndTypeCombo, LM_INSERTITEM, (MPARAM)LIT_END, (MPARAM)*(pfiledlg->papszITypeList[i]) ); i++; } WinSendMsg( hwndTypeCombo, LM_SELECTITEM, (MPARAM)pmydata->ulCurExt, (MPARAM)TRUE ); return mr; case WM_CONTROL: { if ((SHORT1FROMMP(mp1) == 290) && (SHORT2FROMMP(mp1) == CBN_LBSELECT)) { hwndTypeCombo = WinWindowFromID(hwndDlg, 290); pfiledlg = (PFILEDLG)WinQueryWindowULong( hwndDlg, QWL_USER ); pmydata = (PMYDATA)pfiledlg->ulUser; pmydata->ulCurExt = (ULONG)WinSendMsg( hwndTypeCombo, LM_QUERYSELECTION, (MPARAM)LIT_FIRST, (MPARAM)0 ); if (pfiledlg->fl & FDS_OPEN_DIALOG) { WinSetWindowText(WinWindowFromID(hwndDlg,DID_FILENAME_ED), *(pmydata->papszIFilterList[pmydata->ulCurExt])); WinSendMsg(WinWindowFromID(hwndDlg,DID_FILENAME_ED), EM_SETSEL, MPFROM2SHORT(0, 32000), (MPARAM)0 ); WinSendMsg(hwndDlg, WM_CONTROL, MPFROM2SHORT(DID_FILTER_CB, CBN_LBSELECT), (MPARAM)0 ); } return (MRESULT)TRUE; } } break; } return WinDefFileDlgProc(hwndDlg, msg, mp1, mp2); }
/****************************************************************\ * *-------------------------------------------------------------- * * Name:ClkMinMax() * * Purpose: * * * * Usage: * * Method: * - * * - * - * * - * - * * Returns: * VOID * \****************************************************************/ VOID ClkMinmax (HWND hwnd, PSWP pswp) { char achFinalDate[10]; HWND hwndFrame; /* * We want the date as the icon text if the clock is * minimized and the user has selected both date and * time be displayed. */ if ((cp.usDispMode & (DM_TIME | DM_DATE)) == (DM_TIME | DM_DATE)) { hwndFrame = WinQueryWindow (hwnd, QW_PARENT); if (pswp->fl & SWP_MINIMIZE) { GetArrangedDate (achFinalDate); WinSetWindowText (hwndFrame, achFinalDate); } else { WinSetWindowText (hwndFrame, "Clock"); } } }
VOID STATD :: Advance (PSZ psz) { c ++; if (! hwndDlg) return; CHAR ach[21]; #ifdef _MULTILANGUAGES_ sprintf (ach, RSTR (IDS_XOFX), c, cMax); #else sprintf (ach, "%ld of %ld", c, cMax); #endif WinSetWindowText (WinWindowFromID (hwndDlg, WID_ST_COUNT), ach); WinSetWindowText (WinWindowFromID (hwndDlg, WID_E_FILE), psz); WinSendDlgItemMsg (hwndDlg, WID_S_PROGRESS, SLM_SETSLIDERINFO, MPFROM2SHORT (SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), MPFROMLONG ((c*100L)/cMax)); }
/* CENTRY */ int GLUTAPIENTRY glutCreateWindow(const char *title) { static int firstWindow = 1; GLUTwindow *window; #if !defined(_WIN32) && !defined(__OS2__) XWMHints *wmHints; #endif Window win; XTextProperty textprop; if (__glutGameModeWindow) { __glutFatalError("cannot create windows in game mode."); } window = __glutCreateWindow(NULL, __glutSizeHints.x, __glutSizeHints.y, __glutInitWidth, __glutInitHeight, /* not game mode */ 0); win = window->win; /* Setup ICCCM properties. */ textprop.value = (unsigned char *) title; textprop.encoding = XA_STRING; textprop.format = 8; textprop.nitems = strlen(title); #if defined(__OS2__) WinSetWindowText(window->frame, (PCSZ)title); if (__glutIconic) { window->desiredMapState = IconicState; } #elif defined(_WIN32) SetWindowText(win, title); if (__glutIconic) { window->desiredMapState = IconicState; } #else wmHints = XAllocWMHints(); wmHints->initial_state = __glutIconic ? IconicState : NormalState; wmHints->flags = StateHint; XSetWMProperties(__glutDisplay, win, &textprop, &textprop, /* Only put WM_COMMAND property on first window. */ firstWindow ? __glutArgv : NULL, firstWindow ? __glutArgc : 0, &__glutSizeHints, wmHints, NULL); XFree(wmHints); XSetWMProtocols(__glutDisplay, win, &__glutWMDeleteWindow, 1); #endif firstWindow = 0; return window->num + 1; }
STATD :: StatusDisplay (PSZ pszName, ULONG c, HWND hwndOwner, BOOL f, PBOOL pf) { cMax = c; this->c = 0L; fInstantQuit = f; fFinished = FALSE; pfBreak = pf; hwndDlg = WinLoadDlg (HWND_DESKTOP, hwndOwner, DialogProcedure, GETMODULE, ID_DLG_STATUS, this); WinSetWindowText (hwndDlg, pszName); }
static void setServer(HWND hwndDlg) { // HAB hab = WinQueryAnchorBlock(hwndDlg) ; HWND hwnd = WinWindowFromID(hwndDlg, IDD_SHOST) ; int i, id ; PUCHAR first = NULL ; UCHAR server[128] ; WinSendMsg(hwnd, EM_SETTEXTLIMIT, MPFROMSHORT(128), NULL) ; /* * fill-in host list */ for (i = 0 ; i< MAXHOSTS ; i++) { if ((id = profOrder[i]) == 0xff) { continue ; } #ifdef DEBUG TRACE("setServer - %d : %s\n", id, profHosts[id].name) ; #endif if (first == NULL) { first = profHosts[id].name ; } WinSendMsg(hwnd, LM_INSERTITEM, MPFROM2SHORT(LIT_END, 0), MPFROMP(profHosts[id].name)) ; } /* * set host name (current selection) */ if (argServer != NULL) { strcpy(server, argServer) ; } else if (first != NULL) { strcpy(server, first) ; } else { strcpy(server, "") ; } #ifdef DEBUG TRACE("setServer - host %s\n", server) ; #endif WinSetWindowText(hwnd, server) ; }
VOID STATD :: Finished (VOID) { fFinished = TRUE; if (! hwndDlg) return; WinSetWindowText (WinWindowFromID (hwndDlg, WID_PB_OK), #ifdef _MULTILANGUAGES_ RSTR (IDS_OK)); #else "Ok"); #endif if (fInstantQuit) WinPostMsg (hwndDlg, WM_CLOSE, 0,0); }