|
Hi Roger.
'bool', 'true' and 'false' are all C++ keywords. By definition 'true' has the value '1' when converted to an integer and 'false' becomes 0 so most things work as expected.
I once worked on some old style C code where hidden in a header file was,
#define TRUE 0
#define FALSE 1
which explained a lot once I'd found it...
Paul
|
|
|
|
|
I knew it had to be there somewhere; I can't imagine a language that doesn't have a logical data type. But in the references I have, bool (or an equivalent) isn't listed. Oh well, my int suggestion at least conforms to the concept (though logically, from a hardware guy's POV, true=1).
Will Build Nuclear Missile For Food - No Target Too Small
|
|
|
|
|
Paul Ranson wrote:
old style C code
#include <stdio.h>
enum boolean { false, true };
typedef enum boolean bool;
bool Foo(bool val) {
return (!val);
}
int main(void)
{
if(Foo(false))
printf("False expected.\n");
else
printf("True expected.\n");
return 0;
}
Maxwell Chen
|
|
|
|
|
hi
i need to save one mfc application from another mfc application.
can anyone guide me into doing this.
thanks in advance.
|
|
|
|
|
archanagaby wrote:
can anyone guide me into doing this.
Possibly, assuming I understood your question better. What you have presented thus far (i.e., save one application from another application) does not make much sense.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
if i have CString a="a;b;c;d;f" and i want to split it to CString array.
how can i do it on VC++ NET ?
|
|
|
|
|
If you're using MFC7, have a look at CString::Tokenize() function. Otherwise look at the api function strtok()
Or have a look at
http://www.codeproject.com/string/stdstring.asp
|
|
|
|
|
MFC4 has AfxExtractSubString, which should do a lot of what you want.
Steve S
|
|
|
|
|
|
1. How is this a question ?
2. So now Java has templates, they have an STL - what does that prove, except that the STL was a good idea ?
3. What is there to prove ? Any language that takes nothing from any prior languages will either be a disaster, or a revolution. Java is neither....
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
This goes in the lounge.
MSN Messenger.
prakashnadar@msn.com
Tip of the day of visual C++ IDE.
"We use it before you do! Visual C++ was developed using Visual C++"
|
|
|
|
|
JSTL really has nothing to do with C++ STL. It is a tag library for JSP (Java Server Pages).
BTW Java is getting generics (just like C#), not templates in version 1.5.
|
|
|
|
|
Yes, I think people saw the title and neglected to even skim over the article. Even a cursory glance would have made it quite obvious that JSTL is completely different from the C++ STL.
|
|
|
|
|
hi guys sorry for bothering u all again... I noticed that OnSize was called before OnCreate? In my OnCreate,
<br />
OnCreate function<br />
<br />
mSomething.Create(...);<br />
mSomething.ShowWindow(...);<br />
<br />
OnSize function<br />
<br />
mSomething.MoveWindow(...);<br />
and when it runs, an assertion is thrown BUT...
if i do it this way:
<br />
OnSize function<br />
<br />
if(mSomething.m_pHwnd)<br />
mSomething.MoveWindow(...);<br />
it works well... perfectly. So does this means that OnSize is fired before OnCreate? Freaky...
|
|
|
|
|
soggie wrote:
So does this means that OnSize is fired before OnCreate? Freaky...
How do you work that out ? Between OnCreate and OnSize, the window is created, hence in OnSize you don't get an ASSERT because the window you're trying to move exists.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Onsize event is for the frame/view window that has been already created.
Its ur own created window is failing.
MSN Messenger.
prakashnadar@msn.com
Tip of the day of visual C++ IDE.
"We use it before you do! Visual C++ was developed using Visual C++"
|
|
|
|
|
Has anyone seen anything like this before?
http://www.sagara.org/menu.gif[^]
Notice the File menu (left-most). Those garbled characters are supposed to be Japanese characters. Everything in the File menu is garbled, just like that. However, everything else on the rest of the menu renders just fine. In fact, throughout the whole rest of the UI, Japanese text renders perfectly. It's just in the File menu that it doesn't work correctly. The really annoying thing is that the Japanese characters show up correctly in the resource editor.
I had the translator re-type in the text and re-saved the file, but that didn't work.
I tried pasting in the text from the Edit menu, but that didn't work, either.
I'm stumped. Any help would be appreciated.
Thanks!
(BTW, the program is written with VC6, using MFC. It runs on Windows 2000+.)
[edit]
This seems to be a positional thing. I edited the resource file so that the Edit menu came before the File menu and then recompiled. This caused the Edit menu (now the left-most menu) to be garbled, while the File menu rendered correctly.
Does this ring any bells?
[/edit]
|
|
|
|
|
I have a static text label in a straight-Win32 app I'm working on, and I'm wanting the cursor to change to a hand icon when the mouse moves over it (and back to normal when the mouse moves away). What's the best way to do that? It appears that it's possible using RegisterWndEx, but then I have to code a text control myself; there has to be a simpler way.
|
|
|
|
|
I don't know if this would be simple enough for you, but the standard way of creating 'hyperlinking' controls is :
define your own CMyStatic : public CStatic .
Now override OnNcHitTest and return HTCLIENT , this will cause windows to ask you for a cursor, otherwise it won't, e.g.:
<br />
UINT CMyStatic::OnNcHitTest(CPoint point)<br />
{<br />
return HTCLIENT;<br />
}<br />
Now override OnSetCursor and set your hand icon within it, e.g.:
<br />
BOOL CMyStatic::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)<br />
{<br />
::SetCursor(LoadCursor(NULL, IDC_HAND));<br />
return TRUE;<br />
}<br />
That's it.
|
|
|
|
|
Thanks, that worked; I didn't even need to implement the NCHITTEST message in my WndMainProc .
|
|
|
|
|
i just copmiled those lines
<br />
......<br />
CClientDC dc(this);<br />
OnPrepareDC(&dc);<br />
dc.SetPixel( point, RGB(0, 0, 0,) );<br />
......<br />
what i've got is:
---------------------- Done ----------------------
Build: 1 succeeded, 0 failed, 0 skipped
but this line contains more commaz that it needs:
dc.SetPixel( point, RGB(0, 0, 0,) );
and it works any way
do someone know why?
|
|
|
|
|
Does it run successfully in Release/Debug?
Regards,
Axe
|
|
|
|
|
RGB is a macro, so you should see what it expands to in order to see what is going on here.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
COLORREF SetPixel( int x, int y, COLORREF crColor );
COLORREF SetPixel( POINT point, COLORREF crColor );
these are the two overloaded functions of SetPixel. So your function call fits the second case and so it will work.
MSN Messenger.
prakashnadar@msn.com
Tip of the day of visual C++ IDE.
"We use it before you do! Visual C++ was developed using Visual C++"
|
|
|
|
|
I think (I'm not sure ) that the compiler will ignore everything that doesn't fit int the macro definition. So for example you can put everything you want after the last zero (if separated by a comma of course, otherwise it will be detected as a single 'variable').
So for example: this will compile:
dc.SetPixel( point, RGB(0, 0, 0, UnknowVariable) );
even if UnknowVariable is not declared.
In fact, a macro is just a way to tell the compiler to replace a portion of text by another text just before the compilation...
Hope this helps
|
|
|
|