Results 1 to 8 of 8

Thread: Raising Click event on another form.

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2000
    Posts
    32
    I know that this is a topic that has been posted here before, but I can't come up with anything on the search. Anyways, I have two forms in two seperate projects. I am trying to get one of them to raise a click event the other form at an exact location. Nothing I have tried seems to work yet.

    Here is my code:

    winHwnd = FindWindow(vbNullString, "Test Form")
    pos = 140000
    RetVal = SendMessage(winHwnd, WM_LBUTTONDOWN, pos, 1)
    RetVal = SendMessage(winHwnd, WM_LBUTTONUP, pos, 1)

    If I understand correctly the position is the y as Long in the upper 4 bytes, and the x as a Long in the lower 4 bytes.

    I have also tried using PostMessage instead of SendMessage.

    I know that I have the correct window because I have sent it a WM_CLOSE, and it shutdown, but I can't click.

    At the time that this is run, the form sending the message is the active form, and the other form is not even visible. Thanks in advance for any help.

  2. #2
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    I am not sure if this is what you are looking for but here it goes.

    In the other form, change the PRIVATE to PUBLIC. From your other form, use "CALL FORM2.Command1_CLICK".


    Don't remember who I learned this from but it works, if that is what you are looking for.
    Chemically Formulated As:
    Dr. Nitro

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2000
    Posts
    32
    The forms are in seperate projects. They will be compiled into two seperate exe. The only way I will be able to do it is through the API I think. Thanks though.


  4. #4
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    OK!

    In that case, you need a common median for the two executable to communicate with. I am not sure about this but why not put it into a dll and have the two program share the same function?

    Just a thought?

    Or put the code in the second form in an invisible command button and use the API SendMessageNum or something like that to press the button?

    Oh Well
    Chemically Formulated As:
    Dr. Nitro

  5. #5

    Thread Starter
    Member
    Join Date
    Mar 2000
    Posts
    32
    There isn't a button on this form, just an exact location that needs to be clicked. It is for work, and there is already a piece of software that was written and is compiled. I don't have the sources for the other app, but I need to automate the use of it. I couldn't find any info in the MSDN library about SendMessageNum. What exactly does it do differently than SendMessage. P.S. I am new to using the API, so I don't know what everything is, or how to use it.

  6. #6
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    In that case, my expertise does not stretch that far. I thought you have the source code for both project. I don't really think you can do anything unless there are menus or buttons you can send keys to.

    There are two other guys who might be able to answer your question is Serge or Generation X. Post this message with their name on it. They are usually on this site around night time.

    BTW... I meant SendMessage not SendMessageNum

    Good Luck.
    Chemically Formulated As:
    Dr. Nitro

  7. #7
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ottawa,ON,Canada
    Posts
    217
    What to you mean by "an exact location"?

    Either the Form itself needs to be clicked, or some type of control (like a CommandButton, Label, or TextBox).

    Or do mean specific text in a control, like a link?

    Sorry to be picky, but it means a big difference in the APIs that need to be used.

  8. #8

    Thread Starter
    Member
    Join Date
    Mar 2000
    Posts
    32
    I understand you being picky. What the other application is is a java applet, and everything that I would be clicking on would be buttons. The only thing I know about them is the locations of these buttons. I have no idea what the names of the buttons are in the code.

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