|
hi guys
Could someone please help me to convert from dword to lpcvoid?
This is my code:
LPCVOID voider;
DWORD copytothis;
lpBaseAddress = FakeBF2Start;
but i get an error when i try that:
error C2440: '=' : cannot convert from 'DWORD' to 'LPCVOID'
(that code is not the entire code just so u no its just pseudo but thats the only part that is causing probs)
Thanks in advance
|
|
|
|
|
Cyclone02 wrote: lpBaseAddress = FakeBF2Start;
Perhaps:
lpBaseAddress = (LPCVOID) &FakeBF2Start;
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
thanks a lot but when i use that code with this :
lpBaseAddress = (lpBaseAddress - (LPCVOID)&RealStart) + (LPCVOID)&FakeStart;
then it does not work it displays this error:
: error C2036: 'LPCVOID' : unknown size
: error C2036: 'LPCVOID' : unknown size
do u no how to fix this?
Thanks
-- modified at 14:33 Saturday 28th October, 2006
|
|
|
|
|
You're trying to do pointer arithmetic on void pointers. The compiler doesn't know the size
of void so it can't add the pointers. You need to use an appropriate pointer type (LPBYTE,
LPWORD, etc.) for the arithmetic then cast the result to a LPCVOID.
Without knowing what types lpBaseAddress, RealStart, and FakeStart are I can't show you example
code
Mark
|
|
|
|
|
LPCVOID lpBaseAddress
DWORD RealStart
DWORD FakeStart
can u please show me an example code as that would be very helpful.
Thanks
|
|
|
|
|
Ok it looks like you're adding/subtracting the VALUE of RealStart/FakeStart, not the address,
right?
lpBaseAddress = (LPCVOID)(((BYTE*)lpBaseAddress - RealStart) + FakeStart);
Subtracting the ADDRESS of RealStart then adding the ADDRESS of FakeStart doesn't make sense
to me so I assume that's what you're doing.
Is that what you had in mind?
Mark
|
|
|
|
|
thanks a lot m8 that worked
|
|
|
|
|
Hello everyone!
I was just wondering this... I have a variable that I want to write to a file that can have only 4 values, so only 2 bits needed... If I can't write plain 2 bits to a file, what's the most "efficient" thing I can use? char ?
Thanks! (and sorry if I'm being teh big n00b... )
Windows Calculator told me I will die at 28.
|
|
|
|
|
A single byte is the smallest size you can write to disk.
"Alot of the people on this forum are incredibly stupid, thinking that the internet is real" Score: 1.0 in the Soap Box
|
|
|
|
|
|
The smallest unit you can write is a WORD (32 bits is the most common WORD size, nowadays). However, if you wrote just a WORD to a hard drive that writes 4K sized blocks, you will have a lot of unutilized space.
|
|
|
|
|
You're thinking of a "CPU word" which is the size of the CPU's integer registers (32 or 64 bits on modern desktop CPUs).
The C/C++ type WORD is always two bytes.
|
|
|
|
|
I guess I am mixing up my words!
Thanks,
Geo
|
|
|
|
|
|
it will write 2 bytes but the minimum block for a file could be 4k or more depending upon how the harddisk was formated, i.e. fat16, fat32, NTFS, etc
-Prakash
|
|
|
|
|
Now THAT explains why Windows Explorer says a file is 211B but it says "Size on Disk: 4,00KB "... You learn something new everyday. Thanks!
Windows Calculator told me I will die at 28.
|
|
|
|
|
Lord Kixdemp wrote: Now THAT explains why Windows Explorer says a file is 211B but it says "Size on Disk: 4,00KB".
exactly .
-Prakash
|
|
|
|
|
Just for clarification, under Windows a WORD is 16 bits, or two bytes. A DWORD is 32 bits, or four bytes.
Software Zen: delete this;
|
|
|
|
|
Hmmm! A WORD to the wise. I think our answers to the posted question is a BIT much.
|
|
|
|
|
Hopefully someone can give me some pointer on how to deal with the following scenario:
I have a project that will be given to 3 clients. Although the core code (about 80%) is the same, some dialogs/resources are different for each client. Should I finish for a client first, then create 2 copies of the project folder and change 20% of each code to accomodate the other 2? This will mean the core 80% is duplicated 3 times, and whenever I fix something, I need to do it 3 times.
Is there a way to do all 3 projects in one folder, sharing the core 80%, but appears as 3 separate projects (3 .dsw's/dsp's) and hopefully 3 projects in SourceSafe?
I would really appreciate it if someone can help me here. Thanks a bunch.
|
|
|
|
|
You could have 3 projects in one solution.
Keep all the common code together in one folder. The 3 projects will all use the same common
code. I keep common code in a separate folder on disk as well as separate folder in the
projects. Files unique to each project (dialog-related/resource files in your case) go to the
usual "Source Files" and "Header Files" project folders.
Mark
|
|
|
|
|
How do I separate the dialogs, aren't they listed together (resource.h and .rc)?
|
|
|
|
|
It sounds like resources are the main thing you need to keep separate (well, with their
associated dialog window code).
Resource files can have #include statements too, so you can have common resources and individual
custom resources.
Mark
|
|
|
|
|
Well you could use a Source Control product like Visual Source Safe to "share" files in as many projects as you like.
led mike
|
|
|
|
|
Will you know at runtime which client is which?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|