Win32 window messaging

Hi guys,

I need to catch some messaging from a windows application made in c++.

So the developer of that app (he’s no longer developing it) sent me this info:

I sent a string to a hidden window class for the RDF plugin which at the
time maintained backwards compatibility with them I think…

If you create a window you will receive a string… The window has to
present as

int hWnd = getWindowId(“RDFHiddenWindowClass”, “RDFHiddenWindow”);
result = sendWindowsStringMessage(hWnd, 0, callsignsString);

you will then receive a string separated by colons as follows

windowMessaging.SendReceivingCallsigns(string.Join(“:”,
e.ReceivingCallsigns));

if there are no receivingcallsigns at the time you will get a blank string
as such

windowMessaging.SendReceivingCallsigns(“”);

So how do I create such “window” in CW and get that message I want?

Thank you all

Bostjan

I suspect that getWindowId(“RDFHiddenWindowClass”, “RDFHiddenWindow”) finds the window with class name “RDFHiddenWindowClass” OR window text (title) “RDFHiddenWindow”, so you could create plain Clarion (hidden) window and inspect the messages receiving by this window.

Ok. But how do we do “getMessages” in cw window procedure that Windows are holding a messaging queue for?

Subclass it. I’ve always used SetWindowLong API call w/ GWL_WndProc parameter but newer version of Clarion may have a property to that kind of thing now. Then you need a 2nd procedure to catch all the window messages before the CW runtime does.

Search here on ClarionHub for subclass or prop:wndproc and you’ll find some examples.

1 Like

Most of my gdiplus examples use the subclassing.

2 Likes

Great! I will check it out to see if I understand the code.

Just checked: all examples use inherited from TCWnd class. This is a “client” window (prop:ClientHandle). In your case you must use host window (prop:Handle, TWnd class) as only the host window has the title (window text).

2 Likes

How do I set windowclass to a window? I think I got messaging subclass ready but I don’t know how to set window class. CW seems to set it as ClaWin01000000H_2

In c++, this is the code:
RegisterClass(&this->windowClass);

this->hiddenWindow = CreateWindow(
	"RDFHiddenWindowClass",
	"RDFHiddenWindow",
	NULL,
	0,
	0,
	0,
	0,
	NULL,
	NULL,
	GetModuleHandle(NULL),
	reinterpret_cast<LPVOID>(this)
);

Bostjan

Reread my reply, (probably) window title 'RDFHiddenWindow" is enough.

1 Like

I did. I changed the working c++ code where I change the class only hoping it would work with Windows name but it does not :frowning:

And this is the definition prior to CreateWindow in c++:

WNDCLASS windowClass = {
NULL,
HiddenWindow,
NULL,
NULL,
GetModuleHandle(NULL),
NULL,
NULL,
NULL,
NULL,
“ADFHiddenWindowClass”
};

If you have an access to c++ code, then change getWindowId function to ignore window class.

I have access to a cpp plugin dll code which is a target for something else, so i can use it for testing

I don’t have any code from the app that send messages unfortunately.

Ah I see, then you can play with CreateWindow api.

Haha, for you this is something to play with, for me it’s hard work with no certain results :slight_smile:

Yup, hard work must be done by someone else :slight_smile:

1 Like

That’s where the money comes in and levels it out :grin::sweat_smile: