TCHAR * rownanie;
HINSTANCE hInst;
BOOL bChecked;
LRESULT CALLBACK WndProc( HWND, UINT, WPARAM, LPARAM );
HWND hText, hText2, hText3, hText4, hText5, clean, x_variable, hText6;
HWND listview;
DWORD dlugosc;
bool show_onp;
LPWSTR Bufor;
int x, y;
bool odp;
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow )
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof( WNDCLASSEX );
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon( hInstance, MAKEINTRESOURCE( IDI_APPLICATION ) );
wcex.hCursor = LoadCursor( NULL, IDC_ARROW );
wcex.hbrBackground =( HBRUSH )( COLOR_WINDOW + 1 );
wcex.lpszMenuName = NULL;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon( wcex.hInstance, MAKEINTRESOURCE( IDI_APPLICATION ) );
if( !RegisterClassEx( & wcex ) )
{
MessageBox( NULL,
_T( "Call to RegisterClassEx failed!" ),
_T( "Win32 Guided Tour" ),
NULL );
return 1;
}
hInst = hInstance;
HWND g_hPrzycisk, sqrt, abs, tan, ctg;
HWND przycisk_1, przycisk_2, przycisk_3, przycisk_4, przycisk_5, przycisk_6, przycisk_7, przycisk_8, przycisk_9, sin, cos, LICZ;
HWND pokazONP, asin, acos, actan, atan, nawiasy, ln, exp;
HWND plus, minus, iloczyn, dziel, rowne, zero;
HWND hWnd = CreateWindow(
szWindowClass,
szTitle,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
1000, 700,
NULL,
NULL,
hInstance,
NULL
);
hText = CreateWindowEx( WS_EX_CLIENTEDGE, L"EDIT", NULL, WS_CHILD | WS_VISIBLE | WS_BORDER,
20, 30, 220, 20, hWnd, NULL, hInstance, NULL );
hText2 = CreateWindowEx( WS_EX_CLIENTEDGE, L"EDIT", NULL, WS_CHILD | WS_VISIBLE | WS_BORDER |
WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL, 780, 130, 200, 450, hWnd, NULL, hInstance, NULL );
hText3 = CreateWindowEx( WS_EX_CLIENTEDGE, L"EDIT", NULL, WS_CHILD | WS_VISIBLE | WS_BORDER, 800
, 30, 50, 20, hWnd, NULL, hInstance, NULL );
hText4 = CreateWindowEx( WS_EX_CLIENTEDGE, L"EDIT", NULL, WS_CHILD | WS_VISIBLE | WS_BORDER, 800
, 60, 50, 20, hWnd, NULL, hInstance, NULL );
hText5 = CreateWindowEx( WS_EX_CLIENTEDGE, L"EDIT", NULL, WS_CHILD | WS_VISIBLE | WS_BORDER, 900
, 30, 50, 20, hWnd, NULL, hInstance, NULL );
SetWindowText( hText, L"Wpisz funkcje " );
g_hPrzycisk = CreateWindowEx( 0, L"BUTTON", L"Rysuj wykres3", WS_CHILD | WS_VISIBLE,
10, 70, 150, 30, hWnd,( HMENU ) ID_PRZYCISK20, hInstance, NULL );
pokazONP = CreateWindowEx( 0, L"BUTTON", L"Pokaz ONP", WS_CHILD | WS_VISIBLE | BS_CHECKBOX,
50, 550, 150, 30, hWnd,( HMENU ) ID_SHOWONP, hInstance, NULL );
if( !hWnd )
{
MessageBox( NULL,
_T( "Call to CreateWindow failed!" ),
_T( "Wykresy" ),
NULL );
return 1;
}
DWORD dlugosc = GetWindowTextLength( hText );
LPWSTR Bufor =( LPWSTR ) GlobalAlloc( GPTR, dlugosc + 1 );
GetWindowText( hText, Bufor, dlugosc + 1 );
ShowWindow( hWnd,
nCmdShow );
UpdateWindow( hWnd );
MessageBox( NULL, L"Wpisuj poprawne równania !!!\nDozwolone symbole :+,-,*,/,^\nNie wolno używać spacji\nDostepne funkcje:sin,cos,tg,ctg,log\n", L"Witaj użytkowniku", MB_ICONASTERISK );
MSG msg;
while( GetMessage( & msg, NULL, 0, 0 ) )
{
TranslateMessage( & msg );
DispatchMessage( & msg );
}
return( int ) msg.wParam;
}
LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
PAINTSTRUCT ps;
HDC hdc;
TCHAR greeting[] = _T( "Wpisz wzór :" );
TCHAR napis1[] = _T( "Pomiary : " );
TCHAR napis2[] = _T( "f(x)=" );
TCHAR n[] = _T( "n=" );
TCHAR x[] = _T( "x=" );
TCHAR delta;
HWND hStatic;
switch( message )
{
case WM_PAINT:
hdc = BeginPaint( hWnd, & ps );
LineTo( hdc, 21, 10 );
TextOut( hdc, 5, 5, greeting, _tcslen( greeting ) );
TextOut( hdc, 875, 30, n, _tcslen( n ) );
TextOut( hdc, 780, 30, x, _tcslen( x ) );
TextOut( hdc, 780, 60, x, _tcslen( x ) );
TextOut( hdc, 790, 5, napis1, _tcslen( napis1 ) );
HPEN CzerwonePioro, Pudelko; POINT stary;
HBRUSH PedzelZiel, Piornik;
PedzelZiel = CreateSolidBrush( 0x000000 );
CzerwonePioro = CreatePen( PS_SOLID, 1, 0x0000FF );
Pudelko =( HPEN ) SelectObject( hdc, CzerwonePioro );
Piornik =( HBRUSH ) SelectObject( hdc, PedzelZiel );
Rectangle( hdc, 750, 550, 250, 50 );
ReleaseDC( hWnd, hdc );
EndPaint( hWnd, & ps );
break;
case WM_COMMAND:
switch( wParam )
{
case ID_SHOWONP:
show_onp = true;
if(( bChecked = IsDlgButtonChecked( hWnd, ID_SHOWONP ) ) == BST_CHECKED )
{
CheckDlgButton( hWnd, ID_SHOWONP, BST_UNCHECKED );
show_onp = false;
}
else
{
CheckDlgButton( hWnd, ID_SHOWONP, BST_CHECKED );
show_onp = true;
}
if( show_onp == true )
{
hText6 = CreateWindowEx( WS_EX_CLIENTEDGE, L"EDIT", NULL, WS_CHILD | WS_VISIBLE | WS_BORDER |
WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL, 380, 430, 200, 450, hWnd, NULL, hInstance, NULL );
}
break;
default:
break;
}
break;
case WM_DESTROY:
MessageBox( NULL, L"Czy jesteś tego pewien???", L"Wyjście", MB_YESNO );
PostQuitMessage( 0 );
break;
default:
return DefWindowProc( hWnd, message, wParam, lParam );
break;
}
return 0;
}