|
Hello Ratheesh,
You can use LOWORD()[^] macro to get the last two bytes together.
If you need last two bytes separately, then call LOWORD()[^] to get last two bytes together and then get bytes separately by calling LOBYTE()[^] and HIBYTE()[^] macros.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
modified on Friday, June 12, 2009 7:43 AM
|
|
|
|
|
ratheeshnair123 wrote: last two bytes
it is a bit ambiguous...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
You can also achieve the results using & and shift-operators. Something like unsigned-var & 3 (as last 2 bits are 1s and all others are 0s) and then do left-shift to get last 2 bits.
|
|
|
|
|
no need to left shift the bits. they are already in the required order.
regards
|
|
|
|
|
Another option is to use the modulus operator:
int i = 0;
int x = 0;
i = 1286439;
x = i % 65536;
Just another way to do the same thing.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Hii
I wanna open a logical partition and read all of its file using windows function
ReadFile().
I know
HANDLE handle= CreateFile( L"\\\\.\\D:",-------);
bool b= Readfile(handle,buffer,bytes to read ,bytes read,0);
if ((b && bytes read )==0)
My doubt is here we are getting the file as in the buffer.How to get the that file itself?
I wanna make some operation on that file.
So how to get that particular file?
Otherwise I've to create a new file with same name and write into it Using WriteFile() function ?
I've to read all file one-by-one..? how to perform this ?
Thanking you.
|
|
|
|
|
krish_kumar wrote: My doubt is here we are getting the file as in the buffer.How to get the that file itself?
You've to break the hard disk with a hammer, I suppose.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
krish_kumar wrote: How to get the that file itself?
Are you referring to the sectors on the disk that represent that file?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hii
In my application , wanna copy all files from one partition to another partition.
First I copied a file that I taken default and copied to another partition.
The above operation is done by using the control code "FSCTL_GET_RETRIEVAL_POINTERS".
The clusters used are read and wrote into destination volume using readfile() and writefile() windows functions.
Now I gotta copy all files.....
So how to proceed ....??
|
|
|
|
|
krish_kumar wrote: Now I gotta copy all files.....
So how to proceed ....??
If you can successfully copy one file, why can't you copy more than one?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
i am working on SDI based application. in view area i draw four square, i am reading the data from the file,and plot that data in separate square. the problem here is that that the graph which plot goes out of that square area.which is not desired. i want to plot that graph in the square area without any alternation in the graph,i mean i want to fix this graph within that square area without changing the size of the data.
kkkljj
|
|
|
|
|
I'm not a 100% sure if I understand what you want.
::SelectClipRgn() or CDC::SelectClipRgn() can be used on a device context to allow drawing only inside a specific shape (a rectangle in your case). Use ::CreateRectRgn() or CRgn::CreateRectRgn() to create your valid drawing area.
|
|
|
|
|
To map the data image to the window client area you need the following values
int xMinData;
int xMaxData;
int yMinData;
int yMaxData;
(as maximum and minimum values of the bounding rectangle of the data image)
then perform (assuming your client area is {0, 0, widthWnd-1, heightWnd-1}:
xWnd =(int) (((double) xData - xMinData) / (xMaxData-xMinData) * widthWnd + .5);
yWnd =(int) (((double) yData - yMinData) / (yMaxData-yMinData) * heightWnd + .5);
formula correctness test is left to the reader
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
I'm fairly new to VC++ and I'm trying to develop a device manager type of utility.The problem I'm facing is with SPDRP_INSTALL_STATE property. Whenever I try to retreive this property I get the following error at compile time.
error C2065: 'SPDRP_INSTALL_STATE' : undeclared identifier
My syntax is:
SetupDiGetDeviceRegistryProperty(dInfoSet,&devInfo,SPDRP_INSTALL_STATE,&dwT,(PBYTE)&dwIS,sizeof(dwIS),NULL);
where dwIS and dwT are both DWORD.
I also tried the following syntax:
SetupDiGetDeviceRegistryProperty(dInfoSet,&devInfo,SPDRP_INSTALL_STATE,NULL,NULL,0,&reqSz);
szBuf=(char *)malloc(reqSz);
SetupDiGetDeviceRegistryProperty(dInfoSet,&devInfo,SPDRP_INSTALL_STATE,NULL,(unsigned char *)szBuf,reqSz,&reqSz);
Both give the same compilation error.I should also like to point out that the latter snippet works with other properties like SPDRP_DEVICETYPE. I've hit a dead end because of this as I need to know if the device is working properly.Any ideas?? Do I need to use cfgmgr32.h ?(Although I doubt it) Please help
|
|
|
|
|
Do you have an old SDK? I don't know, but both values are defined in setupapi.h on my installation (w/o any #ifdefs)
#define SPDRP_DEVTYPE (0x00000019) // Device Type (R/W)
#define SPDRP_INSTALL_STATE (0x00000022) // Device Install State (R)
|
|
|
|
|
Well it must be old since it is the setupAPI.h that originally came with VC++ 6.0.0.8167 in 1998. And I checked the setupAPI.h and it doesn't have SPDRP_INSTALL_STATE property defined in it. So what should I do? Should I download new setupAPI.h and setupAPI.lib files to replace the old ones? Wouldn't there be any compatibility issues then? Even the SetupDiGetClassDevsEx in this header uses 6 parameters instead of 7 as in the newer version. But it works fine so I didn't bother!
|
|
|
|
|
It sounds a bit risky just updating parts of the SDK. There could in theory be other dependencies you don't know of. On the other hand, it might just work perfectly.
Advice you, I will not.
|
|
|
|
|
callousfantom wrote: So what should I do? Should I download new setupAPI.h and setupAPI.lib files to replace the old ones?
Visual Studio 6 is a very old development platform which was released way before even Windows XP was available. It is a very good IDE and there are many software developers still using it. You need to bring it up-to-date. I highly recommend the following:
1.) Install Visual Studio service pack 6[^]
2.) Install Windows Server 2003 Platform SDK[^]
The Windows Server 2003 PSDK was the last SDK which was guaranteed to be compatiable with VC6... if you want to try a later SDK your on your own.
Best Wishes,
-David Delaune
|
|
|
|
|
Thanks guys! I upgraded using the service pack 6 and used the latest SDK and that solved the problem
modified on Wednesday, June 17, 2009 1:23 AM
|
|
|
|
|
Hi,
When trying to use insertbefore() method to insert a node from an xml file to other Xml file the node is getting deleted from the old Xml file...
Please help me regarding the same..
|
|
|
|
|
How about clone()ing the node first?
|
|
|
|
|
please let me know how to do clone() ing the first node....
|
|
|
|
|
Call IXMLDOMNode::cloneNode() on the node you get from the source document.
|
|
|
|
|
im getting the address of source node into MSXML::IXMLDOMElementPtr how to use the ptr in clone method..
|
|
|
|