|
try GetFinalPathNameByHandle.
-Saurabh
|
|
|
|
|
Hi Saurabh,
Thanks for the reply,
But it gives me errors
error C2065: 'GetFinalPathNameByHandle' : undeclared identifier
E:\Refrence Project Folder\TBHook\TBHook.cpp(106)
error C2065: 'VOLUME_NAME_NT' : undeclared identifier
I am using Visual Studio 6.0
Can you tell me what could be the reason?
Is it possible any other way?
ritz1234
|
|
|
|
|
It will work only in Vista.
If you want to get the file name in XP, you have to use NtQueryObject[^]. You have to dynamically load the function from ntdll.dll
|
|
|
|
|
ritz1234 wrote: But it gives me errors
ritz1234 wrote: Can you tell me what could be the reason?
Did you look at the Requirements section for this function in the documentation? It says:
Client Requires Windows Vista.
Server Requires Windows Server 2008.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
This [^] looks promising.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
ritz1234 wrote: File handle?
What do you mean by that?
Can you try to give us some kind of a clue? How did you create a file? Did you use CFile? Did you use C-Style FILE?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Thanks for the reply friends,
Actually I've WH_CBT hook for my application.
That give me the handle of the file whenever the file is going to close
in the system.I want the path of the file to identify the file to which I
should concern.
Will let you know whose solution will work.
Thanks very much for helping.
ritz1234
|
|
|
|
|
ritz1234 wrote: Actually I've WH_CBT hook for my application.
That give me the handle of the file whenever the file is going to close
You mean your hook function will be called when ever user closes a file in that application . I never heared about that...
|
|
|
|
|
This hook is a system wide hook.
Whenever any file in the system is going to close the HCBT_DESTROYWND is
sent to the filter function of CBT_HOOK.
I want my application will be notified whenever any file in the system is
going to be closed.If you have any other solution, let me know.
ritz1234
|
|
|
|
|
ritz1234 wrote: Whenever any file in the system is going to close the HCBT_DESTROYWND is
HCBT_DESTROYWND is send to filter function, when ever a window is closed, not while Closing a file.
|
|
|
|
|
If any other information is there with you,Please forward it to me.
2 more question if possible.
1)
I've created the MFC extension DLL. My Idea is to whenever the filter
function notified the event of File Closed I want to find and copy the
path of the file in a variable, And there will be a function that returns
the path stored in the variable. What do you think?
2)
If I want to create the COM DLL instead of the MFC extension DLL,then I
have to add One CoClass in the DLL.In this CoClass I am thinking of
adding a function that installs the hook. For installing the hook I've to
use the SetWindowsHook function,In this function I've to Give the
HINSTANCE of the dll as the first argument. So the Question is How do I
provide my Coclass the HINSTANCE of the COM DLL.
ritz1234
|
|
|
|
|
ritz1234 wrote: And there will be a function that returns
the path stored in the variable. What do you think?
Its ok. Keep in mind that the variable should be kept in shared section.
ritz1234 wrote: So the Question is How do I
provide my Coclass the HINSTANCE of the COM DLL.
Why should you go for COM dll, while an ordinary dll will fit?
How ever I still remind you that, your hook function will not be called when ever a file is closed in an applicaiton . First check that, then only you need to think about further things..isnt it..
|
|
|
|
|
Thanks for the help buddy.
Actually I've tried using the variable that is global but not shared so
this doesn't give me the reuslt as expcted.So i've find out that I should
use the shared variable here.
Answer of your question.
1)I am going to use this DLL in the toolbar that will be developed next.
Because this is the MFC extension DLL I think It won't work with ATL.
That's why I think I have to write a COM dll that will Install,Uninstall
the hook. And will give me the path of the file that is closed upon
periodically calling this function. So seriously there is any way to use
HINSTANCE of COM DLL in CoClass?
ritz1234
|
|
|
|
|
ritz1234 wrote: Because this is the MFC extension DLL I think It won't work with ATL.
No need to worry, it will work..
|
|
|
|
|
Hi All,
Just like Sun certification Exams for JAVA. Is there any Certification Exam for VC++ Professionals conducted by Microsoft.
Please give me the Information about this.
|
|
|
|
|
G.L.Prasad wrote: Is there any Certification Exam for VC++ Professionals conducted by Microsoft.
No, not any more. They'll give out certificates only on .NET now.
If you have the skill, I don't think you will ever need such a certificate. But that's just my opinion.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: If you have the skill, I don't think you will ever need such a certificate. But that's just my opinion.
And having the certificate doesn't always imply you have the skills (but this is going on my arrogant...).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
So, let's arrive on a conclusion. Having a certificate and having the skills. They're mutually exclusive.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Or, using other words: certificate skills and VC++ ones are somewhat different.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Rajesh R Subramanian wrote: They're mutually exclusive.
mutually inclusive
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
How to check for or assign the positive/negative infinitive to an int variable?
Thanks,
Suman
--
"Programming is an art that fights back!"
|
|
|
|
|
There are no infinities for int.
Maximum value of int is 2147483647
Minimum value of int is -2147483648
These are defined as INT_MAX and INT_MIN in the limits.h headers file. These files are VC++ specific, if you need portable way to getting these numbers then try numeric_limits class in c++.
-Saurabh
|
|
|
|
|
The values I gave are based on 32 bit int's. Since size of int is not same for all platforms, you should not directly use them. Instead use macros defined in limits.h file.
-Saurabh
|
|
|
|
|
Are you kidding?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
rp_suman wrote: positive/negative infinitive to an int variable
Did you mean to say float or double?
|
|
|
|