home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hot Shareware 35
/
hot35.iso
/
ficheros
/
LC
/
SEE4C10.ZIP
/
QUICK.C
< prev
next >
Wrap
C/C++ Source or Header
|
1998-05-31
|
4KB
|
179 lines
/*
** QUICK.C
**
** Simple program that sends a quick email!
*/
#include <windows.h>
#include "see.h"
#include "message.h"
#include "paint.h"
#include "about.h"
#include "param.h"
#include "str.h"
#include "ascii.h"
#ifdef WIN32
#define USE_INS HINSTANCE
#define USE_PTR PSTR
#else
#define USE_INS HANDLE
#define USE_PTR LPSTR
#endif
#define DEBUG_INTEGER -4
#define DEBUG_CHAR -5
LRESULT CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM);
/* globals */
#define MAX_BUF 1024
#define MAX_STR 64
#define SET_TO 1
#define SET_SUBJ 2
#define SET_MSG 3
HWND hMainWnd; /* main window handle */
static HMENU hMenu;
static USE_INS hInstance;
static int WinWidth = 8 * NCOLS;
static int WinHeight = 12 * NROWS + 48;
static HCURSOR ArrowCursor;
static HCURSOR WaitCursor;
/* WinMain */
#ifdef WIN32
int WINAPI
#else
int PASCAL
#endif
WinMain(USE_INS hInst, USE_INS hPrevInstance,
USE_PTR szCmdLine, int nCmdShow)
{WNDCLASS wc;
MSG msg;
BOOL Result;
if(!hPrevInstance)
{/* register main window class */
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = MainWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInst;
wc.hIcon = LoadIcon(hInst, "HostIcon");
wc.hCursor = NULL;
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = "HostMenu";
wc.lpszClassName = "HostWClass";
Result = RegisterClass(&wc);
if(!Result) return FALSE;
}
/* create main window */
hInstance = hInst;
hMainWnd = CreateWindow(
"HostWClass", "QUICK", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
WinWidth, WinHeight,
NULL, NULL,
hInstance, NULL);
ShowWindow(hMainWnd, nCmdShow);
UpdateWindow(hMainWnd);
hMenu = GetMenu(hMainWnd);
/* window control loop */
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (msg.wParam);
} /* end WinMain */
#ifdef WIN32
LRESULT CALLBACK
#else
long FAR PASCAL
#endif
MainWndProc(HWND hWindow,UINT iMsg,WPARAM wParam,LPARAM lParam)
{HDC hDC;
PAINTSTRUCT ps;
#ifdef WIN32
#else
static FARPROC lpfnAboutDlgProc;
static FARPROC lpfnParamDlgProc;
#endif
hMainWnd = hWindow;
switch (iMsg)
{case WM_CREATE:
/* create cursors */
ArrowCursor = LoadCursor(NULL, IDC_ARROW);
WaitCursor = LoadCursor(NULL, IDC_WAIT);
SetCursor(ArrowCursor);
#ifdef WIN32
#else
/* create thunk for Win16 */
lpfnAboutDlgProc = MakeProcInstance(AboutDlgProc,hInstance);
lpfnParamDlgProc = MakeProcInstance(ParamDlgProc,hInstance);
#endif
/* initialize paint module */
PaintInit();
DisplayLine("Choose 'SendMail' above to set email fields & send email");
DisplayLine("Remember to enclose all email addresses in '<>' brackets");
break;
case WM_COMMAND:
switch(wParam)
{case MSG_ABOUT :
#ifdef WIN32
DialogBox(hInstance, "AboutBox", hMainWnd, AboutDlgProc);
#else
DialogBox(hInstance, "AboutBox", hMainWnd, lpfnAboutDlgProc);
#endif
return 0;
case MSG_PARAM:
#ifdef WIN32
DialogBox(hInstance, "ParamBox", hMainWnd, ParamDlgProc);
#else
DialogBox(hInstance, "ParamBox", hMainWnd, lpfnParamDlgProc);
#endif
return 0;
case MSG_EXIT:
DestroyWindow(hMainWnd);
break;
case MSG_DEBUG:
break;
}
break;
case WM_PAINT:
HideCaret(hMainWnd);
hDC = BeginPaint(hMainWnd, &ps);
SetMapMode(hDC,MM_ANISOTROPIC);
SelectObject(hDC, GetStockObject(OEM_FIXED_FONT) );
PaintMain(hDC,&ps);
EndPaint(hMainWnd,&ps);
SetCaretPos(PaintGetColPos(),PaintGetRowPos());
ShowCaret(hMainWnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return (DefWindowProc(hMainWnd, iMsg, wParam, lParam));
}
return 0;
}