|
In VC++ help, go to 'Contents' tab, then Periodicals - 1997 - MS Systems Journal - February - Wicked Code. The article by Jeff Prosise has a solution for your problem.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
2 ways you can do this
1) Show your dialog and in your modal dialogs OnInitDialog or somewhere else approrpriate, launch the lengthy process.
2) Show a modeless dialog but call AfxGetMainWnd()->EnableWindow(FALSE);
|
|
|
|
|
These errors were displayed when I ran my game in debug mode. The application runs fine as far as I can tell but I have no clue what they mean:
DAMAGE: After Normal block (#17) at 0x00A60DC0
CORE :fff6095f:fff5278f:pdnObject [2f2f110]
CORE :fff6095f:fff5278f:Could not find any entries in the HandleTable
CORE :fff6095f:fff5278f:Object is not initialized
Direct3D8: (ERROR) :Hwnd passed is not a valid window
memory check error at 0x00A60E13 = 0x6F, should be 0xFD.
memory check error at 0x00A60E14 = 0x20, should be 0xFD.
memory check error at 0x00A60E15 = 0x31, should be 0xFD.
memory check error at 0x00A60E16 = 0x36, should be 0xFD.
Any help would be appreciated
-Corillian
|
|
|
|
|
DAMAGE: After Normal block (#17) at 0x00A60DC0
This sounds like heap corruption - the bytes after allocated memory block have been overwritten by your application. In debug mode you're only getting the message, in release this would be probably the application crash. You should use BoundsChecker or Purify to pinpoint the problem.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Where would I get BoundsChecker or Purify, and are they free?
|
|
|
|
|
BoundChecker is at www.numega.com, I guess ( i.e. Numega make it ) and your guess on price is out by about a grand ( in Australia anyhow ).
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
The most common cause for this problem is a buffer overflow condition. You probably have either an array or dynamically allocated memory somewhere in your app which you are writing-past in your application.
Example:
char szTemp[20];
for (int iX = 0; iX <= 20; iX++)
{
szTemp[iX] = ' ';
}
This will write past the end of the array and corrupt the stack at offset (szTemp + 20)
should be
char szTemp[20];
for (int iX = 0; iX < 20; iX++)
{
szTemp[iX] = ' ';
}
|
|
|
|
|
Ok, that's what my first assumption was also. The problem is that i have almost a hundred arrays doing various things. Do you know of any tricks to help find the location of a memory overwrite/leak in a source file?
|
|
|
|
|
Off the top of my head, I can think of 3 things you can try.
1) Make sure your warning level is set to level 4. This will probably not find the error, but its worth a shot and is always a good place to start.
2) If you have access to Purify or BoundsChecker, either will almost always find this kind of problem.
3) This is also not guaranteed, but has proven succesful for me on ocassion. It requires modifying your code, but makes for a simple and performance sensitive check. If you get in the habbit of coding this way, it can solve problems later.
When you have code which reads like below.
char szBuffer[20];
for (int iX = 0; iX < 20; iX++)
{
}
change the code to be
char szBuffer[22];
szBuffer[20] = 0; szBuffer[21] = 255;
for (int iX = 0; iX < 20; iX++)
{
}
ASSERT(szBuffer[21] = 255);
This also mean that when allocating blocks of memory, you will always need to allocate 1 or 2 extra bytes and set the last byte to some value which is unlikely to properly exist in the data. Then before freeing the data, check the value of the last byte for the value you gave it, if its not what you set it to, you just overan your memory.
Note: This is not a guaranteed check because it is possible that the value written into the check byte was the value you put there to begin with, but its still a good preaution.
|
|
|
|
|
oops!
ASSERT(szBuffer[21] = 255);
should have been
ASSERT(szBuffer[21] == 255);
|
|
|
|
|
My CMainFrame class has code to position my docking control bars in OnCreate(). When my app is activated as an active document server, the control bars are created in OnCreateControlBars(). The code to dock each control bar requires m_wndToolBar.GetWindowRect(). The result of GetWindowRect()is silly when called from OnCreateControlBars(). Does anyone know where I should create and position docking control bars when activated as an active doc server?
|
|
|
|
|
hi,
I want to remove my mfc application icon from the taskbar.It must be present only in the process list of task manager.ie it must not appear in the application in taskmanager.
|
|
|
|
|
|
Could you please tell the exact location of this article(KB article )
|
|
|
|
|
Search for Q205158 in your VC help or in msdn.microsoft.com. This is the article ID, you should get only relevant hits when searching.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
My application is dialog based one.Then how can I include WS_EX_TOOLWINDOW etc???
|
|
|
|
|
In CYourApp::InitInstance change this...
CYourDlg dlg;
m_pMainWnd = &dlg;
... to this:
CWnd wndOwner;
static const char * szClass = AfxRegisterWndClass(0);
VERIFY(wndOwner.CreateEx(0, szClass, "x", WS_POPUP, 0, 0, 0, 0, NULL, NULL));
CYourDlg dlg(&wndOwner);
m_pMainWnd = &dlg;
Remove WS_EX_APPWINDOW in CYourDlg::OnInitDialog:
ModifyStyleEx(WS_EX_APPWINDOW, 0);
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi,
What the best way of responding to a mouse move, over a CRichEdit.
Cheers
Richard
|
|
|
|
|
m_richEditControl.SetEventMask(ENM_MOUSEEVENTS);
Then add this to your message map:
ON_NOTIFY(EN_MSGFILTER, INPUT_WINDOW_ID, MyMsgFilter) // change this line to use your own control ID and filter method name
then you add your method:
void CMyView::OnInputMsgFilter(NMHDR *pNMHDR, LRESULT *pResult)
I can go into more detail on these items, but they should get you pointed in the right direction as is.
|
|
|
|
|
We currently have over a thousand programs which are currently compiled using command line tools from Borland. It would be nice to convert over to using VC (the DOS editor is getting to the point where it cannot handle the size of the programs!). Has anybody attempted to write a program that will generate the project/workspace files to go with existing source files.
Does anybody know if this is possible or whether there is a quick way to generate the project/workspace files given 2 C source files, a header file and a resource file.
Thanks in advance for any help you can provide.
Steve.
|
|
|
|
|
File/New/Select Project Tab/win32 Console Application/click in OK
After this select File view. In the project name, make right click and select Add Files to project, add the files .c, the .h, and the .rc
And Ready.
Carlos Antollini.
|
|
|
|
|
I know how to setup 1 project. I am looking for a way to setup project/workspace files for over 1000 projects. Fairly painful operation if I have to follow the instructions above that many times.
|
|
|
|
|
Have a look at automating such a process, by using the msdev objects.
HTH
Jignesh
|
|
|
|
|
I wrote a simple VBS script to automate such a process. This script assumes there are existing files in a certain directory.
This is what I meant by using msdev automation objects.
<br />
' Usage : cscript createproject.vbs<br />
Set objMSDEV = WScript.CreateObject("msdev.application")<br />
objMSDEV.addproject "test","c:\myprogs", "application", TRUE<br />
objMSDEV.ActiveProject.AddFile "test.cpp"<br />
objMSDEV.ActiveProject.AddFile "test.h"<br />
objMSDEV.ActiveProject.AddFile "test.rc"<br />
objMSDEV.Quit<br />
WScript.Echo "Done"<br />
' -----------------<br />
' End of script<br />
' -----------------<br />
You can tweak this to recurse through numerous folders and add only certain kind of files, or anything else you want.
HTH
Jignesh
|
|
|
|
|
.dsp file is a text which has rather simple structure. You can create empty project and add one or two sources. You'll see that each source file is listed in 'SOURCE=' line. .dsp contains also compiler switches and other stuff which you can just copy - it does not depend on actual source files.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|