// Gui.h :  Header file for WinGUI.cpp
// Author :  Murat Guler

#include <windows.h>
#include <commctrl.h>
#include <windowsx.h>
#include <wininet.h>
 

#define WM_READY_NOW WM_USER + 1

#define OPENURL

/* Global Constants */
#define dim(x) (sizeof(x)/sizeof(x[0]))
#define IDC_CMDBAR 1                            // Command bar ID
#define IDC_CLIENT 2                            // Client window ID
#define IDC_EDITBOX 3       // Edit box ID
#define CLIENTWINDOW TEXT("ClientWnd")
#define EDITWINDOW TEXT("EditWnd")
//#define BOX_HEIGHT 20       // Used to be the Edit Box Height
#define COLOR_BLACK 0x00000000
//#define MAX_FILE_LENGTH 32000     // Limits the browser text file length
#define FONTHEIGHT 15       // Height of Font
 

/* Global Structures */
// Associates Windows messages with functions.
struct decodeUINT {
 UINT Code;
 LRESULT (*Fxn)(HWND, UINT, WPARAM, LPARAM);
};

// Associates menu ID's with functions.
struct decodeCMD {
 UINT Code;
 LRESULT (*Fxn)(HWND, WORD, HWND, WORD);
};

/* Necessary Functions */
int InitApp (HINSTANCE);
int InitInstance (HINSTANCE, LPWSTR, int);
int TermInstance (HINSTANCE, int);
int ReadWebPage (TCHAR *, LPDWORD);
int FindTextLength (TCHAR *, DWORD, LPDWORD);

int InitClient (HINSTANCE);
int TermClient (HINSTANCE, int);

//int InitEditWnd (HINSTANCE);
 
 

void DoInet (LPTSTR, HWND);

/* Declare Windowsprocedure */
LRESULT CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK ClientWndProc(HWND, UINT, WPARAM, LPARAM);
//LRESULT CALLBACK EditWndProc (HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK OpenDlgProc (HWND, UINT, WPARAM, LPARAM);

/* Message Functions */
LRESULT DoCreateMain (HWND, UINT, WPARAM, LPARAM);
LRESULT DoDestroyMain (HWND, UINT, WPARAM, LPARAM);
LRESULT DoSizeMain (HWND, UINT, WPARAM, LPARAM);
LRESULT DoCommandMain (HWND, UINT, WPARAM, LPARAM);

LRESULT DoCreateClient (HWND, UINT, WPARAM, LPARAM);
LRESULT DoPaintClient (HWND, UINT, WPARAM, LPARAM);
LRESULT DoVScrollClient (HWND, UINT, WPARAM, LPARAM);

//LRESULT DoCreateEditWnd (HWND, UINT, WPARAM, LPARAM);
//LRESULT DoCommandEditWnd (HWND, UINT, WPARAM, LPARAM);

/* Command Functions */
LPARAM DoMainCommandExit (HWND, WORD, HWND, WORD);
LPARAM DoMainCommandOpen (HWND, WORD, HWND, WORD);