Click here to Skip to main content
15,891,248 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Sharing some humour Pin
Daniel Pfeffer3-Nov-16 3:34
professionalDaniel Pfeffer3-Nov-16 3:34 
GeneralRe: Sharing some humour Pin
leon de boer3-Nov-16 4:41
leon de boer3-Nov-16 4:41 
GeneralRe: Sharing some humour Pin
Randor 13-Nov-16 5:43
professional Randor 13-Nov-16 5:43 
QuestionSendMessage for Interprocess communication stops working Pin
ForNow1-Nov-16 15:29
ForNow1-Nov-16 15:29 
AnswerRe: SendMessage for Interprocess communication stops working Pin
Midi_Mick1-Nov-16 16:16
professionalMidi_Mick1-Nov-16 16:16 
GeneralRe: SendMessage for Interprocess communication stops working Pin
ForNow1-Nov-16 16:22
ForNow1-Nov-16 16:22 
GeneralRe: SendMessage for Interprocess communication stops working Pin
Midi_Mick1-Nov-16 17:36
professionalMidi_Mick1-Nov-16 17:36 
AnswerRe: SendMessage for Interprocess communication stops working Pin
Randor 1-Nov-16 17:56
professional Randor 1-Nov-16 17:56 
Hi,

ForNow wrote:
I have been using SendMessage for interprocess communication.


When you ask for help you should always mention the operating system.

Read the article section about deadlocks and make sure that you understand the dangers of using SendMessage for IPC. Also note that moving forward... all software engineers are encouraged to use the recommended/supported Microsoft Interprocess Communication mechanisms.

ForNow wrote:
and later tried RegisterWindowMessage


Are you checking that the return value of RegisterWindowMessage is not zero? Why did you ask for help but did not give the results of GetLastError()?

I recommend avoiding RegisterWindowMessage. Keep in mind that you can only obtain 16,384 RegisterWindowMessage unique identifiers. After that... there are no more system resources for globally unique messages.

Let's imagine that you are writing software to control an oil refinery system.
Maybe you are writing defense department mission critical software.
Perhaps an airplane requires your Windows component for operation.
Imagine if your writing the radar system for an ship out in the sea.

Maybe in these scenarios the operating system is mission critical and should never go down. In these scenarios it is important to avoid RegisterWindowMessage on these systems. Likewise system builders of mission critical software should perform accounting on all software utilizing RegisterWindowMessage.

ForNow wrote:
I orignally a WM_USER + X


Here you chose the wrong message integer range for IPC. Read this:
WM_USER = Used to define private messages for use by private window classes

Some possible solutions:
1.) Re-write your IPC and avoid the window message system.
2.) Check if your window message was filtered-out via UIPI. If so, utilize the ChangeWindowMessageFilterEx function to allow the message through.
3.) Use a hammer.

Hammer:
C++
BOOL YourClass::AttachInput(HWND hwnd, BOOL fAttach)
{
  DWORD dwThreadId = GetWindowThreadProcessId(hwnd, NULL);
  DWORD dwMyThread = GetCurrentThreadId();
  return AttachThreadInput(dwMyThread, dwThreadId, fAttach);
}


I don't recommend using the hammer. Your message was most likely filtered out.

Best Wishes,
-David Delaune
GeneralRe: SendMessage for Interprocess communication stops working Pin
ForNow2-Nov-16 13:59
ForNow2-Nov-16 13:59 
GeneralRe: SendMessage for Interprocess communication stops working Pin
Randor 2-Nov-16 16:42
professional Randor 2-Nov-16 16:42 
AnswerRe: SendMessage for Interprocess communication stops working Pin
leon de boer2-Nov-16 3:10
leon de boer2-Nov-16 3:10 
GeneralRe: SendMessage for Interprocess communication stops working Pin
ForNow2-Nov-16 14:32
ForNow2-Nov-16 14:32 
GeneralRe: SendMessage for Interprocess communication stops working Pin
leon de boer2-Nov-16 16:57
leon de boer2-Nov-16 16:57 
QuestionNeed help with cryptography Pin
SMD1111-Nov-16 8:54
SMD1111-Nov-16 8:54 
AnswerRe: Need help with cryptography Pin
Randor 1-Nov-16 19:04
professional Randor 1-Nov-16 19:04 
Question[C]Problem in creating a random string Pin
xXxRevolutionxXx27-Oct-16 1:31
xXxRevolutionxXx27-Oct-16 1:31 
AnswerRe: [C]Problem in creating a random string Pin
Richard MacCutchan27-Oct-16 1:46
mveRichard MacCutchan27-Oct-16 1:46 
GeneralRe: [C]Problem in creating a random string Pin
k505427-Oct-16 4:47
mvek505427-Oct-16 4:47 
GeneralRe: [C]Problem in creating a random string Pin
Richard MacCutchan27-Oct-16 4:55
mveRichard MacCutchan27-Oct-16 4:55 
AnswerRe: [C]Problem in creating a random string Pin
Jochen Arndt27-Oct-16 2:35
professionalJochen Arndt27-Oct-16 2:35 
AnswerRe: [C]Problem in creating a random string Pin
leon de boer27-Oct-16 3:43
leon de boer27-Oct-16 3:43 
SuggestionRe: [C]Problem in creating a random string Pin
David Crow27-Oct-16 4:48
David Crow27-Oct-16 4:48 
GeneralRe: [C]Problem in creating a random string Pin
Daniel Pfeffer27-Oct-16 5:11
professionalDaniel Pfeffer27-Oct-16 5:11 
AnswerRe: [C]Problem in creating a random string Pin
Krishnakumartg27-Oct-16 20:18
Krishnakumartg27-Oct-16 20:18 
GeneralRe: [C]Problem in creating a random string Pin
k505428-Oct-16 4:59
mvek505428-Oct-16 4:59 

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.