dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 3 of 3 FirstFirst 123
Results 31 to 40 of 40

Thread: action on pressing a key

  1. #31
    Join Date
    Apr 2007
    Posts
    75

    Re: action on pressing a key

    so prob. after WM_KEYDOWN ??

  2. #32
    Join Date
    Jun 2002
    Location
    Stockholm, Sweden
    Posts
    1,641

    Re: action on pressing a key

    Quote Originally Posted by sdherzo
    u mean just type InvalidateRect(hWnd, NULL, TRUE); after the case WM_PAINT ???

    Haha, invalidate inside WM_PAINT handler is not a very good idea.
    Invalidate tells the system that a particular section needs repainting.
    Therefore it will lead to an infinite loop repainting over and over again.

    Never mind.

    Does your screen update at all? If the value of d0 changes, do you see any changes on the screen?

    I can see that you have a timer to repaint the screen, the question is if it works or not.

    Code:
            case WM_TIMER:                  /* All Timer Events Processed Here */
                InvalidateRgn(hWndMain, hRgn, FALSE);  /* Force screen update  */
                break;
    Please post all of your code again...
    Nobody cares how it works as long as it works

  3. #33
    Join Date
    Apr 2007
    Posts
    75

    Re: action on pressing a key

    >> Does your screen update at all? If the value of d0 changes, do you see any changes on the screen?

    Yes with out the keypress my code works fine. do gets calculated per second about 20 times & i get out d0 in real time.

    Its just this key pressing thing ...

    But basically what we have done is logically perfect ... i am still clueless why it dosent work ... it is prob. something silly ;-)

    The code is posted on "page2 " no canges since then ... u want me to post it again ??

  4. #34
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,628

    Re: action on pressing a key

    It is meaningless to post the code that cannot be compiled!
    As I already wrote you should create a small test project reproducing your problem and post it to the Forum as zip archive (don't include Debug and Release folders, .ncb, .aps files!)
    Victor Nijegorodov

  5. #35
    Join Date
    Jun 2002
    Location
    Stockholm, Sweden
    Posts
    1,641

    Re: action on pressing a key

    Yes, because - as I said - you have to move the calculation of d0 outside WM_PAINT.

    Perhaps you did that, but I want to see that it is correctly done.
    Nobody cares how it works as long as it works

  6. #36
    Join Date
    Apr 2007
    Posts
    75

    Re: action on pressing a key

    it is getting compiled ... But in order to test it with values u prob need my A/D converter ;-) ...

  7. #37
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,628

    Re: action on pressing a key

    Quote Originally Posted by sdherzo
    it is getting compiled ...
    Sure?
    Ok, create an empty project, copy your code from the "page2", paste it to your project file and click the "Compile" button!
    Victor Nijegorodov

  8. #38
    Join Date
    Apr 2007
    Posts
    75

    Re: action on pressing a key

    so guys ! thanks for the help the last cpl of days :-) like i thought it was a small thing :: i hadnt delcared dref,dn as static. I now declared them as staic and it works ;-)
    Reg.

  9. #39
    Join Date
    May 2005
    Posts
    364

    Re: action on pressing a key

    so guys ! thanks for the help the last cpl of days :-) like i thought it was a small thing :: i hadnt delcared dref,dn as static. I now declared them as staic and it works ;-)
    Reg.
    Wait!!

    I told you before the you should use dref as Global variable, and ...

    Anyway now you have understood the meaning of Global and Global static ones.
    Dan

  10. #40
    Join Date
    Apr 2007
    Posts
    75

    Re: action on pressing a key

    ya :-) it could have saved me a lot of nerves over the cpl of days ... but looking at the "summer" outside, just as well that i sat down with this ;-)

Page 3 of 3 FirstFirst 123

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)