Click here to Skip to main content
15,920,896 members
Home / Discussions / C#
   

C#

 
GeneralRe: bind datagrid to a variable Pin
Heath Stewart28-Oct-04 16:13
protectorHeath Stewart28-Oct-04 16:13 
GeneralRe: bind datagrid to a variable Pin
xiaowenjie28-Oct-04 19:08
xiaowenjie28-Oct-04 19:08 
GeneralRe: bind datagrid to a variable Pin
Heath Stewart29-Oct-04 5:38
protectorHeath Stewart29-Oct-04 5:38 
GeneralRe: bind datagrid to a variable Pin
xiaowenjie29-Oct-04 6:15
xiaowenjie29-Oct-04 6:15 
GeneralRe: bind datagrid to a variable Pin
xiaowenjie29-Oct-04 6:29
xiaowenjie29-Oct-04 6:29 
GeneralRe: bind datagrid to a variable Pin
Heath Stewart30-Oct-04 2:58
protectorHeath Stewart30-Oct-04 2:58 
GeneralCOM Interopability problem Pin
iliyang28-Oct-04 10:57
iliyang28-Oct-04 10:57 
GeneralRe: COM Interopability problem Pin
Heath Stewart28-Oct-04 16:04
protectorHeath Stewart28-Oct-04 16:04 
And ArrayList will not marshal the same as an array of strings. What you passed to the interop'd method AddUrlList depends on what the documentation states.

More than likely you must pass it a SAFEARRAY. Since you created an interop assembly (RCW) using VS.NET or tlbimp.exe, you've lost the opportunity to define the correct UnmanagedType to the MarshalAsAttribute, namely the UnmanagedType.SafeArray type. You can, however, re-declare the same interface yourself with the ComImportAttribute and the correct GuidAttribute and ComInterfaceAttribute (with values the same as the one in the interop assembly). If you read the documentation for the UnmanagedType.SafeArray you should get some idea of how to marshal the string[] array correctly.

You could also try using Marshal.GetNativeVariantForObject, but you'll need additional methods from the Marshal class to marshal the returned IntPtr correctly as an object. The method above would probably be easier (you won't have to marshal the data yourself; .NET will do it for you).

Again, though, this all depends on what the AddUrlList is expecting. If you were to tell us what the API documentation states (not what tlbimp.exe or VS.NET thinks it should be in the interop assembly), that will most likely help.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
QuestionKeeping context menu open even after clicking? Pin
Carl Mercier28-Oct-04 9:29
Carl Mercier28-Oct-04 9:29 
AnswerRe: Keeping context menu open even after clicking? Pin
Heath Stewart28-Oct-04 15:58
protectorHeath Stewart28-Oct-04 15:58 
GeneralRe: Keeping context menu open even after clicking? Pin
Carl Mercier29-Oct-04 3:50
Carl Mercier29-Oct-04 3:50 
GeneralRe: Keeping context menu open even after clicking? Pin
LongRange.Shooter29-Oct-04 6:50
LongRange.Shooter29-Oct-04 6:50 
AnswerRe: Keeping context menu open even after clicking? Pin
perlmunger29-Oct-04 9:09
perlmunger29-Oct-04 9:09 
Generalabout device instance enumeration Pin
momer28-Oct-04 9:07
momer28-Oct-04 9:07 
GeneralRe: about device instance enumeration Pin
Heath Stewart28-Oct-04 15:53
protectorHeath Stewart28-Oct-04 15:53 
GeneralRegistry problem..! Pin
QzRz28-Oct-04 8:03
QzRz28-Oct-04 8:03 
GeneralRe: Registry problem..! Pin
Christian Graus28-Oct-04 9:39
protectorChristian Graus28-Oct-04 9:39 
GeneralRe: Registry problem..! Pin
QzRz28-Oct-04 9:45
QzRz28-Oct-04 9:45 
GeneralRe: Registry problem..! Pin
Christian Graus28-Oct-04 9:48
protectorChristian Graus28-Oct-04 9:48 
GeneralRe: Registry problem..! Pin
Alex Korchemniy28-Oct-04 10:04
Alex Korchemniy28-Oct-04 10:04 
GeneralRe: Registry problem..! Pin
Dave Kreskowiak28-Oct-04 16:49
mveDave Kreskowiak28-Oct-04 16:49 
GeneralRe: Registry problem..! Pin
QzRz29-Oct-04 6:19
QzRz29-Oct-04 6:19 
GeneralRe: Registry problem..! Pin
Dave Kreskowiak29-Oct-04 11:34
mveDave Kreskowiak29-Oct-04 11:34 
GeneralRe: Registry problem..! Pin
QzRz29-Oct-04 11:46
QzRz29-Oct-04 11:46 
GeneralRe: Registry problem..! Pin
Dave Kreskowiak29-Oct-04 18:49
mveDave Kreskowiak29-Oct-04 18:49 

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.