You don't need to use DllImport to call legacy COM objects. DLLImport is typically used to call non-COM dlls. You can build a .NET wrapper object to the COM class and call it instead. You can do this ausing the TypeLibrary Importer and then call the methods in the InterOp assembly like you would any other .NET method.
If you are using VS.NET, you can add a reference to you project and select the COM dll from the COM tab and the InterOp assembly is created automatically. There are some issues with data types and threading that might be of interest. Check this out for more details... http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm l/cpconmarshalingdatawithcominterop.asp HTH, Dean Fiala ----------------------------- Very Practical Software, Inc. http://www.vpsw.com/links.aspx -----Original Message----- From: patrickekenney [mailto:[EMAIL PROTECTED] Sent: Sunday, May 23, 2004 7:09 PM To: [EMAIL PROTECTED] Subject: [AspNetAnyQuestionIsOk] Calling Custom Legacy COM Objects with C# namespace & class syntax omitted for brevity... [DllImport("SomeWidget.dll")] static extern int Fubar(string strWhatEver); //call it... void Drill(string strToUse) { Fubar(strToUse); } My question is can I call multiple methods in the same legacy com based dll without a [DllImport("SomeWidget.dll")] line for each method I want to use? I can't seem to make it fly any other way, am I missing something obvious? some delimiter? thanks in advance. Yahoo! Groups Links Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
