Code:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
#include <mmsystem.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
///////////////////////////////////////////////////////////////////////
// Globals
//////////////////////////
// This section will define globals
///////////////////////////////////////////////////////////////////////
HWND main_hwnd = NULL;
HINSTANCE main_instance = NULL;
///////////////////////////////////////////////////////////////////////
// Events Handler
//////////////////////////
// This section will handle windows events
///////////////////////////////////////////////////////////////////////
LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
PAINTSTRUCT ps;
HDC hdc;
switch(msg){
case WM_CREATE:
{
HDC hdc = GetDC(hwnd);
COLORREF TextColor = RGB(0,175,0);
SetTextColor(hdc,TextColor);
SetBkMode(hdc,TRANSPARENT);
return(0);
}break;
case WM_PAINT:
{
hdc = BeginPaint(hwnd,&ps);
TextOut(hdc,55,40,"Username:",strlen("Username:"));
TextOut(hdc,55,80,"Password:",strlen("Password:"));
EndPaint(hwnd,&ps);
return(0);
}break;
case WM_DESTROY:
{
PostQuitMessage(0);
return(0);
} break;
default:break;
}
return(DefWindowProc(hwnd,msg,wparam,lparam));
}
///////////////////////////////////////////////////////////////////////
// Window main
//////////////////////////
// This section is where the main program code goes.
///////////////////////////////////////////////////////////////////////
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow)
{
///////////////////////////////////////////////////////////////////////
// Windows Class
//////////////////////////
// This section sets up the windows class structure.
// This section creates the application, and determines its
// properties.
///////////////////////////////////////////////////////////////////////
WNDCLASSEX winclass;
HWND hwnd;
MSG msg;
winclass.cbSize = sizeof(WNDCLASSEX);
winclass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC | CS_DBLCLKS;
winclass.lpfnWndProc = WindowProc;
winclass.cbClsExtra = 0;
winclass.cbWndExtra = 0;
winclass.hInstance = hinstance;
winclass.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(100));
winclass.hCursor = LoadCursor(NULL,IDC_ARROW);
winclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
winclass.lpszMenuName = NULL;
winclass.lpszClassName = "WINCLASS1";
winclass.hIconSm = LoadIcon(NULL,IDI_WINLOGO);
if(!RegisterClassEx(&winclass))
return(0);
main_instance = hinstance;
main_hwnd = hwnd;
///////////////////////////////////////////////////////////////////////
// Create Window
//////////////////////////
// This section will create our window.
///////////////////////////////////////////////////////////////////////
if(!(main_hwnd = CreateWindowEx(NULL,"WINCLASS1","Lightning Round: Please Log In",
WS_OVERLAPPEDWINDOW | WS_VISIBLE,100,75,400,300,NULL,NULL,
hinstance, NULL)))
return(0);
///////////////////////////////////////////////////////////////////////
// Create Edit Controls
//////////////////////////
// This section will create our edit controls
///////////////////////////////////////////////////////////////////////
CreateWindowEx(NULL,"WINCLASS1","Username:",ES_LEFT | WS_VISIBLE | WS_CHILD,
60,40,CW_USEDEFAULT,CW_USEDEFAULT,main_hwnd,NULL,main_instance,NULL);
CreateWindowEx(NULL,"WINCLASS1","Password:",ES_LEFT | WS_VISIBLE | WS_CHILD,
60,80,CW_USEDEFAULT,CW_USEDEFAULT,main_hwnd,NULL,main_instance,NULL);
///////////////////////////////////////////////////////////////////////
// Main Event Loop
//////////////////////////
// This section will be where the main program code goes
///////////////////////////////////////////////////////////////////////
while(TRUE)
{
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if(msg.message == WM_QUIT){
break;
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return(msg.wParam);
}