.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Win32 usable dll with c#

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :.NET Framework


I need to write a dll in C#, usable by a "old" Win32 application.
What would be the best / secondbest approach to this?

Best Regards

View Complete Post

More Related Resource Links

Building Re-Usable ASP.NET User Control and Page Libraries with VS 2008


I am having problems with a user control. I want my solution to have a separate project for holding my user controls.

The main project can get a reference to this user control project and can import this user control dll into my main project. 

Thanks in advance,

Dheeraj Mittal


Usability in Practice: Useful, Usable and Desirable: Usability as a Core Development Competence


In this month's installment, learn how to achieve the most important outcome of all UI design: ensuring that your software is useful, useable, and desirable.

Dr. Charles B. Kreitzberg and Ambrose Little

MSDN Magazine May 2009

C++ Q&A: Finding a Win32 Handle, HTML in CHtmlCtrl


This month Paul DiLascia discusses how to find windows with GetLastChild and outputting HTML with a C++ procedure equivalent to document.write.

Paul DiLascia

MSDN Magazine August 2003

Inside Windows: An In-Depth Look into the Win32 Portable Executable File Format, Part 2


The Win32 Portable Executable File Format (PE) was designed to be a standard executable format for use on all versions of the operating systems on all supported processors. Since its introduction, the PE format has undergone incremental changes, and the introduction of 64-bit Windows has required a few more. Part 1 of this series presented an overview and covered RVAs, the data directory, and the headers. This month in Part 2 the various sections of the executable are explored. The discussion includes the exports section, export forwarding, binding, and delayloading. The debug directory, thread local storage, and the resources sections are also covered.

Matt Pietrek

MSDN Magazine March 2002

Inside Windows: An In-Depth Look into the Win32 Portable Executable File Format


A good understanding of the Portable Executable (PE) file format leads to a good understanding of the operating system. If you know what's in your DLLs and EXEs, you'll be a more knowledgeable programmer. This article, the first of a two-part series, looks at the changes to the PE format that have occurred over the last few years, along with an overview of the format itself. After this update, the author discusses how the PE format fits into applications written for .NET, PE file sections, RVAs, the DataDirectory, and the importing of functions. An appendix includes lists of the relevant image header structures and their descriptions.

Matt Pietrek

MSDN Magazine February 2002

Win32 Resources: Using C++ to Programmatically Retrieve a Global Cursor's Shape and ID


Getting global cursor information is useful when developing software that drives or gathers information about other UI-based applications, including information about a remote machine. This article describes a way to programmatically identify the current cursor's ID and bitmap at any point in time. The first technique described is based on polling for information and shows how to get the handle of the current global cursor. This handle will then allow you to get information about the cursor. You can also monitor WinEvents for changes to the global cursor.

Dmitri Klementiev

MSDN Magazine October 2001

Sending 'ctrl-c' to the datagridview row of an external application using win32 api. Please help.

I'm just not able to send ctrl-c using my C# application to an external WinForm application. Here is my sequence of commands. I compared the messages using Spy++, and it matches except for my SendMessages are showing up as Send and Receive, vs. the same operation done on the WinForm is showing up as posted. My command sequence : NativeMethods.SendMessage(hwnd, WM_KEYDOWN, 0x00000011, 0x001D0001); NativeMethods.SendMessage(hwnd, WM_KEYDOWN, 0x00000043, 0x002E0001); NativeMethods.SendMessage(hwnd, WM_CHAR, 0x00000003, 0x002E0001); NativeMethods.SendMessage(hwnd, WM_KEYUP, 0x00000043, 0xC02E0001); NativeMethods.SendMessage(hwnd, WM_KEYUP, 0x00000011, 0xC01D0001); My Spy++ sequence : <00001> 0059043C S WM_LBUTTONDOWN fwKeys:MK_LBUTTON xPos:299 yPos:52 [wParam:00000001 lParam:0034012B] <00002> 0059043C R WM_LBUTTONDOWN <00003> 0059043C S WM_LBUTTONUP fwKeys:MK_LBUTTON xPos:299 yPos:52 [wParam:00000001 lParam:0034012B] <00004> 0059043C R WM_LBUTTONUP <00005> 0059043C S WM_KEYDOWN nVirtKey:VK_CONTROL cRepeat:1 ScanCode:1D fExtended:0 fAltDown:0 fRepeat:0 fUp:0 [wParam:00000011 lParam:001D0001] <00006> 0059043C R WM_KEYDOWN <00007> 0059043C S WM_KEYDOWN nVirtKey:'C' cRepeat:1 ScanCode:2E fExtended:0 fAltDown:0 fRepeat:0 fUp:0 [wParam:00000043 lParam:002E0001] <00008> 0059043C R WM_KEYDOWN <00009> 00590

