Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!elroy.jpl.nasa.gov!sdd.hp.com!caen!news.cs.indiana.edu!ux1.cso.uiuc.edu!usenet From: tmkk@uiuc.edu (Scott Coleman) Newsgroups: comp.windows.ms.programmer Subject: Re: SetDlgItemText() w/ BC++ 2.0 Message-ID: <1991Mar4.200940.27679@ux1.cso.uiuc.edu> Date: 4 Mar 91 07:36:05 GMT References: <1991Mar4.073605.586@isis.cs.du.edu> Sender: usenet@ux1.cso.uiuc.edu (News) Organization: University of Illinois at Urbana Lines: 39 In article <1991Mar4.073605.586@isis.cs.du.edu> ebergman@isis.cs.du.edu (Eric Bergman-Terrell) writes: > >Is there a bug with SetDlgItemText() in Borland C++ 2.0? > >I can use SetDlgItemInt() on a dialog box field with no problem. >When I try to use SetDlgItemText() on the same field, I can't make >it work - it places a "%d" in the specified field, rather than the >(literal) string that I pass the fcn. > >Any ideas? I ran across a nearly identical problem with BC++ 2.0. I was attempting to use SetDlgItemText() with the second parameter a literal string, e.g. SetDlgItemText(hwnd, "Something"); I kept getting either a blank control, a %d, or a '- [%s]' in the item. My solution? I CHANGED THE FILE EXTENSION FROM .CPP to .C, AND NOW THE PROGRAM WORKS!?!?!?!?!?!?! Since I'm relatively new to C++, I thought it might be attributable to some subtle difference in the languages, and temporarily dismissed it. Seeing your message, however, makes me start to wonder... Some more tidbits of info on this problem: calls such as SetDlgItemText(hwnd, strupr(ltoa(0L, szBuffer, 16))); where szBuffer is declared as char szBuffer[20]; work fine, even in .CPP mode. If I try to send it a literal string, or if I try to send it szBuffer directly after putting some characters into it, SetDlgItemText pukes. Anyone else stumble across this one? What's the deal??