|
|
Hi Experts,
I have simple problem but unable to figure it out.
I m developing a Chat Application between a Desktop(Server) and a multiple Clients(Palm Device).
The application works as - When a client request a connection with server, a client connected and server displays a new chat window for that client.
I have coded the application as - A thread is created for a server that continues polls for incoming client request and when a request arrives a new client thread has been created. In case of Client Thread, a modeless Chat Dialog Box is displayed..........Now, at this point i have a problem....the client Dialog Box get hang and i m unable 2 proceed further.
The code snippet as follows :
UINT ThreadForServer(LPVOID WinObjPtr)
{
.........
while(1)
{
client = accept(server,(struct sockaddr*)&from,&fromlen );
if ( (client == INVALID_SOCKET) )
continue;
cthreadHandle = CreateThread(0,0,(LPTHREAD_START_ROUTINE) ThreadForClient,0,0,&cid);
}
void CUserLogin::CreateChatWindow()
{
CChat *objChat;
objChat = new CChat();
objChat->Create(MAKEINTRESOURCE(IDD_CHAT),this);
objChat->ShowWindow(SW_SHOW);
}
UINT ThreadForClient(LPVOID WinObjPtr)
{
CUserLogin objLogin;
objLogin.CreateChatWindow();
.... client Processing......
}
I hope u can understand my problem....
Waiting 4 earliest reply.
|
|
|
|
|
I've been getting these messages in my VC6 debug window (at least 12 of them in a row):
First-chance exception in sxtools.exe (KERNEL32.DLL): 0xC0000005: Access Violation.
Normally, an access violation causes the program to break in debug mode but for some reason it just keeps on going. Is it because the access violation is actually happening in a separate process that my application starts? Is there a way for me to tell the debugger to stop on these?
Thanks.
|
|
|
|
|
I suspect this means that sxtools.exe (assuming that isn't your program!) is actually handling this exception using the __try /__except syntax.
Some programs do actually expect access violations. Some operate on sparse arrays by reserving a large block of virtual address space, but not committing any memory pages (both tasks using VirtualAlloc ). When the program tries to use an address that hasn't yet been committed, Windows raises an Access Violation exception; the program handles it by calling VirtualAlloc to commit that page, then returns EXCEPTION_CONTINUE_EXECUTION from the exception handler. The program then resumes with the instruction that caused the fault.
It's possible that a library is doing this on your behalf, if this is your executable.
Exception processing happens in two stages. First, Windows calls all the exception filters (__except blocks) in reverse order from the point that the exception occurred. If the filter returns EXCEPTION_CONTINUE_SEARCH , Windows executes the next filter up the call stack, and so on. If the handler returns EXCEPTION_CONTINUE_EXECUTION , the exception is dismissed and execution continues with the instruction that faulted (or after the call to RaiseException , if the exception was software-initiated). If it returns EXCEPTION_EXECUTE_HANDLER , Windows moves on to the second stage. If all the handlers return EXCEPTION_CONTINUE_SEARCH , Windows drops out into unhandled exception handling (see SetUnhandledExceptionFilter ).
The second stage involves calling all the filters a second time, but between calling each filter Windows unwinds the stack, removing each called function. Finally it runs the code in the handler.
When a debugger is attached to the process, it gets notified of exceptions twice. The first chance is just before Windows calls the first filter, straight after the exception is raised. The second chance is after all the filters have been called and no filter has claimed the exception. You can configure the Visual C++ debugger to stop on the first chance for a given exception code, or only on the second chance. The default is to stop only on an unhandled exception for most exceptions. However, the default for the exceptions raised when you press Ctrl+C or Ctrl+Break in a console application is to stop on the first chance (VC 6.0 also stops on an Invalid Handle exception).
In Visual Studio you configure exception handling in the Debug > Exceptions dialog box. In VC 6.0 you can only access this box when debugging. For VC 6.0, select the exception you want to change and choose either Stop Always to stop on the first chance, or Stop If Not Handled for the second chance, then click Change. If the exception doesn't appear in the list, add its code in the Number box and a description in Name, and click Add. These settings are stored in the project options, IIRC. You can't configure different C++ exceptions separately in VC 6.0 - it's all or nothing.
In VS.NET, the box is unified across native exceptions, C++ exceptions, .NET exceptions and run-time checks. You can configure the behaviour separately for the first and second chances to handle the exception. The "When the exception is thrown" group corresponds to the first chance and "If the exception is not handled" to the second.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
when the application is beeing debugged(*) , go in the menu :
Debug->Exceptions
Then, you can make the debugger stop at every exception.
see if it helps.
(*) you really need to be debugging to see the debug menu and the exception menu item.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Normally a debugger gets TWO notifications for each exception that occurs in your program.
One when as soon as the exception occurs and before it reaches ur program (this is "First-Chance exception" and can be ignored safely).
second is when that exception is not caught by ur program. this time ur program may bomb...
It's not a bug, it's an undocumented feature. suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
I have a C++ app that makes various API calls to a custom API, but I dont have the sources for either the app or the API.
Is there a way I can trace the calls that are made from the app to the api? And what parameters are sent?
Apologies if this is a bit vague, but I am no C++ expert
post.mode = postmodes.signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
I have a CPropertySheet derived class that's a child of a CDialog derived class (main app window.) When a control on the property sheet has focus and I take an action that changes the active window, things get very strange. It looks like an endless loop of WM_GETDLGCODE messages are being generated and processed, so everything locks up. Anybody have any ideas what causes this or how to fix it?
Thanks.
|
|
|
|
|
Check it using a debugger!
Don't try it, just do it!
|
|
|
|
|
Assuming the question was, what does MAKEINTRESOURCE do?
It casts the integer value supplied - which must be below 65536, i.e. fit in a 16-bit quantity - to an LPTSTR , reinterpreting the bit pattern. APIs which expect a resource identifier can take either an integer or a pointer to a string. If the value of the pointer is under 65536, they interpret the value as an integer identifier; otherwise, it is interpreted as a string identifier. You can use the IS_INTRESOURCE macro to check if a resource identifier is a string or an integer.
Windows deliberately reserves the address space between 0 and 0x00010000 for this reason, and to ensure that programs get an access violation if they try to read or write through a NULL pointer (which on Windows is simply a pointer with the value 0).
MAKEINTRESOURCE is implemented in winuser.h . Reading the headers can lead to greater understanding.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
What data type support the operator << of CArchive??.
Thank you.
|
|
|
|
|
|
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
|
|
|
|
|