|
This question has been asked here a gazillion times, so please use the search function before posting...
Regards,
mav
|
|
|
|
|
Hi
I save my documents in a database. While opening them, I make a copy on the local hd and open them. But how can I know, when the user has finished with the changes and closed the document, so I can save them back to the db?
Is there something like a file open check?
At least the office programms have kind of a lock, so only one user can open the document. Can I use that - and if yes, how?
Thank you
Adrian
|
|
|
|
|
Hi!
There's no general "data from this file still in use" flag.
As long as a file has been opened by an application, Windows will know that the file is open, but usually an application will close the file as soon as it's been read. While you're working with the data, the file is closed, so there's no general way to know when you've finished manipulating the data.
Each application has to decide for itself if and how to maintain file locks.
For Office documents there might be properties to find out the user who has opened a document recently, but I'm not sure.
For other documents each application will most likely behave differently.
Regards,
mav
|
|
|
|
|
I can think of following workaround
Create a copy of your current file in memory, then try to delete it, (see MSDN File.Delete Function) if it throws the IOException, the file is still in use .
if it's deleted, write your in-memory version to db.
Good luck.
No hurries, no worries.
|
|
|
|
|
That won't work!
Imagine a plain text file that's being edited with Notepad.
The file will only be in use while Notepad actually loads it. This takes a fraction of a second, after that your "workaround" would save the file back to the DB, albeit the user didn't even have a chance to modify the text or save the changed file!
mav
|
|
|
|
|
Im checking a workaround by watching the process I had started. It doesn't work always, because most of the programs, like word, don't create a new process when they'r already open.
|
|
|
|
|
ok tnx, but there should be a way for checking if a file is in use, no?
No hurries, no worries.
|
|
|
|
|
There is a check, and usually the easiest way to check is to try to open a file exclusively. If this fails, then usually another process has the file in use.
But the main point is that "file is in use" is not the same as "the data inside the file is being modified".
mav
|
|
|
|
|
The process watcher version doesn't work neither. The problem is, that many programs immediately delecate the file to another process and stop the first one. By office programs I even never get the process.
|
|
|
|
|
That's what I'm saying. There is no general way, sorry.
mav
|
|
|
|
|
|
Hello,
is it possible to use datagrid component of .net 2005 in .net 2003?
if yes, please tell me how??
|
|
|
|
|
The short answer is No, that DataGrid requires 2005 to run. The 2003 compilers will not work with the 2005 .NET Framework. You'd have to write a remoting wrapper around the DataGrid class. The more I think about it, the uglier it gets.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello Everyone:
I have posted the same question in managed C++ board.
This is my problem:
I have C# project compiled as a DLL. The C# class is defined as:
public Cs_Class
{
String name;
public Cs_Class(String n)
{ name = n; }
....
}
I have another MC++ project that uses the DLL. The MC++ class is defined as:
public Cpp_Class
{
....
void Test(String* testStr)
{
//Create the c# class
//
Cs_Class* c = new Cs_Class(testStr);
}
}
The compilation/linking was fine. I then encountered a run-time exception:
System.MissingMethodException: Method not found: Cs_Class..ctor(System.String)...
Strangly enough, if I took out the String parameter in Cs_Class constructor and not pass in String* in MC++ class when constructing the Cs_Class object, then everything was fine.
Why??
Thanks in advance.
David
|
|
|
|
|
To hence forth the problem is to dematerialize the occasion of being interpeticular of yomessing
|
|
|
|
|
I'm not a native english speaker either, but this seems to come from a translation program and has completely lost its meaning in the process of translation.
Am I correct? And if I am, which translation service was used and what was the original phrase?
:->
mav
|
|
|
|
|
Hello,
I am not sure I understand what you meant here. Can you explain your point in plain English? Thanks
|
|
|
|
|
I want to compile a existing c# class file, inside another program. I used the Following code. But it does not give any outputs. can you tell me a correct way to do this. thanks.
Process pr = new Process();
pr.StartInfo.FileName = "csc.exe";
string filePath = "D:\\Dilan Projects\\Application3\\LabelWriter.cs";
pr.StartInfo.Arguments ="/out:cl_labelservice.dll /t:library " + filePath;
pr.Start();
this code not working.
|
|
|
|
|
'not working' is kind of enigmatic. What's going wrong ? Best guess - you need to specify a path to csc.exe
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Do you see a console window opening up? Did you try redirecting standard output and error to see what's actually going on?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Have you taken a look at the ICodeCompiler interface or the CSharpCodeProvider class?
They offer services to compile code on the fly without having to find out where the compiler actually lives.
Regards,
mav
|
|
|
|
|
Hi,
Anybody here using vs 2005 beta 2 yet? What do you like about it over vs 2003? I hear the integration with the new sql server 2005 is alot better. Is anyone here using Reporting Services 2005 as well. If so what do you think about it?
Thanks,
JJ
|
|
|
|
|
It's awesome. I've been using it for a while, and the new language features rock, and some of the new IDE features are amazing as well.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Totally agree with what you said.
What ever people say about Microsoft, but .Net 2.0 ROCKS!!!
Regards,
Sidhu
IF YOU DON'T HAVE ANYTHING TO SAY, WELCOME TO THE CLUB
Dotnet @ Work Where Dotnet works...
My Blog
|
|
|
|
|
Hi all.
Certainly almost of you know how to pass custom data to the application during installation ok
this happened by adding custom dialog with text boxes to hold these variables and change them .
Ok i don't need to know how to pass custom data cause i know it already .
But each time you double click the installer.exe file that had been created it gives you the custom dialog that you added to enter new information and each time you begin installation again it will demand from you new information ok.
But i don't want that, i need to make an executable file that you can open it and then enter these values in text boxes and press a button which creates these values in the installer.exe and then you can double click the installer.exe which is already created and install it without requesting these values again .
Miss With The Best And Die Like The Rest
|
|
|
|