|
Your not really giving enough information for anyone to help you. There are many possible causes for an access violation. I give the following advice about once a month; it often helps me track down the nastier heap errors:
Try enabling the page heap[^] for your process. Follow these steps:
1. Download and install WinDBG[^].
2. Select “Start”->“All Programs”->“Debugging Tools for Windows”->“Global Flags”.
3. Select the “Image File” tab.
4. In the “Image: (TAB to refresh)” edit control enter the name of your app then press TAB. Just the name with the extension; not the full path.
5. Tick the following:
- “Enable page heap”
- “Enable heap tail checking”
- “Enable heap free checking”
- “Enable heap parameter checking”
- “Enable heap validation on call”
- “Create user mode stack trace database”
6. Press “Apply”.
7. Debug your application. Any debugger will do but with WinDBG you have access to the stack traces of allocations via the !heap –p –a command, for example. When a heap problem is detected a breakpoint will be generated.
8. When done un-tick all the options you ticked, press “Apply” then dismiss GFlags. This step is important as if it’s skipped all applications named as entered in step 4 will run with the page heap enabled.
Note that when using the page heap your application will run much slower than normal and consume way more memory. It’s good to have a beefy machine to do such tests; and such tests should be ran regularly on all applications you develop as part of regular testing activities. If I find a part of my application that’s too slow with the page heap enabled I optimize the memory allocation in that region.
Steve
|
|
|
|
|
Hi,
I have a piece of hardware that I want to integrate with Office Commnicator 2007. Could somebody point to me where can I get the API/SDK for OC2007? I want to integrate the OC2007 functionality into my app by launching portions of OC2007 user interface, such as the phone dialer...
Can somebody help me here?
Thanks in advance.
|
|
|
|
|
How TO Create A Menu At The Bottom of a dialog based application
|
|
|
|
|
I think I saw this question yesterday,do you want to change position of menu of top to buttom?
|
|
|
|
|
Ya, I want to change the menu position from top to bottom.
Thanks IN Advance
Jannath
|
|
|
|
|
Hi.
Im doing a MDI program using CFormView.
When I first run the program, there is a child window in the parent window.
I do not want to open up the program with a child window.
I want to see the child window only when I click File->Open.
How do I do that?
Thanks.
|
|
|
|
|
Place the following code between ParseCommandLine and ProcessShellCommand function calls in your CMyApp::InitInstance method;
if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew) {<br />
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;<br />
}
--
=====
Arman
|
|
|
|
|
BOOL CYourApp::InitInstance()
{
//...
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Added to prevent New Empty Document at startup
if (cmdInfo.m_nShellCommand==CCommandLineInfo::FileNew) {
cmdInfo.m_nShellCommand=CCommandLineInfo::FileNothing;
}
//...
}
|
|
|
|
|
Hey.
Thanks.
But now, if I clicked File->Open, it wont display the child window.
Only if I clicked File->New, will the child window be displayed.
How can I make the child window be displayed when I clicked File->Open?
And also, after I get the child window to be displayed through File->New, when I tried to maximize the window, my GUI is not there anymore. Why is that so?
|
|
|
|
|
ReturnRain wrote: it wont display the child window
The code provided is pretty much an industry standard way in MFC to prevent the initial document in an MDI application. It appears in many articles and books. It should not have any effect on on the operations you are describing so my best guess is that you have code elsewhere that effects the actions you are having difficulty with.
One way to verify this is to create a MFC MDI application using CFormView and dropping that snippet into the appropriate spot and running it without any other code added and you should see that the open and new and child maximize work correctly (at least on VC++ 6.0 and VC++ 2003). I don't use VC++ 2005 so I have no way to verify it using that IDE.
|
|
|
|
|
i have to create a mail page such that the edit window has to support html emails and i must have the options of bulleting,font size ,font type selection features for that window.so please prefer the class that best supports all this features.i can say that the mail page should look just like ms-outlook outbound and inbound pages.
can we use the class CHtmlEditCtrlBase to support this features.
best regards
|
|
|
|
|
Hi all:
Ran into a tiny problem here.
I have declared a class as following:
class CStack {<br />
char* stk[STK_MAX];
int stkIndex;
public:
void push(int i) {
assert(stkIndex < STK_MAX);<br />
*stk[stkIndex++] = i;<br />
} <br />
};
And in 'main' function that follows:
CStack stack;
for (int i = 1; i < argc; i++) {<br />
stack.push(atoi(argv[i]));
assert(stack.count() == i);<br />
}
Just wondering why?
Thank you
|
|
|
|
|
Not sure about what you are trying here. Did you mean something like...
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
const int STK_MAX = 255;
class CStack {
int stk[STK_MAX]; // Use an array to store the stacked data
int stkIndex; // Index of the first free position in the stack
public:
// Constructor
CStack() : stkIndex(0)
{
}
void push(int i) {
stk[stkIndex++]=i;
}
};
int main(int argc, char* argv[])
{
CStack stack;
for (int i=1;i<argc;i++) {
stack.push(atoi(argv[i]));
printf("Argument %d = %d\n",i,atoi(argv[i]));
}
return 0;
}
|
|
|
|
|
Hi:
Thank you for your reply.
1: No what I meant is :
class CStack {
char* stk[STK_MAX];
int stkIndex;
public:
void push (int i) {
*stk[stkIndex++] = i;
}
2: How do you apply indentation?
Thank you
|
|
|
|
|
That was a rhetorical question. There were hints in the code I posted to help you identify where you forgot to initialize stkIndex and the odd assignment of an arbitrary int to a char*.
C_Zealot wrote: How do you apply indentation?
check the box labeled "Ignore HTML tags in this message (good for code snippets)"
Some people will say wrap it in code tags but that makes it hard to copy and paste snippets to test posted code samples as whitespace is not properly preserved.
|
|
|
|
|
Have u initialized the value for "stkIndex"
*stk[stkIndex++] = i; //stkIndex = garbage value
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
Thank you. I will try it out.
|
|
|
|
|
You have an array of pointers to char s called ‘stk’. As far as I can see these pointers are not initialized, so they point at some random location. You push values on the stack like this:
*stk[stkIndex++] = i;
Let’s break this up (underlined part being considered):
*stk[stkIndex++] = i
This statement evaluates to a reference to one of the elements of the ‘stk’ array. Remember these elements are uninitialized pointers.
*stk[stkIndex++] = i
This dereferences the pointer which result in a reference to some RANDOM area of memory which we interpret as a char .
*stk[stkIndex++] = i
This writes the integer truncated to a char (which is another issue with your code) to the some RANDOM area of memory. Crash!
Steve
|
|
|
|
|
|
Unless you making your own stack for learning purposes you're better off using the standard STL one:
----------------------------
// Console.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <stack>
int main(int arvc, char* argv[])
{
using namespace std;
// A stack of 'int's.
stack<int> ints;
// Fill the stack.
for (int i=0; i<10; ++i)
{
ints.push(i);
}
// Now empty the stack and print the results.
while ( !ints.empty() )
{
cout << ints.top() << endl;
ints.pop();
}
return 0;
}
Steve
|
|
|
|
|
Hi all, I use IVMRWindowlessControl::GetNativeVideoSize function to read the width and height of a film. It works well if the film is in wmv format, but when the film is in MPG format, the height is negative (in my case it is -1060)
A strange thing is that if I change the extension of the file from mpg to wmv. It's OK
Is there another way to read the width and height of a film?
I'm looking forward to your answers. Thanks
|
|
|
|
|
See this[^] site is helpfuls for you
|
|
|
|
|
I tried IVideoBasic anh it's OK now. Thanks a lot!
|
|
|
|
|
Is there a way for an application with Admin privileges to discover the paths to each user's Local Settings directory?
I am writing an updater for an application that stores data for the user within the user's Local settings tree.
But the application updater needs to be able to manipulate the user data for every user on the system.
I am able to call SHGetFolderPath to get the correct path for the current user, but what about the other users?
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
hi !
dear all!
well now all threads are working and running but then it use the same paramters for all the thread. I confuse here why ??? .
I need somebody's urgent help.
Thanks in advance
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|