|
A file is either opened or closed by one or more processes. The mode in which it is open is a characteristic of the handle, which is owned by a process, not the file. (not all handles are owned by processes, but let's keep this simple.)
The bad news is: there is no API. You could have a go at the object manager[^] name space, but this requires the openfiles global flag to be on. Turning it on or off will require a reboot.
Short of that, you can only obtain the information in kernel mode, and that will require a device driver.
|
|
|
|
|
Do you mean the context menu of a file by this "file status(ie. open, close, edit)", or do you mean if a file can be accessed, opened for reading/writing, etc.? You can do that by calling _open[^]
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Just i want to get current status of the file. ie.
1) It is opend
2) It is Closed
3) It is modified
Thanx
|
|
|
|
|
You need to be more clear.
1) A file might be opened in the sense that there are handles of that file opened by one or more processes.
2) I don't know what you mean by "closed", is it that no process has opened the file currently?
3) A file has always been modified somewhere in the past, it might be a minute ago or a month ago or 10 years ago. That's how you create a file, you create it empty and then modify it. Do you mean that you want to get the date of last modification? What do you mean by "it is modified"?
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Accessing File Status (MFC)
Also, you can try CFile::GetStatus
CFile theFile;
char* szFileName = "X:\\TEXT.TXT";
BOOL bOpenOK;
CFileStatus status;
if( CFile::GetStatus( szFileName, status ) ) bOpenOK = theFile.Open( szFileName, CFile::modeWrite );
else bOpenOK = theFile.Open( szFileName, CFile::modeCreate | CFile::modeWrite );
http://msdn.microsoft.com/en-us/library/e3z63bza(VS.80).aspx[^]
.
|
|
|
|
|
yeah... but i need pure win32 API or any library function.
|
|
|
|
|
|
Hi All,
I am developing an SMS application using VC++ 2005 on Vista with Unicode character set.
Is it possible to find the language (i.e, either Chinese, English, french etc etc) of the incomming string?
That is, if I recieve an message in french language, I should be able to recognize the language as French just from the string itself. Are there any API's which will give me that info?
Thanks in advance.
|
|
|
|
|
Nope, nada, non. (*)
For that you would need an infinite corpus for all/most languages, you'd also have to be able to analyze said language based on no "hint" of a language so you'd need to have an analyser for all languages, and imagine also if a sentence used multiple words for multiple languages ...
I was thinking maybe CString could encode "something" to identify the string, but that you not make sense since there is nothing preventing you to use "latin" characters in a japanenese string and make a french sentence.
(*) probably someone will prove to the contrary, but I don't think so, that's why all online translation ask for in (and out) languages.
Watched code never compiles.
|
|
|
|
|
Hi all
Is there any freeware API for multisession cd and dvd burning in windows xp,vista and windows7
|
|
|
|
|
Hi,
I'm not sure of the internals of it (multisession, writing modes, etc.,), but the following two projects are open source:
CDRDAO[^]
Infra recorder[^] (This one is actually for Linux, but a windows version is done with cygwin)
Workout progress:
Current arm size: 14.4in
Desired arm size: 18in
Next Target: 15.4in by Dec 2010
Current training method: HIT
|
|
|
|
|
|
Hi
I am trying to register a Type Library (.tlb) on Windows 7 operating system.
I am having around 40 Type Libraries. Few type libraries are not getting to register. I have used command prompt for registering them using 'Run as an Administrator' BUT still it fails to registers. I am an 'Administrator' of the machine with UAC(User Account Control) disabled.
Those type libraries who succeeds display
"Registration of MyTypeLib.tlb successful"
But those who fails display
"RegisterTypeLib of MyOtherTypeLib.tlb failed : 8002801c". I have also used process monitoring tool, but not able to find any break through.
Can you please any sun light on this dark night.?
|
|
|
|
|
Hi
I am using a CComBSTR object.
CComBSTR bstrText;
bstrText.LoadString( MyStringID);
How do the object know that it has to pick up the string ID 'MyStringID' from XMLResource as we are not passing any Registry Key info to it.
Thanks in advance.
|
|
|
|
|
The LoadString() function loads a string resource which is encoded into the exe file, not from the registry. See here[^] for details.
It's time for a new signature.
|
|
|
|
|
|
Dear All,
I am unable to use the Api ::CreateFileMapping(...) in Windows7 Version and Vista for Elivated User.
Please give me solution for this. I have checked the Error using GetLastError(...) it is giving File AccessPermissions and the Error Code is 5. Please suggest an appropriate solution for this.
Thanks & Regards,
Uday.
|
|
|
|
|
Did you check the Access permissions? Is the file open in another process? Which file are you trying to map? Is it a real file, or do you use the paging backing store? If so, does the system have a backing store?
|
|
|
|
|
Hi,
It is working for Administrative User, But failed in for standard user with Administrative Privilages.
These is observed only on Windows 7 Version and Vista for 2003 and Windows XP working for standard user with administrative previlages.
Please provide me a solution for this.
Thanks,
Uday.
|
|
|
|
|
That's a different story than what you told us in the original question.
I will assume that it a real file, since you haven't answered any of the questions I asked you
Check the file permissions on disk, you will probably discover that it is limited to the administrators group.
You can either change the permissions, or run your program with elevation.
|
|
|
|
|
Hi,
I overriding the CWnd::OnSetCursor in CRicheditctrl which I use to to set my Cursor pos
via SetSel
Is there any other way to drive this notification besides a mouse movement
As it is the only way I have found of postioning my cursor
thankx
|
|
|
|
|
What exactly are you trying to do? You can position your cursor by calling SetCursorPos SetCursorPos[^]
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Didn't think it worked with rich edit
|
|
|
|
|
Hello,
Below codings gives error when I use extern "C" in my dll project.
extern "C" __declspec(dllexport) void Init(); // Gives error
__declspec(dllexport) void Init(); // Can work
extern "C" __declspec(dllexport) void Init();
EXTERN_C const IID DIID__IEventFiringObjectEvents;
template <class T>
class CProxy_IEventFiringObjectEvents : public IConnectionPointImpl<T, &DIID__IEventFiringObjectEvents, CComDynamicUnkArray>
{
extern "C" __declspec(dllexport) void Init()
{
T* pT = static_cast<T*>(this);
};
};
Using extern "C" gives below error message :
error C2059: syntax error : 'string'
Please guide me on how to include extern "C".
Thanking you in advance,
Goutam
|
|
|
|
|
You cannot use extern "C" with classes and templates .
What are you trying to do?
|
|
|
|