|
Hi all,
The question might be strange, but I have a MFC application (say on client system) which will be started by another program from another system (say server) using PsTools command via network. Both systems are connected using a crossover cable and once the server starts the client program it sends commands to client as per user request on server program (which is also a MFC program). The client program is multi-threaded program and records/playbacks videos from framegrabber. Everything is fine for a while, but recently the client program started acting weird, the program closes abruptly without any warning or message or anything, it just disappears (not even its trace in task manager) while the server is still running, the client should close only when the server sends a quit ('Q') command. I tried to have a message pop up in 'OnClose()' function etc etc, but nothing works, it just disappears randomly.
I wonder if there is any way to figure out what the problem/error is, any suggestions??
thanks,
-PNT.
PKNT
|
|
|
|
|
I've seen this happen when an exception is raised and the EXCEPTION_REGISTRATION linked list is corrupt. See here[^] for more information. The following program demonstrates this (it's from memory so bear with me):
void main()
{
__asm
{
mov eax, 0
mov FS:[0], eax
}
*(char*)0 = 0;
return 0;
}
Steve
|
|
|
|
|
In addition to what Stephen Hewitt pointed out... there are other situations which may cause the symptoms you are describing. For example... if you have a global structured exception handler and a second exception occurs while inside your handler code... the application will simply be terminated and would 'dissapear'.
Another situation which would cause the application to 'just dissapear' would be calling:
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
This single line of code would cause the application to simply dissapear when an exception occured.
I would suggest downloading Debugging Tools for Windows[^] and attaching WinDbg to a debug build of your application.
Best Wishes,
-David Delaune
|
|
|
|
|
Thanks for your replies, I thought of using WinDbg, but couldnt figure out exactly how to use it. But will check out for some articles on it. BTW in my program there are no stacks or heavy memory allocations or anything memory intensive, its just get the frame data from framegrabber and write it to a raw avi file on the hard drive.
Will try WinDbg to find the problem.
-PNT
PKNT
|
|
|
|
|
Kiran Satish wrote: there are no stacks
Yes there is: simply calling a function and using local variables uses the CPU's stack. This is the same stack that holds the EXCEPTION_REGISTRATION linked list.
Steve
|
|
|
|
|
I tried to use WinDbg while running this application but its gives me .pdb file not found or mismatched error. I recompiled the program in debug mode and tried to run again and it gave me the same error.
Are there any settings that needs to be set in project options of the applicaiton in debug mode??
-PNT
PKNT
|
|
|
|
|
|
That option "Generate Debug Info" is always enabled in my applications in debug mode. Will go through the PDB files article in a min.
I found a problem/unhandled exception wihtin the application relating to CComVariant. As I said my application communicates with another system using ethernet while at the same time it communicates with another program within the system using COM port. Inorder to handle the events from COM port (CMSComm object), I use a CComVariant object to read the data from CMSComm object whenever it triggers OnReceiveMessage() event. This is how I have used it in my program -
void CMyApplicationDlg::OnReceiveMessage()
{
if(m_ComRecCommand.GetCommEvent() == 2)
{
CString buffer,vidname,val;
m_cvRespInput.Clear();
m_cvRespInput = m_ComRecCommand.GetInput();
buffer = m_cvRespInput.bstrVal;
}
}
It gives me error at line 8, when I watch the variable in debug mode, it shows VT_ERROR for CComVariant object. This is not the case before using ethernet communication from another system. But once I use it, this one shows only VT_ERROR. Am confused on understanding why this is happening???
PKNT
modified on Thursday, January 15, 2009 8:56 PM
|
|
|
|
|
Kiran Satish wrote: when I watch the variable in debug mode, it shows VT_ERROR for CComVariant object.
What is the m_cvRespInput.scode (status code) value? It should be giving you an error code.
Best Wishes,
-David Delaune
|
|
|
|
|
|
...
"Well, we're getting "F"'d at work. WPF, WCF, and WWF... WTF?" --John Simmons
|
|
|
|
|
Would all 5.8 million of you members, plus those few programmers who aren't members yet, please be so kind as to read my excellent article, vote it 5, bookmark it and download the code provided?
TIA
|
|
|
|
|
But 5 of left or right ?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
I wonder why don't you ask also for money...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
[^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote:
Advertising the article in the C++ forum is really shameful.
And what about advertising one's own message?
|
|
|
|
|
i have a view i need a function getting called when that view is activated or updated
|
|
|
|
|
CView::OnActivateView looks good for you.
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
could you plz any MDIChildWnd function
|
|
|
|
|
Are you using MFC?
If you are using raw windows code, then maybe you could look at WM_SETFOCUS?
Other than that, I don't understand your question.
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
ya i am using MFC
i have a scenario i am importing other personalities into the scenario at that time that view is updated
i found one function msdn that is OnMDIActivate it is getting called all the times but it is not getting called when importing personalities
here we are using MDiChildWnd class for that
|
|
|
|
|
Scenario and Personalities are not MFC terms that I know.
Is this data you are loading into your document?
If you are importing things, I guess you have written code there to do the importing? So you already know when this is happening...
If this is in your CDocument class, you can use UpdateAllViews to tell your view class that something interesting has happened.
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
|
Hi all,
If i check the IP address of any machine then it shows the following notation of IP in case of IPv4
"127.0.0.1"
And in case of Ipv6
"fe80::198:8ad2:22fe:2bff8%4"
Is there any API or C function or any logic to convert IPv6 address to IPv4 Address for window and linux.
Thanks
|
|
|
|
|
singh_nav wrote:
Is there any API or C function or any logic to convert IPv6 address to IPv4 Address for window and linux.
Only to a limited degree. See here for more. The operative sentence is, "Obviously, that's impossible, since IPv6 has a larger address space... Your technique will only work on IPv4-mapped IPv6 addresses".
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|