CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Need some help.

  1. #1
    Join Date
    Sep 2012
    Posts
    9

    Smile Need some help.

    Can anyone help me with this.. I have gotten so close, but yet so far away.

    Need this to be changed to where if the Value is 47 then a keyboard event will happen. The default value is 00. I have it running on a timer. Can anyone help?
    ---------------------------------------------------------------
    ULONG Addr, Value; HRESULT hr; char *stop_at;
    Addr = strtoul(m_RegAddr,&stop_at,36);

    hr = Lib_RegRead(Addr, 1, &Value);

    ----------------------------------------------------------------
    Tries so far (gonna need to ask for help from people)

    hr = Lib_RegRead(Addr, 1, &Value);
    if ????????????????????????
    {
    keybd_event(0x21, 0, 0, 0);
    }

  2. #2
    Join Date
    Sep 2012
    Posts
    9

    Re: Need some help.

    else
    {
    m_RegValue.Format(_T("%02X"),Value);
    m_StatusMsg = _T("Backend Register Read Success!");
    }

    Perhaps I could do something with this.... I want an event in between those 2 lines that will do a keyb_event, based on what the value is.. If its 00 or 16 or 47 or whatever.

  3. #3
    Join Date
    Sep 2012
    Posts
    9

    Re: Need some help.

    else
    {
    m_RegValue.Format(_T("%02X"),Value);
    m_StatusMsg = _T("Backend Register Read Success!");
    if ( etLib2_RegRead = (Addr, 1, 47))
    {
    keybd_event(0x21, 0, 0, 0);
    }
    }

    Yeah this is what I need I guess.. thought it doesn't work.

  4. #4
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,835

    Re: Need some help.

    Assuming your code is valid (i.e. Lib_RegRead() and keybd_event() do actually whatever they're supposed to do) surely you just need something like this:-

    Code:
    hr = Lib_RegRead(Addr, 1, &Value);
    
    if (Value == 47)
    {
          keybd_event(0x21, 0, 0, 0);
    }
    Are you trying to simulate a keypress event? That's a very unusual thing to do in Windows programming.
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  5. #5
    Join Date
    Sep 2012
    Posts
    9

    Re: Need some help.

    All fixed! Thanks!

    When in doubt, try everything! =)

    Yeah its to interface with AutoHotKey.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured