|
Assume an age of 0. In that case we have:
floor((0.0-28)/2)*.1
which equals floor(-28.0/2)*.1
which equals -14.0*.1
which equals -1.4
I think perhaps an additional check that the age is greater than 28 is needed.
Steve
|
|
|
|
|
Thanks for the help - works great now!!!
|
|
|
|
|
Hello.
Is there a way to read the (stdout) output from another application directly into a CString? ie) when I specify my application in a series of piped command-line apps, what is the best way to read from stdin, so that I can read data directly into a CString rather than have to worry about the length of the lines of input data?
Thanks in advance.
James.
|
|
|
|
|
I do not know if you can do that using stdin without using a intermediate buffer of some kind.
You can always continue to read stdin in chunks, like reading it into a 1KB buffer and appending the buffer to the CString , until you hit the end of the output data (EOF).
There may be a way to do it using the C++ stream classes and std::string , but I am not certain if you will not still have to use some intermediate transfer mechanism.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Thanks for the reply.
I have ended up using a 'string' class object to read into from cin and getting a const char pointer to it, so that I can get the data into a CString. What a mess, but it works.
Thanks.
James.
|
|
|
|
|
I've created an MDI application where when I open one dialog it shows a bitmap from my C:/ by:
<br />
void Image::showPicture(BYTE bfr[], DWORD size)<br />
{<br />
HBITMAP m_bitmap = NULL;<br />
CImage image;<br />
CJpeg2kDecoder imDec;<br />
<br />
image = imDec.Open(bfr, size);<br />
m_bitmap = (HBITMAP)image;<br />
m_nCam1img.SetBitmap(m_bitmap);<br />
if (m_bitmap) DeleteObject(m_bitmap);<br />
However, when I open another dialog to do commanding (this dialog will partially cover the bitmap dialog) then go back to view my bitmap the portion of the bitmap dialog covered up by the commanding dialog is GONE!
What do i need to do so that when I go back to view the bitmap dialog that the whole picture will still be displayed?
Thanks!
Kitty5
|
|
|
|
|
What is m_nCam1img ? You're deleting the bitmap, why, when it's in use ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
m_nCam1img is the variable for the picture control.
the if (m_bitmap) DeleteObject(m_bitmap);
I thought that that was what you needed to do. I did some research on how to view bmps and all the sample code had that....
Kitty5
|
|
|
|
|
Try removing it. You do need to call it, but after you're not using the bitmap anymore. I don't think a picture control makes a copy.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
What happens if you delete this line if (m_bitmap) DeleteObject(m_bitmap);
|
|
|
|
|
ok so I deleted the line:
if (m_bitmap) DeleteObject(m_bitmap);
but i still have the same problem.
is there an update function for the window when the mouse clicks back to view the picture dialog box after the command dialog box was on top of it?
Kitty5
|
|
|
|
|
Your CImage object goes out of scope at the end of the function so it probably destroys the
HBITMAP via its destructor.
Instead of
m_bitmap = (HBITMAP)image;
try
m_bitmap = image.Detach();
and remove this line:
if (m_bitmap) DeleteObject(m_bitmap);
Mark
|
|
|
|
|
I'm try to put a together a dialog box so that when a user makes a choice in the first groupbox between 2 radio buttons, one of the two other group boxes ghosts out and the user finishes the form, and then clicks "OK". The question is- can anyone tell me how to "ghost out" or "gray out" the group boxes? I've figured out a way to do this with CEdit text boxes (SetReadOnly()) but I can't find a method for group boxes (or if they even have a class devoted to them). I'd appreciate any help. Here is a screen shot of what I am working on:
http://img.photobucket.com/albums/v50/blackdwarf/timesearch.jpg[^]
|
|
|
|
|
Use EnableWindow(FALSE) instead of SetReadOnly() to gray-out controls
Mark
|
|
|
|
|
By the way, group boxes are buttons with the BS_GROUPBOX style. Usually they stay static while
controls "grouped" within them may be disabled (grayed) or enabled.
Mark
|
|
|
|
|
Sorry, got interrupted and answered abruptly before.
CoffeeAddict19 wrote: The question is- can anyone tell me how to "ghost out" or "gray out" the group boxes?
MFC:
GetDlgItem(ID_MYGROUPBOX)->EnableWindow(FALSE);
Non MFC:
::EnableWindow(::GetDlgItem(hwndDlg, ID_MYGROUPBOX), FALSE);
|
|
|
|
|
Thanks! I'll get back to you and let you know if it works.
|
|
|
|
|
Hola friends,
I'm working with a Dialog Box that has a rectangle associated with it so that I may draw in it. However, I am interested in adding regions to the rectangle, which I don't seem to have too much trouble doing. However, once I add my regions (three) all of the code within my WM_PAINT message seems to be constricted to drawing within the last region.
Does anyone know what happens to the DC when I create a region, and does anybody have any suggestions on how I might be able to change it back to the entire rectangle, like it was originally set?
Thanks,
Joe
|
|
|
|
|
Show some code. I suspect you need to use the CombineRgn function with RGN_OR set in fnCombineMode to make a combined region and then select that into the DC.
Steve
|
|
|
|
|
I agree with Steve I think you need to CombineRgn
|
|
|
|
|
I'd like to use AVICap to capture and record video from webcam
but I also wish to have control over contrast, brightness ...
I can call capDlgVideoSource and change it, but is there any possibility
to save these options and recall it. Something like save few most use options and recall it just by pressing some button.
Thank you
viliam
|
|
|
|
|
That dialog is provided by the VCAP driver so there's no (that I know of) common API to get the
settings.
Many/most drivers save the settings between use and many provide a "factory Default"
button/setting.
Mark
|
|
|
|
|
Hello,
I was just wondering if it is possible to add some extra options to an existing commercial software?
If the answer is YES, then what are the steps needs to be taken and what it the route for achieving this task?
Thank you for you time and have a great day.
Khoramdin
-- modified at 15:08 Wednesday 31st January, 2007
|
|
|
|
|
|
Hello Christian,
Thanx for the info. Your reply to my question was "sometimes". Maybe I ask what is the factor which create the uncertainty?
Do we know in advance what 3rd party application can be hook or we just have to try and see?
Thanx for helpping out and have a great day.
Khoramdin
|
|
|
|