這裏是MSDN樣品應該什麼樣子:
#define UNICODE
#define _UNICODE
#define STRICT
#include <windows.h>
#include <mapix.h>
#include <iostream>
int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hinstPrev,
LPSTR lpCmdLine, int nShowCmd) {
// Get a IProfAdmin Interface.
LPPROFADMIN lpProfAdmin;
HRESULT hr = MAPIAdminProfiles(0, &lpProfAdmin);
// Get the Table of Profiles
LPMAPITABLE lpProfileTable;
hr = lpProfAdmin->GetProfileTable(0, &lpProfileTable);
// Build a restriction where PR_DEFAULT_PROFILE = TRUE
SPropValue spvDefaultProfile;
spvDefaultProfile.ulPropTag = PR_DEFAULT_PROFILE;
spvDefaultProfile.Value.b = TRUE;
SRestriction sres;
sres.rt = RES_PROPERTY;
sres.res.resProperty.relop = RELOP_EQ;
sres.res.resProperty.ulPropTag = PR_DEFAULT_PROFILE;
sres.res.resProperty.lpProp = &spvDefaultProfile;
hr = lpProfileTable->Restrict(&sres, TBL_BATCH);
hr = lpProfileTable->FindRow(&sres, BOOKMARK_BEGINNING, 0);
LPSRowSet pRow = NULL;
hr = lpProfileTable->QueryRows(1, 0, &pRow);
// We have a match
if (SUCCEEDED(hr)) {
LPSTR lpDisplayName = pRow->aRow[0].lpProps[0].Value.lpszA;
std::cout << lpDisplayName;
}
}
它編譯下G ++,但我無法弄清楚如何將可執行鏈接...
JNI/JNA ..... ... –
我真的不想使用JNI,但我明白了你的觀點。 – Markus