Date: 02-16-2022
Return to Index
created by gbSnippets
'This simple example minimizes when you press the button.
#Compile Exe
#Dim All
%Unicode = 1
#Include "Win32API.inc"
Global hDlg, hFound As Dword
Function PBMain() As Long
Dialog New Pixels,0,"Test",300,300,200,200,%WS_OverlappedWindow To hDlg
Control Add Button, hDlg, 100,"Push", 50,10,100,20
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
If Cb.Msg = %WM_Command And Cb.Ctl = 100 Then SendData
End Function
Sub SendData
Local D As CopyDataStruct, sData As String * %Max_Path
'get handle to the open instance of gbThreads
EnumWindows(CodePtr(EnumCallback), 0&)
'send message to that instance
sData = "All Thread Words" + $Dq + "Gary Beene" + $Dq 'Terms: all/any/string author/title/lines/thread words match code
D.dwData = 0 'not used
D.lpData = VarPtr(sData) 'pointer to the string
D.cbData = Len(sData) + 1 'length of the string
SendMessage hFound, %WM_CopyData, hDlg, VarPtr(D)
End Sub
Function EnumCallback (ByVal hWnd As Long, lParam As Long) As Long
Local szText As WStringZ * %Max_Path
GetWindowText(hWnd, szText, SizeOf(szText))
Function = 1
If Left$(szText,9) = "gbThreads" Then hFound = hWnd : Function = 0
End Function
http://www.garybeene.com/sw/gbsnippets.htm