Click here to Skip to main content
Click here to Skip to main content

INTER PROCESS COMMUNICATION USING REGISTERMESSAGE and POSTMESSAGE

, 22 Jun 2006
Rate this:
Please Sign up or sign in to vote.
IPC using custom windows messanging by win32 api

Introduction




Hi actually i'm not that professional to submit a material, but as our need arises we
do search for program snaps. I have used many programs and studied them.This program 
basically is the small part of what i was required to do.But i found this as a small 
and easy programm to start with.

 This is actually all about windows messanging. While performing a task there arose a 
 need to develop the application that interact with the other application. This is the
 extract that you'd like to see.

<FONT COLOR=black>
the easiest steps for interprocess communication are:--

application one:-

1) declare similar message and register it
2) make an identification of it self so that other application can search that.
using...
        Dim Params As CreateParams = New CreateParams
        Params.Caption = <caption goes here>
        Me.CreateHandle(Params)
3) use wndproc method to listen pre-registered windows message and act accordingly

application two:-

1) declare windows message.
2) Register windows message
3) find window (params used here) to which message are to be issued(actually to windows 

message queue)
4) post message using postmessage windows command
</FONT>
<P>
<CODE>
the basic windows api used -

    Private Declare Function RegisterWindowMessage Lib "user32" Alias _       "RegisterWindowMessageA" _
(ByVal lpString As String) As IntPtr
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr

Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" _
(ByVal hwnd As IntPtr, ByVal wMsg As IntPtr, ByVal wParam As Integer, _
ByVal lParam As Integer) As IntPtr
</CODE>

the constructor -
<CODE>
    Public Sub New()
        '''''Creating Window based on globally known name, and create handle
        '''''so we can start listening to Window Messages.
        Dim Params As CreateParams = New CreateParams
        Params.Caption = GLOBAL_IDENTITY_ONE
        Me.CreateHandle(Params)
    End Sub
</CODE>




My special thanks to  minja whos post is really helpful.
Your comments and questions are invited.
</P>




</P>

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

K edar V
Engineer
India India
Kedar Vaijanapurkar
theghost_k8@yahoo.com

Comments and Discussions

 
Generalhelpful PinmemberJarw AI19-Oct-06 4:56 
GeneralRe: helpful PinmemberKedar V19-Oct-06 19:26 
Generallooks Pinmemberchix_v29-Jun-06 1:08 
GeneralRe: looks PinmemberKedar V4-Jul-06 19:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.141015.1 | Last Updated 22 Jun 2006
Article Copyright 2006 by K edar V
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid