|
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
|
|
|
|
|
Hi,
I am trying to create a single-linked list class using templates.
#ifndef CSLLIST_H_
#define CSLLIST_H_
/// HEADER FILE INCLUDES //////////////////////////////////////////////////////
#include "CSLNode.h"
/// CLASS DECLARATIONS ////////////////////////////////////////////////////////
template <class t="">
class CSLList
{
private:
CSLNode<t>* pHead;
CSLNode<t>* pTail;
public:
CSLList();
~CSLList();
bool AddDataToHead(T* pNewData);
bool AddDataToTail(T* pNewData);
bool DeleteDataFromHead(T* pDeletedData);
bool DeleteDataFromTail(T* pDeletedData);
bool IsListEmpty();
bool IsNodeInList(T* pDataToFind);
void PrintListContents();
};
#endif
When I try using the list in main using
CSLList<int> oTempList;
everything compiles but the linker fails with the following errors:
Main.obj : error LNK2001: unresolved external symbol "public: __thiscall CSLList<int>::~CSLList<int>(void)" (??1?$CSLList@H@@QAE@XZ)
Main.obj : error LNK2001: unresolved external symbol "public: __thiscall CSLList<int>::CSLList<int>(void)" (??0?$CSLList@H@@QAE@XZ)
Any ideas on what I am missing? Thanks.
|
|
|
|
|
do you have a function body for your constructor and destructor that it's getting the error on? If so, do they match? If not try this, adding a body to your constructor and destructor:
CSLList(){};
~CSLList(){};
If it's broken, I probably did it
bdiamond
|
|
|
|
|
the constructor and destructor (and all other declared methods) are implemented.
template <class T>
CSLList<T>::CSLList()
{
pHead = pTail = NULL;
}
template <class T>
CSLList<T>::~CSLList()
{
CSLNode<T>* oTmpNode;
while (pHead != NULL)
{
oTmpNode = pHead->GetNextNode();
delete pHead;
pHead = oTmpNode;
}
}
|
|
|
|
|
|
|
Hi there.
The issue I am facing is pretty different for me. Let me explain this with an example, whenever we install my application, a button was created in Internet explorer toolbar. This button is used to activate the Dialog box where I have created some controls. Now, I want to have the same sort of button on MSN Messenger, so that I can activate/invoke the same Dialog box I am using with Internet Explorer.
So, my main problem is to have a button on MSN Messenger screen and then linking that button with the code I want to call.
Thanks and Regards,
Pankaj Bhalla
pankajbhalla@mantraonline.com
|
|
|
|