-
You have two problems. First, remove WS_CHILD from the dialog. WS_DISABLED probably isn't all that useful either.
Second, you're not declaring the DLL function correctly in the client. Two ways to fix this:
Code:
#include <windows.h>
extern "C" __declspec(dllimport)
LRESULT DisplayMyMessage(HWND hwndOwner);
#pragma comment(lib, "Con2DLL.lib")
int main()
{
DisplayMyMessage(0);
return 0;
}//main
Or...
Code:
#include <windows.h>
#include <iostream>
using namespace std;
typedef LRESULT (*DisplayMyMessage_pfn)(HWND);
int main()
{
HMODULE hmod = LoadLibraryA("Con2DLL.dll");
if (!hmod)
{
cerr << "LoadLibrary failed, le = " << GetLastError() << endl;
return 1;
}//if
DisplayMyMessage_pfn dm =
(DisplayMyMessage_pfn)GetProcAddress(hmod, "DisplayMyMessage");
if (!dm)
{
FreeLibrary(hmod);
cerr << "GerProcAddress failed, le = " << GetLastError() << endl;
return 1;
}//if
dm(0);
FreeLibrary(hmod);
return 0;
}//main
gg
-
I don't know who you are but you're my hero!!!
Thank you soooo much.
I think the main problem was that I was calling it from a Win32 Project instead of a console project in VS.
Thank you for all the time you put into this.
-
One more question:
How can I change the edit control to a richtext control?
I tried just deleting the edit control and adding the richtext control, but it went back to not displaying my dialog.
-
I got it, I forgot to load the richedd.dll.