answersLogoWhite

0

A DOS program's output/input is based souly on the DOS proment, while a win api based program is based within its own window.

Code is untested!

// DOS Prompt Code c/c++ - With output

#include <iostream> // Input Output Stream

int main()

{

std::cout << "Hello World"; // Output Command

return 0;

}

// Win Api Code c/c++ just window

#include <windows.h>

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,PSTR szCmdLine, int iCmdShow)

{

static TCHAR szAppName[] = TEXT ("Opengl");

HWND hwnd;

WNDCLASS wndclass;

HDC hdc;

MSG msg;

HGLRC hrc;

wndclass.style = CS_HREDRAW | CS_VREDRAW;

wndclass.lpfnWndProc = WndProc;

wndclass.cbClsExtra = 0;

wndclass.cbWndExtra = 0;

wndclass.hInstance = hInstance;

wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION);

wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);

wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);

wndclass.lpszMenuName = NULL;

wndclass.lpszClassName = szAppName;

if (!RegisterClass (&wndclass))

{

MessageBox (NULL, TEXT ("This program requires Windows NT!"),

szAppName, MB_ICONERROR);

return 0;

}

hwnd = CreateWindow (szAppName,

TEXT ("OpengGL"),

WS_OVERLAPPEDWINDOW,

CW_USEDEFAULT,

CW_USEDEFAULT,

CW_USEDEFAULT,

CW_USEDEFAULT,

NULL,

NULL,

hInstance,

NULL);

ShowWindow (hwnd, iCmdShow);

UpdateWindow (hwnd);

while (GetMessage (&msg, NULL, 0, 0))

{

TranslateMessage (&msg);

DispatchMessage (&msg);

}

return msg.wParam;

}

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)

{

switch (message)

{

case WM_PAINT:

opengl.callDisplayFunc();

return 0;

case WM_SIZE:

return 0;

case WM_KEYDOWN:

switch(wParam)

{

case VK_ESCAPE:

SendMessage(hwnd,WM_DESTROY,wParam,lParam);

break;

}

return 0;

case WM_DESTROY:

PostQuitMessage(0);

return 0;

}

return DefWindowProc (hwnd, message, wParam, lParam);

}

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

What is the difference between Windows-based C programming and Linux-based C programming?

C programming is just that no matter if the operating system is Windows or Linux. Operating systems usually have an Application Program Interface that is commonly known as an API. The APIs of Windows will be different than Linux because the operating systems are (very) different.


Differentiate between GUI and command based operating system?

stolen


Similarities between UNIX and Windows?

UNIX is a command-based OS. In contrast, Windows is a menu-based OS.


What is the most common way firms differentiate between consumer group?

based on age and gender


How can we differentiate between statistical and taste-based discrimination in decision-making processes?

Statistical discrimination is based on objective data and patterns, while taste-based discrimination is rooted in personal biases and preferences. To differentiate between the two in decision-making processes, it is important to analyze the reasoning behind the decisions and assess whether they are based on factual information or subjective beliefs.


How do you differentiate between democratic and dictatorship forms of government based on the distribution of power between the executive and legislative branches and the people and judicial?

value of humanity


Can any one give the information for vb dot net programming certification?

I searched in Microsoft site found only related to framework, web based ,windows based etc certifications. But , I need the certification exam which is completely based on the programming concepts of vb.net .... I did not find ..... could you please help me if you can ... Thanking you Rajesh Kolla


What is major difference between window 98 and window xp?

The major difference to date is that Windows 98 is no longer supported by Microsoft. Another notable difference is that Windows XP provides greater stability as a whole. A vast magority of programs available are only usable on Windows XP/Vista machines, and like Microsoft, no longer supported for the older operating system.


What are at least three similarities between Windows XP and Windows XP 2000?

&bull;Windows XP is heavily based on the Windows NT and 2000 core. &bull;Default user login identical to XP Home Edition, but can be configured to do domain authentication like NT and 2000 &bull;Administrative shares exist and are accessible in the same manner that they were in NT and 2000. &bull;Windows XP continues the 32-bit programming model that was fully implemented in NT and 2000 -from Sabastian Gomes B'lore


How do our eyes perceive and differentiate between various color temperatures?

Our eyes perceive and differentiate between various color temperatures based on the wavelengths of light that are reflected or emitted by objects. Different color temperatures are perceived as warmer (reddish) or cooler (bluish) based on the balance of red, green, and blue light that our eyes detect.


How can we differentiate between subjective and objective language in communication?

Subjective language is based on personal opinions, feelings, and beliefs, while objective language is based on facts, evidence, and observations. To differentiate between the two in communication, we can look for words that express personal viewpoints (subjective) versus words that present verifiable information (objective).


Is it possible to differentiate between hypo- and hypereutectic compositions of an alloy based on a single cooling curve and the phase diagram of the alloy?

Try it.