answersLogoWhite

0

Steps to Create Your First DLL
  • Create a Win32 Dynamic Link Library project, adding a *.cpp and a *.h file.
  • In the *.cpp file, create a class instantiated from the CWinApp file. Collapse | Copy Code

    # include # include "SourceFile.h" class CDllApp : public CWinApp { public: CDllApp::CDllApp() { Calc(0,0); } DECLARE_MESSAGE_MAP() }; BEGIN_MESSAGE_MAP(CDllApp,CWinApp) END_MESSAGE_MAP() CDllApp DllObject;

  • In the *.h file (here it is SourceFile.h), define the functions to be used. Also specify the dllexport value for the _declspec function. Collapse | Copy Code

    extern "C" _declspec(dllexport) int Calc(char no1,char no2) { char result; result = no1 + no2; return result; }

  • Then compile the DLL.
  • Create a normal Win32 Application with a *.cppfile and a *.h file.
  • In the *.h file, (here it is AppHeader.h ), declare the function with the dllimport value of _declspec. Collapse | Copy Code

    extern "C" _declspec(dllimport) Calc(int FirstValue, int SecondValue);

  • In the *.cpp file, use the function. Collapse | Copy Code

    # include "AFXWIN.H" # include "AppHeader.h" class MainFrame : public CFrameWnd { public: MainFrame() { Create(0,"Trial"); } void OnLButtonDown(UINT nFlags,CPoint point) { int res; char str[5]; res = Calc(998,226); sprintf(str,"%d",res); MessageBox(str); } DECLARE_MESSAGE_MAP() };

  • In the Link tab of the "Project->Settings" dialog, go to the text box labeled "Object / Library Modules" and specify the path of the DLL file. Then copy the compiled DLL file to your current appliation path directory and run the program.
User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

How do you create dll file?

type nul > c:\my.dll


How do you register a dll file in dos mode?

To register a file, type regsvr32 .dll. Or type regsvr32 \.dll, where is the path to the file, and is the name of the file.


Where can you find karasX2 dll?

You can find karasX2.dll file in Windows System32 file.


Where does a win32 application look for a dll?

You can file dll file in C:\WINDOWS\system32.


Will cleaning your computer fix your dll problem?

Yes and no. The dll file may be just misplaced, then yes. A defrag your hdd and that should fix it. If a dll file is corrupt, then no. You will have to find or repair the dll file yourself.


How do you launch a dll file?

You do not launch a DLL. It's used by something else and will start up when needed. Read up on DLL file.


What can open dll files?

A DLL (dynamic link library) file is a file used by a specific application to communicate with devices inside or attached to the computer. DLL files aren't meant to be opened separately from the program they belong to. When you load the program the DLL file belongs to, that program will automatically load the DLL file if it needs it.


How do you make a dll file go back to its original or default form if it was opened with a text editor by accident?

Overwrite the file with the original dll file.


How do you convert RAR files into DLL files?

To convert RAR files into DLL files, you first need to extract the contents of the RAR file using extraction software like WinRAR or 7-Zip. Once extracted, check if the contents include a source code or necessary files for a DLL. If applicable, compile the source code using a programming language like C# or C++ to create the DLL. If the RAR file contains a precompiled DLL, simply rename the extracted file with a .dll extension, ensuring it corresponds to the intended use.


How do you convert a dll file into a mib file?

Right mouse click on dll file, click convert to, click options, click mib, click apply.


How do you re-install windows rootsystem32hal dll?

Hal dll file locates in C:\WINDOWS\system32. You can install in on this program file.


What is a dll file like when you open it?

i want to know what a .dll file looks like when u click on it. give me a pic plaease