Author Topic: Interprocess Communications  (Read 245 times)

Mikl__

  • Member
  • *****
  • Posts: 1203
Interprocess Communications
« on: May 15, 2022, 10:25:19 AM »
Hi, all!
Does anyone have an example of passing a message via a Windows semaphore or mutex? Pleeeeeez....

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 9369
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Interprocess Communications
« Reply #1 on: May 15, 2022, 11:56:10 AM »
I am not much use to you, I have only ever use memory mapped files for data and SendMessage() using the HWND_BROADCAST handle.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

TimoVJL

  • Member
  • *****
  • Posts: 1001
Re: Interprocess Communications
« Reply #2 on: May 15, 2022, 02:11:40 PM »
In TLWHView code
Code: [Select]
...
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

  • Member
  • *****
  • Posts: 1381
Re: Interprocess Communications
« Reply #3 on: May 24, 2022, 04:54:36 AM »
@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: