#include "stdafx.h"
#include "osisp_laba4.h"
#include "CreatingWindow.h"
#include "LoadDatabase.h"


HINSTANCE				hInst;
extern const char		*g_DatabasePtr;
extern int				g_cRecordsInBase;
extern HWND				g_hMainWindow;
extern OPENDATABASEROUTINE		openDatabaseRoutine;

int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR    lpCmdLine,
                     int       nCmdShow)
{
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);

 	// TODO: Place code here.

	hInst = hInstance;

	if (LoadDatabaseDLL() == FALSE) {
		return EXIT_FAILURE;
	}

	CreateMainWindow(nCmdShow);
	
	g_DatabasePtr = openDatabaseRoutine(TEXT("telbase.txt"), &g_cRecordsInBase);
	if (g_DatabasePtr) {
		TCHAR buff[100];
		_stprintf_p(buff, sizeof(buff), TEXT("Number of Records: %d"), g_cRecordsInBase);
		MessageBox(g_hMainWindow, buff, TEXT("DataBase downloaded Successfully!"), MB_OK);

	}


	HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_OSISP_LABA4));
	MSG msg;
	while (GetMessage(&msg, NULL, 0, 0))
	{
		if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	}

	return (int) msg.wParam;
}

Соседние файлы в папке osisp_laba4