Click here to Skip to main content
15,898,588 members
Home / Discussions / COM
   

COM

 
GeneralRe: Apartment model, COM and misery Pin
Lim Bio Liong11-Sep-06 5:21
Lim Bio Liong11-Sep-06 5:21 
QuestionCOleDispatchException when creating comments for Excel Worksheets Pin
Crash27-Sep-06 10:00
Crash27-Sep-06 10:00 
AnswerRe: COleDispatchException when creating comments for Excel Worksheets Pin
Steve S7-Sep-06 21:51
Steve S7-Sep-06 21:51 
GeneralRe: COleDispatchException when creating comments for Excel Worksheets Pin
Crash28-Sep-06 1:34
Crash28-Sep-06 1:34 
GeneralRe: COleDispatchException when creating comments for Excel Worksheets Pin
Crash28-Sep-06 4:27
Crash28-Sep-06 4:27 
Questionthe problem of SafeArray Pin
XPointer7-Sep-06 7:16
XPointer7-Sep-06 7:16 
AnswerRe: the problem of SafeArray Pin
Hans Ruck8-Sep-06 2:46
Hans Ruck8-Sep-06 2:46 
AnswerRe: the problem of SafeArray Pin
Lim Bio Liong8-Sep-06 3:46
Lim Bio Liong8-Sep-06 3:46 
Hello XPointer,

I tried your sample source code and discovered that the error lies around the following lines :

if(psa)
{
//psa->fFeatures = FADF_VARIANT;
psa->cbElements = nCount; // <-- should not set cbElements.
...
...
...

The "cbElements" field is already set when you called the SafeArrayCreate() function earlier :

psa = SafeArrayCreate(VT_VARIANT, 1, rgsabound);

Furthermore, this field indicates the size of each element of the array and since the element type has been declared to be VT_VARIANT, "cbElements" should be sizeof(VARIANT), i.e. 16 bytes, and should not be "nCount".

However the fields of the SAFEARRAY struct (including fFeatures) should all be transparent to developers and should only be accessed via APIs and not modified or accessed individually.

I suggest commenting out the line :

psa->cbElements = nCount;

Your code should work fine thereafter.


Best Regards,
Bio.
AnswerRe: the problem of SafeArray Pin
BadJerry8-Sep-06 5:23
BadJerry8-Sep-06 5:23 
GeneralRe: the problem of SafeArray Pin
XPointer10-Sep-06 2:24
XPointer10-Sep-06 2:24 
QuestionUsing COM with ASP.Net Pin
hsv0037-Sep-06 5:46
hsv0037-Sep-06 5:46 
QuestionDLL does not contain any types that can be registered for COM Interop Pin
Calgary Randy6-Sep-06 10:13
Calgary Randy6-Sep-06 10:13 
AnswerRe: DLL does not contain any types that can be registered for COM Interop Pin
Mike Dimmick7-Sep-06 3:59
Mike Dimmick7-Sep-06 3:59 
QuestionRe: DLL does not contain any types that can be registered for COM Interop Pin
Calgary Randy11-Sep-06 20:24
Calgary Randy11-Sep-06 20:24 
AnswerRe: DLL does not contain any types that can be registered for COM Interop Pin
Calgary Randy11-Sep-06 20:29
Calgary Randy11-Sep-06 20:29 
QuestionUsing C#/Office .NET Programmability Pin
Andrew Mercer5-Sep-06 22:44
Andrew Mercer5-Sep-06 22:44 
AnswerRe: Using C#/Office .NET Programmability Pin
Pavan K Kulkarni8-Sep-06 3:51
Pavan K Kulkarni8-Sep-06 3:51 
QuestionIs it possible to convert Visual C++ program with GUI into COM DLL or ActiveX ? Pin
peysock5-Sep-06 6:34
peysock5-Sep-06 6:34 
QuestionIdentifying Dynamic Controls click Pin
vijayaBTS5-Sep-06 0:52
vijayaBTS5-Sep-06 0:52 
GeneralRe: Identifying Dynamic Controls click Pin
voorugonda prashanth6-Sep-06 0:51
voorugonda prashanth6-Sep-06 0:51 
QuestionDLL Conversion to 2005 to 2003 Pin
Charith Jayasundara4-Sep-06 7:13
Charith Jayasundara4-Sep-06 7:13 
QuestionError while accssing methods of interfaces passed in safearray Pin
satindar_kumar4-Sep-06 0:56
satindar_kumar4-Sep-06 0:56 
AnswerRe: Error while accssing methods of interfaces passed in safearray Pin
Lim Bio Liong10-Sep-06 5:37
Lim Bio Liong10-Sep-06 5:37 
QuestionWix Editor Pin
kulile3-Sep-06 23:39
kulile3-Sep-06 23:39 
AnswerRe: Wix Editor Pin
Mike Dimmick6-Sep-06 1:06
Mike Dimmick6-Sep-06 1:06 

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.