|
Hello,
Please help to get thumbnail image from CImage object and save on drive in ATL project. I have :
CImage Chart;
Chart.Attach(hBit);
How to resize Chart? How to save it?
Regards,
Leonid
|
|
|
|
|
Anonymous wrote:
How to resize Chart?
CImage::StretchBlt()
Anonymous wrote:
How to save it?
HRESULT CImage::Save(
IStream* pStream,
REFGUID guidFileType
) const throw();
HRESULT CImage::Save(
LPCTSTR pszFileName,
REFGUID guidFileType= GUID_NULL
) const throw();
"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
|
|
|
|
|
Hello,
I am trying to write a filter which reads an XML file, applies some modifications, and then writes the result to a file. I am using the MSXML lib and visual studio 6.0.
The solution I have found is to read the XML file (SAXXMLReader), apply the modifications (SAXXMLFilter), and then writes the result to a file (MXXMLWriter). Finding examples and docs about this is not easy.
For know, I found an example about connecting the reader to the writer and one about connecting a "contentHandler" to the reader. But I did not found much about how to put a content handler in between the reader and the writer.
All I found by now about the SAXXMLFilter, is :
http://msdn.microsoft.com/msdnmag/issues/1100/xml/
which is in VB, and tranlating is not an easy step for me, as I am a newby in the Windows coding.
Is there a best way that using a filter ? Is there an already implemented XMLFilter to which I could just plug "myContentHandler" and send the result to the MXXMLWriter ? Does anyone knows where I could find an example in c++ with a SAXXMLFilter ?
Thanks in advance for the help.
Regards,
Pedro_
|
|
|
|
|
Hi all,
I would like to ask you how I can get number of disks connected to the PC.
HDD can be connected to the system over USB or directly on the motherboard.
For example:
system HDD and one HDD connected over USB are 2 HDDs.
Thanks for your help.
Petr
|
|
|
|
|
|
Wouldn't that get, as the name suggests, the Logical drives?
So if you had only one hard drive but in 3 partitions, you'd get the wrong result (3 instead of 1)?.
Also, this returns a bitmask of available logical drives I think, so for it to work you'd need to mask off bits 0 & 1 (drives A & B which are usually FDD), and count up the number of set bits.
How to get the number of physical drives? Not sure. Hmm. Where's my MSDN cd?
|
|
|
|
|
|
icabod wrote:
Wouldn't that get, as the name suggests, the Logical drives?
yes. but it might be sufficient for whatever the original poster is trying to do.
and it seems to me that wanting to know the number of logical drives is more likely than wanting to know the number of physical drives.
icabod wrote:
so for it to work you'd need to mask off bits 0 & 1 (drives A & B which are usually FDD), and count up the number of set bits
but that's pretty easy.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
To get the number of physical, not logical, drives in the system, you simply need to use the Win32_DiskDrive class.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Here is a code I'm using. It creates a bit-list of the found removable drives in a system. I accept USB hard drives as removable, though they are not considdered as such by Windows.
Modify it to make it function th way you want it.
Kakan.
The code:
long GetNumberOfRemovableDrives()
{
int i;
char sDrivePath[3];
UINT uDriveType;
DWORD dwDrives;
fRemovableDrives = 0;
int noOfDrives = 0;
dwDrives = GetLogicalDrives();
strcpy(sDrivePath+1, ":\\");
// Loop throu the found (logical) drives
for(i = 0; i < 32; i++) {
if(dwDrives & (1 << i)) {
// Create sDrivePath
sDrivePath[0] = (char) ('A' + i);
uDriveType = GetDriveType(sDrivePath);
if((uDriveType == DRIVE_REMOVABLE || uDriveType== DRIVE_RAMDISK)) {
// It's a removable or a RAM-DISK, add it to the list.
fRemovableDrives |= (1 << i);
noOfDrives++;
}
else {
if(uDriveType == DRIVE_FIXED) {
// Accept DRIVE_FIXED if it's a USB unit.
// DRIVE_FIXED means: The disk cannot be removed from the drive.
char szBuf[10];
HANDLE hDevice;
PSTORAGE_DEVICE_DESCRIPTOR pDevDesc;
sprintf(szBuf, "\\\\?\\%c:", sDrivePath[0]);
// Open with "Zero rights". Is supposed to work at all times
hDevice = CreateFile(szBuf, 0,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, NULL, NULL);
if (hDevice != INVALID_HANDLE_VALUE)
{
pDevDesc = (PSTORAGE_DEVICE_DESCRIPTOR)new BYTE[sizeof(STORAGE_DEVICE_DESCRIPTOR) + 512 - 1];
pDevDesc->Size = sizeof(STORAGE_DEVICE_DESCRIPTOR) + 512 - 1;
if(GetDisksProperty(hDevice, pDevDesc))
{
if(pDevDesc->BusType == BusTypeUsb)
{
It's an USB drive!
fRemovableDrives |= (1 << i);
noOfDrives++;
}
}
delete pDevDesc;
CloseHandle(hDevice);
}
}
}
}
}
return noOfDrives;
}
BOOL GetDisksProperty(HANDLE hDevice, PSTORAGE_DEVICE_DESCRIPTOR pDevDesc)
{
STORAGE_PROPERTY_QUERY Query; // input param for query
DWORD dwOutBytes; // IOCTL output length
BOOL bResult; // IOCTL return val
// specify the query type
Query.PropertyId = StorageDeviceProperty;
Query.QueryType = PropertyStandardQuery;
// Query using IOCTL_STORAGE_QUERY_PROPERTY
bResult = ::DeviceIoControl(hDevice, // device handle
IOCTL_STORAGE_QUERY_PROPERTY, // info of device property
&Query, sizeof(STORAGE_PROPERTY_QUERY), // input data buffer
pDevDesc, pDevDesc->Size, // output data buffer
&dwOutBytes, // out's length
(LPOVERLAPPED)NULL);
return bResult;
}
-- modified at 2:51 Tuesday 11th October, 2005
|
|
|
|
|
Is there anyway to detect programmatically,whether the change in systemtime is due to daylight saving or because someone else has changed it?
It would be great help, if anyone can suggest some method, API or algorithm to do this!
Thanks
Arun
|
|
|
|
|
ArunKumar Yalamarthy wrote:
Is there anyway to detect programmatically,whether the change in systemtime...
Is systemtime a structure of some sort? Where/how does it get changed?
Have you looked at the various time-related functions like GetTimeZoneInformation() ?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
i don't know who's voting people down today ; i've also been here[^]. so, here is my '5' to balance that sucker, as your post worthes it.
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
|
broken link...
please use [Get Link]...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I dont know why it didnt work for you, but it worked for me though.
Anyways, I never figured how [get link] works,
So to view my suggestion,
goto the suggestion forum and read the Email Notification thread.
-prakash
|
|
|
|
|
Mr.Prakash wrote:
Anyways, I never figured how [get link] works,
two ways :
either you click on it (it loads a new page which you copy the address - on the address bar),
or you right-click on it ans copy the address from the property dialog...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote:
two ways :
either you click on it (it loads a new page which you copy the address - on the address bar),
or you right-click on it ans copy the address from the property dialog...
Thanks.
-prakash
|
|
|
|
|
I was refering to time shown by system as "systemtime", Some places observe Day Light Saving,for Example when you see GMT-6:00, U.S and Canada,...zone, you can see that there is an option called "automatically adjust clock for daylight saving "when we select this, on a certain well known day system time
changes by one hour automatically, for eg: in GMT-6:00 we can see on first sunday of april, system time jumps from 1:59:59am to 3:00am, my question is how to detect changes like this is due to this windows option or someone has manually changed it?
Thanks
Arun
|
|
|
|
|
Ok, I got the answer, we can use the follwoing
DayLightSaving detection techniques:
1.In windows XP,we can implement WM_TIMECHANGE handler and in this handler we can call
GetTimeZoneInformation() to obtain Bias value,The bias is the difference, in minutes, between Coordinated Universal Time (UTC) and local time, and this value changes when DayLightSaving event or TimeZone change event occurs.
2.Other workaround, where WM_TIMECHANGE does not work for DayLightSaving, you can monitor the value of ActiveTimeBias in following key HKLM\System\CurrentControlSet\Control\TimeZoneInformation. you can monitor it using RegNotifyChangeKeyValue() function.These values also change when DayLightSaving event or TimeZone change event occurs.
If we want to know whether change in system time is due to change in timezone or Day Light Saving, you can monitor the value of name of timezone, that is "Standard Name". if there is no change in timezone name but if there is change in bias time
it is due to day light savings event.
Thanks
Arun
|
|
|
|
|
Hi,
i am compairing the last modification date of a file on FAT file system and the same file on NTFS file system. But the date is not matching. Can anybody tell me how to do that correctly. I am retreiving the date from WIN32_FIND_DATA structure.
Thanks.
|
|
|
|
|
ashtwin wrote:
But the date is not matching.
Could it be because the date/time properties of the files are different?
What does the code snippet look like that is doing the comparison?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Because of the way fat stores times (rounded to the nearest two seconds) there may be a 2 second difference between NTFS and FAT times.
John
|
|
|
|
|
Also NTFS stores file times to somthing like 10-7 seconds so compairing will be dificult. I would abs to less than 3 or 4 seconds.
|
|
|
|
|
Hi,
i am comparing the same copy on both FAT and NTFS. I think it is because of DST. Can anybody give me some idea about DST(day light saving).
|
|
|
|