473,624 Members | 2,564 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling DLL export function(unmana ged visual c++ code) from managed code(Visual c#,.net)

class xyz{

public void somefunction{

if(this.folderB rowserDialog1.S howDialog() == DialogResult.OK )
{
m_varFolderPath = this.folderBrow serDialog1.Sele ctedPath;
m_varFolderPath += "\\Iamlucky.txt ";


System.String a =(String)strVar iable1;
System.String b =(String)strVar iable2;
System.String c =(String)m_varF olderPath;

try
{

/* DidData is the dll export method created in class clsCallDllBacku p*/
if(clsCallDllBa ckup.DigData(a, b,c))
MessageBox.Show ("yyyyyyyyyyyyy ");
else
MessageBox.Show ("00000000") ;
}
catch
{
MessageBox.Show ("xxxxxxxxxx ");
}

}

}//end of function

}//end of class


public class clsCallDllBacku p
{
public clsCallDllBacku p()
{

}

[DllImport("DigI nfo.dll", EntryPoint="Ext ractJobDigData" )]
public static extern bool DigData(String strProjectName, String strJobName,Stri ng strFilepathname );
}

problem: the intended exported dll function 'DigDat'(unmana ged code) is not creating a binary text file on a
choosen folder, Iam calling the DLL exported function from managed code.

description:

I created a class for the dll as class clsCallDllBacku p which is having the prototype
for exported fuction ExtractJobDigDa ta.

Diginfo.dll will creat a txt file with binary information in selected folder, but in c# the
selected path will be as @"D:\\somefolde r\\mylucky.txt" ,

but the input folderpath for the dll function will be as "D:\\somefolder \\mylucky.txt" without
the symbol "@", is it any problem for the dll function in creating the text file on my choosen folder

how to give the input to dll exported function without "@" ie, as "D:\\somefolder \\mylucky.txt"

the signature of dll export function is ExtractJobDigDa ta(LPSTR strVariable1,LP STR strVariable2,LP STR m_varFolderPath )

when i run the program iam getting the true statement MessageBox.Show ("yyyyyyyyyyyyy "); but the required out put of the
dll ie, a text file is not getting created on the choosen folder
Nov 15 '05 #1
1 3710


----- seash wrote: ----

class xyz

public void somefunction

if(this.folderB rowserDialog1.S howDialog() == DialogResult.OK

m_varFolderPath = this.folderBrow serDialog1.Sele ctedPath
m_varFolderPath += "\\Iamlucky.txt ";


System.String a =(String)strVar iable1
System.String b =(String)strVar iable2
System.String c =(String)m_varF olderPath

try
/* DidData is the dll export method created in class clsCallDllBacku p*
if(clsCallDllBa ckup.DigData(a, b,c)
MessageBox.Show ("yyyyyyyyyyyyy ")
els
MessageBox.Show ("00000000")

catc

MessageBox.Show ("xxxxxxxxxx ")


}//end of functio

}//end of clas


public class clsCallDllBacku

public clsCallDllBacku p(


[DllImport("DigI nfo.dll", EntryPoint="Ext ractJobDigData" )
public static extern bool DigData(String strProjectName, String strJobName,Stri ng strFilepathname )


problem: the intended exported dll function 'DigDat'(unmana ged code) is not creating a binary text file on a
choosen folder, Iam calling the DLL exported function from managed code

description

I created a class for the dll as class clsCallDllBacku p which is having the prototyp
for exported fuction ExtractJobDigDa ta

Diginfo.dll will creat a txt file with binary information in selected folder, but in c# the
selected path will be as @"D:\\somefolde r\\mylucky.txt"

but the input folderpath for the dll function will be as "D:\\somefolder \\mylucky.txt" withou
the symbol "@", is it any problem for the dll function in creating the text file on my choosen folde

how to give the input to dll exported function without "@" ie, as "D:\\somefolder \\mylucky.txt

the signature of dll export function is ExtractJobDigDa ta(LPSTR& strVariable1,LP STR& strVariable2,LP STR& m_varFolderPath
when i run the program iam getting the true statement MessageBox.Show ("yyyyyyyyyyyyy "); but the required out put of th
dll ie, a text file is not getting created on the choosen folde
Nov 15 '05 #2

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

Similar topics

1
1190
by: Andreas Hoetker | last post by:
Hello I'm currently developing a project, that contains one .net (VB) executable and a C++ (MFC) DLL. Now, what I want to do is to call the functions in the dll out of my managed code //managed code (the .net executable Public Class TestClas <StructLayout(LayoutKind.Sequential)> Class ANYSTRUC Public counter1 As Int6 Public counter2 As Int6
4
1272
by: Ed Debrot | last post by:
This seems incredibale to me but I've done some testing and it appears I can't pass in a long and than an int to a function. The int is not passed in correctly. extern static int rvCore_bl_get_schedule(long driverNum, int nList); When I call rvCore_bl_get_schedule(long driverNum, int nList) with a value in driverNum and nList, nList is 0 in my unmanaged code. If I change my parameters to be both long or both int it works fine.
1
9453
by: Zapbbx | last post by:
I have a 3rd party application that can reference external dll's. The dll's have to be written in unmanaged code with an exported function I can reference and call. I would like it to call a C# dll file but it cant call a managed C# dll. I need to create an unmanaged C++.net wrapper for a Managed C# dll. Does anyone know how to do this? can you please give me a simple example of what the C++.Net code would look like to do this Take for...
3
2708
by: Gustavo L. Fabro | last post by:
Greetings! I'm a newbie in Visual C++ .NET (have programmed in Borland C++ and Builder for long) and I am trying to do a very simple thing, but I'm stuck. I created an (unmanaged) DLL project with a sample function, and tried to call it from a ".NET Forms" project. All I get are "Unresolved External" errors from the Linker!
8
5355
by: Brett Robichaud | last post by:
I understand how code-behind can handle events for a page, but can I call a code-behind method from within a <script> tag in my ASP.Net page, or can I only call methods defined in other <script> sections? I can't seem to figure out the syntax for for calling code-behind directly. The method is within the class my page inherits from and is public, but when I try to call it from my page I get this error: CS1520: Class, struct, or...
0
1756
by: monika.saxena | last post by:
Hi all, In one of my projects which is a web based application in asp.net, a third party tool - "Frontline Solver DLL" (It is an unmanaged DLL and ..NET is calling it using the PInvoke) is used. This DLL is used for solving and optimizing some non linear problems. Problem : The problem I am facing is as the solver runs and does the
4
1762
by: Peter Schmitz | last post by:
Hi, I've got a rather old DLL that compiles properly with the 'Multi byte charset' option under VS2005. Now, I cannot call any functions of this dll out of a VB .net application (would need 'Use Unicode' option for that..). As I do not want to rewrite the whole application for unicode usage: Is there any way to call functions out of this DLL in a .net 2.0 application? Thanks,
6
3358
by: guxu | last post by:
I have a managed C++ code which calls some methods in unmanaged C++ DLL. In my unmanaged DLL, I have a PROTECTED virutal function in a base class and derived class has a PRIVATE function which overrides the virutal one in the base. In my managed class, I have the following private: CUnmanaged __nogc* m_pUnManaged
1
3433
by: MC-Advantica | last post by:
Does anyone have a simple "Hello World" like application that demonstrates unmanaged C++ calling managed C++ developed in VS2005? I'm confused by many posts as they discuss managed extensions from VS2003, and related techniques. I have found managed to unmanaged technique very easy in VS2005, but have not been able to build anything with unmanaged to managed calls. I have legacy (unmanaged C++) that would like to leverage the .NET...
0
8231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8168
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8672
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6107
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5561
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4167
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1474
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.