示例#1
0
void ColorPalProc(void)
{
char szColors[255];

hColorPalette=WinQueryObject("<WP_LORESCLRPAL>");
if(hColorPalette==NULLHANDLE)
        WinMessageBox(HWND_DESKTOP,hwndClient,
        "Could not open Color Palette",
        szAppName,0,MB_OK|MB_MOVEABLE|MB_ICONEXCLAMATION);
else
    {
    WinSetObjectData(hColorPalette,"OPEN=DEFAULT");
    strcpy(szColors,"COLORS=");
    strcat(szColors,"0xFFFFFF,");//1
    strcat(szColors,"0xFF0000,");//2
    strcat(szColors,"0xFF00FF,");//3
    strcat(szColors,"0x0000FF,");//4
    strcat(szColors,"0x00FFFF,");//5
    strcat(szColors,"0x00FF00,");//6
    strcat(szColors,"0xFFFF00,");//7
    strcat(szColors,"0xCCCCCC,");//8
    strcat(szColors,"0x000000,");//9
    strcat(szColors,"0x800000,");//10
    strcat(szColors,"0x800080,");//11
    strcat(szColors,"0x000080,");//12
    strcat(szColors,"0x008080,");//13
    strcat(szColors,"0x008000,");//14
    strcat(szColors,"0x808000,");//15
    strcat(szColors,"0x808080");//16

    WinSetObjectData(hColorPalette,szColors);
    hwndColorPalette=WinQueryActiveWindow(HWND_DESKTOP);

    }
}
示例#2
0
BOOL WPS_DestroyObject (PWPS_DESTROYOBJECT CustomPtr) {
   HOBJECT ObjectHandle = 0;

   if (!(ObjectHandle = WinQueryObject(CustomPtr->WPDestroyObjectID)))
      return FALSE;
   return WinDestroyObject(ObjectHandle);
 }
BOOL OCL::saveID(PCH DESK)
{
    HOBJECT hObject;

    hObject=WinQueryObject((PCH) DESK);
    if (hObject==NULLHANDLE)
        return(FALSE);
    if ((WinSetObjectData(hObject, "OBJECTID=<WP_DESKTOP>")==TRUE))
        return(TRUE);
    else
        return(FALSE);
}
示例#4
0
void FontPalProc(void)
{

hFontPalette=WinQueryObject("<WP_FNTPAL>");
if(hFontPalette==NULLHANDLE)
        WinMessageBox(HWND_DESKTOP,hwndClient,
        "Could not open Font Palette",
        szAppName,0,MB_OK|MB_MOVEABLE|MB_ICONEXCLAMATION);
else
WinSetObjectData(hFontPalette,"OPEN=DEFAULT");
hwndFontPalette=WinQueryActiveWindow(HWND_DESKTOP);
}
BOOL launchPad::lpSetConfiguration(char * chrTarget, char * chrConfigID_)
{
  HOBJECT hObject;
  char chrSetup[CCHMAXPATH];

  /* Destination of toolbar folder */
  strncpy(chrConfigTarget, chrTarget,sizeof(chrConfigTarget));
  chrConfigTarget[sizeof(chrConfigTarget)-1]=0;
  /* The ID of the toolbar folder */
  strncpy(chrConfigID, chrConfigID_,sizeof(chrConfigID));
  chrConfigID[sizeof(chrConfigID)-1]=0;

  /* First check the config folder */
  if((hObject=WinQueryObject(chrConfigID))==NULLHANDLE)
    {
      /* Toolbar folder lost recreate it */
      if(!checkFileExists(chrConfigTarget))
        return FALSE; /* No install dir defined */

      if(fl & LP_USEOBJECTASPARAM) {
        /* This isn't used yet */
        sprintf(chrSetup, "HIDECLASSPAGE=1;OBJECTID=%s",chrConfigID);
        if((hObject=WinCreateObject("CWMenuFolder", chrConfigID, chrSetup, chrConfigTarget,CO_FAILIFEXISTS))==NULLHANDLE)
          return FALSE; /* Can't create new toolbar folder */
      }
      else {
        sprintf(chrSetup, "OBJECTID=%s", chrConfigID);
        if((hObject=WinCreateObject("WPFolder", chrConfigID, chrSetup, chrConfigTarget,CO_FAILIFEXISTS))==NULLHANDLE)
          return FALSE; /* Can't create new toolbar folder */
      }
    }
  
  lpBuildObjectList(chrConfigID);

  return TRUE;
}
BOOL launchPad::lpSaveObjectList()
{
  SOMClass *folderClass;
  WPFolder *wpFolder;
  char chrPath[CCHMAXPATH];
  ULONG ulBufferSize;
  HINI hIni;
  char * memPtr;
  HOBJECT *hObject;
  HOBJECT hObject2;
  int a;
  LPObject *lpoTemp;

  /* First check the config folder */
  if((hObject2=WinQueryObject(chrConfigID))==NULLHANDLE)
    {
      /* Toolbar folder lost recreate it */
      if(!checkFileExists(chrConfigTarget))
        return FALSE; /* No install dir defined */
      
      sprintf(chrPath,"OBJECTID=%s",chrConfigID);
      if((hObject2=WinCreateObject("WPFolder", chrConfigID, chrPath,chrConfigTarget,CO_FAILIFEXISTS))==NULLHANDLE)
        return FALSE; /* Can't create new toolbar folder */
    }
  
  /* Get toolbar folder */
  if(somIsObj(wpParentFolder)) {
    folderClass=wpParentFolder->somGetClass();
    if(somIsObj(folderClass))
      wpFolder=(WPFolder*)((M_WPFolder*)folderClass)->wpclsQueryFolder(chrConfigID, FALSE);
  }

  ulBufferSize=sizeof(chrPath);
  wpFolder->wpQueryRealName(chrPath, &ulBufferSize, TRUE);
  strcat(chrPath,"\\objects.ini");/* Ini-File containing the hobjects */
  
  //  WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, chrPath, "~launchPad", 123, MB_OK| MB_MOVEABLE);  
  do{
    /* Open the ini-file */
    if((hIni=PrfOpenProfile(WinQueryAnchorBlock(HWND_DESKTOP),chrPath))==NULLHANDLE)
      break; 

    if((memPtr=(char*)malloc(ulNumObjects*sizeof(HOBJECT)))==NULL)
      break;
    

    hObject=(HOBJECT*)memPtr;

    lpoTemp=lpoObjectList;
    for(a=ulNumObjects;a>0 && lpoTemp; a--)
      {
        hObject[a-1]=lpoTemp->hObject;
        lpoTemp=lpoTemp->lpoNext;
      }

    if(!PrfWriteProfileData(hIni,"objects","handles", hObject, ulNumObjects*sizeof(HOBJECT))) {
      free(hObject);
      break;
    }

    free(hObject);
    
    PrfCloseProfile(hIni);
    return TRUE;
  }while(TRUE);

  if(hIni)
    PrfCloseProfile(hIni);
  return FALSE;
}
BOOL launchPad::lpAddButton(WPObject* wpObject, int iPos)
{
  HOBJECT hObject;
  SOMClass *folderClass;
  char chrSetup[CCHMAXPATH];
  WPObject *wpTempObject;
  LPObject *lpoTemp, *lpoTemp2, *lpoTempNew;
  int a;


  /* First check the config folder */
  if((hObject=WinQueryObject(chrConfigID))==NULLHANDLE)
    {
      /* Toolbar folder lost recreate it */
      if(!checkFileExists(chrConfigTarget))
        return FALSE; /* No install dir defined */

      if(fl & LP_USEOBJECTASPARAM) {
        sprintf(chrSetup, "HIDECLASSPAGE=1;OBJECTID=%s", chrConfigID);
        if((hObject=WinCreateObject("CWMenuFolder", chrConfigID, chrSetup, chrConfigTarget,CO_FAILIFEXISTS))==NULLHANDLE)
          return FALSE; /* Can't create new toolbar folder */
      }
      else {
        sprintf(chrSetup,  "OBJECTID=%s", chrConfigID);
        if((hObject=WinCreateObject("WPFolder", chrConfigID, chrSetup, chrConfigTarget,CO_FAILIFEXISTS))==NULLHANDLE)
          return FALSE; /* Can't create new toolbar folder */
      }
    }

  if(somIsObj(wpObject) && somIsObj(wpParentFolder)) {
    folderClass=wpParentFolder->somGetClass();
    if(somIsObj(folderClass)) {
      /* Create a shadow in our toolbar folder */
      wpTempObject=wpObject->wpCreateShadowObject((WPFolder*)((M_WPFolder*)folderClass)->wpclsQueryFolder(chrConfigID, FALSE), FALSE);
      if(somIsObj(wpTempObject)) {
        /* Get the persistent object handle */
        hObject=wpTempObject->wpQueryHandle();

        /* Find the insertion point */
        /* iPos is the button after which we insert the new one. The list of objects is in reverse order. */
        lpoTemp2=lpoObjectList;
        if(iPos<ulNumObjects) {
          lpoTemp=lpoTemp2;
          for(a=ulNumObjects;a>iPos && lpoTemp; a--)
            {
              lpoTemp=lpoTemp2;
              lpoTemp2=lpoTemp2->lpoNext;
            }
        }
        else
          lpoTemp=NULLHANDLE;

        /* lpoTemp contains object */
        /* Alloc a struct for this object to insert it on the toolbar */

        if((lpoTempNew=new LPObject(wpTempObject->wpQueryIcon()))!=NULL) {
          ULONG ulRC;
          
          lpoTempNew->wpObject=wpTempObject;
          lpoTempNew->wpObject->wpLockObject();
          lpoTempNew->hObject=hObject;
          //  lpoTempNew->hPtr=wpTempObject->wpQueryIcon();

          /* Title of the object */
          strncpy(lpoTempNew->chrName, wpTempObject->wpQueryTitle(),sizeof(lpoTempNew->chrName));
          lpoTempNew->lpParent=this;

          if(lpoTemp) {
            lpoTempNew->lpoNext=lpoTemp->lpoNext;
            lpoTemp->lpoNext=lpoTempNew;
          }
          else {
            lpoTempNew->lpoNext=lpoObjectList;
            lpoObjectList=lpoTempNew;
          }
          ulNumObjects++;
        }
      }
    }
  }

  lpSaveObjectList();
  lpRefreshLaunchPad();

  return TRUE;
}
示例#8
0
int main (int argc, char *argv[])
   {
   APIRET       rc;
   PCHAR        pcEnv;
   PRFPROFILE   prfProfile;

#ifdef DEBUG
   ulDebugMask = 0xFFFFFFFF;
#endif /* DEBUG */

   hab = WinInitialize(0);
   hmq = WinCreateMsgQueue(hab, 0);
   DebugS (1, "PM Interface initialized");

   /* Shared Memory organisieren */
   if (rc = DosGetNamedSharedMem ((PPVOID) &pShareInitOS2,
                                  SHARE_INITOS2,
                                  PAG_READ | PAG_WRITE))
      {
      if (rc = DosAllocSharedMem( (PPVOID) &pShareInitOS2,    // Pointer to shared mem
                                  SHARE_INITOS2,              // Name
                                  CCHSHARE_INITOS2,           // Size of shared mem
                                  PAG_COMMIT | PAG_READ | PAG_WRITE)) // Flags
         return(1);
      else
         {
         /* Shared Memory initialisieren */

         memset (pShareInitOS2, '\0', CCHSHARE_INITOS2);

         pShareInitOS2->pszRegFile       = (PCHAR) pShareInitOS2 +
                                          sizeof(*pShareInitOS2);
         strcpy (pShareInitOS2->pszRegFile,
                 DosScanEnv (ENV_SYSTEM_INI, &pcEnv) ? "" : pcEnv);
         pShareInitOS2->pszRootUserIni   = pShareInitOS2->pszRegFile +
                                          strlen(pShareInitOS2->pszRegFile) + 1;
         pShareInitOS2->pszRootSystemIni = pShareInitOS2->pszRootUserIni + 1;
         pShareInitOS2->pszUserIni       = pShareInitOS2->pszRootSystemIni + 1;
         pShareInitOS2->pszSystemIni     = pShareInitOS2->pszUserIni   + CCHMAXPATH;
         pShareInitOS2->pszEnvironment   = pShareInitOS2->pszSystemIni + CCHMAXPATH;
         }
      }
   DebugS (1, "Shared Memory initialized");

   /* Semaphoren organisieren */
   rc = DosOpenEventSem (HEV_SAMMY, &hevSammy);

   if( rc )
      rc = DosCreateEventSem( HEV_SAMMY,   // Name
                              &hevSammy,   // Pointer to sem
                              0,           // Not used with named sems
                              FALSE);      // Initial state (FALSE = SET)

   else        /* Sammy ist bereits installiert */
      {
      pShareInitOS2->pszEnvironment[0] = '\0';
      pShareInitOS2->pszEnvironment[1] = '\0';
      pShareInitOS2->pszSystemIni[0]   = '\0';
      pShareInitOS2->pszUserIni[0]     = '\0';
      DosPostEventSem(hevSammy);
      goto Exit;
      }

   if( rc )
      {
      intSammyRetCode = rc;
      goto Exit;
      }

   rc = DosOpenEventSem (HEV_PRFRESETLOCK, &hevPrfResetLock);

   if( rc )
      rc = DosCreateEventSem( HEV_PRFRESETLOCK, // Name
                              &hevPrfResetLock, // Pointer to sem
                              0,                // Not used with named sems
                              TRUE);            // Initial state (TRUE = POSTED)

   if( rc )
      {
      intSammyRetCode = rc;
      goto Exit;
      }
   DebugS (1, "Semaphores initialized");

   ChangeWPS(pShareInitOS2->pszUserIni, pShareInitOS2->pszSystemIni);

   /* Hintergrundloop starten, das Shell mit aktueller Env. startet */

   DosCreateThread (&tid1,
                    (PFNTHREAD) thStartProg,
                    (ULONG) ((argc > 1) ? argv[1] : ""),
                    0,
                    THREADSTACK);
   DebugS (1, "Background loop started");

   /* Hintergrundloop starten, das jeweils nach L�schen einer Semaphore */
   /* einen prfReset initiiert                      */
   DosCreateThread (&tid2,
                    (PFNTHREAD) thSwitch,
                    (ULONG) 0,
                    0,
                    THREADSTACK);

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

   if (intSammyRetCode)
      {
      DosKillThread (tid1);
      DosKillThread (tid2);

      WinSetObjectData(WinQueryObject("<WP_DESKTOP>"), "WORKAREA=NO");
      WinPostMsg(WinQueryWindow(HWND_DESKTOP, QW_BOTTOM), WM_CLOSE, 0, 0);

      WinAlarm (HWND_DESKTOP, WA_ERROR);

      prfProfile.pszSysName  = (DosScanEnv (ENV_SYSTEM_INI, &pcEnv) ? "" : pcEnv);
      prfProfile.pszUserName = (DosScanEnv (ENV_USER_INI, &pcEnv) ? "" : pcEnv);

      prfProfile.cchUserName = strlen(prfProfile.pszUserName);
      prfProfile.cchSysName  = strlen(prfProfile.pszSysName);

      DosSleep (1000);
      DosKillProcess( DKP_PROCESSTREE, ulShellID );

      if ( !PrfReset(hab, &prfProfile))
         WinSetObjectData(WinQueryObject("<WP_DESKTOP>"), "OPEN=ICON;WORKAREA=YES");
      }
Exit:
   WinDestroyMsgQueue(hmq);
   WinTerminate(hab);

   DebugS (1, "Application terminated");

   return intSammyRetCode;
   }
示例#9
0
BOOL ChangeWPS(PCHAR pszUserIni, PCHAR pszSystemIni)
   {
   PCHAR        pcEnv;
   PRFPROFILE   prfProfile;
   BOOL         bSuccess;

   if (*pszSystemIni == '\0')
      prfProfile.pszSysName = pShareInitOS2->pszRootSystemIni;
   else
      prfProfile.pszSysName = pszSystemIni;

   if (*prfProfile.pszSysName == '\0')
      prfProfile.pszSysName = (DosScanEnv (ENV_SYSTEM_INI, &pcEnv) ? "" : pcEnv);

   if (*pszUserIni == '\0')
      {
      prfProfile.pszUserName = pShareInitOS2->pszRootUserIni;
      pShareInitOS2->ulFlag  = pShareInitOS2->ulFlag_Root; // ulFlag f�r Rootdesktop
      }
   else
      prfProfile.pszUserName = pszUserIni;

   if (*prfProfile.pszUserName == '\0')
      prfProfile.pszUserName = (DosScanEnv (ENV_USER_INI, &pcEnv) ? "" : pcEnv);

   prfProfile.cchUserName = strlen(prfProfile.pszUserName);
   prfProfile.cchSysName  = strlen(prfProfile.pszSysName);

   if (ulOldFlag & CLOSEAPPL)
      WinSetObjectData(WinQueryObject("<WP_DESKTOP>"), "WORKAREA=YES");
   else
      WinSetObjectData(WinQueryObject("<WP_DESKTOP>"), "WORKAREA=NO");

   WinPostMsg(WinQueryWindow(HWND_DESKTOP, QW_BOTTOM), WM_CLOSE, 0, 0);
   DebugS (1, "HWND_DESKTOP closed");

   if( hevPrfResetLock )
      {
      DosWaitEventSem (hevPrfResetLock, SEM_INDEFINITE_WAIT);
      DosSleep(1000);
      DebugS (1, "hevPrfResetLock released");
      }
   else
      DosSleep(20000);

   bSuccess = PrfReset(hab, &prfProfile);
   DebugULd (1, "PrfReset", "return", bSuccess);

/*
 *  Beim Umschalten auf den Root, egal ob von Sammy oder von WPSamF ausgel�st,
 *  wird die Shell vom PrfReset nicht geschlossen.
 *  Solange die Ursache nicht bekannt ist, bleibt nichts anderes �brig,
 *  als an dieser Stelle symptomatisch vorzugehen und die Shell abzuschie�en.
 */
   if (*pszUserIni == '\0')
      {
      DosSuspendThread (tid1);
      DosKillProcess( DKP_PROCESSTREE, ulShellID );   // sog. Budnik'scher Arschtritt
      DebugS (1, "Shell killed");
      DosResumeThread (tid1);
      }

   if( !bSuccess )
      {
      WinSetObjectData(WinQueryObject("<WP_DESKTOP>"), "OPEN=ICON;WORKAREA=YES");
      DebugS (1, "Desktop set to <WP_DESKTOP>");
      intSammyRetCode = 250;
      WinPostQueueMsg (hmq, WM_QUIT, 0L, 0L);
      }
   else
      ulOldFlag = pShareInitOS2->ulFlag;

   return( bSuccess );
   }
