|
Try
wcout << L"Hello world";
|
|
|
|
|
Aaaaahhhhhh... there's a wcout! It's funny, because the AppWizard (at least in VC6) generates this for a default console app:
cerr << _T("Fatal Error: MFC initialization failed") << endl;
which if compiled with UNICODE, would print out the address of the string.
I guess I'll have to do something like
<br />
#ifdef UNICODE<br />
#define _tcout wcout<br />
#else<br />
#define _tcout cout<br />
#endif<br />
in order to have some kind of "tchar-ish" macro, 'cause I can't find one already defined.
|
|
|
|
|
The tcout thing is exactly what I did, and it works like a charm.
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
I need help ASAP.
I have one document with two views (splitter) , left view(CView),right view(CScrollView).
This is my code:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
CRect cr;
BOOL rc;
if (!m_wndSplitter.CreateStatic(this,1,2))
{
TRACE0("Failed to create split bar ");
return FALSE; // failed to create
}
GetClientRect(&cr);
CSize paneSize(cr.Width()-200, cr.Height());
CSize paneSize1(0, cr.Height());
((CMyApp*)AfxGetApp())->m_pDoc=(CMyDoc*)(pContext->m_pCurrentDoc);
pContext->m_pCurrentFrame=this;
rc=m_wndSplitter.CreateView(0, 1,pContext->m_pNewViewClass,paneSize, pContext);
if(!rc)return FALSE;
pContext->m_pNewViewClass=RUNTIME_CLASS(CSnapShotView);
pContext->m_pCurrentDoc=((CMyApp*)AfxGetApp())->m_pDoc;
pContext->m_pCurrentFrame=this;
rc=m_wndSplitter.CreateView(0,0,pContext->m_pNewViewClass,paneSize1,pContext);
m_wndSplitter.SetSplitterGapSize(1);
m_wndSplitter.RecalcLayout();
m_wndSplitter.SetActivePane(0,1);
return rc;
}
I don't know why ,but after i added splitter my right view(CScroll view) doesn't support MouseWheel .
Plese help me !!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
Nobody knows ,or it's to simple??
|
|
|
|
|
Hiya I have now to extract all of the records from a buffer. The code I have works for the first record and then crashes..I have to extract from the buffer the 12 up to and including the carriage return.
So I would extract "12,grahamoj,34,this,\r" as the first record and so on.
This is my code:
char buffer[] = "this,is,not,needed,12,grahamoj,34,this,\ris,not,need"
"edeither,12,tony,34,this,\ris,not,needed,either,this"
"is,not,needed,12,paul,34,this,\ris,not,needed,either";
char *pStart;
char* pEnd;
char* pTemp;
pTemp = new char[100];
// search for carriage return
pEnd = buffer;
do
{
pStart = strstr(pEnd,"12,");
if( pStart )
{
pEnd = strstr( pStart,"34,");
if( pEnd )
{
pTemp = strtok( pEnd,"\r" );
}
}
strcpy( buffer,pStart );
AfxMessageBox( buffer );
}while( pTemp != NULL );
As I say it extracts the first record perfect and then crashes..
Can anyone fix this or is there a better way to extract multiple records??
Thanks.
|
|
|
|
|
This is not a problem. You have the solution, just debug it until you get it right instead of asking for help.
Kuphryn
|
|
|
|
|
Another solution to your problem is to replace all the carriage returns with nulls, then process the buffer as an array of zstrings.
*(cpBuffer + strlen(cpBuffer) + 1) = 0;
char *p = strchr(cpTheBuffer,'\r');
while (p && *p)
{
*p = 0;
p = strchr(p+1,'\r');
}
p = cpTheBuffer;
while (*p)
{
ProcessRecord(p);
p += strlen(p)+1;
}
onwards and upwards...
|
|
|
|
|
Thanks basementman, good suggestion but have to actually extract the strings and display them individually.
Any other ideas??
thanks.
|
|
|
|
|
In the ProcessRecord function described previously, you can do the same sort of logic with the comma field delimiters just as you have done with the record delimiters. As a matter of fact, you could use the same function (genericized, of course) to parse records and fields simply by parameterizing the delimiter character. You could also make it more robust by respecting the delimiters that appear in quoted strings, etc.
onwards and upwards...
|
|
|
|
|
what does 0x0a mean in this context?
if (symbol == 0x0a)
count++;
Mark J Jackson
|
|
|
|
|
|
0x0a is a hexadecimal number, the equivalent of 10 decimal.
--Mike--
"So where does that leave us? Well, it leaves us right back where we started, only more confused than before." -- Matt Gullett
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
hi every one
I am new to MFC c++. Which books i should go for?
How to learn Win32 API's?????????
pl. help
|
|
|
|
|
|
|
Your welcome
Regards,
Brian Dela
|
|
|
|
|
After you get a little familiar with MFC, definitely check out MFC Internals.
|
|
|
|
|
Hi Gang,
I was just wondering if anybody has a vertically aligned Cedit control out there.
Thanks,
Nick
|
|
|
|
|
Anybody know of a class to just validate an XML Document. I don't need to read or write to an XML file. Just validate it.
Any ideas?
Regards,
Brian Dela
|
|
|
|
|
Brian,
The Xerces (XML4C) parser is small, fast and free. I chose it over (ugh) MSXML.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
What is 0x0a and 0x0d in programming? What does it do?
Mark J Jackson
|
|
|
|
|
in what context ?
all alone like that, they are hex values
0x0a = 10 (decimal)
0x0d = 13 (decimal)
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
that mean carriage return and line feed (\r and \n).
onwards and upwards...
|
|
|
|
|
Hello,
I was just wondering if anyone else was getting this type of error.
Basically, in the last little while I have created my own versions of two common Windows controls and I would like to put them all in one project. My first control was a masked text box and everything work fine except that I would lose certain properties that I set in design after I compiled. For example, I had a "Mask Type" enum property that could be set at design time but when I ran the program and I went back to Visual Studio (while the program was still running) the "Masked Type" property would reset to its default state. The program ran properly the first time with the masked type but as soon as I closed it and ran it again, it would use the default value that it had been reset to. This problem frusterated me to no end as I couldn't do anything to save that property but I did narrow it down to that fact that it was because the property was an enum type. As a result, I found that if I moved that enum type to a different class, it would save properly and I could finally move on (although not as happily as I would have hoped). Recently, I have created a customized tab control that would allow me to change the style and colours of the pages. Again everything seemed to work fine but as I neared completion, I noticed that the design view was again not saving the changes that I was making in it after I had compiled. This time is was the pages collection that was losing its settings. Again, if I moved the collection outside of the class and into it's own class, the design time properties saved properly and I could use it normally.
My question is: Does anyone know what I am doing wrong (or possibly doing wrong) Has anyone had this problem with the designer and if so, how did you fix it. I would appreciate any and all help that I could get in this matter. Thanks in advance.
Cheers,
Mike
|
|
|
|
|