Date: 02-16-2022
Return to Index
created by gbSnippets
'To send a message to other processes, you first need to agree
'on a message number that both parties will recognize. The use
'of the RegisterWindowMessage API allows you to do that.
'Primary Code:
'The API take a string and returns a unique system message number.
'Both application call the API with the same string.
gMsg = RegisterWindowMessage(MsgString)
'Compilable Example: (Jose Includes)
'This app will talk to this app: http://gbl_00743
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Include "Win32API.inc"
Global hDlg, gMsg as Dword
Function PBMain() As Long
Local MsgString As AsciiZ * 100
MsgString = "gb Custom MsgA"
gMsg = RegisterWindowMessage(MsgString) 'gets unique msg #
Dialog New Pixels, 0, "EXE #2 " + str$(gMsg),300,300,200,200, %WS_OverlappedWindow To hDlg
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Select Case CB.Msg
Case gMsg
? "Message Received" + str$(cb.wParam) + str$(cb.lParam)
End Select
End Function
'gbs_00698
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm