Results 1 to 15 of 15

Thread: Interfacing Applications

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2002
    Posts
    26

    Interfacing Applications

    . . . . . I know there's a way to let two VB applications communicate with each other. I would like to find out how to have an interface where one application sends text commands to another application (not online, on the same machine) so that the receiving application can interpret those commands and act accordingly.

    . . . . . A little background: I run an online game called 'Dragon's Era'. It's a wonderfully large game I've been programming for the past two years of my life like a part-time job. The server can cramp up at times and it's usually very laggy. The command structure I have installed in the server is subject to that same lag, so when I need to execute a series of commands quickly I cannot do it.
    . . . . . If I can build a seperate application which interfaces with the server on the same machine I could move my entire server control panel to that application and operate the server without any lag. The only real lag would be the delay in processing the text commands rather than a delay in operating and entering the commands. This would be very helpful for me.

    . . . . . I've been searching for a way to do this. Could anyone tell me the basics or at least give me the correct topic to look under? I have heard Active X would be useful, but I'm not sure how to use it for that specific function. I appreciate any help. Thanks,

    -RLore18 (http://www.dragonsera.com/)

    PS - I hate not being able to indent my paragraphs. I have to resort to using periods.
    ~~~RLore18

  2. #2
    Frenzied Member KayJay's Avatar
    Join Date
    Jul 2001
    Location
    Chennai
    Posts
    1,849
    ActiveX would be very useful here. Are both your apps in VB?

    That is the server and the second app you are planning to write?

    "Brothers, you asked for it."
    ...Francisco Domingo Carlos Andres Sebastian D'Anconia

  3. #3
    Frenzied Member KayJay's Avatar
    Join Date
    Jul 2001
    Location
    Chennai
    Posts
    1,849
    sorry! missed reading your first line

    "Brothers, you asked for it."
    ...Francisco Domingo Carlos Andres Sebastian D'Anconia

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Feb 2002
    Posts
    26
    . . . . . Well, all I need is a simple interface which would send text commands one-way. I have only the server which runs from the compiler as it's still in Beta and under heavy developement. I haven't create the control application.

    . . . . . Would I create the control application as an ActiveX control or would it be a seperate application with a custom-made ActiveX control used as the interface? If you can't already tell I've never programmed with ActiveX before.

    . . . . . Thanks,

    -Ron
    ~~~RLore18

  5. #5
    Frenzied Member KayJay's Avatar
    Join Date
    Jul 2001
    Location
    Chennai
    Posts
    1,849
    Since you have not programmed ur Server APP as an ActiveX server, re-programming might be a hassle.

    I am trying out a sample "SendMessage" & "GetMessage" scenario using API. I'll post it soon

    "Brothers, you asked for it."
    ...Francisco Domingo Carlos Andres Sebastian D'Anconia

  6. #6
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780
    I can see a very good use for Pipes here.

    Create a pipe between the two programs, and you can send data streams between them. (buy yourself a copy of Dan Applemans Guide to the Win32 API, best book ever made for VB).

    Or you could add an IP server and port to the app and controller and control it via IP.

  7. #7
    Frenzied Member MerrionComputin's Avatar
    Join Date
    Apr 2001
    Location
    Dublin, Ireland
    Posts
    1,616
    ----8<---------------------------------------
    NEW - The .NET printer queue monitor component
    ----8<---------------------------------------
    Now with Examples of use

  8. #8
    Frenzied Member KayJay's Avatar
    Join Date
    Jul 2001
    Location
    Chennai
    Posts
    1,849
    Just checked that link. Good Tut.

    One question:

    How can one send Strings to be processed? One can do a Select Case..End Select and Hard-Code the results.

    But if one wants to to send a custom message like "APP2, Do This" how would that string's contents be passed? All the parameters I see are "Long".

    "Brothers, you asked for it."
    ...Francisco Domingo Carlos Andres Sebastian D'Anconia

  9. #9
    Frenzied Member KayJay's Avatar
    Join Date
    Jul 2001
    Location
    Chennai
    Posts
    1,849
    One way I have implemented string data transfer between process is attached.

    Both the Client App and the Server App register a common "WM_MyControlAPP" message and a pointer to a string variable's memory pointer is passed as the LPARAM to a SendMessage call from the Client APP.

    The Server APP receives the Message, opens the process of the Client APP and reads the process's memory at the recieved LPARAM pointer.

    One advantage is that since only the pointer is passed, any object or data type can be read from the Client's memory space by the Server.
    Attached Files Attached Files

    "Brothers, you asked for it."
    ...Francisco Domingo Carlos Andres Sebastian D'Anconia

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Feb 2002
    Posts
    26

    Thanks!

    Excellent, thank you very much! I think this should work very well. I'll begin working on it soon.

    Thanks again,

    -RLore18
    ~~~RLore18

  11. #11
    Frenzied Member KayJay's Avatar
    Join Date
    Jul 2001
    Location
    Chennai
    Posts
    1,849
    Felt Bored. Made this up (If you have not already done something like this). Any number of strings can be sent now between apps with only one Message registered.
    Attached Files Attached Files

    "Brothers, you asked for it."
    ...Francisco Domingo Carlos Andres Sebastian D'Anconia

  12. #12

    Thread Starter
    Junior Member
    Join Date
    Feb 2002
    Posts
    26

    Excellent

    Thanks again! I'll use this to work on my server. Using this method is a LOT more secure than sending data through UDP or TCP/IP, although I would have used the latter if I had not know of this.
    ~~~RLore18

  13. #13

    Thread Starter
    Junior Member
    Join Date
    Feb 2002
    Posts
    26

    Upon Closer Examination...

    . . . . . Those applications are great and I've begun making the change, but I've realized that I'll need a source of data from the server provided to the client.

    . . . . . It's a list of players currently playing, and it's contained within a listbox on the server. Rather than setting up a two-way memory transfer, could it be done by somehow periodically copying the contents of the listbox on the server to a listbox on the command module? I need a visual aid to tell me which player I'm trying to operate with, and jumping between two maximized screens with the server lagged down to a couple seconds per refresh isn't feasible.

    . . . . . Is there a way to 'share' the listbox on the server with a listbox in another application, or to copy the contents periodically?
    ~~~RLore18

  14. #14
    Frenzied Member KayJay's Avatar
    Join Date
    Jul 2001
    Location
    Chennai
    Posts
    1,849
    Yes. But subclassing or hooking an external Process/Thread is not advisable in VB. Memory crashes are very likely. I suggest you use the same method to pass the ListBox's values to the Client App.

    "Brothers, you asked for it."
    ...Francisco Domingo Carlos Andres Sebastian D'Anconia

  15. #15

    Thread Starter
    Junior Member
    Join Date
    Feb 2002
    Posts
    26
    . . . . . Alright, thanks. I'm glad you told me about that...I wish someone had told me about how the winsock control leaked memory about a year ago or perhaps even before I started using it. It would have saved me about 200 crashes.

    . . . . . Thanks again!
    ~~~RLore18

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width