|
Windows explorer shows a tooltip if the contents of a column is not entirely visible. I'm trying to emulate that behaviour but when I move the tooltip to cover the clipped text I end up with a flashing tooltip. This seems to be because the tooltip is now under the cursor which causes it to be closed immediately which leaves the cursor back over the clipped text which fires the tooltip and around we go.
Has anyone run into this before and found a solution?
|
|
|
|
|
Just a guess but try adding the WS_EX_TRANSPARENT style to your tooltip and see if it changes anything, don't know what it might screw up though...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
I tried something like this, but no success:
SendMessage(WM_SYSKEYDOWN, VK_MENU,NULL);
Any ideas?
modified on Tuesday, May 11, 2010 10:32 AM
|
|
|
|
|
Don't know what exactly you wish to achieve, but could SendKeys[^] do the job?
[EDIT] Oups, that link should be keybd_event[^], not SendKeys...[/EDIT]
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
modified on Tuesday, May 11, 2010 11:57 AM
|
|
|
|
|
keybd_event worked for me. I just thought by doing SendMessage would do the same thing. Oh well...
|
|
|
|
|
Oups, i just noticed, i pasted the wrong link there in my post, in fact i meant keybd_event[^] too...sorry, but i guess you got it already.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
#include <iostream>
#include <string>
using namespace std;
class CBuffer
{
char * m_pBuffer;
int m_size;
public:
CBuffer()
{
m_pBuffer=NULL; }
~CBuffer()
{
Free();
}
void Allocte(int size) (3) {
m_size=size;
m_pBuffer= new char[size];
}
private:
void Free()
{
if(m_pBuffer!=NULL)
{
delete m_pBuffer;
m_pBuffer=NULL;
}
}
public:
void SaveString(const char* pText) const
{
strcpy(m_pBuffer, pText);
}
char* GetBuffer() const
{
return m_pBuffer;
}
};
int main ()
{
CBuffer buffer1;
buffer1.SaveString("Microsoft");
printf("%s", buffer1.GetBuffer());
return 0;
}
|
|
|
|
|
And what is the problem exactly ?
|
|
|
|
|
|
What I meant is: try to give more details. "It doesn't work" is way too vague. Did you have a compilation error, a run-time crash, your computer exploded, ... ?
Keep in mind that we can't see what's on your screen.
|
|
|
|
|
wbgxx wrote: "Microsoft"
?
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]
|
|
|
|
|
In your constructor you set buffer to NULL.
In your main function you just create an instance of CBuffer and call SaveString.
SaveString accesses your buffer (what is NULL), so you get an access violation.
int main ()
{
CBuffer buffer1;
buffer1.Allocate(4096);
buffer1.SaveString("Microsoft");
printf("%s", buffer1.GetBuffer());
return 0;
}
Greetings
Covean
|
|
|
|
|
Maybe he needs a new pair of sneakers?
The wonderful thing about the Darwin Awards is that everyone wins, especially the members of the audience.
|
|
|
|
|
I want to create a round rect button with three image , one for left round, one for middle and one for right round. Middle image I m rendring according to with of button, but I don't know how to use the both side images so that my button sud look like reound rectangular.
Here is my code to render the middle image.
void CRoundButton2::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
// Get DC of Item
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
ASSERT (pDC != NULL);
// Should Buttons be generated?
bool bGenerate = !m_rBtnSize.EqualRect(&lpDrawItemStruct->rcItem) || m_bRedraw;
// If Rectangles of Button are not the same
if (bGenerate)
{
// Generate Bitmap to hold Buttons
GenButtonBMPs(pDC, lpDrawItemStruct->rcItem);
// Redraw done
m_bRedraw = false;
}
// Generate DC to draw in Memory
CDC *MemDC = new CDC();
MemDC->CreateCompatibleDC(pDC);
HGDIOBJ hOldBmp = MemDC->SelectObject(m_tBmpBtn);
CString sActualCaption;
// Get actual caption
GetWindowText(sActualCaption);
// Check, if caption has changed
if (sActualCaption != m_sOldCaption)
bGenerate = true;
// Store old caption
m_sOldCaption = sActualCaption;
// If Rectangles of Button are not the same
if (bGenerate)
{
// Draw Buttons
DrawButtonFace(MemDC);
// Draw Button-Caption
DrawButtonCaption(MemDC);
}
int nButtonState;
nButtonState = BS_ENABLED;
if (m_bIsHotButton && m_bMouseOnButton)
nButtonState = BS_HOT;
if ((lpDrawItemStruct->itemState & ODS_DISABLED) == ODS_DISABLED)
nButtonState = BS_DISABLED;
else
{
if ((lpDrawItemStruct->itemState & ODS_SELECTED) == ODS_SELECTED)
nButtonState = BS_PRESSED;
else
{
if (this->m_bIsChecked)
{
nButtonState = BS_CLICKED;
}
}
}
CBitmap bitmap2;
bitmap2.LoadBitmap(IDB_BITMAP1);
BITMAP bmpInfo;
bitmap2.GetBitmap(&bmpInfo);
CBitmap* pOldBitmap = MemDC->SelectObject(&bitmap2);
//int nX = m_rBtnSize.left + (m_rBtnSize.Width() - bmpInfo.bmWidth) / 2;
//int nY = m_rBtnSize.top + (m_rBtnSize.Height() - bmpInfo.bmHeight) / 2;
// Copy correct Bitmap to Screen
for ( int i = 0 ; i<117 ; i++)
{
MemDC->SelectObject(bitmap2);
pDC->BitBlt(0+i,0,bmpInfo.bmWidth,bmpInfo.bmHeight, MemDC,0, 0, SRCCOPY);
//MemDC->SelectObject(hOldBmp);
MemDC->SelectObject(pOldBitmap);
}
UINT state = lpDrawItemStruct->itemState; //Get state of the button
if ( (state & ODS_SELECTED) ) // If it is pressed
pDC->DrawEdge(m_rBtnSize,EDGE_SUNKEN,BF_RECT); // Draw a sunken face
// else
// pDC->DrawEdge(rt,EDGE_RAISED,BF_RECT); // Draw a raised face
}
Please help me out..
Thanks in Advance
|
|
|
|
|
Dear All,
I am unable to use the Api ::CreateFileMapping(...) in Windows7 Version and Vista for Elivated User.
Please give me solution for this.
Thanks & Regards,
Uday.
|
|
|
|
|
|
char *my_strcpy(char *p1, char *p2)
{
if (p2 == NULL )
return p1;
if (p1 == NULL)
return 0;
else
{
char *pp1 = p1;
char *pp2 = p2;
while (p2 != '\0')
{
*p1++ = *p2++;
}
*pp1 = '\0';
}
return p1;
}
Is there something wrong in my function and why? Thanks in advantage
|
|
|
|
|
char *my_strcpy(char *p1, char *p2)
{
if (p2 == NULL )
return p1;
if (p1 == NULL)
return 0;
else
{
char *pp1 = p1;
char *pp2 = p2;
while (p2 != '\0')
{
*p1++ = *p2++;
}
*pp1 = '\0';
}
return p1;
}
|
|
|
|
|
wbgxx wrote: Is there something wrong in my function
Have you tested it? What makes you think there's something wrong with it?
|
|
|
|
|
sorry,I can not test it ,can you tell me how to do it ?
|
|
|
|
|
wbgxx wrote: sorry,I can not test it ,can you tell me how to do it ?
Well, how do you intend to become a developper ??
Anyway, you have a couple of choices.
- simulate it on paper (run it by hand, line by line with a pencil and some paper).
- run it in a debugger (Visual Studio has a good one).
Max.
Watched code never compiles.
|
|
|
|
|
|
Well try stepping through it with your eyes (aka reading) one line at a time. Then when you get to the line that reads
*p1++ = *p2++;
ask yourself what is the purpose of pointer pp1 . This looks a bit like the sort of confusion that arises from not using useful variable names.
It's time for a new signature.
|
|
|
|
|
The first two if() tests are not necessary. Also, pp2 is not necessary.
wbgxx wrote: while (p2 != '\0')
This will not terminate like you want it to.
Richard hints at the last piece of the puzzle.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
I have the following weird problem on customer's computer (I cannot look in there and debug):
OS: WinXP
Application: MFC app on Visual C++ 6
There is a simple CDialog-based dialog that always worked OK. But on one of customer's computers the dialog hangs as soon as it is called. I managed to gather dump on it, and this is what I see in Call Stack:
ntdll.dll!_KiFastSystemCallRet@0()
user32.dll!_NtUserDispatchMessage@4() + 0xc bytes
user32.dll!_DispatchMessageW@4() + 0xf bytes
mfc42u.dll!CWinThread::PumpMessage() + 0x3a bytes
mfc42u.dll!CWnd::RunModalLoop() + 0xc6 bytes
mfc42u.dll!CDialog::DoModal() + 0xc7 bytes
If I understood memory dump right, the message id is WM_PAINT. So the dialog probably receives endless WM_PAINT messages and is busy redrawing itself. Why is that? As I said, this is simple About dialog that worked well million times.
|
|
|
|