|
Dear All,
I need to find number of device drives (harddisk partitions) in a host ?
Is there any API to get this information ?
How can i do this ?
Kindly help me.
Thanks.
|
|
|
|
|
Sakthiu wrote: I need to find number of device drives (harddisk partitions) in a host ?
Look up GetLogicalDriveStrings , GetLogicalDrives .
|
|
|
|
|
Sakthiu wrote:
Is there any API to get this information ?
CNMPDriveClass[^]
"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
Support CRY- Child Relief and you
|
|
|
|
|
hi
i am facing memory & handle problem when my application invoke IXMLDOMDocument::load(), even i have used IXMLDOMDocument::Release() each time when i load new xml file, but its continuously increasing the memory and handle usage,
your help will be greatly appreciated
Thanks & Regards
neeraj
neeraj
neeraj
|
|
|
|
|
You got to live with "that". Try do create/delete the whole object.
Greetings from Germany
|
|
|
|
|
I have a simple, but yet important question. I'm trying to determine what the coordinate 0,0 would be on a system with three or more monitors.
I know that for dual displays, 0, 0 is still the top left of the primary (ie, the one with the taskbar). I assume it would be this way for three or more as well, but well we all know how assumptions go.
So, can someone with 3 or more monitors tell me if say -100, -100 is considered off screen or on screen? TIA
|
|
|
|
|
|
Well, I assume when it's three or more the resulting functionality would be the same as if it was eight or whatever. I'm not positive if there's no longer a concept of primary and secondary at that point. And seeing that I only have two monitors, kinda hard to test it out.
|
|
|
|
|
Jeremy Falcon wrote: And seeing that I only have two monitors, kinda hard to test it out.
Likewise.
I thought it was a trick question since you could use different coordinate systems.
My assumption is, by default, the upper left corner of the monitor configured as monitor 1 on
windows.
Good ? though
|
|
|
|
|
|
Gracias for the link! Saved that to my favs - i want 3 monitors
|
|
|
|
|
Mark Salsbery wrote: i want 3 monitors
Same here.
|
|
|
|
|
I recently posted an article about using multiple monitors Jeremy. The answer was there for you.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I just posted an article about using multiple monitors Jeremy. The answer was there for you.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
func1(int a,int b)
func2(int c, int d )
func3(aa,bb,(*fun)())
{
...
fun(aa,bb);
...
}
func4
{
...
if i=1
func3(a,b,func1);
else
func3(a,b,func2);
...
}
all functions are defined in class MyDoc.
When the program is compiled,there are two error in func4. They are in "func3(a,b,func1)" line and "func3(a,b,func2);" line.
The error is the following:
error C2440: '=' : cannot convert from 'int (__thiscall MyDoc::* )(int,int)' to 'int (__cdecl *)(int,int)'
what is the reason?how can i fix them?
thanks!
|
|
|
|
|
I'm going to guess func1 and func2 are members of a class (MyDoc) so they need to be declared
static or called through a MyDoc object.
Mark
.
|
|
|
|
|
thank Mark Salsbery for replying. But all functions are memebers of class CMyDoc, So i don't think they need to be called through a MyDoc object.
i have added the __cdecl to the functions following someone's suggestion.
now the code is following:
in MyDoc.h
typedef int (__cdecl CMyDoc::*pFunc)(CString ,CString ,CString ,CString ,BOOL);
int __cdecl func1(int,int);
int __cdecl func2(int,int);
in MyDoc.cpp
int __cdecl func1(int,int){...};
int __cdecl func2(int,int){...};
func3(int aa,int bb,pFunc fun )
{
...
fun(aa,bb);
...
}
func4 ()
{
...
if i=0
func3(a,b,func1);
else
func3(a,b,func2);
}
But now new erros appear in func3.
error C2064: term does not evaluate to a function taking 2 arguments.
it seems that the fun have not the pointer to func1 or func2.
Please help me! thanks!
-- modified at 9:32 Tuesday 5th December, 2006
|
|
|
|
|
tuqu wrote: But all functions are memebers of class CMyDoc, So i don't think they need to be called through a MyDoc object.
If they are not declared static then they HAVE to be called on an object. That's how C++ works
cdecl has nothing to do with this. That would be helpful if you are perhaps calling the functions
from another language (VB, etc.) or a library built with a different calling convention.
Anyway, since they are all in the same class you should have no problem calling a class member
function pointer from within the functions class.
tuqu wrote: error C2064: term does not evaluate to a function taking 2 arguments.
You've declared pFunc like this:
typedef int (__cdecl CMyDoc::*pFunc)(CString ,CString ,CString ,CString ,BOOL);
but you are calling a pFunc function like this:
fun(aa,bb);
The compiler is expecting you to pass 3 CStrings and a BOOL.
|
|
|
|
|
Mark Salsbery wrote: typedef int (__cdecl CMyDoc::*pFunc)(CString ,CString ,CString ,CString ,BOOL);
i'm sorry for my making a mistake. actualy my function have 5 parameters. in order to make it concise ,i reduced the function to having 2 parameters in the message.
can you give me a example that the function called on an object?
|
|
|
|
|
tuqu wrote: can you give me a example that the function called on an object?
// create a MyDoc object
MyDoc *pMyDoc = new MyDoc();
// call a MyDoc method
pMyDoc->func1(...);
|
|
|
|
|
Thanks a lot.
I changed my code as following:
in MyDoc.h
typedef int ( CMyDoc::*pFunc)(CString ,CString ,CString ,CString ,BOOL);
int func1(int,int);
int func2(int,int);
in MyDoc.cpp
int func1(int,int){...};
int func2(int,int){...};
func3(int aa,int bb,pFunc fun )
{
...
fun(aa,bb);
...
}
func4 ()
{
...
// create a MyDoc object
MyDoc *pMyDoc = new MyDoc();
if i=0
func3(a,b,pMyDoc->func1);
else
func3(a,b,pMyDoc->func2);
}
now i have the following errors:
error C2475: forming a pointer-to-member requires explicit use of the address-of operator ('&') and a qualified name
This error appear in func4.
error C2064: term does not evaluate to a function taking 2 arguments
This error appear in func3.
Are there something wrong with the line of func4 which is "func3(a,b,pMyDoc->func1);" or "func3(a,b,pMyDoc->func2);"?
|
|
|
|
|
You still have your pFunc type defined as a pointer to a function that takes 4 strings and a BOOL
as parameters and returns an int.
Yet, you are trying to call through pointers to functions that take 2 ints as parameters and return
an int. Even if you make them match, you have the problem of passing the implicit "this" pointer.
You are stripping so much out of your code it's difficult to put something together but
I tried anyway. See if any of this helps:
class CMyDoc
{
public:
CMyDoc() {}
static int func1(int,int);
static int func2(int,int);
};
typedef int (*pFunc)(int,int);
int CMyDoc::func1(int,int)
{
return 0;
}
int CMyDoc::func2(int,int)
{
return 0;
}
int func3(int aa,int bb, pFunc fun )
{
return fun(aa,bb);
}
int func4 ()
{
int i = 0;
if (i==0)
return func3(1,2,&CMyDoc::func1);
else
return func3(1,2,&CMyDoc::func2);
}
|
|
|
|
|
oh,it works;
Thank you very much!
At first, i did not notice the key of "static", so i think it doesn't work.
Finally,i noticed it. I modified my code. Then the project is built successfully.
-- modified at 7:14 Thursday 7th December, 2006
|
|
|
|
|
hi..
I have perpared a grid and done its panning, I have set its Mapping mode to MM_ANISOTROPIC and set unit as inches. It scrolls well when I am doing panning and draws a grid accordingly but it shows flickering. I have used double Buffering for it Where Flickering is stoped but the Grid is Constant now. I have set the Mapping mode of the new DC also. In the output its origin is shifted now and the area where grid is shows is also constant
plaease tell me how to correct the code so that it start working with double Buffering also..
|
|
|
|
|
My goal is to use the process to access itself on the hard disk and modify its own physical code content permanently. I have adjusted token privileges to SE_RESTORE_NAME in an attempt to overwrite while bypassing the ACL, but trying to open the file gives me error 32 (The process cannot access the file because it is being used by another process.) in which the process protecting the file is the one trying to mod it. I know this is not a good practice of code and for commercial means and unspecific means it is horrible to use but I need to create code like this specifically. Does anyone have any ideas on how to?
|
|
|
|
|