Skip to content

Commit

Permalink
Update main.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Magnetic-Fox committed Sep 10, 2023
1 parent a3766e9 commit 13bc402
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include <windows.h>
#include <stdlib.h>

#include "menuitems.h"

#define BST_UNCHECKED 0x0000
#define BST_CHECKED 0x0001

Expand Down Expand Up @@ -41,10 +43,12 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
return 1;
}

HMENU hMenu = LoadMenu(hInstance, MAKEINTRESOURCE(200));

HWND hwnd;

hwnd = CreateWindow(NazwaKlasy, "Oto okienko", WS_OVERLAPPEDWINDOW, 20, 20, 640, 480,
NULL, NULL, hInstance, NULL);
NULL, hMenu, hInstance, NULL);

if(hwnd == NULL)
{
Expand Down Expand Up @@ -81,7 +85,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine

SetWindowText(hStatic, "Test 2");

for(unsigned int x=0; x<1000; ++x)
for(unsigned long int x=0; x<65537; ++x)
{
char test[10];
ltoa(x,test,10);
Expand Down Expand Up @@ -111,6 +115,9 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_COMMAND:
switch(wParam)
{
case ID_PLIK_ZAKONCZ:
PostQuitMessage(0);
break;
case ID_PRZYCISK1:
// Odczyt danych z pola tekstowego
DWORD dlugosc = GetWindowTextLength(hText);
Expand All @@ -122,11 +129,11 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case ID_PRZYCISK2:
if(IsDlgButtonChecked(hwnd, ID_CHECKBOX))
{
MessageBox(0,"Zaznaczony!","Stan",MB_ICONINFORMATION);
MessageBox(hwnd,"Zaznaczony!","Stan",MB_ICONINFORMATION);
}
else
{
MessageBox(0,"Niezaznaczony!","Stan",MB_ICONINFORMATION);
MessageBox(hwnd,"Niezaznaczony!","Stan",MB_ICONINFORMATION);
}
break;
case ID_CHECKBOX:
Expand All @@ -143,15 +150,15 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
long int index=SendMessage(hListBox, LB_GETCURSEL, 0, 0);
char test[10];
ltoa(index,test,10);
MessageBox(0,test,"WartoϾ",MB_OK);
MessageBox(hwnd,test,"WartoϾ",MB_OK);
break;
case ID_LISTBOX:
if(HIWORD(lParam)==LBN_DBLCLK)
{
long int index=SendMessage(hListBox, LB_GETCURSEL, 0, 0);
char test[10];
ltoa(index,test,10);
MessageBox(0,test,"WartoϾ",MB_OK);
MessageBox(hwnd,test,"WartoϾ",MB_OK);
}
break;
}
Expand Down

0 comments on commit 13bc402

Please sign in to comment.