Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / February 2007

Tip: Looking for answers? Try searching our database.

COM interop with IIS/ISAPI

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kyle Szklenski - 19 Feb 2007 15:37 GMT
Hi. I posted a while back about an interop question sending a string
from C++ to C#. I got the executable for that working just fine. Now,
I'm going to change it to an ISAPI dll so we can use this program
through our web server and it seems to be getting some kind of error
when it runs its main function. This function runs just fine in the
executable. Is there something special I have to do when I'm trying to
run my C# dll through a C++ DLL instead of a C++ executable?
Furthermore, what if I'm trying to run it through an ISAPI dll?
Thanks,

Kyle

P.S. If you need more information, just let me know. I will post
everything I can.
Kyle Szklenski - 19 Feb 2007 15:57 GMT
Sorry for another post. Here is some more information:

The ISAPI dll seems to fail specifically in the call to the C# dll
through COM. I have it output something to the *pCtxt both before the
call and after the call and I see everything, except for that which I
need to see!

What I did in the C# dll is translate an HTML webpage into an input
file for our program. I used a Writer class for writing out the XML
for our input, so it creates the file right away. I couldn't figure
out how to get the information back out of the C# dll to the C++ ISAPI
dll, so instead, the ISAPI dll is supposed to go grab the file that
was created and stream that back to our server, which then sends that
information to our actual program. It is not creating that file with
the C++ ISAPI dll. It does, however, create that file with the C++
executable. The annoying thing is that they have the exact same code
except how I pass the input to the C# dll, because with the ISAPI dll,
I have to go through an LPCSTR instead of using the executable args.
Could you tell me, is there something wrong with the following?

void CTranslationISAPIExtension::Default(CHttpServerContext* pCtxt,
LPCTSTR pstrInput)
{
 const char* Input = pstrInput;

 // Initialize COM.
 HRESULT hr = CoInitialize(NULL);

 // Create the interface pointer.
 ITranslatorPtr Trans( __uuidof( Translator ) );

 Trans->Process( _bstr_t( CComBSTR( Input ) ) );

 // Uninitialize COM.
 CoUninitialize();

After that, I go look for the file and stream it back out, but it
doesn't find the file because it's not there. Thanks again for any
help,

Kyle

On Feb 19, 10:37 am, "Kyle Szklenski" <kyle.szklen...@gmail.com>
wrote:
> Hi. I posted a while back about an interop question sending a string
> from C++ to C#. I got the executable for that working just fine. Now,
[quoted text clipped - 10 lines]
> P.S. If you need more information, just let me know. I will post
> everything I can.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.