Hi to every body,
I am reading this forum since about two weeks, this forum has solved a lot of question that i had, thank to every body.
I have a question about messages (WM_PAINT, etc...) in a no window object.
I am programming in C#.
I have an application which is yet developed, i can´t change it. This application have a communication funtionality, you can send a private message with SendMessage and when the application process this petition it respond to your window.
You can say to the application with number of message and to what window it must respond through a share memory.
Now i am programing a application that must can manage several instances of this application.
I am programing one object which wrappe all the funtionality of the communication with one instance of the application. I have the problem that when i have several instances, each one respond to my application window, but i need that each one respond to a specific object. I don´t want to manage all the message in other piece of code, i want manage the respond in the object which control the comunication. I am saing that i can´t config that each instance of the application have one number of message to answer to my application and control the respond in the main window.
I was thinking and i want know how do two things:
1.- Create threads with a message queue, and says to the application that answer to this queue.
or
2.- Asociate the object that manage the application to a control and try that this application answer to this control.
Thank to all.
Best regards.
PD: sorry for my english.
4 1167
hello, here i am again.
I just do that the object manager inherit from System.Windows. Form.Control, and now my class can recive windows messages.
The proble is resolve but... not all the question are answer. ¿How can i have a thread with a message queue?
Thanks to all
Plater 7,872
Recognized Expert Expert
There is an object called Queue (I think it's System.Collecti ons.Specialized .Queue ?)
On one thread you listen for messages and when a message is received you can push it onto the queue.
Your other thread can be pulling messages off the Queue and responding to them?
There is an object called Queue (I think it's System.Collecti ons.Specialized .Queue ?)
On one thread you listen for messages and when a message is received you can push it onto the queue.
Your other thread can be pulling messages off the Queue and responding to them?
The problem isn´t comunicate two threads with a queue, the problem is have a thread to receive windows messages (or events) or user defined message send with the call to windows API SendMessage.
System.Collecti ons.Specialized .Queue doesn´t exists.
Plater 7,872
Recognized Expert Expert
Ok, well you said you had already figured out that you could inherit from Control and get at windows messages.
So what is the problem? Make a thread and have it respond to them then.
(Oh and I guess the object is System.Collecti ons.Queue)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: wang xiaoyu |
last post by:
Hello,everyone.
my program runs well in windows,i use tkSimpleDialog to receive some
input,but when i copy my program into Linux RH8.0,entrys in my
tkSimpleDialog derived Dialog have a vital problem:only one entry can
receive key event,'tab' key to navigate between entrys is not valid
too,when i use mouse to focus a entry(which can not navigate through
'tag' key),no matter what key i pressed the entry receive no reply.But
in window they...
|
by: Sven Groot |
last post by:
I have a Windows Service application that acts as if it's an SMTP server.
Outlook connects to this service, which is always running on the localhost.
This works fine most of the time.
However, sometimes it will no longer receive anything from Outlook.
Socket.Receive would block indefinitely (actually, Socket.Poll times out,
because that's what I'm using). Outlook sends it, because when I'm stepping
through the code with the debugger,...
|
by: Jason |
last post by:
Hi all
I have a little FTP proggie. It works, on windows xp, but it doesnt work
properly on windows 2000. The first problem i have, is when retrieving a
list of files.
int bytes = cSocket.Receive(buffer, buffer.Length, 0);
this.message += ASCII.GetString(buffer, 0, bytes);
bytes is returned as size 18, my buffer.Length is set at 512, but i only get
|
by: Dan Kelley |
last post by:
I have 2 projects - 1 Winform project that sends Udp messages using the
UdpClient class when a button is clicked, and a Console application that
listens for these Udp messages.
If I try to use the UdpClient class to receive, it never works. The messages
are never received (no exceptions). If I use a normal socket configured to
listen for Udp messages, it works perfectly.
Below is my sample code. It is only test code - I know the...
|
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.
| |
by: ransoma22 |
last post by:
I developing an application that receive SMS from a connected GSM
handphone, e.g Siemens M55, Nokia 6230,etc through the data cable.
The application(VB.NET) will receive the SMS automatically, process and
output to the screen in my application when a message arrived. But the
problem is how do I read the SMS message immediately when it arrived
without my handphone BeEPINg for new message ? I read up the AT
commands, but when getting down...
|
by: Hooyoo |
last post by:
Hello, guys.
In my application, I need to receive a windows message from another
window, and the other window is a MFC application using SendMessage to
send a custom windows message. So, in my c# application how can I
receive the message? (I know the message identifier in c#
application.)
Thanks.
|
by: iwasinnihon |
last post by:
I am writing a simple program to receive over http using windows
sockets. my program does fine receiving text files. But returns the
incorrect data when receiving image files. (The size of the files are
different). My code is below. The header has already been read using
the same Receive() function. What have I done wrong.
ofstream os("file.dat", ios::binary);
//Retrieve the body
try {
|
by: Joe Blauth |
last post by:
Hi all,
I am currently working on a small application that sends messages from a
client to a server and receives messages in return. Basically the
functionality is made with sockets which is working just fine except of one
little thing. whenever the client tries to receive a message the server has
sent it goes into a hang. unfortunately without an error or exception at
all.
the communication itself (sending message from client to...
|
by: =?Utf-8?B?UmFqbmk=?= |
last post by:
Dear William Stacey,
I have written a server code using the Windows Socket API's. Wherein I have
created the socket and bound it to a particular IP address and port number.
Later I have made the socket in non-blocking mode by using the proper socket
option ( i.e. SO_RCVTIMEO). After which with the use of recv() I am trying to
get into the receive mode. Here as the receive time out is being used the
socket should come out of the block...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |