Converting a Win32.exe to DLL - winapi

I 'm working on a Visual C++ Win32 Project (Visual Studio 2012), consisting of:
-source.cpp (Source Files)
-dialog, icon, accelarator (Resource Files)
-resource.h (Header Files)
I want to convert Win32.exe to Win32.dll, in order to call it from a Windows Forms application. Which is the best way doing this? Do I have to use the source code and put it into a new DLL project or I can just convert it?
I 'm a newbie, and analytical steps would be highly appreciated.

Related

Convert Visual Studio exe-project in lib-project

I am developing an application (exe) in c++ with visual studio. I am not that experienced. Now, I came to the conclusion that it might be better to compile the general program functionality into an lib or dll file, which I then would use in a different visual studio project, where I basically implement the functions from the lib files for the more specific purpose of my project. With my current setup, I get the impression that I am starting to mix the gerenal functionality with the specific problem statement.
Basically I am asking for a way to convert my current full visual studio project into two separate projects, one for the gerenal lib files representing the classes and program modules, and one for the specific problem implementation. Is it possible to also keep everything in one visual studio project (edit: solution) for convenience?

Mwarray.dll for Unity - How can I use it?

I have a problem with the MWArray.dll which is the original dll library from mathworks compiled from Matlab. This dll works under visual studio but not under unity. The goal was to compile under matlab a simple function mycos which calculates a cosinus and uses it under unity with the second dll MWArray mathworks library.
I made a test under Visual Studio and it works well. I have no problem to read the dll and make a call to the mycos.dll class. I made a typical c# project with two references on MWArray and mycos.
But when I try under unity, by putting the two dll under a plugins folder and configure unity 2018 on .NET 4.0 because the dll are compiled with the .NET framework 4.0.
Unity can read the dll but when running I get an error:
NotImplementedException: The requested feature is not implemented.
System.Security.Principal.WindowsIdentity.GetCurrent (Boolean ifImpersonating)
(at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Security.Principal/WindowsIdentity.cs:166)
If I want to use matlab for a research project which was coded in matlab with advanced high level math functions which going to be difficult to recode under unity with c#. So the easy way is to use compiled package from matlab compiler. So is there someone who did this already?
The solution consists in NOT using MWArray.dll in Unity project because of incompatibility with Mono. Create a Visual Studio project (when creating new select the type "console applicatiion"), it MUST be separated from unity project directory, and use it as an application server; in fact in that app you can use MWArray.dll, remember that you have to configure your project configuration to x64!!! In the Unity project create a client app to communicate with the other server project.

Is this a F++ project?

I am supposed to get a Visual Studio project to run again after several years. Originally it was written in Fortran and later a small GUI was build around it. Now my job is to change that GUI-part.
Since I am new to Visual Studio and Fortran, I need to know what kind of language the project (see below) is written in. I know there are Fortran files ( f90, fi, fd, for) but what language is .ico .rc.
It seems to be a F++-Project. But What is F++?
Is that similar to C++?
You are using Intel Visual Fortran in Microsoft Visual Studio. That little icon says Fo (for Fortran).
.ico is an icon file
.rc is a resource compiler file
These are used when creating Windows applications with a graphical user interface.
.fi and .fd are include files - the latter is created automatically from the .rc file when you build the project.

Embed xml into dll

For my UI system, which is similar to WPF but written cross plattform with OpenGL, i need to embed the xml files into the DLL which are used to layout the user controls. The problem is: By default MonoTouch does not support embedding any file into a dll and afaik there is only one solution which solves this: Embed the xml into a *.cs file and compile it.
Now, this is a task which doesn't make any fun if you do it per hand each time, so the question is how is the best way to achieve this for both, Visual Studio and MonoDevelop?
MonoTouch does not compile C# code, it uses the smcs compiler. That's the same compiler being used for Mono for Android and, originally, for Moonlight.
That smcs compiler is able to embed files into assemblies, it's doing so the BCL (e.g. globalization files for mscorlib.dll) and that was an important requirement for XAML (in Moonlight).

Using Gloox with Visual Studio 2010

I am trying to use the gloox library (C++) to create a Windows XMPP application. It seems simple enough, except I don't know how to import gloox into Visual Studio 2010 so I can include it in my application project.
I've looked at the instructions provided in the read-me (shown below), but when I try to compile the library, I get this error:
Cannot open source file: 'src\tlsgnutlsserver.cpp': No such file or directory
Instructions provided in the read-me file:
Building gloox on MSVC++
use the included project file or create your own
adjust include + library paths if necessary
to receive any debug output you should use the LogSink facilities (this is not win32-specific)
build
Does anyone have experience using Gloox with VS10? If yes, can you please help me out? Thanks!
I assume you're using the official 1.0 tarball? I had the same problem (missing source file) and had to acquire the source from SVN instead. I used the 1.0 branch.
I encountered a few other build problems, namely
the release build configuration was set to build an Application (.exe) instead of Dynamic library (.dll) (Project->Properties->General->Configuration Type)
I needed to add DLL_EXPORT to the preprocessor definitions (Project->Properties->Configuration Properties->C/C++ ->Properties->Preprocessor)
src\atomicrefcount.cpp needed to be added to the project's source files. (Project->Add Existing Item)
This worked for me in express editions of both VC++ 2010 and VC++ 2008.
Hopefully it helps you as well.

Resources