INETALL.H

/////////////////////////////////////////////////////// 
/*
* inetall.h
*
* Written by Wei Hua
* of Microsoft Developer Support
*
* Copyright (C) 1997 Microsoft Corporation. All rights reserved
*
* Header file for inetal.cpp.
*/
//////////////////////////////////////////////////////


//dialog box control id for rc file
///////////////////////////////////////////////////////
#define IDC_STATIC -1
#define IDD_INETALL_DIALOG 102
#define IDR_MAINFRAME 128
#define IDB_BMERR 130
#define IDB_BMDIR 131
#define IDB_BMFILE 132
#define IDC_HTTP 1000
#define IDC_FTP 1001
#define IDC_FILE 1002
#define IDC_URL 1006
#define IDC_USERNAME 1007
#define IDC_PASSWORD 1008
#define IDC_HTML 1009
#define IDC_GETDATA 1010
#define IDC_TREE1 1012
#define IDC_CERN 1013

///////////////////////////////////////////////////////
#define MAX_STRING_SIZE1024
#define SERVICE_TYPE_HTTP1
#define SERVICE_TYPE_FTP2
#define SERVICE_TYPE_FILE3

HINSTANCE g_hInst;//Application Instance
HWND g_hDlg;//main dialogbox window handle
TCHAR szFullUrl[MAX_STRING_SIZE];

//ItemAttrib, and CMyItemArray: data structures for enumerating
//FTP URL and FILE URL
typedef struct _tagItemAttrib
{
TCHARszObjectPath[MAX_STRING_SIZE];
intnObjectType; //0 file object, 1 directory object
} ItemAttrib, *PItemAttrib;

//Implements only the minimal functions needed for maintaining items
//info in the tree control.
class CMyItemArray
{
public:
CMyItemArray();// standard constructor
~CMyItemArray();

int Add(ItemAttrib& item); //return Item index
void RemoveAll();
ItemAttrib GetAt(int nIndex);
int GetSize();

private:
PItemAttrib m_pItemlist;
int m_nCount;
};

typedef struct _tagINETALLBAG
{
HIMAGELISThImgList;
HWNDhTreeViewCtrl;
HTREEITEMm_curItem;

HWNDhCheckBoxCern;
BOOLm_cern;

DWORDm_dwServiceType;

HWNDhwndUrl;
TCHARm_url[MAX_STRING_SIZE];
HWNDhwndPassword;
TCHARm_password[MAX_STRING_SIZE];
HWNDhwndUsername;
TCHARm_username[MAX_STRING_SIZE];

HWNDhwndHTML;
LPTSTRm_phtml;
DWORDm_dwSizeHtml;
CMyItemArraym_itemArray;

BOOLm_bRedrawTree;
//TRUE delete all items in the tree control and add new items.
//FALSE add new items as the sub items to the hCurItem

} INETALLBAG, *PINETALLBAG;

INETALLBAG g_Inet;

//Update UI or Collect input from UI
//bDirection FALSE g_Inet to UI
//bDirection TRUE UI to g_Inet
//Helper function similar to MFC UpdateData
BOOL UpdateUI(BOOL bDirection);

//Enumerate strURL, and populate g_Inet.m_itemArray
BOOL FillFtpOrFileObjArray(HINTERNET InternetSession, LPTSTR strURL);

//Draw the TreeView control using g_Inet.m_itemArray
void FillTreeControl();