473,395 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Need to be able to receive WM_COPYDATA messages in VC.NET.

I am new to .NET and trying to convert some existing code to .NET. The
application that is giving be problems is one that receives status messages
from a device via WM_COPYDATA messages and logs, and/or acts upon them.

In MFC this was easy, but I can't seem to figure out how to set up the
handler in .NET. It should be simple but I am obviously missing something.

Can anyone tell me how to set up a function to receive the messages. Once
I have the pointer to the COPYDATASTRUCT I'm ok.

I think a fragment showing how to declare the function properly is all I
need, or just point to some documentation.

Thanks in advance,
Fred.
Nov 22 '05 #1
4 1688
Can anyone tell me how to set up a function to receive the messages.


Just override the WndProc method of a form or control.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 22 '05 #2
Mattias Sjögren <ma********************@mvps.org> wrote in
news:Os**************@TK2MSFTNGP09.phx.gbl:
Can anyone tell me how to set up a function to receive the messages.


Just override the WndProc method of a form or control.

Mattias


Could you be just a little more specific?

I had gotten some bad info that me going in the wrong direction for a
while. I almost have it figured out, but I am having a little problem
with the reinterpret_cast in the fragment below.

I am new to .NET and really struggling with silly syntax problems. The
biggest problem is a lot of abstract reference material in the
documentation but no actual syntactical examples. Before you get
excited, I know there are a lot of examples in MSDN, but most are fairly
simplistic and I have not found any that addresses this topic.
protected: void WndProc(Message* m)
{
if (m->Msg == WM_COPYDATA)
{
COPYDATASTRUCT* CopyData = reinterpret_cast
<COPYDATASTRUCT*> (m->LParam);
int DataType = CopyData->dwData;
int DataSize = CopyData->cbData;
switch (DataType)
...
}
}
else
__super::WndProc(m);
}
Nov 22 '05 #3
Fred,
I had gotten some bad info that me going in the wrong direction for a
while. I almost have it figured out, but I am having a little problem
with the reinterpret_cast in the fragment below. [...] COPYDATASTRUCT* CopyData = reinterpret_cast
<COPYDATASTRUCT*> (m->LParam);


Try replacing m->LParam with m->LParam.ToPointer()


Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 22 '05 #4
Mattias Sjögren <ma********************@mvps.org> wrote in news:eag1Tn
$K********@TK2MSFTNGP14.phx.gbl:
Fred,
I had gotten some bad info that me going in the wrong direction for a
while. I almost have it figured out, but I am having a little problem
with the reinterpret_cast in the fragment below.

[...]
COPYDATASTRUCT* CopyData = reinterpret_cast
<COPYDATASTRUCT*> (m->LParam);


Try replacing m->LParam with m->LParam.ToPointer()


Mattias


Thanks,

I had figured that out shortly after posting that last message.
This transition is very frustrating, my ming is going at 100MPH, but I have
to constantly stop for these frustrating syntax problems. I think one of
the problems, is that I am jumping into the deep end of the pool first.

Anyhow, thanks for the response.

Fred.
Nov 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Frank Bechmann | last post by:
I started to write a SciTe director in python. I had a very basic communication running in Pythonwin but I disliked the strong mixture between Pythonwin's basic functionality and the Pythonwin...
4
by: Fred Hebert | last post by:
I am new to .NET and trying to convert some existing code to .NET. The application that is giving be problems is one that receives status messages from a device via WM_COPYDATA messages and logs,...
4
by: Morten Overgaard | last post by:
Hi I'm listening on the SysLog port (514) through UDP. The problem is that I am not receiving anything nut I know that i get messages on the port. When I use KIWI to listen on the same port via...
1
by: Saso Zagoranski | last post by:
Hi! I have simple client/server game that uses sockets to transfer different messages. The server and the client are running on the same machine.
3
by: **** KiteOregon **** | last post by:
How do i receive a wm_copydata message from a third party application? I can't seem to get the data or the message at all in my vb.net application, what do i need to do. thanks -- Just...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
1
by: Thomas Kehl | last post by:
Hello. I use the fallowing Functions to send Message from one Application to another. This is working correct on a 32bit System. But on a 64Bit System, the Target-Application will no received...
1
by: d-42 | last post by:
Hi, I'm pretty sure I've just got a Marshalling problem, but I'm completely stumped. If there is a better newsgroup to post this in, please point me towards it. First I'm trying to use...
1
by: xMetalDetectorx | last post by:
I have two C# Applications. The first application has to send 2 strings to the other application. The first string is just a simple string "abc", while the 2nd string contains a path...
0
by: dantz | last post by:
Hi everyone, I am trying to combine WM_COPYDATA and Serialization. I am converting an object into string using Serialization then pass that string as the LParam of my COPYDATASTRUCT. I can...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.