Example #1
0
File: gvpmeas.c Project: 131/gsview
MRESULT EXPENTRY 
CalcDlgProc(HWND hwnd, ULONG mess, MPARAM mp1, MPARAM mp2)
{
  static MATRIX tempmtx ;
  static int tempunit ;
  switch(mess) {
  case WM_INITDLG:
    tempmtx =  option.ctm;
    tempunit = option.measure.unit;
    update_dialog_ctm(hwnd, &tempmtx);
    dialog_put_float(hwnd, IDC_CALCTX, option.measure.tx);
    dialog_put_float(hwnd, IDC_CALCTY, option.measure.ty);
    dialog_put_float(hwnd, IDC_CALCROTTH, option.measure.rotate);
    dialog_put_float(hwnd, IDC_CALCSCX, option.measure.sx);
    dialog_put_float(hwnd, IDC_CALCSCY, option.measure.sy);
   switch(tempunit)
    {
    case IDM_UNITPT:
      calc_enable_custom(hwnd, FALSE) ;
      WinSendMsg( WinWindowFromID(hwnd, IDC_CALCPTS),
		BM_SETCHECK, MPFROMLONG(1), MPFROMLONG(0));
      break ;
    case IDM_UNITMM:
      calc_enable_custom(hwnd, FALSE) ;
      WinSendMsg( WinWindowFromID(hwnd, IDC_CALCMM),
		BM_SETCHECK, MPFROMLONG(1), MPFROMLONG(0));
      break ;
    case IDM_UNITINCH:
      calc_enable_custom(hwnd, FALSE) ;
      WinSendMsg( WinWindowFromID(hwnd, IDC_CALCIN),
		BM_SETCHECK, MPFROMLONG(1), MPFROMLONG(0));
      break ;
    case IDM_UNITCUSTOM:
      calc_enable_custom(hwnd, TRUE) ;
      WinSendMsg( WinWindowFromID(hwnd, IDC_CALCPTS),
		BM_SETCHECK, MPFROMLONG(0), MPFROMLONG(0));
      WinSendMsg( WinWindowFromID(hwnd, IDC_CALCMM),
		BM_SETCHECK, MPFROMLONG(0), MPFROMLONG(0));
      WinSendMsg( WinWindowFromID(hwnd, IDC_CALCIN),
		BM_SETCHECK, MPFROMLONG(0), MPFROMLONG(0));
      WinSendMsg( WinWindowFromID(hwnd, IDC_CALCCUST),
		BM_SETCHECK, MPFROMLONG(1), MPFROMLONG(0));
      break ;
    }
    break;
    
  case WM_CONTROL:
    switch (SHORT2FROMMP(mp1)) {
	case BN_CLICKED:
	  return (MRESULT)calc_command(hwnd, SHORT1FROMMP(mp1), &tempmtx, &tempunit);
    }
    break;
  case WM_COMMAND:
    switch(SHORT1FROMMP(mp1)) {
    case DID_OK:
      if (!dialog_get_ctm(hwnd, &tempmtx, TRUE))
	return (MRESULT)TRUE;
      option.ctm = tempmtx;
      option.measure.unit = tempunit;
      dialog_get_float_error(hwnd, IDC_CALCTX, 
	&option.measure.tx, FALSE);
      dialog_get_float_error(hwnd, IDC_CALCTY, 
	&option.measure.ty, FALSE);
      dialog_get_float_error(hwnd, IDC_CALCROTTH, 
	&option.measure.rotate, FALSE);
      dialog_get_float_error(hwnd, IDC_CALCSCX, 
	&option.measure.sx, FALSE);
      dialog_get_float_error(hwnd, IDC_CALCSCY, 
	&option.measure.sy, FALSE);
      WinDismissDlg(hwnd, TRUE);
      return (MRESULT)TRUE;
    case DID_CANCEL:
      WinDismissDlg(hwnd, FALSE);
      return (MRESULT)TRUE;
    case ID_HELP:
      nHelpTopic = IDS_TOPICMEASURE;
      get_help();
      return (MRESULT)TRUE;
    default:
      return (MRESULT)calc_command(hwnd, SHORT1FROMMP(mp1), &tempmtx, &tempunit);
    }
    break;
  }
  return WinDefDlgProc(hwnd, mess, mp1, mp2);
}
Example #2
0
MRESULT EXPENTRY DetailsDllWndProc (HWND hDlg, USHORT Msg, MPARAM mp1, MPARAM mp2)

{
static PSHORT pDetailEntry;
CHAR   TitleStr[41];


switch (Msg)
  {
  case WM_INITDLG:
       pDetailEntry = PVOIDFROMMP (mp2);

       strcpy (TitleStr, "Details ");
       strcat (TitleStr, pShowTableData[*pDetailEntry].Name);
       WinSetWindowText (hDlg, TitleStr);


       /*--- get current libpath --*/

       if (!GetLibPath (Libpath, MAX_LIBPATH_SIZE, ErrorStr))
         {
         WinMessageBox (HWND_DESKTOP, hWndFrame, ErrorStr,
		        ApplTitle, 0, MB_OK | MB_ICONEXCLAMATION | MB_APPLMODAL);
         WinDismissDlg (hDlg, FALSE);
         break;
         }


       /*--- fill exported procedures ---*/

       if (!_FillExportedProcedures (hDlg, *pDetailEntry, ErrorStr))
         {
         WinMessageBox (HWND_DESKTOP, hWndFrame, ErrorStr,
		        ApplTitle, 0, MB_OK | MB_ICONEXCLAMATION | MB_APPLMODAL);
         WinDismissDlg (hDlg, FALSE);
         break;
         }


       /*--- fill imported modules ---*/

       if (!_FillImportedModules (hDlg, *pDetailEntry, ErrorStr))
         {
         WinMessageBox (HWND_DESKTOP, hWndFrame, ErrorStr,
		        ApplTitle, 0, MB_OK | MB_ICONEXCLAMATION | MB_APPLMODAL);
         WinDismissDlg (hDlg, FALSE);
         break;
         }


       CenterDialog (HWND_DESKTOP, hDlg);

       WinSetFocus (HWND_DESKTOP, WinWindowFromID (hDlg, LID_DETAILS_DLL_EXP_RES));
       return ((MRESULT) TRUE);


  case WM_COMMAND:
        switch (SHORT1FROMMP(mp1))
	 {
	 case DID_CANCEL:
	      WinDismissDlg (hDlg, FALSE);
	      break;
	 }
       break;


  default:
       return WinDefDlgProc (hDlg, Msg, mp1, mp2);
  }


return NULL;
}
Example #3
0
MRESULT EXPENTRY SliderDlgProc( HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
{

   CHAR      acBuffer[10];
   CHAR      *cData;
   USHORT  usNewPctDone;
   SHORT ulValue;
   static SHORT sPtVal=0;
   APIRET rc;

    switch(msg)
    {
       //*********************************
       case WM_INITDLG:

         if ( CommPortOpen(hwnd) == FALSE)
            {
            WinDismissDlg( hwnd, TRUE );  
            return (MRESULT)FALSE;
            }
         hwndDlg = hwnd; //used in read task to send term input
         
         InitSlider (hwnd, IDC_SLIDER_CONTROL,MaximumTicks,
                         MinorTickSpacing,MinorTickSize, 
                         MajorTickSpacing,MajorTickSize, 
                         DetentSpacing, TextSpacing,    
                        "10.Courier");

        //set the limit of the entry field    
         WinSendDlgItemMsg(hwnd,
                     IDC_SLIDER_DATA,
                     EM_SETTEXTLIMIT,
                     (MPARAM)3,
                     (MPARAM)0);
         
         WinStartTimer( hab, hwnd,
                     TMID_QUERY_TIMER,
                     750);  //every 750 msec
         LastVal = 0;        
    
         return 0;

      //*********************************
      case WM_TERMINAL_MSG:
         //sent from the DOS read thread
         usNewPctDone    =    (USHORT) mp1;
         if ( (usNewPctDone >= 0)  && (usNewPctDone <= MaximumTicks) )
            {

            WinSendDlgItemMsg (hwnd, IDC_SLIDER_CONTROL,
                        SLM_SETSLIDERINFO,
                        MPFROM2SHORT (SMA_SLIDERARMPOSITION,
                                        SMA_INCREMENTVALUE),
                        MPFROMSHORT (usNewPctDone));
             LastVal = usNewPctDone;
             }

            return 0;

      //*********************************
      case WM_TIMER:
         
            switch(SHORT1FROMMP(mp1))
               {
               case TMID_QUERY_TIMER:
                 {
                 ulValue = (SHORT) WinSendDlgItemMsg(hwnd, IDC_SLIDER_CONTROL,
                     SLM_QUERYSLIDERINFO,
                  MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_INCREMENTVALUE),
                  NULL);
                 
                  if ( ulValue != LastVal)
                     {
                     LastVal = ulValue;
                     cData = _ltoa(ulValue,acBuffer,10);
                     WinSetDlgItemText(hwnd,IDC_SLIDER_DATA, cData);
                     strcat( acBuffer, " ");
                     PrintTerm(acBuffer);
                     }
                  break;
                  }
               default: break;
               }
         break;

      //*********************************
      case WM_CONTROL:
         switch(SHORT2FROMMP(mp1))
         {
            case SLN_SLIDERTRACK:
            case  SLN_CHANGE:
               {
               ulValue = (SHORT) WinSendDlgItemMsg(hwnd, IDC_SLIDER_CONTROL,
                  SLM_QUERYSLIDERINFO,
                  MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_INCREMENTVALUE),
                  NULL);
               cData = _ltoa(ulValue,acBuffer,10);
               WinSetDlgItemText(hwnd,IDC_SLIDER_DATA, cData);
               break;
               }
         
         default:
            break;
         
         }

        break;

        case WM_COMMAND:
            switch (SHORT1FROMMP(mp1))
            {
                case DID_OK:
                  WinStopTimer( hab,  hwnd, TMID_QUERY_TIMER);
                  WinDismissDlg (hwnd, FALSE);
                  return 0;

                case IDC_MID_POINT:
                
                      WinSendDlgItemMsg (hwnd, IDC_SLIDER_CONTROL,
                                  SLM_SETSLIDERINFO,
                                  MPFROM2SHORT (SMA_SLIDERARMPOSITION,
                                                  SMA_INCREMENTVALUE),
                                  MPFROMSHORT (MaximumTicks/2));
                     return 0;
            }
         return 0;

        default:
            return (WinDefDlgProc (hwnd, msg, mp1, mp2));
    }
    return FALSE;
}
Example #4
0
File: dlg.c Project: komh/hanedit2
MRESULT EXPENTRY HEFindDlgProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
{
    switch (msg)
    {
    case WM_INITDLG:
        dlgFind_wmInitDlg(hwnd);
        break;
/*
    case WM_CHAR:
        if (dlgFind_SetButtonFocus(hwnd))
            return 0;
        break;
*/
    case WM_CONTROL:
        {
        switch (SHORT1FROMMP(mp1))
        {
        case IDHEF_FIND:
            switch( SHORT2FROMMP( mp1 ))
            {
                case HEN_CHANGE :
                    dlgFind_SetButtonFocus( hwnd );
                    break;

                case HEN_SETFOCUS :
                    WinSendMsg( WinWindowFromID( hwnd, IDHEF_FIND ),
                                HEM_SETSEL, MPFROM2SHORT( 0, -1 ), 0 );
                    WinSendMsg( WinWindowFromID( hwnd, IDHEF_FIND ), HEM_REFRESH, 0, 0 );

                    dlgFind_SetButtonFocus(hwnd);
                    break;
            }
            break;
        case IDHEF_REPLACE:
            switch( SHORT2FROMMP( mp1 ))
            {
                case HEN_CHANGE :
                    dlgFind_SetButtonFocus( hwnd );
                    break;

                case HEN_SETFOCUS :
                    WinSendMsg( WinWindowFromID( hwnd, IDHEF_REPLACE ),
                                HEM_SETSEL, MPFROM2SHORT( 0, -1 ), 0 );
                    WinSendMsg( WinWindowFromID( hwnd, IDHEF_REPLACE ), HEM_REFRESH, 0, 0 );

                    dlgFind_SetButtonFocus(hwnd);
                    break;
            }
            break;
        } // control switch
        } break;
    case WM_COMMAND:
        switch (SHORT1FROMMP(mp1))
        {
        case IDB_FIND:
            dlgFind_Find(hwnd);
            return 0;
            break;
        case IDB_REPLACE:
            dlgFind_Replace(hwnd,FALSE);
            return 0;
            break;
        case IDB_REPLACEFIND:
            dlgFind_Replace(hwnd,TRUE);
            return 0;
            break;
        case IDB_REPLACEALL:
            dlgFind_ReplaceAll(hwnd);
            return 0;
            break;
        case DID_OK:
            {
            HWND hwndHIA = (HWND)WinSendMsg(hwndHMLE,HMLM_QUERYHIA,0,0);
            WinSendMsg(hwndHIA,HIAM_CONNECT,0,0);
            #ifdef DEBUG
/*              HWND hwndFind = WinWindowFromID(hwnd,IDHEF_FIND);
                fprintf(stderr,"\n<HEF>\n");
                WinSendMsg(hwndFind,HEM_DUMP,(MPARAM)stderr,0);
                fprintf(stderr,"\n<HMLE>\n");
                WinSendMsg(hwndHMLE,HMLM_DUMP,(MPARAM)stderr,0);
*/          #endif
            }
            WinDismissDlg(hwnd,DID_OK);
            return 0;
            break;
        default:
//          printf("here\n");
//          return WinDefDlgProc(hwnd,msg,mp1,mp2);
        }
    } /* endswitch */
    return WinDefDlgProc(hwnd, msg, mp1, mp2);
}
// *******************************************************************************
// FUNCTION:     wm_command
//
// FUNCTION USE: Process WM_COMMAND messages for the dialog window
//
// DESCRIPTION:  If the OK button is clicked, retrieve information from the
//               dialog to set the new margin values.
//
// PARAMETERS:   HWND     dialog window handle
//               MPARAM   first message parameter
//               MPARAM   second message parameter
//
// RETURNS:      MRESULT  Reserved value of zero
//
// INTERNALS:    NONE
//
// *******************************************************************************
static MRESULT wm_command( HWND hwnd, MPARAM mp1, MPARAM mp2 )
{
   PSETFORM    pSetForm;

   switch (SHORT1FROMMP(mp1)) {
   case DID_OK:
// --------------------------------------------------------------------------
// User pressed the OK button - get the data pointer from instance data
// --------------------------------------------------------------------------
      pSetForm = (PSETFORM)WinQueryWindowULong( hwnd, QWL_USER );

// --------------------------------------------------------------------------
// get the selected units
// --------------------------------------------------------------------------
      pSetForm->ulUnits = (ULONG)LONGFROMMR(WinSendDlgItemMsg( hwnd,
                           CID_MEASURE, VM_QUERYSELECTEDITEM, 0L, 0L ) );

// --------------------------------------------------------------------------
// Get new margin values from the entry fields
// --------------------------------------------------------------------------
      GetEntryField( hwnd, CID_MAR_LEFT,
                     &pSetForm->rectlMargins.xLeft, pSetForm->ulUnits );
      GetEntryField( hwnd, CID_MAR_TOP,
                     &pSetForm->rectlMargins.yTop, pSetForm->ulUnits );
      GetEntryField( hwnd, CID_MAR_RIGHT,
                     &pSetForm->rectlMargins.xRight, pSetForm->ulUnits );
      GetEntryField( hwnd, CID_MAR_BOTTOM,
                     &pSetForm->rectlMargins.yBottom, pSetForm->ulUnits );

// --------------------------------------------------------------------------
// convert rectangle from current unit of measure to LO_METRIC */
// --------------------------------------------------------------------------
      if (pSetForm->ulUnits == (ULONG)VSI_INCHES) {
         pSetForm->rectlMargins.xLeft =
                                   HINTOLM( pSetForm->rectlMargins.xLeft );
         pSetForm->rectlMargins.xRight =
                                   HINTOLM( pSetForm->rectlMargins.xRight );
         pSetForm->rectlMargins.yTop =
                                   HINTOLM( pSetForm->rectlMargins.yTop );
         pSetForm->rectlMargins.yBottom =
                                   HINTOLM( pSetForm->rectlMargins.yBottom );
      } else if (pSetForm->ulUnits == (ULONG)VSI_POINTS ) {
         pSetForm->rectlMargins.xLeft =
                                   PTSTOLM( pSetForm->rectlMargins.xLeft );
         pSetForm->rectlMargins.xRight =
                                   PTSTOLM( pSetForm->rectlMargins.xRight );
         pSetForm->rectlMargins.yTop =
                                   PTSTOLM( pSetForm->rectlMargins.yTop );
         pSetForm->rectlMargins.yBottom =
                                   PTSTOLM( pSetForm->rectlMargins.yBottom );
      } else {
         pSetForm->rectlMargins.xLeft =
                                   MMTOLM( pSetForm->rectlMargins.xLeft );
         pSetForm->rectlMargins.xRight =
                                   MMTOLM( pSetForm->rectlMargins.xRight );
         pSetForm->rectlMargins.yTop =
                                   MMTOLM( pSetForm->rectlMargins.yTop );
         pSetForm->rectlMargins.yBottom =
                                   MMTOLM( pSetForm->rectlMargins.yBottom );
      } /* endif */

// --------------------------------------------------------------------------
// Indicate successful completion
// --------------------------------------------------------------------------
      WinDismissDlg( hwnd, TRUE );

// --------------------------------------------------------------------------
// return appropriate value
// --------------------------------------------------------------------------
      return (MRESULT)0L;

   case DID_CANCEL:
// --------------------------------------------------------------------------
// CANCEL pressed - indicate unsuccessful completion.
// --------------------------------------------------------------------------
      WinDismissDlg( hwnd, FALSE );

// --------------------------------------------------------------------------
// return appropriate value
// --------------------------------------------------------------------------
      return (MRESULT)0L;

   default:
      return WinDefDlgProc( hwnd, WM_COMMAND, mp1, mp2 );
   } /* endswitch */
}
Example #6
0
//A Dlg procedure if the plugin has selectable settings.
MRESULT EXPENTRY CBZPluginSetupDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
    short sControlId;
    PLUGINSHARE *pPluginData;
    HOBJECT  hObject;

    switch (msg)
    {
        case WM_INITDLG:
        {
            short sInsertItem;/*to insert in ListBox*/
            CHAR	*szLineStyles [] =
                  {"dotted","short-dashed","dash-dot",
                  "double-dotted","long-dashed","dash-double-dot",
                  "solid","invisible","alternate pels" };

            if ((pPluginData = (PLUGINSHARE *) mp2) == NULL)
            {
                //Error message..
                WinDismissDlg(hwnd, DID_ERROR);
                return (MRFROMLONG(FALSE));
            }
            WinSetWindowPtr(hwnd, QWL_USER, pPluginData);  // store window words

            WinSetPresParam(WinWindowFromID(hwnd, PBID_ACTIVELINECOLOR),
                            PP_BACKGROUNDCOLOR,
                            (ULONG) sizeof(pPluginData->lActiveLineColor),
                            (PVOID) & (pPluginData->lActiveLineColor));
            WinSetPresParam(WinWindowFromID(hwnd, PBID_ACTIVESHADOWCOLOR),
                            PP_BACKGROUNDCOLOR,
                            (ULONG) sizeof(pPluginData->lActiveShadowColor),
                            (PVOID) & (pPluginData->lActiveShadowColor));
            WinSetPresParam(WinWindowFromID(hwnd, PBID_INACTIVELINECOLOR),
                            PP_BACKGROUNDCOLOR,
                            (ULONG) sizeof(pPluginData->lInactiveLineColor),
                            (PVOID) & (pPluginData->lInactiveLineColor));
            WinSetPresParam(WinWindowFromID(hwnd, PBID_INACTIVESHADOWCOLOR),
                            PP_BACKGROUNDCOLOR,
                          (ULONG) sizeof(pPluginData->lInactiveShadowColor),
                            (PVOID) & (pPluginData->lInactiveShadowColor));

            if (pPluginData->bActiveEnabled)
            {
                WinCheckButton(hwnd, CBID_ACTIVEENABLED, TRUE);
                WinEnableWindow(WinWindowFromID(hwnd, PBID_ACTIVELINECOLOR), TRUE);
                WinEnableWindow(WinWindowFromID(hwnd, PBID_ACTIVESHADOWCOLOR), TRUE);
            }
            else
            {
                WinCheckButton(hwnd, CBID_ACTIVEENABLED, FALSE);
                WinEnableWindow(WinWindowFromID(hwnd, PBID_ACTIVELINECOLOR), FALSE);
                WinEnableWindow(WinWindowFromID(hwnd, PBID_ACTIVESHADOWCOLOR), FALSE);
            }
            if (pPluginData->bInactiveEnabled)
            {
                WinCheckButton(hwnd, CBID_INACTIVEENABLED, TRUE);
                WinEnableWindow(WinWindowFromID(hwnd, PBID_INACTIVELINECOLOR), TRUE);
                WinEnableWindow(WinWindowFromID(hwnd, PBID_INACTIVESHADOWCOLOR), TRUE);
            }
            else
            {
                WinCheckButton(hwnd, CBID_INACTIVEENABLED, FALSE);
                WinEnableWindow(WinWindowFromID(hwnd, PBID_INACTIVELINECOLOR), FALSE);
                WinEnableWindow(WinWindowFromID(hwnd, PBID_INACTIVESHADOWCOLOR), FALSE);
            }
            /*there are 9 line styles*/
            for (sInsertItem=0; sInsertItem < 9; sInsertItem++)
            {
            WinSendDlgItemMsg (hwnd, LBID_LINESTYLE, LM_INSERTITEM, MPFROMSHORT (LIT_END), szLineStyles [sInsertItem]);
            }
            WinSendDlgItemMsg (hwnd, LBID_LINESTYLE, LM_SELECTITEM, MPFROMSHORT(pPluginData->lLineStyle-1), MPFROMSHORT(TRUE));

        }
        break;

        case WM_COMMAND:
        {
            sControlId = COMMANDMSG(&msg)->cmd;

            switch (sControlId)
            {
                case PBID_ACTIVELINECOLOR:
                case PBID_ACTIVESHADOWCOLOR:
                case PBID_INACTIVELINECOLOR:
                case PBID_INACTIVESHADOWCOLOR:
                {
                  // Open the colorpalette 
                  hObject=WinQueryObject("<WP_HIRESCLRPAL>");
                  if((hObject=WinQueryObject("<WP_HIRESCLRPAL>"))!=NULLHANDLE) {
                    WinOpenObject(hObject, OPEN_DEFAULT ,TRUE);
                  }
                  else {//Error, can't open the palette
                    /*  Show an error msg.						   */
                    WinMessageBox(HWND_DESKTOP,
                                  hwnd,         
                                  "Can't open color palette",          
                                  "Gradient plugin",                      
                                  12345,            /* Window ID */
                                  MB_OK |
                                  MB_MOVEABLE |
                                  MB_ICONEXCLAMATION |
                                  MB_DEFBUTTON1);                  /* Style     */
                  }
                  
                  /*    long lColor;
                        
                        if (sControlId == PBID_ACTIVELINECOLOR)
                        {
                        if (CBZGetColor(hwnd, &lColor))
                        {
                        WinSetPresParam(WinWindowFromID(hwnd, PBID_ACTIVELINECOLOR),
                        PP_BACKGROUNDCOLOR,
                        (ULONG) sizeof(lColor),
                        (PVOID) &lColor );
                        }
                        }
                        else if (sControlId == PBID_ACTIVESHADOWCOLOR)
                        {
                        if (CBZGetColor(hwnd, &lColor))
                        {
                        WinSetPresParam(WinWindowFromID(hwnd, PBID_ACTIVESHADOWCOLOR),
                        PP_BACKGROUNDCOLOR,
                        (ULONG) sizeof(lColor),
                        (PVOID) &lColor );
                        }
                        }
                        else if (sControlId == PBID_INACTIVELINECOLOR)
                        {
                        if (CBZGetColor(hwnd, &lColor))
                        {
                        WinSetPresParam(WinWindowFromID(hwnd, PBID_INACTIVELINECOLOR),
                        PP_BACKGROUNDCOLOR,
                        (ULONG) sizeof(lColor),
                        (PVOID) &lColor );
                        }
                        }
                        else if (sControlId == PBID_INACTIVESHADOWCOLOR)
                        {
                        if (CBZGetColor(hwnd, &lColor))
                        {
                        WinSetPresParam(WinWindowFromID(hwnd, PBID_INACTIVESHADOWCOLOR),
                        PP_BACKGROUNDCOLOR,
                        (ULONG) sizeof(lColor),
                        (PVOID) &lColor );
                        }
                        }*/
                }
                break;
                
                case PBID_OK:
                {
                    ULONG attrFound;

                    if ((pPluginData = (PLUGINSHARE *) WinQueryWindowPtr(hwnd, QWL_USER)) == NULL)
                    {
                        //error message here.
                        break;
                    }

                    WinQueryPresParam(WinWindowFromID(hwnd, PBID_ACTIVELINECOLOR),
                                        PP_BACKGROUNDCOLOR, 0,
                                        &attrFound, sizeof(attrFound),
                                        &(pPluginData->lActiveLineColor), QPF_PURERGBCOLOR);


                    WinQueryPresParam(WinWindowFromID(hwnd, PBID_ACTIVESHADOWCOLOR),
                                        PP_BACKGROUNDCOLOR, 0,
                                        &attrFound, sizeof(attrFound),
                                        &(pPluginData->lActiveShadowColor), QPF_PURERGBCOLOR);

                    WinQueryPresParam(WinWindowFromID(hwnd, PBID_INACTIVELINECOLOR),
                                        PP_BACKGROUNDCOLOR, 0,
                                        &attrFound, sizeof(attrFound),
                                        &(pPluginData->lInactiveLineColor), QPF_PURERGBCOLOR);

                    WinQueryPresParam(WinWindowFromID(hwnd, PBID_INACTIVESHADOWCOLOR),
                                        PP_BACKGROUNDCOLOR, 0,
                                        &attrFound, sizeof(attrFound),
                                        &(pPluginData->lInactiveShadowColor), QPF_PURERGBCOLOR);


                    if ( WinQueryButtonCheckstate(hwnd, CBID_ACTIVEENABLED) )
                        pPluginData->bActiveEnabled = TRUE;
                    else
                        pPluginData->bActiveEnabled = FALSE;

                    if ( WinQueryButtonCheckstate(hwnd, CBID_INACTIVEENABLED) )
                        pPluginData->bInactiveEnabled = TRUE;
                    else
                        pPluginData->bInactiveEnabled = FALSE;
                    
	                 pPluginData->lLineStyle = 1 + (LONG) WinSendDlgItemMsg (hwnd, LBID_LINESTYLE, LM_QUERYSELECTION, (MPARAM) 0, NULL);

                    //update!
                    WinDismissDlg(hwnd, PBID_OK);
                }
                break;

                case PBID_CANCEL:
                {
                    //don't update shared Memory!
                    WinDismissDlg(hwnd, PBID_CANCEL);
                }
                break;
            }
            return ((MPARAM) 0);
        }
        break;

        case WM_CONTROL:
        {
            switch (SHORT1FROMMP(mp1))
            {
                case CBID_ACTIVEENABLED:
                {
                    // if Enabled
                    if (!WinQueryButtonCheckstate(hwnd, CBID_ACTIVEENABLED))
                    {
                        // check button
                        WinCheckButton(hwnd, CBID_ACTIVEENABLED, TRUE);
                        WinEnableWindow(WinWindowFromID(hwnd, PBID_ACTIVELINECOLOR), TRUE);
                        WinEnableWindow(WinWindowFromID(hwnd, PBID_ACTIVESHADOWCOLOR), TRUE);
                    }
                    else
                    {
                        // uncheck button
                        WinCheckButton(hwnd, CBID_ACTIVEENABLED, FALSE);
                        WinEnableWindow(WinWindowFromID(hwnd, PBID_ACTIVELINECOLOR), FALSE);
                        WinEnableWindow(WinWindowFromID(hwnd, PBID_ACTIVESHADOWCOLOR), FALSE);
                    }
                }
                break;

                case CBID_INACTIVEENABLED:
                {
                    // if Enabled
                    if (!WinQueryButtonCheckstate(hwnd, CBID_INACTIVEENABLED))
                    {
                        // check button
                        WinCheckButton(hwnd, CBID_INACTIVEENABLED, TRUE);
                        WinEnableWindow(WinWindowFromID(hwnd, PBID_INACTIVELINECOLOR), TRUE);
                        WinEnableWindow(WinWindowFromID(hwnd, PBID_INACTIVESHADOWCOLOR), TRUE);
                    }
                    else
                    {
                        // uncheck button
                        WinCheckButton(hwnd, CBID_INACTIVEENABLED, FALSE);
                        WinEnableWindow(WinWindowFromID(hwnd, PBID_INACTIVELINECOLOR), FALSE);
                        WinEnableWindow(WinWindowFromID(hwnd, PBID_INACTIVESHADOWCOLOR), FALSE);
                    }
                }
                break;
            }
            return ((MRESULT) 0);
        }
        break;

    }
    return (WinDefDlgProc(hwnd, msg, mp1, mp2));
}
Example #7
0
BOOL CALLBACK CDialogDlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
#endif
{
   int i;
   class CDialog *dlgClass;
   CPC_MSGMAP_ENTRY *msgMap = NULL;

#if defined(__OS2__)
   dlgClass = (class CDialog *)WinQueryWindowULong (hwnd, QWL_USER);
#elif defined(__NT__)
   dlgClass = (class CDialog *)GetWindowLong (hwnd, GWL_USERDATA);
#endif

   if (dlgClass != NULL) {
      dlgClass->m_msg = msg;
#if defined(__OS2__)
      dlgClass->m_mp1 = mp1;
      dlgClass->m_mp2 = mp2;
#elif defined(__NT__)
      dlgClass->m_wParam = wParam;
      dlgClass->m_lParam = lParam;
#endif

      msgMap = dlgClass->GetMessageMap ();
   }

   switch (msg) {
#if defined(__OS2__)
      case WM_INITDLG: {
         CDIALOG_DATA *cData = (CDIALOG_DATA *)mp2;
#elif defined(__NT__)
      case WM_INITDIALOG: {
         CDIALOG_DATA *cData = (CDIALOG_DATA *)lParam;
#endif

         dlgClass = cData->Dlg;
         dlgClass->m_hWnd = hwnd;
         dlgClass->lv_Selected = -1;
#if defined(__OS2__)
         WinSetWindowULong (hwnd, QWL_USER, (ULONG)dlgClass);
#elif defined(__NT__)
         SetWindowLong (hwnd, GWL_USERDATA, (LONG)dlgClass);
#endif

         dlgClass->OnInitDialog ();
#if defined(__OS2__)
         break;
#elif defined(__NT__)
         return ((BOOL)TRUE);
#endif
      }

#if defined(__OS2__)
      case WM_CONTROL:
         for (i = 0; msgMap[i].pfn != NULL; i++) {
            if (msgMap[i].nMessage == msg) {
               if (msgMap[i].nID >= SHORT1FROMMP (mp1) && msgMap[i].nLastID <= SHORT1FROMMP (mp1)) {
                  if (msgMap[i].nCode == SHORT2FROMMP (mp1)) {
                     (dlgClass->*msgMap[i].pfn) ();
                     break;
                  }
               }
            }
         }
         return (0);
#endif

#if defined(__NT__)
      case WM_NOTIFY: {
         LPNMHDR pnmh = (LPNMHDR)lParam;
         NM_LISTVIEW *pnmv = (NM_LISTVIEW *)lParam;

         if (pnmh->code == NM_DBLCLK)
            dlgClass->OnOK ();
         else if (pnmh->code == LVN_ITEMCHANGED) {
            if (!(pnmv->uNewState & LVIS_SELECTED) && (pnmv->uOldState & LVIS_SELECTED))
               dlgClass->lv_Selected = -1;
            if (pnmv->uNewState & LVIS_SELECTED)
               dlgClass->lv_Selected = (SHORT)pnmv->iItem;
         }
         else {
            for (i = 0; msgMap[i].pfn != NULL; i++) {
               if (msgMap[i].nMessage == msg && msgMap[i].nCode == pnmh->code) {
                  if (msgMap[i].nID >= pnmh->idFrom && msgMap[i].nLastID <= pnmh->idFrom) {
                     (dlgClass->*msgMap[i].pfn) ();
                     break;
                  }
               }
            }
         }
         return (0);
      }
#endif

#if defined(__OS2__)
      case WM_CHAR:
         if (SHORT1FROMMP (mp1) & KC_VIRTUALKEY && SHORT2FROMMP (mp2) == VK_F1)
            dlgClass->OnHelp ();
         break;
#endif

      case WM_HELP:
         dlgClass->OnHelp ();
         break;
/*
#if defined(__OS2__)
      case WM_HELP: {
         USHORT id;
         HWND hwndHelpInstance;

         id = WinQueryWindowUShort (hwnd, QWS_ID);
         hwndHelpInstance = WinQueryHelpInstance (dlgClass->owner_hWnd);
         WinSendMsg (hwndHelpInstance, HM_DISPLAY_HELP, MPFROM2SHORT (id, 0), MPFROMSHORT (HM_RESOURCEID));
         break;
      }
#endif
*/

      case WM_COMMAND:
#if defined(__OS2__)
         switch (SHORT1FROMMP (mp1)) {
#elif defined(__NT__)
         switch (LOWORD (wParam)) {
#endif
            case IDOK:
               dlgClass->OnOK ();
               break;
            case IDCANCEL:
               dlgClass->OnCancel ();
               break;
            case IDHELP:
               dlgClass->OnHelp ();
               break;
            default:
               for (i = 0; msgMap[i].pfn != NULL; i++) {
#if defined(__OS2__)
                  if (msgMap[i].nMessage == msg) {
                     if (msgMap[i].nID >= SHORT1FROMMP (mp1) && msgMap[i].nLastID <= SHORT1FROMMP (mp1)) {
#elif defined(__NT__)
                  if (msgMap[i].nMessage == msg && msgMap[i].nCode == HIWORD (wParam)) {
                     if (msgMap[i].nID >= LOWORD (wParam) && msgMap[i].nLastID <= LOWORD (wParam)) {
#endif
                        (dlgClass->*msgMap[i].pfn) ();
                        break;
                     }
                  }
               }
               break;
         }
         return (0);

#if defined(__NT__)
      case WM_CLOSE:
         EndDialog (hwnd, FALSE);
         break;
#endif

      default:
         if (msgMap != NULL) {
            for (i = 0; msgMap[i].pfn != NULL; i++) {
               if (msgMap[i].nMessage == msg) {
                  (dlgClass->*msgMap[i].pfn) ();
                  return (0);
               }
            }
         }
         break;
   }

#if defined(__OS2__)
   return (WinDefDlgProc (hwnd, msg, mp1, mp2));
#elif defined(__NT__)
   return ((BOOL)FALSE);
#endif
}

CDialog::CDialog (PSZ dialogTemplate, HWND p_hWnd)
{
   strcpy (dlgTemplate, dialogTemplate);
   owner_hWnd = p_hWnd;
   help_hWnd = NULL;
#if defined(__OS2__)
   WinSetPointer (HWND_DESKTOP, WinQuerySysPointer (HWND_DESKTOP, SPTR_WAIT, FALSE));
#elif defined(__NT__)
#endif
}

CDialog::~CDialog ()
{
#if defined(__OS2__)
   if (help_hWnd != NULL)
      WinDestroyHelpInstance (help_hWnd);
#elif defined(__NT__)
#endif
}

VOID CDialog::Center ()
{
#if defined(__OS2__)
   RECTL rc;
#elif defined(__NT__)
   RECT rc;
#endif

#if defined(__OS2__)
   WinQueryWindowRect (m_hWnd, &rc);
   rc.yTop = (WinQuerySysValue (HWND_DESKTOP, SV_CYSCREEN) - (rc.yTop - rc.yBottom)) / 2;
   rc.xLeft = (WinQuerySysValue (HWND_DESKTOP, SV_CXSCREEN) - (rc.xRight - rc.xLeft)) / 2;
   WinSetWindowPos (m_hWnd, NULL, rc.xLeft, rc.yTop, 0, 0, SWP_MOVE);
#elif defined(__NT__)
   GetWindowRect (m_hWnd, &rc);
   rc.top = (GetSystemMetrics (SM_CYSCREEN) - (rc.bottom - rc.top)) / 2;
   rc.left = (GetSystemMetrics (SM_CXSCREEN) - (rc.right - rc.left)) / 2;
   SetWindowPos (m_hWnd, NULL, rc.left, rc.top, 0, 0, SWP_NOSIZE|SWP_NOZORDER);
#endif
}

LONG CDialog::DoModal ()
{
   LONG ulResult = 0L;
   CDIALOG_DATA cDialog;

   cDialog.cbSize = sizeof (CDIALOG_DATA);
   cDialog.Dlg = this;

#if defined(__OS2__)
   WinSetPointer (HWND_DESKTOP, WinQuerySysPointer (HWND_DESKTOP, SPTR_ARROW, FALSE));
   ulResult = WinDlgBox (HWND_DESKTOP, owner_hWnd, CDialogDlgProc, NULLHANDLE, atoi (dlgTemplate), &cDialog);
#elif defined(__NT__)
   ulResult = DialogBoxParam (hinst, MAKEINTRESOURCE (atoi (dlgTemplate)), owner_hWnd, (DLGPROC)CDialogDlgProc, (LPARAM)&cDialog);
#endif

   return (ulResult);
}

// ----------------------------------------------------------------------
// Windowing API replacement
// ----------------------------------------------------------------------

VOID CDialog::EndDialog (USHORT Result)
{
#if defined(__OS2__)
   WinDismissDlg (m_hWnd, Result);
#elif defined(__NT__)
   ::EndDialog (m_hWnd, Result);
#endif
}

VOID CDialog::GetDlgItemText (int id, PSZ text, USHORT size)
{
#if defined(__OS2__)
   WinQueryDlgItemText (m_hWnd, id, size, text);
#elif defined(__NT__)
   ::GetDlgItemText (m_hWnd, id, text, size);
#endif
}

VOID CDialog::GetDlgItemText (int id, USHORT size, PSZ text)
{
#if defined(__OS2__)
   WinQueryDlgItemText (m_hWnd, id, size, text);
#elif defined(__NT__)
   ::GetDlgItemText (m_hWnd, id, text, size);
#endif
}
Example #8
0
MRESULT EXPENTRY fnwpNotifyDlg(HWND hwnd,USHORT msg,MPARAM mp1,MPARAM mp2)
  {
  static MSG *pMessage;
  NOTIFYLST *pNotify;
  ULONG ulSubNumber;
  ULONG ulGroupNumber;
  int iMsgLen;
  USHORT usLength;
  USHORT usSubCount;
  ULONG *pulSubNum;
  char szMessage[80];
  int iIndex;
  static TID tid;
  BYTE *pData;

  switch (msg)
    {
    case WM_INITDLG:
      pMessage = (MSG *)mp2;
      bNotifyLoop = FALSE;
      WinSendDlgItemMsg(hwnd,NOTIFY_SUB_NUMBER,
                                SPBM_SETLIMITS,
                                (MPARAM)usSubscriberListCount,
                                (MPARAM)1);
      WinSendDlgItemMsg(hwnd,NOTIFY_MESSAGE,MLM_FORMAT,(MPARAM)MLFIE_WINFMT,(MPARAM)NULL);
      break;
    case WM_COMMAND:
      switch(SHORT1FROMMP(mp1))
        {
        case DID_OK:
          if (bNotifyLoop)
            break;
          WinSendDlgItemMsg(hwnd,NOTIFY_SUB_NUMBER,SPBM_QUERYVALUE,&ulSubNumber,MPFROM2SHORT(0,SPBQ_DONOTUPDATE));
          iMsgLen = WinQueryDlgItemTextLength(hwnd,NOTIFY_MESSAGE);
//          iMsgLen = (int)WinSendDlgItemMsg(hwnd,NOTIFY_MESSAGE,MLM_QUERYTEXTLENGTH,(MPARAM)NULL,(MPARAM)NULL);
          if (iMsgLen <= 0)
            {
            sprintf(szMessage,"Message is too short, length = %u",iMsgLen);
            MessageBox(hwnd,szMessage);
            break;
            }
          if (astSubList[ulSubNumber].usMaxMsgLen < iMsgLen)
            {
            sprintf(szMessage,"Message is to long for defined subscriber, remove at least %u characters.",(iMsgLen - astSubList[ulSubNumber].usMaxMsgLen));
            MessageBox(hwnd,szMessage);
            break;
            }
          pNotify = (NOTIFYLST *)&pMessage->byData;
          pNotify->usSubCount = 1;
          pNotify->usGroupCount = 0;
          pNotify->usMsgLen = (USHORT)iMsgLen;
          pData = &pNotify->byData;
          iMsgLen = WinQueryDlgItemText(hwnd,NOTIFY_MESSAGE,(iMsgLen + 1),pData);
          pulSubNum = (ULONG *)(pData + iMsgLen);
          usSubCount = 0;
          for (iIndex = 0;iIndex < pNotify->usSubCount;iIndex++)
            {
            usSubCount++;
            *pulSubNum = (ULONG)ulSubNumber;
            pulSubNum++;
            }
          for (iIndex = 0;iIndex < pNotify->usGroupCount;iIndex++)
            {
            usSubCount++;
            *pulSubNum = (ULONG)ulGroupNumber;
            pulSubNum++;
            }
          usLength = ((sizeof(ULONG) * usSubCount) + (USHORT)iMsgLen);
          pMessage->cbDataSize = (usLength + sizeof(NOTIFYLST) - 1);
          if (Checked(hwnd,NOTIFY_CONTINUOUSLY))
            {
            pMessage->fMessageType = REQ_NOTIFY;
            pMessage->cbSize = (pMessage->cbDataSize + sizeof(MSG) - 1);
            bNotifyLoop = TRUE;
            pNotifyLoopMsg = pMessage;
            DosCreateThread(&tid,(PFNTHREAD)NotifyLoopThread,(ULONG)pMessage,0,8192);
            }
          else
            WinDismissDlg(hwnd,TRUE);
          break;
        case DID_CANCEL:
          if (bNotifyLoop)
            DosKillThread(tid);
          WinDismissDlg(hwnd,FALSE);
          break;
        default:
          return(WinDefDlgProc(hwnd,msg,mp1,mp2));
        }
      break;
    default:
      return(WinDefDlgProc(hwnd,msg,mp1,mp2));
    }
  return(FALSE);
  }
/****************************************************************************
 * KeyDlgProc								    *
 *  - Redefines keys by processing WM_CHAR's and assigning the key to the   *
 *	selected radiobutton (game key) 				    *
 *  - Standard dialog window I/O                                            *
 ****************************************************************************/
MRESULT EXPENTRY KeyDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
	   int	 i;
    static KEY	 keyTmp[KEYS];
    static SHORT id;

    switch (msg) {
      case WM_INITDLG:
	/* Set the associated text for each of the radio buttons */
	for (i=0;i<KEYS;i++) {
	    keyTmp[i] = prfProfile.keyDEFS[i];
	    SetText(hwnd, TEXT_LEFT+i, &prfProfile.keyDEFS[i]);
	    }

	/* Check the first radio button and let it set up id */
	WinSendDlgItemMsg(hwnd, KEY_LEFT, BM_CLICK, MPFROMSHORT(TRUE), MPVOID);

	return (MRESULT) TRUE;

      case WM_HELP:
      	i = IDH_KEYS;
      	WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
          	   MPFROMP(&i), MPFROMSHORT(HM_RESOURCEID));
        return 0;
        
      case WM_COMMAND:
	switch (SHORT1FROMMP(mp1)) {
	  case DID_OK:
	    for (i=0;i<KEYS;i++)
		prfProfile.keyDEFS[i] = keyTmp[i];
	  case DID_CANCEL:
            WinDismissDlg(hwnd, 0);
            return 0;
          }
	return 0;

      case WM_CONTROL:
	if (SHORT2FROMMP(mp1) == BN_CLICKED) {
	    switch (SHORT1FROMMP(mp1)) {
	      case KEY_LEFT:
		id = TEXT_LEFT;
		break;
	      case KEY_RIGHT:
		id = TEXT_RIGHT;
		break;
	      case KEY_THRUST:
		id = TEXT_THRUST;
		break;
	      case KEY_HYPER:
		id = TEXT_HYPER;
		break;
	      case KEY_FIRE:
		id = TEXT_FIRE;
		break;
	      case KEY_SHIELD:
		id = TEXT_SHIELD;
	      }

	    WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd,id));
	    }
	return 0;

      case WM_CHAR:
	if (!(CHARMSG(&msg)->fs & KC_KEYUP)) {
	    if ((CHARMSG(&msg)->fs & KC_VIRTUALKEY) &&
		(CHARMSG(&msg)->vkey != VK_SHIFT) &&
		(CHARMSG(&msg)->vkey != VK_CTRL) &&
		(CHARMSG(&msg)->vkey != VK_ALT) &&
		(CHARMSG(&msg)->vkey != VK_F1) &&
		(CHARMSG(&msg)->vkey-1 < MAXVKEY)) {
                if (CHARMSG(&msg)->vkey == VK_F3) {
                    WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(DID_CANCEL, 0),
                    	       MPVOID);
                    return 0;
                }
		keyTmp[id-TEXT_LEFT].vk  = (CHAR) (CHARMSG(&msg)->vkey - 1);
		keyTmp[id-TEXT_LEFT].chr = 0;
		}
	    else if ((CHARMSG(&msg)->fs & KC_CHAR) &&
		     (CHARMSG(&msg)->chr > 32)	   &&
		     (CHARMSG(&msg)->chr < 127)) {
		keyTmp[id-TEXT_LEFT].vk = 0;
		keyTmp[id-TEXT_LEFT].chr = (CHAR) CHARMSG(&msg)->chr;
		}
	    else {
		keyTmp[id-TEXT_LEFT].vk = 0;
		keyTmp[id-TEXT_LEFT].chr = 0;
		}
	    }

	SetText(hwnd, id, &keyTmp[id-TEXT_LEFT]);
	return 0;

      }
    return WinDefDlgProc(hwnd, msg, mp1, mp2);
}
static MRESULT EXPENTRY _bootCDOptionsDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
  CWDataFolder* thisPtr;
  FILEDLG fd = { 0 };
  /* char text[CCHMAXPATH];*/
  char title[CCHMAXPATH];
  ULONG rc;
  THISPTR *tpPtr;

  switch(msg)
    {
    case WM_INITDLG :	
      tpPtr=(THISPTR*)PVOIDFROMMP(mp2);
      thisPtr=(CWDataFolder*)tpPtr->thisPtr;

      /*    sprintf(text,"tpPtr: %x thisPtr: %x",tpPtr,thisPtr);
            WinMessageBox(  HWND_DESKTOP, hwnd,
            text,"2", 0UL, MB_OK | MB_ERROR |MB_MOVEABLE); */

      WinSetWindowULong(WinWindowFromID(hwnd,IDPB_OK),
                        QWL_USER,(ULONG)thisPtr);//Save object ptr.
              
      if(somIsObj(thisPtr)) {        
        WinSetWindowText( WinWindowFromID(hwnd,IDEF_BOOTIMAGE), thisPtr->chrBootImage );
        WinSetWindowText( WinWindowFromID(hwnd,IDEF_BOOTCATALOG), thisPtr->chrBootCatalog );
      }
      break;
    case WM_CLOSE:
      WinDismissDlg(hwnd,0);
      return FALSE;
    case WM_COMMAND:
      switch(SHORT1FROMMP(mp1))
        {
        case IDPB_OK:
          /* User pressed the OK button */
          thisPtr=(CWDataFolder*)WinQueryWindowULong(WinWindowFromID(hwnd,IDPB_OK),QWL_USER);
          if(somIsObj(thisPtr)) {
            WinQueryWindowText(WinWindowFromID(hwnd,IDEF_BOOTIMAGE),sizeof(thisPtr->chrBootImage),thisPtr->chrBootImage);
            WinQueryWindowText(WinWindowFromID(hwnd,IDEF_BOOTCATALOG),sizeof(thisPtr->chrBootCatalog),thisPtr->chrBootCatalog);
          }
          WinDismissDlg(hwnd,DID_OK);
          return (MRESULT) FALSE;          
        case IDPB_CANCEL:
          WinDismissDlg(hwnd,0);
          return FALSE;
        case IDPB_BROWSE:
          /* User pressed the browse button */
          fd.cbSize = sizeof( fd );
          /* It's an centered 'Open'-dialog */
          fd.fl = FDS_OPEN_DIALOG|FDS_CENTER;
          /* Title: "Select boot image" */
          getMessage(title,IDSTR_FDLGSEARCHBOOTIMGTITLE,sizeof(title), hDataResource,hwnd);
          /* Set the title of the file dialog */
          fd.pszTitle = title;
          /* Show all files */
          sprintf(fd.szFullFile,"%s","*.*");
          if( WinFileDlg( HWND_DESKTOP, hwnd, &fd ) == NULLHANDLE )
            {
              /* WinFileDlg failed */
              break;
            }
          if( fd.lReturn == DID_OK )
            {
              WinSetWindowText( WinWindowFromID(hwnd,IDEF_BOOTIMAGE), fd.szFullFile );
            }
          break;
        default:
          break;
        }
      return (MRESULT) TRUE;
    default:
      break;
    }
  return WinDefDlgProc(hwnd, msg, mp1, mp2); 
}
Example #11
0
/**********************************************************************
 * Function: TgtSelDlgProc
 * Info    : dialog event handler for target file selection
 * Result  : TRUE or FALSE
 **********************************************************************/
MRESULT EXPENTRY TgtSelDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{

 static PFILEDLG pFileDlg2;
 CHAR Buffer[CCHMAXPATH+100];
 CHAR FileBuffer[CCHMAXPATH];
 CHAR PathBuffer3[CCHMAXPATH];
 CHAR Title[TITLESTRN_MAXLEN+1];
 BOOL SignedFile;

 MRESULT rc = FALSE;

 switch (msg)
 {

   case WM_INITDLG:
      CenterWindow(hwnd);
      pFileDlg2 = (PFILEDLG) WinQueryWindowULong(hwnd, QWL_USER);
    break;

   case WM_HELP:
     DisplayHelp(IDL_TGTFILE_HELP);
    break;

   case WM_COMMAND:
    switch(SHORT1FROMMP(mp1))
    {
      case DID_OK:
        strcpy(PathBuffer3, pFileDlg2->szFullFile);
        WinQueryWindowText(WinWindowFromID(hwnd, DID_FILENAME_ED),
                           sizeof(FileBuffer),
                           FileBuffer);
        strcat(PathBuffer3, FileBuffer);
        SignedFile = IsSignature(JobDesc.SourceFile);
        if (!SignedFile ||
            (SignedFile && !IsDetachedSignature)
           )
        {
          if(FileExist(PathBuffer3))
          {
            Len = WinLoadString(Hab, hRessourceModule, IDS_QUERY_TARGET_OVERWRITE,
                                MSGSTRN_MAXLEN, Msg);
            Len = WinLoadString(Hab, hRessourceModule, IDS_BUBBLE_DECVERIFYDATA_HELP,
                                TITLESTRN_MAXLEN, Title);
            sprintf(Buffer, Msg, PathBuffer3);
            if (MBID_YES == WinMessageBox(HWND_DESKTOP, hwnd,
                                          Buffer, "", 0, MB_ICONQUESTION | MB_YESNO))
            {
              if (0 == remove(PathBuffer3))
              {
               strcpy(pFileDlg2->szFullFile, PathBuffer3);
               pFileDlg2->lReturn = DID_OK;
               WinDismissDlg(hwnd, TRUE);
               return (MRESULT) TRUE;
              }
              pFileDlg2->lReturn = DID_CANCEL;
            }
            return (MRESULT) FALSE;
          }
        }
        else
        {
          /*
           * source file is a detached signature file that is to
           * be checked against the outfile, so there's no need to
           * query for outfile overwrite allowance
           */
          strcpy(pFileDlg2->szFullFile, PathBuffer3);
          pFileDlg2->lReturn = DID_OK;
          WinDismissDlg(hwnd, TRUE);
          return (MRESULT) TRUE;
        }
      /* fall through! */
    }

   default:
     rc = WinDefFileDlgProc (hwnd, msg, mp1, mp2);
 }

 return rc;

}
MRESULT EXPENTRY MimeDlgProc(HWND hwndDlg,ULONG msg,MPARAM mp1,MPARAM mp2)
{
    HPOINTER  hptrOrig, hptrWait;
    static int num_entries;
    static int entry;
    static FILE *in;
    static Container *list;
    static MimeSet *mimes;
    UserData *ud;
    char buffer[1024];
    int i;
    
    switch(msg)
    {
        
        case WM_INITDLG:
            hptrWait = WinQuerySysPointer( HWND_DESKTOP, SPTR_WAIT, FALSE );
            hptrOrig = WinQueryPointer( HWND_DESKTOP );
            WinSetPointer( HWND_DESKTOP, hptrWait );
            
            WinSendMsg(WinWindowFromID(hwndDlg,MIME_NAME),EM_SETTEXTLIMIT,MPFROMSHORT(128),MPFROMSHORT(0));
            WinSendMsg(WinWindowFromID(hwndDlg,MIME_EXT), EM_SETTEXTLIMIT,MPFROMSHORT(128),MPFROMSHORT(0));
            WinSendMsg(WinWindowFromID(hwndDlg,MIME_EXE), EM_SETTEXTLIMIT,MPFROMSHORT(128),MPFROMSHORT(0));
            
            mimes = (MimeSet*)mp2;
            list = new Container();
            list->initialise(hwndDlg,MIME_CONT);
            
            num_entries = mimes->getSetNum();
            for (i=0; i<num_entries; i++)
            {
                sprintf(buffer,"%s: %s",mimes->getName(i),mimes->getExtensions(i));
//                message("%d/%d %s is %s",i,num_entries,mimes->getName(i),mimes->getExtensions(i));
                
                list->insert(buffer,(UserData*)NULL,8888L,8888L);
            }
            
            WinFocusChange(HWND_DESKTOP,WinWindowFromID(hwndDlg,MIME_CONT),0);
            
            WinSetWindowText(WinWindowFromID(hwndDlg,MIME_NAME),mimes->getName(mimes->getSetNum()-1));
            WinSetWindowText(WinWindowFromID(hwndDlg,MIME_EXT),mimes->getExtensions(mimes->getSetNum()-1));
            WinSetWindowText(WinWindowFromID(hwndDlg,MIME_EXE),mimes->getCommand(mimes->getSetNum()-1));
            list->setItemFocus(list->getLastInsert());
            
            WinSetPointer( HWND_DESKTOP, hptrOrig );
            
            entry = -1;
            break;
            
        case WM_HELP:
            showHelpWindow(HELP_MIMES);
            break;
            
            
        case WM_CLOSE:
            mimes->reload();
            delete list;
            return WinDefDlgProc(hwndDlg,msg,mp1,mp2);
            
        case WM_USER:
            list->arrange();
            break;
            
        case WM_CONTROL:
            switch(SHORT2FROMMP(mp1))
            {
                
                case CN_HELP:
                    WinSendMsg(hwndDlg,WM_HELP,0,0);
                    break;
                    
                // sent every time emphasis of an object is changed, so if
                // change from A to B, get deselect on A, and select on B
                case CN_EMPHASIS:
                {
                    PNOTIFYRECORDEMPHASIS nre = (PNOTIFYRECORDEMPHASIS)mp2;
                    ud = (UserData*)nre->pRecord;
                    
                    if (ud != NULL)
                    {
                        char *buffer = new char[4096];
                        strcpy(buffer,ud->getName());
                        char *ptr = buffer+strlen(buffer)-1;
                        while (ptr>buffer && *ptr!='.') ptr--;
                        if (*ptr == '.')
                        {
                            int index = mimes->find(ptr);
                            
                            if (index > -1)
                            {
                                entry = index;
                                WinSetWindowText(WinWindowFromID(hwndDlg,MIME_NAME),mimes->getName(index));
                                WinSetWindowText(WinWindowFromID(hwndDlg,MIME_EXT),mimes->getExtensions(index));
                                WinSetWindowText(WinWindowFromID(hwndDlg,MIME_EXE),mimes->getCommand(index));
                            }
                        }
                        delete[] buffer;
                    }
                }
                break;
                    
                case EN_CHANGE:
                {
                    if (SHORT1FROMMP(mp1) == MIME_EXE)
                    {
                        ud = list->findSelectedRecord(NULL);
                        static int lastindex = 0;
                        if (ud && entry != -1)
                        {
                            if (lastindex == entry)
                            {
                                char *buffer = new char[4096];
                                WinQueryWindowText(WinWindowFromID(hwndDlg,MIME_EXE),129,buffer);
                                mimes->setCommand(entry,buffer);
                                delete[] buffer;
                            }
                            lastindex = entry;
                        }
                    }
                }
                break;
                    
            }
            break;
            
        case WM_COMMAND:
            switch( SHORT1FROMMP( mp1 ) )
            {
                case IDM_DELETE:
//                    message("delete");
                    break;
                    
                case DID_OK:
                    // all OK, close dialog, return
                    if (entry != -1)
                    {
                        WinQueryWindowText(WinWindowFromID(hwndDlg,MIME_EXE),129,buffer);
                        mimes->setCommand(entry,buffer);
                    }
                    mimes->save();
                    delete list;
                    WinDismissDlg( hwndDlg, TRUE);
                    return (MRESULT) TRUE;
                    
                case DID_CANCEL:
                    mimes->reload();
                    delete list;
                    WinDismissDlg( hwndDlg, TRUE);
                    return (MRESULT) FALSE;
            }
            break;
            
            
        default:
            return WinDefDlgProc(hwndDlg,msg,mp1,mp2);
    }
    return (MRESULT) TRUE;
}
Example #13
0
MRESULT EXPENTRY
SETTINGS :: DialogProcedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
    static PSETTINGS   pset = NULL;

#ifdef _DOLOGDEBUG_
    LogDebug( "DialogProcedure:Message 0x%04x", msg );
#endif

    switch (msg)
    {
    case WM_INITDLG:
#ifdef _DOLOGDEBUG_
        LogDebug( "DialogProcedure: start WM_INITDLG" );
#endif
        pset = PSETTINGS (mp2);
#ifdef _DOLOGDEBUG_
        LogDebug( "DialogProcedure: end WM_INITDLG" );
#endif
        return MRESULT (FALSE);

    case WM_COMMAND:
        switch (SHORT1FROMMP (mp1))
        {
        case WID_PB_OK:
#ifdef _DOLOGDEBUG_
            LogDebug( "DialogProcedure: start WID_PB_OK" );
#endif
            WinSendMsg (hwnd, WM_CLOSE, 0,0);
#ifdef _DOLOGDEBUG_
            LogDebug( "DialogProcedure: end WID_PB_OK" );
#endif
            break;
            
        case WID_PB_UNDO:
            {
                ULONG  id = (ULONG)
                    WinSendDlgItemMsg (hwnd, WID_NB_SETTINGS,
                                       BKM_QUERYPAGEID, 0,
                                       MPFROM2SHORT (BKA_TOP, 0));
                if (id)
                {
                    HWND   hwndPage = (HWND)
                        WinSendDlgItemMsg (hwnd, WID_NB_SETTINGS,
                                           BKM_QUERYPAGEWINDOWHWND,
                                           MPFROMLONG (id), 0);
                    WinSendMsg (hwndPage, UM_SETTINGS2DIALOG, 0,0);
                }
            }
            break;

        case DID_CANCEL:
            {
                // Undo stuff on all notebook pages:
                HWND hwndPage;

                // Get ID of first notebook page.
                ULONG id =
                    ULONG( WinSendDlgItemMsg( hwnd, WID_NB_SETTINGS,
                                              BKM_QUERYPAGEID, 0,
                                              MPFROM2SHORT( BKA_FIRST, 0 ) ) );
                if( id ) {
                    hwndPage =
                        HWND( WinSendDlgItemMsg( hwnd, WID_NB_SETTINGS,
                                                 BKM_QUERYPAGEWINDOWHWND,
                                                 MPFROMLONG( id ), 0 ) );
                    WinSendMsg( hwndPage, UM_SETTINGS2DIALOG, 0,0 );
                }

                while( id ) {
                    // Get ID of next notebook page.
                    if( ( id =
                          ULONG( WinSendDlgItemMsg( hwnd, WID_NB_SETTINGS,
                                                    BKM_QUERYPAGEID,
                                                    MPFROMLONG( id ),
                                                    MPFROM2SHORT( BKA_NEXT, 0 )
                                                  ) ) ) ) {
                        hwndPage =
                            HWND( WinSendDlgItemMsg( hwnd, WID_NB_SETTINGS,
                                                     BKM_QUERYPAGEWINDOWHWND,
                                                     MPFROMLONG( id ), 0 ) );
                        WinSendMsg( hwndPage, UM_SETTINGS2DIALOG, 0,0 );
                    }
                }
                WinSendMsg( hwnd, WM_CLOSE, 0,0 );
            }
            break;
        }
        return MRESULT (FALSE);

#ifdef _DOLOGDEBUG_
    case WM_DESTROY:
        LogDebug( "DialogProcedure: WM_DESTROY" );
        return MRESULT (FALSE);
#endif

    case WM_CLOSE:
#ifdef _DOLOGDEBUG_
        LogDebug( "DialogProcedure: WM_CLOSE" );
#endif
    case WM_QUIT:
#ifdef _DOLOGDEBUG_
        LogDebug( "DialogProcedure: WM_QUIT" );
#endif
    case WM_SAVEAPPLICATION:
#ifdef _DOLOGDEBUG_
        LogDebug( "DialogProcedure: WM_SAVEAPPLICATION" );
#endif
#ifdef _DOLOGDEBUG_
        LogDebug( "DialogProcedure: start WM_CLOSE (or WM_QUIT, WM_SAVEAPPLICATION)" );
#endif
        for (USHORT i = 0; i < COUNT_PAGES; i++)
            WinSendMsg (pset->hwndPage[i], UM_ADJUST, 0,0);
#ifdef _DOLOGDEBUG_
        LogDebug( "DialogProcedure: end WM_CLOSE (or WM_QUIT, WM_SAVEAPPLICATION)" );
#endif
        WinDismissDlg( hwnd, 0L );
        return MRESULT (FALSE);
    }

#ifdef _DOLOGDEBUG_
    LogDebug( "DialogProcedure:WinDefDlgProc->0x%04x", msg );
#endif
    return WinDefDlgProc (hwnd, msg, mp1, mp2);
}
Example #14
0
/*
**  Modeless Dialog to place device status on screen
*/
MRESULT EXPENTRY fnwpDeviceAllStatusDlg(HWND hwnd,USHORT msg,MPARAM mp1,MPARAM mp2)
  {
  char szCount[10];
  static ULONG idTimer;
  WORD wTemp;
  static BOOL bShowAllActivated;

  switch (msg)
    {
    case WM_INITDLG:
//      SetSystemMenu(hwnd);
//      CenterDlgBox(hwnd);
      bShowAllActivated = FALSE;
      idTimer = 0L;
      break;
    case UM_INITLS:
      if (!bShowAllActivated)
        {
        bShowAllActivated = TRUE;
//        MousePosDlgBox(hwnd);
        WinSetWindowText(hwnd,stCFG.szPortName);
        sprintf(szCount,"%u",stCFG.wUpdateDelay);
        WinSetDlgItemText(hwnd,HWS_UPDATE,szCount);
        WinShowWindow(hwnd,TRUE);
        WinSetFocus(HWND_DESKTOP,hwnd);
        }
      UpdateDeviceStatusDlg(hwnd);
      UpdateModemInputStatusDlg(hwnd);
      UpdateModemOutputStatusDlg(hwnd);
      UpdateBufferStatusDlg(hwnd);
      idTimer = WinStartTimer(habAnchorBlock,
                              hwnd,
                              TID_STATALL,
                              stCFG.wUpdateDelay);
      break;
    case WM_CLOSE:
    case UM_KILL_MONITOR:
      if (idTimer != 0)
        {
        WinStopTimer(habAnchorBlock,
                     hwnd,
                     idTimer);
        idTimer = 0L;
        WinDismissDlg(hwnd,TRUE);
        }
      bShowAllActivated = FALSE;
      break;
    case UM_RESETTIMER:
      if (idTimer != 0L)
        idTimer = WinStartTimer(habAnchorBlock,
                              hwnd,
                              idTimer,
                              stCFG.wUpdateDelay);
      break;
    case WM_TIMER:
      UpdateDeviceStatusDlg(hwnd);
      UpdateModemInputStatusDlg(hwnd);
      UpdateModemOutputStatusDlg(hwnd);
      UpdateBufferStatusDlg(hwnd);
      return(FALSE);
    case WM_COMMAND:
      switch(SHORT1FROMMP(mp1))
        {
        case DID_UPDATE:
          WinQueryDlgItemText(hwnd,HWS_UPDATE,sizeof(szCount),szCount);
          wTemp = atol(szCount);
          if (wTemp != stCFG.wUpdateDelay)
            {
            stCFG.wUpdateDelay = wTemp;
            WinStartTimer(habAnchorBlock,
                          hwnd,
                          idTimer,
                          stCFG.wUpdateDelay);
            }
          break;
        case DID_OK:
          WinStopTimer(habAnchorBlock,
                       hwnd,
                       idTimer);
          idTimer = 0L;
          WinDismissDlg(hwnd,TRUE);
          bShowAllActivated = FALSE;
          break;
        case DID_HELP:
          DisplayHelpPanel(HLPP_SHOW_ALL_DLG);
          break;
        default:
          return WinDefDlgProc(hwnd,msg,mp1,mp2);
        }
      return(FALSE);
    default:      return(WinDefDlgProc(hwnd,msg,mp1,mp2));
    }
  return FALSE;
  }
Example #15
0
MRESULT	EXPENTRY PrnSetupDlgProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)

{
CHAR szPrinter[CCHMAXPATH];	   /* Printer Name Holder		*/
PPRN pprn;			   /* Printer List Pointer		*/
register INT i,	n;		   /* Loop Counters			*/

switch ( msg )
   {
   case	WM_INITDLG :
		       /* Save the pointer to user style information	*/
		       /* within the dialog's reserved memory           */

       WinSetWindowPtr(hWnd, QWL_USER, (PVOID)(pprn = (PPRN)mp2));

		       /* Go through the queue list and	add each of the	*/
		       /* queue	entries	to the list box	from which the	*/
		       /* user can select a printer to use and/or	*/
		       /* configure					*/

       for ( i = 0; i <	pprn->cQueues; i++ )
	   {
		       /* Insert item and store	index			*/

	   WinSendDlgItemMsg(hWnd, LB_PRINTERS,	LM_SETITEMHANDLE,
			     MPFROMSHORT(n = (INT)LONGFROMMR(WinSendDlgItemMsg(hWnd, LB_PRINTERS, LM_INSERTITEM,
									       MPFROMSHORT(LIT_SORTASCENDING),
									       MPFROMP(strcat(strcat(strcpy(szPrinter,
										       pprn->pquei[i].pszName),	": "),
										       pprn->pquei[i].pszDriverName))))),
			     MPFROMP(i));

		       /* If the default printer, save the name	to set	*/
		       /* selection					*/

	   if (	i == pprn->iQueue )
	       WinSendDlgItemMsg(hWnd, LB_PRINTERS, LM_SELECTITEM, MPFROMSHORT(n), MPFROMSHORT(TRUE));
	   }
       CenterDlg(hWnd);
       break;
		       /* Process list box selections			*/
   case	WM_CONTROL :
       switch (	SHORT2FROMMP(mp1) )
	   {
		       /* Printer entry	selected			*/

	   case	LN_SELECT :
	       WinEnableWindow(WinWindowFromID(hWnd, DID_SETUP), TRUE);
	       WinEnableWindow(WinWindowFromID(hWnd, DID_OK),	 TRUE);
	       break;
	   }
       break;

   case	WM_COMMAND :
       switch (	SHORT1FROMMP(mp1) )
	   {
	   case	DID_OK :
		       /* Get selection	from the list box		*/

	       pprn = (PPRN)WinQueryWindowPtr(hWnd, QWL_USER);

		       /* Get printer handle				*/

	       pprn->iQueue = (INT)LONGFROMMR(WinSendDlgItemMsg(hWnd, LB_PRINTERS, LM_QUERYITEMHANDLE,
								MPFROMLONG(WinSendDlgItemMsg(hWnd, LB_PRINTERS,
											     LM_QUERYSELECTION,
											     0L, 0L)),
								0L));
	       WinDismissDlg(hWnd, TRUE);
	       break;

	   case	DID_SETUP :

		       /* Get printer handle				*/

	       PrnQueryJobProperties((PPRN)WinQueryWindowPtr(hWnd, QWL_USER),
				     (INT)LONGFROMMR(WinSendDlgItemMsg(hWnd,
								       LB_PRINTERS,
								       LM_QUERYITEMHANDLE,
								       MPFROMLONG(WinSendDlgItemMsg(hWnd,
												    LB_PRINTERS,
												    LM_QUERYSELECTION,
												    0L,	0L)),
								       0L)));
	       break;

	   case	DID_CANCEL :
	       WinDismissDlg(hWnd, FALSE);
	       break;
	   }
       break;
		       /* Close	received, exit dialog			*/
   case	WM_CLOSE :
       WinDismissDlg(hWnd, FALSE);
       break;

   default :
       return(WinDefDlgProc(hWnd, msg, mp1, mp2));
   }
		       /* Pass through unhandled messages		*/
return(0L);
}
Example #16
0
/*
	ConfigureDlgProc
	This is the dialog procedure for the module configuration dialog.
	The dialog contains a check box for enabling/disabling the module
	and two push buttons ("OK" and "Cancel") to close/cancel the dialog.
	Since version 1.2, it contains a slider to set the animation speed;
	if you don't want this slider, change the '#if 0' line in the
	WM_INITDLG part of this dialog procedure.

	This is enough for simple saver modules, but can easily be expanded
	for more saver modules that need more settings.
*/
MRESULT EXPENTRY ConfigureDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
	char	buf[sizeof(modulename)+20];
	static	HWND	hwndEnabled;
	static	HWND	hwndSpeed;
/*
	$$$$$ insert code here $$$$$
	If you need additional data for dialog processing, insert it here.

	$$$$$ for example $$$$$
*/
	static	HWND	hwndCount;

	switch(msg){
	case WM_INITDLG:
	    /* set titlebar of the dialog window */
	    /* to "MODULENAME configuration" */
		strcpy(buf, modulename);
		strcat(buf, " configuration");
		WinSetWindowText(hwnd, (PSZ)buf);

		/* get window handles of the dialog controls */
		/* and set initial state of the controls */
		hwndEnabled = WinWindowFromID(hwnd, IDC_ENABLED);
		WinSendMsg(hwndEnabled, BM_SETCHECK,
		  MPFROMSHORT(configuration_data.enabled), MPVOID);
		hwndSpeed = WinWindowFromID(hwnd, IDC_SPEED);
		WinSendMsg(hwndSpeed, SLM_SETTICKSIZE, MPFROM2SHORT(SMA_SETALLTICKS, 3), MPVOID);
		WinSendMsg(hwndSpeed, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), MPFROMLONG(configuration_data.animation_speed));
		WinSendMsg(hwndSpeed, SLM_SETSCALETEXT, MPFROMSHORT(0), MPFROMP("slow"));
		WinSendMsg(hwndSpeed, SLM_SETSCALETEXT, MPFROMSHORT(4), MPFROMP("fast"));
/*
		$$$$$ insert code here $$$$$
		Get window handles of your dialog controls.
		Set initial state of your controls.

		$$$$$ for example $$$$$
*/
		hwndCount = WinWindowFromID(hwnd, IDC_COUNT);
		WinSendMsg(hwndCount, SPBM_SETLIMITS, (MPARAM)CONFIGURATION_MAXIMUM_COUNT, (MPARAM)CONFIGURATION_MINIMUM_COUNT);
		WinSendMsg(hwndCount, SPBM_SETCURRENTVALUE, MPFROMLONG(configuration_data.count), MPVOID);


		/* return FALSE since we did not change the focus */
		return (MRESULT)FALSE;
	case WM_COMMAND:
		switch(SHORT1FROMMP(mp1)){
		case IDC_OK:
		    /* OK button was pressed. query the control settings */
			configuration_data.enabled = SHORT1FROMMR(WinSendMsg(hwndEnabled, BM_QUERYCHECK, MPVOID, MPVOID));
			configuration_data.animation_speed = SHORT1FROMMR(WinSendMsg(hwndSpeed, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), MPVOID));
/*
			$$$$$ insert code here $$$$$
			Query control settings of your controls.

			$$$$$ for example $$$$$
*/
			WinSendMsg(hwndCount, SPBM_QUERYVALUE, MPFROMP(&configuration_data.count), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));

			/* write all configuration data to INI-file */
			write_profile_data();
			/* end dialog */
			WinDismissDlg(hwnd, TRUE);
			return (MRESULT)0;
		case IDC_CANCEL:
		    /* dialog was cancelled; end it */
			WinDismissDlg(hwnd, FALSE);
			return (MRESULT)0;
		default:
			return (MRESULT)0;
		}
	}
	return WinDefDlgProc(hwnd, msg, mp1, mp2);
}
MRESULT EXPENTRY CDSettingsDlgProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
{
  FILEDLG fd = { 0 };
  char profileName[20];
  static HINI hini;
  ULONG keyLength;
  static  char chrPath[CCHMAXPATH];
  static  char chrOptions[CCHMAXPATH];

  switch( msg )
    {
    case WM_INITDLG:
      {
	WinSendMsg(WinWindowFromID(hwnd,EFID_CDRECORDPATH),EM_SETTEXTLIMIT,MPFROMSHORT((SHORT)CCHMAXPATH),0);
	WinSendMsg(WinWindowFromID(hwnd,EFID_CDRECORDOPTIONS),EM_SETTEXTLIMIT,MPFROMSHORT((SHORT)CCHMAXPATH),0);
	WinSetWindowText( WinWindowFromID(hwnd,EFID_CDRECORDPATH),chrCDRecord);
	WinSetWindowText( WinWindowFromID(hwnd,EFID_CDRECORDOPTIONS),chrCDROptions);
	sprintf(chrPath,"%s",chrCDRecord);
	sprintf(chrOptions,"%s",chrCDROptions);
	sprintf(profileName,"cdrecord.ini");		
	hini=PrfOpenProfile(WinQueryAnchorBlock(HWND_DESKTOP),profileName);
	if(!hini) {
	  WinMessageBox(  HWND_DESKTOP,
			HWND_DESKTOP,
			"Warning! Cannot open Ini-file!",
			"",
			0UL,
			MB_OK | MB_ICONEXCLAMATION );
	  WinDismissDlg(hwnd,DID_ERROR);
	}/* end of if(!hini) */				
      }
      return (MRESULT) TRUE;
    case WM_DESTROY:
      if(hini)PrfCloseProfile(hini);
      hini=NULLHANDLE;
      break;
    case WM_CLOSE:
      WinDismissDlg(hwnd,DID_ERROR);
      break;
    case WM_COMMAND:
      {			
	switch( SHORT1FROMMP( mp1 ) )
	  {
	  case PBID_CDRECORDBROWSE:
	    fd.cbSize = sizeof( fd );
	    fd.fl = FDS_OPEN_DIALOG|FDS_CENTER;
	    fd.pszTitle = "Search CDRecord/2";
	    sprintf(fd.szFullFile,"%s","*.exe");
	    
	    if( WinFileDlg( HWND_DESKTOP, hwnd, &fd ) == NULLHANDLE )
	      {
		break;
	      }
	    if( fd.lReturn == DID_OK )
	      {
		WinSetWindowText( WinWindowFromID(hwnd,EFID_CDRECORDPATH), fd.szFullFile );
		sprintf(chrCDRecord,"%s",fd.szFullFile);
	      }
	    break;
	  case DID_OK:
	    WinQueryWindowText(WinWindowFromID(hwnd,EFID_CDRECORDOPTIONS),sizeof(chrCDROptions),chrCDROptions);
	    if(!PrfWriteProfileString(hini,"CDWriter","cdrecord",chrCDRecord)){
	      WinMessageBox(  HWND_DESKTOP,
			    HWND_DESKTOP,
			    "Warning! Cannot write to Ini-file!",
			    "",
			    0UL,
			    MB_OK | MB_ICONEXCLAMATION );
	      WinDismissDlg(hwnd,DID_ERROR);
	    }
	    
	    if(!PrfWriteProfileString(hini,"CDWriter","cdroptions",chrCDROptions)){
	      WinMessageBox(  HWND_DESKTOP,
			    HWND_DESKTOP,
			    "Warning! Cannot write to Ini-file!",
			    "",
			    0UL,
			    MB_OK | MB_ICONEXCLAMATION );
	      WinDismissDlg(hwnd,DID_ERROR);
	    };
	    WinDismissDlg(hwnd,0);
	    break;
	  case DID_CANCEL:
	    sprintf(chrCDRecord,"%s",chrPath);
	    sprintf(chrCDROptions,"%s",chrOptions);
	    WinDismissDlg(hwnd,1);
	    break;
	    
	  default:
	    break;
	  }
      }
      return (MRESULT) TRUE;      
    }	
  return( WinDefDlgProc( hwnd, msg, mp1, mp2 ) );	
}
Example #18
0
/*
	ConfigureDlgProc
	This is the dialog procedure for the module configuration dialog.
	The dialog contains a check box for enabling/disabling the module
	and two push buttons ("OK" and "Cancel") to close/cancel the dialog.
	Since version 1.2, it contains a slider to set the animation speed;
	if you don't want this slider, change the '#if 0' line in the
	WM_INITDLG part of this dialog procedure.

	This is enough for simple saver modules, but can easily be expanded
	for more saver modules that need more settings.
*/
MRESULT EXPENTRY ConfigureDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
	char	buf[sizeof(modulename)+20];
	static	HWND	hwndEnabled;
	static	HWND	hwndGravity;
	static	HWND  hwndWhiteStars,hwndRedStars;
	static	HWND	hwndBlueStars,hwndYellowStars;
	static	HWND	hwndTraceName;
	static	HWND	hwndShow3d;

   switch(msg){
	case WM_INITDLG:
		/* set titlebar of the dialog window */
		/* to "MODULENAME configuration" */
		strcpy(buf, modulename);
		strcat(buf, " configuration");
		WinSetWindowText(hwnd, (PSZ)buf);

		/* get window handles of the dialog controls */
		/* and set initial state of the controls     */
		hwndEnabled = WinWindowFromID(hwnd, IDC_ENABLED);
   	WinSendMsg(hwndEnabled, BM_SETCHECK,
	   MPFROMSHORT(configuration_data.enabled), MPVOID);

      
		hwndEnabled = WinWindowFromID(hwnd, IDC_ENABLED);
		WinSendMsg(hwndEnabled, BM_SETCHECK,MPFROMSHORT(configuration_data.enabled), MPVOID);

		hwndTraceName = WinWindowFromID(hwnd, IDC_TRACENAME);
		WinSendMsg(hwndTraceName, BM_SETCHECK,MPFROMSHORT(configuration_data.tracename), MPVOID);

		hwndShow3d = WinWindowFromID(hwnd, IDC_3D);
		WinSendMsg(hwndShow3d, BM_SETCHECK,MPFROMSHORT(configuration_data.show3d), MPVOID);

		hwndGravity = WinWindowFromID(hwnd, IDC_GRAVITY);
		WinSendMsg(hwndGravity, SPBM_SETLIMITS, (MPARAM)CONFIGURATION_MAXIMUM_GRAVITY, (MPARAM)CONFIGURATION_MINIMUM_GRAVITY);
		WinSendMsg(hwndGravity, SPBM_SETCURRENTVALUE, MPFROMSHORT(configuration_data.gravity), MPVOID);

		hwndWhiteStars = WinWindowFromID(hwnd, IDC_WHITESTARS);
		WinSendMsg(hwndWhiteStars, SPBM_SETLIMITS, (MPARAM)CONFIGURATION_MAXIMUM_STARS, (MPARAM)CONFIGURATION_MINIMUM_STARS);
		WinSendMsg(hwndWhiteStars, SPBM_SETCURRENTVALUE, MPFROMSHORT(configuration_data.whitestar_count), MPVOID);

		hwndRedStars = WinWindowFromID(hwnd, IDC_REDSTARS);
		WinSendMsg(hwndRedStars, SPBM_SETLIMITS, (MPARAM)CONFIGURATION_MAXIMUM_STARS, (MPARAM)CONFIGURATION_MINIMUM_STARS);
		WinSendMsg(hwndRedStars, SPBM_SETCURRENTVALUE, MPFROMSHORT(configuration_data.redstar_count), MPVOID);

		hwndBlueStars = WinWindowFromID(hwnd, IDC_BLUESTARS);
		WinSendMsg(hwndBlueStars, SPBM_SETLIMITS, (MPARAM)CONFIGURATION_MAXIMUM_STARS, (MPARAM)CONFIGURATION_MINIMUM_STARS);
		WinSendMsg(hwndBlueStars, SPBM_SETCURRENTVALUE, MPFROMSHORT(configuration_data.bluestar_count), MPVOID);

		hwndYellowStars = WinWindowFromID(hwnd, IDC_YELLOWSTARS);
		WinSendMsg(hwndYellowStars, SPBM_SETLIMITS, (MPARAM)CONFIGURATION_MAXIMUM_STARS, (MPARAM)CONFIGURATION_MINIMUM_STARS);
		WinSendMsg(hwndYellowStars, SPBM_SETCURRENTVALUE, MPFROMSHORT(configuration_data.yellowstar_count), MPVOID);

      /* return FALSE since we did not change the focus */
		return (MRESULT)FALSE;
	case WM_COMMAND:
		switch(SHORT1FROMMP(mp1)){
		case IDC_OK:
			/* OK button was pressed. query the control settings */
			configuration_data.enabled   = SHORT1FROMMR(WinSendMsg(hwndEnabled, BM_QUERYCHECK, MPVOID, MPVOID));
			configuration_data.tracename = SHORT1FROMMR(WinSendMsg(hwndTraceName, BM_QUERYCHECK, MPVOID, MPVOID));
			configuration_data.show3d    = SHORT1FROMMR(WinSendMsg(hwndShow3d, BM_QUERYCHECK, MPVOID, MPVOID));

         WinSendMsg(hwndGravity,     SPBM_QUERYVALUE, MPFROMP(&configuration_data.gravity),          MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
         WinSendMsg(hwndWhiteStars,  SPBM_QUERYVALUE, MPFROMP(&configuration_data.whitestar_count),  MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
         WinSendMsg(hwndRedStars,    SPBM_QUERYVALUE, MPFROMP(&configuration_data.redstar_count),    MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
         WinSendMsg(hwndBlueStars,   SPBM_QUERYVALUE, MPFROMP(&configuration_data.bluestar_count),   MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
         WinSendMsg(hwndYellowStars, SPBM_QUERYVALUE, MPFROMP(&configuration_data.yellowstar_count), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));


			/* write all configuration data to INI-file */
			write_profile_data();

			/* end dialog */
			WinDismissDlg(hwnd, TRUE);
			return (MRESULT)0;
		case IDC_CANCEL:
			/* dialog was cancelled; end it */
			WinDismissDlg(hwnd, FALSE);
			return (MRESULT)0;
		default:
			return (MRESULT)0;
		}
	}
	return WinDefDlgProc(hwnd, msg, mp1, mp2);
}
/* This Proc handles the on-the-fly data CD writing */
MRESULT EXPENTRY waveinfoStatusDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
  char text[CCHMAXPATH*2 +10];
  char title[CCHMAXPATH];
  SWCNTRL swctl;
  PID pid;
  int a;


  switch (msg)
    {
    case WM_PAINT:
      {
        HPS hps;
        RECTL rcl, rclSource;
        POINTL ptl;
        LONG lTemp;
        BOOL bUseCustomPainting=TRUE;
        LONG lWidthX;
        LONG lWidthY;
        LONG  lColor;
        ULONG attrFound;


        if(bUseCustomPainting) {
          //          if(allBMPs[CTRLIDX_BG].hbm) {
          if(1) {
            hps=WinBeginPaint(hwnd, NULLHANDLE, &rcl);
            rclSource.xLeft=0;
            rclSource.yBottom=0;
#if 0
            rclSource.yTop=allBMPs[CTRLIDX_BG].bmpInfoHdr.cy;
            rclSource.xRight=allBMPs[CTRLIDX_BG].bmpInfoHdr.cx;
            lTemp=rcl.xLeft/rclSource.xRight;
            ptl.x=lTemp*rclSource.xRight;
            lTemp=rcl.yBottom/rclSource.yTop;
            lTemp*=rclSource.yTop;
#endif

            //    rcl.yBottom+=4;
            rclSource=rcl;
            rcl.yTop+=4;
            WinFillRect(hps, &rclSource, CLR_RED);

            /* Border */
            lWidthX=WinQuerySysValue(HWND_DESKTOP, SV_CXBORDER);
            lWidthY=WinQuerySysValue(HWND_DESKTOP, SV_CYBORDER);

            GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL);
#if 0
        if ( (WinQueryPresParam(hwnd, PP_BACKGROUNDCOLOR, 0, &attrFound, sizeof(attrFound),
                                                &lColor, QPF_PURERGBCOLOR)) == 0 )
           lColor = WinQuerySysColor(HWND_DESKTOP, SYSCLR_DIALOGBACKGROUND, 0);
#endif

            WinQueryWindowRect(hwnd, &rcl);
            ptl.x=1;
            ptl.y=0;
            GpiMove(hps, &ptl);
            GpiSetColor(hps, CLR_BLACK);
            ptl.x=rcl.xRight-1;
            GpiLine(hps,&ptl);
            ptl.y=rcl.yTop-1;
            GpiLine(hps,&ptl);
            GpiSetColor(hps, SYSCLR_SHADOW);
            ptl.x=rcl.xLeft;
            GpiLine(hps,&ptl);
            ptl.y=0;
            GpiLine(hps,&ptl);

            rcl.yTop-=1;
            rcl.yBottom+=1;
            rcl.xLeft+=1;
            rcl.xRight-=1;

            WinDrawBorder( hps,&rcl, 1, 1, 0, 0, 0x400);
            rcl.yTop-=1;
            rcl.yBottom+=1;
            rcl.xLeft+=1;
            rcl.xRight-=1;

            /* Get active border color */
            if(WinQueryActiveWindow(HWND_DESKTOP)==hwnd) {
              if ( (WinQueryPresParam(hwnd, PP_BORDERCOLOR, 0, &attrFound, sizeof(attrFound),
                                      &lColor, QPF_PURERGBCOLOR)) == 0 )
                lColor = WinQuerySysColor(HWND_DESKTOP, SYSCLR_DIALOGBACKGROUND, 0);
            }
            else {
              /* Inactive border color */
              if ( (WinQueryPresParam(hwnd, PP_INACTIVECOLOR, 0, &attrFound, sizeof(attrFound),
                                      &lColor, QPF_PURERGBCOLOR)) == 0 )
                lColor = WinQuerySysColor(HWND_DESKTOP, SYSCLR_DIALOGBACKGROUND, 0);
            }
            /*            Get Border size */
            WinSendMsg(hwnd, WM_QUERYBORDERSIZE, MPFROMP(&ptl),0);

            WinDrawBorder(hps,&rcl, ptl.x-2, ptl.y-2, lColor, 0, 0);

#if 0
            while(ptl.x<rcl.xRight) {
              ptl.y=lTemp;
              while(ptl.y<rcl.yTop) {/* y direction */
                //DosBeep(5000,100);
                WinDrawBitmap(hps, allBMPs[CTRLIDX_BG].hbm,
                              &rclSource, 
                              (PPOINTL)&ptl,
                              0, 0,
                              DBM_IMAGEATTRS);
                ptl.y+=allBMPs[CTRLIDX_BG].bmpInfoHdr.cy;
                //DosSleep(200);
              };
              ptl.x+=allBMPs[CTRLIDX_BG].bmpInfoHdr.cx; 
            };
#endif
            WinEndPaint(hps);
            return (MRESULT)0;
          }
        }
        break;
      }

    case WM_DRAWITEM:
      switch(SHORT1FROMMP(mp1))
        {
        case SLIDERID:
          return drawSlider(hwnd, msg, mp1, mp2, SHORT1FROMMP(mp1));
        default:
          break;
        }              
      break;
    case WM_INITDLG:
      /* Add switch entry */
      memset(&swctl,0,sizeof(swctl));
      WinQueryWindowProcess(hwnd,&pid,NULL);
      swctl.hwnd=hwnd;
      swctl.uchVisibility=SWL_VISIBLE;
      swctl.idProcess=pid;
      swctl.bProgType=PROG_DEFAULT;
      swctl.fbJump=SWL_JUMPABLE;
      WinAddSwitchEntry(&swctl);

#if 0      
      WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, "",
                     "",
                     0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE );
#endif
      //      oldProc=WinSubclassWindow(WinWindowFromID(hwnd, IDST_TEXT), newProc);
      hwndNew=WinCreateWindow(hwnd, CLASS_NAME, "Title", WS_VISIBLE |WS_TABSTOP, 10,50, SLIDERID, 40, 
                              hwnd, HWND_TOP, SLIDERID, NULLHANDLE, NULLHANDLE);
      WinShowWindow(hwnd, TRUE);
      //      WinQueryWindowPos(hwndNew,&swpSl);
      return (MRESULT) TRUE;
      /* WM_APPTERMINATENOTIFY messages are sent from the helper programs e.g. format checker. */
    case WM_CLOSE:
      WinDismissDlg(hwnd,0);
      return FALSE;
    case WM_CONTROL:
      {
        switch(SHORT2FROMMP(mp1))
          {
          case SLN_SLIDERTRACK:
            {
              switch(SHORT1FROMMP(mp1))
                {
                case SLIDERID:
                  DosBeep(5000, 10);
                  break;
                default:
                  break;
                }/* switch */
              return (MRESULT) 0;
              break;
            }
          case SLN_CHANGE:
            {
              switch(SHORT1FROMMP(mp1))
                {
                case SLIDERID:
                  DosBeep(500, 100);
                  break;
                default:
                  break;
                }/* switch */
              return (MRESULT)TRUE;
            }
          default:
            break;
          }/* switch */
        break;
      }/* WM_CONTROL */
      
    case WM_COMMAND:
      switch(SHORT1FROMMP(mp1))
        {
        case DID_OK:
          /* User pressed the OK button */
          WinPostMsg(hwnd,WM_CLOSE,0,0);
          break;
        case IDPB_RIGHT:
          WinPostMsg( WinWindowFromID(hwnd, SLIDERID),
                      SLM_SETSLIDERINFO,
                      MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_RANGEVALUE),
                      MPFROMLONG( (LONG) 70 ));
          
          break;
        case IDPB_LEFT:
          WinPostMsg( WinWindowFromID(hwnd, SLIDERID),
                      SLM_SETSLIDERINFO,
                      MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_RANGEVALUE),
                      MPFROMLONG( (LONG) 20 ));
          
          break;
        case IDPB_SIZE:
          {
            SWP swp;
              RXSTRING arg[2];                       /* argument string for REXX  */
              RXSTRING rexxretval;                /* return value from REXX    */
              APIRET   rc;                        /* return code from REXX     */
              SHORT    rexxrc = 0;                /* return code from function */
              char chrThis[20];
              char chrHwnd[20];

              char    *str = "These words will be swapped"; /* text to swap   */

#if 0
              RexxRegisterFunctionExe("CWRXFunc1", (PFN)rexxFunc1);
              

              sprintf(chrThis, "%d",123);
              sprintf(chrHwnd, "%d", WinQueryWindow(hwnd,QW_PARENT));

              /* By setting the strlength of the output RXSTRING to zero, we   */
              /* force the interpreter to allocate memory and return it to us. */
              /* We could provide a buffer for the interpreter to use instead. */
              rexxretval.strlength = 0L;          /* initialize return to empty*/
              
              MAKERXSTRING(arg[0], chrHwnd, strlen(chrHwnd));/* create input argument     */
              MAKERXSTRING(arg[1], chrThis, strlen(chrThis));/* create input argument     */

              /* Here we call the interpreter.  We don't really need to use    */
              /* all the casts in this call; they just help illustrate         */
              /* the data types used.                                          */
              rc=RexxStart((LONG)      2,             /* number of arguments   */
                           (PRXSTRING)  &arg,          /* array of arguments    */
                           (PSZ)        "G:\\Projects_working\\mmclasses-0.3.0\\testfunc.cwr",/* name of REXX file     */
                           (PRXSTRING)  0,             /* No INSTORE used       */
                           (PSZ)        "CWRXX",         /* Command env. name     */
                           (LONG)       RXSUBROUTINE,  /* Code for how invoked  */
                           (PRXSYSEXIT) 0,             /* No EXITs on this call */
                           (PSHORT)     &rexxrc,       /* Rexx program output   */
                           (PRXSTRING)  &rexxretval ); /* Rexx program output   */

              sprintf(text,"rc: %d, function return code: %d, %s ", 
                      rc, (int) rexxrc, rexxretval.strptr);

              WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, text, "", 1234, MB_OK|MB_MOVEABLE);
              
              DosFreeMem(rexxretval.strptr);          /* Release storage       
                                                         given to us by REXX.  */
              
#endif

              //            WinQueryWindowPos(hwndNew,&swp);
              //    WinSetWindowPos(hwndNew, NULLHANDLE, 0, 0, swp.cx-30, swp.cy+10,SWP_SIZE);
          break;
          }
        default:
          break;
        }
      return (MRESULT) FALSE;
    default:
      break;
    }/* switch */
  
  return WinDefDlgProc( hwnd, msg, mp1, mp2);
}
MRESULT EXPENTRY MaskDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
   static PMASKSEL pmask;
   static BOOL flag = FALSE;   // TRUE se Š stato aggiunto o tolto un elemento
   static int idx;             // posizione item selezionato o di inserzione

   switch (msg) {
      case WM_INITDLG: {
         CHAR buf[FACESIZE];
         PSZ pszCur;
         int len;
         pmask = (PMASKSEL)PVOIDFROMMP(mp2);      // recupera indirizzo dati
         // imposta il font della barra del titolo:
         PrfQueryProfileString(HINI_USERPROFILE, "PM_SystemFonts",
                               "WindowTitles", "9.WarpSans", buf, FACESIZE);
         WinSetPresParam(WinWindowFromID(hwnd, FID_TITLEBAR), PP_FONTNAMESIZE,
                         sstrlen(buf) + 1, (PVOID)(buf));
         WinSetWindowPos(hwnd, HWND_BOTTOM, pmask->pos.x, pmask->pos.y, 0, 0,
                         SWP_MOVE | SWP_SHOW);    // visualizza la finestra
         pszCur = pmask->pszExt;
         DlgEFSetTxtLimit(hwnd, COMBO_MASK, 63);
         // riempie la listbox
         while (len = sstrlen(pszCur)) {
            DlgLboxInsertItem(hwnd, COMBO_MASK, LIT_SORTASCENDING, pszCur);
            pszCur += len + 1;
         } /* endwhile */
         } // end case WM_INITDLG:
         break;
      case WM_CONTROL:
         switch (SHORT2FROMMP(mp1)) {
            case CBN_EFCHANGE: {          // cambiamento testo
               BOOL enable;
               // pulsante OK abilitato se c'e' testo nell' entrifield
               enable = WinQueryDlgItemTextLength(hwnd, COMBO_MASK);
               WinEnableControl(hwnd, MASK_OK, enable);
               // pulsante ADD abilitato se c'Š testo non gi… presente
               WinQueryDlgItemText(hwnd, COMBO_MASK, 64, pmask->achSel);
               idx = isInListBox(hwnd, pmask->achSel, COMBO_MASK); 
               WinEnableControl(hwnd, MASK_STORE, enable && (idx < 0));
               // pulsante REMOVE abilitato se testo EF == item lista
               WinEnableControl(hwnd, MASK_DEL, idx >= 0);
               } // end case CBN_EFCHANGE:
               break;
            case CBN_LBSELECT:            // selezione item
               idx = isInListBox(hwnd, pmask->achSel, COMBO_MASK);
               WinEnableControl(hwnd, MASK_DEL, idx >= 0);
               break;
            default:
              break;
         } /* endswitch */
         break;
      case WM_COMMAND:
         switch (LOUSHORT(mp1)) {
            case MASK_OK:
               WinQueryDlgItemText(hwnd, COMBO_MASK, 64, pmask->achSel);
               if (flag)    // eventualmente aggiorna lista filespec
                  ProcMaskDlgExit(hwnd, pmask);
               SaveMaskDlgPos(hwnd, pmask);
               WinDismissDlg(hwnd, TRUE);
               break;
            case MASK_STORE:
               flag = TRUE;
               DlgLboxInsertItem(hwnd, COMBO_MASK, LIT_SORTASCENDING,
                                 pmask->achSel);
               DlgLboxSelectItem(hwnd, COMBO_MASK, -idx - 1);
               WinEnableControl(hwnd, MASK_STORE, FALSE);
               break;
            case MASK_DEL:
               flag = TRUE;
               idx = DlgLboxQuerySelectedItem(hwnd, COMBO_MASK);
               DlgLboxDeleteItem(hwnd, COMBO_MASK, idx);
               WinSetDlgItemText(hwnd, COMBO_MASK, "");
               break;
            default: 
               if (flag)    // eventualmente aggiorna lista filespec
                  ProcMaskDlgExit(hwnd, pmask);
               SaveMaskDlgPos(hwnd, pmask);
               WinDismissDlg(hwnd, FALSE);
               break;
         } /* endswitch */
         break;
      case WM_CLOSE:
         if (flag)    // eventualmente aggiorna lista filespec
            ProcMaskDlgExit(hwnd, pmask);
         SaveMaskDlgPos(hwnd, pmask);
         WinDismissDlg(hwnd, FALSE);
         break;
      default: 
         return WinDefDlgProc(hwnd, msg, mp1, mp2);
   } // end switch
   return (MRESULT) FALSE;
}
/* This Proc handles the ISO image mounting */
MRESULT EXPENTRY unmountIsoDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
  char text[CCHMAXPATH];
  char title[CCHMAXPATH];

  ULONG rc;
  SWCNTRL swctl;
  PID pid;

  switch (msg)
    {      
    case WM_INITDLG:
      {
        BOOL bDone=FALSE;
        int i;

        writeLog("Initializing dialog...\n");  
        
        /* Add switch entry */
        memset(&swctl,0,sizeof(swctl));
        WinQueryWindowProcess(hwnd,&pid,NULL);
        swctl.hwnd=hwnd;
        swctl.uchVisibility=SWL_VISIBLE;
        swctl.idProcess=pid;
        swctl.bProgType=PROG_DEFAULT;
        swctl.fbJump=SWL_JUMPABLE;
        WinAddSwitchEntry(&swctl);
        
        /*sprintf(text,"%d",params[4]);*/ 
        // sprintf(text,"params[1]: %s ",params[1]);
        /* WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, pvSharedMem,
           params[4],
           0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE );
           WinPostMsg(hwnd,WM_CLOSE,0,0);
           return (MRESULT) TRUE;
           */
        
        /* Get free drive letters */
        if((rc=DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap))!=NO_ERROR)
          WinPostMsg(hwnd,WM_CLOSE,0,0);

        DosError(FERR_DISABLEHARDERR);

        for(i=2;i<26;i++) {
          if(( (ulDriveMap << (31-i)) >>31)) {
            char chrDrive[3]="A:";
            BYTE fsqBuf2[sizeof(FSQBUFFER2)+3*CCHMAXPATH]={0};
            PFSQBUFFER2 pfsqBuf2=(PFSQBUFFER2) &fsqBuf2;
            ULONG ulLength;

            /* Get FS */
            chrDrive[0]='A'+i;
            ulLength=sizeof(fsqBuf2);
            if(DosQueryFSAttach(chrDrive,0L,FSAIL_QUERYNAME, (PFSQBUFFER2)&fsqBuf2, &ulLength)==NO_ERROR) {
              if(!strcmp(pfsqBuf2->szName+pfsqBuf2->cbName+1,"ISOFS")) {
                FSINFO fsInfo;

                if(DosQueryFSInfo(i+1, FSIL_VOLSER, &fsInfo,sizeof(fsInfo))==NO_ERROR)
                  sprintf(text, "%s      (%s)",chrDrive,  fsInfo.vol.szVolLabel); 
                else
                  sprintf(text, "%s      (unknown)",chrDrive); 
                WinSendMsg(WinWindowFromID(hwnd, IDLB_UNMOUNTLETTER),LM_INSERTITEM,MPFROMSHORT(LIT_END),MPFROMP(text));
              }
            }
            else
              printf("%s %s\n",chrDrive, "---"); 
          }
        }
        DosError(FERR_ENABLEHARDERR);

        /* Set dialog font to WarpSans for Warp 4 and above */
        if(cwQueryOSRelease()>=40) {
          WinSetPresParam(hwnd,
                          PP_FONTNAMESIZE,(ULONG)sizeof(DEFAULT_DIALOG_FONT),
                          DEFAULT_DIALOG_FONT );
        }
        
        if(!bHaveWindowPos)
          WinSetWindowPos(hwnd,HWND_TOP,0,0,0,0,SWP_ZORDER|SWP_ACTIVATE);
        else
          WinSetWindowPos(hwnd,HWND_TOP,swpWindow.x, swpWindow.y, 0, 0, SWP_MOVE|SWP_ZORDER|SWP_ACTIVATE|SWP_SHOW);
        
        return (MRESULT) TRUE;
      }
    case WM_CLOSE:
      WinQueryWindowPos(hwnd,&swpWindow);
      WinDismissDlg(hwnd,0);
      return FALSE;
    case WM_HELP:
      sendCommand("DISPLAYHELPPANEL=5100");      
      break;
    case WM_COMMAND:
      switch(SHORT1FROMMP(mp1))
        {
        case IDPB_UNMOUNT:
          {
            /* User pressed the Unount button */
            AEFS_DETACH detachparms={0};
            char pszDrive[3]={0};
            HOBJECT hObject;
            SHORT sSelected;
            memset(&detachparms, 0, sizeof(detachparms));

            /* Get the drive letter */
            sSelected=SHORT1FROMMR(WinSendMsg(WinWindowFromID(hwnd, IDLB_UNMOUNTLETTER),LM_QUERYSELECTION,
                                             MPFROMSHORT(LIT_FIRST),MPFROMLONG(0L)));
            if(sSelected==LIT_NONE)
              break;

            WinSendMsg(WinWindowFromID(hwnd, IDLB_UNMOUNTLETTER),LM_QUERYITEMTEXT,
                       MPFROM2SHORT(sSelected,2),MPFROMP(pszDrive));

            /* Send the attachment request to the FSD. */
            rc = DosFSAttach(
                             //                             (PSZ) "",
                             (PSZ) pszDrive,
                             (PSZ) AEFS_IFS_NAME,
                             &detachparms,
                             sizeof(detachparms),
                             FS_DETACH);
            if (rc) {
              DosBeep(100,400);             
                            
              sprintf(text, "Error while unmounting rc=%d. Make sure there're no open files on the drive.\n", rc);
              WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, text,
                             "ISO image unmount error",
                             0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE );
            }else {
              WinSendMsg(WinWindowFromID(hwnd, IDLB_UNMOUNTLETTER),LM_DELETEITEM,
                         MPFROMSHORT(sSelected),MPFROMLONG(0L));
              sSelected=SHORT1FROMMR(WinSendMsg(WinWindowFromID(hwnd, IDLB_UNMOUNTLETTER),LM_QUERYITEMCOUNT,
                                                MPFROMLONG(0L),MPFROMLONG(0L)));
              if(sSelected==0)
                WinEnableWindow(WinWindowFromID(hwnd,IDPB_UNMOUNT), FALSE);
            }

            break;
          }
        case IDPB_UNMOUNTCLOSE:
          WinPostMsg(hwnd,WM_CLOSE,0,0);
          break;
        default:
          break;
        }
      return (MRESULT) FALSE;
    default:
      break;
    }
  return WinDefDlgProc(hwnd, msg, mp1, mp2);    
}
Example #22
0
/*------------------------------------------------------------------------*/
MRESULT EXPENTRY GridSizeDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
{
   static WINDOWINFO *pwi;
   ULONG  ulStorage[2];    /* To get the vals out of the spins  */
   PVOID  pStorage;        /* idem spinbutton.                  */

   SWP   swp;

   switch(msg)
   {
      case WM_INITDLG:
         pwi  = (WINDOWINFO *)mp2;
         /* Centre dialog on the screen        */

         WinQueryWindowPos(hwnd, (PSWP)&swp);
         WinSetWindowPos(hwnd, HWND_TOP,
                       ((WinQuerySysValue(HWND_DESKTOP,        SV_CXSCREEN) - swp.cx) / 2),
                       ((WinQuerySysValue(HWND_DESKTOP,        SV_CYSCREEN) - swp.cy) / 2),
                       0, 0, SWP_MOVE);

         /*
         ** Display interval spinbutton.
         */
         if (pwi->paper == IDM_MM)
         {
            /*
            ** 0.1 mm precision.
            */
            WinSendDlgItemMsg( hwnd, ID_GRIDSPIN, SPBM_SETLIMITS,
                               MPFROMLONG(MAXGRIDDISP),MPFROMLONG(MINGRIDDISP));

            WinSendDlgItemMsg( hwnd, ID_GRIDSPIN, SPBM_SETCURRENTVALUE,
                               MPFROMLONG((LONG)pwi->ulgriddisp), NULL);
            /*
            ** Gridsize in x direction.
            */
            WinSendDlgItemMsg( hwnd, ID_SPINGRIDX, SPBM_SETLIMITS,
                               MPFROMLONG(MAXGRIDSIZE),MPFROMLONG(MINGRIDSIZE));

            WinSendDlgItemMsg( hwnd, ID_SPINGRIDX,SPBM_SETCURRENTVALUE,
                               MPFROMLONG((LONG)pwi->ulgridcx), NULL);
            /*
            ** Gridsize in y direction.
            */
            WinSendDlgItemMsg( hwnd, ID_SPINGRIDY, SPBM_SETLIMITS,
                               MPFROMLONG(MAXGRIDSIZE),MPFROMLONG(MINGRIDSIZE));

            WinSendDlgItemMsg( hwnd, ID_SPINGRIDY,SPBM_SETCURRENTVALUE,
                               MPFROMLONG((LONG)pwi->ulgridcy), NULL);

         }
         else
         {
            LONG Inch;
            /*
            ** 0.1 inch precision.
            */
            WinSetDlgItemText (hwnd,ID_GRPGRID,"Value's * 0.1 Inch");

            WinSendDlgItemMsg( hwnd, ID_GRIDSPIN, SPBM_SETLIMITS,MPFROMLONG(MAXGRIDDISP),
                               MPFROMLONG(MINGRIDDISP));

            Inch = pwi->ulgriddisp / 2.54;

            WinSendDlgItemMsg( hwnd, ID_GRIDSPIN, SPBM_SETCURRENTVALUE,
                               MPFROMLONG((LONG)Inch), NULL);
            /*
            ** Gridsize in x direction.
            */
            WinSendDlgItemMsg( hwnd, ID_SPINGRIDX, SPBM_SETLIMITS,
                               MPFROMLONG(MAXINCHGRIDSIZE),
                               MPFROMLONG(MININCHGRIDSIZE));

            Inch = pwi->ulgridcx / 2.54;
            WinSendDlgItemMsg( hwnd, ID_SPINGRIDX,SPBM_SETCURRENTVALUE,
                               MPFROMLONG((LONG)Inch), NULL);
            /*
            ** Gridsize in y direction.
            */
            WinSendDlgItemMsg( hwnd, ID_SPINGRIDY, SPBM_SETLIMITS,
                               MPFROMLONG(MAXINCHGRIDSIZE),
                               MPFROMLONG(MININCHGRIDSIZE));

            Inch = pwi->ulgridcy / 2.54;

            WinSendDlgItemMsg( hwnd, ID_SPINGRIDY,SPBM_SETCURRENTVALUE,
                               MPFROMLONG((LONG)Inch), NULL);
         }
         return (MRESULT)0;

      case WM_COMMAND:
         switch(LOUSHORT(mp1))
         {
            case DID_OK:
               pStorage = (PVOID)ulStorage;
               /* display interval */

               WinSendDlgItemMsg(hwnd,ID_GRIDSPIN,SPBM_QUERYVALUE,
                                 (MPARAM)(pStorage),MPFROM2SHORT(0,0));
               if (ulStorage[0] >= MINGRIDDISP && ulStorage[0] <= MAXGRIDDISP )
               {
                  if (pwi->paper == IDM_MM)
                     pwi->ulgriddisp = ulStorage[0];
                  else
                     pwi->ulgriddisp = ulStorage[0] * 2.54; /*back to 0.1 mm */
               }
               /* x - direction */
               WinSendDlgItemMsg(hwnd,ID_SPINGRIDX,SPBM_QUERYVALUE,
                                 (MPARAM)(pStorage),MPFROM2SHORT(0,0));
               if (ulStorage[0] >= MINGRIDSIZE && ulStorage[0] <= MAXGRIDSIZE )
               {
                  if (pwi->paper == IDM_MM)
                     pwi->ulgridcx = ulStorage[0];
                  else
                     pwi->ulgridcx = ulStorage[0] * 2.54;
               }
               /* y - direction */
               WinSendDlgItemMsg(hwnd,ID_SPINGRIDY,SPBM_QUERYVALUE,
                                 (MPARAM)(pStorage),MPFROM2SHORT(0,0));
               if (ulStorage[0] >= MINGRIDSIZE && ulStorage[0] <= MAXGRIDSIZE )
               {
                  if (pwi->paper == IDM_MM)
                     pwi->ulgridcy = ulStorage[0];
                  else
                     pwi->ulgridcy = ulStorage[0] * 2.54;
               }
               WinPostMsg(pwi->hwndClient,UM_ENDDIALOG,(MPARAM)0,(MPARAM)0);               WinDismissDlg(hwnd,DID_OK);
               break;
            case DID_CANCEL:
               WinDismissDlg(hwnd,DID_CANCEL);
               break;
         }
         return (MRESULT)0;
   }
   return(WinDefDlgProc(hwnd, msg, mp1, mp2));
}
Example #23
0
// Callback function - handles messages sent to the dialog box
MRESULT EXPENTRY vncConnDialog::vncConnDlgProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
    // This is a static method, so we don't know which instantiation we're
    // dealing with. But we can get a pseudo-this from the parameter to
    // WM_INITDIALOG, which we therafter store with the window and retrieve
    // as follows:
    vncConnDialog *_this = (vncConnDialog *)WinQueryWindowULong(hwnd, QWL_USER);

    switch (msg) {

    // Dialog has just been created
    case WM_INITDLG:
    {
        // Save the lParam into our user data so that subsequent calls have
        // access to the parent C++ object
        WinSetWindowULong(hwnd, QWL_USER, (ULONG)mp2);
        vncConnDialog *_this = (vncConnDialog *)mp2;

        // Make the text entry box active
        WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, IDC_HOSTNAME));

        WinSendDlgItemMsg( hwnd, IDC_HOSTNAME, EM_SETTEXTLIMIT, MPFROMSHORT( 256 ) , MPVOID );
        // Return success!
        return (MRESULT)FALSE;
    }

    // Dialog has just received a command
    case WM_COMMAND:
        switch (SHORT1FROMMP(mp1))
        {

        // User clicked OK or pressed return
        case DID_OK:
        {
            char viewer[256];
            char hostname[256];
            VCard display_or_port;

            // Get the viewer to connect to
            WinQueryDlgItemText(hwnd, IDC_HOSTNAME, 256, (PSZ)viewer);

            // Process the supplied viewer address
            int result = sscanf(viewer, "%255[^:]:%u", hostname, &display_or_port);
            if (result == 1) {
                display_or_port = 0;
                result = 2;
            }
            if (result == 2) {
                // Correct a display number to a port number if required
                if (display_or_port < 100) {
                    display_or_port += INCOMING_PORT_OFFSET;
                }

                addClntThrdCD *t = new addClntThrdCD( _this->m_server , hostname , display_or_port );
                t->start();
                WinDismissDlg( hwnd , 0 );
            } else {
                // We couldn't process the machine specification
                WinMessageBox( HWND_DESKTOP , HWND_DESKTOP ,
                               (PSZ)"Unable to process specified hostname and display/port",
                               (PSZ)"Outgoing Connection", 10001, MB_OK | MB_ICONEXCLAMATION);
            }
        }
        return (MRESULT)FALSE;

        // Cancel the dialog
        case DID_CANCEL:
            WinDismissDlg( hwnd , 0 );
            return (MRESULT)FALSE;
        };
        break;
    }
    return WinDefDlgProc( hwnd , msg , mp1 , mp2 );
}
Example #24
0
/*
	ConfigureDlgProc
	This is the dialog procedure for the module configuration dialog.
	The dialog contains a check box for enabling/disabling the module
	and two push buttons ("OK" and "Cancel") to close/cancel the dialog.
	Since version 1.2, it contains a slider to set the animation speed;
	if you don't want this slider, change the '#if 0' line in the
	WM_INITDLG part of this dialog procedure.

	This is enough for simple saver modules, but can easily be expanded
	for more saver modules that need more settings.
*/
MRESULT EXPENTRY ConfigureDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
    char	buf[sizeof(modulename)+20];
    static	HWND	hwndEnabled;
    static	HWND	hwndSpeed;
