473,772 Members | 2,424 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

is it possible to embed a native win32 dll as resource and use pinvoke?

if I have a Win32 DLL - X.DLL
can I embed it to a .Net Application and invoke it's exported functions?

normally i have to put the X.DLL in the file system and use DllImport to
import/invoke the function
I just wanna combine everything into a single .exe

thank you
Nov 15 '05 #1
1 3148
What you can do is embed it as a manifest resource stream and then at
runtime extract it, save it to the app's directory and then call it. You'll
have to specify only the filename in your [DllImport] statement for that to
work.
--
_______________ _____
Klaus H. Probst, MVP
http://www.vbbox.com/

"babylon" <am***@hotmail. com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
if I have a Win32 DLL - X.DLL
can I embed it to a .Net Application and invoke it's exported functions?

normally i have to put the X.DLL in the file system and use DllImport to
import/invoke the function
I just wanna combine everything into a single .exe

thank you

Nov 15 '05 #2

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

Similar topics

3
1852
by: rashid | last post by:
Sorry for posting this message on general . kindly direct this message to the specific group. I know we can invoke the Native Code from .Net but can we generate Native Code in .Net( Native Code means PE file and native dlls), if so how many ways to achieve it. Thank You
3
2229
by: M | last post by:
Hi Folks, Does anyone know how to embed a file into a resource in C#? You seem to be able to embed Icon, Bitmap, Cursor's & Strings. But how do you embed a file??? In VC++ version 6 you would, Find the Resource, Load It, get its size, and then write it out to where ever you want it.
1
1345
by: adrian maull | last post by:
Anyone know of a good resource thats maps win32 APIs (structs, functions, etc) to c#?
12
7815
by: Nak | last post by:
Hi there, This might sound like a dumb question but how would I use a Win32 resource DLL in VB.NET? I presumed there were API's for this purpose but am unsure which ones, my API guide has nothing of relevance in the "Resources" section and I've never actually done this in the past. Thanks loads in advance! Nick.
2
2517
by: Marek | last post by:
Hi I'm trying to call a native C++ dll using the following code (both C# and C++ code segments included). When I make the call to the method (AddTwoDoubles) that has no return value all is fine. When I try and call a function that returns a double (AddTwoDoubles2) I get the following message: PInvokeStackImbalance was detected Message: A call to PInvoke function 'tempModule!<Module>::AddTwoDoubles2' has unbalanced the stack. This is...
2
1187
by: pkcser | last post by:
Hi, I am new to .Net development, so please excuse me if some of the questions .... So I have Win32 library (using Bluetooth) and I have to expose its functionality to .Net developers. I think I have 3 options: 1) Re-implement it in C# - looks impossible: 1) I have to call several native methods with complex parameters like WSALookupServiceBegin
8
13667
by: CodeLeon | last post by:
Hi, All. I am creating a setup program. The way it works is that the user creates their setup info, my program generates the C# code for a setup executable, embeds the xml file containing the info for the setup, and compiles the whole thing into one EXE. How do i embed resources, and access them, into that assembly?
14
14080
by: pigeonrandle | last post by:
Hi, This is an answer, not a question. I hope it helps you since i was messing around for ages trying to get information on this: For anyone else wanting to create a test c++nativedll/c# project follow these instructions... 1) Create a new 'Visual C++ - Win32 Console Project' - call it 'test' 1b) When the wizard pops up, click the 'Application Settings' link on the left
0
1554
by: VigneshS | last post by:
Hi, I am a newbie to Globalization and Localisation Concepts. I tried almost all the methods of the Globalization concepts. But i cannot be able to embed a text file within a Resource. My need is to open a solution programmatically, select a Project within, and get a source resource file. Then, select a number of cultures and create culture specific resources with the content of the source resource assembly. I aquired upto...
0
9454
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
10261
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...
1
10038
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9911
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...
0
6713
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
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
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.