示例#10
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));
}
示例#11
0
MRESULT EXPENTRY windowproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
HPS hps;
RECTL rcl;
DRAGITEM dit;
PDRAGINFO pdin;
HOBJECT hobj;
static a=0;

switch(msg)
{
/* control tray icon specific messages */
case DM_DROP:
pdin = (PDRAGINFO)mp1;
DrgAccessDraginfo(pdin);
DrgQueryDragitem(pdin,sizeof(DRAGITEM),&dit,0);
DrgQueryStrName(dit.hstrContainerName,256,cbuf);
DrgQueryStrName(dit.hstrSourceName,256,buf);
strcat(cbuf,buf);
hobj=WinQueryObject("<WP_DRIVES>");
if(hobj)DosBeep(1000,100);
//WinOpenObject(hobj,0,TRUE);
WinMessageBox(HWND_DESKTOP,hwnd,"Drag Succeed!",cbuf,0,MB_OK | MB_INFORMATION);
DrgFreeDraginfo(pdin);
break;
case DM_DRAGOVER:
return MPFROM2SHORT(DOR_DROP,DO_LINK);
case WM_TIMER:
a++;
a%=5;
WinSendMsg(hwndFrame,WM_SETICON,(MPARAM)hIcon[a],NULL);
ChangeTrayIcon(hwnd,NULLHANDLE);
break;
case WM_BUTTON1CLICK|0x2000:
case WM_BUTTON2CLICK|0x2000:
/* activate frame window */
WinSetWindowPos(hwndFrame,HWND_TOP,0,0,0,0,SWP_ACTIVATE | SWP_SHOW | SWP_ZORDER | SWP_RESTORE);
break;
case WM_CREATE:
/* initialize window */

/* initialize tray api */
InitializeTrayApi(hwnd);
break;

case WM_DDE_INITIATEACK:
/* aswer dde server */
AnswerTrayApiDdeAck(mp1);
AddTrayIcon(hwnd,WinSendMsg(hwndFrame,WM_QUERYICON,NULL,NULL));
WinStartTimer(hab,hwnd,1,500);

return (MRESULT)0L;

case WM_PAINT:
hps = WinBeginPaint(hwnd,NULL,NULL);
WinQueryWindowRect(hwnd, &rcl);
WinFillRect(hps, &rcl, CLR_CYAN);
GpiSetColor(hps, CLR_DARKBLUE);
GpiSetBackColor(hps, CLR_CYAN);
rcl.xLeft=(rcl.xLeft+rcl.xRight)/2-40;
rcl.yBottom=(rcl.yBottom+rcl.yTop)/2-7;
GpiCharStringAt(hps, (PPOINTL)&rcl, 13, "Hello, world!");
WinEndPaint(hps);
break;

case WM_DESTROY:
/* delete application icon from system tray */
return (MRESULT)DeleteTrayIcon(hwnd);
}

return WinDefWindowProc(hwnd, msg, mp1, mp2);
}