|
|
Alan Balkany wrote: After you get the screen coordinates of the button
Hello alan,
Thank you very much for your reply. Can you please tell me how to get the screen coordinates of the button.
Many thanks in advance.
modified on Friday, July 18, 2008 10:29 AM
|
|
|
|
|
For example:
RECT rect;
GetDlgItem (IDC_BUTTON1)->GetWindowRect (&rect);
ScreenToClient (&rect);
|
|
|
|
|
Dear Alan,
Thank you very much for your reply. I have the code below as per your guidance. But when I place the mouse over the button the Messagebox is not displayed, instead it is appearing when I place the mouse on the to area of the dialog window, but my control is placed on the bottom of the dialog window. Please advice.
void CdfdgDlg::OnMouseMove(UINT nFlags, CPoint point)
{
GetDlgItem (IDC_BUTTON9)->GetWindowRect (&rect);
ScreenToClient (&rect);
ClientToScreen(&point);
if (rect.PtInRect(point))
{
MessageBox(L"Correct");
}
CDialog::OnMouseMove(nFlags, point);
}
|
|
|
|
|
The line, ClientToScreen(&point); is incorrect. I think this point is already in client coordinates, so remove this line.
|
|
|
|
|
Hello Alan,
I tried like the below. Strangely, when placing mouse over the button changes the bitmap and when I move the mouse over the dialog the button is painted again and again. If I place the mouse over other non-bitmap button and place again over the bitmapbutton didn't change the image. That is the event is triggered for the first time only.
ON_WM_MOUSEMOVE()
ON_MESSAGE(WM_MOUSELEAVE,OnMouseLeave)
LONG CdfdgDlg::OnMouseLeave(WPARAM , LPARAM)
{
POINT point;
GetCursorPos(&point);
ScreenToClient(&point);
GetDlgItem (IDC_BUTTON4)->GetWindowRect (&rect);
ScreenToClient (&rect);
if (rect.PtInRect(point))
{
bool val=m_button4.LoadBitmaps(IDB_BITMAP4,0,IDB_BITMAP4,0);
m_button4.Invalidate();
m_button4.UpdateWindow();
}
return 0;
}
void CdfdgDlg::OnMouseMove(UINT nFlags, CPoint point)
{
TRACKMOUSEEVENT trackmouseevent;
trackmouseevent.cbSize = sizeof(trackmouseevent);
trackmouseevent.dwFlags = TME_LEAVE;
trackmouseevent.hwndTrack = GetSafeHwnd();
trackmouseevent.dwHoverTime = HOVER_DEFAULT;
_TrackMouseEvent(&trackmouseevent);
GetDlgItem (IDC_BUTTON4)->GetWindowRect (&rect);
ScreenToClient (&rect);
if ((!rect.PtInRect(point)) )
{
mouse=true;
bool val=m_button4.LoadBitmaps(IDB_BITMAP2,0,IDB_BITMAP2,0);
m_button4.Invalidate();
m_button4.UpdateWindow();
}
CDialog::OnMouseMove(nFlags, point);
}
modified on Monday, July 21, 2008 8:50 AM
|
|
|
|
|
I'm not sure what your question is. It looks like you're reloading the button bitmaps every time there's a mouse move in your dialog, which probably isn't what you want to do.
|
|
|
|
|
Dear Alan,
Actually I am reloading the button everytime, because I have to change the bitmap of the button when mouse is over and mouse is leave from the button.
That's why I am reloading the bitmap of the button everytime there is mouse move and every time mouse over the button. Please advice me a good way to do this.
Many thanks in advance.
|
|
|
|
|
OnMouseLeave () will only be called when the mouse leaves the dialog -- not the button.
Try handling both cases (mouse in button, mouse out of button) in the OnMouseMove () handler.
|
|
|
|
|
bhanu_8509 wrote: Both are giving the window position only.
Maybe because you are calling them in the context of a window rather than a control. You may, however, be getting screen and client coordinates confused.
"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
|
|
|
|
|
There are many ways, but try something like this:
HWND hwndControl = ::GetDlgItem(GetSafeHwnd(), IDC_PICTUREBOX);
ASSERT(hwndControl);
CRect rec;
VERIFY(::GetWindowRect(hwndControl, &rec));
VERIFY(::MapWindowPoints(NULL, GetSafeHwnd(), reinterpret_cast<LPPOINT>(&rec), 2) != 0 );
This code assumes that it's in a member function of the dialog. By using the raw Win32 functions I'm avoiding the overhead of MFC's handle maps.
Steve
|
|
|
|
|
Hello all,
Please help me...
I am creating Stored Procedure programmatically using db_command
code is some thing like
[
db_command(".. very long SQL stored procedure string....")
]
my stored procedure command string is too long..
while compiling I am getting this "error C2026: string too big, trailing characters truncated" error.
Thanks in advance..
|
|
|
|
|
According to this page [^] you may try to split it into two adjacent string literals.
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]
|
|
|
|
|
Thanks you for reply..
I had already visited this link ..
I have tried this but still I am getting same error.
|
|
|
|
|
The cause: "string too big" try buildind a shorter SP.
I am sute the too big string is poiting that you have written to much code than thought about it.
Greetings from Germany
|
|
|
|
|
Instead of doing something like:
str = "very long SQL stored procedure string"; try this instead:
str = "very long "
str += "SQL stored ";
str += "procedure string"; Strings can be as long as you have enough memory for. The compiler is simply complaining about your string literals.
"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
|
|
|
|
|
i want to write urdu on a richedit control. but when i start writing after first character the language in languagebar get set to urdu or any other arabic language which is first in languagebar automatically and some garbage characters get typed on the control and if i remove urdu or arabic languages from languagebar the application works well,
i am unable to get the reason......plz suggest something..
|
|
|
|
|
1. Have you enabled this language on your computer at first place?
2. If 1 is done, then is your application Unicode ENABLED?
3. If 2 is true, then what do you mean by your CRichEdit control garbage characters get printed?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
thx Anshuman
let me ans ur questions.
1.the problem comes only when i set urdu or any other arabic language in language bar.and which one comes first in language bar it sets on writting first character on the control.
2.yes my application is uicode enabled.
3. the richedit i hav used is CRichEditCtrl50W (msftedit.dll)and i also tried riched20.dll but it is also giving the same result.
3. the first char is correct and then the gargage valus come like ..for the word "sharma"
ث ە / ۹ ە
|
|
|
|
|
dear gurus,
i want to parse all h-files (may be also cpp-files) of my project to get out the dependency-graph.
Do you have some idea how to do it? Are there any working components available?
Thanks
|
|
|
|
|
I guess the source to do this must be available as part of doxygen, the Open Source C++ documentation generator available on Sourceforge and probably elsewhere. It obviously does a lot more than just a dependency-graph though so it might be more trouble to pull out what you need than to write it from scratch.
You could look into starting out with Flex and Bison ( Windows versions of Unix Lex and Yacc also available as C++ sources ) to generate a simple parser that only processes #include s.
On the other hand if you have VS2005 or better you could just turn on Show Includes in the Advanced options for your project and you'll get a build output window filled wiht the entire inclusion hierarchy. Makes you appreciate how fast even MS compilers really are when you see the hundreds of files that get included even in a relatively simple project.
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
Thanks for your points.
I already work with doxygen. It's really good. Unfortunately I have only a graphical output.
What I now need is a "graph-like" output-structure which I can parse by myself to automate physical-design issues
Kind regards
|
|
|
|
|
If you're already familiar with doxygen then I'd suggest perhaps building a modified version that outputs xml to a file of your choice in parallel to its normal output. That way you can keep the existing doxygen parsing. All you need to find is the points in the code where doxygen processes #include s, make sure you've got a reasonable version of msxml.dll in memory and the rest is a little bit of COM, some tables of tag strings and should hopefully be straight forward. Of course if you can architect it as some sort of plugin/addon module/patch for doxygen then you can contribute it back to the community and make the world a little better for all your hard work
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
Unfortunately I'm only familiar with using the doxygen binary - not the source-code
|
|
|
|
|
I'm using vc6, windows xp2,
But I encounter "unresolved external symbol" problem when link with code below.
<br />
#include <shlwapi.h><br />
<br />
TCHAR szBuf[MAX_PATH] = {0};<br />
::GetModuleFileName(NULL, szBuf, sizeof(szBuf)/sizeof(szBuf[0]));<br />
::PathAddBackslash(szBuf);<br />
::PathAppend(szBuf, _T("no2.swf"));<br />
::PathFileExists(szBuf);<br />
</shlwapi.h>
I tested the code in vs2008 express edition too, It has the same problem.
Please help me.
|
|
|
|