/*
  $$$$$ insert code here $$$$$
  If you need additional data for dialog processing, insert it here.

  $$$$$ for example $$$$$
  */
    static	HWND	hwndCount;
    static HWND hwndColor;
    static HWND hwndBlankScreen;
    CHAR msgtext[256];

    switch(msg){
    case WM_INITDLG:
	// set titlebar of the dialog window
	// to "MODULENAME configuration"
	strcpy(buf, modulename);
	strcat(buf, " configuration");
	WinSetWindowText(hwnd, (PSZ)buf);

	// get window handles of the dialog controls
	       // and set initial state of the controls
	       hwndEnabled = WinWindowFromID(hwnd, IDC_ENABLED);
	WinSendMsg(hwndEnabled, BM_SETCHECK,
		   MPFROMLONG(configuration_data.enabled), MPVOID);
	hwndSpeed = WinWindowFromID(hwnd, IDC_SPEED);
	WinSendMsg(hwndSpeed, SLM_SETTICKSIZE, MPFROM2SHORT(SMA_SETALLTICKS, 3), MPVOID);
	WinSendMsg(hwndSpeed, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), MPFROMLONG(configuration_data.animation_speed));
	WinSendMsg(hwndSpeed, SLM_SETSCALETEXT, MPFROMSHORT(0), MPFROMP("slow"));
	WinSendMsg(hwndSpeed, SLM_SETSCALETEXT, MPFROMSHORT(4), MPFROMP("fast"));
/*
  $$$$$ insert code here $$$$$
  Get window handles of your dialog controls.
  Set initial state of your controls.

  $$$$$ for example $$$$$
  */
	hwndCount = WinWindowFromID(hwnd, IDC_COUNT);
	WinSendMsg(hwndCount, SPBM_SETLIMITS, (MPARAM)CONFIGURATION_MAXIMUM_COUNT, (MPARAM)CONFIGURATION_MINIMUM_COUNT);
	WinSendMsg(hwndCount, SPBM_SETCURRENTVALUE, MPFROMLONG(configuration_data.count), MPVOID);

/* set window that queries how many lines will have the same color	*/
	hwndColor = WinWindowFromID(hwnd, IDC_COLOR);
	WinSendMsg(hwndColor, SPBM_SETLIMITS, (MPARAM)COLORS_MAXIMUM, (MPARAM)COLORS_MINIMUM);
	WinSendMsg(hwndColor, SPBM_SETCURRENTVALUE, MPFROMLONG(configuration_data.colors), MPVOID);

	hwndBlankScreen = WinWindowFromID(hwnd, IDC_BLANKSCREEN);
	WinSendMsg(hwndBlankScreen, BM_SETCHECK,
		   MPFROMSHORT(configuration_data.blank_screen), MPVOID);

	// return FALSE since we did not change the focus
	       return (MRESULT)FALSE;
    case WM_COMMAND:
	switch(SHORT1FROMMP(mp1)){
	case IDC_OK:
	    // OK button was pressed. query the control settings
	    configuration_data.enabled = SHORT1FROMMR(WinSendMsg(hwndEnabled, BM_QUERYCHECK, MPVOID, MPVOID));
	    configuration_data.animation_speed = SHORT1FROMMR(WinSendMsg(hwndSpeed, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), MPVOID));
/*
  $$$$$ insert code here $$$$$
  Query control settings of your controls.

  $$$$$ for example $$$$$
  */
	    WinSendMsg(hwndCount, SPBM_QUERYVALUE, MPFROMP(&configuration_data.count), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
	    WinSendMsg(hwndColor, SPBM_QUERYVALUE, MPFROMP(&configuration_data.colors), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
	    configuration_data.blank_screen = SHORT1FROMMR(WinSendMsg(hwndBlankScreen, BM_QUERYCHECK, MPVOID, MPVOID));

/* check if the values are in the allowed range	*/
	    if(CONFIGURATION_MINIMUM_COUNT > configuration_data.count ||
	       configuration_data.count > CONFIGURATION_MAXIMUM_COUNT){
		sprintf( msgtext, "Sorry, but the number of lines displayed must be between %d and %d!",
			 CONFIGURATION_MINIMUM_COUNT, CONFIGURATION_MAXIMUM_COUNT);
		WinMessageBox( HWND_DESKTOP, hwnd, (PSZ)msgtext, (PSZ)"Bouncing Line",
			       0, MB_OK | MB_INFORMATION | MB_MOVEABLE );
	    } else {
		if( COLORS_MINIMUM > configuration_data.colors ||
		    configuration_data.colors > COLORS_MAXIMUM ) {
		    sprintf( msgtext, "Sorry, but the number of lines that are displayed in the same color must be between %d and %d!",
			     COLORS_MINIMUM, COLORS_MAXIMUM );
		    WinMessageBox( HWND_DESKTOP, hwnd, (PSZ)msgtext, (PSZ)"Bouncing Line",
				   0, MB_OK | MB_INFORMATION | MB_MOVEABLE );
		} else {	/* everything is o.k.	*/
		    /* write all configuration data to INI-file */
		    write_profile_data();
		    // end dialog
			   WinDismissDlg(hwnd, TRUE);
		}
	    }
	    return (MRESULT)0;
	case IDC_CANCEL:
	    // dialog was cancelled; end it
					 WinDismissDlg(hwnd, FALSE);
	    return (MRESULT)0;
	default:
	    return (MRESULT)0;
	}
    }
    return WinDefDlgProc(hwnd, msg, mp1, mp2);
}
/* This Proc handles the on-the-fly data CD writing */
MRESULT EXPENTRY waveinfoStatusDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
  char text[CCHMAXPATH*2 +10];
  char title[CCHMAXPATH];
  SWCNTRL swctl;
  PID pid;
  int a;
  int rate;
  int iBitRate;
  SHORT stereo;
  LONG lSec;

  switch (msg)
    {      
    case WM_INITDLG:

      /* Add switch entry */
      memset(&swctl,0,sizeof(swctl));
      WinQueryWindowProcess(hwnd,&pid,NULL);
      swctl.hwnd=hwnd;
      swctl.uchVisibility=SWL_VISIBLE;
      swctl.idProcess=pid;
      swctl.bProgType=PROG_DEFAULT;
      swctl.fbJump=SWL_JUMPABLE;
      WinAddSwitchEntry(&swctl);

      /*      sprintf(text,"1: %s, 2: %s, 3: %s",params[1],params[2],params[3]);
              WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, text,
              params[3],
              0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE );
              */

      WinSendMsg(WinWindowFromID(hwnd,IDST_WAVENAME),EM_SETTEXTLIMIT,MPFROMSHORT((SHORT)CCHMAXPATH),0);
      
      if(!iMp3 || (iMp3 && iMp3Decoder==IDKEY_USEMMIOMP3)) {
        /* Query a wave */          
        switch (mmAudioHeader.mmXWAVHeader.WAVEHeader.usFormatTag)
          {
          case DATATYPE_WAVEFORM:
            getMessage(text, IDSTR_PMWAVEINFOPCM, sizeof(text), RESSOURCEHANDLE, hwnd);
            break;
          case DATATYPE_ALAW:
            getMessage(text, IDSTR_PMWAVEINFOALAW, sizeof(text), RESSOURCEHANDLE, hwnd);
            break;
          case DATATYPE_MULAW:
            getMessage(text, IDSTR_PMWAVEINFOMULAW, sizeof(text), RESSOURCEHANDLE, hwnd);
            break;
          case DATATYPE_ADPCM_AVC:
            getMessage(text, IDSTR_PMWAVEINFOADPCM, sizeof(text), RESSOURCEHANDLE, hwnd);
            break;
          default:
            getMessage(text, IDSTR_PMWAVEINFOUNKNOWN, sizeof(text), RESSOURCEHANDLE, hwnd);	
            break;
          }
        
        /* Channels */
        getMessage(title, IDSTR_PMWAVEINFOCHANNELS, sizeof(title), RESSOURCEHANDLE, hwnd);	
        sprintf(text, title, mmAudioHeader.mmXWAVHeader.WAVEHeader.usChannels);
        WinSetWindowText(WinWindowFromID(hwnd,IDST_CHANNELS),text);
        
        /* Bit per sample */
        getMessage(title, IDSTR_PMWAVEINFOBITPERSAMPLE, sizeof(title), RESSOURCEHANDLE, hwnd);	
        sprintf(text, title,mmAudioHeader.mmXWAVHeader.WAVEHeader.usBitsPerSample);
        WinSetWindowText(WinWindowFromID(hwnd,IDST_BITPERSAMPLE),text);
        
        /* Samplerate */
        getMessage(title, IDSTR_PMWAVEINFOSAMPLERATE, sizeof(title), RESSOURCEHANDLE, hwnd);	
        sprintf(text, title, mmAudioHeader.mmXWAVHeader.WAVEHeader.ulSamplesPerSec);
        WinSetWindowText(WinWindowFromID(hwnd,IDST_SAMPLERATE),text);
        
        /* Filename */
        WinSetWindowText(WinWindowFromID(hwnd,IDST_WAVENAME),params[3]);
        
        /* Playtime */
        getMessage(title, IDSTR_PMWAVEINFOPLAYTIME, sizeof(title), RESSOURCEHANDLE, hwnd);	
        sprintf(text, title, mmAudioHeader.mmXWAVHeader.XWAVHeaderInfo.ulAudioLengthInBytes/
					 mmAudioHeader.mmXWAVHeader.WAVEHeader.ulAvgBytesPerSec/60,
					 mmAudioHeader.mmXWAVHeader.XWAVHeaderInfo.ulAudioLengthInBytes/
					 mmAudioHeader.mmXWAVHeader.WAVEHeader.ulAvgBytesPerSec%60);
        WinSetWindowText(WinWindowFromID(hwnd,IDST_PLAYTIME),text);

      }
      else
        {
          /* Query info for MP3 */
          getMessage(title, IDSTR_PMMP3INFODLGTITLE, sizeof(title), RESSOURCEHANDLE, hwnd);	
          WinSetWindowText(hwnd,title);

          WinSetWindowText(WinWindowFromID(hwnd,IDST_CDBITS), "");
        
          /* Filename */
          WinSetWindowText(WinWindowFromID(hwnd,IDST_WAVENAME),params[3]);

          audioHlpStartMp3Query(params[3], hwnd);
        }
      /* Set dialog font to WarpSans for Warp 4 and above */
      if(cwQueryOSRelease()>=40) {
        WinSetPresParam(hwnd,
                        PP_FONTNAMESIZE,(ULONG)sizeof(DEFAULT_DIALOG_FONT),
                        DEFAULT_DIALOG_FONT );
      }

      if(!bHaveWindowPos)
        WinSetWindowPos(hwnd,HWND_TOP,0,0,0,0,SWP_ZORDER|SWP_ACTIVATE|SWP_SHOW);
      else
        WinSetWindowPos(hwnd,HWND_TOP,swpWindow.x, swpWindow.y, 0, 0, SWP_MOVE|SWP_ZORDER|SWP_ACTIVATE|SWP_SHOW);

      return (MRESULT) TRUE;
      /* WM_APPTERMINATENOTIFY messages are sent from the helper programs e.g. format checker. */
    case WM_APPTERMINATENOTIFY:
      switch(LONGFROMMP(mp1))
        {
        case ACKEY_MP3INFO:
          rate=SHORT2FROMMP(mp2);
          iBitRate=SHORT1FROMMP(mp2);
          iBitRate>>=2;
          stereo=SHORT1FROMMP(mp2) & 0x3;

          /* Channels */
          getMessage(title, IDSTR_PMWAVEINFOCHANNELS, sizeof(title), RESSOURCEHANDLE, hwnd);
          if(stereo)	
            sprintf(text, title, 2);
          else
            sprintf(text, title, 1);
          WinSetWindowText(WinWindowFromID(hwnd,IDST_CHANNELS),text);
          
          /* Bitrate */
          getMessage(title, IDSTR_PMMP3INFOBITRATE, sizeof(title), RESSOURCEHANDLE, hwnd);	
          sprintf(text, title, iBitRate);
          WinSetWindowText(WinWindowFromID(hwnd,IDST_BITPERSAMPLE),text);
          
          /* Samplerate */
          getMessage(title, IDSTR_PMWAVEINFOSAMPLERATE, sizeof(title), RESSOURCEHANDLE, hwnd);	
          sprintf(text, title, rate);
          WinSetWindowText(WinWindowFromID(hwnd,IDST_SAMPLERATE),text);


          break;
        case ACKEY_PLAYTIME:
          lSec=LONGFROMMP(mp2);
          lSec/=(44100*4);

          /* Playtime */
          getMessage(title, IDSTR_PMWAVEINFOPLAYTIME, sizeof(title), RESSOURCEHANDLE, hwnd);	
          sprintf(text, title, lSec/60, lSec%60);
          WinSetWindowText(WinWindowFromID(hwnd,IDST_PLAYTIME),text);

          break;
        default:
          break;
        }
      return FALSE;

    case WM_CLOSE:
      WinQueryWindowPos(hwnd,&swpWindow);
      WinDismissDlg(hwnd,0);
      return FALSE;
    case WM_COMMAND:
      switch(SHORT1FROMMP(mp1))
        {
        case IDPB_OK:
          /* User pressed the OK button */
          WinPostMsg(hwnd,WM_CLOSE,0,0);
          break;
        default:
          break;
        }
      return (MRESULT) FALSE;
    default:
      break;
    }/* switch */
  
  return WinDefDlgProc( hwnd, msg, mp1, mp2);
}
Example #26
0
//A Dlg procedure if the plugin has selectable settings.
MRESULT EXPENTRY CBZPluginSetupDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
  short sControlId;
    PLUGINSHARE *pPluginData;
    FILEDLG filedlg;
    HWND hwndDlg;

    switch (msg)
    {
        case WM_INITDLG:
        {
            if ((pPluginData = (PLUGINSHARE *) mp2) == NULL)
            {
                //Error msg..
                WinDismissDlg(hwnd, DID_ERROR);
                return (MRFROMLONG(FALSE));
            }
            WinSetWindowPtr(hwnd, QWL_USER, pPluginData);  // store window words

            WinSendMsg(WinWindowFromID(hwnd, EFID_IMAGE), EM_SETTEXTLIMIT, (MPARAM) CCHMAXPATH, (MPARAM) 0);

            WinSetWindowText(WinWindowFromID(hwnd, EFID_IMAGE), pPluginData->szImageFile);

            /* This is temprary. At the moment only all or no frame control may be drawn */
            WinCheckButton(hwnd, CBID_CLOSEENABLED, TRUE);
            WinCheckButton(hwnd, CBID_MINIMIZEENABLED, TRUE);
            WinCheckButton(hwnd, CBID_MAXIMIZEENABLED, TRUE);
            WinCheckButton(hwnd, CBID_RESTOREENABLED, TRUE);
            WinCheckButton(hwnd, CBID_HIDEENABLED, TRUE);

            WinEnableWindow(WinWindowFromID(hwnd,CBID_CLOSEENABLED ), FALSE);
            WinEnableWindow(WinWindowFromID(hwnd, CBID_MINIMIZEENABLED), FALSE);
            WinEnableWindow(WinWindowFromID(hwnd, CBID_MAXIMIZEENABLED), FALSE);
            WinEnableWindow(WinWindowFromID(hwnd, CBID_RESTOREENABLED), FALSE);
            WinEnableWindow(WinWindowFromID(hwnd, CBID_HIDEENABLED), FALSE);

        }
        break;

        case WM_COMMAND:
        {
            sControlId = COMMANDMSG(&msg)->cmd;

            switch (sControlId)
            {
                case PBID_IMAGE:
                {

                    //popup file change dialog!
                    memset(&filedlg, 0, sizeof(FILEDLG));  // init filedlg struct

                    filedlg.cbSize = sizeof(FILEDLG);
                    filedlg.fl = FDS_OPEN_DIALOG;
                    filedlg.pszTitle = "Choose an image";
                    strcpy(filedlg.szFullFile, "*.*");

                    if ((hwndDlg = WinFileDlg(HWND_DESKTOP, hwnd, &filedlg)) == NULLHANDLE)
                    {
                        return (FALSE);
                    }

                    if (filedlg.lReturn != DID_OK)  // selected one

                    {
                        break;
                    }

                    WinSetWindowText(WinWindowFromID(hwnd, EFID_IMAGE), filedlg.szFullFile);

                }
                break;


                case PBID_OK:
                {
                    if ((pPluginData = (PLUGINSHARE *) WinQueryWindowPtr(hwnd, QWL_USER)) == NULL)
                    {
                        //error message..
                        break;
                    }

                    WinQueryWindowText(WinWindowFromID(hwnd, EFID_IMAGE), CCHMAXPATH, pPluginData->szImageFile);

                    //update!
                    WinDismissDlg(hwnd, PBID_OK);
                }
                break;

                case PBID_CANCEL:
                {
                    //don't update shared Memory!
                    WinDismissDlg(hwnd, PBID_CANCEL);
                }
                break;
            }

            return ((MPARAM) 0);
        }
        break;

        case WM_CONTROL:
        {
            switch (SHORT1FROMMP(mp1))
            {

            }
            return ((MRESULT) 0);
        }
        break;

    }
    return (WinDefDlgProc(hwnd, msg, mp1, mp2));
}
/* This Proc handles the on-the-fly data CD writing */
MRESULT EXPENTRY onTheFlyStatusDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
  char text[CCHMAXPATH*2+10];
  char title[CCHMAXPATH];
  char *textPtr;
  char *textPtr2; 
  static LONG lCDSize;
  static LONG lImageSize;
  SWCNTRL swctl;
  PID pid;

  switch (msg)
    {      
    case WM_PAINT:
      {
        if(HlpPaintFrame(hwnd, TRUE))
          return (MRESULT)0;
        break;
      }
    case WM_INITDLG:   

      WinShowWindow(WinWindowFromID(hwnd,IDPB_STATUSOK),FALSE);
      WinShowWindow(WinWindowFromID(hwnd,IDPB_SHOWLOG),FALSE);      
      WinShowWindow(WinWindowFromID(hwnd,IDPB_ABORTWRITE), TRUE);
      /* Hide percent bar which shows the write progress */
      WinShowWindow(WinWindowFromID(hwnd,IDSR_PERCENT), FALSE);

      /* Add switch entry */
      memset(&swctl,0,sizeof(swctl));
      WinQueryWindowProcess(hwnd,&pid,NULL);
      swctl.hwnd=hwnd;
      swctl.uchVisibility=SWL_VISIBLE;
      swctl.idProcess=pid;
      swctl.bProgType=PROG_DEFAULT;
      swctl.fbJump=SWL_JUMPABLE;
      WinAddSwitchEntry(&swctl);

      /* Set percent bar to 0. */
      WinSetWindowText(WinWindowFromID(hwnd,IDSR_PERCENT),"0#0%");

      /* Set dialog font to WarpSans for Warp 4 and above */
      if(cwQueryOSRelease()>=40) {
        WinSetPresParam(hwnd,
                        PP_FONTNAMESIZE,(ULONG)sizeof(DEFAULT_DIALOG_FONT),
                        DEFAULT_DIALOG_FONT );
      }

      /* Custom painting */
      setupGroupBoxControl(hwnd, IDGB_CHECKSTATUS);
      setupStaticTextControl(hwnd, IDST_ACTIONTEXT);

      /* Show dialog */
      if(!bHaveWindowPos)
        WinSetWindowPos(hwnd,HWND_TOP,0,0,0,0,SWP_ZORDER|SWP_ACTIVATE);
      else
        WinSetWindowPos(hwnd,HWND_TOP,swpWindow.x, swpWindow.y, 0, 0, SWP_MOVE|SWP_ZORDER|SWP_ACTIVATE|SWP_SHOW);

      /* Get writer device from parameter memory */
      if((textPtr=strstr(ptrLocalMem, "--device"))!=NULL) 
        if((textPtr2=strchr(textPtr, ' '))!=NULL)
          if((textPtr2=strchr(++textPtr2, ' '))!=NULL)
            *textPtr2=0;
      sprintf(text, "\"%s\"", textPtr);
      /* First query free CD space */
      if(queryFreeDVDSpace(hwnd, text)) {
        WinPostMsg(hwnd,WM_CLOSE,0,0);
        return (MRESULT) TRUE;
      };
      if(textPtr2)
        *textPtr2=' ';
      
      return (MRESULT) TRUE;
    case WM_CLOSE:
      WinShowWindow(WinWindowFromID(hwnd,IDPB_ABORTWRITE),FALSE);
      WinShowWindow(WinWindowFromID(hwnd,IDPB_STATUSOK),TRUE);
      WinShowWindow(WinWindowFromID(hwnd,IDPB_SHOWLOG),TRUE);      
      return FALSE;
    case WM_COMMAND:
      switch(SHORT1FROMMP(mp1))
        {
        case IDPB_ABORTWRITE:
          /* User pressed the ABORT button */
          DosBeep(1000,200);
          bAbort=TRUE;
          writeLog("User pressed ABORT.\n");
          WinPostMsg(hwnd,WM_CLOSE,0,0);
          break;
        case IDPB_STATUSOK:
          WinQueryWindowPos(hwnd,&swpWindow);
          WinDismissDlg(hwnd,0);
          break;
        case IDPB_SHOWLOG:
          showLogFile();
          break;
        default:
          break;
        }
    case WM_APPTERMINATENOTIFY:
      if(1) {
        switch(LONGFROMMP(mp1)) {
        case ACKEY_ONTHEFLY:
          /* Writing done. */
          WinSendMsg(WinWindowFromID(hwnd,IDLB_CHECKSTATUS),LM_DELETEITEM,MPFROMSHORT(2),0);
          if(!(LONGFROMMP(mp2))) {
            /* Tell the folder that we successfully wrote the CD  */
            /* This message will cause the folder to reset the archive bit if selected */
            sendCommand("ONTHEFLYDONE=1");
            /* Text: "CD-ROM successfully created." */
            getMessage(text, IDSTRLB_CDROMCREATIONSUCCESS, sizeof(text), RESSOURCEHANDLE, hwnd);
            DosBeep(1000,100);
            DosBeep(2000,100);
            DosBeep(3000,100);
          }
          else {
            /* There was an error while writing */
            sendCommand("ONTHEFLYDONE=0");
            DosBeep(100,200);
            /* Text: "Error while writing on the fly!" */
            getMessage(text, IDSTRLB_ONTHEFLYDVDERROR, sizeof(text), RESSOURCEHANDLE, hwnd);
          }
          writeLog(text);
          writeLog("\n");
          WinSendMsg(WinWindowFromID(hwnd,IDLB_CHECKSTATUS),LM_INSERTITEM,MPFROMSHORT(2),text);
          WinShowWindow(WinWindowFromID(hwnd,IDSR_PERCENT),FALSE);
          WinPostMsg(hwnd,WM_CLOSE,0,0);
          WinSetWindowPos(hwnd,HWND_TOP,0,0,0,0,SWP_ZORDER|SWP_ACTIVATE);
          break;
        case ACKEY_FIXATING:
          /* This msg. is sent by the helper process when cdrecord begins with fixating the disk */
          WinSendMsg(WinWindowFromID(hwnd,IDLB_CHECKSTATUS),LM_DELETEITEM,MPFROMSHORT(2),0);
          if(LONGFROMMP(mp2)==0) {
            /* Text: "Fixating... (may need some minutes)" */
            getMessage(text, IDSTRLB_FIXATING, sizeof(text), RESSOURCEHANDLE, hwnd);
          }
          else {
            /* Text: "Writing buffers to CD..." */
            getMessage(text, IDSTRLB_WRITINGBUFFERS, sizeof(text), RESSOURCEHANDLE, hwnd);
          }
          WinSendMsg(WinWindowFromID(hwnd,IDLB_CHECKSTATUS),LM_INSERTITEM,MPFROMSHORT(2),text);
          break;
        case ACKEY_MBWRITTEN:
          {
            int iPercent;

            iPercent=LONGFROMMP(mp2);

            if(lImageSize<100)/* Catch division by zero trap */
              iPercent=0;
            else
              iPercent/=(lImageSize/100);

            if(iPercent>100)
              iPercent=100;
            if(iPercent<0)
              iPercent=0;
            
            /* Update percent bar value. The helper prog sends us the actual written Mbytes. */
            sprintf(text,"%d#%d%%", iPercent, iPercent);
            WinSetWindowText(WinWindowFromID(hwnd,IDSR_PERCENT), text);  
            break;
          }
        case ACKEY_PRINTSIZE:
          {
            FILE * file;

          /* The PM wrapper requested the imagesize by invoking mkisofs with the -print-size option.
             The helper prog sends us the # of extents (each 2048bytes) with this msg */

          /* Delete previous message in listbox */
          WinSendMsg(WinWindowFromID(hwnd,IDLB_CHECKSTATUS),LM_DELETEITEM,MPFROMSHORT(1),0);
          if(LONGFROMMP(mp2)<=2097152) {
            /* Put new msg with imagesize into listbox */
            /* title: "Imagesize is %d.%0.3d.%0.3d bytes" */
            getMessage(title, IDSTRD_IMAGESIZE, sizeof(title), RESSOURCEHANDLE, hwnd);
            sprintf(text,title,
                    LONGFROMMP(mp2)*2048/1000000,(LONGFROMMP(mp2)*2048%1000000)/1000,LONGFROMMP(mp2)*2048%1000);
          }
          else {
            /* title: "Estimated imagesize is %d Mb" */
            getMessage( title, IDSTRD_IMAGESIZESTATUSLINETEXT2, sizeof(title), RESSOURCEHANDLE, hwnd);
            sprintf(text, title, LONGFROMMP(mp2)*2/1024);
          }
          writeLog(text);
          writeLog("\n");
          WinSendMsg(WinWindowFromID(hwnd,IDLB_CHECKSTATUS),LM_INSERTITEM,MPFROMSHORT(1),text);
          /* Save imagesize. We need it for the percent bar */
          lImageSize=LONGFROMMP(mp2);

          /* mkisofs can't create the image for some reason... */
          if(lImageSize==0) {
            messageBox( text, IDSTRD_CHECKSIZEERRORMULTI, sizeof(text),
                        title, IDSTRD_ONTHEFLYTITLE, sizeof(title),
                        RESSOURCEHANDLE, hwnd, MB_OK | MB_ERROR | MB_MOVEABLE);
            WinPostMsg(hwnd,WM_CLOSE,0,0);
            break;
          }
          if(LONGFROMMP(mp2) >lCDSize && lCDSize!=0) {
            /* Text: "Image is bigger than free CD space! [...]. Do you want to proceed?"
               Title: "On the fly writing"
               */
            if(MBID_NO==messageBox( text, IDSTRPM_IMAGETOBIG , sizeof(text),
                                     title, IDSTRD_ONTHEFLYTITLE, sizeof(title),
                                     RESSOURCEHANDLE, hwnd, MB_YESNO | MB_WARNING|MB_MOVEABLE)) {            
              WinPostMsg(hwnd,WM_CLOSE,0,0);
              break;
            }
          }
          /**************************************************************************************************************************************************************/

          /* Check if user pressed Abort in the meantime */
          if(bAbort)
            return FALSE;

          /* Now starting the write process */
          if(pipePtr) {
            *pipePtr='|';
            pipePtr++;
            *pipePtr=' ';
          }

          /* Copy updated command line to parameter file */
          if((file=fopen(params[4],"wb"))!=NULL) {
            fwrite(ptrLocalMem, sizeof(char), SHAREDMEM_SIZE, file);
            fclose(file); 
          }
          /* Put a message in the listbox  */
          /* Text: "Writing on the fly..." */
          getMessage(text, IDSTR_ONTHEFLYWRITING, sizeof(text), RESSOURCEHANDLE, hwnd);
          WinSendMsg(WinWindowFromID(hwnd,IDLB_CHECKSTATUS),LM_INSERTITEM,MPFROMSHORT(2),text);

          /* Hide ABORT Button in the status dialog. We do not let the user interrupt a write because this
             will damage the CD. */
          WinShowWindow(WinWindowFromID(hwnd,IDPB_ABORTWRITE),FALSE);
          /* Set percent bar value */
          WinPostMsg(WinWindowFromID(hwnd,IDSR_PERCENT),WM_UPDATEPROGRESSBAR,MPFROMLONG(0),MPFROMLONG(lImageSize));
          /* Show percent bar which shows the write progress */
          WinShowWindow(WinWindowFromID(hwnd,IDSR_PERCENT),TRUE);

          /* logfilename as a parameter */
          buildLogName(title, logName,  sizeof(title));
          //          snprintf(text, sizeof(text), "\"%s\"" ,title);
          snprintf(text, sizeof(text), "\"%s\" \"%s\"" ,params[4], title);
          /* Launch the helper program */
          /* Title: "On the fly VIO helper" */
          getMessage(title, IDSTRVIO_ONTHEFLY, sizeof(title), RESSOURCEHANDLE, hwnd);
          launchWrapper( text, chrInstallDir, hwnd, "dvdthefly.exe", title);          
          break;
          }
        case ACKEY_CDSIZE:
          {
            FILE * file;

          /* This msg is sent by the helper prog after getting the actual free space of the inserted
             CD */
      
          /* Save CD-Size */
          lCDSize=LONGFROMMP(mp2);
          /* Delete previous Message in the listbox */
          WinSendMsg(WinWindowFromID(hwnd,IDLB_CHECKSTATUS),LM_DELETEITEM,MPFROMSHORT(0),0);

          if(lCDSize==0) {
            /* There was an error. */
            /* Title: "Writing CD"
               Text: "Can't query free CD space! On some systems detection of free CD space fails 
               so you may override this message if you know what you're doing! Do you want to proceed with writing? "
               */
            writeLog("Can't query CD-size. Returned value is 0.\n");
            writeLog("\n");

            if(MBID_NO==queryFreeCDSpaceError(hwnd)) {
              WinPostMsg(hwnd, WM_CLOSE,0,0);
              return FALSE;
            }
          }
          /* Delete check size error message in listbox */
          WinSendMsg(WinWindowFromID(hwnd,IDLB_CHECKSTATUS),LM_DELETEITEM,MPFROMSHORT(0),0);

          if(LONGFROMMP(mp2)<=2097152) {
            /* Insert the CD size into the listbox to inform the user */
            /* title: "Free CD space is %d.%0.3d.%0.3d bytes" */
            getMessage(title, IDSTRLB_FREECDSPACE, sizeof(title), RESSOURCEHANDLE, hwnd);
            sprintf(text,title,
                    LONGFROMMP(mp2)*2048/1000000,(LONGFROMMP(mp2)*2048%1000000)/1000,LONGFROMMP(mp2)*2048%1000);
          }
          else
            {
              getMessage( title, IDSTR_CDSIZESTATUSLINETEXT2, sizeof(title), RESSOURCEHANDLE, hwnd);
              sprintf(text, title, LONGFROMMP(mp2)*2/1024);
            }
          WinSendMsg(WinWindowFromID(hwnd,IDLB_CHECKSTATUS),LM_INSERTITEM,MPFROMSHORT(0),text);

          /* User pressed 'Abort' */
          if(bAbort)
            return FALSE;

           /* Query image size. This is the second check prior to writing */
          /* Put a message into the listbox */
          /* Text: "Calculating image size. Please wait..." */
          getMessage(text, IDSTRD_CALCULATINGIMAGESIZE, sizeof(text), RESSOURCEHANDLE, hwnd);
          writeLog(text);
          writeLog("\n");

          WinSendMsg(WinWindowFromID(hwnd,IDLB_CHECKSTATUS),LM_INSERTITEM,MPFROMSHORT(1),text);
          
          pipePtr=strchr(ptrLocalMem,'|');
          if(pipePtr) {
            *pipePtr=0;
            pipePtr++;
            *pipePtr=0;
            pipePtr--;

          }
          textPtr=strstr(ptrLocalMem,"-o-print-size");
          if(textPtr) {
            *textPtr=' ';
            textPtr++;
            *textPtr=' ';
          }
          /* Copy updated command line to parameter file */
          if((file=fopen(params[4],"wb"))!=NULL) {
            fwrite(ptrLocalMem, sizeof(char), SHAREDMEM_SIZE, file);
            fclose(file); 
          }
          /* logfilename as a parameter */
          buildLogName(title, logName,  sizeof(title));
          snprintf(text, sizeof(text), "\"%s\" \"%s\"" ,params[4], title);
          /* Launch the helper program */
          launchWrapper( text, chrInstallDir, hwnd,"prntsize.exe", "Query image size");          
          break;
          }
        default:
          break;
        }/* switch */
      }/* if(thisPtr) */           
      return WinDefWindowProc( hwnd, msg, mp1, mp2);
    default:
      break;
    }
    return WinDefDlgProc(hwnd, msg, mp1, mp2);    
}
/*����������������������������������������������������������������������������*/
 MRESULT FilterDlgProc(          HWND    hwnd,
                        register ULONG   message,
                                 MPARAM  lParam1,
                                 MPARAM  lParam2 )

  {
     /*���������������������������������������������������������������������Ŀ*/
     /*� Local Variables                                                     �*/
     /*�����������������������������������������������������������������������*/
     MRESULT            dpResult = NULL;

     register USHORT    pbSelected;
     CHAR               sFilterItem[128];
     PMSG_ITEM          pMsg;

     static PSPY_DATA   pSpyData = NULL;

     HWND               hwndLB;                /* HWND of message listbox */

    /*����������������������������������������������������������������������Ŀ*/
    /*� Process the message                                                  �*/
    /*������������������������������������������������������������������������*/
    switch (message)                          /* Switch off of the message ID */
    {
        /*������������������������������������������������������������������Ŀ*/
        /*� One of our pushbuttons was pressed...                            �*/
        /*��������������������������������������������������������������������*/
        case WM_COMMAND:

          switch( pbSelected = LOUSHORT( lParam1 ) )
          {
              /*������������������������������������������������������������Ŀ*/
              /*� Process selected items                                     �*/
              /*��������������������������������������������������������������*/
              default:
              {
                USHORT        curItem,            /* current list item        */
                              nSelected;          /* Number of items selected */

                MSG_COLOR     color = GetColor( hwnd, pSpyData);

                /*����������������������������������������������������������Ŀ*/
                /*� Obtain HWND of message listbox once for performance      �*/
                /*������������������������������������������������������������*/
                hwndLB = WinWindowFromID(hwnd, IDD_FILTER);

                /************************************************************
                * "Lock" the ListBox to minimize performance impact
                ************************************************************/
                WinLockWindowUpdate(HWND_DESKTOP,     /* Desktop */
                                    hwndLB);          /* Lockee  */

                /************************************************************
                * Process the "selected" ListBox items
                ************************************************************/
                for(nSelected = 0,                    /* Initialize */
                    curItem   = SHORT1FROMMR(WinSendMsg(hwndLB,
                                                        LM_QUERYSELECTION,
                                                        MPFROMSHORT(LIT_FIRST),
                                                        NULL) );

                    curItem != (USHORT)LIT_NONE;      /* While      */

                    nSelected++,                     /* Iterate     */
                    curItem   = SHORT1FROMMR(WinSendMsg(hwndLB,
                                                        LM_QUERYSELECTION,
                                                        MPFROMSHORT(curItem),
                                                        NULL) )
                   )
                {
                  /*��������������������������������������������������������Ŀ*/
                  /*� Locate specific MSG item for this selected item        �*/
                  /*����������������������������������������������������������*/
                  pMsg = PVOIDFROMMR( WinSendMsg(hwndLB,
                                                 LM_QUERYITEMHANDLE,
                                                 MPFROMSHORT(curItem),
                                                 NULL) );

                  /*��������������������������������������������������������Ŀ*/
                  /*� Perform action on this selected item                   �*/
                  /*����������������������������������������������������������*/
                  switch( pbSelected )
                  {
                    /*********************************************************
                    * Delete this MSG's definition
                    **********************************************************/
                    case ID_PB_F_DELETE:

                         DeleteMsg(pSpyData, pMsg->Msg);

                         WinSendMsg(hwndLB,
                                    LM_DELETEITEM,
                                    MPFROMSHORT(curItem),
                                    MPFROMP(NULL));

                         curItem = (USHORT)( (curItem == 0)
                                             ? LIT_FIRST
                                             : (curItem - 1) );
                    break;

                    /*********************************************************
                    * Mark that this MSG can NOT be "spied" / act as "trigger"
                    **********************************************************/
                    case ID_PB_F_EXCLUDE:

                         IncludeMsg(pSpyData, pMsg->Msg, BOOL_FALSE, color);

                         WinSendMsg(hwndLB,
                                    LM_SETITEMTEXT,
                                    MPFROMSHORT(curItem),
                                    MPFROMP(FormatMSG(pMsg, sFilterItem)));
                    break;

                    /*********************************************************
                    * Mark that this MSG can be "spied" / act as "trigger"
                    **********************************************************/
                    case ID_PB_F_INCLUDE:

                         IncludeMsg(pSpyData, pMsg->Msg, BOOL_TRUE, color);

                         WinSendMsg(hwndLB,
                                    LM_SETITEMTEXT,
                                    MPFROMSHORT(curItem),
                                    MPFROMP(FormatMSG(pMsg, sFilterItem)));
                    break;

                    /*********************************************************
                    * Set FREEZE "trigger"
                    **********************************************************/
                    case ID_PB_F_FREEZE:

                         pMsg->TriggerFreeze  = BOOL_TRUE;
                         pMsg->TriggerThaw    = BOOL_FALSE;

                         WinSendMsg(hwndLB,
                                           LM_SETITEMTEXT,
                                           MPFROMSHORT(curItem),
                                           MPFROMP(FormatMSG(pMsg, sFilterItem)));

                         if (color != Color_Asis)
                           pMsg->ClrFG = color;
                    break;

                    /*********************************************************
                    * Set THAW "trigger"
                    **********************************************************/
                    case ID_PB_F_THAW:

                         pMsg->TriggerThaw    = BOOL_TRUE;
                         pMsg->TriggerFreeze  = BOOL_FALSE;

                         WinSendMsg(hwndLB,
                                    LM_SETITEMTEXT,
                                    MPFROMSHORT(curItem),
                                    MPFROMP(FormatMSG(pMsg, sFilterItem)));

                         if (color != Color_Asis)
                           pMsg->ClrFG = color;
                    break;

                    /*********************************************************
                    * Remove FREEZE and THAW "triggers"
                    **********************************************************/
                    case ID_PB_F_NO_TRIGGER:

                         pMsg->TriggerFreeze  =
                         pMsg->TriggerThaw    = BOOL_FALSE;

                         WinSendMsg(hwndLB,
                                    LM_SETITEMTEXT,
                                    MPFROMSHORT(curItem),
                                    MPFROMP(FormatMSG(pMsg, sFilterItem)));

                         if (color != Color_Asis)
                           pMsg->ClrFG = color;
                    break;

                    /*********************************************************
                    * Reset MSG unique data
                    **********************************************************/
                    case ID_PB_F_RESET:

                         pMsg->aulTimes[MSG_TIMES_SINCE] = 0;

                         if (color != Color_Asis)
                           pMsg->ClrFG = color;
                    break;
                  }
                }

                /************************************************************
                * Finally, "unlock" the ListBox so it is only redrawn once
                ************************************************************/
                WinLockWindowUpdate(HWND_DESKTOP, NULLHANDLE);

                /************************************************************
                * Make "noise" if no items were selected...
                ************************************************************/
                if (nSelected == 0)
                  WinAlarm(HWND_DESKTOP, WA_ERROR);
              }
              break;

              /*������������������������������������������������������������Ŀ*/
              /*� User cancelled dialog                                      �*/
              /*��������������������������������������������������������������*/
              case DID_CANCEL:

                   WinDismissDlg(hwnd, 0);              /* Close dialog */
              break;
          }
        break;                                          /* Break WM_COMMAND             */

        /*������������������������������������������������������������������Ŀ*/
        /*� WM_CLOSE:                                                        �*/
        /*� - Call WinDismissDlg to close the dialog box                     �*/
        /*��������������������������������������������������������������������*/

        case WM_CLOSE:                                  /* Close Dialog Box.    */

             WinDismissDlg( hwnd, 0);

        break;

        /*������������������������������������������������������������������Ŀ*/
        /*� WM_INITDLG:                                                      �*/
        /*� - Init pointer to data pointed to by WinDlgBox                   �*/
        /*� - Init global handle of this dlg                                 �*/
        /*�                                                                  �*/
        /*� - MP2 = PSPY_DATA                                                �*/
        /*��������������������������������������������������������������������*/
        case WM_INITDLG:
        {
               register USHORT  list_index;

               /*�����������������������������������������������������������Ŀ*/
               /*� Locate "SPY" data to utilize                              �*/
               /*�������������������������������������������������������������*/
               pSpyData = PVOIDFROMMP(lParam2);

               /*�����������������������������������������������������������Ŀ*/
               /*� Obtain HWND of message listbox once for performance       �*/
               /*�������������������������������������������������������������*/
               hwndLB = WinWindowFromID(hwnd, IDD_FILTER);

              /*������������������������������������������������������������Ŀ*/
              /*� Set listbox FONT to current non-proportional value         �*/
              /*��������������������������������������������������������������*/
              SetListboxFont(hwndLB, (PSZ) pSpyData->pfnLB);

              /************************************************************
              * "Lock" the ListBox to minimize performance impact
              ************************************************************/
              WinLockWindowUpdate(HWND_DESKTOP,     /* Desktop */
                                  hwndLB);          /* Lockee  */

              /*�����������������������������������������������������������Ŀ*/
              /*� Add all Messages to list box                              �*/
              /*�������������������������������������������������������������*/
              for( /* Initialize */  pMsg = ProcessFirstMsg(pSpyData); /* start @ first MSG */
                   /* Terminate  */  pMsg != NULL;                     /* stop at End-Of-Table */
                   /* Iterate    */  pMsg = ProcessNextMsg(pSpyData)   /* try the next MSG */
                 )
              {
                list_index = (USHORT)
                    WinSendMsg(hwndLB,
                               LM_INSERTITEM,
                               MPFROMSHORT(LIT_SORTASCENDING),
                               MPFROMP(FormatMSG(pMsg, sFilterItem)) );

                WinSendMsg(hwndLB,                    /* Window Handle              */
                           LM_SETITEMHANDLE,          /* Message                    */
                           MPFROMSHORT(list_index),   /* Index of list item         */
                           MPFROMP(pMsg));            /* Handle of list item        */
              }

              /************************************************************
              * Finally, "unlock" the ListBox so it is only redrawn once
              ************************************************************/
              WinLockWindowUpdate(HWND_DESKTOP, NULLHANDLE);

              /************************************************************
              * Other dialog set-up
              ************************************************************/
              SetColors( hwnd, pSpyData );      /* load colors       */

              CenterDialog(hwnd);               /* Center the Dialog */
        }
        break;

        /*������������������������������������������������������������������Ŀ*/
        /*� We don't need to handle any other messages...                    �*/
        /*�                                                                  �*/
        /*� If this isn't an IPF message, let PM do it's default "thing"     �*/
        /*��������������������������������������������������������������������*/
        default:
             if ( !HandleIPF(hwnd, message, lParam1, lParam2, &dpResult) )
               dpResult = WinDefDlgProc(hwnd,       /* Dialog Handle                */
                                        message,    /* Message                      */
                                        lParam1,    /* First parameter for message. */
                                        lParam2);   /* Second parameter for message.*/

      } /* End MSG switch */

   /*�����������������������������������������������������������������������Ŀ*/
   /*� Exit                                                                  �*/
   /*�������������������������������������������������������������������������*/
   return( dpResult );
}
Example #29
0
/*---------------------------------------------------------------------------*/
MRESULT EXPENTRY BlockTextDlgProc(HWND hwnd,ULONG msg, MPARAM mp1, MPARAM mp2)
{
   SWP     swp;  /* Screen Window Position Holder */
   POBJECT pObj;
   IPT     lOffset; /* Insertion point MLE */
   ULONG   lBytes;
   LONG    lCursor;
   BOOL    bRet;
   SWP     *pswp;
   char    buf[100];
   static  HWND hText;    /* Multiline textbox     */
   static  SWP  swpText;  /* Size & pos of editbox */
   static  long cxborder,cyborder,cyTitlebar;

   switch (msg)
   {
      case WM_INITDLG:
                /* Centre dialog on the screen */
         WinQueryWindowPos(hwnd, (PSWP)&swp);
         WinSetWindowPos(hwnd, HWND_TOP,
		       ((WinQuerySysValue(HWND_DESKTOP,	SV_CXSCREEN) - swp.cx) / 2),
		       ((WinQuerySysValue(HWND_DESKTOP,	SV_CYSCREEN) - swp.cy) / 2),
		       0, 0, SWP_MOVE);
         pObj = (POBJECT)defTBlock.pT;
         pObj->bLocked = TRUE;

         cyborder = (LONG)WinQuerySysValue(HWND_DESKTOP,SV_CYSIZEBORDER);
         cxborder = (LONG)WinQuerySysValue(HWND_DESKTOP,SV_CXSIZEBORDER);
         cyTitlebar = (LONG)WinQuerySysValue(HWND_DESKTOP,SV_CYTITLEBAR);

         defTBlock.pszMleBuffer = (char *)calloc(MAX_MLEBUF,1);

         hText = WinWindowFromID(hwnd, ID_BTEXTMLE);
         WinQueryWindowPos(hText,(PSWP)&swpText);

         if (defTBlock.pT->pszText)
         {
            lOffset =  0;
            lCursor = -1;
            lBytes  = defTBlock.pT->lTextlen -1; /* \0 must be removed!!*/
            /*
            ** Copy text from the texblock object to the Multiline editbox.
            */
            WinSendDlgItemMsg(hwnd,ID_BTEXTMLE,MLM_SETIMPORTEXPORT,
                              MPFROMP(defTBlock.pszMleBuffer),
                              MPFROMSHORT((USHORT)lBytes));
            if (lBytes < MAX_MLEBUF)
            {
               strcpy(defTBlock.pszMleBuffer,defTBlock.pT->pszText);
               WinSendDlgItemMsg(hwnd,ID_BTEXTMLE,MLM_IMPORT,
                                 MPFROMP(&lCursor),MPFROMP(&lBytes));
            }
            else
            {
               sprintf(buf,
                       "Text size exceeds the maximum allowed size of %d bytes",
                       MAX_MLEBUF);
               WinMessageBox(HWND_DESKTOP,defTBlock.pwi->hwndClient,
                             (PSZ)buf,
                             (PSZ)"Application Error",
                             0,
                             MB_OK | MB_APPLMODAL | MB_MOVEABLE |
                             MB_ICONEXCLAMATION);
            }
         }
         break;
      case WM_WINDOWPOSCHANGED:
         pswp = (SWP *)mp1;
         if (pswp)
         {
            WinSetWindowPos(hText,
                            (HWND)0,
                            cxborder,swpText.y,     /* x,y position */
                            pswp->cx - ( 2 * cxborder),
                            pswp->cy - ( swpText.y + cyborder + cyTitlebar),
                            SWP_MOVE | SWP_SIZE);
         }
         break;

      case WM_COMMAND:
         switch(LOUSHORT(mp1))
         {
            case DID_OK:
               bRet = TRUE;  /* Successfull ending?*/
               defTBlock.bDialogActive = FALSE;
               pObj = (POBJECT)defTBlock.pT;
               pObj->bLocked = FALSE;

               lBytes = (ULONG)WinSendDlgItemMsg(hwnd,ID_BTEXTMLE,
                                                  MLM_QUERYFORMATTEXTLENGTH,
                                                  MPFROMLONG(0L),MPFROMLONG((-1)));
               if (lBytes)
               {
                  if (defTBlock.pT->pszText)
                     free((void *)defTBlock.pT->pszText);
                  defTBlock.pT->lTextlen = lBytes+1;
                  defTBlock.pT->pszText  = calloc(lBytes+1,1);
                  lOffset = 0;
                  

                  WinSendDlgItemMsg(hwnd,ID_BTEXTMLE,MLM_SETIMPORTEXPORT,
                                    MPFROMP(defTBlock.pszMleBuffer),
                                    MPFROMSHORT((USHORT)MAX_MLEBUF));

                  WinPostMsg(defTBlock.pwi->hwndClient,
                             UM_ENDDIALOG,(MPARAM)pObj,(MPARAM)0);
               
                  lBytes = (LONG)WinSendDlgItemMsg(hwnd,ID_BTEXTMLE,MLM_EXPORT,
                                                   MPFROMP(&lOffset),
                                                   MPFROMP(&lBytes));
                  memcpy(defTBlock.pT->pszText,defTBlock.pszMleBuffer,lBytes);
               }
               else
                  bRet = FALSE; /* Close dialog with error! */

               if (defTBlock.pszMleBuffer)
                  free((void *)defTBlock.pszMleBuffer);
               defTBlock.pszMleBuffer = NULL;
               WinDismissDlg(hwnd,bRet);
               break;
            case DID_CANCEL:
               defTBlock.bDialogActive = FALSE;
               pObj = (POBJECT)defTBlock.pT;
               pObj->bLocked = FALSE;
               if (defTBlock.pszMleBuffer)
                  free((void *)defTBlock.pszMleBuffer);
               defTBlock.pszMleBuffer = NULL;
               WinDismissDlg(hwnd,FALSE);
               break;
            case DID_HELP:
               ShowDlgHelp(hwnd);
               return 0;
         }
         return 0;
   }
   return(WinDefDlgProc(hwnd, msg, mp1, mp2));
}
/*��������������������������������������������������������������������������*/
MRESULT MsgDlgProc(HWND    hwnd,
                   MSG     message,
                   MPARAM  lParam1,
                   MPARAM  lParam2 )
{
  /*������������������������������������������������������������������������Ŀ*/
  /*� Local Variables                                                        �*/
  /*��������������������������������������������������������������������������*/
  MRESULT   dpResult  = NULL;

  CHAR      szFmt [256],                          /* formatting specification */
            szText[256];                          /* formatting area          */

  USHORT    usThisItem;                           /* list item                */

  /*������������������������������������������������������������������������Ŀ*/
  /*� Locate dialog's instance data                                          �*/
  /*��������������������������������������������������������������������������*/
  PMD_DATA pData = WinQueryWindowPtr(hwnd, QWL_USER);

  /*������������������������������������������������������������������������Ŀ*/
  /*� Process the message                                                    �*/
  /*��������������������������������������������������������������������������*/
  switch (message)
  {
    /*��������������������������������������������������������������������Ŀ*/
    /*� "Done" PUSHBUTTON has been used or dialog close requested          �*/
    /*����������������������������������������������������������������������*/
    case WM_COMMAND:
    case WM_CLOSE:

         WinDismissDlg(hwnd, 0);

    break;

    /*��������������������������������������������������������������������Ŀ*/
    /*� Notification from one of the dialog controls....                   �*/
    /*����������������������������������������������������������������������*/
    case WM_CONTROL:
          /******************************************************************
          * One of our drop-down list items have new selection?
          ******************************************************************/
          if (
                 (SHORT2FROMMP(lParam1) == CBN_EFCHANGE) &&
               ( (SHORT1FROMMP(lParam1) == DLG_MD_DD_MP1) ||
                 (SHORT1FROMMP(lParam1) == DLG_MD_DD_MP2) )
             )
          {
            MP_FORMAT mpThis;                     /* current MP Format        */

            /****************************************************************
            * Determine "new" drop-down list item
            ****************************************************************/
            usThisItem = SHORT1FROMMR( WinSendMsg(HWNDFROMMP(lParam2),
                                                  LM_QUERYSELECTION,                  /* Select item    */
                                                  MPFROMSHORT(LIT_FIRST),
                                                  NULL) );

            /****************************************************************
            * Query item's "handle" to MP table item
            *****************************************************************/
            mpThis = (MP_FORMAT)
                     SHORT1FROMMR( WinSendMsg(HWNDFROMMP(lParam2),
                                              LM_QUERYITEMHANDLE,
                                              MPFROMSHORT(usThisItem),
                                              NULL) );

            /****************************************************************
            * Format MP1/MP2 using selected value
            *****************************************************************/
            if ( SHORT1FROMMP(lParam1) == DLG_MD_DD_MP1 )
            {
              WinSetWindowText( WinWindowFromID(hwnd, DLG_MD_ST_MP1),
                                MpFormat(pData->qmsgItem.mp1,
                                         pData->pMsg->fMP1 = mpThis,
                                         szText) );
            }
            else
            {
              WinSetWindowText( WinWindowFromID(hwnd, DLG_MD_ST_MP2),
                                MpFormat(pData->qmsgItem.mp2,
                                         pData->pMsg->fMP2 = mpThis,
                                         szText) );
            }
          }
    break;

     /*�������������������������������������������������������������������Ŀ*/
     /*� WM_INITDLG:                                                       �*/
     /*�                                                                   �*/
     /*� - MP2 is dialog instance's data                                   �*/
     /*���������������������������������������������������������������������*/
     case WM_INITDLG:
          /*��������������������������������������������������������������Ŀ*/
          /*� Save Dialog's instance data pointer (passed in MP2)          �*/
          /*����������������������������������������������������������������*/
          WinSetWindowPtr(hwnd, QWL_USER, pData = PVOIDFROMMP(lParam2));

          /*��������������������������������������������������������������Ŀ*/
          /*� Setup the Dialog for processing...                           �*/
          /*����������������������������������������������������������������*/
          CenterDialog(hwnd);                                /* Center DLG  */

          /*��������������������������������������������������������������Ŀ*/
          /*� Set up Dialog's title to include MSG name                    �*/
          /*����������������������������������������������������������������*/
          WinQueryWindowText(hwnd, sizeof(szFmt), szFmt);

          sprintf(szText, szFmt, pData->pMsg->pDesc);

          WinSetWindowText(hwnd, szText);

          /*��������������������������������������������������������������Ŀ*/
          /*� Display MSG's value                                          �*/
          /*����������������������������������������������������������������*/
          sprintf(szText,
                  "0x%4.4X (%d)",
                  pData->pMsg->Msg,
                  pData->pMsg->Msg);

          WinSetWindowText( WinWindowFromID(hwnd, DLG_MD_ST_MSG), szText);

          /*��������������������������������������������������������������Ŀ*/
          /*� Display MSG "seen" values                                    �*/
          /*����������������������������������������������������������������*/
          WinQueryWindowText( WinWindowFromID(hwnd, DLG_MD_ST_SEEN),
                              sizeof(szFmt), szFmt);

          sprintf( szText,
                   szFmt,
                   pData->pMsg->aulTimes[MSG_TIMES_EVER],
                   pData->pMsg->aulTimes[MSG_TIMES_SINCE]
                 );

          WinSetWindowText( WinWindowFromID(hwnd, DLG_MD_ST_SEEN), szText);

          /*��������������������������������������������������������������Ŀ*/
          /*� Set MP format values                                         �*/
          /*�                                                              �*/
          /*� Note: WM_CONTROL messages are generated by the following     �*/
          /*�       which cause formatting of MP1 / MP2 data (see above)   �*/
          /*����������������������������������������������������������������*/
          LoadMpFormats(hwnd, DLG_MD_DD_MP1, pData->pMsg->fMP1);
          LoadMpFormats(hwnd, DLG_MD_DD_MP2, pData->pMsg->fMP2);

      break;

     /*�������������������������������������������������������������������Ŀ*/
     /*� We don't need to handle any other messages...                     �*/
     /*�                                                                   �*/
     /*� If this isn't an IPF message, let PM do it's default "thing"      �*/
     /*���������������������������������������������������������������������*/
     default:
          if ( !HandleIPF(hwnd, message, lParam1, lParam2, &dpResult) )
            dpResult = WinDefDlgProc(hwnd, message, lParam1, lParam2 );
   }

   /*�����������������������������������������������������������������������Ŀ*/
   /*� Exit                                                                  �*/
   /*�������������������������������������������������������������������������*/
   return( dpResult );
}