1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>
#include "..\\..\\..\\Allgemeines\\Windowmaker.h"
using namespace std;
LRESULT CALLBACK Callback(HWND hWnd, UINT msg, WPARAM wParam,LPARAM lParam);
void showMessage(string(*Message)(bool), bool yes_no);
string ApplicationInitMessage(bool Inited);
string WindowInitMessage(bool Inited);
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, char* Cmd,
int CmdLine)
{
int Pos[2] = {0,0};
int Weight[2] = {500,500};
const char className[] = "Logfiletest";
const char caption[] = "Logfiletest";
HWND hWnd;
WNDCLASSEX wc;
MSG msg;
wc = InitApp(&hInst, className, Callback);
if(!(RegisterClassEx(&wc))){
showMessage(ApplicationInitMessage, false);
return 1;
}
else
showMessage(ApplicationInitMessage, true);
hWnd = InitWnd(&hInst, className, caption, Pos, Weight);
if(hWnd == NULL){
showMessage(WindowInitMessage, false);
return 1;
}
else
showMessage(WindowInitMessage, true);
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
LRESULT CALLBACK Callback(HWND hWnd, UINT msg, WPARAM wParam,LPARAM lParam)
{
switch(msg)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return(DefWindowProc(hWnd, msg, wParam, lParam));
}
void showMessage(string(*Message)(bool), bool yes_no)
{
string Text;
Text = Message(yes_no);
ofstream Out((char*) "Logfile.txt", ios::ate | ios::out);
Out.write((char*) Text.c_str(), sizeof(Text));
Out.close();
}
string ApplicationInitMessage(bool Inited)
{
string text;
if(Inited == true)
text = "Applikation erfolgreich Initialisiert!";
else
text = "Applikation nicht erfolgreich Initialisiert!";
return text;
}
string WindowInitMessage(bool Inited)
{
string text;
if(Inited == true)
text = "Fenster erfolgreich Initialisiert!";
else
text = "Fenster nicht erfolgreich Initialisiert!";
return text;
}
|