void InitControls( HWND hwndDlg )
{
    int   i;
    HWND  hwndLB;

    hwndLB = WinWindowFromID( hwndDlg, CB_OPERATION );
    for( i = 0; i < cOperations; i++ )
        WinInsertLboxItem( hwndLB, LIT_END, dcOperation[ i ].szItem );

    hwndLB = WinWindowFromID( hwndDlg, CB_TYPE );
    for( i = 0; i < cTypes; i++ )
        WinInsertLboxItem( hwndLB, LIT_END, ntsType[ i ].szName );

    hwndLB = WinWindowFromID( hwndDlg, LB_CONTROL );
    for( i = 0; i < cControlTypes; i++ )
        WinInsertLboxItem( hwndLB, LIT_END, dcControl[ i ].szItem );

    hwndLB = WinWindowFromID( hwndDlg, LB_SUPPORTEDOPS );
    for( i = 0; i < cSupportedOps; i++ )
        WinInsertLboxItem( hwndLB, LIT_END, dcSupportedOp[ i ].szItem );

    SetEFTextLimit( hwndDlg, EF_ITEMID, 8 );
    SetEFTextLimit( hwndDlg, CB_TYPE, TYPE_LEN );
    SetEFTextLimit( hwndDlg, EF_CNR_NAME, CCHMAXPATH );
    SetEFTextLimit( hwndDlg, EF_SOURCE_NAME, CCHMAXPATH );
    SetEFTextLimit( hwndDlg, EF_TARGET_NAME, CCHMAXPATH );

    UpdateControls( hwndDlg );
}
MRESULT InitMainWindow(HWND hwnd,      /* handle to the main client window */
                       MPARAM mp1,     /* first parameter of WM_CREATE message */
                       MPARAM mp2)     /* second parameter of WM_CREATE message */
{
   FONTMETRICS fm;
   HPS         hps;

   hps = WinGetPS (hwnd) ;
   GpiQueryFontMetrics (hps, (LONG) sizeof fm, &fm) ;

   cxChar = fm.lAveCharWidth ;
   cxCaps = fm.lEmInc ;
   cyChar = fm.lMaxBaselineExt ;
   cyDesc = fm.lMaxDescender ;

   WinReleasePS (hps) ;

   cxTextTotal = MESSAGE_LEN * cxChar ;

   hwndHscroll = WinWindowFromID (
                       WinQueryWindow (hwnd, QW_PARENT),
                       FID_HORZSCROLL) ;

   hwndVscroll = WinWindowFromID (
                       WinQueryWindow (hwnd, QW_PARENT),
                       FID_VERTSCROLL) ;

   return (MRFROMLONG(0));
}
Beispiel #3
0
MRESULT EXPENTRY aboutProcR( HWND hwndDlg, ULONG msg,
			    MPARAM mp1, MPARAM mp2 )
{
INT i;
switch ( msg )
   {
   case WM_INITDLG:
      return WinDefDlgProc( hwndDlg, msg, mp1, mp2 );

   case WM_COMMAND:
      switch( SHORT1FROMMP( mp1 ) )
	 {
	 case DID_CANCEL :
	    WinShowWindow(WinWindowFromID(hwndDlg, DID_CANCEL), FALSE);
	    for( i=0;i<4;i++ )
	       {
	       WinShowWindow(WinWindowFromID(hwndDlg, ID_BEGSCREEN), FALSE);
	       DosSleep(200);
	       WinShowWindow(WinWindowFromID(hwndDlg, ID_BEGSCREEN), TRUE);
	       DosSleep(200);
	       }
	    WinDismissDlg( hwndDlg, TRUE );
	    break;

	 default :
	    return WinDefDlgProc( hwndDlg, msg, mp1, mp2 );
	 }
      break;
   default :
      return WinDefDlgProc( hwndDlg, msg, mp1, mp2 );
   }
return (MRESULT) FALSE;
}
Beispiel #4
0
MRESULT mainhewmInit(HWND hwnd,MPARAM mp1,MPARAM mp2)
{
HWND    hwndFrame = WinQueryWindow(hwnd,QW_PARENT);

//  printf("HEWM_INIT\n");

    if (bootopen)
        han_type = HEFileOpenWithAutoHanCode(hwnd,bootopen,TRUE);

    HESetTitlebarText(hwnd);

    WinPostMsg(hwndHIA,HIAM_SETKBDTYPE,MPFROMLONG(kbd_type),0L);
    WinPostMsg(hwndHMLE,HMLM_SETTEXTFORMAT,MPFROMLONG(eol_type),0L);
    WinPostMsg(hwndStatbar,STATBAR_USERM_SETEOLTYPE,MPFROMLONG(eol_type),0L);
    WinPostMsg(hwndStatbar,STATBAR_USERM_SETHANTYPE,MPFROMLONG(han_type),0L);

    if (readonly)
        {
        WinEnableMenuItem(WinWindowFromID(hwndFrame,FID_MENU),IDM_IMPORT,FALSE );
        WinEnableMenuItem(WinWindowFromID(hwndFrame,FID_MENU),IDM_SAVE,FALSE);
        //WinEnableMenuItem(WinWindowFromID(hwndFrame,FID_MENU),IDM_SAVEAS,FALSE);
        WinPostMsg(hwndToolbar,TOOLBAR_USERM_SHOWITEM,MPFROMLONG(TOOLBAR_SAVE),FALSE);
        WinPostMsg(hwndToolbar,TOOLBAR_USERM_SHOWITEM,MPFROMLONG(TOOLBAR_CUT),FALSE);
        WinPostMsg(hwndToolbar,TOOLBAR_USERM_SHOWITEM,MPFROMLONG(TOOLBAR_PASTE),FALSE);
        WinPostMsg(hwndToolbar,TOOLBAR_USERM_SHOWITEM,MPFROMLONG(TOOLBAR_CLEAR),FALSE);
        WinPostMsg(hwndToolbar,TOOLBAR_USERM_UPDATE,0,0);
        }
    WinEnableMenuItem(WinWindowFromID(hwndFrame,FID_MENU),IDM_PROPERTIES,FALSE);

    WinSetFocus(HWND_DESKTOP,hwndHMLE);

    return 0L;
}
// Window - окно.
LONG WindowTypes_WindowType( HWND Window )
{
 // Если окно не задано - возврат.
 if( Window == NULLHANDLE ) return WT_UNKNOWN;

 // Если это окно рабочего стола - возврат.
 if( IsDesktopWindow( Window ) ) return WT_UNKNOWN;

 // Это может быть окно рамки.
 if( IsFrameWindow( Window ) ) return WT_BORDER;

 // Окна заголовка, картинки и меню могут иметь различные имена.
 // У них есть родительское окно - рабочий стол или окно рамки.
 HWND Parent_window = WinQueryWindow( Window, QW_PARENT );

 if( IsFrameWindow( Parent_window ) )
  {
   if( WinWindowFromID( Parent_window, FID_SYSMENU ) == Window ) return WT_SYSMENU;
   if( WinWindowFromID( Parent_window, FID_TITLEBAR ) == Window ) return WT_TITLEBAR;
   if( WinWindowFromID( Parent_window, FID_MINMAX ) == Window ) return WT_MINMAX;
   if( WinWindowFromID( Parent_window, FID_MENU ) == Window ) return WT_MENU;
   if( WinWindowFromID( Parent_window, FID_CLIENT ) == Window ) return WT_CLIENT;
  }

 // Возврат.
 return WT_UNKNOWN;
}
Beispiel #6
0
MRESULT mainwmSize( HWND hwnd, MPARAM mp1, MPARAM mp2 )
{
//  printf("HMLEdit:: WM_SIZE\n");

    WinSetWindowPos( WinWindowFromID( hwnd, ID_HANMLE ), NULLHANDLE,
            0, (use_statbar?STATBAR_YSIZE:0),
            SHORT1FROMMP(mp2),
            SHORT2FROMMP(mp2)-(use_statbar?STATBAR_YSIZE:0)-(use_toolbar?TOOLBAR_YSIZE:0),
            SWP_SIZE | SWP_MOVE );
    if (use_toolbar)
        WinSetWindowPos( WinWindowFromID( hwnd, ID_TOOLBAR ), NULLHANDLE,
            0, SHORT2FROMMP(mp2)-TOOLBAR_YSIZE, SHORT1FROMMP(mp2) , TOOLBAR_YSIZE,
            SWP_SIZE | SWP_MOVE | SWP_SHOW);
        else
        WinSetWindowPos( WinWindowFromID( hwnd, ID_TOOLBAR ), NULLHANDLE,
            0, SHORT2FROMMP(mp2)-TOOLBAR_YSIZE, SHORT1FROMMP(mp2) , TOOLBAR_YSIZE,
            SWP_SIZE | SWP_MOVE | SWP_HIDE);
    if (use_statbar)
        WinSetWindowPos( WinWindowFromID( hwnd, ID_STATBAR ), NULLHANDLE,
            0, 0, SHORT1FROMMP(mp2), STATBAR_YSIZE,
            SWP_SIZE | SWP_MOVE | SWP_SHOW);
        else
        WinSetWindowPos( WinWindowFromID( hwnd, ID_STATBAR ), NULLHANDLE,
            0, 0, SHORT1FROMMP(mp2), STATBAR_YSIZE,
            SWP_SIZE | SWP_MOVE | SWP_HIDE);
    return MRFROMLONG(0L);
}
Beispiel #7
0
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));
}
Beispiel #8
0
VOID CDialog::LVM_InvalidateView (int id)
{
#if defined(__OS2__)
   RECORDINSERT recordInsert;

   if (pRecord != NULL) {
      recordInsert.cb = sizeof (RECORDINSERT);
      recordInsert.pRecordOrder = (PRECORDCORE)CMA_END;
      recordInsert.zOrder = (ULONG)CMA_TOP;
      recordInsert.cRecordsInsert = 1;
      recordInsert.fInvalidateRecord = FALSE;
      recordInsert.pRecordParent = NULL;
      WinSendMsg (WinWindowFromID (m_hWnd, id), CM_INSERTRECORD, MPFROMP (pRecord), MPFROMP (&recordInsert));

      pRecord = NULL;
   }

   WinSendMsg (WinWindowFromID (m_hWnd, id), CM_INVALIDATEDETAILFIELDINFO, 0L, 0L);
#elif defined(__NT__)
   int i;

   for (i = 0; i < lvC.iSubItem; i++)
      ListView_SetColumnWidth (GetDlgItem (m_hWnd, id), i, LVSCW_AUTOSIZE_USEHEADER);

   ::ShowWindow (GetDlgItem (m_hWnd, id), SW_SHOW);
#endif
}
/****************************************************************************
   Main Program start
*****************************************************************************/
int main()
{
    HMQ   hmq;
    QMSG  qmsg;

    hab = WinInitialize (0);
    hmq = WinCreateMsgQueue (hab, 0);

    hWndFrame = WinLoadDlg (HWND_DESKTOP, HWND_DESKTOP,
        MainDlgProc, 0, IDD_CLOCK,NULL);
    TitleDefProc = WinSubclassWindow(WinWindowFromID(hWndFrame, FID_TITLEBAR),
                   (PFNWP)TitleBarProc );
    SysMenuDefProc = WinSubclassWindow(WinWindowFromID(hWndFrame, FID_SYSMENU),
                   (PFNWP)SysMenuProc );

    SysMenuButton = WinLoadPointer (HWND_DESKTOP, 0, IDD_CLOCK);
    WinQueryPointerInfo(SysMenuButton,&PointerInfo);
    WinSendMsg (hWndFrame, WM_SETICON, (MPARAM)SysMenuButton, NULL);


    while (WinGetMsg (hab, &qmsg, 0, 0, 0))
        WinDispatchMsg (hab, &qmsg);

    WinDestroyWindow (hWndFrame);
    WinDestroyMsgQueue (hmq);
    WinTerminate (hab);
    return (0);
}
Beispiel #10
0
void dlgFind_Find(HWND hwnd)
{
HWND hwndFind = WinWindowFromID(hwnd,IDHEF_FIND);
HWND hwndCaseSens = WinWindowFromID(hwnd,IDB_CASESENSITIVE);

MLE_SEARCHDATA searchData;
ULONG ulStyle = 0;
int findLen=0;
char *findStr = NULL;

    findLen = WinQueryWindowTextLength(hwndFind);
    findStr = malloc(findLen+1);
#ifdef DEBUG
    assert(findStr!=NULL);
#endif
    if (findStr==NULL) return;
    WinQueryWindowText(hwndFind,findLen+1,findStr);

    searchData.cb = sizeof(searchData);
    searchData.pchFind = findStr;
    searchData.pchReplace = NULL;
    searchData.iptStart = -1;
    searchData.iptStop = -1;
    ulStyle = MLFSEARCH_SELECTMATCH;
    if (WinSendMsg(hwndCaseSens,BM_QUERYCHECK,0,0))
        ulStyle |= MLFSEARCH_CASESENSITIVE;
    dlgFind_SetFound(hwnd,(int) WinSendMsg(hwndHMLE,HMLM_SEARCH,MPFROMLONG(ulStyle),&searchData));
    free(findStr);
}
VOID AdjustSaveTypeButtons (BOOL f)
{
    HWND   hwndClient = WinWindowFromID (hwndFrame, FID_CLIENT);

    // FIXME um, em, global variables :-$
    WinEnableWindow (WinWindowFromID (hwndClient, WID_RB_CLIPBOARD), !f);
    WinEnableWindow (WinWindowFromID (hwndClient, WID_RB_FILE), !f);
}
Beispiel #12
0
VOID ClearScreen(THREAD *pstThd)
  {
  VIOCELL Cell;
  VIOPS *pVio = &pstThd->stVio;
  BYTE byBackground;
  BYTE byForeground;


  byBackground = ClrTable[pVio->wBackground].PSClr;
  byForeground = ClrTable[pVio->wForeground].PSClr;


  /*
  ** Set foreground and background colors in ANSI, so that the
  ** VioWrtTTY function will pick up the correct colors.
  */
  chAnsi[ANSI_FORE] = QueryAnsiClr(byForeground);
  chAnsi[ANSI_BACK] = QueryAnsiClr(byBackground);
  VioSetAnsi (ANSI_ON,pVio->hpsVio);
  VioWrtTTY( (PCH)chAnsi,sizeof(chAnsi),pVio->hpsVio);
  if (!pstThd->stCfg.bEnableAnsi)
    VioSetAnsi (ANSI_OFF,pVio->hpsVio);

  /*
  ** Set Presentation Space to a known state - full of spaces.
  */
  Cell.vc      = ' ';
  Cell.ExtAttr = Cell.Spare = 0;
  Cell.Attr    =  (byBackground << 4) | byForeground;
  VioWrtNCell((PBYTE)&Cell,pVio->usPsWidth * pVio->usPsDepth,0,0,pVio->hpsVio);
  VioSetOrg(0,0,pVio->hpsVio);
  VioSetCurPos(0,0,pVio->hpsVio);

  /*
  ** Zero the scroll bars.
  */
  WinSendMsg(WinWindowFromID(pstThd->hwndFrame,FID_VERTSCROLL),
             SBM_SETPOS,
             MPFROMSHORT(0),
             MPFROMSHORT(0));

  WinSendMsg(WinWindowFromID(pstThd->hwndFrame,FID_HORZSCROLL),
             SBM_SETPOS,
             MPFROMSHORT(0),
             MPFROMSHORT(0));

  WinSendMsg(WinWindowFromID(pstThd->hwndFrame,FID_VERTSCROLL),
              SBM_SETTHUMBSIZE,
              MPFROM2SHORT(pVio->usWndWidth,pVio->usPsWidth),
              (MPARAM)NULL);

  WinSendMsg(WinWindowFromID(pstThd->hwndFrame,FID_HORZSCROLL),
              SBM_SETTHUMBSIZE,
              MPFROM2SHORT(pVio->usWndDepth,pVio->usPsDepth),
              (MPARAM)NULL);

  }
