Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Problem: How do display the message box that is error comes while device operating. This message box should be work like Modal 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 modal 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.
Posted
Updated 20-May-11 2:33am
v2

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

With this statement, you have pretty much excluded everything except a custom modal dialog. And since MessageBox is meant to be a general-purpose message display dialog, then what you want is going to be a mystery to anyone reading this forum.

What exactly are you looking for? Can you point to an example?

Why is MessageBox "not appropriate"? You know, you don't need to pass a window handle - you can just pass NULL.

What do you mean by "How to display device functionality related error information and that error elimination information."? Please try to re-word this sentence. It makes no sense.
 
Share this answer
 
Comments
drcool23 20-May-11 3:58am    
What exactly are you looking for? Can you point to an example?
Ans- I am looking for an event triggered information to be diplay as a custom message which has to pop up and display the device functionality related error message to user as Reason for error And error Releasing method. For example - C++ DLL triggered an event as Decrease of voltage of battery. This even notification, user has to know and he/she has to Release this error by taking appropriate action.

Q -Why is MessageBox "not appropriate"? You know, you don't need to pass a window handle - you can just pass NULL.
Ans - Because If I used MessageBox, It will be run independently (without window handler) when i just passed NULL. User may ignore this message. However, My requirement is user should not do any another operation on Application window until he clicked on OK batten of MessageBox.
Hans Dietrich 20-May-11 8:32am    
Please take a look at MB_TASKMODAL option of MessageBox().
Albert Holguin 20-May-11 11:57am    
Sounds like you do need a message box, or the MFC version AfxMessageBox()...
Hans Dietrich 20-May-11 17:54pm    
Yes, I think MessageBox will do what he wants, if he chooses the right set of options.
Albert Holguin 20-May-11 17:57pm    
well isn't AfxMessageBox() already modal by default? I'm pretty sure it is...
If you know your Application window's caption, why don't you just FindWindow[^] ?
HWND hWnd = FindWindow(0, "MyApp");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900