i want to make DLL for Metatrader however unlike MQL programming i didn't find any good source to learn on this subject
can anyone point me to a website or book etc so i study those
thanks for your help in advance
Here are few of the sources for creating DLLs for MT4/5 with C++ and C#(for MT5)
C++
Latest Article-DLL is made with VS2017
Old one(just for reference)
C#
Windows Form Application on MT5 with C# DLLs
Quotes Exporter with Managed(.NET) DLLs with C++ wrapper
Related
Is there any way, I can prevent my c++ cli project from being decompiled if someone uses a C# decompiler, because I tried to decompile the .exe i made in ILSpy and it showed my whole code, so is there any way I can prevent this?
Thanks
as ancient as this thread is, I ran across it with the same question, and a newish answer. Can't specify the minimum version for this one, but
[module:System::Runtime::CompilerServices::SuppressIldasmAttribute];
on top of each .cpp module did the trick for me:
I didn't investigate much further, yet.
Another useful thing is to add
#pragma unmanaged
to each .cpp that does not contain .net code.
You can
Use a .NET obfuscator.
Or
Only use C++CLI for the boundaries of your app which require to Interact with .NET. And implement your logic in a native C++ library.
I am trying to migrate a VB6-based .ocx into C++. The migration path that I'm settling on is as follows:
Migrate the current .ocx into a regular COM .dll (it doesn't really have any user interface components, and I'm not sure why it's an .ocx anyway).
Write a C++ version of the COM .dll, and use that as my replacement.
My questions are:
a. Does this seem like the right way to go?
b. How does one go about creating a COM .dll in C++ in Visual Studio 2010? I tried creating a simple .dll, using tlbexp to generate a .tlb file, but this doesn't seem to work. I can pull my .tlb into the VB5 project, but there are no classes to instantiate. If I try to use regsvr32 to register the .dll, I get the "no entry point" error.
I have seen references to an option in VS 2005 to "Register for COM Interop", but I haven't been able to find an equivalent option in VS 2010.
Thanks in advance for your help!
You have to create an ATL project:
Then add the COM objects to your component. The missing entry point you receive is because astandard dll does not have the correct entry ppoints for registration, an ATL project does this for you.
When I was reading about DLLs on StackOverflow I came accross the word "Native DLLs" a lot of times. I found questions regarding them but I couldn't understand what a "Native DLL" actually is.
What is a native DLL?
Native DLL's are usually DLL's containing raw processor directly-executable code (such as that found in the Win32 API's) as opposed to, for example, managed (MSIL) which contain code that is consumed and JIT compiled to native processor instructions by a runtime such as the .NET CLR.
In .NET it is also possible to create mixed-mode DLL's that contain both native binary code and managed code.
this term came out when managed code that comes from .net assemblies was invented, to distinguish between managed and unmanaged =native code.
every .net assembly gets "nativied" by the JIT-compiler during execution. this means it gets translated to asm code that is "natively" understandable to the CPU.
The term native DLL was originally used before managed code existed. It was originally intended to refer to DLLs that are not COM DLLs. It is intended to refer to DLLs like the ones in Windows originally.
Note that Kev said "In .NET it is also possible to create mixed-mode DLL's that contain both native binary code and managed code." but that is not relevant; such a DLL is not a native DLL because it has CLI (.Net) metadata. Also, mixed-mode DLL's can only be developed using C++/CLI; no other language supports it.
See my article Native Windows Dynamic Link Libraries (DLLs) for more.
From what I understand a "Native DLL" will be a basic Win32 dll for example. A DLL that contains non managed code.
With .NET you write Managed assemblies. These will call the base level Windows code which is the same that a non-managed application will call.
A quick look through these MSDN search results will answer your question:
http://social.msdn.microsoft.com/Search/en-US?query=define:%20native%20dll&ac=8
It's simple a DLL that contains machine code, rather than MSIL.
I'm already new in C++CLI , although I have been working on VB and C++ for a long time , but I need to start a projects on CLI using it's visual screens and easy codes (just in windows) , But I can't find any good Resource or book to start windows programming (I mean codes that you can give it to buttons or texts without using c++ classes) ,
Can I find any of them ?
thank you
I can suggest you 3 books ( I used them ):
Foundations of C++/CLI The Visual C++ Language for.NET 3.5
Pro Visual C++/CLI and the .NET 3.5 Platform
C++/CLI in Action
They are in order of difficulty.
The first and the 2nd are introductory and advance respectively.
The 3rd is great for advanced topics, like interop, mixed-mode coding etc..
Not sure what you have done in your work with C++ without classes, it is C with classes :). If you want to write Windows Program in C, Programming Windows, 5th Edition written by Charles Petzold could be a good start. Then you can decide which managed GUI to learn. Winform is mature with no future planned beyond .Net 4.0, while WPF is growing and is the main focus of Microsoft.
I put "better" in quotes because it's a qualitative question. I've been writing COM DLLs for a couple of years now and have only recently come upon, and successfully used, the standard DLL with Typelib concept.
Are there any compelling reasons to use COM DLLs instead of DLL+Typelib? Granted, you can't do DCOM with a DLL+Typelib, but is that the only reason?
EDIT I've written COM DLLs in Visual C/C++ 6, Compaq Visual Fortran, Delphi, Visual BASIC 6, ActiveState Perl and a few others. I've written standard DLLs in Visual C/C++ 6, Delphi, Ada and a few others. I've written typelibs for some of my own standard DLLs and also for third party DLLs. The question was originally written in the context of a Delphi DLL+Typelib reimplementation of a VB6 original.
TypeLib's are also important if you ever wish to migrate COM components to managed code in the future. Or have managed code interact with the COM components.
With a typelib there are lots of tools which will automagically translate your COM signatures into .Net interfaces and types. This can be done by hand but with a large project it's certainly a huge time saver.
It really depends on the clients of the component I would think.