473,325 Members | 2,828 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,325 software developers and data experts.

Passing objects in windows messages

Nak
Hi there,

I was wondering if it was possible to pass objects in windows messages,
obviously via pointers I would presume, but I can't quite work out how to
turn an object into a pointer in VB.NET, if it is even possible of course?!?
Anyway, if anyone knows a way of doing this I would be most appreciative of
some advice, thanks yet again in advance!

Nick.
Nov 20 '05 #1
6 1304
* "Nak" <a@a.com> scripsit:
I was wondering if it was possible to pass objects in windows messages,
obviously via pointers I would presume, but I can't quite work out how to
turn an object into a pointer in VB.NET, if it is even possible of course?!?
Anyway, if anyone knows a way of doing this I would be most appreciative of
some advice, thanks yet again in advance!


I am just interested why you need this functionality.

BTW: What you are looking for should be possible with
limitations using the 'System.Runtime.InteropServices.Marshal'
class and structures that hold data.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
Nak
Hi Herfried,

Why would I need this functionality? Because I am creating an object
that simplifies interprocess communication and enables the host to define a
custom protocol, my idea is that I shall be able to create a debugging
service for my applications as well as other things. I have used remoting
on a previous occasion, but I think this might be overkill and possibly
slower? I'm slightly fed up with my applications existing in a state of
blindness, I think this will be quite good, I have everything working
"spot-on" now, and thought it might be quite nice to be able to pass more
complex objects like strings and arrays. I hope this clarifies things a
little, cheers mate, I shall check out the Marshal namespace as you suggest.

Nick.

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eV**************@TK2MSFTNGP10.phx.gbl...
* "Nak" <a@a.com> scripsit:
I was wondering if it was possible to pass objects in windows messages,
obviously via pointers I would presume, but I can't quite work out how to turn an object into a pointer in VB.NET, if it is even possible of course?!? Anyway, if anyone knows a way of doing this I would be most appreciative of some advice, thanks yet again in advance!


I am just interested why you need this functionality.

BTW: What you are looking for should be possible with
limitations using the 'System.Runtime.InteropServices.Marshal'
class and structures that hold data.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #3
Nak
Oh dear, tell a lie, it seems to be working when sending structures to the
same process, but when it comes to sending structures to another process
they come out garbled. The values are all wrong, any idea why this would
be?

Also, this might sound silly as well, but sometimes if I send "too many"
messages the application quits without exception, even if the messages are
handled and a value is returned using ReplyMessage. I must be doing
something very wrong because surely you can't send so many messsages to a
window that it crashes, or can you? Isn't that the point of blocking the
thread until a value is returned?

Nick.

"Nak" <a@a.com> wrote in message
news:uR**************@tk2msftngp13.phx.gbl...
Okie dokie, so I am sending Structures okay now, which is pretty handy,
cheers for the info!

Nick.

"Nak" <a@a.com> wrote in message
news:um**************@TK2MSFTNGP11.phx.gbl...
Hi Herfried,

Why would I need this functionality? Because I am creating an object
that simplifies interprocess communication and enables the host to define
a
custom protocol, my idea is that I shall be able to create a debugging
service for my applications as well as other things. I have used

remoting on a previous occasion, but I think this might be overkill and possibly
slower? I'm slightly fed up with my applications existing in a state of
blindness, I think this will be quite good, I have everything working
"spot-on" now, and thought it might be quite nice to be able to pass more complex objects like strings and arrays. I hope this clarifies things a
little, cheers mate, I shall check out the Marshal namespace as you

suggest.

Nick.

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eV**************@TK2MSFTNGP10.phx.gbl...
* "Nak" <a@a.com> scripsit:
> I was wondering if it was possible to pass objects in windows messages, > obviously via pointers I would presume, but I can't quite work out

how to
> turn an object into a pointer in VB.NET, if it is even possible of

