Results 1 to 12 of 12

Thread: Waiting for Input, Waiting for # milliseconds, DMA in C++

  1. #1

    Thread Starter
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134

    Waiting for Input, Waiting for # milliseconds, DMA in C++

    I need to know how to pause for a second or two, and wait for the user to press "any key" to continue. Also Kedaman maybe after I devote some time to C++ and get all the basics down could you give me an example of DMA?
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    how did you know i was going to read this thread? to pause 2 milliseconds you call sleep(2000); and to wait for a key to be pressed buffer the states from getkeyboardstate and compare them. I have some samples of DMA i think you would like
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3

    Thread Starter
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134

    Thumbs up

    I knew because you can't resist me .

    VB causes much hilarity among Cam, compared to C++ . I just started learning it and now wonder why I put it off for 3 years !!
    Last edited by Sastraxi; Jun 27th, 2001 at 03:36 PM.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  4. #4

    Thread Starter
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    And also I'd like to know how to get the current time, I want to find out how long it took to do something (eg, in vb: )

    VB Code:
    1. A = Timer
    2. B = Timer
    3. TimeSec = (B - A) / 1000

    How would I do this in C++? I am thinking:

    Code:
    long int a, b, c;
    a == gettime();
    // stuff
    b == gettime();
    c == (b - a) / 1000;
    I know GetTime() is probably wrong but is there anything else wrong? IM ON MY 2ND DAY OF C++ PROGRAMMING.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  5. #5

    Thread Starter
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Also what header files do what? I need to know which one sleep(); is in.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  6. #6
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Sleep is an API. So you need to include the windows.h header.
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  7. #7
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    gettickcount() gives you milliseconds from start if that's what you need. all win32api's should be available if you include the windows.h file
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  8. #8

    Thread Starter
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    ALL APIS????
    SWEETNESS!!
    I'm beginning to C why C++ is an industry standard.

    I'm REALLY sorry for the bad joke.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  9. #9
    denniswrenn
    Guest
    Well, not ALL APIs... just the most common ones.... nearly anything requiring an OCX in VB will require another header(commctrl.h, wsock.h, etc.)

  10. #10
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    those are not part of win32api either
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  11. #11
    denniswrenn
    Guest
    Well, they are APIs, and he said "ALL APIS????"

  12. #12
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Winsock, Common Controls, they're all part of the Win32 API
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

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