1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-23 01:49:53 +03:00
SoftEtherVPN/src/vpndrvinst/Dialog.c
Davide Beatrici 9d29d8813b New vpndrvinst implementation, independent from Cedar and Mayaqua
This greatly improves performance and reduces the binary's size (~0.2 MB vs ~5 MB).

All recent Windows versions are supported, starting with Vista.

No dialogs are created, aside from error/warning ones in case of failure.

The only dependency (aside from Windows libraries) is libhamcore.
2021-03-12 05:46:20 +01:00

37 lines
783 B
C

#include "Dialog.h"
#include <stdio.h>
#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
int ShowMessage(const char *title, const char *message, const unsigned int type, const va_list args)
{
char buf[MAX_MESSAGE_SIZE];
vsnprintf(buf, sizeof(buf), message, args);
return MessageBox(NULL, buf, title, type);
}
int ShowInformation(const char *title, const char *message, ...)
{
va_list args;
va_start(args, message);
const int ret = ShowMessage(title, message, MB_OK | MB_ICONINFORMATION, args);
va_end(args);
return ret;
}
int ShowWarning(const char *title, const char *message, ...)
{
va_list args;
va_start(args, message);
const int ret = ShowMessage(title, message, MB_OK | MB_ICONWARNING, args);
va_end(args);
return ret;
}