Click here to Skip to main content
15,797,167 members

Comments by Grasshopper.iics (Top 12 by date)

Grasshopper.iics 22-Jan-13 11:27am View    
If you are using Digital Persona, then it comes with a driver. Every driver puts a registry entry. There are some simple Win API method which can detect when a USB device is inserted. You can compare the device ID and use some password to activate the device.

However if a hardware lock is so important, cant there be a USB hub? Logic remains same. Alongside the device you provide a USB stick and embed it's ID into program for password checking. However if such a solution needs to be distributed in lot then software lock might be best option?
Grasshopper.iics 21-Jan-13 20:47pm View    
You have set SeriesChartType.Point, it should be SeriesChartType.Column
Grasshopper.iics 21-Jan-13 18:53pm View    
BeginInvoke by UI controls or thread is meant to be executed at the background. So When you have loads of statement and use BeginInvoke at the end, UI gets updated smoothly. Do a simple test. Take a Label, and a button. on click event write the following code.

for (int i = 0; i < 100; i++)
label1.Text = i.ToString();

// your UI update code here. e.g. this.Close();Label1.Text="something";
// System.Threading.Thread.Sleep(2000);

Dont you see your UI in wait state? That is what I mean. In his code context, calling BeginInvoke from inside nested loops is not executing asynchronously. First Invoke is locking the resource, the second call is waiting for that to complete. So even though they are executing asynchronously, lock is not managed that way.
Grasshopper.iics 21-Jan-13 18:33pm View    
Put argument to rest, please check with the suggested changes first!
Grasshopper.iics 21-Jan-13 3:17am View    
I am sorry, but I really don't get you here SA. I considered member to be relatively new in coding as he seems to be relatively new to cp. So I offered an easy way out. You voted me 1, stamping the answer not suitable. I pulled out some work from another project which I found some times back in stackoverflow. This solution works best, no matter what your file type is.

But you are now saying that the solution is complicated. By the mean time OP has not come back to comment on any solutions or clarifying any point.

Should we consider
1. To check if a file is locked, my first solution
2. To find the exact process and the name with file handle, my second method.

Where I used it?

I have controlled power point slide through some stuff like lasser , voice, hand movement, eye blink. I use this technique to find out the Handle (Int32 pointer to process) and then I pass the keys through Sendkey(). So please clarify if I am wrong in my either cases.