Hi,
In case I want to use a MFC dll to my C# application.
Can I just add it as a refernce to the project and use it, or do I need to add something else.
I saw some examples with Assembly.LoadFile|("something.dll") - when it is used?
Thanks
Idit
3 6315
Hi,
In case I want to use a MFC dll to my C# application.
Can I just add it as a refernce to the project and use it, or do I need to add something else.
I saw some examples with Assembly.LoadFile|("something.dll") - when it is used?
Thanks
Idit
Adding the DLL to the References should be enough.
Another way to do it, (albeit the hard way), is to use DllImport. For example, if you wanted to use the IsWindowVisible() call from user32.dll, the resulting code would look like: -
[DllImport("user32.dll", CharSet = CharSet.Auto)]
-
public extern static int IsWindowVisible(IntPtr hWnd);
-
-
// And later in the code you would call it normally
-
-
IsWindowVisible(hWnd);
-
Adding the DLL to the References should be enough.
Another way to do it, (albeit the hard way), is to use DllImport. For example, if you wanted to use the IsWindowVisible() call from user32.dll, the resulting code would look like: -
[DllImport("user32.dll", CharSet = CharSet.Auto)]
-
public extern static int IsWindowVisible(IntPtr hWnd);
-
-
// And later in the code you would call it normally
-
-
IsWindowVisible(hWnd);
-
Thanks,
I thought it should be ok,but when I try to load the dll on another computer (not with VS2005) it fails to load (FileNotFoundException).
The dll is in the same dir with the exe. and the .net 2.0 framework is also installed.
Do you have any idea what could be the problem?
Thanks
Idit
Thanks,
I thought it should be ok,but when I try to load the dll on another computer (not with VS2005) it fails to load (FileNotFoundException).
The dll is in the same dir with the exe. and the .net 2.0 framework is also installed.
Do you have any idea what could be the problem?
Thanks
Idit
I don't have any idea...perhaps you should us what compiler it is?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Wysiwyg |
last post by:
Is there any way to add an embedded resource to a project without copying it
to the project's directory? I have shared resources and don't want each
project using the images, xml files, etc. to...
|
by: Geraldine Hobley |
last post by:
Hello,
I'm having a problem adding a manifest to a vb project in order to add visual styles to my vb.net application. I followed the steps outlined her...
|
by: Adam Maltby |
last post by:
Hi,
I am adding an new picbox and animated gif to it at runtime
Dim img As Image = Image.FromFile(Application.StartupPath & "\animation.gif")
With pic_Wait
.Location = New Point(300, 250)...
|
by: MIGUEL |
last post by:
Hi all,
I'm quite lost with how adding web references to a project creates proxy
classes.
I've developed a web service with two classes inside and that contains three
references to three...
|
by: UJ |
last post by:
I have a couple of files (type definitions, constants, ...) that I want to
use in multiple projects. How do I make it so that I have only one copy of
the file for multiple projects? If I do add...
|
by: Dinsdale |
last post by:
I'm looking at adding scheduling features to an application and I
wanted to ask the community about any experience with scheduling
components, either open source like from code project or from a...
|
by: moondaddy |
last post by:
I'm running a wpf windows app and want to add the appSettings element to the
config file. when I do, the app wont start up and I get the following
error:
{"The type initializer for...
|
by: vinodkreddy1 |
last post by:
hi good morning every body...
i have a problem in adding Reference of any dll to asp.net 2005.
i am trying to add dlls reference to asp.net application. but they r not adding to the reference...
|
by: ifitzgerald |
last post by:
Hi,
I am modifying a rather large and complex MFC application (written by someone else) written in Visual C++ 6.0 with service pack 6. I need to add serial communication functionality to the...
|
by: Jason |
last post by:
Hello,
I am trying to utilitze the AJAX Control toolkit in my asp.net project. I
have added a reference to AjaxControlToolkit.dll, and in my page, added
these lines of code:
...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |