No matter how many functions i put before WinMain(), they wont be executed, even if theyre named main(). The only thing i can do is leave them there and call them after WinMain().
Am i right to think this way? Does it means that it probably is more logical to put the functions after WinMain() in a natural order?
For example, if i want to check for the existance of a file, try to read its values, and set my mainwindow controls with this values, i was thinking of a function like that:
int getdata() {
FILE *dataFile;
/*Some vars declared here*/
if((dataFile=fopen("data.txt", "rw"))==NULL) {
/* Do error stuff */
return 1;
}
else {
/*Read the file, and get the stuff to the vars*/
return 0;
}
Using the example C code everybody has at %devcppdir%\templates\WinApp_C.txt, where would i paste my function?
Any help would be great guys, im having a hard time here.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Intercept the WM_CREATEWINDOW message and put your startup code there. Or, if it is a dialog, intercept the WM_INITDIALOG message and do the same. L8tr.
Kip
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
A quick question on C programming for Win32:
No matter how many functions i put before WinMain(), they wont be executed, even if theyre named main(). The only thing i can do is leave them there and call them after WinMain().
Am i right to think this way? Does it means that it probably is more logical to put the functions after WinMain() in a natural order?
For example, if i want to check for the existance of a file, try to read its values, and set my mainwindow controls with this values, i was thinking of a function like that:
int getdata() {
FILE *dataFile;
/*Some vars declared here*/
if((dataFile=fopen("data.txt", "rw"))==NULL) {
/* Do error stuff */
return 1;
}
else {
/*Read the file, and get the stuff to the vars*/
return 0;
}
Using the example C code everybody has at %devcppdir%\templates\WinApp_C.txt, where would i paste my function?
Any help would be great guys, im having a hard time here.
Hi,
Intercept the WM_CREATEWINDOW message and put your startup code there. Or, if it is a dialog, intercept the WM_INITDIALOG message and do the same. L8tr.
Kip