|
I need to inverts a rectangle. My drawing code is based on Gdi+, and Gdi+ doesn't provide any function to do this. so i used Windows API function ::InvertRect.
It works fine when direct draw to screen, but when i used double-buffer, the result was wrong. here is the code:
void CTestView::OnDraw(CDC* pDC)
{
CTestDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CRect rc;
GetClientRect(&rc);
Bitmap bmp(rc.Width(), rc.Height());
Graphics* pGraphics = Graphics::FromImage(&bmp);
SolidBrush brush(Color(255, 255, 255));
pGraphics->FillRectangle(&brush, rc.left, rc.top, rc.Width(), rc.Height());
HDC hdc = pGraphics->GetHDC();
CRect rc1;
rc1.left = m_pt.x;
rc1.top = m_pt.y;
rc1.right = rc1.left + 10;
rc1.bottom = rc1.top + 10;
::InvertRect(hdc, &rc1);
pGraphics->ReleaseHDC(hdc);
Graphics g(pDC->GetSafeHdc());
g.DrawImage(&bmp, Point(0, 0));
delete pGraphics;
}
What's wrong?
|
|
|
|
|
Hi,
Is there a way to programatically add an icon for a contact ( in MS Outlook )?
Ex: for a contact which has an icq email address to put the icq icon.
Thanks
|
|
|
|
|
|
my application looks like
http://www.treetops.com.sg/before.jpg
when I fill an IC in patient IC textbox and click search button, it's supposed to query database and show what found in the right hand side listview. Everything seems ok by using mouse click, however if I want to use keyboard 'Enter' instead of mouse click what happen is all controls in this 'Patient Infomation' tab dispear:
http://www.treetops.com.sg/after.jpg
I have to manually switch to other tab then switch back, controls in Patient Infomation will appear. Anybody encountered this kind of problem before?
|
|
|
|
|
Well, I think you have for each tab a dialog and only one of them at a time is visible.
Normally, dialogs have an "OK" and a "Cancel" button. If you only delete them, the functionality still is in the dialog and "Enter" or "Esc" will close your dialog.
To avoid this, you should override (implement) the "OnOK" and "OnCancel" functions, but without calling its parent functions.
void CMySubDialog1::OnOK()
{
//CDialog::OnOK();
}
void CMySubDialog1::OnCancel()
{
//CDialog::OnCancel();
}
This should solve your problem.
|
|
|
|
|
Its sounds as though the Search button is not the default button. Does the property sheet have an OK button?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Does anyone know if there's a relatively easy way of inserting the VERSIONINFO data into a C++ comment. I want to annotate my changes with the current build number. Any ideas?
Many thanks,
Robert Pickford
|
|
|
|
|
Robert Pickford wrote:
Does anyone know if there's a relatively easy way of inserting the VERSIONINFO data into a C++ comment.
Do you mean at compile time or run time?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I actually mean at edit time. What I really want is a Visual Studio add-in or macro that inserts a comment like:
.... // Modified R A Pickford [02-Jun-2004 Build 2108]
Doesn't have to be exactly that format but it's getting the build number in that is foxing me at the moment. I may have to write my own addin.
|
|
|
|
|
Robert Pickford wrote:
...but it's getting the build number in that is foxing me at the moment.
Isn't that number determined by you?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Yes and no. I use VERSIONINFO and increment the Build number on every major release build so I wanted to automatically put that number into my comments.
|
|
|
|
|
Use a version control package. Then consult the documentation for that package. In CVS you can use
/* $log$
*
*/
to place your change comments in the code, but if you don't use CVS that isn't helpful. There are other things too that you can add, some of which are suitable for assigning to a variable so you can manipulate the version in code.
|
|
|
|
|
When using both modeless dialogs and formviews together in an application, is it an inherent nature of the modeless dialog to always overlap the formview? I know that a possible solution is to pass GetDesktopWindow() as the second parameter in the Create() function for dialogs, but that is not desirable for what I am doing. I want the application's mainframe window to be the parent window. However, when I use this in the Create function, the dialog still covers the formview. Is there any way to prevent my modeless dialogs from hiding my formviews?
Thanks for any suggestions.
|
|
|
|
|
I have problem with an executable with a MFC dialog. Whenever my dialog is up and i switch to MS Word or Paint then close down Word or Paint my exe locks up. It does not seem to repaint or return control when word or paint is shut down.
any suggestions?
|
|
|
|
|
Are you doing anything within OnPaint, KillFocus or SetFocus that could be looping?
I suggest that you:
1) run your application in debug through the IDE.
2) Switch between programs.
3) When you switch back, use the IDE to break into your program.
You should have a better understanding of where it is and what it is doing then.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fuity and sweet. I'm jelly, what am I? - David Williams (Little Britain)
|
|
|
|
|
My dialog(modal) does not get WM_NOTIFY messages.
How can it be fixed?
Thanks.
avivhal
|
|
|
|
|
Hello everyone,
I am updating the code of an already working service. I am trying to start a service on a remote computer from within the main function of the initial service. First I check if the executable of the service is in place and the check fails even if it is there. When I remove this check and try to start it anyway I cannot access the Service Control Manager with the following command:
scmHandle = ::OpenSCManager(serviceComputer, 0, SC_MANAGER_ALL_ACCESS);
It works locally, let's just say for simplicity that I specify as service executable:
\\mypc\c\temp\bla.exe
Is it possible what I am trying to do (by changing permissions in the creation of the initial service or something), or should I forget the whole thing?
Thanks a million in advance
|
|
|
|
|
I have a CDialog.
I'm trying to implement tooltips for the edit controls of the dialog.
I adde the code :
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXT,0,0xFFFF,OnToolTipNotify)
in the message map
and my function is :
BOOL CPageCurrentLoop::OnToolTipNotify( UINT id, NMHDR * pNMHDR, LRESULT * pResult )
The problem is the OnToolTipNotify never gets called. Even if the mouse pointer is over CEdit controls of the dialog.
Thanks.
avivhal
|
|
|
|
|
Has EnableToolTips() been called? You might need to use:
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipNotify)
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipNotify) Also make sure that no other control (e.g., group box) is obscuring the CEdit controls.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I tried this and it does not help.
I noticed that I dont get any wm_notify messages.
I guess they are "kidnapped" somewhere along the way.. but where?
avivhal
|
|
|
|
|
Aviv Halperin wrote:
I tried this and it does not help.
Meaning that EnableToolTips() has been called and both entries are in the dialog's message map? How are you verifying that OnToolTipNotify() is not getting called?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Yes, EnableToolTips() has been called and both entries are in the dialog's message map.
I tried putting a break point in the message handler in debug mode and never got to the break point.
Then I tried with the spy++ to find out if any notify message is sent and non are sent.
I have complex structure here that might be the reason:
I have a dialog box with a tab control. The tab control has a few pages which are all implemented as child dialogs of the tab control.
I'm trying to add tool tips to some of the controls of the tab pages dialogs.
Thanks.
avivhal
|
|
|
|
|
Did you call EnableToolTips from within your dialog window?
We are men. We are different. We have only one word for soap. We do not own candles. We have never seen anything of any value in a craft shop. We do not own magazines full of photographs of celebrities with their clothes on. - Steve
|
|
|
|
|
hi all
i have a modeless dialog which i call, kind of a waiting dialog if you like
i use
CCPServerWait* m_pWaitDlg;
m_pWaitDlg = new CCPServerWait;
m_pWaitDlg->Create(IDD_DCPSERVER_WAIT
m_pWaitDlg->m_wait_mes = "ConfimingDetails...Please Wait";
m_pWaitDlg->UpdateData(FALSE);
m_pWaitDlg->CenterWindow(CWnd::GetDesktopWindow());
m_pWaitDlg->ShowWindow(SW_SHOW);
m_pWaitDlg->UpdateWindow();
however im getting a debug assertion error on wincore.cpp when i run my program
when i look at the value CCPServerWait has when i step through hWnd is equalling nothing
CCPServerWait {CCPServerWait hWnd=???} CCPServerWait
this used to work fine until i added in the line of code below before the
dialog is called
ok = SQLCreateDataSource(m_hWnd,"CP_CMIS_CON");
which allows the user to create a Datasource
if i take this out the above works, but with it in
it throws me out an error on the m_pWaitDlg->UpdateData(FALSE); line
i assume this is because hWnd=???
but i dont know how to fix it
any ideas ????
|
|
|
|
|
You're calling UpdateData() but the controls do not exist yet. Remove that call altogether. Then in the dialog's OnInitDialog() method, use SetWindowText() instead. The CenterWindow() call should be moved to the dialog's OnInitDialog() method.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|