[comp.windows.ms.programmer] HELP with Windows questions

GANGFANG@cc.utah.edu (04/21/91)

Hi netters!
    I have some Windows questions need to be helped with.
    1. The 'wsprintf' function doesn't support floating point data, whatelse
can be used to print a float type data into a string?
    2. The EDIT controls don't seem to be able to handle more than 64k text
data directly, how can one use edit control to handle a large file?
    3. Is there any way to switch between different resolutions and color modes
dynamically? For example, I need the 640x480x256 mode to display medical images
but usually the 256 color drivers are too slow to be used comfortablly    to
develop programs, a 800x600x16 driver is better for that. So, it will be more
convenient if one can change the display mode dynamically.
    Any help will be greatly appreciated.

ebergman@isis.cs.du.edu (Eric Bergman-Terrell) (04/22/91)

I'll try to answer question #1 - since wsprintf doesn't do floating point,
use the sprintf that came with your compiler - unless you have BC++ 2.0
which has a bug in sprintf for floating point numbers.

If you have BC++ 2.0 consider writing your own floating point to ascii
conversion (that's what I had to do).

Note this is not a flame - if that's the only serious problem with BC++ 2.0
I'll still be happy.  The bug shows up as follows:

sprintf(str, "%f", (float) 24 / 27);

which places "1.0" into str rather than "0.88888".

Please don't call Borland - I already called it in.  I have a floating
point to ascii conversion routine which I'll post under coercion...


Terrell

ferdie@coyote.datalog.com (fred jarvis) (04/22/91)

GANGFANG@cc.utah.edu writes:

> Hi netters!
>     I have some Windows questions need to be helped with.
>     1. The 'wsprintf' function doesn't support floating point data, whatelse
> can be used to print a float type data into a string?
> ...
    sprintf is still available, which supports floating point data, by
including <stdio.h>; however, this will increase the size of your .EXE

     Fred Jarvis 

lwallace@javelin.sim.es.com (Raptor) (04/23/91)

ferdie@coyote.datalog.com (fred jarvis) writes:
>GANGFANG@cc.utah.edu writes:
>>     1. The 'wsprintf' function doesn't support floating point data, whatelse
>> can be used to print a float type data into a string?
>    sprintf is still available, which supports floating point data, by
>including <stdio.h>; however, this will increase the size of your .EXE

Beware the near/far pointer and stack/data segment confusion problems, which,
though I don't yet completely grok them, have bitten me.  This is why Windows
has replaced some of the C RTL functions.
-- 
            Lynn Wallace           |           I do not represent E&S.
Evans and Sutherland Computer Corp.|   Internet: lwallace@javelin.sim.es.com
      Salt Lake City, UT 84108     |           Compu$erve:  70242,101
	      Revenge is a dish best not served at all.

bonneau@hyper.hyper.com (Paul Bonneau) (04/24/91)

In article <113517@cc.utah.edu> GANGFANG@cc.utah.edu writes:
>    2. The EDIT controls don't seem to be able to handle more than 64k text
>data directly, how can one use edit control to handle a large file?
>
Unfortunately, you are hitting the bad old 64k segment limit.
As far as I know, this is an implementation limit of the edit
control itself.  So unless you can find a third party edit
control without this limitation you will have to write one
yourself (not a trivial task).

Sorry - Paul Bonneau.