Hello World
Hello World
![]() |
![]() Character World 125 x 150 cm Hello Kitty Hearts Junior Panel Duvet Set US $35.69
|
![]() Hello World US $18.22
|
![]() Goebel Hummel HELLO WORLD 429 TMK7 R94 US $65.00
|
![]() GRETCHEN PETERS HELLO CRUEL WORLD NEW CD US $17.45
|
Write Hello World using WIN32 API
As I haven't read any 'Hello world' example written for use in Windows, I thought I might just write my own tutorial, so here it is:
First of all we include the windows handler
#include
Next thing we do is hooking the main function, which is called WinMain for use in Windows. And save the instance outside the function
HINSTANCE hInst;
int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { hInst = hInstance; return 0; }
This is the main function we are going to use, now in this function, we have to call a function which sets up our main window. We also have to leave the window open as long as we didn't exit it and keep it updated. So now the main function looks like this:
int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
MSG msg;
hInst = hInstance;
initApplication( hInst );
while( GetMessage( &msg, 0, 0, 0 ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
return msg.wParam;
}
In the function initApplication which we call in WinMain, we will have to initialize the main window.
void initApplication( HINSTANCE hInstance )
{
WNDCLASS wC; // Defines the class
wC.cbClsExtra = 0;
wC.cbWndExtra = 0;
wC.hbrBackground = ( HBRUSH ) GetStockObject( LTGRAY_BRUSH ); // Choose background color
wC.hInstance = hInst; // Mention the instance
wC.hCursor = LoadCursor( NULL, IDC_ARROW ); // Load the cursor
wC.hIcon= LoadIcon( NULL, IDI_APPLICATION ); // Load the icon
wC.lpszClassName = "Main"; // Name of the window
wC.lpfnWndProc = ( WNDPROC ) MainProc; // The window process function
wC.lpszMenuName = NULL;
wC.style = CS_HREDRAW | CS_VREDRAW;
RegisterClass( &wC ); // Register the class
// Setting up the position and size
int x = 300;
int y = 300;
int w = 300;
int h = 300;
// Creating the actual window
Main = CreateWindow( "Main", "Main", WS_OVERLAPPEDWINDOW, x, y, w, h, 0, 0, hInstance, 0 );
ShowWindow( Main, SW_SHOW ); // Displays the main window
UpdateWindow( Main ); // Update it
}
Now we have to declare the process function and write it.
LRESULT APIENTRY MainProc( HWND, UINT, WPARAM, LPARAM ); // Definition
LRESULT APIENTRY MainProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) // Actual process
function
{
#define HELLOWORLD 1
switch ( msg )
{
case WM_CREATE: // When WM_CREATE is used, you can create buttons, etc
{
CreateWindow( "Static", "Hello World", WS_CHILD | WS_VISIBLE, 50, 50, 100, 20, hwnd, ( HMENU )
HELLOWORLD, hInst, 0 ); // Create the static
}
break;
case WM_DESTROY: // If WM_DESTROY is used, you should leave the program
{
ExitProcess( 0 );
}
break;
default:
return DefWindowProc( hwnd, msg, wParam, lParam );
}
return 0;
}
About the Author
Come visit my latest website that discusses your computer workstation desk and school computer furniture. For the extra touch in your house or school.
|
|
Hello World $10.49 Hello World |
|
|
Hello Cruel World $11.49 Hello Cruel World |
|
|
Hello Kitty, Hello World $21.17 The popular character Hello Kitty travels to 12 countries, saying hello to people of many different cultures in their native languages. Color illustrations accompany the text. |
|
|
Hello World (The Motown Solo Collection) $25.99 Hello World (The Motown Solo Collection) |
|
|
Hello $11.99 Track Listing: 1. Hello, 2. Trigger Happy Jack (Drive by a Go-Go), 3. Choking the Cherry, 4. That Day, 5. Angry Johnny, 6. Dolphin, 7. Another World, 8. Fingertips, 9. Beautiful Girl, 10. Junkie, 11. Fly Away |
|
|
How the World Says Hello $27.99 Catrina Genovese How the World Says Hello - Art Print |
|
|
Hello, World $11.09 This charming board book takes children on a world tour by teaching them to say Hello in 10 different languages and includes allnew, colorful artwork inspired by Mary Blairs designs for the famous Disney theme park attraction, Its a Small World. Author: Kubo, Nancy (ILT)/ Ho, Winnie (CRT) Series Title: Its A Small World Publication Date: 2011/08/16 Number of Pages: 16 Binding Type: School And Library Grade Level: Preschool Language: MULTILINGUAL Depth: 0.25 Width: 7.00 Height: 7.25 |
|
|
Hello World! $12.99 Track Listing: 1. Hello World, 2. Buono Appetito, 3. We're All in This Together, 4. On the Day You Were Born, 5. When I Get a Feeling, 6. Time Together, 7. Over the Rainbow, 8. Digging for Diamonds, 9. I Want You to Listen, 10. We're Rich, 11. Starlight Star Bright, 12. Shining Eyes |
|
|
Hello! $10 Hello! |
|
|
Hello Kitty Surprise Egg $1.49 14,90 EUR / 100g - Spielspa� und naschen - Hello Kitty Fans werden mit dem Hello Kitty Surprise Egg ganz viel Spa� haben. Figuren, Sticker und Candies rosa und wei�e Zuckerdragees warten auf neugierige Hello Kitty Ei Sammler. In jedem Ei steckt eine tolle �berraschung. Nicht f�r Kinder unter 3 Jahren geeignet. |
|
|
Hello World As Made Famous By Lady Antebellum $10 Hello World As Made Famous By Lady Antebellum - American Country Hits |
|
|
Amely - Hello World $19.3 Disc 1:Now or NeverSing To YouI`d Rather Be AloneSay GoodbyeCome Back To MeAll You NeedHave You Ever Known?Hello World |


US $19.99































![GRETCHEN PETERS HELLO CRUEL WORLD DIGIPAK] NEW CD](http://www.indir1.us/images/e/110880635298_0.jpg)













![OH ASTRO HELLO WORLD CD NEW]](http://www.indir1.us/images/e/140710495781_0.jpg)
















































