lapucca
asked on
Any sample on how to change the DSDISPLAYSPECOPTIONS for ext prop page
The CFSTR_DS_DISPLAY_SPEC_OPTI ONS clipboard format provides an HGLOBAL that contains a DSDISPLAYSPECOPTIONS structure. The DSDISPLAYSPECOPTIONS contains configuration data for use by the extension.
I think I need to change the the user, password, server path in this structure for all the adminPropertyPages in the display specifier. Are there any sample code on how I can do update this?
--
Thanks.
I think I need to change the the user, password, server path in this structure for all the adminPropertyPages in the display specifier. Are there any sample code on how I can do update this?
--
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok, I revser it and here it is. I think it's correct way to set values
if(pStgMedium->hGlobal)
{
DSDISPLAYSPECOPTIONS *pDispSpecOptions = (DSDISPLAYSPECOPTIONS*)Glo balLock(pS tgMedium-> hGlobal);
if(pDispSpecOptions)
{
//LPWSTR pwszTemp;
pDispSpecOptions->dwFlags = DSDSOF_HASUSERANDSERVERINF O;
wcscpy((LPWSTR)((LPBYTE)pD ispSpecOpt ions + pDispSpecOptions->offsetAt tribPrefix ), pwszPrefix);
wcscpy((LPWSTR)((LPBYTE)pD ispSpecOpt ions + pDispSpecOptions->offsetUs erName), m_userID);
wcscpy((LPWSTR)((LPBYTE)pD ispSpecOpt ions + pDispSpecOptions->offsetPa ssword), m_password);
wcscpy((LPWSTR)((LPBYTE)pD ispSpecOpt ions + pDispSpecOptions->offsetSe rver), m_serverName);
wcscpy((LPWSTR)((LPBYTE)pD ispSpecOpt ions + pDispSpecOptions->offsetSe rverConfig Path), m_adPath);
// Copy the prefix string.
//pwszTemp = (LPWSTR)((LPBYTE)pDispSpec Options + dwPrefixOffset);
//lstrcpyW(pwszTemp, pwszPrefix);
GlobalUnlock(pStgMedium->h Global);
hr = S_OK;
}
if(pStgMedium->hGlobal)
{
DSDISPLAYSPECOPTIONS *pDispSpecOptions = (DSDISPLAYSPECOPTIONS*)Glo
if(pDispSpecOptions)
{
//LPWSTR pwszTemp;
pDispSpecOptions->dwFlags = DSDSOF_HASUSERANDSERVERINF
wcscpy((LPWSTR)((LPBYTE)pD
wcscpy((LPWSTR)((LPBYTE)pD
wcscpy((LPWSTR)((LPBYTE)pD
wcscpy((LPWSTR)((LPBYTE)pD
wcscpy((LPWSTR)((LPBYTE)pD
// Copy the prefix string.
//pwszTemp = (LPWSTR)((LPBYTE)pDispSpec
//lstrcpyW(pwszTemp, pwszPrefix);
GlobalUnlock(pStgMedium->h
hr = S_OK;
}
If you don't get any errors, it should work. Have you tried running it?
ASKER
Yes, and it compiles OK. Thank you. I'm posting another related question. I would appreciate it if you can take a look too. Thanks.
Just a caveat - after thinking about thar whole thing, you might run into trouble seeting these values successfully if they are larger than teh previous ones...
ASKER
HRESULT CPropSheetHost::_GetDSDisp
STGMEDIUM *pStgMedium)
{
if((m_cfDSDispSpecOptions != pFormatEtc->cfFormat) ||
!(pFormatEtc->tymed & TYMED_HGLOBAL))
{
return DV_E_FORMATETC;
}
HRESULT hr = E_OUTOFMEMORY;
LPWSTR pwszPrefix = m_pwszPrefix;
DWORD dwPrefixOffset;
// Size of the DSDISPLAYSPECOPTIONS structure.
DWORD dwBytes = sizeof(DSDISPLAYSPECOPTION
// Store the offset to the prefix.
dwPrefixOffset = dwBytes;
// Length of the prefix Unicode string, including the null terminator.
dwBytes += (lstrlenW(pwszPrefix) + 1) * sizeof(WCHAR);
pStgMedium->pUnkForRelease
pStgMedium->tymed = TYMED_HGLOBAL;
pStgMedium->hGlobal = GlobalAlloc(GPTR, dwBytes);
if(pStgMedium->hGlobal)
{
DSDISPLAYSPECOPTIONS *pDispSpecOptions = (DSDISPLAYSPECOPTIONS*)Glo
if(pDispSpecOptions)
{
LPWSTR pwszTemp;
pDispSpecOptions->dwSize = sizeof(DSDISPLAYSPECOPTION
pDispSpecOptions->dwFlags = 0;
pDispSpecOptions->offsetAt
pDispSpecOptions->offsetUs
pDispSpecOptions->offsetPa
pDispSpecOptions->offsetSe
pDispSpecOptions->offsetSe
// Copy the prefix string.
pwszTemp = (LPWSTR)((LPBYTE)pDispSpec
lstrcpyW(pwszTemp, pwszPrefix);
GlobalUnlock(pStgMedium->h
hr = S_OK;
}
}
return hr;
}