[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Simple unmanaged C++ code to show a messagebox in windows

Posted on 2007-10-14
4
Medium Priority
?
1,421 Views
Last Modified: 2013-11-07
I'm familiar with C# but now I'm trying to understand unmanaged C++. What would be the shortest code for an unmanaged, non-dependent on .net framework, win32 program that simply shows a messagebox and exits when ok is pressed?
0
Comment
Question by:stormist
  • 3
4 Comments
 
LVL 7

Accepted Solution

by:
UrosVidojevic earned 2000 total points
ID: 20075216
#include <windows.h>

int main()
{
      MessageBox(0,"Message text...","Message title!",0);
      
      return 0;
}
0
 
LVL 7

Expert Comment

by:UrosVidojevic
ID: 20075227
0
 
LVL 10

Author Comment

by:stormist
ID: 20075234
In VS2005, which is the proper way to open a project of this sort without it inserting all that extra code? Is a win32 console app ok?
0
 
LVL 7

Expert Comment

by:UrosVidojevic
ID: 20075288
You may do that if you don't want extra code, but console window will also appear when you execute program.

So maybe best solution is to create Win32 application and then insert this code in

int APIENTRY WinMain(HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow) {}

function.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

867 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