|
Cool cmk!
I like both the article and the forum you recommended.
What I am trying to do is to solve a sort of specific issues, when there is OS error box which indicates my application is broken at some address (e.g. 0x12345678), because of unhandled exception or something. I want to find out what actually resides in address 0x12345678? Is it code or data?
Any advice or documents to refer?
regards,
George
|
|
|
|
|
You said it is your app, i would suggest running it in Visual Studio, the debugger is easier to use than WinDbg.
The address alone is just a starting point, it may be a side-effect of the actual error. You need more information that that.
I'm sure you realize that debugging is an art, there is no single way to do it, but it starts with coding defensively.
I would suggest getting one of John Robbins debugging books: http://www.wintellect.com/Books.aspx[^], i have 'Debugging Applications'.
Also check out his BugSlayer articles, a collection can be found here ...[^].
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
Thanks cmk!
Great link! My issue is, on the target machine, we can not install Visual Studio, and could I use Visual Studio on local machine to debug on the remote machine's process? If yes, how?
regards,
George
|
|
|
|
|
|
Thanks cmk!
I have read the documents carefully. My current confusion is, as mentioned here and in also other documents,
http://www.nachreiner.com/remotedebug/[^]
we need to copy some DLLs, but the DLL names are for old VC 6.0, and for current Visual 2008, what are the related DLL names?
--------------------
Copy the following files from the HOST to the TARGET machines system directory
MFC42D.DLL
MFCO42D.DLL
MSVCRTD.DLL
Copy the following files from the HOST to the TARGET machines.
DM.DLL
MSDIS110.DLL
MSVCMON.EXE
MSVCP60.DLL
PSAPI.DLL
TLN0T.DLL
--------------------
regards,
George
|
|
|
|
|
I'm trying to generate random numbers with
#include <stdio.h>
void main( )
{
int iRandom = 0;
iRandom = ( rand( ) % 100 ) + 1;
printf( "\n\n%d", iRandom );
}
the result is 42 everytime any help please
Microsoft visual c++ 9.0 / Vista
<div class="ForumMod">modified on Monday, June 30, 2008 1:13 AM</div>
|
|
|
|
|
Try to put this line
srand( (unsigned)time( NULL ) );
before calling rand();
-Santosh
« Superman »
|
|
|
|
|
|
you should use srand if you want the sequence to start with a different number each time. Otherwise it always gets seeded to 1, and on your compiler (Visual C++, I'm guessing) the first number generated with a seed of 1 is 41.
The result is displayed as 42 since you always add 1 to the random number.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi all,
I m using Number property for Edit box,becoz i want to use only digits.
But i also want to enter ".",but it is not accept it please tell me how can i Number property of Edit box where i m also use ".".
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
"_$h@nky_" wrote: how can i Number property of Edit box where i m also use ".".
You cannot. If you want such a feature, you should handle the WM_CHAR message and filter the unwanted keys..
|
|
|
|
|
Can you please tell me with example.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
void CNumericEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
char szBuffer[100] = {0};
short int nCounter = 0;
short int iTemp = 0;
int iStartChar = 0;
int iEndChar = 0;
if(nChar == '-')
{
return;
}
if(nChar != VK_BACK && nChar != VK_TAB)
{
if(nChar != '.' && (nChar < '0' || nChar > '9'))
{
return;
}
GetWindowText(szBuffer, sizeof(szBuffer));
if(nChar == '.')
{
GetSel(iStartChar, iEndChar);
if(iStartChar != 0 || iEndChar != static_cast<int>(strlen(szBuffer)))
{
for(nCounter = 0; szBuffer[nCounter] != NULL; nCounter++)
{
if(szBuffer[nCounter] == '.')
{
return;
}
}
}
}
}
CEdit::OnChar(nChar, nRepCnt, nFlags);
}
|
|
|
|
|
this error comes out when i use the above code.
error C2248: 'CWnd::OnChar' : cannot access protected member declared in class 'CWnd'
1> C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include\afxwin.h(2631) : see declaration of 'CWnd::OnChar'
1> C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include\afxwin.h(1967) : see declaration of 'CWnd'
1>
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
|
How can i do this?
I m using edit box and other controls on Dialog box,so the base class is CDialog.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Derive a new class from CEdit and override OnChar.
In dialog create a member variable of new Class derived from CEdit.
In DoDataExchange of dialog write
DDX_Control(pDX, <edit control="" id="">, <object of="" derived="" cedit="" class="">);
If you still do not get please see articals which is available in codeproject.
|
|
|
|
|
Thanks.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
|
Have you considered a masked edit control?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello everyone,
Am I correct for the understanding of the following three questions about CoInitialize/CoUninitialize?
1.
For each thread which utilizes COM, we need to call CoInitialize/CoUninitialize. Not for each process.
2.
There is no harm to call CoUninitialize even if we do not call CoInitialize? And if we call CoInitialize N times on a thread, we need to call CoUninitialize the same of times (N times, not only 1 time) on a thread to release all resources?
3.
CoInitializeEx will invoke CoInitialize?
thanks in advance,
George
|
|
|
|
|
George_George wrote: For each thread which utilizes COM, we need to call CoInitialize/CoUninitialize. Not for each process.
yes
George_George wrote: And if we call CoInitialize N times on a thread, we need to call CoUninitialize the same of times (N times, not only 1 time) on a thread to release all resources?
yes
George_George wrote: CoInitializeEx will invoke CoInitialize?
No. But CoInitialize calls CoInitializeEx with concurrency model as single-thread apartment.
|
|
|
|
|
Thanks Naveen,
I have tried call CoInitialize multiple times will result in fail? Could you reproduce it?
regards,
George
|
|
|
|
|
Fail means it return E_FAIL ? I hope you have seen the below lines in MSDN
"Typically, the COM library is initialized on a thread only once. Subsequent calls to CoInitialize or CoInitializeEx on the same thread will succeed, as long as they do not attempt to change the concurrency model, but will return S_FALSE"
|
|
|
|
|
Thanks nave,
Question answered. This is what I mean.
regards,
George
|
|
|
|