home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 December / PCWKCD1296.iso / vjplusb / activex / inetsdk / samples / wininet / asyncftp / comctlhd.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-06-04  |  3.0 KB  |  104 lines

  1.  
  2. #ifndef _COMCTLHD_H
  3. #define _COMCTLHD_H
  4.  
  5. //control id's for dynamically created controls (CreateWindowEx)
  6. #define TREEVIEW_CONTROL_ID 3002
  7. #define STATUSBAR_CONTROL_ID 3003
  8.  
  9.  
  10. // ASSERT 
  11. #ifndef _ASSERT
  12. #define _ASSERT
  13. #ifdef _DEBUG
  14. #define ASSERT(f) if(!(f)) DebugBreak();
  15. #else
  16. #define ASSERT(f)
  17. #endif // _DEBUG
  18. #endif // _ASSERT
  19.  
  20. //structure used to pass TV_ITEM data member values to other routines
  21. struct TVDATA
  22. {
  23.     int imgIndex;           //TV_ITEM.iImage
  24.     int imgIndexSelected;   //TV_ITEM.iSelectedImage
  25.     HTREEITEM hParent;      //TV_INSERTSTRUCT.hParent
  26. };
  27.  
  28. typedef TVDATA * LPTVDATA;
  29.  
  30. //helper macro for setting structure element values
  31. #define SETTVDATA(tvdata, imgIx, imgIxSel, hParen) \
  32. {\
  33.     (tvdata).imgIndex = imgIx; \
  34.     (tvdata).imgIndexSelected = imgIxSel; \
  35.     (tvdata).hParent = hParen; \
  36. }
  37.  
  38. struct TVNODEINFO {
  39.     DWORD dwAttributes;  //file attributes (zero for root level ftp sites)
  40.     BOOL  enumflag;      //has the directory been enumerated
  41.     int index;           //index location of root level node associated with this item
  42.     int requestType;     //application defined REQUEST_INTERNET* value
  43.     int key;             //random number generated as key value for retrieval
  44.     TCHAR pszSite[MAX_PATH];  //site name - full URL
  45.     TCHAR pszServer[80];     //server name 
  46.     TCHAR pszDir[MAX_PATH];  //full directory path
  47.     TCHAR pszFile[MAX_PATH]; //filename - text of TreeView item
  48.     TCHAR pszFileTarget[80]; //for Ftp get only - target filename
  49.     //internet handles
  50.     HINTERNET hConnect, hEnum, hFile; 
  51.     HTREEITEM hTreeItem;
  52.     //pointer to other specific data - ended up as pointer to
  53.     //WIN32_FIND_DATA structure
  54.     LPVOID prequestResult;
  55. };
  56.  
  57. typedef TVNODEINFO * LPTVNODEINFO;
  58.  
  59. //helper macro for setting structure element values
  60. #define SETTVNODEINFO(tvnodei, dwAttr, enumbool, handle, strSite, indx, ihType, prq, strDir) \
  61. {\
  62.     (tvnodei).dwAttributes = dwAttr;\
  63.     (tvnodei).enumflag = enumbool;\
  64.     (tvnodei).hConnect = handle;\
  65.     lstrcpy((tvnodei).pszSite, strSite);\
  66.     (tvnodei).index = indx;\
  67.     (tvnodei).requestType = ihType;\
  68.     (tvnodei).prequestResult = prq; \
  69.     lstrcpy((tvnodei).pszDir, strDir); \
  70. }
  71.  
  72. class Clist;
  73. class CDlg;
  74.  
  75. class CCommonCtrl
  76. {
  77.     friend CDlg;
  78. protected:
  79.     HINSTANCE m_hInst;
  80.     HWND      m_hWndParent;
  81.     HBITMAP m_hb[3];         //imagelist bitamps
  82.     HIMAGELIST m_himg;       //imagelist handle
  83.     HWND      m_hWndTV;
  84.     //each root level ftp site in the treeview is represented by a
  85.     //Clist object which manages the linked list of all its child
  86.     //items 
  87.     Clist     *m_prootlvl[10];  
  88.     int       m_icount;
  89.  
  90.     //not really appropriate for CCommonCtrl class but these
  91.     //variables are used with TVNODEINFO data
  92.     WIN32_FIND_DATA m_FindData;
  93.     HTREEITEM m_hTreeItem;
  94. public:
  95.     BOOL ImageListInit();
  96.     HTREEITEM TreeViewAdd(TCHAR *, LPTVDATA, LPTVNODEINFO, LPDWORD);
  97.     HTREEITEM TreeViewParent(HTREEITEM, LPTV_ITEM, UINT, LPTSTR);
  98.     BOOL TreeViewItem(HTREEITEM, LPTV_ITEM, UINT, LPTSTR);
  99.     CCommonCtrl(HINSTANCE, HWND);
  100.     ~CCommonCtrl();
  101.  
  102. };
  103.  
  104. #endif