Click here to Skip to main content
15,901,122 members
Home / Discussions / C#
   

C#

 
GeneralRe: disable paste in a textbox Pin
Tyrus18224-Aug-06 19:28
Tyrus18224-Aug-06 19:28 
AnswerRe: disable paste in a textbox Pin
Martin#24-Aug-06 19:59
Martin#24-Aug-06 19:59 
GeneralRe: disable paste in a textbox Pin
Vipin Venugopal25-Aug-06 1:44
Vipin Venugopal25-Aug-06 1:44 
QuestionListview.items.add() Pin
Sri harini24-Aug-06 16:53
Sri harini24-Aug-06 16:53 
QuestionHow to push a window behind the desktop icons? Pin
Rojan Gh.24-Aug-06 14:58
professionalRojan Gh.24-Aug-06 14:58 
AnswerRe: How to push a window behind the desktop icons? Pin
Divyang Mithaiwala24-Aug-06 19:34
Divyang Mithaiwala24-Aug-06 19:34 
AnswerRe: How to push a window behind the desktop icons? Pin
Rojan Gh.25-Aug-06 4:48
professionalRojan Gh.25-Aug-06 4:48 
QuestionPassing Excel.Application object from C# to C++ Pin
alias4724-Aug-06 14:25
alias4724-Aug-06 14:25 
I am trying to pass an Excel.Application object from c# to c++ DLL via PInvoke.

The c++ code expects an IDispatch.

The Pinvoke Wizard paulyao.com suggests:
[DllImport("myDLL.dll")]<br />
public static extern short Initialise(ref LPDISPATCH pExcel);


so I have tried this code c#:

[DllImport("myDLL.dll")]<br />
public static extern short Initialise([MarshalAs(UnmanagedType.IDispatch)]ref object pExcel);


and

[DllImport("myDLL.dll")]<br />
public static extern short Initialise([MarshalAs(UnmanagedType.IUnknown)]ref object pExcel);


And this is the code that calls the routine.

Excel.Application excelApp= (Excel.Application)application; //(from Connect class in COM Addin)<br />
object o=(object)excelApp;<br />
Initialise(ref o);


When the c++ code is called it throws a COleDispatchException error. m_wCode is 00000000 and 80020005 respectively.
Any ideas on how I should pass the Excel Application object?


Regards
Alias47
QuestionbindingNavigator Lost Renderer - Blue Pin
Glen Harvy24-Aug-06 13:53
Glen Harvy24-Aug-06 13:53 
Questionif statements Pin
TWatson4724-Aug-06 9:47
TWatson4724-Aug-06 9:47 
AnswerRe: if statements Pin
Ennis Ray Lynch, Jr.24-Aug-06 9:52
Ennis Ray Lynch, Jr.24-Aug-06 9:52 
GeneralRe: if statements Pin
TWatson4724-Aug-06 10:31
TWatson4724-Aug-06 10:31 
GeneralRe: if statements Pin
Ennis Ray Lynch, Jr.24-Aug-06 10:38
Ennis Ray Lynch, Jr.24-Aug-06 10:38 
GeneralRe: if statements Pin
TWatson4724-Aug-06 11:22
TWatson4724-Aug-06 11:22 
GeneralRe: if statements Pin
Ennis Ray Lynch, Jr.24-Aug-06 11:27
Ennis Ray Lynch, Jr.24-Aug-06 11:27 
GeneralRe: if statements Pin
TWatson4724-Aug-06 11:53
TWatson4724-Aug-06 11:53 
GeneralRe: if statements Pin
Ennis Ray Lynch, Jr.24-Aug-06 12:32
Ennis Ray Lynch, Jr.24-Aug-06 12:32 
AnswerRe: if statements Pin
Sean Michael Murphy24-Aug-06 11:07
Sean Michael Murphy24-Aug-06 11:07 
GeneralRe: if statements Pin
TWatson4724-Aug-06 11:47
TWatson4724-Aug-06 11:47 
AnswerRe: if statements Pin
eggsovereasy24-Aug-06 11:13
eggsovereasy24-Aug-06 11:13 
AnswerRe: if statements Pin
Christian Graus24-Aug-06 12:07
protectorChristian Graus24-Aug-06 12:07 
AnswerRe: if statements Pin
Guffa24-Aug-06 12:17
Guffa24-Aug-06 12:17 
AnswerRe: if statements Pin
KevinMac24-Aug-06 13:47
KevinMac24-Aug-06 13:47 
GeneralRe: if statements Pin
Tyrus18224-Aug-06 18:16
Tyrus18224-Aug-06 18:16 
AnswerRe: if statements Pin
Coding C#24-Aug-06 20:38
Coding C#24-Aug-06 20:38 

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.