|
Hello Experts,
I have a code of Keyboard Hook In which have a problem when i m tring to Capture Unicode Character then it's not working fine.
I know that i want to use MapVirtualKeyEx, ToUnicodeEx function to convert for Unicode.
But i am not unable to understand this function .
So Please can any one help me to convert it function for Unicode Support.
Private Function KeyboardProc(ByVal nCode As Integer, ByVal wParam As IntPtr, ByRef lParam As KeyboardData) As IntPtr
If (nCode >= NativeMethods.HC_ACTION) Then
Dim e As Pcdll.KeyBoardEventArgs
Dim keyCode As Keys = CType(lParam.vkCode, Keys)
Select Case True
Case CInt(wParam) = NativeMethods.WM_KEYDOWN Or CInt(wParam) = NativeMethods.WM_SYSKEYDOWN
If keyCode = Keys.LMenu Or keyCode = Keys.RMenu Then
Me._keyData = Me._keyData Or Keys.Alt
e = New Pcdll.KeyBoardEventArgs(Me._keyData Or Keys.Menu, keyCode)
ElseIf keyCode = Keys.LControlKey Or keyCode = Keys.RControlKey Then
Me._keyData = Me._keyData Or Keys.Control
e = New Pcdll.KeyBoardEventArgs(Me._keyData Or Keys.ControlKey, keyCode)
ElseIf keyCode = Keys.LShiftKey Or keyCode = Keys.RShiftKey Then
Me._keyData = Me._keyData Or Keys.Shift
e = New Pcdll.KeyBoardEventArgs(Me._keyData Or Keys.ShiftKey, keyCode)
Else
e = New Pcdll.KeyBoardEventArgs(Me._keyData Or keyCode, keyCode)
End If
Me.OnKeyDown(e)
If e.Handled Then
Return CType(1, IntPtr)
End If
Case CInt(wParam) = NativeMethods.WM_KEYUP Or CInt(wParam) = NativeMethods.WM_SYSKEYUP
If keyCode = Keys.LMenu Or keyCode = Keys.RMenu Then
Me._keyData = Me._keyData And Not (Keys.Alt)
e = New Pcdll.KeyBoardEventArgs(Me._keyData Or Keys.Menu, keyCode)
ElseIf keyCode = Keys.LControlKey Or keyCode = Keys.RControlKey Then
Me._keyData = Me._keyData And Not (Keys.Control)
e = New Pcdll.KeyBoardEventArgs(Me._keyData Or Keys.ControlKey, keyCode)
ElseIf keyCode = Keys.LShiftKey Or keyCode = Keys.RShiftKey Then
Me._keyData = Me._keyData And Not (Keys.Shift)
e = New Pcdll.KeyBoardEventArgs(Me._keyData Or Keys.ShiftKey, keyCode)
Else
e = New Pcdll.KeyBoardEventArgs(Me._keyData Or keyCode, keyCode)
End If
Me.OnKeyUp(e)
If e.Handled Then
Return CType(1, IntPtr)
End If
End Select
End If
Return NativeMethods.CallNextHookEx(Me._hKeyboardHook, nCode, wParam, lParam)
End Function
Reqired Link is here :
Global Windows Hooks[^]
Thanks
If you can think then I Can.
|
|
|
|
|
This code does not look much like C# to me. Try posting in the correct forum.
I must get a clever new signature for 2011.
|
|
|
|
|
O Sorry Sir,
But if u have the solution for that pls help. Because C# and Vb.net is Mostly similer only syntex changes.
If you can think then I Can.
|
|
|
|
|
eg_Anubhava wrote: Because C# and Vb.net is Mostly similer only syntex changes.
That may be true but we have separate forums for a reason. Lots of people know VB.NET or C# but not both.
I must get a clever new signature for 2011.
|
|
|
|
|
He has. He also tried posting it to Q&A as a link here - deleted.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
Agree
If you can think then I Can.
|
|
|
|
|
Hi,
I just got a new task to do. I need a desktop solution which will contact to another desktop application. My desktop application will send some message to the remote desktop application and the remote desktop application will print that message by the connected printer of that remote PC. Both of the application will be written by me in C# 4.0.
Now, how can I achieve this goal ? So far I thought, I will run IIS to the remote Desktop where the IIS will be running an ASP.NET Web Application. My application will post the message to an URL of the remote IIS served website, and that URL is an ASPX page, which will invoke a C# application and that application will print that message.
But, obviously it costs more by too much overhead. Cannot I directly connect to that printing application (using IP address or some other token) and send the print command ? Is WCF is the technology that can solve this problem ? If so, can you please show me any useful article ?
I have used WCF in my ASP.NET web application so that a remote desktop application can connect to my Web site and download information, but I did not host WCF in a Windows Application and I am not sure if that approach is the really best fit for my problem. I am not sure if WCF can be used over internet when hosting the WCF in a Windows application.
Regards
modified on Friday, February 4, 2011 11:54 PM
|
|
|
|
|
You can use Client Server (Network ) Programming.
You can use also with the use of database to communicate with each other.
This Process is called Intranet in case of Using Web Part to use (With in a network).
First U must to create a server where your database or Browsers files will be store after that connect from the client machine and Use the same like internet.
Best Regard
If you can think then I Can.
|
|
|
|
|
Thanks for the keyword 'Client Server (Network) Programming'. I searched in Google with 'Client Server Programming in C#' and found the VERY RIGHT article that just solved my problem.
Here is that article : Introduction to TCP client server in C#[^]
|
|
|
|
|
|
Find yourself some dictionaries with "known" words from various languages, and check if there's one with a lot of hits
I are Troll
|
|
|
|
|
I'm trying to determine is the value has already been encrypted so I don't encrypt it again.
Everything makes sense in someone's mind
|
|
|
|
|
Intuitively, I believe that this is impossible.
How would the function tell the difference between an encrypted string, and a string of random characters?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
It wouldn't. OTOH, how many people will decide to encrypt random data?
It'd be a lousy way to gain access to something that you don't know; it might even be an MP3-file in Base64 that's encrypted in there. Counting the number of hits against a dictionary is enough indication if you merely want to determine whether you're dealing with something in plain-text or not.
I are Troll
|
|
|
|
|
Me.
I frequently pad data before encryption with random info to ensure it is the same block size (say multiples of 8K). It makes it harder to work out any info about the source. Since my encrypted data includes the original length, I can just chuck the rubbish when I decrypt it.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
After a little experimentation I have noticed that there is one thing that might help you to determine this.
Only you can know if this is any help because you know roughly what sort of text is being encrypted.
Regardless of the input there should be no spaces in the encrypted text.
It's not foolproof proof, if you see what I mean, but it might help.
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 wouldn't let CG touch my Abacus!
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.
|
|
|
|
|
return ( true ) ;
Ah , just run it through again.
|
|
|
|
|
Kevin Marois wrote: I'm wondering if there's any way to determine if a string has really been encrypted from a method that's receiving the string and doesn't know what the unencrypted value is.
One way would be to explicitly add a prefix like: 'encrypt:' and 'plain:'
However you can also note that encryption creates binary values. Strings cannot contain binary values.
The algorithm that you referenced is returning the binary data encoded as base64. So unless your system is also passing around other binary data without specifying what it is then any valid base64 value larger than a certain length (say 20) could be considered encrypted.
|
|
|
|
|
Kevin Marois wrote: determine if a string has really been encrypted
If one could, then it would not be encryption would it?
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
|
|
|
|
|
No, not if the encryption algorithm is any good - it should appear to be random data.
However, when I write encryption stuff, I use a class which accepts a stream and returns a stream. The output stream includes the class ID and version (in human - and electronic - readable form) so that I can tell how to decrypt it. This allows for upgrades to "better" encryption algorithms without discarding existing data.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
Hi,
I have used the Serial Port Class for around 2 years and not used the serialPort tool in the tool box. Is there a difference I have avoid it due to MSComm memories/flash backs in VS6 is there a difference why are two ways of doing the same thing included with .Net 2+?
Glenn
|
|
|
|
|
the components in the toolbox are regular .NET classes; using them through Visual Designer creates code in some (often hidden) file, look for file1.designer.cs; you can check the code and see your Form, all of its Controls, and the SerialPort being instantiated and their properties being set.
If you want to succeed in programming, you should not only be curious but also a bit more adventurous...
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Well, thats that. I just had a way of doing serial comms to Windows and didn't need anything else I was interested, Yes you are right
this.RS232 = new System.IO.Ports.SerialPort(this.components);
I was expecting but no
using System.IO.Ports;
at all as a header on the form page a bit odd (give me #include ANSI C style anyday) .
|
|
|
|
|
Visual Designer avoids imports, as those may lead to name clashes, which would be bad when caused by imports you did not ask for; so they typically use fully qualified class names, as you discovered. Keep looking around!
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Luc Pattyn wrote: fully qualified class names
As well it should... 
|
|
|
|