1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| //TestDLL.cpp dans projet DLL TestDLL
#include <windows.h>
#include <wincred.h>
#pragma comment(lib, "credui.lib")
extern "C" __declspec(dllexport) DWORD WINAPI TestCredUI(void)
{
CREDUI_INFO info = {0};
info.cbSize = sizeof(info);
info.pszCaptionText = L"Test";
info.pszMessageText = L"Entrez un nom et mot de passe:";
PVOID authBuffer = NULL;
ULONG authBuflen = 0;
ULONG authPackage = 0;
DWORD result = CredUIPromptForWindowsCredentials(&info, 0, &authPackage, NULL, 0, &authBuffer, &authBuflen, NULL, CREDUIWIN_GENERIC);
{
TCHAR buf[80];
wsprintf(buf, TEXT("Code retourné par CredUIPromptForCredentialsW: %lu."), result);
MessageBox(NULL, buf, TEXT("Résultat"), MB_OK | (result==0 ? MB_ICONINFORMATION : MB_ICONEXCLAMATION));
}
return result;
} |
Partager