?
Solved

DoEvents in C++

Posted on 2003-02-25
3
Medium Priority
?
1,434 Views
Last Modified: 2008-03-06
Hello,

In VisualC++ I have a program that calls DoEvents() and works just fine.  

I moved the exact same code outside VisualC++, since I need it as a stand alone program.  However, my DoEvents() now do cause linkage problems.  These look like:

void DoEvents(void)
{
    MSG msg;
    while(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
    {
       TranslateMessage(&msg);
       DispatchMessage(&msg);
    }
}

DoEvents processes Windows Messages in the message queue. C++ does not have a one command counterpart. What can I do?  I need a DoEvents in plain C++!  Anyone knows?
0
Comment
Question by:scecilia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Accepted Solution

by:
UncleJimbo earned 60 total points
ID: 8022475
DoEvents is just a function defined in a windows library, VC++ probably just automatically includes the library header, and link the library in when compiling/linking.

Basically when you compile (example here is for the GNU c++ compiler)

g++ yourprogram.cpp -o yourprogram.exe -lKernel32

The -lKernel32 means link to the Kernel32 library.

I think Kernel32 is the right library for DoEvents, check it and lemme know if it works.
0
 

Author Comment

by:scecilia
ID: 8025737
Dear UncleJimbo,

Kernel32.LIB did not work but User32.LIB did.  Thanks to your comment I got a better idea about which library to include.
0
 
LVL 11

Expert Comment

by:bcladd
ID: 9846042
No comment has been added lately, so it's time to clean up this TA. I will
leave a recommendation in the Cleanup topic area that this question is:

Answered: Points to UncleJimbo: Grade B

Please leave any comments here within the next seven days.

Experts: Silence means you don't care. Grading recommendations are made in light
of the posted grading guidlines (http://www.experts-exchange.com/help.jsp#hi73).

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

-bcl (bcladd)
EE Cleanup Volunteer
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question