Click here to Skip to main content
15,901,035 members

Comments by Member 15011436 (Top 4 by date)

Member 15011436 25-Mar-21 10:06am View    
Thanks,
Below code worked.

CRect programEditCntrlRect;
CWnd* prgEdit = GetDlgItem(IDC_EDIT_PrgTxt);
prgEdit->GetWindowRect(&programEditCntrlRect);
this->ScreenToClient(&programEditCntrlRect);
Member 15011436 26-Feb-21 10:18am View    
Using DLL is program design's demand.

I think I am done with most on dll, call back is set.

Application 1 can pass argument and events to dll. When DLL tries to call application 2 callback, it throws access violation error. Then I searched and found your remarks on a old question, that gives idea on shared memory.

Please advise "How to initialize the code for shared memory in generated code that does not have DllMain?" This answer will save my many old work in dll.
Member 15011436 26-Feb-21 8:25am View    
Deleted
C++

Copy
// The DLL code

#include <windows.h>
#include <memory.h>

#define SHMEMSIZE 4096

static LPVOID lpvMem = NULL; // pointer to shared memory
static HANDLE hMapObject = NULL; // handle to file mapping

// The DLL entry-point function sets up shared memory using a
// named file-mapping object.

BOOL WINAPI DllMain(HINSTANCE hinstDLL, // DLL module handle
DWORD fdwReason, // reason called
LPVOID lpvReserved) // reserved
{
Member 15011436 26-Feb-21 8:18am View    
Hi Richard, Thanks for your time.

I am trying to develop a DLL with capability of sharing data , events between two or more different MFC applications.

For example MFC Application 1 will send x, y, radius of sphere to the dll, then dll should pass these data with some draw sphere event to 2nd MFC application that will draw the sphere.

https://docs.microsoft.com/en-us/windows/win32/dlls/using-shared-memory-in-a-dynamic-link-library

BOOL WINAPI DllMain(HINSTANCE hinstDLL, // DLL module handle
DWORD fdwReason, // reason called
LPVOID lpvReserved) // reserved
{

This looks part of DLL.