sendmessage???
-
Hi
Ich hab da so nen Auftrag bekommen während meines Praktikums und zwar soll ich zwei Programme schreiben, die untereinander kommunizieren sollen und dazu die Befehle sendmessage und postmessage verwenden.
Ich bin nun seit einem Jahr mit C/c++ in der Schule zugange, und so weit sind wir da natürlich nicht gekommen.
in den Büchern die ich hier habe, finde ich darüber gar nichts. Google gibt zwar ne Menge dazu aus, aber wirklich detailiert erklärt find ich da auch nichts wirkliches.
Wäre echt Klasse, wenn irgendjmd hier Helfen könnte oder sogar n anschauliches Beispiel für mich hat.
mfg
PhoenixONE
-
Was für ein System?
(SendMessage()/PostMessage() klingt entweder nach WinAPI oder MFC - in beiden Fällen solltest du in der MSDN die nötigen Infos finden)
-
naja also bis jetzt war alles was ich gemacht hab mit Win32 Konsolenanwendung ...
Ich hab ganz ehrlich keinen Plan ob netsend/Postsend da irgendwie reinpassen
-
msdn:
SendMessage The SendMessage function sends the specified message to a window or windows. The function calls the window procedure for the specified window and does not return until the window procedure has processed the message. The PostMessage function, in contrast, posts a message to a thread's message queue and returns immediately. LRESULT SendMessage( HWND hWnd, // handle of destination window UINT Msg, // message to send WPARAM wParam, // first message parameter LPARAM lParam // second message parameter ); Parameters hWnd Handle to the window whose window procedure will receive the message. If this parameter is HWND_BROADCAST, the message is sent to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not sent to child windows. Msg Specifies the message to be sent. wParam Specifies additional message-specific information. lParam Specifies additional message-specific information. Return Values The return value specifies the result of the message processing and depends on the message sent. Remarks Applications that need to communicate using HWND_BROADCAST should use the RegisterWindowMessage function to obtain a unique message for inter-application communication. If the specified window was created by the calling thread, the window procedure is called immediately as a subroutine. If the specified window was created by a different thread, the system switches to that thread and calls the appropriate window procedure. Messages sent between threads are processed only when the receiving thread executes message retrieval code. The sending thread is blocked until the receiving thread processes the message.
[cpp
PostMessage
The PostMessage function places (posts) a message in the message queue associated with the thread that created the specified window and then returns without waiting for the thread to process the message. Messages in a message queue are retrieved by calls to the GetMessage or PeekMessage function.BOOL PostMessage(
HWND hWnd, // handle of destination window
UINT Msg, // message to post
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);Parameters
hWnd
Handle to the window whose window procedure is to receive the message. Two values have special meanings: Value Meaning
HWND_BROADCAST The message is posted to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows. The message is not posted to child windows.
NULL The function behaves like a call to PostThreadMessage with the dwThreadId parameter set to the identifier of the current thread.Msg
Specifies the message to be posted.
wParam
Specifies additional message-specific information.
lParam
Specifies additional message-specific information.
Return Values
If the function succeeds, the return value is nonzero.If the function fails, the return value is zero. To get extended error information, callGetLastError.
Remarks
Applications that need to communicate using HWND_BROADCAST should use the RegisterWindowMessage function to obtain a unique message for inter-application communication.If you send a message in the range below WM_USER to the asynchronous message functions (PostMessage, SendNotifyMessage, and SendMessageCallback), its message parameters can not include pointers. Otherwise, the operation will fail. The functions will return before the receiving thread has had a chance to process the message and the sender will free the memory before it is used.
[/cpp]
-
Dieser Thread wurde von Moderator/in CStoll aus dem Forum C++ in das Forum WinAPI verschoben.
Im Zweifelsfall bitte auch folgende Hinweise beachten:
C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?Dieses Posting wurde automatisch erzeugt.
-
da das ganze jetzt verschoben wurde, kann ich davon ausgehen dass ich mit der Win 32 Konsolenanwendung nicht weit komme oder seh ich da was falsch?
-
Ja, vermutlich - diese Message-Behandlung ist eher auf WinAPI-Ebene zu suchen.
(btw, du solltest dir mal die Abschnitte durchlesen, die "msdn" hier gepostet hat ;))
-
CStoll schrieb:
(btw, du solltest dir mal die Abschnitte durchlesen, die "msdn" hier gepostet hat ;))
ja ich such mir ma jmd der das für mich übersetzt
dazu kommt dann noch, dass ich in diesem Fall KEINE AHNUNG hab wie ich vorgehen soll, weil ich bisher nur Win32-Konsolenanwendung gemacht habe (in der Schule hatten wir leider bisher nicht mehr.
kann mir vllt irgendjemand dann noch gute Lektüre für sowas empfehlen? also Analoge Lektüre, wo sich das "scrollen" noch "Blättern" nennt? und wo man nur bei Dunkelheit Strom für Beleuchtung benötigt?
-
-
also ich würde fast vermuten, dass du keine konsolenanwedungen schreiben sollst.
in dem fall solltest du erstmal mit den grundlagen von windows anfangen,
winapi:
http://www.win-api.de/
http://www.willemer.de/informatik/windows/winprg.htmoder wenn du vc++ hast:
http://www.elektronikschule.de/~amann/visualc/i_vcroot.html
http://home.wtal.de/ranzurmall/visualc/mfg
Schandi
-
Okay, danke an alle die sich hier beteiligt haben.
ich probier mich ma daran, den Kurs auf der Seite von Elektroschule.de durchzuführen und das Buch ist auch bestellt.
Danke für eure Hilfe