Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++
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 19-May-11 11:11am
Edited 20-May-11 2:33am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Comments
drcool23 at 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 at 20-May-11 8:32am
   
Please take a look at MB_TASKMODAL option of MessageBox().
Albert Holguin at 20-May-11 11:57am
   
Sounds like you do need a message box, or the MFC version AfxMessageBox()...
Hans Dietrich at 20-May-11 17:54pm
   
Yes, I think MessageBox will do what he wants, if he chooses the right set of options.
Albert Holguin at 20-May-11 17:57pm
   
well isn't AfxMessageBox() already modal by default? I'm pretty sure it is...
Hans Dietrich at 20-May-11 19:19pm
   
I believe the OP is saying that he doesn't have a handle to the current app window, and therefore must pass NULL to MessageBox; this does *not* result in app-modal behavior, unless you use the option I mentioned.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

If you know your Application window's caption, why don't you just FindWindow[^] ?
HWND hWnd = FindWindow(0, "MyApp");
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 363
1 OriginalGriff 354
2 George Jonsson 248
3 Shemeemsha RA 148
4 Animesh Datta 130
0 OriginalGriff 6,179
1 Sergey Alexandrovich Kryukov 5,616
2 CPallini 4,770
3 George Jonsson 3,400
4 Gihan Liyanage 2,522


Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 20 May 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100