course?!?
> Anyway, if anyone knows a way of doing this I would be most

appreciative
of
> some advice, thanks yet again in advance!

I am just interested why you need this functionality.

BTW: What you are looking for should be possible with
limitations using the 'System.Runtime.InteropServices.Marshal'
class and structures that hold data.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>



Nov 20 '05 #4
I think that is called serialization and deserialization.

"Nak" <a@a.com> wrote in message
news:e3**************@tk2msftngp13.phx.gbl...
Hi there,

I was wondering if it was possible to pass objects in windows messages, obviously via pointers I would presume, but I can't quite work out how to
turn an object into a pointer in VB.NET, if it is even possible of course?!? Anyway, if anyone knows a way of doing this I would be most appreciative of some advice, thanks yet again in advance!

Nick.

Nov 20 '05 #5
Nak
Hi Gavin,

Hmm, I hadn't thought of it like that, so storing a string in memory
that contains the XML serialized data for a class and passing the pointer to
that is your suggestion? I shall have to give it a whirl if poss. Cheers
for the idea.

Nick.

"Gavin Jacobs" <no********@inhell.net> wrote in message
news:uv**************@TK2MSFTNGP11.phx.gbl...
I think that is called serialization and deserialization.

"Nak" <a@a.com> wrote in message
news:e3**************@tk2msftngp13.phx.gbl...
Hi there,

I was wondering if it was possible to pass objects in windows

messages,
obviously via pointers I would presume, but I can't quite work out how to turn an object into a pointer in VB.NET, if it is even possible of

course?!?
Anyway, if anyone knows a way of doing this I would be most appreciative

of
some advice, thanks yet again in advance!

Nick.


Nov 20 '05 #6
Hi Nick,

In windows NT world, every process has its own process space. That is to
say, certain memory address valid in process A will be invalid in process
B, so when you use sendmessge to send a point of certain memory to another
process the another process will cause problem.
For send data to another process, you may take a look at the WM_COPYDATA
message
http://msdn.microsoft.com/library/de...us/winui/winui
/windowsuserinterface/dataexchange/datacopy/datacopyreference/datacopymessag
es/wm_copydata.asp

If you will pass large object to another process, I suggest you use the
filemapping.
Creating Named Shared Memory
http://msdn.microsoft.com/library/de...us/fileio/base
/creating_named_shared_memory.asp

Choosing Communication Options in .NET
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconchoosingcommunicationoptionsinnet.asp

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #7

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

Similar topics

7
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID...
6
by: Scott Zabolotzky | last post by:
I'm trying to pass a custom object back and forth between forms. This custom object is pulled into the app using an external reference to an assembly DLL that was given to me by a co-worker. A...
10
by: Stan | last post by:
There are two ways to pass structured data to a web service: xml === <Order OrderId="123" OrderAmount="234" /> or class =====
3
by: Rune Jacobsen | last post by:
Hi all, I am working on my single instance application that now also has a URL type associated with it, according to the Asynchronous Pluggable Protocols information from MSDN. Now, if my...
4
by: Vysakh P Pillai | last post by:
This is my 1st year B-tech Seminar topic.Can anyone plaese give me someone please give me some points for this????
9
by: jdlists | last post by:
I have inheirted some existing code, that i will explain in a moment, have needed to extend and ultimately should be able to run in threads. I've done a bunch of work with python but very little...
2
by: Hakan Örnek | last post by:
Hi , I want to parameter passing to my windows sevice. I call service commands like this ; '------------------------------------------------------------ Dim sc As ServiceController sc = New...
5
by: wshaer | last post by:
Hi This is the task: and these are my classes: public class Engine{ // Declare the varibles
0
by: AAaron123 | last post by:
On a Form I have a RichTextBox. I do the call for EM_SETEVENTMASK with ENM_REQUESTRESIZE The user control's WndProc writes to the consol to keep track of any EN_REQUESTRESIZE messages. As...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.