0% found this document useful (0 votes)
59 views3 pages

DP of Wnds

This document contains code for a Windows application that displays student data. It defines a window procedure that handles messages to create child windows like labels, buttons, and a listbox to display the student name, roll number, section, registration number, and other data. When the buttons are clicked, it draws the text to the window using different colors. It also resizes and redraws the window when needed.

Uploaded by

Shoyab Siddiqui
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views3 pages

DP of Wnds

This document contains code for a Windows application that displays student data. It defines a window procedure that handles messages to create child windows like labels, buttons, and a listbox to display the student name, roll number, section, registration number, and other data. When the buttons are clicked, it draws the text to the window using different colors. It also resizes and redraws the window when needed.

Uploaded by

Shoyab Siddiqui
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

#include <windows.

h>
#include"resource.h"

LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,PSTR


szCmdLine, int iCmdShow)
{
static TCHAR szAppName[] = TEXT ("DESIGN PROBLEM") ;
HWND hwnd ;
MSG msg ;
WNDCLASS wndclass ;
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon(hInstance, (LPCWSTR)IDI_cpas) ;
wndclass.hCursor = LoadCursor (hInstance, (LPCWSTR)IDC_CURSOR1) ;
wndclass.hbrBackground =(HBRUSH) GetStockObject (BLACK_BRUSH) ;
wndclass.lpszMenuName = MAKEINTRESOURCE(IDR_MENU1) ;
wndclass.lpszClassName = szAppName ;
if (!RegisterClass (&wndclass))
return 0 ;

hwnd = CreateWindow (szAppName,TEXT(" RECORD OF SHOYAB ROLL NO


16"),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)
{

static HWND H1,H2,H3;


HDC hdc;
PAINTSTRUCT ps;
static int i=1;
switch(message)
{
case WM_CREATE:
H2=CreateWindow(TEXT("STATIC"),TEXT("THIS IS STUDENT
data"),WS_CHILD|WS_VISIBLE|SS_LEFT,200,200,200,200,hwnd,NULL,
(HINSTANCE)GetWindowLong(H2,GWL_HINSTANCE),NULL);
ShowWindow(H2,SW_SHOWNORMAL);
H3=CreateWindow(TEXT("BUTTON"),TEXT("VERSION 1"),WS_CHILD|
WS_VISIBLE|BS_PUSHBUTTON,100,200,100,100,hwnd,NULL,
(HINSTANCE)GetWindowLong(H3,GWL_HINSTANCE),NULL);
ShowWindow(H3,SW_SHOWNORMAL);
break;
case WM_COMMAND:
switch(wParam)
{
case ID_SHOW:
case ID_SHOWNAME_SHOW:
hdc=GetDC(hwnd);
SelectObject(hdc,GetStockObject(ANSI_VAR_FONT));
SetBkColor(hdc, RGB(235,125,142));
SetTextColor (hdc, RGB(255,255,135));
TextOut(hdc,20,30,TEXT("STUDENT NAME: SHOYAB
SIDDIQUI"),lstrlen(TEXT("STUDENT NAME: SHOYAB SIDDIQUI ")));

ReleaseDC(hwnd,hdc);
i=0;
break;
case ID_SHOWROLLNO :
hdc=GetDC(hwnd);
SetBkColor(hdc, RGB(075,145,55));
SetTextColor (hdc, RGB(025,195,035));
TextOut(hdc,20 ,50,TEXT("ROLL NO.:- 16"),lstrlen(TEXT("ROLL
NO.:- 16")));
MessageBox(hwnd,TEXT("student data\n version 1\n copyright
2010\n"),TEXT("VERSION MESSAGE"),MB_OK);
ReleaseDC(hwnd,hdc);
break;
case ID_SHOWSECTION:
hdc=GetDC(hwnd);
SelectObject(hdc,GetStockObject(ANSI_VAR_FONT));
SetBkColor(hdc, RGB(145,0,0));
SetTextColor (hdc, RGB(110,221,0));
TextOut(hdc,20,10,TEXT("SECTION
A1806"),lstrlen(TEXT("SECTION A1806")));

ReleaseDC(hwnd,hdc);
break;
case ID_SHOWREGNO:
hdc=GetDC(hwnd);
SelectObject(hdc,GetStockObject(ANSI_VAR_FONT));
SetBkColor(hdc, RGB(255,0,0));
SetTextColor (hdc, RGB(10,222,255));
TextOut(hdc,20,120,TEXT("REGISTRATION
NO:10805456"),lstrlen(TEXT("REGISTRATION NO:=10805456")));

ReleaseDC(hwnd,hdc);
break;
case ID_SUBMITTEDTO:
hdc=GetDC(hwnd);
SelectObject(hdc,GetStockObject(ANSI_VAR_FONT));
SetBkColor(hdc, RGB(0,0,255));
SetTextColor (hdc, RGB(150,255,210));
TextOut(hdc,20,80,TEXT("DP SUBMITTED TO:=MS.ISHA BATRA
MAM"),lstrlen(TEXT("DP SUBMITTED TO:=MS.ISHA BATRA MAM")));

ReleaseDC(hwnd,hdc);
break;
case ID_QUIT:
DestroyWindow(hwnd);
break;

}
break;

case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_PAINT :
if(i==0) {
hdc=BeginPaint(hwnd,&ps);
SelectObject(hdc,GetStockObject(ANSI_VAR_FONT));
SetTextColor (hdc, RGB(0,0,255));
SetBkMode(hdc, TRANSPARENT);
SetBkColor(hdc, RGB(150,255,210));
TextOut(ps.hdc,20,20,TEXT("YOU RESIZE THE WINDOW CLICK MENU
AGAIN"),lstrlen(TEXT("YOU RESIZE THE WINDOW CLICK MENU AGAIN")));
EndPaint(hwnd, &ps);
}
break;

H1 = CreateWindow ( TEXT("listbox"),
TEXT("SIMPLE"),
WS_CHILD |WS_VISIBLE|
LBS_STANDARD,200,300,80,200,
hwnd,(HMENU)100,
(HINSTANCE)GetWindowLong(H1,GWL_HINSTANCE),
NULL) ;
ShowWindow(H1,SW_NORMAL);
return 0;

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

You might also like