home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: SysTools / SysTools.zip / taman002.zip / TASKMANA.ZIP / src / kProcessDetails.cpp < prev    next >
C/C++ Source or Header  |  2000-04-29  |  4KB  |  144 lines

  1. /* $Id: kProcessDetails.cpp,v 1.1 2000/04/29 19:06:35 stknut Exp $
  2.  *
  3.  * kProcessDetails - Process notebook.
  4.  *
  5.  * Copyright (c) 2000 knut st. osmundsen
  6.  *
  7.  */
  8.  
  9.  
  10.  
  11. /*******************************************************************************
  12. *   Defined Constants And Macros                                               *
  13. *******************************************************************************/
  14. #define INCL_WIN
  15. #define INCL_GPI
  16. #define INCL_BASE
  17.  
  18.  
  19. /*******************************************************************************
  20. *   Header Files                                                               *
  21. *******************************************************************************/
  22. #include <os2.h>
  23. #ifdef USE_KLIB
  24.     #include <kAssert.h>
  25.     #include <kLog.h>
  26.     #include <kHeap.h>
  27. #else
  28.     #include <malloc.h>
  29. #endif
  30. #include <memory.h>
  31. #include <process.h>
  32. #include <stdio.h>
  33. #include <string.h>
  34.  
  35. #include "kBase.h"
  36. #include "kError.h"
  37. #include "kDlgBase.h"
  38. #include "kMenuBase.h"
  39. #include "kClickDlg.h"
  40. #include "kContainer.h"
  41. #include "kTaskMgr_defs.h"
  42. #include "kNotebookBase.h"
  43. #include "kNotebookPageBase.h"
  44.  
  45. #include "kQuerySysState.h"
  46. #include "kDetailBase.h"
  47. #include "kModuleRecord.h"
  48. #include "kModuleContainer.h"
  49. #include "kObjectRecord.h"
  50. #include "kProcessRecord.h"
  51. #include "kProcessContainer.h"
  52. #include "kSFNRecord.h"
  53. #include "kSFNContainer.h"
  54. #include "kThreadRecord.h"
  55. #include "kThreadContainer.h"
  56. #include "kAboutPage.h"
  57. #include "kModulePage.h"
  58. #include "kSFNPage.h"
  59. #include "kProcessDetails.h"
  60. #include "kProcessDetailsPage.h"
  61. #include "kTaskMgr.h"
  62.  
  63.  
  64.  
  65. /**
  66.  * Constructor.
  67.  * @param     usPid        Process ID to display details for.
  68.  * @param     hwndTaskMgr  Handle of the taskmgr window.
  69.  */
  70. kProcessDetails::kProcessDetails(USHORT usPid, HWND hwndTaskMgr)
  71. : kNotebookBase(DL_KPROCESSDETAILS, NULLHANDLE, KPROCDTL_NTBK, NULLHANDLE),
  72. kDetailBase(hwnd),
  73. hwndOwner(hwndTaskMgr), usPid(usPid)
  74. {
  75.     PPROCESSDATA    pProcData;
  76.     qsLrec_t *      pMteData;
  77.     USHORT          hMte;
  78.     char szTitle[278];
  79.  
  80.     /* Get process data */
  81.     pProcData = QSGetProcessData(usPid);
  82.     if (pProcData == NULL)
  83.         throw(kError(ERROR_INVALID_PARAMETER, kError::dos)); /* FIXME better complaint! */
  84.     pMteData = QSGetMteData(pProcData->pProcRec->hMte);
  85.     if (pMteData != NULL)
  86.         hMte = pMteData->hmte;
  87.     else
  88.         hMte = 0xFFFE;
  89.  
  90.     /* Set title */
  91.     sprintf(&szTitle[0], "Pid 0x%04x - %.260s",
  92.             usPid, pMteData != NULL && pMteData->pName != NULL ? (char*)pMteData->pName : "<unknown>");
  93.     setTitle(&szTitle[0]);
  94.  
  95.     /* Create and insert notebook pages */
  96.     insertPage(new kProcessDetailsPage(this, usPid), BKA_MAJOR | BKA_AUTOPAGESIZE, BKA_LAST);
  97.     insertPage(new kModulePage(this, hMte), BKA_MAJOR, BKA_LAST);
  98.     insertPage(new kSFNPage(this, usPid), BKA_MAJOR, BKA_LAST);
  99.  
  100.     /* Last */
  101.     insertPage(new kAboutPage(this), BKA_MAJOR, BKA_LAST);
  102. }
  103.  
  104.  
  105.  
  106. /**
  107.  * Destructor for the kProcessDetails class.
  108.  */
  109. kProcessDetails::~kProcessDetails()
  110. {
  111. }
  112.  
  113.  
  114. /**
  115.  * Temporary size and focus fix....
  116.  */
  117. BOOL kProcessDetails::show()
  118. {
  119.     SWP swp;
  120.     BOOL fRet = kDlgBase::show();
  121.  
  122.     /* Temporary size fix  */
  123.     WinQueryWindowPos(hwnd, &swp);
  124.     WinSetWindowPos(hwnd, NULLHANDLE, 0, 0, swp.cx-1, swp.cy-1, SWP_SIZE);
  125.  
  126.     /* Try set focus correctly */
  127.     if (paPages != NULL && cPages != 0)
  128.         WinSetFocus(HWND_DESKTOP, WinWindowFromID(paPages[0].hwnd, KPROCDTLPG_CNR_THREADS));
  129.  
  130.     return fRet;
  131. }
  132.  
  133.  
  134. /**
  135.  * Updates the dialog contents.
  136.  * @returns   success indicator.
  137.  * @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
  138.  * @remark    Currently a dummy stub.
  139.  */
  140. BOOL kProcessDetails::update()
  141. {
  142.     return FALSE;
  143. }
  144.