|
Try setting the style "Clip children" in the resource editor for yor main window (or if it is not a dialog, set the style WS_CLIPCHILDREN when creating the window).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi
I open a simple modal dialog box... (from a menu)
And I want to do this:
When the mouse cursor move above a simple component (CEdit, CCheckBox, CComboBox, etc.), I want to display some information about this component fonctionnality (CEdit, etc.) in CEdit with the read-only flag...
The WM_MOUSEMOVE message is sent to the dialog box. Here is the code I use:
void CControlDlg::OnMouseMove(UINT nFlags, CPoint point)
{
CWnd* ThisWnd = ChildWindowFromPoint(point);
int ThisID = ThisWnd->GetDlgCtrlID();
switch(ThisID) {
case IDC_TPG_V_H:
m_strInfoControl = "Test Pattern Generator for incremental test";
break;
default:
m_strInfoControl = "default";
}
UpdateData(FALSE);
CDialog::OnMouseMove(nFlags, point);
}
The m_strInfoControl is the information display into an Edit box read-only component...
The problem is that the dialog box loses the control of the mouse when the mouse cursor is above a component...
Thanks in advance...
Hello World!!!
from Raphaël
|
|
|
|
|
You could compare the coords or the cursor (the point parameter of OnMouseMove ) with the CRect coords of the control with CRect::PtInRect ... ?
[EDIT] I might have not understand your question : Is it you can't recognize the control where the mouse cursor passes over, or is it you cannot do anything after you recognized it ?
~RaGE();
|
|
|
|
|
This is: I can't recognize the control where the mouse cursor passes over...
Because OnMouseMove is defined for the dialog and not for the component i want to recognize...
Hello World!!!
from Raphaël
|
|
|
|
|
You'll have to override the OnMouseMove for every control, or do almost like I said in the first post (that's bad cheating): Get the CRect from your control, add it 10 pixels or so on every side, so you'll egt a CRect 10 pixels greater than your control, and when the mouse enter this CRect, display your things, when it comes out, undo your display. Tricky, but it should do it. You may also take a look on OnSetCapture to redirect Mouse events.
~RaGE();
|
|
|
|
|
Rage wrote:
You'll have to override the OnMouseMove for every control
It is well what I thought...
Thanks...
Hello World!!!
from Raphaël
|
|
|
|
|
I have a DLL file, no .h file, no import library.
In DLL only one function is exported - I know its name.
I need to use this function, but I don't know the
parameters and their types and return value.
Is it possible at all to find this information?
How would do this, if you were in my position?
|
|
|
|
|
Read the documentation ? No other possibility IMO
~RaGE();
|
|
|
|
|
if i get what ure doing, try to find a sample that use that dll, diasemble that exe, and look for the code of this function,and try to mimic it
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I'm working on a MDI application which has a couple of dockable toolbars. When a document loads, I want the childframe to start at a certain height and width depending on the data in the attached document. I don't want to move the child frame; I just want to change its width and height. This is what I tried...
<br />
CRect lChildRect;<br />
pChildWnd->GetWindowRect(&lChildRect);<br />
lChildRect.NormalizeRect();<br />
pMainWnd->ScreenToClient(&lChildRect);<br />
<br />
pChildWnd->MoveWindow(lChildRect->left, lChildRect->top, iNewWidth, iNewHeight, TRUE);<br />
It sets the new width and height correctly but the position is wrong. Depending on how many toolbars are docked to the top or left side of the main frame, the child frame position winds up increasingly offset. It seems that the ScreenToClient() function fails to take into account toolbars but the client area, used by the MoveWindow() function, does take toolbars into account.
How do I get the correct client coordinates for my MoveWindow() call?
|
|
|
|
|
Use SetWindowPos with SWP_NOMOVE flag.
Pavel
Sonork 100.15206
|
|
|
|
|
hi there,
i want to debug my unicode console application.
even when i set break point it does not stop.
can anyone suggest as to what am i missing out.
i am building it in the debug version...
|
|
|
|
|
3 possiblities I see :
1. You're setting a breakpoint in a file which actually does not belong anymore to your project (happened to me as I copied several times a project to do multiple versions of it )
2. The section of code you're trying to debug is never executed.
3. You changed the debug settings .
~RaGE();
|
|
|
|
|
no this is not the case
1.the break point is in the same file
2.well when i start the application it should atleast put me at start even without a break point so second point is also ruled out
3. no i did'nt change any of the debug settings
|
|
|
|
|
Well unless you send me your code so i can try it out, i do not think we'llbe able to help you
~RaGE();
|
|
|
|
|
Dont launch the app with "Start Debug/Go" but with "Start Debug/Step Into" which will stop at the first statement in the app. If it does not, then rethink your live and have a XMas break
But it still might be that the code at the breakpoint is never executed.
I don't think this is a serious possesion, and the evil most likely comes from your hand. Colin J Davies, The Lounge
|
|
|
|
|
dear all,
i'using mfc dialog based app.
the application adds a tray icon and a dialog box appears on dblclicking it.
the problem is that on every double click a new instance of dialog box appear.
how do i ensure that only one dialog can appear at a time.
Also, if the dialog is modal, how do i forcibly close the dialog say after 15 seconds.
When i use Create func to create a modeless dialog box, the dialog flashes and disappears. Why is it Happening?
I'm new to VC programmer. plz. help
rishabhs
|
|
|
|
|
rishabhs wrote:
Also, if the dialog is modal, how do i forcibly close the dialog say after 15 seconds.
Here you'll have to use a Timer.Here we go ...
SetTimer(100,15000,NULL);
Then handle your WM_TIMER message (Right Click on your Dialog in the class browser, Handling Windows Message ... [Dialog opens], doubleclick on WM_TIMER in the right column so that it appears in the middle one, click Edit now (I don't know the exact english denomination, i have it in german here =/)
You'll get something like :
void CBuilderDlg::OnTimer(UINT nIDEvent)
{
CDialog::OnTimer(nIDEvent);
}
add the following lines :
void CBuilderDlg::OnTimer(UINT nIDEvent)
{
if(nIDEvent==100)
{
OnCancel();
}
CDialog::OnTimer(nIDEvent);
}
rishabhs wrote:
When i use Create func to create a modeless dialog box, the dialog flashes and disappears. Why is it Happening?
You probably did :
CMyDialog mydialog;
mydialog.Create(bla...);
so your dialog is created as a local variable, and when you exit the function, it disappears.
Create a new member variable (Rightclick on your dialog in the class browser, Add a new memeber variable) named m_mydialog .
Then call the Create function with
m_mydialog.Create(bla...)
Whereas to
rishabhs wrote:
how do i ensure that only one dialog can appear at a time
post your code handling your double click on the tray icon ...
You may also want to look at Mike Dunn's FAQ for further question.
Hope this helps
~RaGE();
|
|
|
|
|
It would help if you post some code.
To display a dialog for 15s, use a timer (SetTimer ) and use DestroyWindow to kill the dialog.
Cheers,
Fredrik
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
hi FREDRIK! Nice to see u help me again.
This is my code:-
LRESULT CTimer::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
CSchdDlg *dlgObj;
dlgObj = new CSchdDlg(NULL);
switch(message)
{
case WM_NOTIFY_ICON:
switch (lParam)
{
case WM_LBUTTONDBLCLK:
dlgObj->Create(IDD_SCHD_DIALOG, NULL);
// SetTimer(2,15000,NULL); to disappear dlg after 15 seconds + I've used just a return in ONTimer func
// dlgObj->DestroyWindow();
break;
default:
break;
}
break;
default:
break;
}
return CFrameWnd::WindowProc(message, wParam, lParam);
}
now can u answer my questions!
waiting..............
rishabhs
|
|
|
|
|
rishabhs wrote:
now can u answer my questions!
OK. Let's see a few points :
1. The SetTimer and OnTimer stuff I gave you should be implemented in your CSchDlg.
2. You really _have_ to declare your dialog as a member varaible if you do not want it to vanish a 1/1000e second after you created it with Create
3. If you want to close the dialog after 15s from _outside_ the CSchDlg, do like Frederik said, but again you'll need a member variable m_myDlg to perform a m_myDlg->DestroyWindow(); (it is IMO far much better to do it from within the CSchDlg, but )
4. To avoid multiple instances, just put a boolean as memeber variable, set it to 1 when you first create the SchDlg, reset it when destroying it, and do a test in your case WM_LBUTTONDBLCLK to know if you acn or not recreate a dialog.
Hope this helps.
~RaGE();
|
|
|
|
|
See the answer from Rage.
Another thing, you are doing one new , but no delete , and that causes memory leaks.
Cheers,
Fredrik
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
you new the dialog in the function
and delete it in this funtion too
so you can not see the dialog
|
|
|
|
|
Rage gave you a great response, but let me just add my personal solution:
Like Rage said, the modeless dialog dissapears because you're probably creating the class as a local variable.... so, to kill 2 birds with one stone, the solution is simple: create the class as a static variable!
static CMyDialog s_dlg;
if (::IsWindow(s_dlg.m_hWnd))
s_dlg.ShowWindow(SW_SHOWNORMAL);
else
s_dlg.Create(CMyDialog::IDD);
This keeps your dialog class around and also ensures that only one is created.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
i am trying to findout if there are a Line Class in MFC.
for example in a Specified Device Context i want to define a Line Object with 2 attributes
1. Source-Cpoint
2. Destination-Cpoint
if i change the Source-CPoint of a Line Object in a DC then Line changes in that DC.
|
|
|
|