|
even if the file is altered in your IDE, it will display such dialogs. [for example, if u change something in the dialog and try to complie it, though it doesn't throw any errors]. just click on "save all" before compiling. this will make sure what you see is what is there.
Every man should marry. After all, happiness is not the only thing in life.
--[v]--
|
|
|
|
|
I have a class written in WTL 7.0 but I want to use it in my MFC application.How can i do that. The class use WTL CString but I think it isn't recognized in MFC
I tried to add the class into my project but I got the following code when I conpiled:
fatal error C1010: unexpected end of file while looking for precompiled header directive
Can you help me?
Thanks a lot!
|
|
|
|
|
well,
I am not too sure about WTL->MFC, but you can fix the compilation error by putting
#include "stdafx.h"
at the top of the file or select "not using precompiled header" in projectsettings->C/C++
-prakash
|
|
|
|
|
Thank you for your help.
When I debug the program and close it ,it said the "HEAP[Airrf.exe]: Invalid Address specified to RtlValidateHeap( 00370000, 003750AC )". What does it mean?And How do i work it.
Thank you.
|
|
|
|
|
it probably means you've written outside the memory your app has allocated (you have a stray pointer somewhere) and you've corrupted something the OS needed to maintain the Heap.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Thank you.
So how to I deal with it? Could you give me some ways to find the error pointer?
|
|
|
|
|
this is definitely a difficult thing to track down. basically, you have to make sure any pointer you use points to a valid address before you write to it.
basic things to start with: make sure your pointers are initialized to NULL or a valid value before you use them. take a good close look at any code that dereferences a pointer (*(ptr) = ..; , ptr[x]=...; or ptr->... = ...;) - make sure that code isn't running outside the limits of any memory you've allocated dynamically...
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Thank you for your help.
I will track down any code defined the pointer.
Thank you again.
|
|
|
|
|
and if you are free up a memory pointer dont forget to assign NULL to that (good practice)
-prakash
|
|
|
|
|
Thank you for your good advice.
|
|
|
|
|
Hello. This is a problem I'm encoutering. I have a program compiled on a 32-bit system. Yet, I want to detect the Process Affinity Mask and System Affinity Mask on a 64-bit System which contains 64 logical processors. The problem is that:
BOOL GetProcessAffinityMask(
HANDLE hProcess,
PDWORD_PTR lpProcessAffinityMask,
PDWORD_PTR lpSystemAffinityMask
);
and
BOOL SetProcessAffinityMask(
HANDLE hProcess,
DWORD_PTR dwProcessAffinityMask
);
These functions have a DWORD_PTR data type that is a 32-bit data type in a 32-bit system and 64-bit data type in a 64-bit system when the code is compile native mode( 32-bit or 64-bit ). Since my application is compiled in a 32-bit system, the DWORD_PTR will be a 32-bit mask. When I run this application in a 64-bit system, I get the process affinity mask and system affinity as 32-bit value. This implies that even though, I have 64-bit system with 64 logical processor, my application can only see the process affinity mask and system affinity mask for 32 logical processors.
What this implies is that my 32-bit application can only be set to run on any 32 logical processors, but I would never be able to have my application run in all processors since my process affinity mask data type is 32-bit and system process affinity is also 32-bit.
So, my questions is, how can I set my application 32-bit app to run on all 64 logical processors when my code was compiled in a 32-bit system?
One Answer which I already know: I have to compile my code 64-bit native in order to be able to make my application have the ability to choose any of the 64 logical processors to run on. But then that implies a 32-bit app would never be able to choose to run on any logical processor it chooses to in a system with 64 logical processors since the GetProcessAffinity( ... ) will only return 32-bit affinity mask. This will also apply when you are setting the process affinity, SetProcessAffinityMask( ... )
I would appreciate a quick response. Thanks.
P.S. For those trying to detect all the processors in a 64-bit system with a 32-bit application, which contain more than 32 logical processors good luck. If you are able to do it, please email me at: sergioah78@yahoo.com. If no one can do it, then that means we have a limitation when we run a 32-bit app on a 64-bit system. If we have more than 32 logical processors, we can only choose up to 32 logical processors to run the 32-bit application.
sergioah78@yahoo.com
Sergio
|
|
|
|
|
I have written a number of Active X controls using VC++6.0, including a couple of subclassed controls. I am attempting to subclass the CTreeCtrl, and wish to access the superclass methods such as GetFirstVisibleItem, GetItemText and so on. I understand the principle of the PreCreateWindow and have hooked messages. The Microsoft article MFC ActiveX Controls: Subclassing a Windows Control does not really help much.
Am I missing something here, is there a simple way of accessing specific Superclass methods?
|
|
|
|
|
The program works, but the calculation is wrong. The is written in C. Could someone tell me what I am doing wrong?
Thank You
#include "stdafx.h"
#include <math.h>
#using <mscorlib.dll>
using namespace System;
// Function prorotypes
void sphere_volume (double);
// PI is a constant
const double PI=3.14159;
int _tmain()
{
// Integer local to Main to store initial radius value
double r;
printf("Please Enter A Positive Radius Value\n");
scanf("%lf", &r);
// If Else Function To Make Sure The User Types A Positive and Not A Negative Integer.
if (r >= 0)
sphere_volume (r);
else
printf("You Must Enter A Positive Integer!!!! Not A Negative Integer!!!\n");
return 0;
}
// This Is The Fnction That Does The Calculations For The Volume.
void sphere_volume (double radius)
{
double radius_cubed;
double exponent=3;
double volume;
printf("This Is The Test To See If R Was Passed To The Function: %lf\n", radius);
radius_cubed=pow(radius, exponent);
volume=(4/3)*PI*radius_cubed;
printf("The Volume Of The Sphere is %lf\n", volume);
}
Joseph L. Gelsomino
|
|
|
|
|
Try changing the 4/3 to 4.0/3.0 so the calulation is done as a double not as an integer, which is currently losing you the 0.3333333
If you vote me down, my score will only get lower
|
|
|
|
|
In addition to Roger's suggestion, I suggest the following to help 'polish' your application:
WackoWolf wrote: // Integer local to Main to store initial radius value
double r;
Comment (int) does not match code (double).
WackoWolf wrote: if (r >= 0)
Use a double constant (0.0) here.
WackoWolf wrote: printf("You Must Enter A Positive Integer!!!! Not A Negative Integer!!!\n");
Again referencing integers.
WackoWolf wrote: double exponent=3;
Use a double constant (3.0) here.
WackoWolf wrote: void sphere_volume (double radius)
Another suggestion I might make, although it has no impact on the outcome of your program, is to make this function's parameter const .
void sphere_volume( const double radius ); This ensures that your code does not accidently change the value of the parameter.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hello,
I am hosting an activeX control that has its own UI using standard MFC controls. I have a button that has an accelerator key ("&Browse") but the button is not responding to alt+b.
I don't know what the problem is. Perhaps the accelerator message is going to the hosting application and not the activeX control? The accelerator key never works, even when a control in the activeX control has the focus.
Any ideas?
thanks!
-Ian
|
|
|
|
|
I'm getting a strange problem that I don't know how to find out what is causing the problem. It's late in this programs' development and I can now use it for it's actual intended purpose instead of testing functionality. After I run it for a while, it slows down and I click Stop in VS. A lot of these come up in the debugging output window:
First-chance exception at 0x7c81eb33 in myprogram.exe: Microsoft C++ exception: CResourceException @ 0x0012f660. Warning: Uncaught exception in WindowProc (returning 0). I know how to handle exceptions but I don't know how to find out where the exception occurs so I can either fix it or catch it and then handle it properly.
|
|
|
|
|
Are there any localization tools which would indicate a resource in one language to change when the same resource id is updated in another language in the same RC file?
Jim456
|
|
|
|
|
Okay, a little problem here, im doing the following code, all in the same scope:
char* data;
...
data = (char*)malloc(sizeof(char));
memset( data, 0, sizeof(data) );
...
if( data != NULL )
{
free(data); // error here
data = NULL;
}
And i get a debug error, "DAMAGE: after Normal block(#371) at 0x0037F9B0."
Any ideas why im getting this?
|
|
|
|
|
Also, at the point where free(data) is called, data = 0xcccccccc.
|
|
|
|
|
Your problem:
// This allocates ONLY 1 byte, why you try to allocate only 1 byte??
data = (char*)malloc(sizeof(char));
// However this is memsetting 4 bytes which is whats causing the problem...
memset( data, 0, sizeof(data) );
// Code should read, only set up 1 byte
memset( data, 0, sizeof(char));
|
|
|
|
|
wow, dumb error, thanks alot.
|
|
|
|
|
Have you considered using new/delete instead?
|
|
|
|
|
memset( data, 0, sizeof(*data) );
|
|
|
|
|
Hi,
I work on a large App created using C++ in VS6. We have since moved to .Net and our code is unmanaged. Several of our dialogs have an overwhelming number of controls. I have been tasked to create a wizard which will walk the user step-by-step through completion of the dialog. The current dialog must stay in tact while the wizard will break the dialog into smaller "user friendly" chunks with explanation text. The idea is to have only the current dialog for experienced users and the wizard for new users. The user will have to add text to edit boxes and select from combo boxes etc. I have to do this for several dialogs. I'm trying to figure out the best way to do this without duplicating work. I'm toying with the idea of using a property sheet.
Suggestions??
Thanx
Cubzfan
|
|
|
|