|
How about GetFileSize() ?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
hi David
as I see GetFileSize() needs HANDLE to a file as a parameter , that means as i know I need to open the file for reading at least.
I need to retrieve sizes of files in loop. I did it by opening them and calling GetLength method, but it seemd ugly
<br />
for(...)<br />
{<br />
CFile file<br />
file.Open(path,CFile::modeRead)<br />
Length[i] = file.GetLength()<br />
file.Close()<br />
}<br />
Is not there any API like this for example?
ULONGLONG GetFileSize(LPCTSTR sPath);
or any more convenient way?
thank you
|
|
|
|
|
big_denny_200 wrote: I did it by opening them and calling GetLength method, but it seemd ugly
But does it work, and is it easy to understand both now and in the future?
big_denny_200 wrote:
Is not there any API like this for example?
There's also _stat() .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Call ::FindFirstFile() will the path. Do remember to close the handle and all that if it succeeds.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Hello.
I'm trying to make a pointer to a method of instance of some class, like this:
<br />
<br />
class Foo<br />
{<br />
public:<br />
void DoSomething(int a)<br />
{<br />
......<br />
}<br />
};<br />
<br />
int main()<br />
{<br />
typedef void MethodCallback(int a);<br />
<br />
Foo *x = new Foo;<br />
MethodCallback *MC = (MethodCallback *)x->DoSomething;
}<br />
<br />
Works only if I change to static method.....
Any idia how to do this correctly ?
Thanks,
David
|
|
|
|
|
Virtek wrote: // Throws an error!
which error
|
|
|
|
|
I believe you can't use what you have shown because of the objects 'this' pointer, thats why it works when you make it a static method.
Check these out:
Pointers to methods[^]
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
|
|
Thanks people.
I needed to pass a function pointer to an API function, and because i did a class-wrapping, i needed to pass the class member-function, but it's not possible (thanks for clearing my eyes about the "this" pointer issue...)
|
|
|
|
|
Edit2 Sounds like nmake doesn't ship with just the compiler and linker tools - sounds like I have to download the SDK as well???
Edit I should note that vcvars32.bat has been run...
I've downloaded the free Visual C++ toolkit from MS web site: http://msdn.microsoft.com/visualc/vctoolkit2003/[^]
I have an application which uses NMAKE.EXE but it doesn't seem to exists with just the toolkit???
Do I have to download and install the Visual C++ IDE Express version???
Thanks
It's frustrating being a genius and living the life of a moron!!!
-- modified at 12:08 Thursday 13th April, 2006
|
|
|
|
|
I try to run my application on one XP PC without visual studio 2005 installed, but failed, the error is like "cannot initialize properly" or "the application is not installed correctly".
So I try to run an application that is built from MFC wizards, without any change of the codes, the same problem happens to me, even i intall the framework 2.0.
One way to make it work is to compile it in MT mode, the other is install vs2005 on that PC, but I don't think these are the final solution, could anyone help me?
-- modified at 10:04 Thursday 13th April, 2006
The application is developed by vs2005 in windows 2000
|
|
|
|
|
the error might tell you that a DLL is missing.
provide these dll with your exe.
|
|
|
|
|
hi, thanks for your help.
I have tried copy all the dlls that i see from the dll dependency, but it can't work, as i know, in vs2002/vs2003, we only need to copy mfc70.dll and msvcr70.dll (maybe this name), but it looks not the same to vs2005. I even install the framework 2.0 actually.
|
|
|
|
|
|
Not only. With VS2005, they included a mechanism with manifest files. I cannot explain how it works but the only thing I can say is that it is much more complicated to deploy your applications.
|
|
|
|
|
WTF did they do that for ?!
|
|
|
|
|
It is kind of complicated. In fact it is done (if I'm not wrong) to avoid dll hell problems (problems with versioning of dll's). I don't know exactly who it works but this mechanism was already available for 2003 but it was optional. Now it is no more otherwise nobody would use it.
|
|
|
|
|
|
|
Have you checked with the service pack of XP? Is it the latest?
|
|
|
|
|
Hi all, great thanks for your help, it works now^_^
It looks that i didn't put "Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT" and "Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.MFC" to the exe folder. So easy, so complicated...
Best regards/Lu Weiwen
|
|
|
|
|
Hi All
I need to write some application that will be work in the background of the task manager and will "here" all keyboard event.
In case that the user press on the key ALT+T the application will be do something ( like open some WAV file ).
I don't know how i start this application....
My question are :
1.How my application will work in the background of the operation system and "listen" to all keyboard click ?
2.How can i "here" all click without intercept all other application in the background to get also the keyboard event ?
3.I need this application to run on every start up of the machine - how do i do it ?
4.Where/how can i found any demo code that i can see it ?
Thanks for any help.
-- modified at 9:29 Thursday 13th April, 2006
|
|
|
|
|
See if SetWindowsHookEx() is of any help.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Thanks ,
But i need something with more interpret.
|
|
|
|
|
yanshof wrote: But i need something with more interpret.
Huh? Interpret is a verb, not a noun. How can something have more interpret?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|