xref: /reactos/sdk/lib/crt/misc/__crt_MessageBoxA.c (revision c2c66aff)
1 /*
2  * PROJECT:         ReactOS C runtime library
3  * LICENSE:         BSD - See COPYING.ARM in the top level directory
4  * FILE:            lib/sdk/crt/misc/__crt_MessageBoxA.c
5  * PURPOSE:         __crt_MessageBoxA implementation
6  * PROGRAMMER:      Timo Kreuzer (timo.kreuzer@reactos.org)
7  */
8 
9 #include <precomp.h>
10 
11 /*****************************************************************************
12  * \brief Displays a message box.
13  *
14  * \param pszText - The message to be displayed.
15  * \param uType - The contents and behavior of the message box.
16  * \return Identifies the button that was pressed by the user.
17  * \see MessageBox
18  *
19  *****************************************************************************/
20 int
21 __cdecl
__crt_MessageBoxA(_In_opt_ const char * pszText,_In_ unsigned int uType)22 __crt_MessageBoxA (
23     _In_opt_ const char *pszText,
24     _In_ unsigned int uType)
25 {
26     HMODULE hmodUser32;
27     int (WINAPI *pMessageBoxA)(HWND, LPCTSTR, LPCTSTR, UINT);
28     int iResult;
29 
30     /* Get MessageBoxA function pointer */
31     hmodUser32 = LoadLibrary("user32.dll");
32     pMessageBoxA = (PVOID)GetProcAddress(hmodUser32, "MessageBoxA");
33     if (!pMessageBoxA)
34     {
35         abort();
36     }
37 
38     /* Display a message box */
39     iResult = pMessageBoxA(NULL,
40                            pszText,
41                            "ReactOS C Runtime Library",
42                            uType);
43 
44     FreeLibrary(hmodUser32);
45     return iResult;
46 }
47 
48