Quantcast
Channel: MicroStation Programming - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 383

[C/C++ MDL V8i] USTN Console - Press ENTER to continue or wait for 5s.

$
0
0

Hello, I need in my MDL app to make a message 'Press ENTER to continue or wait for 5s', but I can not find a way t:

  1. catch user press
  2. detect if console is a foreground window

This is what I tried without success (code normally works in console application):

      toolSubsystem_printf("Press ENTER to continue or wait for 5s...");

      HWND console_wnd = ::GetConsoleWindow();

      boost::timer tim;
      while ( tim.elapsed() < 5.0 )
      {
        if (
          ::GetForegroundWindow() == console_wnd &&   // does not work in USTN
          ::GetAsyncKeyState(VK_RETURN) == -32767 )   // does not work in USTN
        {
          toolSubsystem_printf("\r\n");
          break;
        }

        ::Sleep(0);
      }

How can I do that?

EDIT: I have also tried getc and toolSubsystem_getStdin but also without success (throws exception due to incpompatibility of FILE pointer)...


Viewing all articles
Browse latest Browse all 383

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>