|
fiaolle wrote: Can you give me a code example
I don't have any. I suggest you read MSDN, and use Google. It has nothing to do with Word, Mouse.Capture is a general-purpose tool.
|
|
|
|
|
Hi
I'm sorry I haven't found anything that helps me or I'm not understanding the examples. Is there anybody who can help with some code how to do this.
Please
Thanks
Fia
|
|
|
|
|
Hi
Thanks for all the replies. I have found a solution.
Microsoft.Office.Interop.Word.Application ap;
Microsoft.Office.Interop.Word.Document doc;
ap = new Word.Application();
ap.WindowSelectionChange +=new ApplicationEvents4_WindowSelectionChangeEventHandler(ap_WindowSelectionChange);
doc = ap.Documents.Open(path, ReadOnly: false, Visible: true);
private void ap_WindowSelectionChange(Microsoft.Office.Interop.Word.Selection Sel)
{
}
When I click in the doc I have opened the event ap_WindowSelectionChange runs.
Fia
|
|
|
|
|
Hello working on this software is I got the idea for a feature that let me configure the types of data that can to copy flash memory, someone has any idea of how to solve this. Use Visual Studio 2008 c#.NET 3.5
modified 11-Oct-11 10:59am.
|
|
|
|
|
This is an English orientated site please edit your question translate your question.
This is what Bing Translator makes of it:
Hello working on this software is I got the idea for a feature that let me configure the types of data that can to copy flash memory, someone has any idea of how to solve this. Use Visual Studio 2008 c#.NET 3.5
0100000101101110011001000111001011101001
|
|
|
|
|
I'm doing a software for the security of USB devices, that its main properties are placed in in XML file, and need to do that this file can not be deleted by the user to maintain the operation of the aircraft. Please if someone could help me in this. The language in which development is C# Visual Studio 2008.NET 3.5
modified 11-Oct-11 10:55am.
|
|
|
|
|
Please post your questions in English. That's the accepted language for Code Project. By posting in Spanish, you have reduced the likelihood that you will get an answer.
|
|
|
|
|
This is an English orientated site please edit your question translate your question.
This is what Bing Translator makes of it:
I'm doing a software for the security of USB devices, that its main properties are placed in in XML file, and need to do that this file can not be deleted by the user to maintain the operation of the aircraft. Please if someone could help me in this. The language in which development is C# Visual Studio 2008.NET 3.5
0100000101101110011001000111001011101001
|
|
|
|
|
If your application is running in the user's security context, and it has access to the file, then the user also has access to the same file. If the user's an administrator then you're screwed, from a software solution point of view. The best you can do is (i) keep rewriting it if it is deleted (though this might get you flagged as a virus) and (ii) refuse to operate if the file is not present.
|
|
|
|
|
somarriba wrote: to maintain the operation of the aircraft.
Please tell us this has nothing to do with commercial flights!
|
|
|
|
|
Richard MacCutchan wrote: Please tell us this has nothing to do with commercial flights!
If he is indeed writing software that might control the airplane, I'm staying off the plane
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
I would guess that it is possible to manufacture a USB drive that was read only.
Basic process would be
1. Find a manufacturer.
2. Set up an business relationship.
3. Create an image.
4. Ship image to manufacturer.
5. manufacturer burns image to usb and constructs device
6. You deliver to customers
|
|
|
|
|
It's kinda simple; if you have the USB-stick, you can format it and wipe any data that was stored on there.
If the key only comes near to computers that are under your control, then you can use a setting in the registry[^].
If not, you'd buy a key with a hardware "write protection" lock, (list here[^]) Put your files on there, put it in readonly-setting and glue the button in it's place with superglue.
However, if the file is "crucial" for your system and people's would depend on it, I'd say you need TWO internal SSD-drives and a darn good lock. USB-sticks don't fail often, but once-in-a-million events are bound to occur.
Bastard Programmer from Hell
|
|
|
|
|
I think you may have to go for embedded programming.Only USB manufactures can do that..i guess.Anyway I just stopped taking flights ...uffffffffffffff
|
|
|
|
|
Subin Mavunkal wrote: Only USB manufactures can do that..i guess.
Guessing is a bad form of answering. If you read my post you would have seen two options for the specified scenario.
Bastard Programmer from Hell
|
|
|
|
|
First let me try to translate the subject of your message for those who neither speak Spanish nor are willing to accept #2 of "HOW TO ANSWER A QUESTION":
"How to protect an XML file so that it cannot be deleted from the computer"
A very simple solution is to make the file hidden (see file attributes http://msdn.microsoft.com/es-es/library/system.io.file.setattributes(v=VS.90).aspx[^]). Of course, that's simple and the user can easily find that out.
You can make it more difficult for the user when you write a Windows service. That would run with "Local System Account" and thus has different access rights to files. A user with admin privileges could still delete it.
|
|
|
|
|
Hi,
I have an application build with VS2005 + SP1 on Windows XP + XP SP 3. This application simply copy a file from some folder to "C:\". When I copy my release build .exe from XP machine to Windows 7 machine. It does not copy the source file to "c:\" I am using following code to copy my file.
class Program
{
static void WritetoLog(Strings)
{
System.IO.StreamWriter file = new System.IO.StreamWriter("D:\\Test\\CopyFileApp.log", true);
file.WriteLine(s);
file.Close();
}
static void Main(string[] args)
{
try
{
File.Copy("D:\\Source.txt", "c:\\target.txt", true);
}
catch (Exceptione)
{
WritetoLog("got Exception");
}
}
}
Surprisingly, there is no exception on Windows 7 and neither there is file copied. Please let me know what is wrong here and if there is any workaround to this. If I build the same application using VS2008, I get an exception on Windows 7. I am working on a big application and can't move to VS2008.
|
|
|
|
|
System.IO.StreamWriter file = new System.IO.StreamWriter("D:\\Test\\CopyFileApp.log", true)
This is your issue. Your StreamWriter is set up to write to D:, not C:
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
The problem is not with StreamWriter. It is with File.Copy
Manish Agarwal
manish.k.agarwal @ gmail DOT com
|
|
|
|
|
Does D:\Test exist? If not, your logging code will fail and the whole thing will exit with an unhandled exception.
|
|
|
|
|
Yes, it exists. It is clearly mentioned that the problem is with File.Copy
Manish Agarwal
manish.k.agarwal @ gmail DOT com
|
|
|
|
|
I suspect that Windows 7 doesn't want you to write to the root of the C: drive.
|
|
|
|
|
|
You can use following code to check the access for a folder:
using System.Security.AccessControl;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
DirectorySecurity ds = new DirectorySecurity("C:\\", AccessControlSections.Access);
bool isProtected = ds.AreAccessRulesProtected;
}
}
}
Thanks,
Manish Agarwal
Manish Agarwal
manish.k.agarwal @ gmail DOT com
|
|
|
|
|