Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!ukma!psuvax1!psuvm!f0o From: F0O@psuvm.psu.edu Newsgroups: comp.lang.pascal Subject: Problem with the WVSPrintF function Message-ID: <91156.113452F0O@psuvm.psu.edu> Date: 5 Jun 91 15:34:52 GMT Organization: Penn State University Lines: 42 Hi netters! I'm new to Windows programming and I was trying to modify the STEP3.PAS example program that comes with TPW. I was changing the WMLButtonDown method. The original routine looks like this: Procedure TMyWindow.WMLButtonDown(Var Msg:TMessage); VAR DC: HDC; S: array[0..9] of char; BEGIN WVSPrintF(S, '(%d,%d)', Msg.LParam); DC := GetDC(HWindow); TextOut(DC, Msg.LParamLo, Msg.LParamHi, S, StrLen(S)); ReleaseDC(HWindow, DC); END; This of course works fine, but I modified the code in the following way so I could print some text instead of a number: Procedure TMyWindow.WMLButtonDown(Var TextString: PChar); VAR DC: HDC; S: PChar; BEGIN WVSPrintF(S, '%s', TextString); DC := GetDC(HWindow); TextOut(DC, Msg.LParamLo, Msg.LParamHi, S, StrLen(S)); ReleaseDC(HWindow, DC); END; When Windows hits the WVSPrintF statement, I get a UAE. By running in the debugger, the UAE is reported as exception code 13, a memory addressing error. The problem must be that I'm not using PChar correctly, although the on-line help states all parameters of WVSPrintF are of type PChar and the manual shows examples of where you can put a text string into a variable of type PChar. If someone can tell me what I'm doing wrong, I'd greatly appreciate it! [Tim]