Please help me!
It is so: I'm just reading the tutorial on but I have a problem with writing text into a window. Just look at the source:
Now I get a window with the following text:
"Hallo, dies ist der Text.3nhll" When I make the program redraw, the "3nhll" shortens to ")". What the?? And how to make the Prog write the text properly?
It is so: I'm just reading the tutorial on but I have a problem with writing text into a window. Just look at the source:
Code:
[ignore]{$DEFINE STRICT}
program ausgabetest;
uses windows;
const
szAppName='Textausgabe im Anwendungsbereich';
var
hwind:hwnd;
mesg:msg;
wc:wndclass;
v:variant;
function wndproc(hwind:hwnd; message:uint; wordparam: wparam; longparam:lparam):lresult; stdcall;
var
ps:paintstruct;
hdevc:hdc;
sztext:shortstring;
hstr:shortstring;
begin
case message of
wm_paint: begin
szText:='Hallo, dies ist der Text.';
@hstr:=@szText[25]+1;
hstr:=' ';
hdevc:= beginPaint(hwind, ps);
begin
textout(hdevc, 50, 50, @szText+1, ord(sztext[0])-5);
end;
endpaint(hwind, ps);
exit(0);
end;
wm_destroy: begin
postquitmessage(0);
exit(0);
end;
end;
exit (defwindowproc(hwind,message,wordparam,longparam));
end;
begin
wc.style := cs_hredraw + cs_vredraw;
wc.lpfnwndproc := @wndproc;
wc.cbclsextra := 0;
wc.cbwndextra := 0;
wc.hinstance := hinstance;
wc.hcursor := loadcursor(0, IDC_ARROW);
wc.hIcon := loadicon(0, IDI_APPLICATION);
wc.hbrbackground := getstockobject(white_brush);
wc.lpszclassname := szAppName;
wc.lpszMenuName := nil;
registerclass (wc);
v:= cw_usedefault;
hwind := createwindow( szAppName,
'Titelleiste',
ws_overlappedwindow,
v,
v,
v,
v,
0,
0,
hinstance,
nil);
showwindow (hwind, sw_show);
updatewindow(hwind);
while getmessage(mesg, 0, 0, 0) do begin
translatemessage(mesg);
dispatchmessage(mesg);
end;
halt(mesg.wparam);
end.[/ignore]
"Hallo, dies ist der Text.3nhll" When I make the program redraw, the "3nhll" shortens to ")". What the?? And how to make the Prog write the text properly?