pabitra
May 8th, 1999, 05:03 AM
Hi,
Can I create a modeless message box?
Please help.
Regards,
Pabitra
Can I create a modeless message box?
Please help.
Regards,
Pabitra
|
Click to See Complete Forum and Search --> : Modeless Message box pabitra May 8th, 1999, 05:03 AM Hi, Can I create a modeless message box? Please help. Regards, Pabitra anant anavkar June 20th, 1999, 01:09 PM Hi, You can create modeless dlg box & then create a list box inside it. When u want to display a msg, you can do an InsertString() (remove any existing strings) to this listbox, and then bring that window to top & set focus to it. However, u cannot get any Yes/No/Cancel sort of user input. This is output only. In fact, I use this technique to debug my applications. My debug messages go to this modeless dlg box, instead of OutputDebugString(). I maintain the last 25 messages in the listbox. You can have a sizing border on the modeless dlg box, so that u can size it acc to your specs. regards, anant Saeed R June 20th, 1999, 06:13 PM If ananta's response was not working for you,let me know i have a solution for a modless dialogue as well.or search for my posts and i have replied to the similar quetsions in the past. Good Luck sshay77 November 23rd, 2008, 06:50 AM what about this implementation: #pragma once /******************************************************************** created: 2008/11/23 created: 23:11:2008 11:16 filename: ModelessMessageBox.h file path: file base: ModelessMessageBox file ext: h author: Shay purpose: Creating a message box not on the stack, without Stopping the code flow. Using thread and message box data on the heap. usage: ModelessMessageBox(NULL, sEvent, L"Debug events form menu", MB_OK); *********************************************************************/ class _ModelessMessageBox { protected: struct MessageData { HWND hWnd; CString lpText; CString lpCaption; UINT uType; }; static DWORD WINAPI DoMessageBoxThreadProc(LPVOID lpParameter) { if(lpParameter == NULL) return 1L; MessageData * pData= static_cast<MessageData *>(lpParameter); if (NULL == pData ) return 1L; //else ::MessageBox(pData->hWnd, pData->lpCaption, pData->lpText, pData->uType); delete pData; return 0L; } public: static void Show( HWND hWnd = NULL, LPCTSTR lpText = L"", LPCTSTR lpCaption = L"", UINT uType = MB_OK ) { MessageData * pMessageData = new MessageData; pMessageData->hWnd= hWnd; pMessageData->lpText = lpText; pMessageData->lpCaption = lpCaption; pMessageData->uType = uType; LPDWORD threadId = 0; CreateThread(NULL, 0, DoMessageBoxThreadProc, pMessageData/*(LPVOID)&m_messageData*/, 0, threadId); } }; void ModelessMessageBox(HWND hWnd = NULL, LPCTSTR lpText = L"", LPCTSTR lpCaption = L"", UINT uType = MB_OK ); in the cpp file ==================== #include "ModelessMessageBox.h" void ModelessMessageBox( HWND hWnd /*= NULL*/, LPCTSTR lpText /*= L""*/, LPCTSTR lpCaption /*= L""*/, UINT uType /*= MB_OK */ ) { _ModelessMessageBox::Show(hWnd /*= NULL*/, lpText/* = L""*/, lpCaption /*= L""*/, uType/* = MB_OK*/ ); } VictorN November 23rd, 2008, 09:39 AM You must have read it before you post! (http://www.codeguru.com/forum/announcement.php?f=7&a=6) codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |