|
Hi,
When I create the dialog box (second dialog) in the first dialog box it stays always above the first one. I can push to a button in the first dialog box while the second one stays above it.But when I create them at the begining of the program in the main dialog box (main dialog box is different than the first dialog box) then if I touch to the first dialog box the second one goes below the first one.How can I fix the second dialog box above the first dialog box when I create them at the beginning of the program?
Thanks
ibrahim
|
|
|
|
|
|
As mike said, u can use SetWindowPos( m_hWnd, HWND_TOPMOST, Left, Top, Width, Height, SWP_SHOWWINDOW );
aks
|
|
|
|
|
That didn't solve my problem.I think it will be better if I write the code sample.
Creating the dialogs as global.
pKeyboard = new CKeyboard;
pKeyboard->Create(IDD_KEYBOARD,this);
::SetWindowPos(pKeyboard->m_hWnd, HWND_TOPMOST,0,0,cxScreen,2*cyScreen/5, SWP_SHOWWINDOW );
pPhoneEditor = new CPhoneEditor;
pPhoneEditor->Create(IDD_PHONEEDITOR,this);
pPhoneEditor->SetWindowPos(&wndTop,0,0,cxScreen,cyScreen,SWP_HIDEWINDOW);
Is there a problem in this code?
|
|
|
|
|
If you use DoModal () to display the second dialog box, it will be fixed at the top until you close it. This is called a "modal" dialog box.
|
|
|
|
|
But I want that I can push a button or write something to an editbox in the first dialog box while the second dialog is on the top.When I create the dialog box as modal I think that I cannot use the first dialog box?
|
|
|
|
|
That's correct. In that case, you should probably use led mike's suggestion instead of DoModal ().
|
|
|
|
|
Dear All,
Please guide me how to use TrackMouseEvent() to track the events of mouse on a CBitmapbutton. Please advice.
Also I see a message map
ON_BN_HILITE( <id>, <memberFxn> ) afx_msg void memberFxn( );
Is it possible to use when a button is highlighted.
Regards,
Banu
modified on Thursday, July 17, 2008 9:39 AM
|
|
|
|
|
bhanu_8509 wrote: Please guide me how to use TrackMouseEvent()
No. But I will guide you on how to use Google[^]
led mike
|
|
|
|
|
What is the purpose of
ON_BN_HILITE( <id>, <memberFxn> ) afx_msg void memberFxn( ); message map.
|
|
|
|
|
bhanu_8509 wrote: What is the purpose of
MSDN Documentation for BN_HILITE[^]
Also thank you for letting me know that I had accidentally set my signature to "Microsoft Documentation Central". I have now set it back to led mike. I mean seriously that could have been a real disaster, all sorts of people would have been asking me for information that is freely available on the MSDN web site!
led mike
|
|
|
|
|
I see, so please tell me what is the wrong with the below code
//DoDataExchange
DDX_Control(pDX, IDC_BUTTON9, m_button9);
//Message map
ON_BN_HILITE(IDC_BUTTON9,&Test::OnHighlight)
//Function declaration and button declaration
afx_msg void OnHighlight();
CBitmapButton m_button9;
//Function definition
void Test::OnHighlight()
{
MessageBox(L"Button Highlighted");
}
Also the notify property of the button is true and Owner draw is set to false. I have tried all the above and then only I am asking questions in this forum, if you have time please help otherwise please don't disgrace the new members and novice programmers.
|
|
|
|
|
bhanu_8509 wrote: otherwise please don't disgrace the new members and novice programmers.
Don't disgrace yourself.
bhanu_8509 wrote: please tell me what is the wrong with the below code
I don't see anything wrong with the code you posted and you did not explain what the symptom is now did you? Therefore I don't even know what to look for now do I?
Are you running in 16 bit Windows?
led mike
|
|
|
|
|
Hi,
is there the possibility to get a MouseOver Event for Combobox Items?
I want a bubble to pop up, when the users mousepointer is over a combobox item, so i would need the event, and the value of the item the mouse is over.
Can someone help me?
Thank you,
Johannes
|
|
|
|
|
Have you called EnableToolTips(TRUE) ? Do you have a handler for TTN_NEEDTEXTA and TTN_NEEDTEXTW ?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks for you answer.
I decided to use a control from codeguru.com (http://www.codeguru.com/cpp/controls/combobox/tooltips/article.php/c4949/).
It works fine so far, but I have another Problem:
I want to have a multiline ToolTip Text ("line1 \n line2"). I read that I have to call SetMaxTipWidth() from the CToolTipCtrl class.
The Code of the codeguru control manipulates the ToolTip text in the function CTooltipListCtrl::OnToolTipText(...).
TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
if (pNMHDR->code == TTN_NEEDTEXTA)
lstrcpyn(pTTTA->szText, sTipText, 80);
else
_mbstowcsz(pTTTW->szText, sTipText, 80);
Can someone tell me how to get the CToolTipCtrl pointer in the CTooltipListCtrl class(derived FROM CListCtrl), to call it's SetMaxTipWidth() function to get a Multiline ToolTipText?
Thanks for your help...
|
|
|
|
|
I am trying to create a progress dialog box in the below event. But Progress dialog box is not displayed, it is working fine when I comment th loop, I the lenthy operation is very much similar to the loop.
I want the progressbar to be initiated with thread,
Please advice.
void CTestDlg::OnStartPrg()
{
ThreadPrgIndiaction* pThread;
pThread = new ThreadPrgIndiaction();
pThread->CreateThread();
pThread->PostThreadMessage(WM_MYTHREADMESSAGE,NULL,NULL);
// My progress is similar to below loop
int j=1;
while(j<99)
{
j++;
Sleep(200);
}
}
THREAD
BEGIN_MESSAGE_MAP(ThreadPrgIndiaction, CWinThread)
//{{AFX_MSG_MAP(ThreadPrgIndiaction)
// NOTE - the ClassWizard will add and remove mapping macros here.
ON_THREAD_MESSAGE ( WM_MYTHREADMESSAGE, MyMessageHandler )
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void ThreadPrgIndiaction::MyMessageHandler(WPARAM, LPARAM)
{
CPrgDlg *dlg;
dlg = new CPrgDlg;
dlg->Create(IDD_DIALOG2);
dlg->ShowWindow(1);
PrgDialog
BOOL CPrgDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_prg.SetStep(1);
m_prg.SetRange(0,60);
SetTimer(1, 60, NULL);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CPrgDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
m_prg.SetPos(m_prg.GetPos()+1);
UpdateData(FALSE);
CDialog::OnTimer(nIDEvent);
}
}
|
|
|
|
|
ptr_Electron wrote: But Progress dialog box is not displayed...
Have you set a breakpoint in CPrgDlg::OnInitDialog() to verify that control is reaching that method?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes, it is working fine in the absents of while loop, but it is not reach there when place whie loop
|
|
|
|
|
You should be using
CWinThread* AfxBeginThread(
CRuntimeClass* pThreadClass,
int nPriority = THREAD_PRIORITY_NORMAL,
UINT nStackSize = 0,
DWORD dwCreateFlags = 0,
LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL
);
instead of
pThread->CreateThread();
to create a UI thread. Otherwise, your thread won't get the
WM_MYTHREADMESSAGE you post to it.
*Edit*<br />
Actually you can leave your thread creation code the way it is as<br />
long as your ThreadPrgIndiaction class has an InitInstance() override<br />
that returns TRUE. That will cause the message queue to be created for <br />
the thread.<br />
Mark
Mark Salsbery
Microsoft MVP - Visual C++
modified on Thursday, July 17, 2008 3:19 PM
|
|
|
|
|
But the above code is working fine, with out the while loop. The problem, progress bar indication is shown on the dialog, when while loop is placed.
|
|
|
|
|
The problem is that the ui thread is creating a window that is a child of a main thread window . Windows communicate with their parent window, so the ui thread has to wait until the parent window's thread processes a message. I think thats y ur CPrgDlg is not displayed. It may display after completing the loop.
I think u can create a worker thread and can call CPrgDlg from the thread function.
aks
|
|
|
|
|
|
Hi All,
Is there a way to find out the time taken by a function to complete (in terms of nanoseconds) in my c++ code without using "Function Profiling" feature of the linker. I tried GetTickCount(), but it gives the time in milliseconds. It always returns 0 because my function completes its task less than in one millisecond.
Thanks in advance
|
|
|
|
|
You may use the QueryPerformanceFrequency [<a href="http://msdn.microsoft.com/en-us/library/ms644905.aspx" target="_blank" title="New Window">^</a>], QueryPerformanceCounter [^] pair.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|