|
Well, you can't arbitrarily assign an address to a pointer and expect it to work. Did you do something like
void *p = (void *)0x003261b6; ?
Let me try explaining why it doesn't work in the simplest way possible.
Every program has something called a virtual address space allocated to it, to prevent one program from trampling over another program's memory. Now whenever you try to access memory, the OS and the CPU conspire to translate the virtual address to the actual physical address. To do this, the OS has to maintain a mapping between virtual and physical addresses and has to know which virtual addresses have been allocated by the program and which have not.
In your case, you're trying to access an address which has not been allocated to the program and that's why you're getting the access violation error. You must consider yourself lucky it crashed straightaway. Imagine the consequences if it worked on your PC, because by some coincidence that memory *was* allocated somewhere else (by the OS or by you), and it crashed right in front a 100 people when you are giving a demo.
Bottom line : Never do the above unless you are dead sure that address has been allocated.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
no I was not doing that...
well, I was doing following thing,
//asign the address to a void PTR
Base = &(FileVersionInfo->dwProductVersionMS);
Before above code I m writing this,
dwVerInfoSize = GetFileVersionInfoSize( szAppName, &dwVerHnd );
cout << dwVerInfoSize << "\n";
if I comment cout stmt my pgm gives me that error.If I uncomment it it works fine.why is that so...I was really confused...
anyways bye. In betwn are U same Senthil who helped me in my final year engineering for XML parser.
thanks
Supriya Tonape
-- modified at 4:38 Saturday 8th October, 2005
|
|
|
|
|
Supriya Tonape wrote:
//asign the address to a void PTR
Base = &(FileVersionInfo->dwProductVersionMS);
It's possible that FileVersionInfo instance went out of scope and consequently got destroyed, but you're still having a pointer to it's swProductVersionMS member. Could you paste the whole function where the problem is happening?
Supriya Tonape wrote:
In betwn are U same Senthil who helped me in my final year engineering for XML parser
In Yahoo Programming chat rooms? Then yes.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
There is another issue if the code is crashing somewhere after the assign. Do you actually access the pointer at some point in time or does it crash when you leave the fn.
|
|
|
|
|
|
Ivan Cachicatari wrote:
How to detect system inactivity?
check is this api of any help GetLastInputInfo
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
|
where i can get manual or tutorial or sample for ms dbgrid control in visual c++?? can someone helpme plz ...
|
|
|
|
|
ive got this program im trying to write and basically its supposed to get an integer and decide if its prime or not prime.
the problem is, i have no idea where to start. i know it involves things like while loops but im not sure how to get it to determine if its prime or not.
can aanybody help?
|
|
|
|
|
Anonymous wrote:
the problem is, i have no idea where to start. i know it involves things like while loops but im not sure how to get it to determine if its prime or not.
Small Logic:-
void main()
{
int i,j;
bool bPrime=true;
cout<<"enter the number ( greater and equal to 2 ) : ";
cin>>i;
for(j=2;j<i-1;j++)
{
if(i%j==0)
{
bPrime=false;
break;
}
}
if(bPrime)
cout<<endl<<i<<" Number is prime";
else
cout<<endl<<i<<" Number isnot prime";
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
|
A prime number, by definition, is divisible only by 1 and itself. Your program finds an integer that, multiplied by itself, is equal to the user's number.
Software Zen: delete this;
|
|
|
|
|
First you have to know what a prime number is. The rest is just symantics here.
In other words, write some code and post it with your question. The odds are that while you are writing it, you'll get your see answer.
INTP
Every thing is relative...
|
|
|
|
|
I want to have an array of objects for an object horse.
horse oHorse[3];
horse Jabo;
horse DarbyDan;
horse BigRed;
How would I set a horse named Jabo using the array?
I've tried oHorse[0] Jabo; but I get that Jabo is an undeclared identifier. I'm a newb so please explain any concepts if you feel they need explained.
Thanks
|
|
|
|
|
Anonymous wrote:
How would I set a horse named Jabo using the array?
what do you mean by "name" ? does the horse object have a name member variable ?
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
No, Jabo, BigRed would be the name of the horse object itself. horse BigRed; is a horse named BigRed. From there I could say BigRed.ShowStatistics();
Thanks
|
|
|
|
|
Instead of set I meant declare, sorry.
|
|
|
|
|
i still don't know exactly what it is you're trying to do... but, it sounds like you want an array where eac element in the array has a unique variable name. ... ?
if that's true, then you can do it in a couple of ways. here is the basic code:
horse horsearray[3];
horsearray[1].SomeMemberFunction(...whatever...);
if you want to give them names, in a way, you can do something like this:
enum {Jabo = 0, DarbyDan = 1, BigRed = 2};
horse horsearray[3];
horsearray[DarbyDan].SomeMemberFunction(...whatever...);
or, if you want to make your code confusing:
horse horsearray[3];
horse *Jabo = &horsearray[0];
horse *DarbyDan = &horsearray[1];
horse *BigRed = &horsearray[2];
DarbyDan->SomeMemberFunction(...whatever...);
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
No, I think you understand what I asked now. I will give it a try later, and if I run into any problems I will post back. I don't want to make it confusing as I'm a newb .
Thanks
|
|
|
|
|
Hi everyone,
Not sure if it's a right place for my question, although it's about C++;
Does anyone experienced any troubles with running code that uses CInternetSession on a computer with ZoneAlarm installed? I can't even run examples like Tear and FteTree from VC! It simply gives timeout.
Looks like ZoneAlarm blocks inet access for those apps without even asking permission.
All other apps (commercial or freeware) work as intended. When they try to connect, ZoneAlarm asks if I want to block access or not. But when I build code with CInternetSession in it, including examples from some articles here, on CodeProject, it blocks access without asking.
Is there a solution known for that problem?
|
|
|
|
|
Is Multiple version of a sinlge dll for each language possible?
Jim456
|
|
|
|
|
You can either put multiple resource languages in a signle DLL or make a separate DLL for each language. Usually the language code will be appended to name of DLL and you explicitly load appropriate language DLL at runtime. If you use all special resource loading functions that accept the language identifier, then it might be easier to combine all the languages into a single DLL. You can not have multiple copies of the 'same' DLL on the system, they have to differ at least by name.
|
|
|
|
|
This sounds very basic but, why cant the dll have like multiples copies on the system?
Jim456
|
|
|
|
|
Hello,
I need to write a program that receives video data sent by a camera (custom made, not an internet camera) using udp or tcp (which is prefered ?)
btw, the camera is connected directly to the computer without network sharing (no switches or hubs or firewalls).
The camera send the data with 50 frames per second and the image size is 480*384 16 bits per pixel. I need help with the implementation of a program that will receive all the frames display and save them to a binary file.
It has to be deterministic (50 frames per sec) (all the data should be saved, no data loss)
I have to display the data at the same rate.
I rather use win32 or mfc.
The hardware i am using is:
1. custom made camera sending video data using udp
2. Gbit Ethernet card
3. pentium 4 (3ghz, 1gb ram)
Thanks.
|
|
|
|
|
The samples that come with the download are for VB and C#; nothing for VC7.
Don't even bother asking the company for answers, you'll get none (if you're ever lucky to get a reply). And if you're lucky to get a reply, you'll learn that there are no VC++ API's to interface with the database. IOW, you're on your own. The product does not even come with ODBC drivers.
I've pretty much had to do and create everything myself when it comes to having the product interface with VC++ for ".net'.
Whatever you learn from their website about technical support, it's for VB and C#.
William
Fortes in fide et opere!
|
|
|
|