|
Does anyone have a clue how to update the current window you are in, the GUI that is built with Visual Studio.net MFC foundation class. The problem is I have a timer function that triggers and can take a minute or so to complete. Everything works fine unless I open say calculator, then close it. There is a hole in the GUI until the timer function completes. Is there a way of updating the window while inside the timer function. I am somewhat new to using Windows and MFC and I was wrong in assuming Windows handles it for you. I thought the purpose of using MFC was it would handle all this for you.
-- modified at 14:01 Monday 10th October, 2005
|
|
|
|
|
This would be better asked in the VC++ forum...not the Lounge.
Picture a huge catholic cathedral. In it there's many people, including a gregorian monk choir. You know, those who sing beautifully. Then they start singing, in latin, as they always do: "Ad hominem..."
-Jörgen Sigvardsson
|
|
|
|
|
tis not the lounge
|
|
|
|
|
This was in the Lounge when I saw it. Chris must have moved it.
Picture a huge catholic cathedral. In it there's many people, including a gregorian monk choir. You know, those who sing beautifully. Then they start singing, in latin, as they always do: "Ad hominem..."
-Jörgen Sigvardsson
|
|
|
|
|
The screen will not update because the thread that is doing your calculation is busy and this is the same thread that draws your screen. You can solve this problem in several ways. One way is to do your calculation in a second thread.
A second way is to use PumpMessage as in the following article:
http://www.codeproject.com/threads/TemplatedLengthyOperation.asp[^]
John
-- modified at 14:07 Monday 10th October, 2005
|
|
|
|
|
Folks
What is the right way to handle this warning:
warning C4018: '>=' : signed/unsigned mismatch
I am comparing the out of two functions, both of which aren't mine, and one returns int and the other returns unsigned. I know they both return positive integers practically - so whats the way to get rid of this compiler warning?
Thanks!
|
|
|
|
|
If you are certain that there will not be any range problems, you can cast one of the variables to the other's type.
if( DWORD( iValue ) >= dwValue ) <br />
if( iValue >= int( dwValue ) )
This will not work correctly if one of the variables contains a value that has the high bit set (e.g. a 32-bit integer value greater than 2,147,483,647).
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
|
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]
|
|
|
|