Click here to Skip to main content
15,902,635 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
QuestionProblems with VB6 Winsock connection and Senddata Pin
she-Developer20-Oct-09 4:58
she-Developer20-Oct-09 4:58 
AnswerRe: Problems with VB6 Winsock connection and Senddata Pin
dan!sh 20-Oct-09 7:20
professional dan!sh 20-Oct-09 7:20 
AnswerRe: Problems with VB6 Winsock connection and Senddata Pin
Eddy Vluggen20-Oct-09 10:50
professionalEddy Vluggen20-Oct-09 10:50 
GeneralRe: Problems with VB6 Winsock connection and Senddata Pin
she-Developer20-Oct-09 21:40
she-Developer20-Oct-09 21:40 
GeneralRe: Problems with VB6 Winsock connection and Senddata Pin
Eddy Vluggen20-Oct-09 22:45
professionalEddy Vluggen20-Oct-09 22:45 
AnswerRe: Problems with VB6 Winsock connection and Senddata [modified] Pin
MatthysDT21-Oct-09 20:33
MatthysDT21-Oct-09 20:33 
QuestionProblem serializing to SOAP when using System.Object [modified] Pin
annathor20-Oct-09 1:36
annathor20-Oct-09 1:36 
QuestionInterop Questions Pin
#realJSOP20-Oct-09 1:02
professional#realJSOP20-Oct-09 1:02 
VS2008 and DotNet 3.5 with SP/1, on a 64-bit machine:

I'm trying to use registered window messages to communicate between applications. All apps/components are compiled to x86.

Here's my interop stuff (in a class library):

namespace Utility
{
	public class WinAPI
	{
		public const string REGISTERED_MSG = "AllInOneDemo";
		
		[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
		public static extern uint RegisterWindowMessage(string lpString);

		[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
		public static extern int SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);

		public static int SendRegisteredMessage(uint message, int lParam, int wParam)
		{
			return SendMessage(IntPtr.Zero, message, lParam, wParam);
		}
	}
}


Here's my registering code:

private uint RegisteredMessage = WinAPI.RegisterWindowMessage(Globals.REGISTERED_MSG);


Here's my message sending code (the return value is always 0):

int result = WinAPI.SendRegisteredMessage(this.RegisteredMessage, 123, 456);


And finally, here's the message handling code:

protected override void WndProc(ref System.Windows.Forms.Message msg)
{
    base.WndProc(ref msg);
    if (msg.Msg == this.RegisteredMessage)
    {
        this.listBoxPublicMsg.Items.Add(string.Format("{0}\tLParam={0}\tWParam={1}", msg.Msg, msg.LParam, msg.WParam));
    }
}


One application registers/sends the message, and one application is supposed to register/receive the message. The message is being sent, but it's not being received.

I have verified that both apps are getting the same return value when calling RegisterWindowMessage. The sending app appears to be sending the message, but the receiving app never sees it.

I tried using Spy++(64-bit) to look only at the Registered messages for both apps, but I get nothing at all for either window.

What am I doing wrong?

.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

AnswerRe: Interop Questions Pin
NormDroid20-Oct-09 1:35
professionalNormDroid20-Oct-09 1:35 
GeneralRe: Interop Questions Pin
#realJSOP20-Oct-09 3:49
professional#realJSOP20-Oct-09 3:49 
AnswerRe: Interop Questions Pin
freakyit20-Oct-09 1:35
freakyit20-Oct-09 1:35 
AnswerRe: Interop Questions Pin
Richard MacCutchan20-Oct-09 1:36
mveRichard MacCutchan20-Oct-09 1:36 
QuestionOracle 10 g user id passwords Pin
manish.m.meshram19-Oct-09 18:30
manish.m.meshram19-Oct-09 18:30 
QuestionHow to get Default Mail Application name? (like microsoft office outlook) Pin
CeremBeyazit19-Oct-09 12:39
CeremBeyazit19-Oct-09 12:39 
AnswerRe: How to get Default Mail Application name? (like microsoft office outlook) Pin
N a v a n e e t h19-Oct-09 16:40
N a v a n e e t h19-Oct-09 16:40 
QuestionUnusual Problem: Listbox Not Updating Pin
raineym19-Oct-09 7:50
raineym19-Oct-09 7:50 
AnswerRe: Unusual Problem: Listbox Not Updating Pin
Luc Pattyn19-Oct-09 7:57
sitebuilderLuc Pattyn19-Oct-09 7:57 
GeneralRe: Unusual Problem: Listbox Not Updating [modified] Pin
raineym19-Oct-09 8:52
raineym19-Oct-09 8:52 
GeneralRe: Unusual Problem: Listbox Not Updating Pin
Luc Pattyn19-Oct-09 9:11
sitebuilderLuc Pattyn19-Oct-09 9:11 
GeneralRe: Unusual Problem: Listbox Not Updating Pin
raineym19-Oct-09 10:34
raineym19-Oct-09 10:34 
GeneralRe: Unusual Problem: Listbox Not Updating Pin
Luc Pattyn19-Oct-09 10:38
sitebuilderLuc Pattyn19-Oct-09 10:38 
NewsVisual Studio Beta 2 Available This Week, VS 2010 Launch Date Announced, New Packaging Revealed Pin
brucedkyle19-Oct-09 6:24
brucedkyle19-Oct-09 6:24 
QuestionCapture Screenshot of a Window(With Handle) Pin
Harrison Jones19-Oct-09 6:17
Harrison Jones19-Oct-09 6:17 
AnswerRe: Capture Screenshot of a Window(With Handle) Pin
Richard MacCutchan19-Oct-09 10:14
mveRichard MacCutchan19-Oct-09 10:14 
AnswerRe: Capture Screenshot of a Window(With Handle) Pin
Mark Salsbery19-Oct-09 11:19
Mark Salsbery19-Oct-09 11:19 

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.