Who ask you about difference between working and screwing around?
I only want to know how to hook keyboard press in a windows form even after it's minimized or not focused.
Look, I managed to solve my own problem.
I ask here nicely to get some help so I can finish this faster.
This is what I called (solution) even it's not what I want, I appreciate it.
Abhinav S wrote:
Handling the forms keydown event would give you a count of key strokes within the application.
Dave, I believe you know how to do this.
But I don't know why everytime you respond my question, always something weird like your question above.
I tried to learn, not "gimme code to hook keyboard press please thank you email me bla bla".
Next time if you're not going to give me some help, then please find another question to answer.
How do you define "more useful"? There are many reasons why you would choose one over the other but it will depend on the problem you are trying to solve and the skill levels and experience of your developers.
One of these days I'm going to think of a really clever signature.
You get Access Denied because the account your code is running under does not have permissions to the remote machine. By default, if you don't specify any account information in the Management connection objects, it'll use the account your code is running under. If that account doesn't have permissions on the remote machine, it'll fail.
On the Oracle DB there's a stored proc defined like:
PROCEDURE pGetHashes ( iFrom IN NUMBER, iTo IN NUMBER, sHash1 OUT CHAR, sHash2 OUT CHAR );
When I call this procedure from within my app, I only get a value for the sHash2 parameter. The value of the sHash1 parameter is always null. (Running the same stored proc from sqldeveloper gives a result for both hash values.)
Underneath I have added the code which I use to call the stored proc. Does anybody see anything I might have done wrong?
int iFrom = 0;
int iTo = 1000;
using (IDbCommand command = dbConnection.CreateCommand())
OracleCommand orclCommand = command as OracleCommand;
orclCommand.CommandText = "pGetHashes";
orclCommand.CommandType = CommandType.StoredProcedure;
orclCommand.Parameters.Add("iFrom", OracleDbType.Int32, iFrom, ParameterDirection.Input);
orclCommand.Parameters.Add("iTo", OracleDbType.Int32, iTo, ParameterDirection.Input);
OracleParameter orclParam = new OracleParameter("sHash1", OracleDbType.Char, 100);
orclParam.Direction = ParameterDirection.Output;
orclParam = new OracleParameter("sHash2", OracleDbType.Char, 100);
orclParam.Direction = ParameterDirection.Output;
orclCommand.BindByName = true;
// after this the orclCommand.Parameters["sHash1"].Value is always null.
// the orclCommand.Parameters["sHash2"].Value has the correct value.
For extra documentation. Running the following PLSQL from within sqldeveloper results in both a value for Hash1 and Hash2:
SET SERVEROUTPUT ON;
nFrom NUMBER := 0;
nTo NUMBER := 1000;
pGetHashes( nFrom, nTo, sHash1, sHash2 );
dbms_output.put_line('Hash1: '|| sHash1);
dbms_output.put_line('Hash2: '|| sHash2);
Thanks for any light you can shed on this problem.
My application works well on Vista, Win 7 32 and 64 bits.
It modifies some registry key in HKEY_LOCAL_MACHINE.
But when run on Win 8 (both 32 and 64), with minimum level UAC (I drag the slider to bottom, then restart), it doesn't work. And there is the error:
"Application attempted to perform an operation not allowed by the security policy. To grant this application the required permission, contact your system administrator, or use the Microsoft .NET Framework Configuration tool. Requested registry access is not allowed."
When I disable completely UAC of win 8 by editing registry, then restart computer, my application works well.
If I run regedit on Windows 7 then it runs with elevated priviledges which causes a UAC dialog to pop.
I find it unlikely that your application is doing nothing and yet is allowed total access to the registry on Windows 7. Do you have UAC enabled on your Windows 7 test box? Are you only editing some user data and as such the app might have access? Or perhaps are you installing it on Windows 7 (installing does seem to provide certain priviledges)? Also are you sure that the user for windows 7 and that for 8 both have the same priviledges?
You might be trying to modify TrustedInstaller keys. TrustedInstaller is a special user that has power beyond that of Administrator(s). You will need to take ownership of the key in order to work around that (completely ruining the security on your user's machine). If you need to change keys owned by TrustedInstaller you are doing something very very wrong.
If you are not trying to modify TrustedInstaller-owned keys you probably need to indicate which permissions you want when you open the key:
using (var key = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Foo\\Bar", RegistryKeyPermissionCheck.ReadWriteSubTree))
// .. or ..
using (var key = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Foo\\Bar", RegistryKeyPermissionCheck.ReadWriteSubTree))
He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb]
Jonathan C Dickinson (C# Software Engineer)
Last Visit: 31-Dec-99 18:00 Last Update: 25-Jul-14 0:16