static void _showSingleSessionCntrls(HWND hwnd, BOOL bEnable)
{
  /* hwnd:    Dialog-HWND
     bEnable: New enable state */

  WinShowWindow(WinWindowFromID(hwnd,IDGB_MERGESESSION),bEnable);//Groupbox
  WinShowWindow(WinWindowFromID(hwnd,IDST_SINGLESESSION),bEnable);//Text

}
Beispiel #14
0
/*
 * _NewWindow - create a new window
 */
unsigned _NewWindow( char *name, ... )
{
    LPWDATA     w;
    MENUITEM    menus;
    HWND        hwnd,frame,temp;
    char        str[80];
    int         x1,x2,y1,y2;
    ULONG       style;
    RECTL       rcl;
    va_list     al;

    _GetWindowNameAndCoords( name, str, &x1, &x2, &y1, &y2 );

    style = FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_MINMAX |
            FCF_VERTSCROLL;
    frame = WinCreateStdWindow( _MainWindow,
                WS_VISIBLE | WS_CLIPSIBLINGS,
                &style, _ClassName, str, 0, NULL, 0, &hwnd );
    if( frame == 0 ) return( FALSE );
    WinSetOwner( hwnd, _MainWindow );

    va_start( al, name );
    w = _AnotherWindowData( hwnd, al );
    w->frame = frame;
    w->text_color = CLR_WHITE;
    w->background_color = CLR_BLACK;
    WinSendMsg( frame, WM_SETICON,
        MPFROMLONG( WinQuerySysPointer( HWND_DESKTOP, SPTR_APPICON, TRUE ) ), 0 );
    WinSetWindowBits( WinWindowFromID( w->frame, FID_VERTSCROLL ), QWL_STYLE,
                        SBS_AUTOTRACK, SBS_AUTOTRACK );

    _CreateFont( w );
    _PositionScrollThumb( w );
    WinQueryWindowRect( _MainWindow, &rcl );
    WinSetWindowPos( frame, HWND_TOP,
                x1*w->xchar,
                (rcl.yTop - rcl.yBottom)-y1*w->ychar-y2*w->ychar,
                x2*w->xchar,
                y2*w->ychar,
                SWP_SIZE | SWP_MOVE | SWP_ZORDER );

    menus.iPosition = _MainWindowData->window_count - 1;
    menus.afStyle = MIS_TEXT;
    menus.afAttribute = 0;
    menus.id = DID_WIND_STDIO + w->handles[0];
    menus.hwndSubMenu = NULL;
    menus.hItem = 0;
    if ( MIT_ERROR == (BOOL)WinSendMsg( menuHandle, ( ULONG )MM_INSERTITEM, MPFROMP( &menus ), MPFROMP( str ) ) ) abort();
    temp = WinWindowFromID( frame, FID_SYSMENU );
    WinSendMsg( temp, MM_QUERYITEM, MPFROM2SHORT(SC_SYSMENU, TRUE),
                               MPFROMP((PSZ)&menus) );
    WinSendMsg( menus.hwndSubMenu, MM_DELETEITEM, MPFROM2SHORT( SC_CLOSE, TRUE ), 0 );
    WinUpdateWindow( hwnd );
    WinSetFocus( HWND_DESKTOP, hwnd );
    return( TRUE );

} /* _NewWindow */
static void _showBootCDCntrls(HWND hwnd, BOOL bEnable)
{
  /* hwnd:    Dialog-HWND
     bEnable: New enable state */

  WinShowWindow(WinWindowFromID(hwnd,IDGB_BOOTCD),bEnable);
  WinShowWindow(WinWindowFromID(hwnd,IDST_BOOTIMAGE),bEnable);
  WinShowWindow(WinWindowFromID(hwnd,IDST_BOOTCATALOG),bEnable);
  WinShowWindow(WinWindowFromID(hwnd,IDPB_BOOTCDCONFIGURE),bEnable);
}
Beispiel #16
0
static MRESULT APIENTRY OK ( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 ) {

 /***************************************************************************
  * Find the instance data.                                                 *
  ***************************************************************************/

  PPROFILE_PARMS Parms = PPROFILE_PARMS ( WinQueryWindowPtr ( hwnd, QWL_USER ) ) ;

 /***************************************************************************
  * Verify the entered path.                                                *
  ***************************************************************************/

  BYTE Name [256] ;
  WinQueryDlgItemText ( hwnd, Parms->id+ENTRY, sizeof(Name), Name ) ;

  BYTE FullPath [256] ;
  if ( DosQueryPathInfo ( Name, FIL_QUERYFULLNAME, FullPath, sizeof(FullPath) ) ) {
    PSZ Message = PSZ ( "ERROR: Not a valid path." ) ;
    WinSetDlgItemText ( hwnd, Parms->id+ERR, Message ) ;
    WinAlarm ( HWND_DESKTOP, WA_ERROR ) ;
    WinSetFocus ( HWND_DESKTOP, WinWindowFromID ( hwnd, Parms->id+ENTRY ) ) ;
    return ( 0 ) ;
  }

  FILESTATUS3 Status ;
  if ( DosQueryPathInfo ( FullPath, FIL_STANDARD, &Status, sizeof(Status) ) ) {
    PSZ Message = PSZ ( "ERROR: Path does not exist." ) ;
    WinSetDlgItemText ( hwnd, Parms->id+ERR, Message ) ;
    WinAlarm ( HWND_DESKTOP, WA_ERROR ) ;
    WinSetFocus ( HWND_DESKTOP, WinWindowFromID ( hwnd, Parms->id+ENTRY ) ) ;
    return ( 0 ) ;
  }

  if ( ! ( Status.attrFile & FILE_DIRECTORY ) ) {
    PSZ Message = PSZ ( "ERROR: Specified path is not a directory." ) ;
    WinSetDlgItemText ( hwnd, Parms->id+ERR, Message ) ;
    WinAlarm ( HWND_DESKTOP, WA_ERROR ) ;
    WinSetFocus ( HWND_DESKTOP, WinWindowFromID ( hwnd, Parms->id+ENTRY ) ) ;
    return ( 0 ) ;
  }

 /***************************************************************************
  * Return the full path to the caller.                                     *
  ***************************************************************************/

  strncpy ( PCHAR(Parms->Path), PCHAR(FullPath), Parms->PathSize ) ;

 /***************************************************************************
  * Dismiss the dialog with a TRUE status.                                  *
  ***************************************************************************/

  WinDismissDlg ( hwnd, TRUE ) ;

  return ( 0 ) ;
}
Beispiel #17
0
TOOLBAR :: Toolbar (HWND hwndFrame)
{
    TOOLBAR::ptb = this; // FIXME puke!

    fHidden = TRUE;
    this->hwndFrame = hwndFrame;

    if (WinWindowFromID (hwndFrame, FID_CLIENT))
        fOwnerIsDialog = FALSE;
    else
        fOwnerIsDialog = TRUE;

    // no buttons by now ...
    c = 0;
    memset (aid, 0x00, sizeof (aid[0]) * TOOLBARBUTTONSMAX);

    if (! (pfnwpOldFrame =
           WinSubclassWindow (hwndFrame, PFNWP (fnwpNewFrame))))
        return;

    // if not already registered, register our window class
    if (! fClassRegistered)
    {
        WinRegisterClass (GETHAB, PSZ_WCTOOLBAR, fnwp, 0L, 4L);
        fClassRegistered = TRUE;
    }

    // either place under menu or under titlebar
    SHORT  y, cx;
    SWP    swp;

    if ((hwndAnchor = WinWindowFromID (hwndFrame, FID_MENU)))
    {
        WinQueryWindowPos (hwndAnchor, &swp);
        cx = swp.cx;
        y  = swp.y-CY_TOOLBAR;
    }
    else if ((hwndAnchor = WinWindowFromID (hwndFrame, FID_TITLEBAR)))
    {
        WinQueryWindowPos (hwndAnchor, &swp);
        cx = swp.cx;
        y  = swp.y-CY_TOOLBAR;
    }
    else
    {
        cx = 1;
        y = 0;
    }

    // create client window and assign object ptr to window word
    hwnd = WinCreateWindow (hwndFrame, PSZ_WCTOOLBAR, "", 0L, 0,y,
                            cx,CY_TOOLBAR, hwndFrame, HWND_TOP, FID_TOOLBAR,
                            NULL, NULL);
    WinSetWindowPtr (hwnd, 0, this);
}
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;
}
Beispiel #19
0
void dlgFind_SetFound(HWND hwnd,int found)
{
HWND hwndBtnReplace = WinWindowFromID(hwnd,IDB_REPLACE);
HWND hwndBtnReplaceFind = WinWindowFromID(hwnd,IDB_REPLACEFIND);
HWND hwndBtnReplaceAll = WinWindowFromID(hwnd,IDB_REPLACEALL);

    WinEnableWindow(hwndBtnReplace,found);
    WinEnableWindow(hwndBtnReplaceFind,found);
    WinEnableWindow(hwndBtnReplaceAll,found);
    dlgFind_found = found;
}
void mwpSize(HWND hWnd)
{
   RECTL    rect;
   ULONG    fl = SWP_SIZE | SWP_MOVE;

   WinQueryWindowRect(hWnd, &rect);

   WinSetControlRelPos(WinWindowFromID(hWnd, PB_PROGRESS), HWND_TOP, &rect, 0.00, 0.40, 1.00, 1.00, fl, 0, 5, -5, -5);
   WinSetControlRelPos(WinWindowFromID(hWnd, ST_VOLUME),   HWND_TOP, &rect, 0.00, 0.00, 0.10, 0.40, fl, 5, 5,  0, -5);
   WinSetControlRelPos(WinWindowFromID(hWnd, SLRD_VOLUME), HWND_TOP, &rect, 0.10, 0.00, 1.00, 0.40, fl, 0, 5, -5, -5);
}
// Frame_window - окно рамки.
LONG Diver_GetPreDefinedButtonsState( HWND Frame_window )
{
 // Если окна картинки нет - возврат.
 if( WinWindowFromID( Frame_window, FID_SYSMENU ) == NULLHANDLE ) return NO_ACTION;

 // Узнаем, как выглядит рамка окна.
 LONG Frame_type = FrameType( Frame_window );

 // Если окно имеет рамку в одну точку - требуется кнопка закрытия.
 if( Frame_type == FT_POINT ) return CLOSE_ACTION;

 // Если это окно постоянного размера - требуется кнопка закрытия.
 if( Frame_type == FT_CONST )
  if( PermissionForButtonsDrawing( Frame_window ) ) return CLOSE_ACTION;

 // Если окно имеет обычную рамку:
 if( Frame_type == FT_NORMAL )
  {
   // Если это окно справочника - состояние кнопок может быть любым, возврат.
   if( WindowIsCreatedBy( APP_VIEWDOC, Frame_window ) ) return NO_ACTION;

   // Если это текстовое окно - надо рисовать все кнопки, возврат.
   if( IsVIOWindow( Frame_window ) ) return CLOSE_ACTION | MINIMIZE_ACTION | MAXIMIZE_ACTION;

   // Задаем состояние кнопок.
   BYTE Draw_all_buttons = 0;

   // Если это окно WPS - должны быть нарисованы все кнопки.
   if( IsFolderWindow( Frame_window ) ) Draw_all_buttons = 1;

   // Так же, если в окне есть меню и его родительское окно - рабочий стол.
   if( !Draw_all_buttons )
    if( WinWindowFromID( Frame_window, FID_MENU ) != NULLHANDLE )
     if( WinQueryWindow( Frame_window, QW_PARENT ) == QueryDesktopWindow() )
      Draw_all_buttons = 1;

   // Если в окне должны быть нарисованы все кнопки:
   if( Draw_all_buttons )
    {
     // Для некоторых окон нужна только кнопка закрытия.
     if( Painter_OneActionIsAllowed( Frame_window ) ) return CLOSE_ACTION;

     // Для некоторых окон не нужна кнопка уменьшения.
     if( !Painter_MinimizeActionIsAllowed( Frame_window ) ) return CLOSE_ACTION | MAXIMIZE_ACTION;

     // Для остальных окон нужны все три кнопки.
     return ALL_ACTIONS;
    }
  }

 // Возврат.
 return NO_ACTION;
}
Beispiel #22
0
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;
}
Beispiel #23
0
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);
}
/****************************************************************************
 * 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), "???");
}
static void enableArchiveCntrls(HWND hwnd, BOOL bEnable)
{

  /* Use archive bit */
  WinEnableWindow(WinWindowFromID(hwnd,IDCB_USEARCHIVEBIT),bEnable);

  /* Reset archive bit */
  WinEnableWindow(WinWindowFromID(hwnd, IDCB_RESETARCHIVEBIT),bEnable);

  /* Reset now push button */
  WinEnableWindow(WinWindowFromID(hwnd, IDPB_RESETNOW),bEnable);

}
/* Dialog-Procedure f�r die AboutBox (OS/2-Standard) */
MRESULT EXPENTRY AboutBoxDlgProc(HWND hwnd, ULONG msg, MPARAM mp1,MPARAM mp2)
{
   HWND  TextPos;
   IString textstr;
   SHORT i;
   ULONG   ulScrWidth, ulScrHeight;
   RECTL   Rectl;
   SWP     Swp;
   HPS     hps;

   switch(msg) {
   case WM_PAINT:
      hps = WinBeginPaint (hwnd,0,0);
      WinQueryWindowRect (hwnd, &Rectl);
      WinFillRect (hps, &Rectl, SYSCLR_DIALOGBACKGROUND);
      Rectl.yTop -= WinQuerySysValue(HWND_DESKTOP,SV_CYTITLEBAR),

      WinDrawBorder (hps, &Rectl,
          WinQuerySysValue(HWND_DESKTOP,SV_CXDLGFRAME),
          WinQuerySysValue(HWND_DESKTOP,SV_CYDLGFRAME),
          CLR_DARKGRAY, CLR_WHITE, DB_RAISED);
      GpiMove (hps, (PPOINTL)&Rectl);
      Rectl.xRight--;
      Rectl.yTop--;
      WinQueryWindowPos (WinWindowFromID (hwnd, IDD_ACOPYRIGHTFRAME), &Swp);
      Rectl.xLeft   = Swp.x-1;
      Rectl.yBottom = Swp.y-1;
      Rectl.xRight  = Swp.x + Swp.cx + 1;
      Rectl.yTop    = Swp.y + Swp.cy + 1;
      WinDrawBorder (hps, &Rectl, 1L, 1L,
          CLR_DARKGRAY, CLR_WHITE, DB_DEPRESSED);
      WinQueryWindowPos (WinWindowFromID (hwnd, IDD_APROGRAMFRAME), &Swp);
      Rectl.xLeft   = Swp.x-1;
      Rectl.yBottom = Swp.y-1;
      Rectl.xRight  = Swp.x + Swp.cx + 1;
      Rectl.yTop    = Swp.y + Swp.cy + 1;
      WinDrawBorder (hps, &Rectl, 1L, 1L,
          CLR_DARKGRAY, CLR_WHITE, DB_DEPRESSED);
      WinEndPaint (hps);
      break;
   case WM_COMMAND:
     /* no matter what the command, close the dialog */
      WinDismissDlg(hwnd, TRUE);
      break;

   default:
      return(WinDefDlgProc(hwnd, msg, mp1, mp2));
   }
   return(MPVOID);
}  /* AboutBoxWndProc() */
static void internal_ArrangeWrongPwdWindowControls(HWND hwnd)
{
  SWP swpWindow;
  ULONG CXDLGFRAME = WinQuerySysValue(HWND_DESKTOP, SV_CXDLGFRAME);
  ULONG CYDLGFRAME = WinQuerySysValue(HWND_DESKTOP, SV_CYDLGFRAME);
  ULONG CYTITLEBAR = WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR);
  int iCX, iCY;     // Control size
  int iMaxBtnCX, iBtnCY;

  // Arrange password protection window controls, and
  // set window size so it will look nice!


  // First get the sizes of texts inside buttons
  internal_GetStaticTextSize(hwnd, DID_OK, &iMaxBtnCX, &iBtnCY);

  // Now get size of text!
  internal_GetStaticTextSize(hwnd, ST_INVALIDPASSWORDTEXT, &iCX, &iCY);

  // Oookay, now we know how big window we want!

  WinSetWindowPos(hwnd,
                  HWND_TOP,
                  0, 0,
                  6*CXDLGFRAME + iCX,
                  CYDLGFRAME + CYTITLEBAR + 2*CYDLGFRAME + iCY + 2*CYDLGFRAME + (iBtnCY+4*CYDLGFRAME) + 2*CYDLGFRAME,
                  SWP_SIZE);

  WinQueryWindowPos(hwnd, &swpWindow);

  // Set the button in there
  WinSetWindowPos(WinWindowFromID(hwnd, DID_OK),
                  HWND_TOP,
                  (swpWindow.cx - (6*CXDLGFRAME + iMaxBtnCX)) / 2,
                  2*CYDLGFRAME,
                  6*CXDLGFRAME + iMaxBtnCX,
                  3*CYDLGFRAME + iBtnCY,
                  SWP_MOVE | SWP_SIZE);

  // Set the position of wrong password text
  WinSetWindowPos(WinWindowFromID(hwnd, ST_INVALIDPASSWORDTEXT),
                  HWND_TOP,
                  3*CXDLGFRAME,
                  swpWindow.cy - CYDLGFRAME - CYTITLEBAR - 2*CYDLGFRAME - iCY,
                  iCX,
                  iCY,
                  SWP_MOVE | SWP_SIZE);

}
Beispiel #28
0
/**********************************************************************
 * 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);

}
/**********************************************************************
* InitAlarm
*
************************************************************************/
void InitAlarm(HWND hwnd)
{
   USHORT usItem;
   MPARAM Message;

   WinSendMsg(WinWindowFromID(hwnd,
              SCROLL_HOURS),
              SBM_SETSCROLLBAR,
              MPFROMLONG(2),
              MPFROM2SHORT(1, 3));
   WinSendMsg(WinWindowFromID(hwnd,SCROLL_MINUTES),
              SBM_SETSCROLLBAR,
              MPFROMLONG(2),
              MPFROM2SHORT(1, 3));
   WinSendDlgItemMsg(hwnd,
                     IDC_HOURMINUTES,
                     EM_SETTEXTLIMIT,
                     MPFROMLONG(5),
                     MPVOID);
   SetAlarmField(hwnd, cp.alarm.uchHour, cp.alarm.uchMinutes);
   WinSendDlgItemMsg(hwnd,
                     IDC_HOURMINUTES,
                     EM_SETSEL,
                     MPFROM2SHORT(0, 0),
                     MPVOID);
   pfnwpEntryField = WinSubclassWindow(WinWindowFromID(hwnd,
                                                       IDC_HOURMINUTES),
                                                       EntryFieldSubProc);
   usItem = (USHORT)(cp.alarm.usMode & AM_ACTIVE ? RB_ALARMON : RB_ALARMOFF);
   WinSendDlgItemMsg(hwnd,
                     usItem,
                     BM_SETCHECK,
                     MPFROMLONG(1),
                     MPVOID);
   Message = (cp.alarm.usMode & AM_AUDIO)? MPFROMLONG(1) : MPFROMLONG(0);
   WinSendDlgItemMsg(hwnd,
                      IDC_BEEP,
                      BM_SETCHECK,
                      Message,
                      MPVOID);

   Message = (cp.alarm.usMode & AM_MSGBOX) ? MPFROMLONG(1) : MPFROMLONG(0);
   WinSendDlgItemMsg(hwnd,
                     IDC_MSG,
                     BM_SETCHECK,
                     Message,
                     MPVOID);
}
/****************************************************************\
 *
 *--------------------------------------------------------------
 *
 *  Name:     SetAlarmField
 *
 *  Purpose:
 *
 *
 *
 *  Usage:
 *
 *  Method:
 *          -
 *
 *          -
 *          -
 *
 *          -
 *          -
 *
 *  Returns:
 *          1 - if successful execution completed
 *          0 - if error
\****************************************************************/
VOID SetAlarmField(HWND hwnd,UCHAR uchHours,UCHAR uchMinutes)
{
   UCHAR achHourMinutes[6];

   if (bTwelveHourFormat)
   {
      if (uchHours >= 12)
      {
         uchHours -= 12;
         WinSendDlgItemMsg(hwnd,
                           RB_PM,
                           BM_SETCHECK,
                           MPFROMLONG(1),
                           MPVOID);
        if (uchHours == 0)
           uchHours = 12;
      }
      else
      {
         if (uchHours == 0)
            uchHours = 12;
         WinSendDlgItemMsg(hwnd,
                           RB_AM,
                           BM_SETCHECK,
                           MPFROMLONG(1),
                           MPVOID);
      }
   }
   else
   {
       WinShowWindow(WinWindowFromID(hwnd,RB_PM),FALSE);
       WinShowWindow(WinWindowFromID(hwnd,RB_AM),FALSE);
   }
   _itoa(uchHours, achHourMinutes,10);
   _itoa(uchMinutes, &achHourMinutes[3],10);
   achHourMinutes[2] = szTimeSep[0];
   if (achHourMinutes[1] == 0)
   {
      achHourMinutes[1] = achHourMinutes[0];
      achHourMinutes[0] = ' ';
   }
   if (achHourMinutes[4] == 0)
   {
      achHourMinutes[4] = achHourMinutes[3];
      achHourMinutes[3] = '0';
   }
   WinSetDlgItemText(hwnd, IDC_HOURMINUTES, achHourMinutes);
}