Importing and running the Windows program (a function) through DLL
// Before you can link to the DLL, you need to add/tell your compiler the mydllpro.lib library so that it can find the DLL. Project->your_project_name Properties->
// Configuration Properties->Linker->Input->Additional Dependencies->On the end of the field click the ...->Type mydllpro.lib in the box
// and click OK button->Click OK button to close the project property page. Make sure you already copied the mydllpro.lib and mydllpro.dll to the appropriate folders
// as shown in the previous example. Create another empty Win32 console mode application project, the source file name: mydllloadtime.cpp
// A simple program that uses mydll() from mydllpro.dll from the previous example.
// For WinXp, don't forget to add
#define _WIN32_WINNT 0x0501
// call to a function in the mydllpro.dll
__declspec(dllimport) int mydll(LPTSTR);
// Another form: int mydll(LPTSTR);
int Ret = 1;
Ret = mydll("This message was printed using the DLL function");
-This is mydll.dll file lol!-
GetStdHandle(), standard handle is OK.
This message was printed using the DLL function
Press any key to continue . . .
Compiler: Visual C++ Express Edition 2005
Compiled on Platform: Windows Xp Pro SP2
Target platform: none, just for learning and fun
Header file: Standard and Windows
Additional library: Windows Platform SDK
Additional project setting: Set project to be compiled as C.
Project->your_project_name Properties->Configuration Properties->C/C++->Advanced->Compiled As: Compiled as C Code (/TC)
Other info: non-CLR or unmanaged. Need to add Advapi32.lib (Advapi32.dll) to the project. Click the Project menu->Select the
your_project_name Properties... sub menu->Expand the Configuration Properties folder on the left pane->Expand the Linker
subfolder->Select the Input subfolder->Select the Additional Dependencies field on the right pane->Click the ... at the end
of the field->Type in 'Advapi32.lib' in the empty pane->Click the OK button->Click the OK button second time to close the project Properties dialog.
To do: Importing and running the Windows program (a function) using Dynamic Link Library
To show: The Windows process, thread and DLL programming in Win32