News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Interprocess Communications

Started by Mikl__, May 15, 2022, 10:25:19 AM

Previous topic - Next topic

Mikl__

Hi, all!
Does anyone have an example of passing a message via a Windows semaphore or mutex? Pleeeeeez....

hutch--

I am not much use to you, I have only ever use memory mapped files for data and SendMessage() using the HWND_BROADCAST handle.

TimoVJL

In TLWHView code
...
HANDLE hMutex = CreateMutex(NULL, FALSE, g_szAppName); // create or open the mutex
if (hMutex)
if (GetLastError() == ERROR_ALREADY_EXISTS) {// test a mutex existence
COPYDATASTRUCT cds;
g_hFrame = FindWindow(szFrameClass, NULL);
cds.dwData = 1;
cds.cbData = lstrlen(lpCmdLine);
cds.lpData = lpCmdLine;
SendMessage(g_hFrame, WM_COPYDATA, 0, (LPARAM)&cds);
ShowWindow(g_hFrame, SW_RESTORE);
} else {
// create application window

...
case WM_COPYDATA:
return OnCopyData(hwnd,(UINT)wParam, (PCOPYDATASTRUCT)lParam),0;
...

...
May the source be with you

felipe

@TimoVJL so, based on the existence of a mutex you send some data to a window of some class, but wouldn't that be intra process communication?  :icon_idea: