a couple o' easy questions 
Author Message
 a couple o' easy questions

Hi all, how ya doing? :)

I have some easy questions to answer.

please help.

1.)

CFile myFile("test.fil", CFile::modeCreate | CFile::modeWrite);
for(i = 0; i < 15; i++)
  {
      CString temp = "df";
      temp += "\n";
      myFile.Write(temp, temp.GetLength());

Quote:
}

unfortunatelly "\n" doesn't do it's job well. What should be here instead?

2.)

how exactly can I receive messages from my modeless dialog in my parent's
message map? I heard of PreTranslateMessage, but don't know how to use it.

3.)  Where is std::ios::nocreate. My compiler reports unknown identifier.
(VC++ 6.0)

4.)
I want to set bModified flag everytime someone changes contents of one of
CEdit controls on my Dialog. what message do I have to handle?

bye



Thu, 18 Mar 2004 06:17:50 GMT  
 a couple o' easy questions


Quote:
>Hi all, how ya doing? :)

>I have some easy questions to answer.

>please help.

>1.)

>CFile myFile("test.fil", CFile::modeCreate | CFile::modeWrite);
>for(i = 0; i < 15; i++)
>  {
>      CString temp = "df";
>      temp += "\n";
>      myFile.Write(temp, temp.GetLength());
>}

>unfortunatelly "\n" doesn't do it's job well. What should be here instead?

You don't say what you *want* it to do, but you might try "\r\n"
instead.

Quote:
>2.)

>how exactly can I receive messages from my modeless dialog in my parent's
>message map? I heard of PreTranslateMessage, but don't know how to use it.

My inclination would be to handle them in the dialog itself, and
perhaps send user-defined messages on to the parent when necessary.
The documentation, however, states that messages are sent to the
parent when the dialog doesn't handle them, so you really shouldn't
need to do anything.

Quote:
>3.)  Where is std::ios::nocreate. My compiler reports unknown identifier.
>(VC++ 6.0)

It sounds as if you're not including the header, which is, if I
remember correctly, <iostream>.

Quote:
>4.)
>I want to set bModified flag everytime someone changes contents of one of
>CEdit controls on my Dialog. what message do I have to handle?

EN_CHANGE. This is sent as a WM_COMMAND message, but the ClassWizard
will handle creating and calling an OnChange member function to handle
it

Pete Barrett



Thu, 18 Mar 2004 17:23:30 GMT  
 a couple o' easy questions


Quote:


> >Hi all, how ya doing? :)

> >I have some easy questions to answer.

> >please help.

> >1.)

> >CFile myFile("test.fil", CFile::modeCreate | CFile::modeWrite);
> >for(i = 0; i < 15; i++)
> >  {
> >      CString temp = "df";
> >      temp += "\n";
> >      myFile.Write(temp, temp.GetLength());
> >}

> >unfortunatelly "\n" doesn't do it's job well. What should be here
instead?

> You don't say what you *want* it to do, but you might try "\r\n"
> instead.

Yes, I was looking for that. thanx

Quote:
> >2.)

> >how exactly can I receive messages from my modeless dialog in my parent's
> >message map? I heard of PreTranslateMessage, but don't know how to use
it.

> My inclination would be to handle them in the dialog itself, and
> perhaps send user-defined messages on to the parent when necessary.
> The documentation, however, states that messages are sent to the
> parent when the dialog doesn't handle them, so you really shouldn't
> need to do anything.

Hmm I supposed the same but then my dialog's parent didn't receive messages.
I guess I did something wrong. If I cannot force it to work this way, I'll
do it your way and send user defined messages.

Quote:
> >3.)  Where is std::ios::nocreate. My compiler reports unknown identifier.
> >(VC++ 6.0)

> It sounds as if you're not including the header, which is, if I
> remember correctly, <iostream>.

I included this, other ios members DO work eg. std::ios::good. But no
std::ios::nocreate. you can try it yourself.

Quote:
> >4.)
> >I want to set bModified flag everytime someone changes contents of one of
> >CEdit controls on my Dialog. what message do I have to handle?

> EN_CHANGE. This is sent as a WM_COMMAND message, but the ClassWizard
> will handle creating and calling an OnChange member function to handle
> it

I have yet to try that. thanx for info on EN_CHANGE

- Show quoted text -

Quote:
> Pete Barrett



Thu, 18 Mar 2004 21:02:38 GMT  
 a couple o' easy questions

Quote:
> > >3.)  Where is std::ios::nocreate. My compiler reports unknown
identifier.
> > >(VC++ 6.0)

> > It sounds as if you're not including the header, which is, if I
> > remember correctly, <iostream>.

> I included this, other ios members DO work eg. std::ios::good. But no
> std::ios::nocreate. you can try it yourself.

It is in the old-style, now deprecated <iostream.h> header (no std::
namespace for that one). New-style <iostream> header doesn't define nocreate
flag. If you want a nocreate behavior with new style streams, open the file
with in | out flags.
--
With best wishes,
    Igor Tandetnik


Mon, 22 Mar 2004 05:54:18 GMT  
 a couple o' easy questions

Quote:

> It is in the old-style, now deprecated <iostream.h> header (no std::
> namespace for that one).

It's not EVEN deprecated.  As far as the standard is concerned iostream.h
does not exist.  (The deprecated features are required to be there but may
be revised out of future standards).


Mon, 22 Mar 2004 21:29:07 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. A couple of easy questions

2. This is a biztalk question but probably an easy question for you C# guru's

3. Real Fast 'n' Easy Question --

4. I'm a newbie but easy question

5. Here's an easy question, having to do with the CRecordSet Class

6. beinner's (hopefully) easy question

7. Beginner's COM question (easy)

8. Beginner's COM question (easy)

9. Easy Question I'm sure...I need help

10. couple questions - make directory & Format questions

11. A couple CTreeCtrl questions and a CComboBox question

12. @> two easy easy questions

 

 
Powered by phpBB® Forum Software