Well, the whole code is 900~ lines of code, anyway here it is
#include <windows.h>
#define ID_TABCTRL 1
#include <commctrl.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include"C:\Users\Moudi\Documents\Visual Studio 2008\Projects\grade op\grade op\resource.h"
const char g_szClassName[] = "myWindowClass";
char tempp[20];
HWND hTab;
HWND hwndList;
HWND hwndButton;
HWND hwndEdit;
HINSTANCE g_hinst;
HWND hwndEdit2;
HWND hwndEdit3;
HWND hwndEdit4;
HWND hwndEdit5;
HWND hwndEdit6;
HWND hwndEdit7;
HWND hwndEdit8;
HWND hwndEdit9;
HWND hwndEdit10;
HWND hwndEdit11;
HWND hwndEdit12;
HWND hwndEdit13;
HWND hwndEdit14;
HWND hwndEdit15;
HWND hwndEdit16;
HWND hwndEdit17;
int sel;
HWND hwndList2;
char temp2[100];
int i;
int vres =0, tres =0;
int newlines =0;
char *str[13][5];
int result[13];
char temp[500];
int len;
int res;
char name[100];
char *note = NULL;
char cc;
int comma = 0;
HBITMAP g_hbmBall = NULL;
int SaveToFile(char n[], int arry[],FILE **fp,int vir, int ter, int tot);
int SaveToFile(char n[], int arry[],FILE **fp,int vir, int ter, int tot)
{
int i;
fprintf(fp, "%s,", n);
for(i=0; i<13; i++)
{
fprintf(fp, "%d,", arry[i]);
}
fprintf(fp, "%d,%d,%d\n", vir,ter,tot);
fclose(fp);
}
void DoIt()
{
if(GetWindowTextLength(hwndEdit) == 0 || GetWindowTextLength(hwndEdit2) == 0 || GetWindowTextLength(hwndEdit3) == 0 || GetWindowTextLength(hwndEdit4) == 0 || GetWindowTextLength(hwndEdit5) == 0 || GetWindowTextLength(hwndEdit6) == 0 || GetWindowTextLength(hwndEdit7) == 0 || GetWindowTextLength(hwndEdit8) == 0 || GetWindowTextLength(hwndEdit9) == 0 || GetWindowTextLength(hwndEdit10) == 0 || GetWindowTextLength(hwndEdit11) == 0 || GetWindowTextLength(hwndEdit12) == 0 || GetWindowTextLength(hwndEdit13) == 0 || GetWindowTextLength(hwndEdit14) == 0 )
{
MessageBox(hwndButton, "A textbox was not filled, please recheck", "Info missing", MB_OK | MB_ICONERROR);
}
else{
len = GetWindowTextLength(hwndEdit2) + 1;
GetWindowText(hwndEdit2, str[0], len);
len = GetWindowTextLength(hwndEdit3) + 1;
GetWindowText(hwndEdit3, str[1], len);
len = GetWindowTextLength(hwndEdit4) + 1;
GetWindowText(hwndEdit4, str[2], len);
len = GetWindowTextLength(hwndEdit5) + 1;
GetWindowText(hwndEdit5, str[3], len);
len = GetWindowTextLength(hwndEdit6) + 1;
GetWindowText(hwndEdit6, str[4], len);
len = GetWindowTextLength(hwndEdit7) + 1;
GetWindowText(hwndEdit7, str[5], len);
len = GetWindowTextLength(hwndEdit8) + 1;
GetWindowText(hwndEdit8, str[6], len);
len = GetWindowTextLength(hwndEdit9) + 1;
GetWindowText(hwndEdit9, str[7], len);
len = GetWindowTextLength(hwndEdit10) + 1;
GetWindowText(hwndEdit10, str[8], len);
len = GetWindowTextLength(hwndEdit11) + 1;
GetWindowText(hwndEdit11, str[9], len);
len = GetWindowTextLength(hwndEdit12) + 1;
GetWindowText(hwndEdit12, str[10], len);
len = GetWindowTextLength(hwndEdit13) + 1;
GetWindowText(hwndEdit13, str[11], len);
len = GetWindowTextLength(hwndEdit14) + 1;
GetWindowText(hwndEdit14, str[12], len);
for(i=0; i<13; i++)
{
result[i] = atoi(str[i]);
}
for(i=0; i<7; i++)
{
vres+=result[i];
}
for(i=7; i<13; i++)
{
tres+=result[i];
}
res = vres + tres;
SetWindowText(hwndEdit15, itoa(vres,temp2 ,10));
SetWindowText(hwndEdit16, itoa(tres,temp2, 10));
SetWindowText(hwndEdit17, itoa(res, temp2, 10));
GetWindowText(hwndEdit, name, GetWindowTextLength(hwndEdit) + 1);
if(res>=1100)
{
SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM) name);
}
else{
SendMessage(hwndList2, LB_ADDSTRING, 0, (LPARAM) name);
}
FILE *file;
file = fopen("mydatabase.dbs", "ab+");
SaveToFile(name, result, file, vres, tres, res);
res = vres = tres = 0;
}
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_CREATE:
{
CreateWindow(TEXT("STATIC"), "Student name",
WS_CHILD | WS_VISIBLE | SS_LEFT,
110, 30, 200, 20,
hwnd, (HMENU) 1, NULL,NULL);
hwndEdit = CreateWindow(TEXT("Edit"), NULL, WS_CHILD|WS_VISIBLE |ES_AUTOHSCROLL|ES_AUTOHSCROLL|WS_BORDER,
110, 50,200, 25, hwnd, (HMENU) 2,
NULL, NULL);
hwndList = CreateWindow(TEXT("listbox") , NULL, WS_CHILD | WS_VISIBLE | LBS_NOTIFY | WS_BORDER,
10, 10, 90, 500, hwnd,(HMENU) 3, g_hinst, NULL);
hwndList2 = CreateWindow(TEXT("listbox") , NULL, WS_CHILD | WS_VISIBLE | LBS_NOTIFY | WS_BORDER,
900, 10, 90, 500, hwnd,(HMENU) 3, g_hinst, NULL);
CreateWindow(TEXT("STATIC"), "Law grade",
WS_CHILD | WS_VISIBLE | SS_LEFT,
110, 80, 200,20,
hwnd, (HMENU) 6, NULL,NULL);
hwndEdit2 = CreateWindow(TEXT("Edit"), NULL, WS_CHILD|WS_VISIBLE |ES_AUTOHSCROLL|ES_AUTOHSCROLL|WS_BORDER,
110, 100, 200,25, hwnd, (HMENU) 5,
NULL,NULL);
CreateWindow(TEXT("STATIC"), "Math Grade",
WS_CHILD | WS_VISIBLE | SS_LEFT,
110, 130, 200,20,
hwnd, (HMENU) 7, NULL,NULL);
hwndEdit3 = CreateWindow(TEXT("Edit"), NULL, WS_CHILD|WS_VISIBLE |ES_AUTOHSCROLL|ES_AUTOHSCROLL|WS_BORDER,
110, 150, 200, 25, hwnd, (HMENU) 8,
NULL,NULL);
CreateWindow(TEXT("STATIC"), "Primary language grade",
WS_CHILD | WS_VISIBLE | SS_LEFT,
110, 180, 200, 20,
hwnd, (HMENU) 9, NULL,NULL);
hwndEdit4 = CreateWindow(TEXT("Edit"), NULL, WS_CHILD|WS_VISIBLE |ES_AUTOHSCROLL|ES_AUTOHSCROLL|WS_BORDER,
110, 200, 200, 25, hwnd, (HMENU) 10,
NULL, NULL);
CreateWindow(TEXT("STATIC"), "Sociology",
WS_CHILD|WS_VISIBLE|SS_LEFT,
110,230,200,20,
hwnd, (HMENU) 11, NULL,NULL);
hwndEdit5 = CreateWindow(TEXT("Edit"), NULL, WS_CHILD|WS_VISIBLE |ES_AUTOHSCROLL|ES_AUTOHSCROLL|WS_BORDER,
110, 250, 200, 25, hwnd, (HMENU) 12,
NULL,NULL);
CreateWindow(TEXT("STATIC"), "Religion",
WS_CHILD|WS_VISIBLE|SS_LEFT,
110, 280, 200,20,
hwnd, (HMENU) 13, NULL,NULL);
hwndEdit6 = CreateWindow(TEXT("Edit"), NULL, WS_CHILD|WS_VISIBLE |ES_AUTOHSCROLL|ES_AUTOHSCROLL|WS_BORDER,
110, 300, 200, 25, hwnd, (HMENU) 14, NULL,NULL);
CreateWindow(TEXT("STATIC"), "Secondary language grade",
WS_CHILD|WS_VISIBLE|SS_LEFT,
110,330, 200, 20,
hwnd, (HMENU) 15, NULL,NULL);
hwndEdit7 = CreateWindow(TEXT("Edit"), NULL, WS_CHILD|WS_VISIBLE |ES_AUTOHSCROLL|ES_AUTOHSCROLL|WS_BORDER,
110, 350, 200, 25, hwnd, (HMENU) 16, NULL,NULL);
CreateWindow(TEXT("STATIC"), "Arabic Grade",
WS_CHILD|WS_VISIBLE|SS_LEFT,
110, 380, 200, 20, hwnd, (HMENU) 17, NULL,NULL);
hwndEdit8 = CreateWindow(TEXT("Edit"), NULL, WS_CHILD|WS_VISIBLE |ES_AUTOHSCROLL|ES_AUTOHSCROLL|WS_BORDER,
110, 400, 200, 25, hwnd, (HMENU) 18, NULL,NULL);
CreateWindow(TEXT("STATIC"), "Information Technology Grade",
WS_CHILD|WS_VISIBLE|SS_LEFT,
380, 30, 200,20, hwnd, (HMENU) 19, NULL,NULL);
hwndEdit9 = CreateWindow(TEXT("Edit"), NULL, WS_CHILD|WS_VISIBLE |ES_AUTOHSCROLL|ES_AUTOHSCROLL|WS_BORDER,
380, 50, 200, 25, hwnd, (HMENU) 20, NULL,NULL);
CreateWindow(TEXT("STATIC"), "Microsoft Access",
WS_CHILD|WS_VISIBLE|SS_LEFT,
380, 80, 200, 20, hwnd, (HMENU) 21, NULL,NULL);
hwndEdit10 = CreateWindow(TEXT("Edit"), NULL, WS_CHILD|WS_VISIBLE |ES_AUTOHSCROLL|ES_AUTOHSCROLL|WS_BORDER,
380, 100, 200, 25, hwnd, (HMENU) 22, NULL,NULL);
CreateWindow(TEXT("STATIC"), "Pc Assembly",
WS_CHILD|WS_VISIBLE|SS_LEFT,
380, 130, 200, 20, hwnd, (HMENU) 23, NULL,NULL);
hwndEdit11 = CreateWindow(TEXT("Edit"), NULL, WS_CHILD|WS_VISIBLE |ES_AUTOHSCROLL|ES_AUTOHSCROLL|WS_BORDER,
380, 150, 200, 25, hwnd, (HMENU) 24, NULL,NULL);
CreateWindow(TEXT("STATIC"), "C Programming",
WS_CHILD|WS_VISIBLE|SS_LEFT,
380, 180, 200, 20, hwnd, (HMENU) 25, NULL,NULL);
hwndEdit12 = CreateWindow(TEXT("Edit"), NULL, WS_CHILD|WS_VISIBLE |ES_AUTOHSCROLL|ES_AUTOHSCROLL|WS_BORDER,
380, 200, 200, 25, hwnd, (HMENU) 26, NULL,NULL);
CreateWindow(TEXT("STATIC"), "Webdesign HTML",
WS_CHILD|WS_VISIBLE|SS_LEFT,
380, 230, 200, 20, hwnd, (HMENU) 27, NULL,NULL);
hwndEdit13 = CreateWindow(TEXT("Edit"), NULL, WS_CHILD|WS_VISIBLE |ES_AUTOHSCROLL|ES_AUTOHSCROLL|WS_BORDER,
380, 250, 200, 25, hwnd, (HMENU) 28, NULL,NULL);
CreateWindow(TEXT("STATIC"), "Networking",
WS_CHILD|WS_VISIBLE|SS_LEFT,
380, 280, 200, 20, hwnd, (HMENU) 29, NULL,NULL);
hwndEdit14 = CreateWindow(TEXT("Edit"), NULL, WS_CHILD|WS_VISIBLE |ES_AUTOHSCROLL|ES_AUTOHSCROLL|WS_BORDER,
380, 300, 200, 25, hwnd, (HMENU) 30, NULL,NULL);
CreateWindow(TEXT("STATIC"), "Theory total",
WS_CHILD|WS_VISIBLE|SS_LEFT,
650, 30, 200, 25, hwnd, (HMENU) 31, NULL,NULL);
hwndEdit15 = CreateWindow(TEXT("Edit"), NULL, WS_CHILD|WS_VISIBLE |ES_AUTOHSCROLL|ES_AUTOHSCROLL|WS_BORDER,
650, 50, 200, 25, hwnd, (HMENU) 32, NULL,NULL);
CreateWindow(TEXT("STATIC"), "IT Total",
WS_CHILD|WS_VISIBLE|SS_LEFT,
650, 80, 200, 25, hwnd, (HMENU) 33, NULL,NULL);
hwndEdit16 = CreateWindow(TEXT("Edit"), NULL, WS_CHILD|WS_VISIBLE |ES_AUTOHSCROLL|ES_AUTOHSCROLL|WS_BORDER,
650, 100, 200, 25, hwnd, (HMENU) 34, NULL,NULL);
CreateWindow(TEXT("STATIC"), "TOTAL",
WS_CHILD|WS_VISIBLE|SS_LEFT,
650, 130, 200,25, hwnd, (HMENU) 35, NULL,NULL);
hwndEdit17 = CreateWindow(TEXT("Edit"), NULL, WS_CHILD|WS_VISIBLE |ES_AUTOHSCROLL|ES_AUTOHSCROLL|WS_BORDER,
650, 150, 200,25,hwnd,(HMENU)36,NULL,NULL);
hwndButton = CreateWindow( TEXT("button"), TEXT("Submit"),
WS_VISIBLE | WS_CHILD,
200,450,100,25,
hwnd, (HMENU) 37, NULL, NULL);
FILE *fp;
fp=fopen("mydatabase.dbs", "rb+");
const int blocksize = 255; // allocate 255 bytes at a time
size_t cursize = 0; // current allocated size
size_t used = 0; // number of bytes used
while((cc=fgetc(fp))!=EOF)
{
if( (used +1) >= cursize)
{
cursize += blocksize;
note = realloc(note, cursize);
}
note[used++] = cc;
}
newlines=0;
for(i=0; i<strlen(note)+1; i++)
{
if(note[i] == "\n")
{
newlines++;
}
}
char **law = malloc(sizeof(char *) * newlines + 3);
for(i=0; i<newlines + 3; i++)
{
law[i] = malloc(sizeof(char) * 4);
}
char **math = malloc(sizeof(char *) *newlines + 3);
for(i=0; i<newlines + 3; i++)
{
math[i] = malloc(sizeof(char) * 4);
}
char **pl = malloc(sizeof(char *) *newlines + 3);
for(i=0; i<newlines + 3; i++)
{
pl[i] = malloc(sizeof(char) * 4);
}
char **soc = malloc(sizeof(char *) * newlines + 3);
for(i=0; i<newlines + 3; i++)
{
soc[i] = malloc(sizeof(char) * 4);
}
char **rel = malloc(sizeof(char *) * newlines + 3);
for(i=0; i<newlines + 3; i++)
{
rel[i] = malloc(sizeof(char) * 4);
}
char **sl = malloc(sizeof(char *) * newlines + 3);
for(i=0; i<newlines + 3; i++)
{
sl[i] = malloc(sizeof(char) * 4);
}
char **arabic = malloc(sizeof(char *) * newlines + 3);
for(i=0; i<newlines + 3; i++)
{
arabic[i] = malloc(sizeof(char) * 4);
}
char **IT = malloc(sizeof(char *) * newlines + 3);
for(i=0; i<newlines + 3; i++)
{
IT[i] = malloc(sizeof(char) * 4);
}
char **MC = malloc(sizeof(char *) * newlines + 3);
for(i=0; i<newlines +3; i++)
{
MC[i] = malloc(sizeof(char) *4);
}
char **PC = malloc(sizeof(char *) *newlines +3);
for(i=0; i<newlines+3; i++)
{
PC[i] = malloc(sizeof(char) * 4);
}
char **CPP = malloc(sizeof(char *) * newlines + 3);
for(i=0; i<newlines+3; i++)
{
CPP[i] = malloc(sizeof(char) * 4);
}
char **HTML = malloc(sizeof(char *) *newlines+3);
for(i=0; i<newlines+3; i++)
{
HTML[i] = malloc(sizeof(char) * 4);
}
char **NET = malloc(sizeof(char *) *newlines+3);
for(i=0; i<newlines+3; i++)
{
NET[i] = malloc(sizeof(char) * 4);
}
char **TE = malloc(sizeof(char *) *newlines+3);
for(i=0; i<newlines+3; i++)
{
TE[i] = malloc(sizeof(char) * 4);
}
char **TT = malloc(sizeof(char *) *newlines+3);
for(i=0; i<newlines+3; i++)
{
TT[i] = malloc(sizeof(char) * 4);
}
char **tott = malloc(sizeof(char *) *newlines+3);
for(i=0; i<newlines+3; i++)
{
tott[i] = malloc(sizeof(char) * 4);
}
char **namee = malloc(sizeof(char *) *newlines+3);
for(i=0; i<newlines+3; i++)
{
namee[i] = malloc(sizeof(char) * 50);
}
i=0;
int i2;
newlines =0;
comma=0;
for(i=0; i<strlen(note) + 1; )
{
this:
if(note[i] == EOF)
{
break;
}
if(comma==0)
{
if(note[i] == ",")
{
comma++;
temp[i2+1] = "\0";
strcpy(namee[newlines], temp);
strcpy(temp, "\0");
i2=0;
i++;
goto this;
}
else if(note[i] == "\n"){
newlines++;
strcpy(temp, "\0");
comma =0;
i++;
i2=0;
goto this;
}
else if(note[i] == EOF)
{
break;
}
else{
temp[i2] = note[i];
i++;
i2++;
}
}
else if(comma==1)
{
if(note[i]==",")
{
comma++;
strcat(temp, "\0");
strcpy(law[newlines], temp);
i++;
i2=0;
strcpy(temp, "\0");
goto this;
}
else if(note[i] == EOF)
{
break;
}
else if(note[i] == "\n"){
newlines++;
strcpy(temp, "\0");
comma =0;
i++;
i2=0;
goto this;
}
else{
temp[i2] = note[i];
i++;
i2++;
}
}
else if(comma==2)
{
if(note[i] == ",")
{
comma++;
strcat(temp, "\0");
strcpy(math[newlines], temp);
i++;
i2=0;
strcpy(temp, "\0");
goto this;
}
else if(note[i] == EOF)
{
break;
}
else if(note[i] == "\n")
{
newlines++;
strcpy(temp, "\0");
comma =0;
i2=0;
i++;
goto this;
}
else{
temp[i2] = note[i];
i++;
i2++;
}
}
else if(comma == 3)
{
if(note[i] == ",")
{
comma++;
strcat(temp, "\0");
strcpy(pl[newlines], temp);
i++;
i2=0;
strcpy(temp, "\0");
goto this;
}
else if(note[i] == EOF)
{
break;
}
else if(note[i] == "\n")
{
newlines++;
strcpy(temp, "\0");
comma =0;
i2=0;
i++;
goto this;
}
else{
temp[i2] = note[i];
i++;
i2++;
}
}
else if(comma == 4)
{
if(note[i] == ",")
{
comma++;
strcat(temp, "\0");
strcpy(soc[newlines], temp);
i++;
i2=0;
strcpy(temp, "\0");
goto this;
}
else if(note[i] == EOF)
{
break;
}
else if(note[i] == "\n")
{
newlines++;
i2=0;
strcpy(temp, "\0");
comma =0;
i++;
goto this;
}
else{
temp[i2] = note[i];
i++;
i2++;
}
}
else if(comma==5)
{
if(note[i] == ",")
{
comma++;
strcat(temp, "\0");
strcpy(rel[newlines], temp);
i++;
i2=0;
strcpy(temp, "\0");
goto this;
}
else if(note[i] == EOF)
{
break;
}
else if(note[i] == "\n")
{
newlines++;
i2=0;
strcpy(temp, "\0");
comma =0;
i++;
goto this;
}
else{
temp[i2] = note[i];
i++;
i2++;
}
}
else if(comma == 6)
{
if(note[i] == ",")
{
comma++;
i2=0;
strcat(temp, "\0");
strcpy(sl[newlines], temp);
i++;
strcpy(temp, "\0");
goto this;
}
else if(note[i] == EOF)
{
break;
}
else if(note[i] == "\n")
{
newlines++;
i2=0;
strcpy(temp, "\0");
comma=0;
i++;
goto this;
}
else{
temp[i2] = note[i];
i++;
i2++;
}
}
else if(comma==7)
{
if(note[i] == ",")
{
comma++;
i2=0;
strcat(temp,"\0");
strcpy(arabic[newlines], temp);
i++;
strcpy(temp, "\0");
goto this;
}
else if(note[i] == EOF)
{
break;
}
else if(note[i] == "\n")
{
newlines++;
i2=0;
strcpy(temp, "\0");
comma=0;
i++;
goto this;
}
else{
temp[i2] = note[i];
i++;
i2++;
}
}
else if(comma==8)
{
if(note[i] == ",")
{
comma++;
i2=0;
strcat(temp, "\0");
strcpy(IT[newlines], temp);
i++;
strcpy(temp, "\0");
goto this;
}
else if(note[i] == EOF)
{
break;
}
else if(note[i] == "\n")
{
newlines++;
strcpy(temp, "\0");
comma=0;
i2=0;
i++;
goto this;
}
else{
temp[i2] = note[i];
i++;
i2++;
}
}
else if(comma==9)
{
if(note[i] == ",")
{
comma++;
i2=0;
strcat(temp, "\0");
strcpy(MC[newlines], temp);
i++;
strcpy(temp, "\0");
goto this;
}
else if(note[i] == EOF)
{
break;
}
else if(note[i] == "\n")
{
newlines++;
i2=0;
strcpy(temp, "\0");
comma=0;
i++;
goto this;
}
else{
temp[i2] = note[i];
i++;
i2++;
}
}
else if(comma ==10)
{
if(note[i] == ",")
{
comma++;
i2=0;
strcat(temp, "\0");
strcpy(PC[newlines], temp);
i++;
strcpy(temp, "\0");
goto this;
}
else if(note[i] == EOF)
{
break;
}
else if(note[i] == "\n")
{
newlines++;
i2=0;
strcpy(temp, "\0");
comma=0;
i++;
goto this;
}
else{
temp[i2] = note[i];
i++;
i2++;
}
}
else if(comma == 11)
{
if(note[i] == ",")
{
comma++;
i2=0;
strcat(temp, "\0");
strcpy(CPP[newlines], temp);
i++;
strcpy(temp, "\0");
goto this;
}
else if(note[i] == EOF)
{
break;
}
else if(note[i] == "\n")
{
newlines++;
i2=0;
strcpy(temp, "\0");
comma=0;
i++;
goto this;
}
else{
temp[i2] = note[i];
i++;
i2++;
}
}
else if(comma == 11)
{
if(note[i]==",")
{
comma++;
i2=0;
strcat(temp,"\0");
strcpy(HTML[newlines], temp);
i++;
strcpy(temp, "\0");
goto this;
}
else if(note[i] == EOF)
{
break;
}
else if(note[i] == "\n")
{
newlines++;
i2=0;
strcpy(temp, "\0");
comma=0;
i++;
goto this;
}
else{
temp[i2] = note[i];
i++;
i2++;
}
}
else if(comma==12)
{
if(note[i] == ",")
{
comma++;
i2=0;
strcat(temp, "\0");
strcpy(NET[newlines], temp);
i++;
strcpy(temp, "\0");
goto this;
}
else if(note[i] == EOF)
{
break;
}
else if(note[i] == "\n")
{
newlines++;
i2=0;
strcpy(temp, "\0");
comma=0;
i++;
goto this;
}
else{
temp[i2] = note[i];
i++;
i2++;
}
}
else if(comma==13)
{
if(note[i] == ",")
{
comma++;
i2=0;
strcat(temp,"\0");
strcpy(TE[newlines], temp);
i++;
strcpy(temp, "\0");
goto this;
}
else if(note[i] == EOF)
{
break;
}
else if(note[i] == "\n")
{
i2=0;
newlines++;
strcpy(temp, "\0");
comma=0;
i++;
goto this;
}
else{
temp[i2] = note[i];
i++;
i2++;
}
}
else if(comma==14)
{
if(note[i] == ",")
{
comma++;
i2=0;
strcat(temp,"\0");
strcpy(TT[newlines], temp);
i++;
strcpy(temp,"\0");
goto this;
}
else if(note[i] == EOF)
{
break;
}
else if(note[i] == "\n")
{
newlines++;
i2=0;
strcpy(temp, "\0");
comma=0;
i++;
goto this;
}
else{
temp[i2] = note[i];
i++;
i2++;
}
}
else if(comma==15)
{
if(note[i] == ",")
{
comma++;
i2=0;
strcat(temp,"\0");
strcpy(tott[newlines], temp);
i++;
strcpy(temp,"\0");
goto this;
}
else if(note[i] == EOF)
{
break;
}
else if(note[i] == "\n")
{
newlines++;
i2=0;
strcpy(temp, "\0");
comma=0;
i++;
goto this;
}
else{
temp[i2] = note[i];
i++;
i2++;
}
}
}
printf("%s", namee[0]);
EnableWindow(hwndEdit15, FALSE);
EnableWindow(hwndEdit16, FALSE);
EnableWindow(hwndEdit17, FALSE);
g_hbmBall = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BITMAP1));
}
break;
case WM_CLOSE:
DeleteObject(g_hbmBall);
DestroyWindow(hwnd);
break;
case WM_COMMAND:
{
if(LOWORD(wParam) == 37){
HANDLE rDoIt;
rDoIt = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)DoIt,0,0,NULL);
}
}
break;
case WM_DESTROY:
{
DeleteObject(g_hbmBall);
PostQuitMessage(0);
}
break;
case WM_CTLCOLORSTATIC:
{
SetBkMode((HDC)wParam, TRANSPARENT);
return GetStockObject(NULL_BRUSH);
}
case WM_PAINT:
{
BITMAP bm;
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hbmOld = SelectObject(hdcMem, g_hbmBall);
GetObject(g_hbmBall, sizeof(bm), &bm);
BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
SelectObject(hdcMem, hbmOld);
DeleteDC(hdcMem);
EndPaint(hwnd, &ps);
}
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX wc;
HWND hwnd;
MSG Msg;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
wc.lpszMenuName = NULL;
wc.lpszClassName = g_szClassName;
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
if(!RegisterClassEx(&wc))
{
MessageBox(NULL, "Window Registration Failed!", "Error!",
MB_ICONEXCLAMATION | MB_OK);
return 0;
}
hwnd = CreateWindow( wc.lpszClassName, "Grade Optimiser - Mouhammed",
WS_VISIBLE | WS_CAPTION | WS_SYSMENU,
CW_USEDEFAULT, CW_USEDEFAULT, 1000, 550, NULL,NULL, hInstance, 0);
if(hwnd == NULL)
{
MessageBox(NULL, "Window Creation Failed!", "Error!",
MB_ICONEXCLAMATION | MB_OK);
return 0;
}
ShowWindow(hwnd, 1);
UpdateWindow(hwnd);
while(GetMessage(&Msg, NULL, 0, 0) > 0)
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
}