General information
Category:
Windows API functions
>>>It's a COM object. I don't think that you can interface directly with it from VFP. The easiest way is to write a DLL or ActiveX control to hide the complexities.
>>
>>I'm pretty unexperienced at this type of thing. Does an ActiveX or Dll exists that I could purchase or download
>
>Hi Mike,
>
>I'm C++ newbie. I've written exactly one DLL. The one I wrote, however, interfaces with a similar (in terms of methods, etc.) object, the IShellLink.
>
>Bela though might be able to help.
Hi Mike and George!
I never faced this problem to make new profiles, so I have no ready-to-use routine, but here is a sort C++ proc, which retrieve into a VFP array all available profiles. So going on this path, you can get some idea, and write your own func.
#include "MAPIX.H"
#include "MAPIUTIL.H"
////////////////////////////////////////////////////////////
///
/// ENUMERATING AVAILABLE EXCHANGE PROFILES INTO AN ARRAY
/// it requires only 1 parameter: the name of the array
////////////////////////////////////////////////////////////
void FAR GetProfiles(ParamBlk FAR *parm)
{ // enumerates the Exchange client local profile names
LPPROFADMIN lpProfAdmin;
LPMAPITABLE lpTable;
HRESULT vissza=0;
MAPIINIT_0 MAPIINIT= { 0, MAPI_MULTITHREAD_NOTIFICATIONS} ;
LPSRowSet lpRows;
LPSPropValue lpPropvalueArray;
unsigned int i,y;
LPSTR profilname;
char FAR *varName;
Locator loc;
int flag;
int retValue;
int ArrayLength=-1;
MAPIInitialize(&MAPIINIT);
if (S_OK!=MAPIAdminProfiles(0, &lpProfAdmin))
goto ERROR;
if (S_OK!=lpProfAdmin->GetProfileTable(0, &lpTable))
goto ERROR;
if (S_OK!=HrQueryAllRows(lpTable, NULL,NULL,NULL,0,&lpRows))
goto ERROR;
// First Making the array
/////////////////////////
// We need Null terminate character string
if (!_SetHandSize(parm->p[0].val.ev_handle,parm->p[0].val.ev_length+1))
goto ERROR; // "Insufficient memory"
_HLock(parm->p[0].val.ev_handle);
varName = (char FAR *) _HandToPtr(parm->p[0].val.ev_handle);
varName[parm->p[0].val.ev_length] = '\0';
if (_FindVar(_NameTableIndex(varName),-1,&loc)) { // array exist
_Release(_NameTableIndex(varName));
}
loc.l_subs = 1;// 1 dimension array
loc.l_sub1 =(short) lpRows->cRows; // 1st dimension
ArrayLength=lpRows->cRows;
loc.l_sub2 = 0; // 2nd dimension
flag = 1; // private 0: public
if ((retValue = _NewVar(varName, &loc, flag)) < 0) {// retValue : NTI
_HUnLock(parm->p[0].val.ev_handle);
goto ERROR;
}
_HUnLock(parm->p[0].val.ev_handle);
for (i=0; icRows; i++) {
lpPropvalueArray=lpRows->aRow[i].lpProps;
for (y=0;yaRow[i].cValues;y++) {
if (PR_DISPLAY_NAME==lpPropvalueArray->ulPropTag) { // got the column
//0x3001001E: PR_PROFILE_NAME tag code is: PR_DISPLAY_NAME
loc.l_subs = 1;// 1 dimension array
loc.l_sub1 =i+1; // 1st dimension
loc.l_sub2 = 0; // 2nd dimension
profilname=lpPropvalueArray->Value.lpszA;
if (!_SetHandSize(parm->p[0].val.ev_handle,strlen(profilname)))
goto HIBA; // "Insufficient memory"
_HLock(parm->p[0].val.ev_handle);
varName = (char FAR *) _HandToPtr(parm->p[0].val.ev_handle);
strcpy(varName,profilname);
parm->p[0].val.ev_length=strlen(profilname);
if ((retValue = _Store(&loc,&parm->p[0].val)) < 0)
{
_HUnLock(parm->p[0].val.ev_handle);
goto ERROR;
}
_HUnLock(parm->p[0].val.ev_handle);
}
lpPropvalueArray++;
};
};
ERROR:
MAPIUninitialize();
_RetInt(ArrayLength,10);
}
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only