Click here to Skip to main content
15,905,136 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to Place a Different Caption in the AfxMessageBox(,) MFC messagebox Pin
Larry Mills Sr7-Aug-09 8:22
Larry Mills Sr7-Aug-09 8:22 
QuestionSendInput API is a mess indeed Pin
Madhu_Rani7-Aug-09 4:39
Madhu_Rani7-Aug-09 4:39 
AnswerRe: SendInput API is a mess indeed Pin
jeron17-Aug-09 4:44
jeron17-Aug-09 4:44 
GeneralRe: SendInput API is a mess indeed Pin
Madhu_Rani7-Aug-09 4:53
Madhu_Rani7-Aug-09 4:53 
QuestionCMapStringToOb works slow Pin
rkata7-Aug-09 3:29
rkata7-Aug-09 3:29 
QuestionHelp with custom message broadcasting(Inter process communication) Pin
callousfantom7-Aug-09 2:16
callousfantom7-Aug-09 2:16 
AnswerRe: Help with custom message broadcasting(Inter process communication) Pin
«_Superman_»7-Aug-09 2:32
professional«_Superman_»7-Aug-09 2:32 
GeneralRe: Help with custom message broadcasting(Inter process communication) [modified] Pin
callousfantom9-Aug-09 20:56
callousfantom9-Aug-09 20:56 
Well, here's the thing.
1.I'm able to communicate from the app. to the service using the ControlService function but not the other way around.

2.You say that it is only valid for a session. But as you can see I've used RegisterWindowMessage in the service as well as app.(to get the same SYSTEMWIDE unique -that's what msdn says- value for my message both inside the service and the app.) So if the app is reloaded from another user's context the app will gather the value of the message again.

3.I've even had the values displayed in both my service and app and they are the same. Thus the message is definitely unique and visible to both.

4.I even printed a log of all the messages recvd by wndproc of the app but the broadcasted msg never reaches the wndproc despite being successfully broadcasted from the service.

As for your idea of using named events, I did that and again the same issue was encountered. The service says that the event was set but the application never captures the event. Just to confirm, while using CreateEvent I still do need to follow the escaping conventions right? i.e I used CreateEvent(NULL,0,0,"Global\\my_message") in the service and
CreateEvent(Nothing,0,0,"Global\my_message") in the app.(since vb.net doesn't need to escape backslash)

Here's the code:
HANDLE MY_EVENT=CreateEvent(NULL,false,false,"Global\\my_message");
SetEvent(MY_EVENT);


In vb.net:
Const SYNCHRONIZE As Integer = &H100000L
Dim MY_EVENT As Integer
Private Declare Function OpenEvent Lib "kernel32" Alias "OpenEventA" (ByVal dwDesiredAccess As Long, ByVal inheritHandle As Integer, ByVal lpName As String) As Integer
Private Declare Function WaitForSingleObject Lib "kernel32" Alias "WaitForSingleObject" (ByVal hHandle As Integer, ByVal dwMilliseconds As Integer) As Integer
Sub New()
InitializeComponent()
Me.TopLevel = True
Try
my_event_thread = New Thread(AddressOf MyEventWatcher)
Catch ex As Exception
MsgBox("Error in initializing! " + ex.Message)
Application.Exit()
End Try
End Sub
Private Sub MyEventWatcher()
Try
MY_EVENT = OpenEvent(SYNCHRONIZE, 1, "Global\my_message")
While True
WaitForSingleObject(MY_EVENT, INFINITE)
MsgBox("Done")
End While
Catch ex As Exception
MsgBox("Exception:" + ex.Message)
End Try
End Sub

What should I do now?Any ideas?Confused | :confused: Thanks for the help!

modified on Monday, August 10, 2009 3:22 AM

GeneralRe: Help with custom message broadcasting(Inter process communication) Pin
callousfantom9-Aug-09 23:27
callousfantom9-Aug-09 23:27 
GeneralRe: Help with custom message broadcasting(Inter process communication) Pin
«_Superman_»10-Aug-09 3:59
professional«_Superman_»10-Aug-09 3:59 
GeneralRe: Help with custom message broadcasting(Inter process communication) Pin
callousfantom10-Aug-09 18:05
callousfantom10-Aug-09 18:05 
Questionhow to create a file shared among all users Pin
Joseph Marzbani7-Aug-09 2:03
Joseph Marzbani7-Aug-09 2:03 
AnswerRe: how to create a file shared among all users Pin
CPallini7-Aug-09 2:15
mveCPallini7-Aug-09 2:15 
GeneralRe: how to create a file shared among all users Pin
Joseph Marzbani7-Aug-09 2:24
Joseph Marzbani7-Aug-09 2:24 
GeneralRe: how to create a file shared among all users Pin
CPallini7-Aug-09 2:33
mveCPallini7-Aug-09 2:33 
GeneralRe: how to create a file shared among all users Pin
Omri1217-Aug-09 5:32
Omri1217-Aug-09 5:32 
QuestionRe: how to create a file shared among all users Pin
David Crow7-Aug-09 3:09
David Crow7-Aug-09 3:09 
QuestionReading Simplified Chinese String. [modified] Pin
gothic_coder6-Aug-09 21:23
gothic_coder6-Aug-09 21:23 
AnswerRe: Reading Simplified Chinese String. Pin
sashoalm6-Aug-09 22:04
sashoalm6-Aug-09 22:04 
GeneralRe: Reading Simplified Chinese String. Pin
gothic_coder6-Aug-09 22:32
gothic_coder6-Aug-09 22:32 
GeneralRe: Reading Simplified Chinese String. Pin
sashoalm6-Aug-09 23:22
sashoalm6-Aug-09 23:22 
GeneralRe: Reading Simplified Chinese String. Pin
gothic_coder6-Aug-09 23:48
gothic_coder6-Aug-09 23:48 
GeneralRe: Reading Simplified Chinese String. Pin
sashoalm7-Aug-09 0:14
sashoalm7-Aug-09 0:14 
GeneralRe: Reading Simplified Chinese String. Pin
Adam Roderick J7-Aug-09 0:50
Adam Roderick J7-Aug-09 0:50 
GeneralRe: Reading Simplified Chinese String. Pin
sashoalm7-Aug-09 1:27
sashoalm7-Aug-09 1:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.