Click here to Skip to main content
15,905,323 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralProblem using ATL Object in other ATL Server Pin
andreasf5-Apr-05 20:22
andreasf5-Apr-05 20:22 
GeneralImmediate repainting of a listctrl Pin
Franz Klein5-Apr-05 0:17
Franz Klein5-Apr-05 0:17 
GeneralRe: Immediate repainting of a listctrl Pin
Michael Dunn5-Apr-05 7:14
sitebuilderMichael Dunn5-Apr-05 7:14 
QuestionCan a ConnectionPoint Object have function like "HRESULT Test([in, out] Byte* pData)" Pin
samfromcn4-Apr-05 16:36
samfromcn4-Apr-05 16:36 
AnswerRe: Can a ConnectionPoint Object have function like "HRESULT Test([in, out] Byte* pData)" Pin
Michael Dunn4-Apr-05 20:12
sitebuilderMichael Dunn4-Apr-05 20:12 
GeneralRe: Can a ConnectionPoint Object have function like "HRESULT Test([in, out] Byte* pData)" Pin
samfromcn4-Apr-05 21:39
samfromcn4-Apr-05 21:39 
GeneralRe: Can a ConnectionPoint Object have function like "HRESULT Test([in, out] Byte* pData)" Pin
Stuart Dootson4-Apr-05 21:52
professionalStuart Dootson4-Apr-05 21:52 
GeneralRe: Can a ConnectionPoint Object have function like "HRESULT Test([in, out] Byte* pData)" Pin
samfromcn4-Apr-05 22:27
samfromcn4-Apr-05 22:27 
It seems as if the method does not work. Following my code :

1:declare interface------
dispinterface _IMyEvents
{
properties:
methods:
[id(1), helpstring("method Test")] HRESULT Test([in]DWORD dwLen, [in] BSTR pData);
};
2:method implement-------
HRESULT Fire_Test(ULONG dwLen, BSTR pData)
{
CComVariant varResult;
T* pT = static_cast<t*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[2];
int nConnections = m_vec.GetSize();

for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<iunknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<idispatch*>(sp.p);
if (pDispatch != NULL)
{
VariantClear(&varResult);
pvars[1] = (int)dwLen;
pvars[0] = pData;
DISPPARAMS disp = { pvars, NULL, 2, 0 };
pDispatch->Invoke(0x2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
}
}
delete[] pvars;
return varResult.scode;
}
3:call method in Server Object------
{
char a[10] = _T("abcdef");
a[8] = 'x';
BSTR bstr = SysAllocStringByteLen(a, 10);

Fire_Test(10, bstr);
}
4:called in Client -------
long CEventNotifySink::OnTest(DWORD dwLen, BSTR pData)
{
UINT len = SysStringByteLen (pData); // result: len!=10
BYTE * p = (BYTE*)pData; // pData refs wrong address

SysFreeString(pData);
return 0;
}

where is wrong?Confused | :confused:
GeneralRe: Can a ConnectionPoint Object have function like &quot;HRESULT Test([in, out] Byte* pData)&quot; Pin
Stuart Dootson4-Apr-05 23:05
professionalStuart Dootson4-Apr-05 23:05 
GeneralRe: Can a ConnectionPoint Object have function like &quot;HRESULT Test([in, out] Byte* pData)&quot; Pin
samfromcn4-Apr-05 23:28
samfromcn4-Apr-05 23:28 
GeneralRe: Can a ConnectionPoint Object have function like &quot;HRESULT Test([in, out] Byte* pData)&quot; Pin
Stuart Dootson4-Apr-05 23:43
professionalStuart Dootson4-Apr-05 23:43 
GeneralRe: Can a ConnectionPoint Object have function like &quot;HRESULT Test([in, out] Byte* pData)&quot; Pin
samfromcn5-Apr-05 16:14
samfromcn5-Apr-05 16:14 
GeneralRe: Can a ConnectionPoint Object have function like &quot;HRESULT Test([in, out] Byte* pData)&quot; Pin
Stuart Dootson5-Apr-05 22:17
professionalStuart Dootson5-Apr-05 22:17 
GeneralRe: Can a ConnectionPoint Object have function like &quot;HRESULT Test([in, out] Byte* pData)&quot; Pin
samfromcn6-Apr-05 15:57
samfromcn6-Apr-05 15:57 
GeneralRe: Can a ConnectionPoint Object have function like &quot;HRESULT Test([in, out] Byte* pData)&quot; Pin
Stuart Dootson6-Apr-05 21:02
professionalStuart Dootson6-Apr-05 21:02 
GeneralSerializing objects using XLM Pin
Ernesto D.4-Apr-05 15:01
Ernesto D.4-Apr-05 15:01 
GeneralRe: Serializing objects using XLM Pin
Christian Graus4-Apr-05 15:53
protectorChristian Graus4-Apr-05 15:53 
GeneralRe: Serializing objects using XLM Pin
Michael Dunn4-Apr-05 20:15
sitebuilderMichael Dunn4-Apr-05 20:15 
GeneralRe: Serializing objects using XLM Pin
Ernesto D.4-Apr-05 20:20
Ernesto D.4-Apr-05 20:20 
GeneralRe: Serializing objects using XLM Pin
Andrew Walker4-Apr-05 21:13
Andrew Walker4-Apr-05 21:13 
GeneralRe: Serializing objects using XLM Pin
Ernesto D.5-Apr-05 2:34
Ernesto D.5-Apr-05 2:34 
GeneralSmart Tag for Rich Edit of Outlook email viewer Pin
Rajeev K Srivastava3-Apr-05 9:35
Rajeev K Srivastava3-Apr-05 9:35 
GeneralCan't get data from my vector. Help!!! Pin
Larry Mills Sr2-Apr-05 9:42
Larry Mills Sr2-Apr-05 9:42 
GeneralBrowser Helper Object Pin
nmhuy30-Mar-05 21:42
nmhuy30-Mar-05 21:42 
GeneralRe: Browser Helper Object Pin
Nicholas Cardi1-Apr-05 4:00
Nicholas Cardi1-Apr-05 4:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.