|
primitive data types or serializable objects (that derives, either directly or indirectly, from CObject).
It's not a bug, it's an undocumented feature. suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
i used a CAsyncsocket class in my service prog,and create socket succeed.when socket was connected ,the connect()function return zero. getlasterror() show the error is 997:(Overlapped I/O operation is in progress).but it is strange that:at first, my prog was fault,the socket can also receive and send data in the state of error(connect() return zero).why?
class CMysocket : public CAsyncSocket
{ .........}
class CServiceWnd : public CWinThread
{
CMysocket * m_pSocket;
..........
}
BOOL CServiceWnd::Createsocket()
{
if (m_pSocket != NULL)
{
delete m_pSocket;
m_pSocket = NULL;
}
m_pSocket = new CMysocket();
if (!m_pSocket->Create())
{
LogEvent("Socket failure", 0, FALSE);
return FALSE;
}
int s;
s=m_pSocket->Connect(IP_Address,IP_Port);
CString ss;
ss.Format("Connect(IP_Address, IP_Port) return :%d",s);
LogEvent(ss,0, FALSE);
if(Is)
//at first,i set "ifisj"Cbut can also send/receiveIIH
{
if (m_pSocket->GetLastError() != WSAEWOULDBLOCK)
{
CString strError;
strError.Format("can't connect,last error is %d",m_pSocket->GetLastError());
LogEvent (strError, 0, FALSE);
m_fConnected = FALSE;
delete m_pSocket;
m_pSocket = NULL;
return FALSE;
}
}
m_fConnected = TRUE;
LogEvent (_T("connected"), 0, FALSE);
return TRUE;
}
|
|
|
|
|
Hi all,
I'm using MFC (VC6) and have a list control in a dialog that I would like to catch double-clicks.
I've searched through the class wizard messages available to the list control but do not find any that can be used...
What am I missing here?
Any help welcome.
|
|
|
|
|
Try NM_DBLCLK. It is a Common Controls notification in common with others, rather than a List Control
specifically.
Unless you mean a ListBox, in which case you want LBN_DBLCLK.
Iain.
|
|
|
|
|
Thanks, that worked...
Now, can anyone explain to me why the description for the control's message that the class wizard shows on the bottom of its window is cut on the right?
If I could see the whole explanation I would not need to ask this here...
All I could see was
Indicates that the user has double-clicked the left mouse button in the
The what?
Nice one, Microsoft
Anyway, thanks for the help
|
|
|
|
|
Forget class wizard. With VC++ you would have got the MSDN cds.
Run that, and search for NM_DBLCK, etc, and get the full info there.
Or on the wab: NM_DBLCLK[^].
Iain.
|
|
|
|
|
plz help me i have just 3 days left to make a programme in borland c++ dos mode for grphics
programe should take input from user any alphabet that alphabet should rotate about its axis and can be zoomed
plz any genius person can 2 that in 2 days if any one can do that iwill be ver very very very thank full to him
thnx
umair majeed
|
|
|
|
|
can you use directx? if so, use the D3DXDrawText() function
If it's broken, I probably did it
bdiamond
|
|
|
|
|
I'm programming an activeX control and my 'OnDraw' function uses both gdiplus and standard gdi calls.
When I insert my control into a dialog ressource in VC++, it is drawn correctly, but when I run the application there 's no gdiplus drawing anymore on the dialog, only gdi drawing are visible.
May someone help me?
thanks
|
|
|
|
|
I'm no expert on GDI+, but have you remembered your GdiplusStartup / GdiplusShutdown functions?
Iain.
|
|
|
|
|
I solved the problem :
Strangly, If the pen I am using to draw is instanciated before the GdiplusStartUp, there is no error, but the drawing are invisible with this pen...
So I declare my pen after GdiplusStartUp now.
|
|
|
|
|
Hi,
I intend to add voice recognition features to an application I'm developing in Visual C++. I'm comfortable in c++ and MFC and had planned to do research into the Microsoft Speech SDK 5.2 but I'm finding msdn has very little info on the Speech SDK.
Can anyone tell me if the Speech SDK has now been superseded by the SASDK, which appears to be ASP.net based.
Bearing in mind I've never touched ASP could anyone advise me where I need to focus my attention? I don't need dictation capabilities, purely command recognition.
Thanks in advance,
Simon
|
|
|
|
|
I'll bet you're familiar with this problem.
printf("this might crash: %s", integervalue);
In code with thousands of string formatting statements, at least some of them might be malformed.
Anyone has a solid solution to prevent this type of crash?
anyone seen good and secured string formatter code?
greetings,
Niko
|
|
|
|
|
USE sprintf rather than printf.
|
|
|
|
|
hmm.
this will crash too.
The question is not:
how can I format strings.
but
how can I prevent myself from crashes due to bad formatting parameters.
|
|
|
|
|
Your answer is innoportune. Are you sure you have read NikoTanghe's question ? He obviously used printf as an general example to illustrate the problem. This applies to sprintf, CString::Format, etc. as well.
|
|
|
|
|
The standard libraries IOStream libraries. That's what exactly what they're designed for.
int i = 1;
std::string s = "foo"
std::cout << i << s;
or in the case of printing to a buffer use std::ostringstream in preference to sprintf
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
As much as I dislike iostreams, I have to agree with Andrew. If the programmers can't get their formats straight then iostreams is an excellent choice.
Then again, if your programmers can't get their formats straight, you are going to have much more problems than just printing.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Try Boost format library. It provides type-safe formatting very similar to printf .
Robert-Antonio
"CRAY is the only computer, which runs an endless loop in just 4 hours"
|
|
|
|
|
this can't be correct if intergervalue is effectively an integer...
%s is waiting for a char pointer which represent a NULL-terminated C-style string....
to prevent this type of crash as you say, it is first to well name your variables. iValue for an integer for example, pcArray for a char pointer...
the second thing is to be attentive when coding
or you use cout instead, but that'll be more difficult to catch error...
TOXCCT >>> GEII power
|
|
|
|
|
As a summary of what the others have written... using printf or its variants, how to prevent a crash if the wrong format specifier is used? The answer is simple:
You can't.
You will have to use IOStreams, or possibly as another person mentioned, boost. Using iostreams is probably the simplest alternate option. Either that, or make sure your format specifiers always match the data types!
Sometimes I feel like I'm a USB printer in a parallel universe.
|
|
|
|
|
Is there a possibility with the CFileDialog Classe to do a select folder dialog box?
Thank's for advance
|
|
|
|
|
ShBrowseForFolder should do the work if you only need folders.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Ok thank's... Can you help me about how can be the code to display it ?
|
|
|
|
|
In the CodeProject's search edit box (just below the title), type ShBrowseForFolder and you'll get a couple of good articles about it.
|
|
|
|