473,324 Members | 2,581 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

How do I call a C++(.NET) DLL from an ASP.NET Page?

Hi
I am an ASP.NET newbie and I have a VB.NET application I am trying to write
in ASP.NET . The problem is that the application calls a DLL written using
VC++.NET . How do I call this DLL from the ASP.NET page? I'd appreciate any
help, as I am stuck for time.
Thanks
Nov 18 '05 #1
4 1173

"Hoss" <hm******@menanet.net> wrote in message
news:u3**************@TK2MSFTNGP12.phx.gbl...
Hi
I am an ASP.NET newbie and I have a VB.NET application I am trying to
write
in ASP.NET . The problem is that the application calls a DLL written using
VC++.NET . How do I call this DLL from the ASP.NET page? I'd appreciate
any
help, as I am stuck for time.


If it's managed C++ then just add a reference to it in your project. If
it's a COM dll, do the same (although different stuff will happen behind the
scenes). If it's an unmanaged, non-COM dll then you need to use P/Invoke.

David
Nov 18 '05 #2
Thankx David, the DLL is managed C++ and I included it as a reference in the
project.
But when I then try to run it, it gives a DLLNotFoundException. What am I
doing wrong?

This is the code:
================================================== ==========================
=============
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCalculate.Click
Dim MorphID As Integer, rc As Short

' MorphID's value is returned

rc = LNSearch.InitializeLangData("D:\LangSearch\VB.NET\ LNSearch\DataFiles",
MorphID)

End Sub

Public Class LNSearch

Declare Auto Function InitializeLangData Lib
"D:\LangSearch\VC\LNSearchDLL\Release\LNSearchDLL. dll" (ByVal DictPath As
String, ByRef MorphID As Integer) As Short

End Class

================================================== ==========================
=============

"David Browne" <davidbaxterbrowne no potted me**@hotmail.com> wrote in
message news:OC**************@TK2MSFTNGP14.phx.gbl...

"Hoss" <hm******@menanet.net> wrote in message
news:u3**************@TK2MSFTNGP12.phx.gbl...
Hi
I am an ASP.NET newbie and I have a VB.NET application I am trying to
write
in ASP.NET . The problem is that the application calls a DLL written using VC++.NET . How do I call this DLL from the ASP.NET page? I'd appreciate
any
help, as I am stuck for time.

If it's managed C++ then just add a reference to it in your project. If
it's a COM dll, do the same (although different stuff will happen behind

the scenes). If it's an unmanaged, non-COM dll then you need to use P/Invoke.

David

Nov 18 '05 #3

"Hoss" <hm******@menanet.net> wrote in message
news:uI****************@tk2msftngp13.phx.gbl...
Thankx David, the DLL is managed C++ and I included it as a reference in
the
project.
But when I then try to run it, it gives a DLLNotFoundException. What am I
doing wrong?

This is the code:
================================================== ==========================
=============
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCalculate.Click
Dim MorphID As Integer, rc As Short

' MorphID's value is returned

rc =
LNSearch.InitializeLangData("D:\LangSearch\VB.NET\ LNSearch\DataFiles",
MorphID)

End Sub

Public Class LNSearch

Declare Auto Function InitializeLangData Lib
"D:\LangSearch\VC\LNSearchDLL\Release\LNSearchDLL. dll" (ByVal DictPath As
String, ByRef MorphID As Integer) As Short


That's P/Invoke. If it's .NET you shouldn'd have to declare the function.
Just add the reference and you should be able to access its functions.

David
Nov 18 '05 #4
Many thanks, it works now.

"David Browne" <davidbaxterbrowne no potted me**@hotmail.com> wrote in
message news:uR**************@TK2MSFTNGP15.phx.gbl...

"Hoss" <hm******@menanet.net> wrote in message
news:uI****************@tk2msftngp13.phx.gbl...
Thankx David, the DLL is managed C++ and I included it as a reference in
the
project.
But when I then try to run it, it gives a DLLNotFoundException. What am I doing wrong?

This is the code:
================================================== ========================== =============
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCalculate.Click
Dim MorphID As Integer, rc As Short

' MorphID's value is returned

rc =
LNSearch.InitializeLangData("D:\LangSearch\VB.NET\ LNSearch\DataFiles",
MorphID)

End Sub

Public Class LNSearch

Declare Auto Function InitializeLangData Lib
"D:\LangSearch\VC\LNSearchDLL\Release\LNSearchDLL. dll" (ByVal DictPath As String, ByRef MorphID As Integer) As Short


That's P/Invoke. If it's .NET you shouldn'd have to declare the function.
Just add the reference and you should be able to access its functions.

David

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Greg Chapman | last post by:
I am at my wit's end trying to get information out of Streamline.net's support dept about my problem. They reply quickly enough, but seem to try and give out the least possible amount of info each...
0
by: Eugene Safrankow | last post by:
Hello All! I've encountered with the error when I call a method of dependency library (written in managed VC++) from Smart Client placed on a web page. In general, I make a call to the Windows...
2
by: moondaddy | last post by:
I'm using vb.net and have an aspx page where I want to call a function in the code behind to do something on the backend and I want to call this function from a jscript function in the aspx page. ...
6
by: grist2mill | last post by:
I want to create a standard tool bar that appears on all pages that is a control. The toolbar has a button 'New'. What I wolud like when the user clicks on 'New' depends on the page they are on. I...
10
by: abcd | last post by:
is there anyway I can call ASP page from ASPNET page. How should I call...whats the syntax...or code sample thanks
1
by: A.M-SG | last post by:
Hi, I have a web service with two soap extensions enabled on it. When I run the default IIS method invoke page, the invoke button bypasses all my soap extensions. But when I call the...
4
by: Paul | last post by:
Hi, I've been struggling with this today, I'm developing a DotNet2.0 website in C# that needs to call a long running data query. Obviously this is a good candidate for an Asynchronous call, so...
3
by: Marshall | last post by:
Hello, I am wondering if it is possible to call a remote web service using ATLAS and if so, how. I have read several docs which show how to call a web service that is within the same project as...
7
by: MeAgin | last post by:
Hi all, I want to call a classic ASP page from my vb.net code. How this can be done? Normally I would create an object from MSXML2.XMLHTTP and then call the Get method and the ResponseText wiuld...
6
by: Steve Richter | last post by:
what with the website solution structure not having a namespace, how does the class of one website .aspx page class reference the class of another page in the same website? I have two pages....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.