Post: Simple Win32 API [C++Source]
03-08-2011, 12:07 AM #1
(adsbygoogle = window.adsbygoogle || []).push({}); I'm going to be learning SFML and OpenGL over the next few months, so i thought id start with Win32 API, and working my way up from there.

(This uses the drawMenu.h header which can be found in my pingpong source at [url]www.mediafire.com/uber[/url])

    #include<windows.h>
#include "drawMenu.h"


int WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, LPSTR lCmdLine, int CmdShot)
{
bool FULLSCREEN = false;
const unsigned short MB_YES = 6;

for(;Winky Winky
{
if(FULLSCREEN)
{
switch(
drawMenu("Select an operation from TheUberFails program",
"Exit Fullscreen|Exit",
1)
)
{
case 1: keybd_event(VK_MENU,0x38,0,0);
keybd_event(VK_RETURN,0x1c,0,0);
keybd_event(VK_MENU,0x38,KEYEVENTF_KEYUP,0);
keybd_event(VK_RETURN,0x1c,KEYEVENTF_KEYUP,0);
FULLSCREEN = false;
break;

case 2: if(MessageBox(NULL,"Do you want exit?","Question",MB_YESNO | MB_ICONQUESTION)==MB_YES)
{
return 0;
}
break;
}
}
else
{
switch(
drawMenu("Select an operation from TheUberFails program",
"Fullscreen|Exit",
1)
)
{
case 1: if(MessageBox(NULL,"Do you want to go fullscreen?","Question",MB_YESNO | MB_ICONQUESTION)==MB_YES)
{
keybd_event(VK_MENU,0x38,0,0);
keybd_event(VK_RETURN,0x1c,0,0);
keybd_event(VK_MENU,0x38,KEYEVENTF_KEYUP,0);
keybd_event(VK_RETURN,0x1c,KEYEVENTF_KEYUP,0);
FULLSCREEN = true;
}
break;

case 2: if(MessageBox(NULL,"Do you want exit?","Question",MB_YESNO | MB_ICONQUESTION)==MB_YES)
{
return 0;
}
break;
}
}
}
}

:sleep::beer:

The following user thanked TheUberFail for this useful post:

kiwimoosical
03-08-2011, 01:51 AM #2
kiwimoosical
Bounty hunter
Nice. I prefer console applications though, much faster in creation and actual speed. And I hate writing UI's. I prefer back-end work xP
03-08-2011, 02:00 AM #3
Originally posted by kiwimoosical View Post
Nice. I prefer console applications though, much faster in creation and actual speed. And I hate writing UI's. I prefer back-end work xP


Back end work? :confused:
03-08-2011, 12:01 PM #4
kiwimoosical
Bounty hunter
Like base functions, the stuff that happens when you press save, that kind of stuff, not just the looks.

The following user thanked kiwimoosical for this useful post:

TheUberFail

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo