|
My application writes data into the Registry which is causing a UAC issue on vista. I keep data in the registry so I can access it across different applications we have (this is not a mass product but only installed on selected machines).
Since I am storing data into the LocalMachine SOFTWARE keys, is that was is causing the UAC errors, or should I store the application config settings somewhere else?
|
|
|
|
|
Look into the use of the applicationdata folder, I beleive it is designed for this type of use instead of the registry. I think you'll find fighting Vista's UAC will drive you nuts whereas changing the data store is fairly simple.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Anything that is user specific will work just fine, such as Environment.SpecialFolder.ApplicationData and HKCurrentUser.
Anything that applies to all users will fail unless you have admin rights and elevated privileges apply, as for Environment.SpecialFolder.CommonApplicationData and HKLocalMachine.
The logic is: a single regular user is not allowed to influence the machine's behavior for other users.
|
|
|
|
|
I am trying to find out the best practice for calling one function out a set at random. I am using this to establish a random event in a video game.
For instance, let's say over time a bunch of different things could happen to a plant over time. So, every 5 hours, a random thing happens to this plant (resulting in 1 of many functions being fired).
The current way I am thinking about this follows in this example:
A timer knows about a list of 100 plants. When the timer ticks, it is randomly decided that the InsectInfestation method will be fired and it will affect 30 plants.
Where is the best place to store these random event methods?
The plant? An interface to the plant?
What is the best method of firing one at random?
A delegate in the timer that queues up the methods contained in the 30 affected plants? If so, how do I call up these methods in an algorithm?
---------------
TyloCook
|
|
|
|
|
Hmmm... interesting... there are many ways.
Perhaps the Plant (IPlant interface?) could have an Update method? And in the Update method you generate a random number and use a switch to determine what should happen to the individual Plant?
Or perhaps you could have a facility to apply some other class (Decorator Pattern?) to the Plant. So you have a Plant and then do something like myPlants [ i ].Infestations.Add ( new InsectInfestation() ) ;
At any rate, the effects of the infestation should be handled by the Plant, not by an outside agency.
|
|
|
|
|
now i am doing my project ussing C# to recive input from extrnal circuit I use sound card but i can't access the sound card if you now the class library used for recive input from sound card write me
|
|
|
|
|
There are many.
However, Google for 'DirectSound c#' should get you started.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
i can insert picture from file location but can not use ctrl+v to paste the image.
if (e.Modifiers == Keys.Control && e.KeyCode == Keys.V)
{
DataFormats.Format df;
df = DataFormats.GetFormat(DataFormats.Bitmap);
if (Clipboard.ContainsImage())
{
rtbDoc.Paste(df);
e.Handled = true;
Clipboard.Clear();
}
}
modified on Saturday, April 11, 2009 5:50 PM
|
|
|
|
|
Hi,
Clipboard.GetImage() is required, you can't paste a data format.
BTW: CTRL/V should not clear the Clipboard.
|
|
|
|
|
here is the code...
if (e.Modifiers == Keys.Control && e.KeyCode == Keys.V)
{
DataFormats.Format df;
df = DataFormats.GetFormat(DataFormats.Bitmap);
StringCollection strcollect = Clipboard.GetFileDropList();
Image image = Image.FromFile(strcollect[0]);
Clipboard.Clear();
Clipboard.SetImage(image);
if (Clipboard.ContainsImage())
{
rtbDoc.Paste(df);
e.Handled = true;
Clipboard.Clear();
}
}
|
|
|
|
|
Hi,
I have a small application that monitors a specified windows folder and displays the activities performed on that folder.My aim is to track all the activities, like creation,renaming,updating files/subfolders under the specified folder, but never allows the user to delete a file or sub folder. I have used FileSystemWatcher(FSW) to track and handles the activities. But Iam not able to track the event that fires just before deletion, and thus not able to deny delete access. My code tracks the activites and informs me of the activities. Please find below the code i have written.I have specified only those part that tracks the folder.The tracking happens on a 'Button Start' click.
<pre>public partial class Frm_Monitor : Form
{
public FileSystemWatcher FileWatcher;
private void Btn_Start_Click(object sender, EventArgs e)
{
FileWatcher = new FileSystemWatcher();
string Path;
Path = txt_FolderPath.Text;//user can browse for the path
//Clear all the previous entry
Tmr_ForThread.Start(); //timer to start the thread
FileWatcher.Path = Path;
FileWatcher.NotifyFilter =
NotifyFilters.FileName | NotifyFilters.Attributes | NotifyFilters.LastAccess | NotifyFilters.LastWrite
| NotifyFilters.Security
| NotifyFilters.Size
| NotifyFilters.CreationTime;
FileWatcher.Changed += new FileSystemEventHandler (OnFileEvent);
FileWatcher.Created += new FileSystemEventHandler(OnFileEvent);
FileWatcher.Deleted += new FileSystemEventHandler(OnFileEvent);
FileWatcher.Renamed += new RenamedEventHandler(OnRenameEvent);
FileWatcher.IncludeSubdirectories = true;
FileWatcher.EnableRaisingEvents = true;
}
}</pre>
In the above code, under the 'OnFileEvent' and 'OnRenameEvent', I had written the code to get and pass the 'changetype' and 'fullpath' attribute of the eventhandler arguments to a sub routine. That sub routine uses MethodInvoker on a Listview.BeginInvoke, to display the 'changetype' and 'fullpath' onto a ListView control in the form Frm_Monitor.
Instead of using the FileWatcher.Deleted , what should i use so that I will know the moment the user clicks on deletion of a file/folder, rather than letting me know after the deletion?
Any help in the whole process/idea as soon as possible is much appreciated. Please let me know If i need to paste the whole program
|
|
|
|
|
leshu wrote: Instead of using the FileWatcher.Deleted , what should i use so that I will know the moment the user clicks on deletion of a file/folder, rather than letting me know after the deletion?
Deleted is in the past tense. If you want to capture something before it happens the events will typically be named in the present continuous/progressive* tense. e.g. Deleting
However, the FileWatcher isn't designed with this in mind. It is simply a mechanism to tell you what changes have been made recently. It cannot tell you what changes are about to be made.
You will have to use low level hooks into the filesystem that are beyond the scope of the .NET Framework to do this.
|
|
|
|
|
Colin Angus Mackay wrote: It cannot tell you what changes are about to be made.
Telepathic software - my PM has a standing request for this, it gets rejected on average of about twice a month!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks for the input. Can u please share with me your knowledge of using filesystem for my issue.
|
|
|
|
|
leshu wrote: Can u please share with me your knowledge of using filesystem for my issue.
Sorry, my knowledge of the file system no longer extends to the problem that you have. You need someone with low level Win32 API experience. I stopped doing that about 8 years ago.
You are looking at the level that Mark Russinovich deals with. He's the chap that wrote the SysInternals[^] suite of applications. If you can understand that level then you should be able to capture events before they are carried out by trapping them at the OS level. However, be aware, if you get it wrong at that level you could very well destabalise your operating system.
|
|
|
|
|
Ok sounds intresting and challenging.Thank you. Will follow up the link
|
|
|
|
|
|
Hey All! ,
Over the past coupla months I've read alot about TCP/IP and
System.Net.Sockets etc and I made my own little server/client application. Simple. One connects the other listens and receives messages. All works fine on my end (testing). BUT, to my surprise, it never works on anybody elses computer. I give them the client, and I use my server to listen, and they can never end up connecting to my server. They always get a "Server took way way way too long to respond" and similar error messages. . I tried reading a little more about it and nothing I had read helped solve the problem. So, I turned to my second best friend (Google) and found about 20 sample client/server applications that I downloaded and tested. They all worked perfectly on my own computer. But when I got friends to test, same old story... Couldn't connect. My friends have DSL Internet. Does this matter? Can anybody help shed a little light on this? I'd appreciate any help I can get on this.
lots of thanks,
jay
foreach( inch on Jason )
{
Girlfriend.IsHappier();
}
|
|
|
|
|
Are there firewalls in between blocking the connection?
|
|
|
|
|
Well, I don't know if they are blocking the connection. But now that you've mentioned it. That must be the case since we're all using anti-virus software with their own Firewalls. I use ESET Smart Security. And my friends are using AVG and Norton's. Maybe there's a way to get around the firewall's without disabling them?
foreach( inch on Jason )
{
Girlfriend.IsHappier();
}
|
|
|
|
|
If it is a firewall issue, ensure that the port of your service is open on the firewall(s).
You can also cheat and use a common port so long as you are not already using that service. e.g. If you don't have a web server installed on your computer you can use port 80 as firewalls typically keep that one open.
|
|
|
|
|
Oh. Awesome. It worked. Thanks so much for that!!!
Jay.
foreach( inch on Jason )
{
Girlfriend.IsHappier();
}
|
|
|
|
|
Hy!
I have multimedia keys on my laptop, just like most of us. These keys make Winamp/iTunis/GOMPlayer and so play/pause, etc. I want to make an application that does just the same: makes multimedia applications play/pause, stop, etc.
Now as these keys work with more applications I suppose (though not sure) that they use a built-in .NET API or some other Windows functionality hidden in some DLL somewhere rather then controlling the hotkeys of the individual applications.
I want my application to be PC model independent, I don't mind having it only Vista compatible.
So can anyone recommend a good starting point, library, class or anything in fact that could get me started. I don't (really) need all of the code to be written for me, I just need something to get me started.
Thanks!
modified on Saturday, April 11, 2009 2:49 PM
For those who are reading the first post: original introductory sentence was: "I have multimedia keys on my laptop, just like most of us.", hence the discussions. Edited later not to upset all the "sensible" people around here.
And in fact whether you have or not multimedia keys on your keyboard/laptop is not even important as I am looking for a software solution that would make all commonly used media players controllable by software, via OS specific commands (if any) even on system without MM keys.
RESOLVED: Global Mouse and Keyboard Library[^] also simulates MultiMedia Key press events.
modified on Sunday, April 12, 2009 7:10 AM
|
|
|
|
|
jano_rajmond wrote: I have multimedia keys on my laptop, just like all of us.
Thats a bit of a generalisation there. I have a laptop without multimedia keys. It is called a business laptop. My mother's consumer laptop, however, does have multimedia keys.
|
|
|
|
|
Not to be offensive... but really... NOT the point and NOT the answer to the question.
|
|
|
|