C++ newbie question please HELP!!!?

Sasuke U

Member
Joined
Dec 22, 2009
Messages
57
Reaction score
0
Points
6
ok, so im fairly new to writing programs... so far i can do simple things like math in an MS-DOS window (you know, those black windows with grey letters) but i want to move on to real windows applications. well, basically i just want to know how to create an actual Windows 'window', a GUI. how do you do this? can you post the code to make a gui window here? thanks! and i'll be sure to pick you as best answer =D
@fourth answerer: thank you for actually answering my question!! i have to wait 4 hours before i can choose yours as best answer. thanks!
@first answerer: that has nothing to do with my question -.-

@second answerer: i think you mean visual basic... visual c++ is and IDE with a compiler, just like dev c++ (which is what im using)
 
You should download Visual C++ 2008 (Express Edition - FREE)... go to http://www.microsoft.com/express/download/ and scroll to the bottom of the page and download Visual C++...

Once you download it, you'll be able to create windows forms, buttons, menus, and much more... everything you need for GUIs. This will be especially useful for you since you're a beginner and with Visual C++ you can simply drag-and-drop controls onto the page without doing much coding. (Then later on, after seeing the generated code, you'll be able to write the code yourself if you wanted to. But for now, I strongly recommend downloading Visual C++ (on link above) and you'll be able to create GUIs really quickly.
 
Going from console programming (what you did there) to windows programming is hard. The code jumps from a few dozen lines to sometimes over hundreds. To get a working program, start a non-empty, win32 project (not console) in Visual Studio, if you have it, which I suggest because it is free and powerful. This will provide a good starting project that will display a window. Here the shortest program that will display a plain white screen using the windows API, standard with windows:

#include <windows.h>
#include <stdlib.h>
#include <time.h>

//application title
#define APPTITLE "Hello World"

//function prototypes (forward declarations)
BOOL InitInstance(HINSTANCE,int);
ATOM MyRegisterClass(HINSTANCE);
LRESULT CALLBACK WinProc(HWND,UINT,WPARAM,LPARAM);


//the window event callback function
LRESULT CALLBACK WinProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}

//helper function to set up the window properties
ATOM MyRegisterClass(HINSTANCE hInstance)
{
//create the window class structure
WNDCLASSEX wc;
wc.cbSize = sizeof(WNDCLASSEX);

//fill the struct with info
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC)WinProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = APPTITLE;
wc.hIconSm = NULL;

//set up the window with the class info
return RegisterClassEx(&wc);
}

//helper function to create the window and refresh it
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;

//create a new window
hWnd = CreateWindow(
APPTITLE, //window class
APPTITLE, //title bar
WS_OVERLAPPEDWINDOW, //window style
CW_USEDEFAULT, //x position of window
CW_USEDEFAULT, //y position of window
500, //width of the window
400, //height of the window
NULL, //parent window
NULL, //menu
hInstance, //application instance
NULL); //window parameters

//was there an error creating the window?
if (!hWnd)
return FALSE;

//display the window
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);

return TRUE;
}


//entry point for a Windows program
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, LPSTR lpCmdLine,int nCmdShow)
{
// declare variables
MSG msg;

// register the class
MyRegisterClass(hInstance);

// initialize application
if (!InitInstance (hInstance, nCmdShow))
return FALSE;

//set random number seed
srand(time(NULL));

// main message loop
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}

return msg.wParam;
}

Told you it was long. This was copied from Beginning Game Programming. Make sure that you are using a win32 project, not a console project. Also, use a multibyte charecter set, not Unibyte. It is a project setting. If you have any problems or questions, email me at [email protected]
 
Shoutbox
  1. wilson holistic centre:
    new girl works at 💋535 Evans Ave today 💕💕💕☎️☎️416-531-6969☎️☎️
  2. SL East Spa:
    💆‍♀💖Terrific Thursday 💖 Ultimate destination for Asian massages🎉 Two fab spots: SL Richmond Hill & SL West Oakville ✨ Your passport to paradise with 10 enchanting girls fr China, HK — 🆕Tiffany, Joey, Julie, Aaliyah, Cici, Coco, Yui, Meghan, Julia & New 34D Jasmine—— ready to pamper you🎁🍁 Ring us 📞647-695-6354 or text us 📱647-578-8169✨ 160 East Beaver Cr., Unit 12, RichmondHill 💰Where Eastern charm meets Western comfort - your bliss awaits
  3. SpringGreen.:
    Today we have 5 girls on Thursday:💋💋New girl MIMI💋💋 apple- Sweet school girl with a large serving of naughtiness Angela- Slim beauty with long legs and nice proportions Julia- Exotic beauty with great service and attitude k k- Spunky fun in... Attachments Call and text 6478910699 ask questions thx
  4. wilson holistic centre:
    new girl works at 💋535 Evans Ave today 💕💕💕☎️☎️416-531-6969☎️☎️
  5. Lilyspa1:
    Lily Spa : 💰💰100 hh all in💰💰 ❤️❤️ SuSu ( Asian )Slim , 😍😍Porn Service 🩷🩷Elena 22, Latino French, 36 DDD and 🍑🍑ASS, 💋💋Mimi 24, Asian mixed White , very open-Minded , 😈bbbj , DFk 🔥Duo 🔥,☎️ 6475318288
  6. Lulu1980:
    Phoenix Blossom Spa 🌹🌹🌹2 girls,Nina 、Cindy 🔥🔥🔥5124 Dundas St W Etobicoke☎️416-817-3366👍 Table Shower Sea Salt Bath Body Scrub😘 Japanese girl Nina ❤️ Natural Big Boobs 38 DD 😘Pink Mini Nipples Hot body slide, super enjoyable😘😘😘😘 very provocative service😘😘😘, Mia sexy girl 1.65 M.pretty boobs 36D😘Superb service 👍 massage, has therapeutic effect to loosen bones and relieve muscle pressure and will bring you unexpected service effects, she will bring you a little surpr
  7. Nu spring spa888:
    ❤️❤️❤️sexy hot Germany🌸Korean 🌸 Singapore girl working at💓💓 Nu spring spa ☎️416-669-8508❤️❤️❤️
  8. jrgcsn17:
    mississauga
  9. Golden Sunshine Spa:
    ✨Click on our Username and FOLLOW US for updates and special services ! ✅ Click Here Today🌸Aletta🌸Jessica🌸Selina🌸Nina🌸Chelsea Call us ☎ 905 - 265 - 2158☎️ Your ultimate service awaits! ✨
  10. Red Rose Spa:
    🌸 We have 5 hot brown girls today 🌸 MONICA, LUCY, ANGEL, JANVI, AMANDA, MEGAN, JAZMINE, MONIKA, KIRAN 🌸 2588 Birchmount 🌸 2 Invergordon 🌸 647-702-8800 🌸 Please visit for a great erotic massage
  11. Withme_Spa:
    💕💥4386 Sheppard Avenue east 💯💞💋💘Thursday ❣❤  Ruby, average height and sexy build, nice boobs, long hair. Beautiful. Firm treatment awesome service ❤💞 Lucy, beautiful, dark hair to shoulder, tall and slim but busty, very relaxing treatment with over the top finish. ❣❤ Yoyo, 💋medium height and sexy build with shapely legs and ass. friendly, very good treatment and excellent finish 💖💞 Crystal, 💋average height, slim build, very pretty, white skin, medium treatment, 💋💖🔋416 297-7488🔋
  12. 89moonstar&MoonMoon:
    MoonMoon spa/416 887 8801/8131Yonge st #203 Cuban girl Mimi and Asian girl today
  13. wilson holistic centre:
    new girl works at 💋535 Evans Ave today 💕💕💕☎️☎️416-531-6969☎️☎️ Edit
  14. wonderspa:
    wonderspa: ☎️416-5000-800,L6a4H8,open10 to10,Ensuit shower available open long weekend 🌹🔥beautiful young Jessica deep tissue to relax massage back walk,hot stone🍅sexy face sunny is very good looking,slim body ,nice body slide sweet sensual touch 🌹beautiful long hair younge new lily,must try,amazing oil strong to relaxing massage,very friendly smile,bring you comfortable warm time,must try🌹🔥
  15. lemon_tree:
    💛💥a discreet entrance to 4155 Sheppard Avenue east, unit 201💯💞❣Thursday, ❣👄 Cici...💕 small build, friendly and pretty,nice touch, with a lot of energy, service oriented, aka Coco 💓💥 💋♥️💋📞647 348-2899📞
  16. AliceSpa:
    THURSDAY at 𝗔𝗟𝗜𝗖𝗘 𝗦𝗣𝗔.4915 Steeles Ave. E, Scarborough 𝟰𝟭𝟲-𝟮𝟵𝟴-𝟬𝟴𝟵𝟴. 3 girls here today at ALICE SPA. Open 10am to 9pm: BEBE (12pm-9pm) is a young slim Vietnamese girl with a beauty face, C Cup, 5'2" & 100 Lbs, student and model looks, vg at fs multiple positions, bbbj ymmv must be clean and respectful. CLOUDIA (10am-9pm): is Vietnamese, young, petite 5'2" & 96 Lbs, B Cup
  17. Jenny’s Spa:
    🎉🍒JENNY’S SPA🎉🍒 ✅5170 DUNDAS STREET WEST✅ 👌ETOBICOKE ONTARIO M9A 1C4👌 ☎️( 647-893-5196)☎️Call or Text ☎️( 437-888-3759)☎️Call Only (ETOBICOKE) OPEN 10am to 9pm MONDAY to SUNDAY 🔥✅GRAND OPENING💯NEW GIRLS EVERYDAY🔥EXCELLENT MASSAGE + SERVICE QUEENS NOW AVAILABLE AT JENNY’S SPA FOR ALL YOUR MASSAGE AND SPECIAL EXTRA NEEDS🔥💯😘🔥❤️👌 🔥TWO BEAUTIFUL NEW YOUNG ASIAN GIRLS EVERYDAY🔥 💯REAL PICTURES OF ATTENDANTS💯 🔥💋Limited Time Special Promotion🔥💋 ✅💦30 Minutes Nude Mass
  18. ForeverWarden:
    Thursday at 🫦❤️🔴🟥♾️𝓕𝓞𝓡𝓔𝓥𝓔𝓡 𝓢𝓟𝓐♾️🟥🔴❤️🫦🫦2190 Warden Ave, Unit 201, Scarborough 𝟰𝟭𝟲-𝟴𝟬𝟬-𝟳𝟴𝟴𝟳: Cindy, Sophia & Tracy. Cindy is a slim beauty, 5’4”, natural C Cups. Her massage is nice, her services will drive you wild & her finish is a dream come true. Sophia is a sweet & pretty Chinese lady with natural B Cups and an awe-inspiring smooth rounded ass. Sophia can provide top notch services
  19. HolidaySpa:
    Thursday at 🌴😎🌅𝓗𝓸𝓵𝓲𝓭𝓪𝔂 𝓢𝓹𝓪🌅😎🌴3517 Kennedy Rd, Unit 4, Scarborough ☎️𝟰𝟯𝟳-𝟮𝟰𝟳-𝟭𝟭𝟵𝟵☎️: ANGELA, LUCY & CINDY. Angela is versatile and responsive. LUCY is a beautiful and slim Asian lady with a happy disposition and great services. CINDY is a slim & incredibly sexy lady with a smile that will melt your heart, & an ass that will fire up your spirit.
  20. SugarLoveSpa:
    Thursday at ❤️💙 💜⎝𝗦𝗨𝗚𝗔𝗥 𝗟𝗢𝗩𝗘 𝗦𝗣𝗔⎠💖💗💘: LUNA, MIA, SARA & TIFFANY. 1270 Finch Ave W (at Keele St), Unit 18. North York, ON ☎ 𝟰𝟯𝟳-𝟯𝟲𝟱-𝟮𝟲𝟴𝟴 ☎ LUNA is a slim, VERY PETITE and capable Vietnamese beauty, nice natural 34C Cups. Luna can do everything. MIA is a young & slim 𝙎𝙋𝙄𝙉𝙉𝙀𝙍, very PRETTY & PETITE Vietnamese beauty with perfect natural A Cups, 5’1” & 90 Lbs, very versatile. Come and enjoy.
  21. Lulu_Villa_Spa:
    Yuki Sweet Singaporean Girl Judy is a gorgeous model type Vietnamese Girl Mia Vietnamese sweetheart girl with amazing personality ☎️647-446-0886
  22. Red_Pearl_Spa:
    ♥️💋4385 Sheppard Avenue east, unit 5 🔺💋💋🔴 💋💘 Jenny, slim body, tall and pretty, here for therapeutic treatment with amazing finish+ 🤩💞 Tammy, full body treatment by an amazing attendant.💋☎️647 352-1588☎️
  23. Spa in Markham:
  24. BlueXado Therapy & Spa:
  25. bnwellness_wilson:
    We have 4 young girls are working today, young flirty Ivy 36DD with big buttocks 30’s and young Taiwanese Victoria slime 25’s open mind, pretty Tina with sexy curve body open mind and cute GFE Ella are providing deep tissue massage, pls call 4163985777 book appointment and walk in always welcome,back entrance and parking available, 350 Wilson Ave North York
  26. Pink Flower Spa:
  27. gold__rose__spa:
    💐🏵1536 Warden Avenue 💗💞💋Thursday, 💞💋Michelle for traditional style treatment and quality services., newly toned body, strong, does very firm treatment,. 💐🌹 📳 647 346-8086📳
  28. Annie Spa:
    🎉🍒ANNIE SPA🎉🍒 ✅7-1001 SANDHURST CIRCLE✅ 👌SCARBOROUGH ON M1V 1Z6👌 ☎️ (647) 891-9688☎️ ☎️ (416) 291-8879☎️ (FINCH & MCCOWAN) OPEN 9:30am to 9pm MONDAY to SUNDAY 🔥✅NEW MANAGEMENT💯NEW GIRLS🔥🔥 🔥GORGEOUS NEW YOUNG ASIAN GIRLS - TODAY’s ROSTER INCLUDES: 🔥Suki😍is beautiful short petite tiny sexy student from Cambodia. Exotic features and model looks, Suki has a nice bum, slim waist, flat stomach and very good massage skills and has a great playful personality. Suki has a beaut
  29. Double_Tree:
    💞4271 Sheppard Avenue east 💗💋Thursday, 💞💯Sofia, tall and slim, experienced touch that will have you relaxed and feeling energized. 💗❣ Holly, tall with medium build . Pretty, has long brown hair. white skin, soft hands +. 💘 📞 416 293-5071📞
  30. Lulu_Villa_Spa:
    Judy is a gorgeous model type Vietnamese Girl Mia Vietnamese sweetheart girl with amazing personality Bella She is Mexican Gorgeous face Natalie she is CBC/filipina mixed Petite girl Barbie Petite Korea Part time School girl ☎️64
  31. Lulu1980:
    Phoenix Blossom Spa 🌹🌹🌹2 girls,Nina 、Cindy 🔥🔥🔥5124 Dundas St W Etobicoke☎️416-817-3366👍 Table Shower Sea Salt Bath Body Scrub😘 Japanese girl Nina ❤️ Natural Big Boobs 38 DD 😘Pink Mini Nipples Hot body slide, super enjoyable😘😘😘😘 very provocative service😘😘😘, nice girl Mia Round buttocks 😜pretty boobs 36D😘Superb service 👍 massage, has therapeutic effect to loosen bones and relieve muscle pressure and will bring you unexpected service effects, she will bring you a little surprise
  32. luckywellness:
    Lucky Wellness Center 4379721888 295 Eglinton Ave E,Unit 7,Mississauga Kiki and Suki work
  33. DareDevil:
    Blackpink Wellness ♥️♥️90 Marycroft Ave. Unit #2, Vaughan, 🍭🍬ON L4L 5Y1 (647) 395-3188. BEAUTIFUL AND SEXY GIRLS TODAY:🌹🌹Fun Girl Akino, Indian Girl Radika and Beautiful Tiffany on duty 🌹🌹 .
  34. DareDevil:
    ARIA WELLNESS ♥️♥️ADDRESS: 360 HWY 7, UNIT #6, RICHMOND HILL,647-222-5683 ♥️♥️(PHONES CALL ONLY, NO TEXT'N AVAILABLE) ♥️TODAY'S Schedule!♥️ Loaded lineup with Beautiful Girls : New Girl Phoebe, Superstar Lucy, Young RMT Student Helen, Magical Mia and Work out🏋🚴💪 Babe Amy! SPECIAL PROMO 30 MINS 2 GIRLS $70 🌹🌹**TODAY'S PICKS OF THE DAY IS 🍭🍬LUCY AND PHOEBE🍬🍭**
  35. wonderspa:
    🌺welcome to wonder spa☎️416-5000-800,L6a4H8,open10 to10,Ensuit shower available 🍅beautiful young Jessica deep tissue to relax massage back walk,hot stone🍅sexy face sunny is very good looking,slim body ,nice body slide sweet sensual touch 🌹beautiful long hair younge new lily,must try,amazing oil strong to relaxing massage,very friendly smile,bring you comfortable warm time,happy long weekend 🔥🔥
  36. EMSpa_schedule:
    Tomorrow's sneak peek: On Thursday May 15, 2025, our attendants will be Vicky 🥰, Monica 🥰, Ada 🤩, Cici 😍 and Sophie 🤗. Call us at ☎️(905) 479-6668☎️ to book!
  37. wilson holistic centre:
    💕💕Beautiful Korean girl working at 382 Wilson Ave 💕💕☎️☎️416-840-0071❤️❤️
  38. SL East Spa:
    💆‍♀💖WooHoo Wed💖 Ultimate destination for Asian massages🎉 Two fab spots: Richmond Hill & Oakville✨ Your passport to paradise with 9 enchanting girls fr China, HK, Japan & Korea — 🆕Gigi, Cindy, Coco,Cici, Amber, JPN Yui, Akino, Jasmine & Lucy— ready to pamper you🎁🍁 Ring us 📞647-695-6354 or text us 📱647-578-8169✨ 160 East Beaver Cr., Unit 12, RichmondHill 💰Where Eastern charm meets Western comfort - your bliss awaits🙌
  39. Lilyspa1:
    Lily Spa :💕💕Thursday Schedule 🇮🇳🇮🇳Sana 23, , Punjabi girl , very pretty 36 DDD 😈GFE ❤️Elena ( Latino ) Big Nature Boobs & SuSu ( Asian )Slim , 😍😍Porn Service 🔥Duo 🔥,☎️ 6475318288
  40. Lulu1980:
    Phoenix Blossom Spa 🌹🌹🌹2 girls 🔥🔥🔥5124 Dundas St W Etobicoke☎️416-817-3366👍 Table Shower Sea Salt Bath Body Scrub😘 Japanese girl Nina ❤️ Natural Big Boobs 38 DD 😘Pink Mini Nipples Hot body slide, super enjoyable😘😘😘😘 very provocative service😘😘😘, professional super Luna deep tissue massage, has therapeutic effect to loosen bones and relieve muscle pressure and will bring you unexpected service effects, she will bring you a little surprise😍😍😍😍❤️You are welcome to make an appoint
  41. Nu spring spa888:
    🌹🌹🌹sexy hot Philippine 💖 💖 Canadian 💖 💖 Indian girls 👍working at Nu spring spa💋💋☎️416-669-8508🌹🌹🌹
  42. LittleMan:
    Best masage in Oakville/Burlington? Please recommend
  43. wonderspa:
    🌺Wonder spa,(9421Jane st unit127)call416-5000-800☎️best massage in vaughan,Wednesday RMT available,💄sexy face young girl Joey natural c cup,very good looking nice body slide,really popular 🍎long hair Q Lucy good strong to relax oil massage, Relieve pain and remove stress,more experience,🌹young friendly Cici slim body ,backwalk,amazing ending ,bring you comfortable warm time😀🔥🔥
  44. Spa in Markham:
  45. BlueXado Therapy & Spa:
  46. Pink Flower Spa:
  47. Jenny’s Spa:
    🎉🍒JENNY’S SPA🎉🍒 ✅5170 DUNDAS STREET WEST✅ 👌ETOBICOKE ONTARIO M9A 1C4👌 ☎️( 647-893-5196)☎️Call or Text ☎️( 437-888-3759)☎️Call Only (ETOBICOKE) OPEN 10am to 9pm MONDAY to SUNDAY 🔥✅GRAND OPENING💯NEW GIRLS EVERYDAY🔥EXCELLENT MASSAGE + SERVICE QUEENS NOW AVAILABLE AT JENNY’S SPA FOR ALL YOUR MASSAGE AND SPECIAL EXTRA NEEDS🔥💯😘🔥❤️👌 🔥TWO BEAUTIFUL NEW YOUNG ASIAN GIRLS EVERYDAY🔥 💯REAL PICTURES OF ATTENDANTS💯 🔥💋Limited Time Special Promotion🔥💋 ✅💦30 Minutes Nude Mass
  48. wilson holistic centre:
    💕💕Beautiful Korean girl working at 382 Wilson Ave 💕💕☎️☎️416-840-0071❤️❤️
  49. Soul Relax Spa:
    ✨ Looking for a relaxing escape? ✅ Click Here Meet🌸Tina🌸Jessica🌸IsabellaCall us today for the best treatment and service experience. Click on our Username and FOLLOW US for updates ! Call now ☎ 289 - 298 - 5662☎️ Your ultimate relaxation awaits! ✨
  50. Lilyspa1:
    Lily Spa :💕💕 Wednesday Schedule 🇮🇳🇮🇳Kajal 23, Punjabi girl 😈GFE & bbbj ❤️❤️Elena ( Latino ) Big Nature Boobs & SuSu ( Asian )Slim , 😍😍Porn Service 🔥Duo 🔥,☎️ 6475318288
Back
Top