MergeContentDbs Error: : This SqlTransaction has completed; it is no longer usable

I am running a MOSS 2007 farm with a large (378 GB) content database. I am running through various splitting scenarios so that I have multiple Db's instead of just one large one.  Using mergecontentdb's works fine for site collections up to 2GB, but any site collection larger gets the following error: : This SqlTransaction has completed; it is no longer usable.   After that, the site is no longer browseable.  Fortunately this is my test bed, but it does not bode well for splitting up the larger site collections.   Any help is greatly appreciated.   DaleDale

How to embed a win32 application in a WPF application

Hi, I was wondering if it would be possible to host a win32 application into a WPF application. I don't need to interact with it at all, I just want to host it in my WPF app. For example I want to be able to host a Notepad or Command Prompt window or any other win32 app. Is there a way for me to do this? Thank you, Cristian

Delphi Win32 MDI Parent with C# Windows Forms child form

I have created an assembly containing a form that i want created as a MDI child form in a Delphi Win32 application's MDI parent control. I can create the .NET form fine from my Delphi code. I can even use the Delphi window handle to let my .NET form be a child in the Win32 application by using the SetParent API. However minimizing the child form makes it disappear (instead of the regular minimize action for MDI children), and it also doesn't cause the MDI container to get scroll bars when you drag the child form under the edge of the MDI container. I have the feeling that the child form is not yet correctly aware that it is a MDI child. For instance, its MdiParent property is null. And i read somewhere that i might need to call some more Win32 API"s to hook everything up correctly. I can't, however, for the life of me not find which ones to call, and where to do it. Is there anyone here that is well versed in hooking up managed Windows Forms with native Win32 applications that can lend a helping hand?

How to proceed with activeX and unmanaged win32 console[mix of a question and a discussion]

Hi I have rather weird situation. I want to get images from an ip camera to process with infamous opencv. My camera comes with description protocol for socket programmers however I do not wanna get distracted with developing that one as well. Anyway luckily there is also an MFC sample that comes with camera and it uses an activex control.My first question (1) Should I use the control as in given MFC window and then hide it from user somehow and find a way to marshal data to opencv code that I wrote or should I try to consume program in unmanaged C++(For latter one I worry whether juice worths the snooze)? Since I do not know so much about marshaling I am trying to solve this problem in 2nd method (trying to consume activex object as an ordinary com object). My second question comes here (2) I checked corresponding com object's clsid and tried to do this HRESULT hr; ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); CLSID clsid; const IID CLSID_AMC = { 0x745395C8, 0xD0E1, 0x4227, { 0x85, 0x86, 0x62, 0x4C, 0xA9, 0xA1, 0xA, 0x8D } }; clsid = CLSID_AMC; IDispatch *amc; hr = ::CoCreateInstance(clsid, NULL, CLSCTX_LOCAL_SERVER /*this one was for activex right? */, IID_IDispatch, (void **)&amc); But it gave  0x80040154 Class not registered. Then changed last line to hr = ::CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, IID_IDispatch, (void **)&amc

advice needed on implementing a re-usable class (c#)

Hi guys,Im trying to create a function for my website that allows the re-sizing of images for different purposes. I want the function to use variables for image height and image width, and obviously for the file itself. I have working test code for re-sizing a selected image that is hard-coded into the function. I have created it in a separate class in my App_Code folder, and have tried calling it on web pages and it works until I try and pass a filename as a variable, encountering a variety of errors. Should I be using a server control/user control to do this? or do I need something else?RegardsPooleo

System.BadImageFormatException:is not a valid Win32 application

We are facing problem while migrating a .Net 2.0 application 64 Bit OS Windows Server 2003.The error is  as below:"is not a valid Win32 application. (Exception from HRESULT: 0x800700C1) " Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.BadImageFormatException: is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)the application is running fine on 32 Bit OS windows Server 2003.Can any one provide any possible soution to the above problem.thanksNikhil

64 bit compilation starts always with /D "Win32"

This might be a  VS general issue but I decided to post it here: I am porting a project to AMD64 bit. After solving some poting issues I am facing the following problem: The compiler is started with /D "Win32" , although in the project configuration WIN64 is defined. I tried - to rebuild... no effect - to reload solution ... no effect In the vcproj file the defines are correct. I could upload a screeenshot if possible.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend