int         main( void)

{
    HAB     hab = 0;
    HMQ     hmq = 0;
    HWND    hwnd = 0;
    int     nRtn = 8;
    QMSG    qmsg;

do
{
    Morph();

    hab = WinInitialize( 0);
    if (!hab)
        break;

    hmq = WinCreateMsgQueue( hab, 0);
    if (!hmq)
        break;

    // avoid compatibility problems
    // RWSFULLVERSION for RwsTest v0.80 is 0x08000100
    if (RwsQueryVersion( 0) < RWSFULLVERSION) {
        WinMessageBox( HWND_DESKTOP, 0,
                       "Please use a newer version of the RWS08 dlls",
                       "FPos", 1, MB_OK | MB_ERROR | MB_MOVEABLE);
        break;
    }

    hwnd = WinLoadDlg(
                HWND_DESKTOP,               //  parent-window
                NULLHANDLE,                 //  owner-window
                MainWndProc,                //  dialog proc
                NULLHANDLE,                 //  EXE module handle
                IDD_MAIN,                   //  dialog id
                NULL);                      //  pointer to create params

    if (!hwnd)
        break;

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

    nRtn = 0;

} while (fFalse);

    if (nRtn)
        DosBeep( 440, 150);

    if (hwnd)
        WinDestroyWindow( hwnd);
    if (hmq)
        WinDestroyMsgQueue( hmq);
    if (hab)
        WinTerminate( hab);

    return (nRtn);
}
INT main(VOID) {
   HWND hwnd;
   HAB hab;
   HMQ hmq;
   QMSG qmsg;
   HWND hHlp;

   hmq = WinCreateMsgQueue(hab = WinInitialize(0), 0);
   hwnd = WinLoadDlg(HWND_DESKTOP,  // parent
                     NULLHANDLE,    // owner
                     dlgProc,       // dialog window proc
                     NULLHANDLE,    // module handle
                     ID_MAIN,      // dialog template ID
                     NULL);         // application data pointer

   if (hwnd) {
      hHlp = initHelp(hwnd);
      while (WinGetMsg(hab, &qmsg, NULLHANDLE, 0, 0))
         WinDispatchMsg(hab, &qmsg);
      endHelp(hwnd, hHlp);
   }

   WinDestroyWindow(hwnd);
   WinDestroyMsgQueue(hmq);
   WinTerminate(hab);
   return 0;
} /* end main */
/****************************************************************************
   Main Program start
*****************************************************************************/
int main()
{
    HMQ   hmq;
    QMSG  qmsg;

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

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

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


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

    WinDestroyWindow (hWndFrame);
    WinDestroyMsgQueue (hmq);
    WinTerminate (hab);
    return (0);
}
示例#4
0
/*
 * The prototype for ico_wpMenuItemSelected was replaced by the following prototype:
 */
SOM_Scope BOOL  SOMLINK ico_wpMenuItemSelected(DDIcon *somSelf,
                                               HWND hwndFrame,
                                               ULONG ulMenuId)
{
   PDLGTEMPLATE pdlgt;
   HMODULE    hmodResource;  // Resource module handle

   /* DDIconData *somThis = DDIconGetData(somSelf); */
   DDIconMethodDebug("DDIcon","ico_wpMenuItemSelected");

   if (ulMenuId == MENUID_PRODUCT_INFO)
   {
      _Pmpf(("Calling 'QueryModuleHandle'"));

      hmodResource = QueryModuleHandle("DDIcon");

      _Pmpf(("Calling 'WinCreateDlg'"));

      WinLoadDlg(HWND_DESKTOP, HWND_DESKTOP,
                 ProdInfoDlgProc,
                 hmodResource,
                 DLGID_PRODINFO,
                 NULL);
   }

   return (DDIcon_parent_WPIcon_wpMenuItemSelected(somSelf,
                                                   hwndFrame,
                                                   ulMenuId));
}
HWND LoadAndAssociate( HWND hwndFrame, PPAGEDATA pPageData,
                       PPAGESELECTNOTIFY ppsn )
{
    HWND hwndDlg = WinLoadDlg( hwndFrame, ppsn->hwndBook, pPageData->pfnwpDlg,
                               0, pPageData->idDlg, NULL );

    if( hwndDlg )
    {
        // Allow the dialog to give us its initial focus id.

        pPageData->idFocus = (ULONG) WinSendMsg( hwndDlg, UM_GET_FOCUS_ID,
                                                 NULL, NULL );
        // Associate the dialog with the page.

        if( WinSendMsg( ppsn->hwndBook, BKM_SETPAGEWINDOWHWND,
                        MPFROMP( ppsn->ulPageIdNew ),
                        MPFROMLONG( hwndDlg ) ) )
            WinSetWindowPtr( hwndDlg, QWL_USER, pPageData );
        else
        {
            WinDestroyWindow( hwndDlg );
            hwndDlg = NULLHANDLE;
            Msg( "LoadAndAssociate SETPAGEWINDOWHWND RC(%X)",
                 HWNDERR( ppsn->hwndBook ) );
        }
    }
    else
        Msg( "LoadAndAssociate WinLoadDlg RC(%X)", HWNDERR( hwndBook ) );

    return hwndDlg;
}
示例#6
0
文件: xpi.c 项目: rn10950/RetroZilla
void InitProgressDlg()
{
  if(sgProduct.ulMode != SILENT)
  {
    dlgInfo.hWndDlg = WinLoadDlg(HWND_DESKTOP, hWndMain, ProgressDlgProc, hSetupRscInst, DLG_EXTRACTING, NULL);
    WinShowWindow(dlgInfo.hWndDlg, TRUE);
  }
}
bool KDialog::LoadDlg( KWindow* pkwndP, KWindow* pkwndO, HMODULE hmod,
                       ULONG idDlg, PVOID pCreateParams )
{
    HWND hwndP = pkwnd2hwnd( pkwndP );
    HWND hwndO = pkwnd2hwnd( pkwndO );

    CreateParams cp = { sizeof( cp ), pCreateParams, this };

    return WinLoadDlg( hwndP, hwndO, DlgProc, hmod, idDlg, &cp );
}
示例#8
0
 /* ##END User defined messages */
   default :
     HandleMessage(hwndFrame, hwndDlg, msg, mp1, mp2);
     return WinDefDlgProc(hwndDlg,msg,mp1,mp2);
   } /* end switch for main msg dispatch */
   return (MRESULT)FALSE;
} /* end dialog procedure */
HWND OpenO_CONFIG(HWND hwndOwner, PVOID pInfo)
{
   HWND hwndFrame;
   if (WinQueryWindowUShort(hwndOwner, QWS_ID) == FID_CLIENT)
      hwndOwner = WinQueryWindow(hwndOwner, QW_PARENT);
   hwndFrame =(HWND) WinLoadDlg(hwndOwner,
           hwndOwner,   
           O_CONFIGDlgProc, 
           0, ID_O_CONFIGFORM, 
           pInfo); 
   return hwndFrame;
}
示例#9
0
BOOL APIENTRY WprogressBar(HWND hParent, HWND hOwner, PPROGRESSDLG ppd) {
   QMSG  qmsg;
   HWND hwnd;
   PPRGSAPPDATA pad;
   BOOL rc = FALSE;
   
   // allocate storage for application data
   if (!(pad = (PPRGSAPPDATA)malloc(sizeof(PRGSAPPDATA)))) return FALSE;
   memset(pad, 0, sizeof(PRGSAPPDATA));
   pad->ppd = ppd;
   // ottiene tempo di inizio
   pad->start = WinGetCurrentTime(pad->hab = WinQueryAnchorBlock(hOwner))
                / 1000;
   // window handles
   if (ppd->fl & PRGSS_BITMAP) {
      SIZEL szl;
      WqueryBitmapSize(pad->ppd->hbmp, &szl);
      pad->cxbmp = szl.cx;
   } /* endif */
   if (NULLHANDLE != (hwnd = WinLoadDlg(hParent, hOwner, ProgressDlgProc,
                                     hmod, DLG_PROGRESS, pad))) {
      if (!ppd->pszPrgrss) ppd->pszPrgrss = SZ_PROGRESS;
      if (!ppd->pszTime) ppd->pszTime = SZ_ELAPSTIME;
      if (ppd->pszStop) WinSetDlgItemText(hwnd, BTN_STOP, ppd->pszStop);
      pad->hOwner = WinQueryWindow(hwnd, QW_OWNER);
      WinEnableWindow(pad->hOwner, FALSE);
      for(;;) {
         if (WinGetMsg(pad->hab, &qmsg, NULLHANDLE, 0, 0)) {    // loop standard
            if (qmsg.msg == PRGSM_END && qmsg.hwnd == hwnd) {
               if (pad->qQuit.msg)
                  WinPostMsg(pad->qQuit.hwnd, pad->qQuit.msg,
                             pad->qQuit.mp1, pad->qQuit.mp2);
               break;
            } // end if   
            WinDispatchMsg(pad->hab, &qmsg);
         } else {                   // WM_QUIT
            pad->qQuit = qmsg;
            if(qmsg.hwnd == NULLHANDLE)                       // SHUTDOWN
               WinPostMsg(hwnd, WM_CLOSE, MPFROMLONG(TRUE), NULL);
            else if(qmsg.hwnd == HWNDFROMMP(qmsg.mp2))        // TASKLIST
               WinPostMsg(hwnd, WM_CLOSE, 0L, 0L);
            else                            // chiusura regolare: termina
               break;
         } // end if
      } // end forever
      WinSetFocus(HWND_DESKTOP, hOwner);
      WinDestroyWindow(hwnd);
      WinEnableWindow(pad->hOwner, TRUE);
      rc = TRUE;
   } // end if
   free(pad);
   return rc;
}
示例#10
0
 /* ##END User defined messages */
   default :
     HandleMessage(hwndFrame, hwndDlg, msg, mp1, mp2);
     return WinDefDlgProc(hwndDlg,msg,mp1,mp2);
   } /* end switch for main msg dispatch */
   return (MRESULT)FALSE;
} /* end dialog procedure */
HWND OpenSETTINGS(HWND hwndOwner, PVOID pInfo)
{
   HWND hwndFrame;
   if (WinQueryWindowUShort(hwndOwner, QWS_ID) == FID_CLIENT)
      hwndOwner = WinQueryWindow(hwndOwner, QW_PARENT);
   hwndFrame =(HWND) WinLoadDlg(HWND_DESKTOP,
           hwndOwner,   
           SETTINGSDlgProc, 
           0, ID_SETTINGSFORM, 
           pInfo); 
   WinShowWindow(hwndFrame, TRUE);
   return hwndFrame;
}
示例#11
0
STATD :: StatusDisplay (PSZ pszName, ULONG c, HWND hwndOwner, BOOL f, PBOOL pf)
{
    cMax    = c;
    this->c = 0L;

    fInstantQuit = f;
    fFinished    = FALSE;

    pfBreak = pf;

    hwndDlg = WinLoadDlg (HWND_DESKTOP, hwndOwner, DialogProcedure,
                          GETMODULE, ID_DLG_STATUS, this);
    WinSetWindowText (hwndDlg, pszName);
}
示例#12
0
文件: gvpmeas.c 项目: 131/gsview
void 
measure_show(void)
{
    if (hwnd_measure) {
	WinSetWindowPos(hwnd_measure, HWND_TOP, 0, 0, 0, 0, 
	    SWP_ZORDER | SWP_ACTIVATE);
	return;
    }

    hwnd_measure = WinLoadDlg(HWND_DESKTOP, hwnd_frame, MeasureDlgProc, 
	hlanguage, IDD_MEASURE, NULL);
    WinSetWindowPos(hwnd_measure, HWND_TOP, 0, 0, 0, 0, 
	SWP_ZORDER | SWP_ACTIVATE);

}
示例#13
0
BOOL CPlugin::initEmbed(ULONG dwInitData)
{
  restorePreferences();

  HWND hWndParent = (HWND)dwInitData;

  if(WinIsWindow((HAB)0, hWndParent))
    m_hWndParent = hWndParent;

  WinLoadDlg(m_hWndParent, m_hWndParent, (PFNWP)TesterDlgProc, m_hInst, IDD_DIALOG_TESTER, (PVOID)this);

  m_bPluginReady = (m_hWnd != NULL);

  return m_bPluginReady;
}
示例#14
0
文件: HMLEdit.c 项目: komh/hanedit2
ULONG HEFind(HWND hwnd)
{
static char findStr[ 256 ] = { 0, };
static char replaceStr[ 256 ] = { 0, };

ULONG ulrc;
HWND hwndDlg;
HWND hwndFind;
HWND hwndReplace;
//char str[255];
//int hanmode,kbdtype;

    hwndDlg = WinLoadDlg(HWND_DESKTOP,hwnd,&HEFindDlgProc,NULLHANDLE,IDD_FIND,NULL);
    hwndFind = WinWindowFromID( hwndDlg, IDHEF_FIND );
    hwndReplace = WinWindowFromID( hwndDlg, IDHEF_REPLACE );

    WinSetWindowText( hwndFind, findStr );
//    WinSendMsg( hwndFind, HEM_SETSEL, MPFROM2SHORT( 0, strlen( findStr )), 0 );
//    WinSendMsg( hwndFind, HEM_REFRESH, 0, 0 );
    WinSetWindowText( hwndReplace, replaceStr );
//    WinSendMsg( hwndReplace, HEM_SETSEL,
//                MPFROM2SHORT( strlen( replaceStr ), strlen( replaceStr )), 0 );
//    WinSendMsg( hwndReplace, HEM_REFRESH, 0, 0 );

    WinSetFocus(HWND_DESKTOP,WinWindowFromID(hwndDlg, DID_OK ));

    ulrc = WinProcessDlg(hwndDlg);

//  if (ulrc == DID_OK)
//    {
//    }

    WinQueryWindowText( hwndFind, sizeof( findStr ), findStr );
    WinQueryWindowText( hwndReplace, sizeof( replaceStr ), replaceStr );

    WinDestroyWindow(hwndDlg);

//  hanmode = (int)WinSendMsg(hwndHMLE,HMLM_QUERYHANINPUTMODE,0,0);
//  kbdtype = (int)WinSendMsg(hwndHMLE,HMLM_QUERYKBDTYPE,0,0);

//  WinPostMsg(hwndStatbar,STATBAR_USERM_SETHANMODE,MPFROMLONG(hanmode),0L);
//  WinPostMsg(hwndStatbar,STATBAR_USERM_SETKBDTYPE,MPFROMLONG(kbdtype),0L);

    WinSetFocus(HWND_DESKTOP,hwndHMLE);
    return 0L;
}
INT main()
{
  HMQ   hmq;                           /* Message queue handle       */
  QMSG  qmsg;                          /* Receive PM queue message   */

                                       /* startup PM usage           */
  hab = WinInitialize(0);              /* Get the anchor block handle*/
  hmq = WinCreateMsgQueue(hab, 0);     /* Create the message queue   */
                                       /* register our window class  */
  WinRegisterClass(hab, "RexxCalc", Calculator, 0l, 0);

  /* Load the calculator dialog.  The dialog definitions are in      */
  /* rexxcalc.rc                                                     */

  hwndCalc = WinLoadDlg(HWND_DESKTOP, HWND_DESKTOP,
                        NULL,
                        0,
                        REXXCALC,      /* Dialog ID                  */
                        NULL);

  WinSendMsg(hwndCalc, WM_SETICON,     /* Set program icon           */
      (MPARAM)WinLoadPointer(HWND_DESKTOP, 0, REXXCALC), NULL);

                                       /* set the window focus       */
  WinSetFocus(HWND_DESKTOP,
      WinWindowFromID(hwndCalc, FID_CLIENT));

  /* Process the standard Presentation Manager message loop until    */
  /* we are told to terminate                                        */

                                       /* While more messages        */
  while (WinGetMsg(hab, &qmsg, 0, 0, 0))
     WinDispatchMsg(hab, &qmsg);       /* dispatch application       */
                                       /*   message handler          */


  /* The close option has been selected so we need to clean up       */
  /* our context.                                                    */

  WinDestroyWindow(hwndCalc);          /* Destroy the dialog window  */
  WinDestroyMsgQueue(hmq);             /* Destroy the message queue  */
  WinTerminate(hab);                   /* Terminate PM usage         */
  return (0);                          /* Indicate successful        */
                                       /*   completion               */
}
int main()
{
  HMQ hmq;
  HAB hab;
  CHAR szPMWIN[CCHMAXPATH];
  HMODULE hmodPMWIN;
  PSZ psz;
  HWND hwndDlg;
  SWP swp;
 
  hab = WinInitialize(0);
  hmq = WinCreateMsgQueue(hab, 0);

  if (!DosLoadModule(NULL, 0, "PMWIN", &hmodPMWIN))
  {
    DosQueryModuleName(hmodPMWIN, sizeof(szPMWIN), szPMWIN);
    psz = strrchr(szPMWIN, '\\');
    *psz = '\0';

    strcpy(vszSysDLLPath, szPMWIN);
  }
 
  hwndDlg = WinLoadDlg(HWND_DESKTOP,
      NULLHANDLE, ShrInstallDlgProc,
      NULLHANDLE,
      IDD_INSTALL, vszSysDLLPath);

  WinQueryWindowPos(hwndDlg, &swp);
  swp.x = (WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN) - swp.cx) / 2;
  swp.y = (WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN) - swp.cy) / 2;
  swp.fl |= SWP_ACTIVATE | SWP_MOVE | SWP_ZORDER;
  swp.hwndInsertBehind = HWND_TOP;

  WinSetMultWindowPos(NULLHANDLE, &swp, 1);

  WinProcessDlg(hwndDlg);

  WinDestroyMsgQueue(hmq);
  WinTerminate(hab);

  return 0;
}
示例#17
0
 /* ##END User defined messages */
   default :
     HandleMessage(hwndFrame, hwndDlg, msg, mp1, mp2);
     return WinDefDlgProc(hwndDlg,msg,mp1,mp2);
   } /* end switch for main msg dispatch */
   return (MRESULT)FALSE;
} /* end dialog procedure */
HWND OpenVIEWMR(HWND hwndOwner, PVOID pInfo)
{
   HWND hwndFrame;
   HWND hwndClient;
   FRAMECDATA frameData;
   frameData.cb=sizeof(FRAMECDATA);
   frameData.flCreateFlags= FCF_NOBYTEALIGN | FCF_SIZEBORDER | FCF_TITLEBAR | FCF_SYSMENU | FCF_TASKLIST | FCF_MAXBUTTON | FCF_MINBUTTON | FCF_ICON ;
   frameData.hmodResources=0;
   frameData.idResources=ID_VIEWMRFORM;
   if (WinQueryWindowUShort(hwndOwner, QWS_ID) == FID_CLIENT)
      hwndOwner = WinQueryWindow(hwndOwner, QW_PARENT);
   hwndFrame=WinCreateWindow(HWND_DESKTOP, WC_FRAME, "", 0,0,0,0,0,hwndOwner,HWND_TOP,ID_VIEWMRFORM,&frameData,0);
   if (hwndFrame) {
      hwndClient =(HWND) WinLoadDlg(hwndFrame,
              hwndFrame,   
              VIEWMRDlgProc, 
              0, ID_VIEWMRFORM, 
              pInfo); 
      WinShowWindow(hwndFrame, TRUE);
   }
   return hwndFrame;
}
示例#18
0
ULONG WinCenteredDlgBox(HWND hwndParent,
                        HWND hwndOwner,
                        PFNWP pfnDlgProc,
                        HMODULE hmod,
                        ULONG idDlg,
                        PVOID pCreateParams)
{
    ULONG           ulReply = DID_CANCEL;
    HWND            hwndDlg = WinLoadDlg(hwndParent, hwndOwner, pfnDlgProc,
                                         hmod, idDlg, pCreateParams);

    if (hwndDlg)
    {
        CenterWindow(hwndDlg);
        ulReply = WinProcessDlg(hwndDlg);
        WinDestroyWindow(hwndDlg);
    }
    else
        DisplayError("Cannot load dialog");

    return ulReply;
}
int main( void )
{
    HAB     hab;
    HMQ     hmq;
    HWND    hwndHelpInstance;   /* Handle to Help window    */
    HWND    hwndDlg;            // Main dlg window
    static SWCNTRL swctl;


    freopen ("err", "w", stderr);

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

    // Load main application dialog
    hwndDlg = WinLoadDlg (HWND_DESKTOP, HWND_DESKTOP,
        AirTrafficControlDlg, 0, IDDLG_CNRSAMP, 0);

    swctl.hwnd = hwndDlg;
    strcpy( swctl.szSwtitle, "Air Traffic Control Container" );
    WinAddSwitchEntry( &swctl );

    hwndHelpInstance = InitializeHelp (hab, hwndDlg, IDDLG_CNRSAMP,
        (PSZ) "atccnr.HLP", (
        PSZ) "Air Traffic Control Container Help Window", 0);

    WinProcessDlg (hwndDlg);

    if (hwndHelpInstance)
        WinDestroyHelpInstance (hwndHelpInstance);

    WinDestroyWindow (hwndDlg);

    WinDestroyMsgQueue (hmq);
    WinTerminate (hab);

    return 0;
}
示例#20
0
void M_CWMenuFolder::wpclsInitData()
{
  somId mySomId;
  CLASSINFO ci;
  
  /* call parent */
  if((mySomId=somIdFromString("wpclsInitData"))!=NULLHANDLE) {
    ((somTD_M_WPObject_wpclsInitData)
     somParentNumResolve(__ClassObject->somGetPClsMtabs(),
                         1,
                         __ClassObject->
                         somGetMethodToken(mySomId))
     )(this);
    SOMFree(mySomId);
  }
  else
    M_WPFolder::wpclsInitData();

  if(!fInitDone) {
    /* Get install dir */
    queryInstallDir(chrInstallPath, sizeof(chrInstallPath));
    /* INI file path */
    queryIniFilePath(chrWPSWizIni, sizeof(chrWPSWizIni));

    /* Register new button class */
    if(WinQueryClassInfo(WinQueryAnchorBlock(HWND_DESKTOP),
                         (PSZ) WC_BUTTON,
                         &ci))
      {
        g_ulButtonDataOffset=ci.cbWindowData;
        g_pfnwpOrgButtonProc=ci.pfnWindowProc;
        
        ulQWP_WIZBUTTONDATA=g_ulButtonDataOffset;
        
        if (WinRegisterClass(WinQueryAnchorBlock(HWND_DESKTOP),
                             (PSZ) WC_WIZBUTTON,
                             fnwpWizButtonProc,
                             //  ci.pfnWindowProc, 
                             ci.flClassStyle&~CS_PUBLIC,
                             ci.cbWindowData + WIZBUTTON_DATASIZE))
          {
            /* */

          }
      }

    if(WinQueryClassInfo(WinQueryAnchorBlock(HWND_DESKTOP),
                         WC_STATIC,
                         &ci))
      {
        g_haveFlyOverClient=TRUE; /* Blended flyover window is only available if CWFolder is
                                     installed. */
      }
    
    /* Register percentbar class */
    if(!percentRegisterBarClass())
      SysWriteToTrapLog("Can't register percent bar window class.\n");
    
    /* Register REXX functions */
    RexxRegisterFunctionExe("WPSWizCallWPSFunc", (PFN)rxCallWPSFunc);
    RexxRegisterFunctionExe("WPSWizCallWinFunc", (PFN)rxCallPMFunc);
    RexxRegisterFunctionExe("WPSWizCallFunc", (PFN)rxCallCWWPSFunc);
    RexxRegisterFunctionExe("WPSWizCallWPSClsFunc", (PFN)rxCallWPSClassFunc);
    RexxRegisterFunctionExe("DevGetHash", (PFN)rxGetHash);
    /* Register the gadget REXX function */
    RexxRegisterFunctionExe("WPSWizGadgetFunc", (PFN)rxCallCWWPSFunc);
    RexxRegisterExitExe("WIZREXX", (PFN)cwRexxExitHandler, NULLHANDLE);

    /* Load Rexx error dialog */
    if(!g_hwndRexxError) {
      somTD_M_CWObject_wizclsSetRexxErrorWindowHWND methodPtr;

      g_hwndRexxError=WinLoadDlg(HWND_DESKTOP, HWND_DESKTOP, pfnwpRexxErrorProc, 
                                 queryModuleHandle(), IDDLG_REXXERROR, NULLHANDLE);

      TRY_LOUD(ERROR_HWND) {
        /* Make sure M_CWObject class is installed and replaces the normal M_WPObject
           class. If yes, the M_CWMenuFolder class has a new static method
           "wizclsSetRexxErrorWindowHWND". */
        methodPtr=(somTD_M_CWObject_wizclsSetRexxErrorWindowHWND)
          somResolveByName( this,
                          "wizclsSetRexxErrorWindowHWND");
        //   SysWriteToTrapLog("%s: %x\n", __FUNCTION__, methodPtr);
        if(methodPtr)
          methodPtr(this, g_hwndRexxError);
          }
      CATCH(ERROR_HWND)
        {
          SysWriteToTrapLog("%s: Error while setting REXX error window HWND.\n", __FUNCTION__);
        } END_CATCH;
        
    }
示例#21
0
MRESULT EXPENTRY fnwpMain(HWND hwndFrame, ULONG msg, MPARAM mp1, MPARAM mp2)
{
    PSZ             szData;
    PDDESTRUCT      pddeStruct;
    ULONG           mem;

    CHAR            szBuffer[200];

    switch (msg)
    {

        // all answers to the WinDDEInitate call arrive here
        case WM_DDE_INITIATEACK:
        {
            PDDEINIT        pddeInit;
            PSZ             szInApp, szInTopic;
            static BOOL bNetscapeAnswered = FALSE;

            pddeInit = (PDDEINIT)mp2;
            szInApp = pddeInit->pszAppName;
            szInTopic = pddeInit->pszTopic;
            G_hServerWnd = (HWND)mp1;

            ShowMessage("WM_DDE_INITIATEACK (resp to WinDDEInitiate)");
            ShowMessage("  application: \"%s\"",
                        pddeInit->pszAppName);
            ShowMessage("  topic: \"%s\"",
                        pddeInit->pszTopic);

            // RDP 2000-07-07 07:24:18
            // There was no check on which application responded.
            // This made NETSCDDE fail when another DDE-aware application,
            // like EPM, was running.
            // Now the handle from mp1 is only assigned if the application
            // responding is Netscape.
            // If the app is not Netscape then the handle is nullified.
            // I don't know if assigning 0 to the handle is correct but
            // is seems to solve the problem.

            // V0.9.19 (2002-03-28) [umoeller]
            // Opera fix: use stricmp instead of strcmp
            if (!stricmp(pddeInit->pszAppName,
                         G_szDDENetscape))     // V0.9.16 (2001-10-02) [umoeller]
            {
                // ShowMessage("!! Netscape answered.");
                G_hServerWnd = (HWND)mp1;
                bNetscapeAnswered = TRUE;
            }
            else
            {
                // ShowMessage("!! Other application aswered.");
                G_hServerWnd = (HWND)0;
            }
        }
        break;

        // all answers to DDE requests arrive here
        case WM_DDE_DATA:
        {
            ShowMessage("!! Received data from Netscape: ");
            pddeStruct = (PDDESTRUCT) mp2;
            DosGetSharedMem(pddeStruct, PAG_READ | PAG_WRITE);
            szData = (BYTE *) (pddeStruct + (pddeStruct->offabData));
            ShowMessage(szData);
        }
        break;

        // menu item processing (in debug mode, otherwise these
        // WM_COMMAND msgs have been posted automatically)
        case WM_COMMAND:
            switch (SHORT1FROMMP(mp1))
            {
                // start DDE conversation: this was posted
                // by "main" before the PM loop was entered
                // (even if we're in debug mode)
                case IDM_INITIATE:
                    // WinPostMsg(G_hwndListbox, LM_DELETEALL, 0, 0);
                    ShowMessage("IDM_INITIATE:");
                    ShowMessage("Topic: \"%s\"", G_szOpenURLTopic);
                    G_context.cb = sizeof(CONVCONTEXT);
                    G_context.fsContext = 0;
                    WinDdeInitiate(hwndFrame, G_szDDENetscape,
                                   G_szOpenURLTopic, &G_context);
                    if (!G_optDebug)
                        // if we're not in debug mode, post subsequent
                        // menu commands automatically
                        WinPostMsg(hwndFrame, WM_COMMAND, MPFROM2SHORT(IDM_CHAIN2, 0), 0);
                break;

                // "Open URL": request data from server
                case IDM_OPENURL:
                {
                    ShowMessage("IDM_OPENURL");
                    ShowMessage("  URL: \"%s\"", G_szURL);
                    strlcpy(szBuffer, G_szURL, sizeof(szBuffer));
                    strlcat(szBuffer, ",,0xFFFFFFFF,0x0", sizeof(szBuffer));
                    DDERequest(hwndFrame, szBuffer);
                }
                break;

                // "Open URL in new window": request data from server,
                // but with different parameters
                case IDM_OPENURLNEW:
                {
                    ShowMessage("IDM_OPENURLNEW");
                    ShowMessage("  URL: \"%s\"", G_szURL);
                    strlcpy(szBuffer, G_szURL, sizeof(szBuffer));
                    strlcat(szBuffer, ",,0x0,0x0", sizeof(szBuffer));
                    DDERequest(hwndFrame, szBuffer);
                }
                break;

                /*
                 * IDM_CHAIN2:
                 *      this is posted after DDE_INITIATE was
                 *      successful
                 */

                case IDM_CHAIN2:
                {
                    if (G_optNewWindow)
                        WinPostMsg(G_hwndDebug, WM_COMMAND, MPFROM2SHORT(IDM_OPENURLNEW, 0), 0);
                    else
                        WinPostMsg(G_hwndDebug, WM_COMMAND, MPFROM2SHORT(IDM_OPENURL, 0), 0);
                    WinPostMsg(G_hwndDebug, WM_COMMAND, MPFROM2SHORT(IDM_CHAIN3, 0), 0);
                }
                break;

                /*
                 * IDM_CHAIN3:
                 *      this is posted to close the whole thing; we just need
                 *      another msg before going for IDM_CLOSE, or some DDE
                 *      msgs might get lost
                 */

                case IDM_CHAIN3:
                    WinPostMsg(G_hwndDebug, WM_COMMAND, MPFROM2SHORT(IDM_CLOSE, 0), 0);
                break;

                case IDM_FULLSEQUENCE:
                    WinPostMsg(G_hwndDebug, WM_COMMAND, MPFROM2SHORT(IDM_INITIATE, 0), 0);
                    WinPostMsg(G_hwndDebug, WM_COMMAND, MPFROM2SHORT(IDM_CHAIN2, 0), 0);
                break;


                /*
                 * IDM_CLOSE:
                 *      this is posted to close the whole thing
                 */

                case IDM_CLOSE:
                    WinDdePostMsg(G_hServerWnd,
                                  hwndFrame,
                                  WM_DDE_TERMINATE,
                                  NULL,
                                  DDEPM_RETRY);
                    ShowMessage("DDE connection closed.");

                    if (!G_optDebug)
                        WinPostMsg(hwndFrame, WM_COMMAND, MPFROM2SHORT(IDM_DELAYEXIT, 0), 0);
                break;

                /*
                 * IDM_DELAYEXIT:
                 *      this is posted after IDM_CLOSE; we will now
                 *      check for whether the DDE conversation with
                 *      Netscape was successful and, if not, start
                 *      a new instance of Netscape according to the
                 *      command line parameters
                 */

                case IDM_DELAYEXIT:
                {
                    if (    (!G_NetscapeFound)
                         && (G_optExecute)
                       )
                    {
                        CHAR szStart[256];
                        GetNLSString(szStart, sizeof(szStart), ID_NDSI_STARTNETSCAPE);

                        // confirm start netscape
                        if (    (!G_optConfirmStart)
                             // get rid of this hideously ugly dialog
                             || (WinMessageBox(HWND_DESKTOP,
                                               HWND_DESKTOP,
                                               szStart,
                                               (PSZ)NETSCDDE_TITLE,
                                               0,
                                               MB_YESNO | MB_MOVEABLE)
                                       == MBID_YES)
                                               /* WinCenteredDlgBox(HWND_DESKTOP,
                                                   G_hwndDebug,
                                                   WinDefDlgProc,
                                                   G_hmodNLS,
                                                   ID_NDD_QUERYSTART,
                                                   NULL)
                                      == DID_OK) */
                           )
                        {
                            UCHAR           achObjBuf[256] = "";

                            CHAR            szArgs[CCHMAXPATH];

                            HWND            hwndNotify = HWND_DESKTOP;
                            PROGDETAILS     pd;
                            HAPP            happ;

                            // destroy "Contacting", create "Starting Netscape"
                            // window
                            WinDestroyWindow(G_hwndContacting);
                            G_hwndContacting = NULLHANDLE;

                            if (!G_optQuiet)
                            {
                                G_hwndContacting = WinLoadDlg(HWND_DESKTOP, G_hwndDebug,
                                                            WinDefDlgProc,
                                                            G_hmodNLS, ID_NDD_STARTING,
                                                            0);
                                WinShowWindow(G_hwndContacting, TRUE);
                            }

                            strlcpy(szArgs, G_szNetscapeParams, sizeof(szArgs));
                            strlcat(szArgs, " ", sizeof(szArgs));
                            strlcat(szArgs, G_szURL, sizeof(szArgs));

                            // now start app
                            memset(&pd, 0, sizeof(pd));
                            pd.Length = sizeof(pd);
                            pd.progt.progc = PROG_DEFAULT;
                            pd.progt.fbVisible = SHE_VISIBLE;
                            pd.pszExecutable = G_szNetscapeApp;
                            pd.pszParameters = szArgs;
                            pd.pszStartupDir = G_szStartupDir;

                            if (!(happ = WinStartApp(NULLHANDLE,
                                                     &pd,
                                                     szArgs,
                                                     NULL,
                                                     SAF_INSTALLEDCMDLINE)))
                            {
                                DisplayError("WinStartApp failed for app \"%s\", params \"%s\", startup dir \"%s\"",
                                             G_szNetscapeApp,
                                             szArgs,
                                             G_szStartupDir);
                            }
                        }
                    }
                    // keep "Contacting" / "Starting" window visible for two seconds
                    G_idTimer = WinStartTimer(G_hab, hwndFrame, 1, 2000);
                    break;
                }

                // User closes the window
                case IDM_EXIT:
                    WinPostMsg(hwndFrame, WM_CLOSE, 0, 0);
                break;
            }
            break;

        case WM_TIMER:
            // after two seconds, close status window
            WinStopTimer(G_hab, hwndFrame, G_idTimer);
            WinPostMsg(hwndFrame, WM_CLOSE, 0, 0);
        break;

        // Send the message to the usual WC_FRAME WndProc
        default:
            return G_SysWndProc(hwndFrame, msg, mp1, mp2);
    }

    return FALSE;
}
示例#22
0
int main(int argc,
         char *argv[])
{
    HMQ             hmq;
    FRAMECDATA      fcd;
    QMSG            qmsg;
    BOOL            Proceed = TRUE;

    if (!(G_hab = WinInitialize(0)))
        return 1;

    if (!(hmq = WinCreateMsgQueue(G_hab, 0)))
        return 1;

    // now attempt to find the XWorkplace NLS resource DLL,
    // which we need for all resources (new with XWP 0.9.0)
    Proceed = LoadNLS();

    // load browser path from USER_INI
    // V0.9.19 (2002-03-28) [umoeller]
    if (PrfQueryProfileString(HINI_USERPROFILE,
                              "WPURLDEFAULTSETTINGS", "DefaultBrowserExe",
                              (PSZ)DEFAULT_BROWSER,
                              G_szNetscapeApp,
                              sizeof(G_szNetscapeApp)))
    {
        // make sure this is not NETSCDDE.EXE, or we'll have
        // plenty of problems restarting ourselves infinitely
        // V0.9.19 (2002-04-02) [umoeller]
        if (strhistr(G_szNetscapeApp, "netscdde.exe"))
            strlcpy(G_szNetscapeApp, DEFAULT_BROWSER, sizeof(G_szNetscapeApp));
    }

    // load browser startup dir from USER_INI
    // V0.9.19 (2002-03-28) [umoeller]
    PrfQueryProfileString(HINI_USERPROFILE,
                          "WPURLDEFAULTSETTINGS", "DefaultWorkingDir",
                          "",
                          G_szStartupDir,
                          sizeof(G_szStartupDir));

    if (Proceed)
    {
        // parse parameters on cmd line
        if (argc > 1)
        {
            SHORT           i = 0;

            while (i++ < argc - 1)
            {
                if (argv[i][0] == '-')
                {
                    SHORT           i2;

                    for (i2 = 1; i2 < strlen(argv[i]); i2++)
                    {
                        switch (argv[i][i2])
                        {
                            case 'n':
                                G_optNewWindow = TRUE;
                                break;

                            case 'x':
                                G_optExecute = FALSE;
                                break;

                            case 'm':
                                G_optMinimized = TRUE;
                                break;

                            case 'h':
                                G_optHidden = TRUE;
                                break;

                            case 'X':
                                G_optConfirmStart = FALSE;
                                break;

                            case 'p':   // netscape path

                                if (i < argc)
                                {
                                    strlcpy(G_szNetscapeApp, argv[i + 1], sizeof(G_szNetscapeApp));
                                    i++;
                                    i2 = 1000;
                                }
                                else
                                {
                                    ExplainParams();
                                    Proceed = FALSE;
                                }
                                break;

                            case 's':   // startup dir V0.9.16 (2001-10-02) [umoeller]
                            {
                                if (i < argc)
                                {
                                    strlcpy(G_szStartupDir, argv[i + 1], sizeof(G_szStartupDir));
                                    i++;
                                    i2 = 1000;
                                }
                                else
                                {
                                    ExplainParams();
                                    Proceed = FALSE;
                                }
                                break;
                            }

                            case 'S':   // DDE server name V0.9.16 (2001-10-02) [umoeller]
                                if (i < argc)
                                {
                                    strlcpy(G_szDDENetscape, argv[i + 1], sizeof(G_szDDENetscape));
                                    i++;
                                    i2 = 1000;
                                }
                                else
                                {
                                    ExplainParams();
                                    Proceed = FALSE;
                                }
                                break;

                            case 'P':   // netscape parameters

                                if (i < argc)
                                {
                                    strlcpy(G_szNetscapeParams, argv[i + 1], sizeof(G_szNetscapeParams));
                                    i++;
                                    i2 = 1000;
                                }
                                else
                                {
                                    ExplainParams();
                                    Proceed = FALSE;
                                }
                                break;

                            case 'D':   // debug, show list box window w/ DDE msgs

                                G_optDebug = TRUE;
                                break;

                            case 'q': // added V0.9.1 (2000-02-07) [umoeller]
                                G_optQuiet = TRUE;
                                break;

                            default:    // unknown parameter
                                ExplainParams();
                                Proceed = FALSE;
                                break;
                        }
                    }
                }
                else
                {
                    // no option ("-"): seems to be URL
                    _PmpfF(("got URL [%s]", argv[i]));
                    // if the URL contains spaces, we enclose it in quotes
                    // V1.0.0 (2002-09-09) [umoeller]: not only spaces,
                    // but other weird characters too
                    if (strpbrk(argv[i], " &|="))
                        sprintf(G_szURL, "\"%s\"", argv[i]);
                    else
                        strlcpy(G_szURL, argv[i], sizeof(G_szURL));
                }
            }
        }

        if (strlen(G_szURL) == 0)
        {
            // no URL given: explain
            ExplainParams();
            Proceed = FALSE;
        }

        if (Proceed)
        {
            // OK, parameters seemed to be correct:
            // create the main window, which is only
            // visible in Debug mode ("-D" param). But
            // even if not in debug mode, this window is
            // used for DDE message processing.
            fcd.cb = sizeof(FRAMECDATA);
            fcd.flCreateFlags = FCF_TITLEBAR |
                                   FCF_SYSMENU |
                                   FCF_MENU |
                                   FCF_SIZEBORDER |
                                   FCF_SHELLPOSITION |
                                   FCF_MINMAX |
                                   FCF_TASKLIST;

            fcd.hmodResources = NULLHANDLE;
            // set our resource key (so PM can find menus, icons, etc).
            fcd.idResources = DDEC;
            // create the frame
            G_hwndDebug = WinCreateWindow(HWND_DESKTOP,
                                          WC_FRAME,
                                          (PSZ)NETSCDDE_TITLE,
                                          0, 0, 0, 0, 0,
                                          NULLHANDLE,
                                          HWND_TOP,
                                          DDEC,
                                          &fcd,
                                          NULL);

            if (!G_hwndDebug)
                return 1;

            // set the NetscDDE icon for the frame window
            WinSendMsg(G_hwndDebug,
                       WM_SETICON,
                       (MPARAM)WinLoadPointer(HWND_DESKTOP, G_hmodNLS,
                                              ID_ND_ICON),
                       NULL);

            // create a list window child
            G_hwndListbox = WinCreateWindow(G_hwndDebug,
                                            WC_LISTBOX,
                                            NULL,
                                            LS_HORZSCROLL,
                                            0, 0, 0, 0,
                                            G_hwndDebug,
                                            HWND_BOTTOM,
                                            FID_CLIENT,
                                            NULL,
                                            NULL);

            // we must intercept the frame window's messages;
            // we save the return value (the current WndProc),
            // so we can pass it all the other messages the frame gets.
            G_SysWndProc = WinSubclassWindow(G_hwndDebug, (PFNWP) fnwpMain);

            // the window we just created is normally invisible; we
            // will only display it if the (undocumented) "-D" option
            // was given on the command line.
            if (G_optDebug)
            {
                WinShowWindow(G_hwndDebug, TRUE);
                ShowMessage("Entering msg loop");
            }

            // now show "Contacting Netscape"
            if (!G_optQuiet)
            {
                G_hwndContacting = WinLoadDlg(HWND_DESKTOP, G_hwndDebug,
                                            WinDefDlgProc,
                                            G_hmodNLS, ID_NDD_CONTACTING,
                                            0);
                WinShowWindow(G_hwndContacting, TRUE);
            }

            // now post msg to main window to initiate DDE
            if (!G_optDebug)
                WinPostMsg(G_hwndDebug, WM_COMMAND, MPFROM2SHORT(IDM_INITIATE, 0), 0);

            //  standard PM message loop
            while (WinGetMsg(G_hab, &qmsg, NULLHANDLE, 0, 0))
            {
                WinDispatchMsg(G_hab, &qmsg);
            }
        }                           // end if (proceed)

        // clean up on the way out
        WinDestroyWindow(G_hwndContacting);
        G_hwndContacting = NULLHANDLE;
    }

    WinDestroyMsgQueue(hmq);
    WinTerminate(G_hab);

    return 0;
}
SSMODULEDECLSPEC int SSMODULECALL SSModule_Configure(HWND hwndOwner, char *pchHomeDirectory)
{
  HWND hwndDlg;
  char chFileName[1024];
  char buffer[4097];
  int  chars;
  FILE *hFile;

  readConfig(pchHomeDirectory);
  // load the dialog
  hwndDlg = WinLoadDlg(HWND_DESKTOP, hwndOwner, fnConfigDialogProc, hmodOurDLLHandle, DLG_CONFIGURE, &CfgDlgInit);

  if (!hwndDlg) return SSMODULE_ERROR_INTERNALERROR;

  if (WinProcessDlg(hwndDlg) == PB_CONFOK) {

    char *pchHomeEnvVar;
    // User dismissed the dialog with OK button,
    // so save configuration!
    memset(chFileName, 0 , sizeof(chFileName));
    // Get home directory of current user
    hFile = NULL;
    pchHomeEnvVar = getenv("HOME");
    // If we have the HOME variable set, then we'll try to use
    // the .dssaver folder in there, otherwise fall back to
    // using the DSSaver Global home directory!
    if (pchHomeEnvVar) {
      int iLen;
      memset(chFileName, 0 , sizeof(chFileName));
      snprintf(chFileName, sizeof(chFileName)-1, "%s", pchHomeEnvVar);
      // Make sure it will have the trailing backslash!
      iLen = strlen(chFileName);
      if ((iLen>0) &&
          (chFileName[iLen-1]!='\\'))
      {
        chFileName[iLen] = '\\';
        chFileName[iLen+1] = 0;
      }
      // Now put there the .dssaver folder name and the config file name!
      strncat(chFileName, ".dssaver\\Text.CFG", sizeof(chFileName));
      // Try to open that config file!
      hFile = fopen(chFileName, "wt");
    }

    if (!hFile) {
      // If we could not open a config file in the HOME directory, or there was
      // no HOME directory, then try to use the DSSaver Global home directory!
      memset(chFileName, 0 , sizeof(chFileName));
      snprintf(chFileName, sizeof(chFileName), "%sText.CFG", pchHomeDirectory);
      hFile = fopen(chFileName, "wt");
    }

    if (!hFile) {
      // Could not create config file
      //DosBeep(1400,200);
    } else {
      memset(buffer,0, sizeof(buffer));
      sprintf(buffer, "sText = %s\n", CfgDlgInit.pchText);
      chars = fwrite(buffer, sizeof(char), strlen(buffer), hFile);
      if (chars != strlen(buffer)) {
        // bad file
        //DosBeep(1400,200);
        fclose(hFile);
      }
      fclose(hFile);
    }

  }

  WinDestroyWindow(hwndDlg);

  return SSMODULE_NOERROR;


}
MRESULT EXPENTRY fnSaverWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
  SWP swpDlg, swpParent;
  HWND hwndDlg;
  int rc;

  switch( msg )
  {
    case WM_SUBCLASS_INIT:
		case WM_CREATE: {
			RECTL rclRect;
			// Any initialization of the window and variables should come here.

			// the timer for the moving text
			ulAnimationTimerID = WinStartTimer(WinQueryAnchorBlock(hwnd), hwnd, ANIMATION_TIMER_ID, 20);

			// setup the initial coordinates for the scrolling text
			WinQueryWindowRect(hwnd, &rclRect);
			textX = rclRect.xRight;
			textY = rclRect.yTop/2;

			// Hide mouse pointer, if we're in real screen-saving mode!
			if (!bOnlyPreviewMode) WinShowPointer(HWND_DESKTOP, FALSE);
			// Initialize WMCHAR record
			internal_InitWMCHARRecord();
		break; }

		case WM_CHAR:
		if (!bOnlyPreviewMode) internal_SaveWMCHAREventToRecord(mp1, mp2);
		break;

    case WM_ASKPASSWORD:
      {
        // Get parameters
        char *pchPwdBuff = (char *) mp1;
	int iPwdBuffSize = (int) mp2;

	// Show mouse pointer, if we're screensaving.
	if (!bOnlyPreviewMode)
	  WinShowPointer(HWND_DESKTOP, TRUE);

	hwndDlg = WinLoadDlg(hwnd, hwnd,
			     fnAutoHiderDlgProc,
			     hmodOurDLLHandle,
			     DLG_PASSWORDPROTECTION,
			     NULL);
	if (!hwndDlg)
	{
	  // Could not load dialog window resources!
	  if (!bOnlyPreviewMode)
	    WinShowPointer(HWND_DESKTOP, FALSE);

	  return (MRESULT) SSMODULE_ERROR_INTERNALERROR;
	}

        // Ok, dialog window loaded!

        // Now set its texts (NLS)
        internal_SetPageFont(hwndDlg);
        internal_SetPwdProtWindowText(hwndDlg);

        // Resize the window so text will fit!
        internal_ArrangePwdProtWindowControls(hwndDlg);

	// Initialize control(s)!
	WinSendDlgItemMsg(hwndDlg, EF_PASSWORD,
			  EM_SETTEXTLIMIT,
			  (MPARAM) (iPwdBuffSize-1),
			  (MPARAM) 0);
	WinSetDlgItemText(hwndDlg, EF_PASSWORD, "");

	// Center dialog in screen
	if (WinQueryWindowPos(hwndDlg, &swpDlg))
	  if (WinQueryWindowPos(hwnd, &swpParent))
	  {
	    // Center dialog box within the screen
	    int ix, iy;
	    ix = swpParent.x + (swpParent.cx - swpDlg.cx)/2;
	    iy = swpParent.y + (swpParent.cy - swpDlg.cy)/2;
	    WinSetWindowPos(hwndDlg, HWND_TOP, ix, iy, 0, 0,
			    SWP_MOVE);
	  }
	WinSetWindowPos(hwndDlg, HWND_TOP, 0, 0, 0, 0,
			SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER);

		// Re-send WM_CHAR messages if needed
		if (bFirstKeyGoesToPwdWindow) internal_ReplayWMCHARRecord();

	// Process the dialog!
	rc = WinProcessDlg(hwndDlg);

	if (rc!=PB_OK)
	{
	  // The user pressed cancel!
          rc = SSMODULE_ERROR_USERPRESSEDCANCEL;
	} else
	{
	  // The user pressed OK!
	  // Get the entered password
	  WinQueryDlgItemText(hwndDlg, EF_PASSWORD,
			      iPwdBuffSize,
			      pchPwdBuff);
          rc = SSMODULE_NOERROR;
	}

	// Destroy window
	WinDestroyWindow(hwndDlg);

	// Hide mouse pointer again, if we're screensaving.
	if (!bOnlyPreviewMode)
	  WinShowPointer(HWND_DESKTOP, FALSE);

	return (MRESULT) rc;
      }

    case WM_SHOWWRONGPASSWORD:

      // Show mouse pointer, if we're screensaving.
      if (!bOnlyPreviewMode)
	WinShowPointer(HWND_DESKTOP, TRUE);

      hwndDlg = WinLoadDlg(hwnd, hwnd,
                           fnAutoHiderDlgProc,
                           hmodOurDLLHandle,
                           DLG_WRONGPASSWORD,
                           NULL);
      if (!hwndDlg)
      {
	// Could not load dialog window resources!

	if (!bOnlyPreviewMode)
          WinShowPointer(HWND_DESKTOP, FALSE);

        return (MRESULT) SSMODULE_ERROR_INTERNALERROR;
      }

      // Ok, dialog window loaded!

      // Now set its texts (NLS)
      internal_SetPageFont(hwndDlg);
      internal_SetWrongPwdWindowText(hwndDlg);

      // Resize the window so text will fit!
      internal_ArrangeWrongPwdWindowControls(hwndDlg);

      // Center dialog in screen
      if (WinQueryWindowPos(hwndDlg, &swpDlg))
        if (WinQueryWindowPos(hwnd, &swpParent))
        {
          // Center dialog box within the screen
          int ix, iy;
          ix = swpParent.x + (swpParent.cx - swpDlg.cx)/2;
          iy = swpParent.y + (swpParent.cy - swpDlg.cy)/2;
          WinSetWindowPos(hwndDlg, HWND_TOP, ix, iy, 0, 0,
                          SWP_MOVE);
        }
      WinSetWindowPos(hwndDlg, HWND_TOP, 0, 0, 0, 0,
                      SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER);

      // Process the dialog!
      rc = WinProcessDlg(hwndDlg);

      // Destroy window
      WinDestroyWindow(hwndDlg);

      // Hide mouse pointer again, if we're screensaving.
      if (!bOnlyPreviewMode)
        WinShowPointer(HWND_DESKTOP, FALSE);

      return (MRESULT) SSMODULE_NOERROR;

    case WM_SUBCLASS_UNINIT:
    case WM_DESTROY:
      // All kinds of cleanup (the opposite of everything done in WM_CREATE)
      // should come here.


      WinStopTimer(WinQueryAnchorBlock(hwnd), hwnd, ulAnimationTimerID);


      // Restore mouse pointer, if we're in real screen-saving mode!
      if (!bOnlyPreviewMode)
        WinShowPointer(HWND_DESKTOP, TRUE);
      break;

    case WM_ADJUSTWINDOWPOS:
      if (!bOnlyPreviewMode)
      {
	SWP *pSWP;

	// The following is required so that this window will be on
        // top of the xCenter window, evenif that is set to be always on top!

	// Real screensaving, here we should stay on top!
        // Set WS_TOPMOST flag again!
	WinSetWindowBits(hwnd, QWL_STYLE, WS_TOPMOST, WS_TOPMOST);

	pSWP = (SWP *) mp1;
	pSWP->hwndInsertBehind = HWND_TOP;
        pSWP->fl |= SWP_ZORDER;
      }
      break;
		case WM_PAINT: {
			HPS hpsBeginPaint;
			RECTL rclRect, blank, rclWindow;
			FONTMETRICS fm;
			int len;

			#ifdef DEBUG_LOGGING
				AddLog("WM_PAINT\n");
			#endif

			hpsBeginPaint = WinBeginPaint(hwnd, NULLHANDLE, &rclRect);
			WinQueryWindowRect(hwnd, &rclRect);
			WinQueryWindowRect(hwnd, &rclWindow);

			WinSetWindowFontMy(hwnd, "10.Courier");	
			GpiQueryFontMetrics(hpsBeginPaint, sizeof(fm), &fm);

			rclRect.xLeft = textX;
			rclRect.yTop  = textY;
			len = strlen(CfgDlgInit.pchText);
			rclRect.xRight = rclRect.xLeft + fm./*lAveCharWidth*/lMaxCharInc * len+5;
			rclRect.yBottom = rclRect.yTop - fm.lMaxBaselineExt;
			WinDrawText(hpsBeginPaint, len ,CfgDlgInit.pchText, &rclRect, CLR_WHITE, CLR_BLACK, DT_ERASERECT | DT_LEFT | DT_VCENTER);
			/* paint the black around the text*/
			blank.xLeft = 0; blank.yBottom = 0; blank.xRight = rclRect.xLeft; blank.yTop = rclWindow.yTop; WinFillRect(hpsBeginPaint, &blank, CLR_BLACK);
			blank.xLeft = rclRect.xLeft-2; blank.yBottom = rclRect.yTop; blank.xRight = rclWindow.xRight; blank.yTop = rclWindow.yTop; WinFillRect(hpsBeginPaint, &blank, CLR_BLACK);
			blank.xLeft = rclRect.xRight; blank.yBottom = 0; blank.xRight = rclWindow.xRight; blank.yTop = rclRect.yTop; WinFillRect(hpsBeginPaint, &blank, CLR_BLACK);
			blank.xLeft = rclRect.xLeft-2; blank.yBottom = 0; blank.xRight = rclRect.xRight+2; blank.yTop = rclRect.yBottom; WinFillRect(hpsBeginPaint, &blank, CLR_BLACK);
			if (rclRect.xRight <= -10) {
				WinQueryWindowRect(hwnd, &rclRect);
				textX = rclRect.xRight;
				textY = rclRect.yTop/2;
			}
			WinEndPaint(hpsBeginPaint);

			#ifdef DEBUG_LOGGING
				AddLog("WM_PAINT done\n");
			#endif
			return (MRESULT) FALSE;
		}

     case WM_TIMER:
      if (((SHORT)mp1)==ANIMATION_TIMER_ID)
      {
	// Timer, so make new image position
	textX -= 2;
	WinInvalidateRect(hwnd, NULL, FALSE);
      }
      break;

    default:
      break;
  }

  return WinDefWindowProc( hwnd, msg, mp1, mp2 );
}
示例#25
0
MRESULT EXPENTRY fnSaverWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
  SWP swpDlg, swpParent;
  HWND hwndDlg;
  int rc;

  switch( msg )
  {
    case WM_SUBCLASS_INIT:
    case WM_CREATE:
      // Any initialization of the window and variables should come here.

      // Hide mouse pointer, if we're in real screen-saving mode!
      if (!bOnlyPreviewMode)
        WinShowPointer(HWND_DESKTOP, FALSE);
      // Initialize WMCHAR record
      internal_InitWMCHARRecord();
      break;

    case WM_CHAR:
      if (!bOnlyPreviewMode)
        internal_SaveWMCHAREventToRecord(mp1, mp2);
      break;

    case WM_ASKPASSWORD:
      {
        // Get parameters
        char *pchPwdBuff = (char *) mp1;
	int iPwdBuffSize = (int) mp2;

	// Show mouse pointer, if we're screensaving.
        if (!bOnlyPreviewMode)
          WinShowPointer(HWND_DESKTOP, TRUE);

	hwndDlg = WinLoadDlg(hwnd, hwnd,
			     fnAutoHiderDlgProc,
			     hmodOurDLLHandle,
			     DLG_PASSWORDPROTECTION,
			     NULL);
	if (!hwndDlg)
	{
	  // Could not load dialog window resources!
          if (!bOnlyPreviewMode)
            WinShowPointer(HWND_DESKTOP, FALSE);

	  return (MRESULT) SSMODULE_ERROR_INTERNALERROR;
	}

        // Ok, dialog window loaded!

        // Now set its texts (NLS)
        internal_SetPageFont(hwndDlg);
        internal_SetPwdProtWindowText(hwndDlg);

        // Resize the window so text will fit!
        internal_ArrangePwdProtWindowControls(hwndDlg);

	// Initialize control(s)!
	WinSendDlgItemMsg(hwndDlg, EF_PASSWORD,
			  EM_SETTEXTLIMIT,
			  (MPARAM) (iPwdBuffSize-1),
			  (MPARAM) 0);
	WinSetDlgItemText(hwndDlg, EF_PASSWORD, "");

	// Center dialog in screen
	if (WinQueryWindowPos(hwndDlg, &swpDlg))
	  if (WinQueryWindowPos(hwnd, &swpParent))
	  {
	    // Center dialog box within the screen
	    int ix, iy;
	    ix = swpParent.x + (swpParent.cx - swpDlg.cx)/2;
	    iy = swpParent.y + (swpParent.cy - swpDlg.cy)/2;
	    WinSetWindowPos(hwndDlg, HWND_TOP, ix, iy, 0, 0,
			    SWP_MOVE);
	  }
	WinSetWindowPos(hwndDlg, HWND_TOP, 0, 0, 0, 0,
			SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER);

        // Re-send WM_CHAR messages if needed
        if (bFirstKeyGoesToPwdWindow)
          internal_ReplayWMCHARRecord();

        // Process the dialog!
	rc = WinProcessDlg(hwndDlg);

	if (rc!=PB_OK)
	{
	  // The user pressed cancel!
          rc = SSMODULE_ERROR_USERPRESSEDCANCEL;
	} else
	{
	  // The user pressed OK!
	  // Get the entered password
	  WinQueryDlgItemText(hwndDlg, EF_PASSWORD,
			      iPwdBuffSize,
			      pchPwdBuff);
          rc = SSMODULE_NOERROR;
	}

	// Destroy window
	WinDestroyWindow(hwndDlg);

	// Hide mouse pointer again, if we're screensaving.
        if (!bOnlyPreviewMode)
          WinShowPointer(HWND_DESKTOP, FALSE);

	return (MRESULT) rc;
      }

    case WM_SHOWWRONGPASSWORD:

      // Show mouse pointer, if we're screensaving.
      if (!bOnlyPreviewMode)
	WinShowPointer(HWND_DESKTOP, TRUE);

      hwndDlg = WinLoadDlg(hwnd, hwnd,
                           fnAutoHiderDlgProc,
                           hmodOurDLLHandle,
                           DLG_WRONGPASSWORD,
                           NULL);
      if (!hwndDlg)
      {
	// Could not load dialog window resources!

        if (!bOnlyPreviewMode)
          WinShowPointer(HWND_DESKTOP, FALSE);

        return (MRESULT) SSMODULE_ERROR_INTERNALERROR;
      }

      // Ok, dialog window loaded!

      // Now set its texts (NLS)
      internal_SetPageFont(hwndDlg);
      internal_SetWrongPwdWindowText(hwndDlg);

      // Resize the window so text will fit!
      internal_ArrangeWrongPwdWindowControls(hwndDlg);

      // Center dialog in screen
      if (WinQueryWindowPos(hwndDlg, &swpDlg))
        if (WinQueryWindowPos(hwnd, &swpParent))
        {
          // Center dialog box within the screen
          int ix, iy;
          ix = swpParent.x + (swpParent.cx - swpDlg.cx)/2;
          iy = swpParent.y + (swpParent.cy - swpDlg.cy)/2;
          WinSetWindowPos(hwndDlg, HWND_TOP, ix, iy, 0, 0,
                          SWP_MOVE);
        }
      WinSetWindowPos(hwndDlg, HWND_TOP, 0, 0, 0, 0,
                      SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER);

      // Process the dialog!
      rc = WinProcessDlg(hwndDlg);

      // Destroy window
      WinDestroyWindow(hwndDlg);

      // Hide mouse pointer again, if we're screensaving.
      if (!bOnlyPreviewMode)
        WinShowPointer(HWND_DESKTOP, FALSE);

      return (MRESULT) SSMODULE_NOERROR;

    case WM_SUBCLASS_UNINIT:
    case WM_DESTROY:
      // All kinds of cleanup (the opposite of everything done in WM_CREATE)
      // should come here.

      // Restore mouse pointer, if we're in real screen-saving mode!
      if (!bOnlyPreviewMode)
        WinShowPointer(HWND_DESKTOP, TRUE);
      break;

    case WM_ADJUSTWINDOWPOS:
      if (!bOnlyPreviewMode)
      {
	SWP *pSWP;

	// The following is required so that this window will be on
        // top of the xCenter window, evenif that is set to be always on top!

	// Real screensaving, here we should stay on top!
        // Set WS_TOPMOST flag again!
	WinSetWindowBits(hwnd, QWL_STYLE, WS_TOPMOST, WS_TOPMOST);

	pSWP = (SWP *) mp1;
	pSWP->hwndInsertBehind = HWND_TOP;
        pSWP->fl |= SWP_ZORDER;
      }
      break;
    case WM_PAINT:
      {
        HPS hpsBeginPaint;
        RECTL rclRect;

#ifdef DEBUG_LOGGING
        AddLog("WM_PAINT\n");
#endif

        hpsBeginPaint = WinBeginPaint(hwnd, NULL, &rclRect);

        WinQueryWindowRect(hwnd, &rclRect);

        // Fill with black
        WinFillRect(hpsBeginPaint, &rclRect, CLR_BLACK);

	WinEndPaint(hpsBeginPaint);
	return (MRESULT) FALSE;
      }
    default:
      break;
  }

  return WinDefWindowProc( hwnd, msg, mp1, mp2 );
}
示例#26
0
文件: HMLEdit.c 项目: komh/hanedit2
ULONG HEOptions(HWND hwnd)
{
HWND hwndDlg;
ULONG TextFormat = (ULONG) WinSendMsg(hwndHMLE,HMLM_QUERYTEXTFORMAT,0L,0L);
ULONG HanType   = (ULONG)  WinSendMsg(hwndHMLE,HMLM_QUERYHANTYPE,0L,0L);
ULONG ulrc = ( ULONG ) WinSendMsg( hwndHMLE, HMLM_QUERYWRAP, 0, 0 );
//int old_eoltype = TextFormat;
//int old_hantype = HanType;
BOOL wordWrap = CHAR3FROMMP( ulrc );
BOOL wordProtect = CHAR4FROMMP( ulrc );
int  wordWrapSize = SHORT1FROMMR( ulrc );
CHAR size[ 10 ];

    hwndDlg = WinLoadDlg(HWND_DESKTOP,hwnd,&WinDefDlgProc,NULLHANDLE,IDD_OPTIONS,NULL);

    if (TextFormat==HMLE_EOL_CRLF)
        WinSendMsg(WinWindowFromID(hwndDlg,IDB_TF_CRLF),BM_SETCHECK,MPFROMLONG(1L),0L);
        else
        WinSendMsg(WinWindowFromID(hwndDlg,IDB_TF_LF),BM_SETCHECK,MPFROMLONG(1L),0L);
    if (HanType==HMLE_HAN_KS)
        WinSendMsg(WinWindowFromID(hwndDlg,IDB_HT_KS),BM_SETCHECK,MPFROMLONG(1L),0L);
        else
        WinSendMsg(WinWindowFromID(hwndDlg,IDB_HT_SY),BM_SETCHECK,MPFROMLONG(1L),0L);

    WinSendMsg( WinWindowFromID( hwndDlg, IDB_WORDWRAP ), BM_SETCHECK,
                MPFROMLONG( SHORT1FROMMR( wordWrap )), 0 );

    _itoa( wordWrapSize, size, 10 );
    WinSetWindowText( WinWindowFromID( hwndDlg, IDEF_WORDWRAP_SIZE ), size );

    //WinSetFocus(HWND_DESKTOP,hwndDlg);

    ulrc = WinProcessDlg(hwndDlg);

    if (ulrc == DID_OK)
        {
        TextFormat  = (ULONG) WinSendMsg(WinWindowFromID(hwndDlg,IDB_TF_CRLF),BM_QUERYCHECKINDEX,0L,0L);
        HanType     = (ULONG) WinSendMsg(WinWindowFromID(hwndDlg,IDB_HT_KS),BM_QUERYCHECKINDEX,0L,0L);
        if (TextFormat == 1)
            {
            WinSendMsg(hwndHMLE,HMLM_SETTEXTFORMAT,MPFROMLONG(HMLE_EOL_CRLF),0L);
            WinPostMsg(hwndStatbar,STATBAR_USERM_SETEOLTYPE,MPFROMLONG(HMLE_EOL_CRLF),0L);
            } else {
            WinSendMsg(hwndHMLE,HMLM_SETTEXTFORMAT,MPFROMLONG(HMLE_EOL_LF),0L);
            WinPostMsg(hwndStatbar,STATBAR_USERM_SETEOLTYPE,MPFROMLONG(HMLE_EOL_LF),0L);
            }
        if (HanType == 1)
            {
            WinSendMsg(hwndHMLE,HMLM_SETHANTYPE,MPFROMLONG(HMLE_HAN_KS),0L);
            WinPostMsg(hwndStatbar,STATBAR_USERM_SETHANTYPE,MPFROMLONG(HMLE_HAN_KS),0L);
            } else {
            WinSendMsg(hwndHMLE,HMLM_SETHANTYPE,MPFROMLONG(HMLE_HAN_SY),0L);
            WinPostMsg(hwndStatbar,STATBAR_USERM_SETHANTYPE,MPFROMLONG(HMLE_HAN_SY),0L);
            }

        wordWrap = ( BOOL )WinSendDlgItemMsg( hwndDlg, IDB_WORDWRAP, BM_QUERYCHECK, 0, 0 );
        WinQueryWindowText( WinWindowFromID( hwndDlg, IDEF_WORDWRAP_SIZE ), sizeof( size ), size );
        wordWrapSize = atoi( size );
        if(( wordWrapSize != 0 ) && ( wordWrapSize < MIN_WORDWRAP_SIZE ))
            wordWrapSize = MIN_WORDWRAP_SIZE;

        WinSendMsg( hwndHMLE, HMLM_SETWRAP, MPFROM2SHORT( wordWrap, wordProtect ), MPFROMSHORT( wordWrapSize ));
        }
    WinDestroyWindow(hwndDlg);
    return 0L;
}
BOOL AddNotebookPage(HWND hwndNoteBook, long pageID, PFNWP pfnDlgProc,
                     char szTabText[], char szMinorText[],
                     char szStatusText[], BOOL bMajor, char szClassName[])
{
    ULONG ulPageID;
    HWND hwndDialog;
    BOOKPAGEINFO bpInfo;

    if (bMajor)
    {
        // insert page
        if ((ulPageID = (ULONG) WinSendMsg(hwndNoteBook,
                                           BKM_INSERTPAGE,
                                           (MPARAM) NULL,
                                           MPFROM2SHORT(BKA_AUTOPAGESIZE |
                                                   BKA_STATUSTEXTON |
                                                   BKA_MAJOR | BKA_MINOR,
                                                   BKA_LAST))) == 0L)
        {
            PSUTErrorFunc(hwndNoteBook, "Error", "AddNotebookPage",
                          "Error Inserting the Major Notebook Page", 0UL);
            return FALSE;
        }
    }
    else
    {
        // insert page
        if ((ulPageID = (ULONG) WinSendMsg(hwndNoteBook,
                                           BKM_INSERTPAGE,
                                           (MPARAM) NULL,
                                           MPFROM2SHORT(BKA_AUTOPAGESIZE |
                                                   BKA_STATUSTEXTON |
                                                   BKA_MINOR,
                                                   BKA_LAST))) == 0L)
        {
            PSUTErrorFunc(hwndNoteBook, "Error", "AddNotebookPage",
                          "Error Inserting the Minor Notebook Page", 0UL);
            return FALSE;
        }
    }

    if ((hwndDialog = WinLoadDlg(hwndNoteBook,
                                 hwndNoteBook,
                                 pfnDlgProc,
                                 NULLHANDLE,
                                 pageID,
                                 MPFROMP(szClassName))) == NULLHANDLE)
    {
        PSUTErrorFunc(hwndNoteBook, "Error", "AddNotebookPage",
                      "Error Loading the Notebook Dialog", 0UL);

        return FALSE;
    }

    // set page info
    WinSendMsg(hwndNoteBook,
               BKM_SETPAGEDATA,
               MPFROMLONG(ulPageID),
               MPFROMSHORT(pageID));
    WinSendMsg(hwndNoteBook,
               BKM_SETTABTEXT,
               MPFROMLONG(ulPageID),
               MPFROMP(szTabText));
    WinSendMsg(hwndNoteBook,
               BKM_SETPAGEWINDOWHWND,
               MPFROMLONG(ulPageID),
               MPFROMHWND(hwndDialog));
    WinSendMsg(hwndNoteBook,
               BKM_SETSTATUSLINETEXT,
               MPFROMLONG(ulPageID),
               MPFROMP(szStatusText));

    // minor tab info
    memset(&bpInfo, 0, sizeof(bpInfo));
    bpInfo.cb = sizeof(bpInfo);
    bpInfo.fl = BFA_MINORTABTEXT;
    bpInfo.cbMinorTab = strlen(szMinorText);
    bpInfo.pszMinorTab = szMinorText;
    //Set the Minor text info, so popup menu has the correct text
    WinSendMsg(hwndNoteBook,
               BKM_SETPAGEINFO,
               MPFROMLONG(ulPageID),
               MPFROMP(&bpInfo));

    return TRUE;
}
示例#28
0
void DoWaWEConfigureWindow(HWND hwndOwner)
{
  SWP swpTemp, swpParent;
  POINTL ptlTemp;
  unsigned short usTabTextLength=0, usTabTextHeight=0;

  // The user wants to configure WaWE!

  // Save old config for Undo!
  memcpy(&WaWEUndoConfiguration, &WaWEConfiguration, sizeof(WaWEConfiguration));

  // For this, we'll create a notebook window.
  // The first page of the notebook will contain the cache settings.
  // Later, it can have more notebook tabs, if required.

#ifdef DEBUG_BUILD
  printf("[DoWaWEConfigureWindow] : Loading dialog from EXE...\n");
#endif

  hwndConfigDlg=WinLoadDlg(HWND_DESKTOP, hwndOwner, (PFNWP)ConfigDlgProc, NULL,
                          DLG_CONFIGURATION, NULL);

  if (!hwndConfigDlg)
  {
#ifdef DEBUG_BUILD
    printf("[DoWaWEConfigureWindow] : Could not load resource!\n");
#endif
    return;
  }

#ifdef DEBUG_BUILD
  printf("[DoWaWEConfigureWindow] : Dialog loaded, others come...\n");
#endif

  // Query the handle of the notebook control
  hwndConfigNB = WinWindowFromID(hwndConfigDlg, NB_CONFIGURATION);

  // Now load and add the pages, one by one...
  hwndCacheNBP = WinLoadDlg(hwndConfigNB, hwndConfigNB, (PFNWP) fnCacheNotebookPage,
                            NULL, DLG_CONFIGURATION_CACHE, NULL);
  hwndInterfaceNBP = WinLoadDlg(hwndConfigNB, hwndConfigNB, (PFNWP) fnInterfaceNotebookPage,
                                NULL, DLG_CONFIGURATION_INTERFACE, NULL);

  // Save the size of one notebook page for later use.
  // (after adding, it will be resized, because of the AUDIOSIZE flag of notebook!)
  WinQueryWindowPos(hwndCacheNBP, &swpTemp);

  // Add pages to notebook:
  AddNotebookTab(hwndConfigNB, hwndInterfaceNBP, BKA_MAJOR, "Interface", "Interface settings", &(ulInterfaceNBPID), &usTabTextLength, &usTabTextHeight);
  AddNotebookTab(hwndConfigNB, hwndCacheNBP, BKA_MAJOR, "Cache", "Read-cache settings", &(ulCacheNBPID), &usTabTextLength, &usTabTextHeight);

  // The followings are discarder on Warp4, but makes things look better on Warp3:

  // Set notebook info field color (default is white... Yipe...)
  WinSendMsg(hwndConfigNB,
             BKM_SETNOTEBOOKCOLORS,
	     MPFROMLONG(SYSCLR_FIELDBACKGROUND), MPFROMSHORT(BKA_BACKGROUNDPAGECOLORINDEX));
  // Adjust tab size:
  WinSendMsg(hwndConfigNB,
             BKM_SETDIMENSIONS,
             MPFROM2SHORT(usTabTextLength + 10, (SHORT)((float)usTabTextHeight * 0.8)),
	     MPFROMSHORT(BKA_MAJORTAB));
  WinSendMsg(hwndConfigNB,
	     BKM_SETDIMENSIONS,
             MPFROM2SHORT(0, 0),
	     MPFROMSHORT(BKA_MINORTAB));


  // Adjust controls and window size
  AdjustControls(swpTemp.cx, swpTemp.cy);

  // Position the window in the middle of its parent!
  WinQueryWindowPos(hwndOwner, &swpParent);
  ptlTemp.x = swpParent.x;
  ptlTemp.y = swpParent.y;
  WinMapWindowPoints(hwndOwner, HWND_DESKTOP, &ptlTemp, 1);
  swpParent.x = ptlTemp.x;
  swpParent.y = ptlTemp.y;
  WinQueryWindowPos(hwndConfigDlg, &swpTemp);
  swpTemp.x = (swpParent.cx-swpTemp.cx)/2 + swpParent.x;
  swpTemp.y = (swpParent.cy-swpTemp.cy)/2 + swpParent.y;
  WinSetWindowPos(hwndConfigDlg, HWND_TOP,
                  swpTemp.x, swpTemp.y,
                  0, 0,
                  SWP_MOVE);

  // Show window
  WinShowWindow(hwndConfigDlg, TRUE);
  WinSetFocus(HWND_DESKTOP, hwndConfigNB);

#ifdef DEBUG_BUILD
  printf("[DoWaWEConfigureWindow] : Processing config window...\n");
#endif
  // Process messages
  WinProcessDlg(hwndConfigDlg);

#ifdef DEBUG_BUILD
  printf("[DoWaWEConfigureWindow] : End of configuration!\n");
#endif

  // Now cleanup
  WinDestroyWindow(hwndConfigDlg);
}
示例#29
0
/**************************************************************************
*
* FUNCTION NAME: HandleCommand
*
* DESCRIPTION:
*
*
* INPUT PARAMETERS:
*     None.
*
* OUTPUT PARAMETERS:
*     None.
*
**************************************************************************/
MRESULT EXPENTRY HandleCommand (HWND hwnd, 
										  ULONG msg, 
										  MPARAM mp1, 
										  MPARAM mp2)
{
   HWND 					 hwndDlg;
   MCI_GENERIC_PARMS  mciGenericParms;

   switch (SHORT1FROMMP (mp1))
   {
		/*
		** Game menu items...
		*/
		case MENU_START_ID :
		   eDemoMode = DEMO_NONE;
		   if (gAction != PAUSED)
			{
		   	gAction = START;
			}
			break;

		case MENU_STOP_ID :
		   eDemoMode = DEMO_NONE;
		   gAction = STOP;
			break;

		case MENU_EXIT_ID :
		   gAction = EXIT;
			break;

	   case MENU_PAUSE_ID :
		   /* Toggle the pause action */
		   if ((gAction = (gAction == PAUSED) ? NONE : PAUSED) == PAUSED)
			{
				PauseGame ();
			}
			else
			{
				ResumeGame ();
			}
			break;

		case MENU_DEMO_PLAY_ID :
		   eDemoMode = DEMO_PLAY;
		   if (gAction != PAUSED)
			{
		   	gAction = START;
			}
			break;

		case MENU_DEMO_RECORD_ID :
		   /* Display a message box to verify they really want to do this */
			if (!gfDemoLoaded ||
				  WinMessageBox (HWND_DESKTOP, HWND_DESKTOP, CHECK_RECORD, 
				    			     "Demo Record", 0, 
									  MB_YESNO | MB_WARNING | MB_MOVEABLE) == MBID_YES)
			{
		   	eDemoMode = DEMO_RECORD;
		    	if (gAction != PAUSED)
				{
		   		gAction = START;
				}
			}
		   WinSetFocus (HWND_DESKTOP, hwndDefClient);
			break;

		/*
		** Options menu items...
		*/
      case MENU_KEY_ID :
	      hwndDlg = WinLoadDlg (HWND_DESKTOP,
   	                         hwndDefClient,
									  	 (PFNWP) ProcessKeyDialog,
            		             0L,
                  		       KEY_DLG_ID,
                        		 NULL);

	      /* Process the dialog and then destroy it */
   	   WinProcessDlg (hwndDlg);
   		WinDestroyWindow (hwndDlg);
			break;

      case MENU_SPEED_ID :
	      hwndDlg = WinLoadDlg (HWND_DESKTOP,
   	                         hwndDefClient,
									  	 (PFNWP) ProcessSpeedDialog,
            		             0L,
                  		       SPEED_DLG_ID,
                        		 NULL);

	      /* Process the dialog and then destroy it */
   	   WinProcessDlg (hwndDlg);
   		WinDestroyWindow (hwndDlg);
			break;

      case MENU_OBJECT_SIZE_ID :
	      hwndDlg = WinLoadDlg (HWND_DESKTOP,
   	                         hwndDefClient,
									  	 (PFNWP) ProcessSizeDialog,
            		             0L,
                  		       SIZE_DLG_ID,
                        		 NULL);

	      /* Process the dialog and then destroy it */
   	   WinProcessDlg (hwndDlg);
   		WinDestroyWindow (hwndDlg);
			break;

      case MENU_HISCORE_ID :
	      hwndDlg = WinLoadDlg (HWND_DESKTOP,
   	                         hwndDefClient,
									  	 (PFNWP) ProcessHiScoreDialog,
            		             0L,
                  		       HISCORE_DLG_ID,
                        		 NULL);

	      /* Process the dialog and then destroy it */
   	   WinProcessDlg (hwndDlg);
   		WinDestroyWindow (hwndDlg);
			break;

      case MENU_REGISTER_ID :
	      hwndDlg = WinLoadDlg (HWND_DESKTOP,
   	                         hwndDefClient,
									  	 (PFNWP) ProcessRegisterDialog,
            		             0L,
                  		       REG_DLG_ID,
                        		 NULL);

	      /* Process the dialog and then destroy it */
   	   WinProcessDlg (hwndDlg);
   		WinDestroyWindow (hwndDlg);
			break;

		case MENU_BULLET_ID :
		   /* Toggle the bullet menu item */
		   gfBullets = gfBullets ? FALSE : TRUE;
         WinCheckMenuItem (hwndMenu, MENU_BULLET_ID, gfBullets);
		   break;

		case MENU_BUBBLES_ID :
		   /* Toggle the bubbles menu item */
		   gfBubbles = gfBubbles ? FALSE : TRUE;
         WinCheckMenuItem (hwndMenu, MENU_BUBBLES_ID, gfBubbles);
		   break;

		case MENU_SOUND_ID :
		   /* Toggle the sound menu item */
         if (gfSoundEnabled)
         {
		      gfSoundOn = gfSoundOn ? FALSE : TRUE;
            WinCheckMenuItem (hwndMenu, MENU_SOUND_ID, gfSoundOn);

				if (gfSoundOn)
				{
               mciGenericParms.hwndCallback = hwnd;
               (*stMMPMFn[MCI_SENDCOMMAND_FN].pFn) (gusWaveDeviceID,
                                                    MCI_ACQUIREDEVICE,
                                                    (ULONG) MCI_NOTIFY,
                                                    (PVOID) &mciGenericParms,
                                                    (USHORT) 0);
				}
         }
		   break;

		case MENU_MUSIC_ID :
		   /* Toggle the menu menu item */
		   gfMusicEnabled = gfMusicEnabled ? FALSE : TRUE;
         WinCheckMenuItem (hwndMenu, MENU_MUSIC_ID, gfMusicEnabled); 
         if (gfMusicEnabled)
			{
            (*stMMPMFn[MCI_SENDCOMMAND_FN].pFn) (gusMidiDeviceID,
                                                 MCI_ACQUIREDEVICE,
                                                 (ULONG) MCI_NOTIFY,
                                                 (PVOID) &mciGenericParms,
                                                 (USHORT) 0);
			}

         if (gsGameOn)
         {
            /* Play or stop the music */
            gsMusicAction = gfMusicEnabled ? START : STOP;
     	      DosPostEventSem (hSoundEventSem);
         }
		   break;

		case MENU_MOUSE_ID :
		   /* Toggle the mouse menu item */
		   gfMouseEnabled = gfMouseEnabled ? FALSE : TRUE;
         WinCheckMenuItem (hwndMenu, MENU_MOUSE_ID, gfMouseEnabled);
		   EnableMouse (gfMouseEnabled);
			break;

		case MENU_3SHIPS_ID :
			gsStartShips = 3;
         WinCheckMenuItem (hwndMenu, MENU_3SHIPS_ID, TRUE);
         WinCheckMenuItem (hwndMenu, MENU_4SHIPS_ID, FALSE);
         WinCheckMenuItem (hwndMenu, MENU_5SHIPS_ID, FALSE);
			break;

		case MENU_4SHIPS_ID :
			gsStartShips = 4;
         WinCheckMenuItem (hwndMenu, MENU_3SHIPS_ID, FALSE);
         WinCheckMenuItem (hwndMenu, MENU_4SHIPS_ID, TRUE);
         WinCheckMenuItem (hwndMenu, MENU_5SHIPS_ID, FALSE);
			break;

		case MENU_5SHIPS_ID :
			gsStartShips = 5;
         WinCheckMenuItem (hwndMenu, MENU_3SHIPS_ID, FALSE);
         WinCheckMenuItem (hwndMenu, MENU_4SHIPS_ID, FALSE);
         WinCheckMenuItem (hwndMenu, MENU_5SHIPS_ID, TRUE);
			break;


		case MENU_3SMARTS_ID :
			gsStartSmarts = 3;
         WinCheckMenuItem (hwndMenu, MENU_3SMARTS_ID, TRUE);
         WinCheckMenuItem (hwndMenu, MENU_5SMARTS_ID, FALSE);
         WinCheckMenuItem (hwndMenu, MENU_7SMARTS_ID, FALSE);
			break;

		case MENU_5SMARTS_ID :
			gsStartSmarts = 5;
         WinCheckMenuItem (hwndMenu, MENU_3SMARTS_ID, FALSE);
         WinCheckMenuItem (hwndMenu, MENU_5SMARTS_ID, TRUE);
         WinCheckMenuItem (hwndMenu, MENU_7SMARTS_ID, FALSE);
			break;

		case MENU_7SMARTS_ID :
			gsStartSmarts = 7;
         WinCheckMenuItem (hwndMenu, MENU_3SMARTS_ID, FALSE);
         WinCheckMenuItem (hwndMenu, MENU_5SMARTS_ID, FALSE);
         WinCheckMenuItem (hwndMenu, MENU_7SMARTS_ID, TRUE);
			break;

		case MENU_SONAR_FADE_ID :
			stScanner.sMode = SCANNER_SWEEP;
         WinCheckMenuItem (hwndMenu, MENU_SONAR_FADE_ID, TRUE);
         WinCheckMenuItem (hwndMenu, MENU_SONAR_PERSIST_ID, FALSE);
         WinCheckMenuItem (hwndMenu, MENU_SONAR_NO_ID, FALSE);
			break;

		case MENU_SONAR_PERSIST_ID :
			stScanner.sMode = SCANNER_ON;
         WinCheckMenuItem (hwndMenu, MENU_SONAR_FADE_ID, FALSE);
         WinCheckMenuItem (hwndMenu, MENU_SONAR_PERSIST_ID, TRUE);
         WinCheckMenuItem (hwndMenu, MENU_SONAR_NO_ID, FALSE);
			break;

		case MENU_SONAR_NO_ID :
			stScanner.sMode = SCANNER_OFF;
         WinCheckMenuItem (hwndMenu, MENU_SONAR_FADE_ID, FALSE);
         WinCheckMenuItem (hwndMenu, MENU_SONAR_PERSIST_ID, FALSE);
         WinCheckMenuItem (hwndMenu, MENU_SONAR_NO_ID, TRUE);
			break;

		case MENU_FRAME_CONTROLS_ID :
			if (gfShowFrame)
			{
				HideFrameControls ();
			}
			else
			{
				ShowFrameControls ();
			}

         gfShowFrame = gfShowFrame ? FALSE : TRUE;
         WinCheckMenuItem (hwndMenu, MENU_FRAME_CONTROLS_ID, gfShowFrame);
			break;

		/*
		** Help menu items...
		*/
		case MENU_HELPINDEX_ID	:
         WinSendMsg (hwndHelpInstance, HM_HELP_INDEX, NULL, NULL);
			break;

		case MENU_HELPEXTENDED_ID :
         WinSendMsg(hwndHelpInstance, HM_EXT_HELP, NULL, NULL);
			break;

		case MENU_HELPHELPFORHELP_ID :
         WinSendMsg (hwndHelpInstance, HM_DISPLAY_HELP, NULL, NULL);
			break;

		case MENU_HELPKEYSHELP_ID :
         WinSendMsg (hwndHelpInstance, HM_KEYS_HELP, NULL, NULL);
		   break;

		case MENU_HELPABOUT_ID :
	      hwndDlg = WinLoadDlg (HWND_DESKTOP,
   	                         hwndDefClient,
									  	 (PFNWP) ProcessProdInfoDialog,
            		             0L,
                  		       PROD_INFO_DLG_ID,
                        		 NULL);

	      /* Process the dialog and then destroy it */
   	   WinProcessDlg (hwndDlg);
   		WinDestroyWindow (hwndDlg);
			break;

		default :
         return (WinDefWindowProc (hwnd, msg, mp1, mp2));
   }
}
示例#30
0
BOOL SETTINGS :: Dialog (BOOL fOnlyLanguage)
{
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 1" );
#endif
    fAutoLanguage = fOnlyLanguage;

    // load the main dialog window
    hwndDlg = WinLoadDlg (HWND_DESKTOP, hwndFrame, PFNWP (DialogProcedure),
                          GETMODULE, ID_DLG_SETTINGS, this);
    // FIXME YUKKI! YUKKI!! YUKKI!!! But I'm too lazy to do it better now :-)
    g_hwndSettingsDialog = hwndDlg;
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 2" );
#endif

    // disable this two buttons if only language select
    if (fAutoLanguage)
    {
        WinEnableWindow (WinWindowFromID (hwndDlg, WID_PB_HELP), FALSE);
        WinEnableWindow (WinWindowFromID (hwndDlg, WID_PB_UNDO), FALSE);
    }

    HWND   hwndNB = WinWindowFromID (hwndDlg, WID_NB_SETTINGS);
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 3" );
#endif

    // set notebook background color
    WinSendMsg (hwndNB, BKM_SETNOTEBOOKCOLORS,
                MPFROMLONG (SYSCLR_DIALOGBACKGROUND),
                MPFROMSHORT (BKA_BACKGROUNDPAGECOLORINDEX));

    // set tab dimensions
    WinSendMsg (hwndNB, BKM_SETDIMENSIONS,
                MPFROM2SHORT (80, 25), MPFROMSHORT (BKA_MAJORTAB));
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 4" );
#endif

    ULONG   idPage[COUNT_PAGES];
    USHORT  i, cPages;

    if (fOnlyLanguage)
    {
        cPages = 1;

        idPage[0] = (ULONG)
            WinSendMsg (hwndNB, BKM_INSERTPAGE, 0L,
                        MPFROM2SHORT (BKA_MAJOR | BKA_AUTOPAGESIZE,
                                      BKA_LAST));
        WinSendMsg (hwndNB, BKM_SETTABTEXT, MPFROMLONG (idPage[0]),
                    MPFROMP (pszPageTab[COUNT_PAGES-1]));
        hwndPage[0] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page4Procedure,
                                  GETMODULE, ID_DLG_SETTINGSPAGE4, this);
    }
    else
    {
        cPages = COUNT_PAGES;

        // insert empty pages
        for (i = 0; i < cPages; i++)
        {
            idPage[i] = (ULONG)
                WinSendMsg (hwndNB, BKM_INSERTPAGE, 0L,
                            MPFROM2SHORT (BKA_MAJOR | BKA_AUTOPAGESIZE,
                                          BKA_LAST));
            WinSendMsg (hwndNB, BKM_SETTABTEXT,
                        MPFROMLONG (idPage[i]), MPFROMP (pszPageTab[i]));
        }

        // open and assign dialogs to pages
        hwndPage[0] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page1Procedure,
                                  GETMODULE, ID_DLG_SETTINGSPAGE1, this);
        hwndPage[1] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page2Procedure,
                                  GETMODULE, ID_DLG_SETTINGSPAGE2, this);
        hwndPage[2] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page3Procedure,
                                  GETMODULE, ID_DLG_SETTINGSPAGE3, this);
        hwndPage[3] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page4Procedure,
                                  GETMODULE, ID_DLG_SETTINGSPAGE4, this);
    }
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 5" );
#endif

    // combine dlg-handle and page ids
    for (i = 0; i < cPages; i++)
        WinSendMsg (hwndNB, BKM_SETPAGEWINDOWHWND,
                    MPFROMLONG (idPage[i]), MPFROMHWND (hwndPage[i]));

/*    if (fAutoLanguage)
        WinSendMsg (hwndNB, BKM_TURNTOPAGE, MPFROMLONG (idPage[0]), 0L);
#if (COUNT_PAGES != 4)
#warning FIXME settings.cpp 264 or so ...
#endif */
    for (i = 0; i < cPages; i++)
        WinSendMsg (hwndPage[i], UM_SETTINGS2DIALOG, 0,0);
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 6" );
#endif

    //WinSetFocus (WinWindowFromID (hwndDlg, WID_PB_OK), TRUE);
    //WinSetFocus( hwndPage[0], TRUE );
    WinSetActiveWindow( HWND_DESKTOP, hwndPage[0] );
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 7" );
#endif

    WinProcessDlg (hwndDlg);
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 7.5" );
#endif
    WinDestroyWindow (hwndDlg);
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 8" );
#endif

    // it ain't the best way to do it, but ...
    SetIdlePriority(QueryFlag(SEI_IDLEPRIORITY));

    for (i = 0; i < COUNT_PAGES; i++)
        hwndPage[i] = NULL;

    hwndDlg = NULLHANDLE;
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 9" );
#endif
    return TRUE;
}