ReactOS 0.4.16-dev-1063-gd722e70
popupmenu.c File Reference
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include "resource.h"
Include dependency graph for popupmenu.c:

Go to the source code of this file.

Functions

LRESULT WINAPI MainWndProc (HWND, UINT, WPARAM, LPARAM)
 
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
 

Function Documentation

◆ MainWndProc()

LRESULT WINAPI MainWndProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 62 of file popupmenu.c.

63{
64 switch(msg)
65 {
66 case WM_COMMAND:
67 {
68 switch(LOWORD(wParam))
69 {
70 case IDM_EXIT:
72 break;
73 }
74 break;
75 }
76 case WM_RBUTTONUP:
77 {
78 POINT pos;
79 HMENU Menu;
80
81 pos.x = LOWORD(lParam);
82 pos.y = HIWORD(lParam);
84
85 if((Menu = GetMenu(hWnd)) && (Menu = GetSubMenu(Menu, 1)))
86 {
87 TrackPopupMenu(Menu, 0, pos.x, pos.y, 0, hWnd, NULL);
88 }
89 break;
90 }
91 case WM_DESTROY:
92 {
94 break;
95 }
96 default:
97 {
99 }
100 }
101 return 0;
102}
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
#define IDM_EXIT
Definition: resource.h:27
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
#define LOWORD(l)
Definition: pedump.c:82
#define DefWindowProc
Definition: ros2win.h:31
#define HIWORD(l)
Definition: typedefs.h:247
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_COMMAND
Definition: winuser.h:1751
#define WM_RBUTTONUP
Definition: winuser.h:1791
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
#define WM_DESTROY
Definition: winuser.h:1620
HMENU WINAPI GetMenu(_In_ HWND)

Referenced by WinMain().

◆ WinMain()

int WINAPI WinMain ( HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
LPSTR  lpszCmdLine,
int  nCmdShow 
)

Definition at line 9 of file popupmenu.c.

13{
14 WNDCLASS wc;
15 MSG msg;
16 HWND hWnd;
17
18 wc.lpszClassName = "MenuTestClass";
24 wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
26 wc.cbClsExtra = 0;
27 wc.cbWndExtra = 0;
28 if (RegisterClass(&wc) == 0)
29 {
30 fprintf(stderr, "RegisterClass failed (last error 0x%lX)\n",
31 GetLastError());
32 return(1);
33 }
34
35 hWnd = CreateWindow("MenuTestClass",
36 "PopupMenu Test",
38 0,
39 0,
42 NULL,
43 NULL,
45 NULL);
46 if (hWnd == NULL)
47 {
48 fprintf(stderr, "CreateWindow failed (last error 0x%lX)\n",
49 GetLastError());
50 return(1);
51 }
52
53 while(GetMessage(&msg, NULL, 0, 0))
54 {
57 }
58
59 return msg.wParam;
60}
#define IDM_MAINMENU
Definition: resources.h:3
HINSTANCE hInstance
Definition: charmap.c:19
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_VISIBLE
Definition: pedump.c:620
LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM)
Definition: popupmenu.c:62
HBRUSH hbrBackground
Definition: winuser.h:3181
HICON hIcon
Definition: winuser.h:3179
HINSTANCE hInstance
Definition: winuser.h:3178
HCURSOR hCursor
Definition: winuser.h:3180
int cbWndExtra
Definition: winuser.h:3177
UINT style
Definition: winuser.h:3174
LPCSTR lpszMenuName
Definition: winuser.h:3182
LPCSTR lpszClassName
Definition: winuser.h:3183
WNDPROC lpfnWndProc
Definition: winuser.h:3175
int cbClsExtra
Definition: winuser.h:3176
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define CS_VREDRAW
Definition: winuser.h:666
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define CS_HREDRAW
Definition: winuser.h:661
#define IDC_ARROW
Definition: winuser.h:695
#define IDI_APPLICATION
Definition: winuser.h:712
#define CreateWindow
Definition: winuser.h:5774
#define GetMessage
Definition: winuser.h:5810
#define LoadIcon
Definition: winuser.h:5833
#define LoadCursor
Definition: winuser.h:5832
#define CW_USEDEFAULT
Definition: winuser.h:225
#define RegisterClass
Definition: winuser.h:5856
#define DispatchMessage
Definition: winuser.h:5785
#define COLOR_BTNFACE
Definition: winuser.h:939
const CHAR * LPCTSTR
Definition: xmlstorage.h:193