OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: Seva Kaplunenko (seva.kaplunenkoCONDUCTUS.COM)
Date: Wed Nov 28 2001 - 13:10:37 CST

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    Not all messages allowed by OS to be send between different
    applications. You have to use
    ::PostMessage(HWND_BROADCAST,msg,wparam,lparam) and wait for similar
    reply from you target box.
    For messages allowed see help around WM_APP keyword. I tried to copy
    part of that help here. See also UINT RegisterWindowMessage(
      LPCTSTR lpString // message string
    );
    Seva

    The WM_APP constant is used by applications to help define private
    messages, usually of the form WM_APP+X, where X is an integer value.

    #define WM_APP 0x8000
    Remarks
    The WM_APP constant is used to distinguish between message values that
    are reserved for use by the system and values that can be used by an
    application to send messages within a private window class. The
    following are the ranges of message numbers available.

    Range Meaning
    0 through WM_USER - 1 Messages reserved for use by the system.
    WM_USER through 0x7FFF Integer messages for use by private window
    classes.
    WM_APP through 0xBFFF Messages available for use by applications.
    0xC000 through 0xFFFF String messages for use by applications.
    Greater than 0xFFFF Reserved by the system for future use.

    Message numbers in the first range (0 through WM_USER - 1) are defined
    by the system. Values in this range that are not explicitly defined are
    reserved for future use by the system.

    Message numbers in the second range (WM_USER through 0x7FFF) can be
    defined and used by an application to send messages within a private
    window class. These values cannot be used to define messages that are
    meaningful throughout an application, because some predefined window
    classes already define values in this range. For example, predefined
    control classes such as BUTTON, EDIT, LISTBOX, and COMBOBOX may use
    these values. Messages in this range should not be sent to other
    applications unless the applications have been designed to exchange
    messages and to attach the same meaning to the message numbers.

    Message numbers in the third range (0x8000 through 0xBFFF) are available
    for application to use as private messages. Message in this range do not
    conflict with system messages.

    Message numbers in the fourth range (0xC000 through 0xFFFF) are defined
    at run time when an application calls the RegisterWindowMessage function
    to retrieve a message number for a string. All applications that
    register the same string can use the associated message number for
    exchanging messages. The actual message number, however, is not a
    constant and cannot be assumed to be the same between different
    sessions.

    Message numbers in the fifth range (greater than 0xFFFF) are reserved
    for future use by the system.

    Requirements
      Windows NT/2000: Requires Windows NT 3.51 or later.
      Windows 95/98: Requires Windows 95 or later.
      Header: Declared in Winuser.h; include Windows.h.

    -----Original Message-----
    From: Kuruvilla Jacob [mailto:jacob_kuHOTMAIL.COM]
    Sent: Friday, November 23, 2001 5:55 AM
    To: DCOMDISCUSS.MICROSOFT.COM
    Subject: Sending key strokes to another App

    Hi,
    I have an windows application that pops up a message box with an ok
    cancel
    buttons.
    Now, from another application I want to be able to send a message to
    click
    either the ok or the cancel button.

    I have been able to get the Handle to the Messagebox window(and also the
    handle to the command button having the "OK".) But when I do a
    SendMessage(hWnd,WM_CHAR,VK_RETURN,0) nothing happens.

    On the other hand if I do a SendMessage(hWnd,WM_CLOSE,0,0) I am able to
    close the message box.
    I have tried SendMessage(hWnd,WM_COMMAND,WM_LBUTTONDOWN,0) , but no
    luck.

    I would appreciate any help. The application to which I am sending these
    messages to is a vendor application.

    This is what I do.

    hWindow = FindWindow(vbNullString, "Starquote NG")
    hChildWindow = GetWindow(hWindow, 5)
    lngReturnValue = SendMessage(hChildWindow, 7, 0, 0) ' Set focus
    lngReturnValue = SendMessage(hChildWindow, WM_CHAR, 13, 0)
    lngReturnValue = SendMessage(hChildWindow, WM_COMMAND, WM_LBUTTONDOWN,
    0)

    Thanks
    Jacob

    _________________________________________________________________
    Get your FREE download of MSN Explorer at
    http://explorer.msn.com/intl.asp

    ----------------------------------------------------------------
    Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
    contains important info. Save time, search the archives at
    http://discuss.microsoft.com/archives/index.html .
    To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM

    ----------------------------------------------------------------
    Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
    contains important info. Save time, search the archives at
    http://discuss.microsoft.com/archives/index.html .
    To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM