home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 December / PCWKCD1296.iso / vjplusb / activex / inetsdk / samples / wininet / asyncftp / cdlg.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-01  |  2.8 KB  |  98 lines

  1.  
  2.  
  3.  
  4. #ifndef _CDLG_H_ 
  5. #define _CDLG_H_
  6.  
  7.  
  8. //application defined messages sent from Internet
  9. //callback function to dialog procedure
  10. #define  WM_INTERNETCONNECT            (WM_USER + 100)
  11. #define  WM_INTERNETFILEOPENED        (WM_USER + 101)
  12. #define  WM_INTERNETFILEFOUND        (WM_USER + 102)
  13. #define  WM_INTERNETENUMERATE        (WM_USER + 103)
  14. #define  WM_INTERNETENUMCONNECT        (WM_USER + 105)
  15. #define  WM_INTERNETOPENFILE        (WM_USER + 109)
  16.  
  17. //request types sent from dialog procedure to Internet
  18. //callback function via dwContext parameter 
  19. #define  REQUEST_NEW_INTERNET_SITE        1000
  20. #define  REQUEST_INTERNET_CONNECT        1001
  21. #define  REQUEST_INTERNET_OPENFILE        1002
  22. #define  REQUEST_INTERNET_ENUM_CONNECT  1003
  23. #define  REQUEST_INTERNET_OPEN_CONNECT  1004
  24. #define  REQUEST_FIRSTFILEFOUND            2000
  25. #define  REQUEST_FILENOTFOUND            2001
  26. #define  REQUEST_FILETRANSFER            2002
  27. #define  REQUEST_INTERNETFILEREAD        2005
  28. #define  REQUEST_INTERNETDELETEFILE     2006
  29.  
  30.  
  31. //maximum size of status editbox buffer
  32. #define STRMAX 50000
  33.  
  34. //maximum size of file to read
  35. #define STRRDMAX 20000
  36.  
  37.  
  38.  
  39. class CDlg 
  40. {
  41. protected:
  42.     HWND                m_hWnd;
  43.     HINSTANCE            m_hInst;
  44.     DWORD               m_dwAccessType;  //INTERNET_ACCESS* types
  45.     TCHAR               m_szPwd[20];     //password
  46.     TCHAR               m_szUser[20];    //username
  47.     TCHAR               m_szProxy[20];   //proxy name
  48.     LPTSTR              m_pszPwd;
  49.     LPTSTR              m_pszUser ;
  50.     LPTSTR              m_pszProxy;
  51.     CCommonCtrl        *m_pcctrl;
  52.     BOOL                m_anonymous;     //logon type 
  53.     HMENU               m_hmnu;          //menu handle for right mouse click popup menus
  54.     HINTERNET           m_hSession;
  55.     HINTERNET           m_hLastHandleCreated;
  56.     TCHAR               m_filebuf[STRRDMAX];
  57.     DWORD               m_dwBytesRead;
  58.     HANDLE              m_hFileDownload;
  59.  
  60.                                   
  61. public:
  62.     // Initialization methods
  63.     CDlg(HINSTANCE);           // Constructor
  64.     virtual ~CDlg();          // Destructor
  65.     BOOL Init(int);
  66.     BOOL OnGoto(DWORD);
  67.     HWND GetHWND()
  68.     {
  69.         return m_hWnd;
  70.     }
  71.     //user command to connect
  72.     BOOL OnCommand(HWND, WPARAM, LPARAM);
  73.  
  74.     //internet wrapped functions
  75.     BOOL InetDelete(TV_ITEM *);
  76.     void InetEnumerate(LPARAM, HTREEITEM);
  77.     void InetRead(LPARAM);
  78.     void InetConnect(LPTSTR, LPHINTERNET, DWORD);
  79.     void InetOpen();
  80.     BOOL InetEnumNext(LPARAM);
  81.  
  82.     //utility 
  83.     BOOL AddItem(LPARAM);
  84.     void ParseServer(LPTSTR, LPTSTR, LPTSTR);
  85.  
  86.     //dialog procedure
  87.     static BOOL CALLBACK DialogProc(HWND, UINT, WPARAM, LPARAM); 
  88.     //internet callback function for asynchronous calls
  89.     static VOID CALLBACK InternetCallback (HINTERNET hInternet, DWORD dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInformation, DWORD dwStatusInformationLength);
  90.  
  91. };
  92.  
  93. //about box dialog procedure
  94. BOOL CALLBACK AboutDlgProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam);
  95.  
  96. #endif
  97.  
  98.