Here is another example using Pelle's C run-time DLL pocrt.dll
#define WIN32_LEAN_AND_MEAN
#define IDC_EDIT 4001
#include <stdio.h>
#include <windows.h>
HINSTANCE hInstance;
FILE *file;
char buffer[75];
char k;
char i=0;
BOOL CALLBACK DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_CLOSE:
EndDialog(hwnd,0);
break;
case WM_INITDIALOG:
file=fopen("Text.txt","r");
while ( k=fgetc(file)) {
if (k==EOF) {
buffer[i]=0;
break;
}
if (k==10) {
buffer[i]=13;
++i;
}
buffer[i]=k;
++i;
}
fclose(file);
SetDlgItemText(hwnd,(int)IDC_EDIT,buffer);
break;
default:
return FALSE;
}
return TRUE;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow)
{
LPCTSTR DlgName="MyDialog";
hInstance=GetModuleHandle(0);
return(DialogBoxParam(hInstance,DlgName,0,DlgProc,0));
}
[/code]