locked
How to display message box similar to model dialog without knowing windows handler, in C++/VC++ without or using MFC RRS feed

  • Question

  • Problem: How do display the message box that is error comes while device operating.  This message box should be work like Model dialog. However, I do not have information about windows handler (VB application window) to pass the Handle to the owner window of the message box to be created. Since, I do not have VB code; I have only VB application executables.  I need to implement this error message display functionality in in C++/VC++ win32 application DLL.   

    I have tried MessageBox, However, I think that it will not be that much appropriate in this scenario.

    Additional Information: -

    1. Existing scenario: I have an existing application that was develop using VB language and in additions to that this application uses the Win32 dll (Not using MFC) and this dll developed using C++ on VC++ 6.0 platform. It also has OCX active X component that translate the different language (VB and C++) message/command.  In short Device ( layer1 ) <-- --RS232C  serial comm. --> C++/VC++ DLL (device communication interface) ( layer2 )  <--  -- > OCX (Translator) ( layer3 ) < -- -->  VB Front end application( layer4 )

    2. New Requirement:  I have to enhance this application to provide solution for new device support and I should upgrade/ enhance the DLL  Win32 dll only (not front end application)This DLL have the device interface business logic so I need to upgrade this device interface dll.  I have upgraded this interface C++/VC++ DLL but problem occur for following scenario design and implementation time:

    3. Condition – Will not be required any changes to VB application front-end side.  Displayed message box should be work like model dialog box without knowing windows handler.  Message would be implemented at C++/VC++ dll layer.  So my question is, please any friend suggest me on How to display device functionality related error information and that error elimination information.

    Thursday, May 19, 2011 9:05 PM

Answers

  • If you have a hard requirement that you cannot touch the VB, FindWindow is going to be your best bet.  There is always a chance that some other window in the system might match whatever search you apply to FindWindow.

    Or you push back and say the requirements are somewhat ridiculous -- if you are going to add significant functionality to the back end you may need to touch the front end in order to properly use it.

    • Proposed as answer by Jesse Jiang Thursday, May 26, 2011 6:04 AM
    • Marked as answer by Jesse Jiang Wednesday, June 1, 2011 3:21 AM
    Thursday, May 19, 2011 10:22 PM

All replies

  • Maybe if you know your VB app's main window name, you can use FindWindow() to get its HWND?

    -Seetharam

    Thursday, May 19, 2011 9:47 PM
  • If you have a hard requirement that you cannot touch the VB, FindWindow is going to be your best bet.  There is always a chance that some other window in the system might match whatever search you apply to FindWindow.

    Or you push back and say the requirements are somewhat ridiculous -- if you are going to add significant functionality to the back end you may need to touch the front end in order to properly use it.

    • Proposed as answer by Jesse Jiang Thursday, May 26, 2011 6:04 AM
    • Marked as answer by Jesse Jiang Wednesday, June 1, 2011 3:21 AM
    Thursday, May 19, 2011 10:22 PM
  • Hello,

     

    I think your question is how to communicate between two application. To call FindWindow and send message is fine, but we have some other ways to make the communications like

    • Clipboard
    • COM
    • Data Copy
    • DDE
    • File Mapping
    • Mailslots
    • Pipes
    • RPC
    • Windows Sockets

     

    You can follow this document Interprocess Communications which it introduces these ways. You can also see this blog Interprocess communication tutorial which it contains a sample codes.

     

    I hope my suggestions can help you to solve this problem.

     

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Proposed as answer by Jesse Jiang Thursday, May 26, 2011 6:04 AM
    Monday, May 23, 2011 3:09 AM
  • Hello,

     

    Would you mind letting me know the result of the suggestions? If you need further assistance, feel free to let me know. I will be more than happy to be of assistance.

     

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, May 26, 2011 6:03 AM
  • Hello,

     

    I marked Simon's reply as answer, if your issue have not been solved please unmark it and update more information about this issue.

     

    Best regards,

    Jesse

     


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, June 1, 2011 3:21 AM