|
Just FYI, this really does work, and is infact the basis of the template design pattern. Where I went wrong: class A was written by somebody else (in this case it was part of WTL written by Microsoft). I thought it was virtual, it wasn't. If it was virtual it would've worked, as I've now found out.
Why it works: The method in class B that calls the virtual function is calling it on the this pointer. Thus, the virtual table is used to figure out which version to call, so even though class B doesn't know about class C, class C's definition of the function is used. Pretty cool when you do it right.
|
|
|
|
|
Dear all,
In Win2k or XP platform, it's easy to get that information through function DeviceIoControl with code IOCTL_DISK_GET_DRIVE_GEOMETRY. However, that solution fails in Windows 98 because we cannot create a file name by CreateFile with file name "\\.\PHYSICALDRIVE0". Windows 98 fails to return a handle to any physical disks. So my question is how I get physical disk geometry in Windows 98. I need some information such as TracksPerCylinder, SectorsPerTrack... From those, I can calculate the actual size of a physical disk.
Thanks for reading my question.
Best regards.
____
Tuan
|
|
|
|
|
Tuan Dang wrote:
So my question is how I get physical disk geometry in Windows 98. I need some information such as TracksPerCylinder, SectorsPerTrack... From those, I can calculate the actual size of a physical disk.
How about GetDiskFreeSpace[Ex]() ?
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
How can I use this function in case of PhysicalDrive? I don't know what the first parameter syntax is?
However, those function doesn't return any information for getting attributes of a physical disk such as NumberOfCylinders, TracksPerCylinder, SectorsPerTrack...
Best regards.
|
|
|
|
|
You'll either need to iterate through each logical drive on the physical drive, adding the numbers for each, or create a virtual device driver to be used by CreateFile() .
You might also try looking at the WMI Win32_DiskDrive class, specifically the TotalCylinders and TracksPerCylinder properties.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Personally, I think the first solution is not the best. Examine this sample:
<--------------------------Physical Disk 1----------------------------->
<--Partition 1--->
(Primary)
C:
<------------Partition 2---------->
(Extended)
<---unallocated--->
<---------Logical Drive 1--------->
D:
You see, adding the size of all logical drives cannot give us the total size of the physical disk.
I will try your second suggestion. However, Win98 seems not to be supported. I think we don't have a complete solution for Win98 platform.
Thank you very much.
P.S: can I make a direct contact with you via email?
____
Tuan
|
|
|
|
|
Tuan Dang wrote:
You see, adding the size of all logical drives cannot give us the total size of the physical disk.
True, but in your example, why would you need the total size of the physical disk, since not all of it can be used anyway? For example, if you had an 80GB disk, 30GB for C: and 40GB for D:, that would leave 10GB of unallocated space. Until that 10GB is partitioned and formatted, it's of no use, so why include it in any totals? I'm sure you've got a reason for this, but it's not immediately obvious to me.
I wonder if you need to query the BIOS somehow to find out what it knows about the HD?
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Well, I got your idea. However, my need is very simple. In Windows 2000 and XP, I can easily get many of physical disk information such as number of Cylinders, TracksPerCylinder, SectorsPerTrack... But in Windows 98, I could not. That's why I posted my question. I think that such information was kept somewhere in the physical disk and was independent with platform. The problem is only the way to get them (depend on which platforms we do use).
About the total size, I think that in some cases, we also need to know exactly how big our physical disk is. That information may be helpful in many cases. Do you think so?
____
Tuan
|
|
|
|
|
Tuan Dang wrote:
About the total size, I think that in some cases, we also need to know exactly how big our physical disk is. That information may be helpful in many cases. Do you think so?
Sure. For applications that partition/format disks, you might have a "This disk is 80GB in size, but only 70GB of it has been formatted. Would you like to format the remaining 10GB?" prompt. I've not ever done such work, though.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Go back to my major problem. In Win98, can I get such information as total Cylinders, TracksPerCylinder...?
Best regards.
____
Tuan
|
|
|
|
|
Given the Windows 98 restriction, I know of no way. You might try posing your question to the microsoft.public.vc.language newsgroup.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Dear David,
How can I do that? I mean how i can post my question to that newsgroup?
BRs.
____
Tuan
|
|
|
|
|
I use Outlook Express. You can also use Google.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Well, this seems to be a trivial question, but it's giving me problems, so I've decided to claim for someone's help.
In a Win32/MFC application, some kinds of resource (as images, for example) are stored in independent files, wich can be easily accessed and modified. I pretend to have some of these resources encapsulated and/or secured in such a way that they are not trivially engaged by users. This surely implies to provide some kind of encapsulation in order to have not first-look recognizable files. But I was thinking, too, in adding such resources directly inside the executable file.
I don't know if I've explained this clearly enough, and I know that my English is too far from correctness. But if someone could help me, no matter in what way, I'd be very pleased. Thanks for all.
|
|
|
|
|
I want to get a handle of a thread of other process in the Win9x.
but th API OpenThread() only can work in Win2K or later.
The best I've managed to do so far is:
DebugActiveProcess()
while( WaitForDebugEvent(&debug_event, ...))
{
....
ContinueDebugEvent()
}
Which will enumerate every thread in a process, filling a DEBUG_EVENT
structure with each thread's handle.
This works, but it's not the prettiest way to do it.
It also has the very unfortunate side-effect of attaching the process as a
child of this one.
What should I do ? Please help me , Thanks a lot!
|
|
|
|
|
Interesting.
As far as I know, you cannot get a handle to a thread from another process because of security reason. The only way is if you spawn the process via CreateProcess(), etc.
Kuphryn
|
|
|
|
|
I met a problem in MFC extension dll creation and I write to seek your kind assistance.
I created two project: Main.dsw and server.dsw ;
[1] In Server.dsw, I defined a series of classes, derived from CObject, and implemented them with serrialization support;
[2] In Main.dsw, in the document class, I defined a TypedList like this:
typedef CTypedPtrList<coblist, cobject*=""> CActor;
void CXXXDoc::Serialize(CArchive& ar)
{
Actor.Serialize (ar);
}
I then added some objects in this document, all these objects are instances from Server classes;
The problem is, every time I save the document, and then reopen the saved document, a "Unexpected file format" error pops up.
I debugged into the code, and found that it occurs in CObList.Serialize();
However, if I do not encapsulate the classes into server.dll, instead, I directly use them in Main.dsw (I put the source code in main.dsw ), the serialization is ok. This is so strange. Can anyone give me some hints on this?
I have been working on this for half a month, and searched MSDN for quite a few days, will you pls give me a hand?
Your kind help is highly appreciated.
|
|
|
|
|
i need a mouse detector tool, especifically develop it,
because i'm a software developper, and i need to do it in my software, i hear about using direct driver access, but in this moment i dont know about driver develop or how to access it, if you know any way to detect a mouse presence in real time, please let me know it.
any thing to do ? where to find it, how to develop it ?
please help me and thanks a lot
------------------------------
christian s.
unhandledexception@hotmail.com
------------------------------
|
|
|
|
|
How about GetSystemMetrics(SM_MOUSEPRESENT) ?
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Hi there.
I'm having a problem with a project i'm currently working on.
I'm writing an MFC extension dll to simplify the reusability of code that i've written. The Project itself is called "STHDll" and i added all necessary
files to it. It currently has the two standard configurations (DEBUG and RELEASE).
In the Project's linker tab i use the following command line:
(Release)
/nologo /subsystem:windows /dll /machine:I386 /out:"../bin/STHLib.dll" /implib:"../lib/STHLib.lib"
(Debug)
/nologo /subsystem:windows /dll /machine:I386 /out:"../bin/STHLibD.dll" /implib:"../lib/STHLibD.lib"
Now if i compile it the linker gives a warning: LNK4070
STHLibD.exp : warning LNK4070: /OUT:STHDll.dll filename directive in .EXP differs from output filename "../Bin/STHLibD.dll"; ignoring directive
Now if i open the .exp file i only find references for "STHDll.dll".
Teh same is for the .lib file.
Can anybody help me with this problem, so that i can create the proper .exp
and .lib files?
Many Thanks.
Optimus Chaos
|
|
|
|
|
hi,
After I installed the latest PSDK ,
When I try to compile I get the message '...\rc.exe This program expects a newer version of windows'.
I am running ME.
what could be wrong with the resource compiler?
I am using VC6 SP5 , with latest platform SDK.
regards
Hari
Hari Krishnan
|
|
|
|
|
I have this same environment at home and have no troubles compiling (this is in contrast to Michael's comment about Microsoft disabling the product). Perhaps you need to reinstall SP5 with the thought that it might provide the "correct" resource compiler.
What happens if you run the resource compiler from a command prompt? Change to the C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin folder, type rc, and see if it gives you the "...\rc.exe This program expects..." or the RC1107 message.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
hi,
NOP, the same message. I copied rc.exe and rcdll.dll from visual stidio 6 to platform sdk/bin. It works ok, but i know it is not right.
Any thoughts ?
regards
hari
Hari Krishnan
|
|
|
|
|
pranavamhari wrote:
what could be wrong with the resource compiler?
MS purposely crippled it so it will not run on 9x/Me. If you have access to older Platform SDK CDs, go back to around Oct 2001 or so and grab the RC.exe from there.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0! | RightClick-Encrypt
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
-- Buffy
|
|
|
|
|
Hi,
How can I read raws and columns of a .csv file?
I would like to move from one column to the next,, how can I do that ?
Ehsan Behboudi
|
|
|
|
|