Mystruct.cpp
上传用户:weisheen
上传日期:2022-07-09
资源大小:19390k
文件大小:1k
源码类别:
ActiveX/DCOM/ATL
开发平台:
Visual C++
- // Mystruct.cpp : Implementation of CMystruct
- #include "stdafx.h"
- #include "ExStruct.h"
- #include "Mystruct.h"
- /////////////////////////////////////////////////////////////////////////////
- // CMystruct
- STDMETHODIMP CMystruct::GetPersonById(UINT id, StPerson **Result)
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState())
- // TODO: Add your implementation code here
- StPerson* p=(StPerson*)::CoTaskMemAlloc(sizeof(StPerson));//申请1个空间
- p->age=23;
- p->name=::SysAllocString(L"zhangsan");//name为BSTR类型
- p->sex=::SysAllocString(L"male");
- *Result=p;
- return S_OK;
- }
- STDMETHODIMP CMystruct::GetAllPerson(UINT *number, StPerson **Result)
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState())
- StPerson* p=(StPerson*)::CoTaskMemAlloc(2*sizeof(StPerson));
- ZerpMemory();
- // TODO: Add your implementation code here
- return S_OK;
- }
- STDMETHODIMP CMystruct::SavePerson(UINT number, StPerson *Result, UINT *pResult)
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState())
- // TODO: Add your implementation code here
- return S_OK;
- }