Is this translation correct?
Code:
HRESULT CPropSheetHost::_AddPagesForObject(IADs *padsObject)
{
HRESULT hr;
// Get a copy of our IDataObject.
CComPtr<IDataObject> spDataObject;
hr = this->QueryInterface(IID_IDataObject, (LPVOID*)&spDataObject);
if(FAILED(hr))
{
return hr;
}
< CUT >
Delphi-Quellcode:
function TPropSheetHost._AddPagesForObject(hPage: HPROPSHEETPAGE; lParam: LPARAM): HRESULT;
var hr: HResult;
spDataObject: IDataObject;
begin
// Get a copy of our IDataObject.
spDataObject := CreateComObject(IID_IDataObject) as IDataObject;
hr := QueryInterface(IID_IDataObject, spDataObject);
if Failed(hr) then
begin
Result := hr;
Exit;
end;
< CUT >
Some other questions:
How to cast a WideString to PAnsiChar? //Edit: PAnsiChar := PChar(String(WideString));
Code:
// Fill out the PROPSHEETHEADER structure.
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_DEFAULT;
psh.hwndParent = m_hwndParent;
psh.hInstance = NULL;
psh.pszIcon = NULL;
psh.pszCaption = W2T(sbstrTemp);
psh.nPages = (UINT)m_rgPageHandles.GetSize();
psh.phpage = m_rgPageHandles.GetData();
psh.pfnCallback = NULL;
GetSize returns number of elements in array? --> psh.nPages := Length(m_rgPageHandles.GetSize)?
Getdata stores all members in a pointer? How to do this in Delphi? psh.u3.phpage := @m_rgPageHandles;?
Edit: adding one more question, how to convert this:
Code:
LPBYTE pDest = (LPBYTE)*ppSecPageInfo;
LPBYTE pSource = (LPBYTE)wParam;
// Copy the original memory to the new block.
CopyMemory(pDest + dwOffset, pSource, sizeOldSize);
This part CopyMemory(pDest + dwOffset will not work in Delphi. // EDIT: CopyMemory(PChar(pDest) + dwOffset, pSource, sizeOldSize); ?
Added code so far as attachment