|
...I invalidate that rectangle and do an UpdateWindow to force a WM_PAINT
Try (for debugging purposes) invalidating the whole window instead. If this causes the window to be correctly repainted, then probably you're miscalculating the dimensions of the rectangle.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
also, you might want to track WM_MOUSELEAVE message.
here is a snip to how to get this message:
TRACKMOUSEEVENT structEventTrack;
structEventTrack.cbSize = sizeof(structEventTrack);
structEventTrack.dwFlags = TME_LEAVE;
structEventTrack.hwndTrack = this->GetSafeHwnd();
structEventTrack.dwHoverTime = HOVER_DEFAULT;
_TrackMouseEvent(&structEventTrack);
and in your handler to WM_MOUSELEAVE message, you might want to clear your flags which was set during mousemove.
|
|
|
|
|
Hi,
I need to get hold of some algorithm for doing lexicographic text
matching - the way it works for wildcard. Could anybody give me
some URL or article extract?
e.g.:
abc* matches abcdef but does not match abdef.
?XYZ matches MXYZ but does not match MNXYZ.
With best regards,
Sayan
Email:sayanmukherjee@indiatimes.com
|
|
|
|
|
|
A dilemma:
I want a "done" button to be disabled until the user adds omething to the CEdit. Fine. I trapped the EN_CHANGE, and the button comes alive as soon as the user enters anything. Problem is, I dont ever want this field to be empty, and if after typing a letter in, the user goes back and deletes it, my "done" button is still enabled. It should only be enabled when theres something in the CEdit.
How do I do this?
======================================================================================
My other tactic was to test when the "done' was pressed like this(below) but it freezes my program and doesnt give me a chance to enter something into the CEdit:
void CDlgMineName::OnButtonDone()
{
CString UserEntry;
m_editMineName.GetWindowText(UserEntry);
while (UserEntry =="")
{
m_editMineName.SetFocus();
m_editMineName.GetWindowText(UserEntry);<code>why cant I enter anything here? </code>
}
It freezes and I have to kill it from task manager. Is it obvious why ?
Thanks,
ns
|
|
|
|
|
ns wrote:
I trapped the EN_CHANGE,
So EN_CHANGE isn't sent when user deletes text from edit control?
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
It probably is, but heres what I do in the function:
void CDlgMineName::OnChangeEditminename()
{
m_buttonminename.EnableWindow(TRUE);
}
If the change was of a "negative type" i.e. nothings left in the CEdit, I want to EnableWindow(FALSE), so should I do a GetWindowText in this event and see if its empty?
void CDlgMineName::OnChangeEditminename()
{
CString abc;
m_myEdit.GetWindowText(abc);
if(abc=="")
{
m_buttonminename.EnableWindow(FALSE);
}
else
{
m_buttonminename.EnableWindow(TRUE);
}
}
What do you think about this? Too contrived?
Thanks,
ns
|
|
|
|
|
One line does it all:
m_button.EnableWindow(m_edit.GetWindowTextLength() > 0);
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
For the EN_CHANGE you would just write
CString name ;
m_editMineName.GetWindowText(name) ;
GetDlgItem(IDC_BUTTON_DONE)->EnableWindow(name.GetLength() > 0) ;
Roger Allen
Sonork 100.10016
I think I need a new quote, I am on the prowl, so look out for a soft cute furry looking animal, which is really a Hippo in disguise. Its probably me.
|
|
|
|
|
Thanks! I was going about doing that but I really like your succintness and style!
Thanks,
ns
|
|
|
|
|
Hi,
Please find below a possible way to do it using MFC. It is in your lines
of thought and EN_CHANGE does it.
When the application starts the button will be disabled. As you type in the
edit box or delete text EN_CHANGE fires. Keep on measuring the length of the
string.
Code follows:
Class declaration:
<br />
class CEditControlDlg : public CDialog<br />
{<br />
public:<br />
CEdit *m_pEdit; <br />
CButton *m_pButton; <br />
<br />
CEditControlDlg(CWnd* pParent = NULL);
}<br />
Function definition - InitDialog():
<br />
BOOL CEditControlDlg::OnInitDialog()<br />
{<br />
CDialog::OnInitDialog();<br />
<br />
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
<br />
m_pEdit = (CEdit *)GetDlgItem(EF_TEXT); <br />
m_pButton = (CButton *)GetDlgItem(PB_DONE); <br />
<br />
m_pButton->EnableWindow(FALSE);
return TRUE;
}<br />
Function definition - EN_CHANGE handler function:
<br />
void CEditControlDlg::OnChangeText() <br />
{<br />
<br />
CString strText;<br />
<br />
m_pEdit->GetWindowText(strText);<br />
<br />
if (!strText.GetLength())<br />
{<br />
m_pButton->EnableWindow(FALSE);<br />
}<br />
else<br />
{<br />
m_pButton->EnableWindow();<br />
}<br />
}<br />
With best regards,
Sayan
Email:sayanmukherjee@indiatimes.com
|
|
|
|
|
I'm automating Excel from C++ using OLE.
Sometimes, I give a command to excel. Excel handles the command and finishes it, BUT excel doesn't return back to my c++ app.
In my c++ app, I'm calling pDispatch->Invoke(...), the method or property is indeed invoked, you can see the result in the excel sheet. But the invoke method never returns and hangs...
My guess is that it's wndmessage-related.
btw. my app is in fact an mfc-dll. InitInstance() is called but Run() is never called.
Anybody knows why? Do I have to override the excel messagepump?
PLEASE, any suggestions are fine...
tnx
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
Hi,
I would like to print all the contents of a List Box from the Start to the End (some time the list is very long & it shows only protion of it in the screen) including its Header columns titles
Is there any samples about this?
I appreciate any help & guideline here!
Thanks,
|
|
|
|
|
Are they global (Windows) scope or application scope? Just curious about that but I have a view with a timer in it. My application creates two instances of this view in splitter window panes. Of course for now, each view has the same timer ID which is effecting what I'm doing. But, I was wondering if I pick two random numbers or two different hard coded values will they be effected by any other timers running in different applications if a developer of those "other" applications used the same ID.
|
|
|
|
|
i believe they are application scope. otherwise, your app would be receiving timer messages from every other app out running on your system - this would be a tremendous waste of CPU cycles, IMO.
-c
For men use, if they have an evil turn, to write it in marble:
and whoso doth us a good turn we write it in dust.
-- Sir Thomas More
|
|
|
|
|
Not global. IDs must be unique per HWND.
"If the hWnd parameter is not NULL and the window specified by hWnd already has a timer with the value nIDEvent, then the existing timer is replaced by the new timer. When SetTimer replaces a timer, the timer is reset. Therefore, a message will be sent after the current time-out value elapses, but the previously set time-out value is ignored." (from MSDN docs on SetTimer).
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
Wow! That was quick. Thanks, Guys.
|
|
|
|
|
Working with VC++ 6.0 I have a problem. The CRecordView class has no DoModal() function.So I don't know how to call a dialog based on CRecordView from another dialog (based on CView for example).
E.g I tried to call a dialog with class name CRecView (based on CRecordView):
void CTestDlg::OnButton1()
{
CRecView m_Dlg1;
m_Dlg1.DoModal();
}
but without the DoModal function I can't do it.
|
|
|
|
|
|
Working with VC++ 6.0 I have a problem. The CRecordView class has no DoModal() function.So I don't know how to call a dialog based on CRecordView from another dialog (based on CView for example).
E.g I tried to call a dialog with class name CRecView (based on CRecordView):
void CTestDlg::OnButton1()
{
CRecView m_Dlg1;
m_Dlg1.DoModal();
}
but without the DoModal function I can't do it.
|
|
|
|
|
I will be packaging my MFC app with Wise.Theres a third party control that requires that olepro32 and oleaut32 be registered and installed on the users machine. I guess my question is, that if I ship the version they suggest, they are older than whats already on my win2k. If the user has newer dlls too, then these older ones I distribute wont overwrite them right? (In which case, the app should still work, I hope.).
If my shipped dlls are newer than the users dlls, then it wont mess up their machine to install mine - is that right?
Thanks,
ns
|
|
|
|
|
ns wrote:
If the user has newer dlls too, then these older ones I distribute wont overwrite them right?
Well, it depends on the installer. I don't know Wise, but I'm pretty sure you can control the way files are copied - there should be an option 'leave existing file if its version is more recent'. At least there's something like this in InstallShield.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
<old installshield="">
It is true you have the overwrite-only-if-newer flag in old InstallShield.
If you put these DLLs in your app directory, then you don't even need to worry this.
InstallShield is legacy.
You must use Merge modules (.msm) files, fill a .msi database and use the Windows Installer SDK.
System merge modules such like the ones you mention are provided by MS. VS.Net provides a lot of them in the cd.
Packages are represented by GUIDs and that's by design the installer now knows if a subpackage is already installed, needs upgrade, or has been uninstalled.
And I swallow a small raisin.
|
|
|
|
|
StephaneRodriguez wrote:
If you put these DLLs in your app directory, then you don't even need to worry this
I highly doubt if you can put olepro32 and oleaut32 in app directory - these are core OLE libraries.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
Agreed, but usually DLLs loaded automatically follow the documented scheme :
- either in current path
- or in PATH environment variable
- or system dir
So I guess this works. Requires a try though...
And I swallow a small raisin.
|
|
|
|