Click here to Skip to main content
15,888,816 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to make database for a Project Pin
CHill6015-Jun-15 22:33
mveCHill6015-Jun-15 22:33 
QuestionA C# Windows Application can not run in Windows XP Pin
Member 1173519614-Jun-15 19:06
Member 1173519614-Jun-15 19:06 
AnswerRe: A C# Windows Application can not run in Windows XP Pin
Jim Meadors14-Jun-15 19:14
Jim Meadors14-Jun-15 19:14 
GeneralRe: A C# Windows Application can not run in Windows XP Pin
Member 1173519614-Jun-15 20:51
Member 1173519614-Jun-15 20:51 
GeneralRe: A C# Windows Application can not run in Windows XP Pin
Simon_Whale14-Jun-15 23:07
Simon_Whale14-Jun-15 23:07 
AnswerRe: A C# Windows Application can not run in Windows XP Pin
Bernhard Hiller14-Jun-15 21:47
Bernhard Hiller14-Jun-15 21:47 
SuggestionRe: A C# Windows Application can not run in Windows XP Pin
Richard Deeming15-Jun-15 1:13
mveRichard Deeming15-Jun-15 1:13 
QuestionCard reader and control data Pin
Jean-Pierre Carvalho (JPCarvalho)14-Jun-15 0:51
Jean-Pierre Carvalho (JPCarvalho)14-Jun-15 0:51 
XML
Hi,

I have a card reader for read a user card but reading appears that:

<b>For user 7196: %00007196_ç00007196_ - this is a new card</b>

<b>For user 910202: ç00910202_ - this is a old card</b>

Another card reader appears:

<b>For user 7196: 00007196 - this is a new card</b>

<b>For user 910202: 00910202 - this is a old card</b>

The problem is when i pass the card the system sends all codes like a copy-paste but i need control this paste. Eliminate chars, etc...

This code receives all ps/2 codes:

<pre lang="c#">
using System;
using System.Diagnostics;
using System.Windows.Forms;
using System.Runtime.InteropServices;

class InterceptKeys
{
    [DllImport(&quot;user32.dll&quot;, CharSet = CharSet.Auto, SetLastError = true)]
    private static extern IntPtr SetWindowsHookEx(int idHook, LowLevelKeyboardProc lpfn, IntPtr hMod, uint dwThreadId);

    [DllImport(&quot;user32.dll&quot;, CharSet = CharSet.Auto, SetLastError = true)]
    [return: MarshalAs(UnmanagedType.Bool)]
    private static extern bool UnhookWindowsHookEx(IntPtr hhk);

    [DllImport(&quot;user32.dll&quot;, CharSet = CharSet.Auto, SetLastError = true)]
    private static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, IntPtr wParam, IntPtr lParam);

    [DllImport(&quot;kernel32.dll&quot;, CharSet = CharSet.Auto, SetLastError = true)]
    private static extern IntPtr GetModuleHandle(string lpModuleName);

    public static int _count = 0;
    private const int WH_KEYBOARD_LL = 13;
    private const int WM_KEYDOWN = 0x0100;
    private static LowLevelKeyboardProc _proc = HookCallback;
    private static IntPtr _hookID = IntPtr.Zero;

    public static void Main()
    {
        _hookID = SetHook(_proc);
        Application.Run();
        UnhookWindowsHookEx(_hookID);
    }

    private static IntPtr SetHook(LowLevelKeyboardProc proc)
    {
        using (Process curProcess = Process.GetCurrentProcess())

        using (ProcessModule curModule = curProcess.MainModule)
        {
            return SetWindowsHookEx(WH_KEYBOARD_LL, proc, GetModuleHandle(curModule.ModuleName), 0);
        }
    }

    private delegate IntPtr LowLevelKeyboardProc(int nCode, IntPtr wParam, IntPtr lParam);

    private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
    {
        if (nCode &gt;= 0 &amp;&amp; wParam == (IntPtr)WM_KEYDOWN)
        {

            int vkCode = Marshal.ReadInt32(lParam);

            if ((Keys)vkCode == Keys.Return)
            {
                Console.WriteLine(&quot;Cartão novo lido com sucesso.&quot;);
            }

            Console.WriteLine((Keys)vkCode);
        }
        return CallNextHookEx(_hookID, nCode, wParam, lParam);
    }
}
</pre>

<b>I need increase this code, any help?</b>

AnswerRe: Card reader and control data PinPopular
OriginalGriff14-Jun-15 1:20
mveOriginalGriff14-Jun-15 1:20 
GeneralRe: Card reader and control data Pin
Jean-Pierre Carvalho (JPCarvalho)14-Jun-15 4:43
Jean-Pierre Carvalho (JPCarvalho)14-Jun-15 4:43 
QuestionBarcode printing Sato Lm 408e thermal SBPL Pin
gunturlin12-Jun-15 2:00
gunturlin12-Jun-15 2:00 
AnswerRe: Barcode printing Sato Lm 408e thermal SBPL Pin
OriginalGriff12-Jun-15 2:41
mveOriginalGriff12-Jun-15 2:41 
QuestionBinaryFormatter - Serialize OutOfMemory Exception Pin
Kit Fisto11-Jun-15 1:54
Kit Fisto11-Jun-15 1:54 
AnswerRe: BinaryFormatter - Serialize OutOfMemory Exception Pin
Sascha Lefèvre11-Jun-15 2:23
professionalSascha Lefèvre11-Jun-15 2:23 
GeneralRe: BinaryFormatter - Serialize OutOfMemory Exception Pin
Brisingr Aerowing11-Jun-15 11:55
professionalBrisingr Aerowing11-Jun-15 11:55 
GeneralRe: BinaryFormatter - Serialize OutOfMemory Exception Pin
Sascha Lefèvre11-Jun-15 16:41
professionalSascha Lefèvre11-Jun-15 16:41 
AnswerRe: BinaryFormatter - Serialize OutOfMemory Exception Pin
Eddy Vluggen11-Jun-15 12:29
professionalEddy Vluggen11-Jun-15 12:29 
GeneralRe: BinaryFormatter - Serialize OutOfMemory Exception Pin
Kit Fisto23-Jun-15 5:34
Kit Fisto23-Jun-15 5:34 
GeneralRe: BinaryFormatter - Serialize OutOfMemory Exception Pin
Eddy Vluggen23-Jun-15 5:57
professionalEddy Vluggen23-Jun-15 5:57 
QuestionSMTP - Failure sending mail. Pin
Hrishikesh Shivacharan10-Jun-15 23:12
Hrishikesh Shivacharan10-Jun-15 23:12 
AnswerRe: SMTP - Failure sending mail. Pin
OriginalGriff10-Jun-15 23:49
mveOriginalGriff10-Jun-15 23:49 
SuggestionRe: SMTP - Failure sending mail. Pin
Richard MacCutchan11-Jun-15 1:01
mveRichard MacCutchan11-Jun-15 1:01 
AnswerRe: SMTP - Failure sending mail. Pin
Abhipal Singh11-Jun-15 6:23
professionalAbhipal Singh11-Jun-15 6:23 
QuestionHow to write java script for image upload on choose file type not in click function Pin
balajiparamkusam10-Jun-15 4:42
balajiparamkusam10-Jun-15 4:42 
AnswerRe: How to write java script for image upload on choose file type not in click function Pin
CHill6010-Jun-15 4:56
mveCHill6010-Jun-15 4:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.