Tooltip disappears too fast in layered window

Hello,

I have a (MFC) layered window that I create like this:

DWORD dwExStyle = 0;

#ifdef USE_LAYERED_WINDOWS
    dwExStyle |= WS_EX_LAYERED;
#endif

    BOOL bOK = CreateEx (   dwExStyle,
                        AfxRegisterWndClass (0, NULL, NULL, 
AfxGetApp()->LoadIcon (IDR_MAINFRAME)),
                        _T("Window caption"), WS_POPUP | WS_SYSMENU, rect, 
NULL, 0 );

    if (!bOK)
        return FALSE;

#ifdef USE_LAYERED_WINDOWS
        SetLayeredWindowAttributes  ( GetSafeHwnd(),  RGB(255,255,0),  255, 
LWA_COLORKEY) ;
#endif


Whether the window is layered or not depends on whether USE_LAYERED_WINDOWS 
is defined.

After the window is created, I create a child listview control (MFC 
CListCtrl class), in Report view.  It has the LVS_EX_LABELTIP style so that 
the tooltip should appear if the mouse is hovered over a subitem that is 
truncated.  This works fine if USE_LAYERED_WINDOWS above is not defined 
(i.e. the window is not layered).  But if it is defined, then the tooltip 
appears briefly, but disappears about 0.1 seconds later! The only time it 
displays normally is if I hover over the first (leftmost) pixel of the text, 
or if I hover over the icon in the first column.

What could be causing the tooltip to disappear?  I know layered windows work 
by using off-screen DC's.  Do tooltips also do this also?

Thanks for any help.  I'm very perplexed.

-- David


0
dc2983 (3206)
9/3/2005 11:57:32 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
1096 Views

Similar Articles

[PageSpeed] 29

Hi,

Well, if USE_LAYERED_WINDOWS is defined, then dwExStyle should
equals the window style WS_EX_LAYERED, otherWise dwExStyle will
have a zero value initialize. Also, you could create the layered
window directly withOut the conditional text (#ifdef....#endif),
especially if you want to create a layered window, try this:

	CreateWindowEx(WS_EX_LAYERED, .............);
	UpdateLayeredWindow()

According to microSoft, when creating a layered window, it is more
efficient to use the API UpdateLayeredWindow(), especailly since the
API SetWindowLayeredAttributes() uses more memory for its reDirection
handling of a layered window, which tends to have a delay factor.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/updatelayeredwindow.asp

Hope these information helps,

Kellie.

0
9/4/2005 7:09:15 PM
"Kellie Fitton" <KELLIEFITTON@YAHOO.COM> wrote in message 
news:1125860955.957850.294450@g43g2000cwa.googlegroups.com...
> Hi,
>
> Well, if USE_LAYERED_WINDOWS is defined, then dwExStyle should
> equals the window style WS_EX_LAYERED, otherWise dwExStyle will
> have a zero value initialize. Also, you could create the layered
> window directly withOut the conditional text (#ifdef....#endif),
> especially if you want to create a layered window, try this:
>
> CreateWindowEx(WS_EX_LAYERED, .............);
> UpdateLayeredWindow()
>

Thanks Kellie.  The USE_LAYERED_WINDOWS was a quick way of flipping the 
layered window style on and off to illustrate the problem only occurs with 
it turned on.


> According to microSoft, when creating a layered window, it is more
> efficient to use the API UpdateLayeredWindow(), especailly since the
> API SetWindowLayeredAttributes() uses more memory for its reDirection
> handling of a layered window, which tends to have a delay factor.
>

I'd love to use UpdateLayeredWindow(), especially since it supports 
per-pixel alpha transparency, and SetLayeredWindowAttributes() doesn't.  The 
trouble is, UpdateLayeredWindow() doesn't support the window having child 
windows in it.  The child windows aren't painted at all if you use 
UpdateLayeredWindow().  So if you want a layered window with child controls, 
you have no choice but to use SetLayeredwindowAttributes().

-- David


0
dc2983 (3206)
9/4/2005 7:28:20 PM
Reply:

Similar Artilces:

PB 5.0 on Windows 7 (x64)
Hi, We are having problems installing PB5 on a pc with Windows 7 x64. The installations fails at the end and the installation rolls back. (Before the PB installtion Visual 2005 and 2008 had been successfully installed on the pc.) Is it possible installing/running PB5 on Windows 7 x64? If not, is the problem x64 or Windows 7. I've seen reports of problems on Windows Vista x64. Thanks, Jojje See this post regarding PB6. I presume that PB5 has a similar problem. http://groups.google.com/group/microsoft.public.windowsce.platbuilder/brows= e_thread/thread/f8d26b911240e6bb/2...

Fast Food Users
I would like to know if there are any RMS users out there that utilize the RMS software in a Fast-Food application. I need a refference for the RMS software using that type of application. cthompson@adctech.com 909-923-5268 ...

How to keep MDI window size while cascading?
My application sets all MDI child windows to new size while cascading. What can I do to keep their sizes? ...

Windows Service won't start
Hi all, I going thru the MCSD course and I am creating a Windows Service. The Service compiles with no errors and I can install it using "Installutil" with no problem. But when I go into Services and try to start it I get the following error message. "Could not start the RemoteAccessAgent service on Local Computer. Error 193: 0xc1" Does anyone know what this is and how to fix this? Thanks in advance for your reply. Larry Hurlbert --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.556 / Virus Database: 348 ...

Cumulative Security Update for Internet Explorer 8 for Windows XP
Last night I was going about my regular buisness of (after work) getting on and vegging in fron of my laptop while I watch TV. An update came around (mind you everything was working fine yesterday) which was: Cumulative Security Update for Internet Explorer 8 for Windows XP (KB980182). Now for some reason I can't access yahoo.com or lotro.com? These two sites are the only ones that I can't seem to access for some reason? I have tried to search for malicious spyware and viruses nothing comes across (McAfee, and Malewarebytes) I have tried to System restore to a date I ...

Outlook 2003 won't start under Windows 7
Reinstalled Office 2003 after converting to W7. This error message appears immediately after starting OL: "Unable to open your default e-mail folders. The information store could not be opened." Try; Start Run Outlook.exe /resetnavpane (space between exe /) "Kay" <Kay@kayknapp.com> wrote in message news:eYf7cZufKHA.2184@TK2MSFTNGP04.phx.gbl... > Reinstalled Office 2003 after converting to W7. This error message > appears immediately after starting OL: > > "Unable to open your default e-mail folders. The information store ...

Windows Vista File Backup / Restore
Can anyone help. I've had a drive partition fail and, after a couple of days work (and a new drive), need to restore ALL the files from the original partition from my backup(s). I'm not clear how I do this... I assume Vista does Incremental Backups between Full Backups...? In which case I need to restore my (most recent) Full Backup followed by my Last Backup? Only problem is, I cant see, from the Vista Restore utility, which was my most recent Full Backup! Help. Thanks Mark ...

Windows Media Center ??
Is it possible to run windows Media center under windows xp- pro ? The links that I can find seem to want you to up grade to windows 7 ... there are some old posts to downloads for the center .. but these seem to be now upgraded to windows 7 I have a hap TV card .. which requires the media center to use the dual tuner facility .. not - windows media player .. this is not suitable tnx - G . WinXP MCE and WinXP Pro are pretty much (but not quite) the same thing. If your hardware is compatible, you might consider "upgrading" to ...

KB 91185 won't install from Windows Update
Like a few questions before this one, the 'HID non-user input data filter' updates {2 of them} seem to fail. I did hide them, but now it seems the 2 USB ports on the outside of my tower, no longer work! The 2 on the back of the tower work: they have an optical keyoboard and a printer...both work. When I use devmgmt.msc and disable them, nothing. Then I enable and 'scan for hardware changes', and it seems to put them 'back', but then says there's an error with the ''HID non-user input data filter' again? So I guess I need the fixes, but.....

difficult parent window problem in CDialog::Create / ::AfxGetMainWnd
I am creating two modeless dialogs which are first not displayed. In the constructor of the dialogs I call CDialog::Create(IDD,pParent). When I create the dialogs, I don't have any parent window, because I first only store data there, so I supply NULL as parent window. Later I'll show one of the two dialogs using ShowWindow(SW_SHOWNORMAL). In a new instance I'm doing the same again (create two dialogs, NULL as parent). Then I show one of them. The problem is now that when the first active window closes, then the window of the new instance also closes. As I found out, CDialo...

Windows browser Parent/Child structure
This is a multi-part message in MIME format. ------=_NextPart_000_0014_01C71608.002B0FC0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Is it possible to setup a cell structure such that when I click on it a = "Windows browser Parent/Child structure" opens and closes? Similar to the folders with the "-" and "+" signs of the browser? His = means that an entire set of rows appear or disappear by clicking on the = cell? If so, could you please point me in the right direction so I can do = this. Thanks Erich ...

Microsoft Exchange options missing from the windows backup utility
Im trying to use ntbackup installed in serverA (windows 2003) to backup a exchange server in serverB (windows 2003 SP1) A Exchange Servers Folder doesnt appear in ntbackup, then I have Exchange System Manager in serverA installed but still..the Exchange Servers Folder doesn't appear. some idea ? does the account you're logged on with have sufficient Exchange permissions? -- Susan Conkey [MVP] "Alexander Wolff" <AlexanderWolff@discussions.microsoft.com> wrote in message news:A7FFD6EA-10CA-42C2-9A46-92EED4FA16E2@microsoft.com... > Im trying to use ntbackup i...

windows live e-mail problem
Just recently, I can't drag my e-mails from my inbox to my folders. How do I fix this problem?? I'm using Winsows 7 I'm having similar issues. I can't drag. I can't delete. When I try, I get the same error message "an unknown error has occurred". And I only have this problem with my MSN email accounts. Anyone have any ideas on how to correct this? "nittenkitten" wrote: > Just recently, I can't drag my e-mails from my inbox to my folders. How do I > fix this problem?? I'm using Winsows 7 On Tue, 31 Aug 2010 20:34:...

Windows Mail stopped connecting to the server
Your server has unexpectedly terminated the connection. Possible causes for this include server problems, network problems, or a long period of inactivity. Account: 'pop.att.yahoo.com', Server: 'pop.att.yahoo.com', Protocol: POP3, Port: 995, Secure(SSL): Yes, Error Number: 0x800CCC0F Vista x64 Ultimate overnight windows mail stopped connecting to the server. I installed C# express, VB Express, Python 2.6, and VB6 run times last night. I've tried disabling all virus scanning on the off chance that was blocking itbut no luck. Anyone got any ideas? The...

help needed splitter window
hi I want to show 7 panes in splitter windows. seperate views in each pane. I know only up to 4 panes can anybody help me with regards Harish hi I want to show 7 raws and 1 col. can anybody help me with regards Harish "Harish" <harish.k at sify.com> wrote in message news:e5#nJVJ8DHA.3112@tk2msftngp13.phx.gbl... > hi > > I want to show 7 panes in splitter windows. > seperate views in each pane. I know only up to 4 panes > > can anybody help me > > with regards > Harish > > > Harish wrote: > hi > I want to show 7 raws and...

Moving from Windows
I'm about to buy my first Mac--dual core, either portable or desktop. As a longtime Windows user I'm just wondering about the many Office files I have on my current system. Will they, basically, be "readable" on the Mac version of Office if I buy whatever the current version is? Having heard that a lot of Mac programs can read Windows files, I'm thinking of buying a large external hard drive and copying all of my files over to it for later use on the Mac if this is possible. Is it? Thanks, Tim Yes it is. Get Office 2004 for Mac, it should be able to handle ...

phone numbers & addresses header disappear (customized contact)
Hi all, I tried to customized the contact form from the standard library. exchange 2003/outlook2003 envir. I just drop one (or any) user defind field from field chooser to the contact design form. I just test and run this form and the Phone Numbers________________________ Addresses___________________________ Do not appear in the header anymore. Is this supposed to be? What's the solution to this? Thank you very much! What do you mean by "header"? In the meantime, you might want to get familiar with the quirks of custom contact forms; see http://www.o...

Book for a windows/c++/mfc beginner...
Hi, I have previous coding experience, but not in the windows environment and not in C/C++. I have just got a copy of MS Visual C++ Express and want to learn how to code C++ for Windows. As I understand it I need to use MFC for the windows stuff, and without it Visual C++ would just be command prompt based? Is that correct? If so then I need a book that teaches me MFC and C++, preferably in the Visual C++ environment... Which is the best book/books for this? Thanks. anon418600J5 wrote: > Hi, > > I have previous coding experience, but not in the windows environment and...

Word file is not opening. Windows cannot find it..
While using word on my computer I have been getting this message. Windows cannot find 'C: /Users/XXXXXX/Desktop/Folder name/Resume.docx' (XXXXXX to protect name). Make sure you type the name correctly, and then try again. The only way I can get it open is to open word then select the file again from its location. Any help would be appreciated. Do you have any add-ins installed? Try running Word in Safe Mode to see if that resolves the problem, then remove any problematic add-ins. You can open any Office or Office family program in Office Safe Mode by pressing CTRL whi...

Unable to send messages in Outbox of Windows Mail
I get error message "Unable to find Google" I have correctly set up for Pop3 account (I think) with default port etc. I can receive messages sent from Google or other sources but they go into the Outbox of Windows mail. That's as far as I can get. What am I doing wrong or failing to do??? "Dodobird" <Dodobird@discussions.microsoft.com> wrote in message news:FA472169-B5A6-440F-AAC6-EAF72174C3C6@microsoft.com... >I get error message "Unable to find Google" I have correctly set up for >Pop3 > account (I think) with default port etc. I can r...

emails disappear after forwarding
I have windows 2007 which I was happy with but just recently any email when forwarding completely disappears and is los from both the inbox and the deleted items. I have checked my settings but can't rectify ...

how to put up 5 PCs with Windows XP and 7?
Hi, I have 3 PCs with Windows XP and 2 windows pc 7. I find it difficult to network to share folders between them. How can I network? thanks ... ...

Windows update installation problem under Windows 7 64 bit
This morning I noticed a message in the Action Center saying that there had been a "Windows Update installation problem" dated two days ago. A Windows update did not install properly, it said. I checked my system and application logs for the past week and found no error messages. I checked Windows Update history and I did an update for Internet Explorer 8 on 1/23, two days earlier, that it said completed successfully. I do see there is an Internet Explorer 8 update to be installed.still and am assuming that must be *again*? So I am confused. Do I have a problem or not? How do...

Tooltips for a toolbar in a dialog box
I have placed a toolbar in a dialog box. How do I get tooltips to appear? Use the style: CBRS_TOOLTIPS when you create the toolbar. Tom "William Gower" <w_gower@hotmail.com> wrote in message news:%23qb604yIEHA.1944@TK2MSFTNGP11.phx.gbl... > I have placed a toolbar in a dialog box. How do I get tooltips to appear? > > ...

Windows Email Programs
Are there two different Windows Mail programs --- or just one? Windows Mail versus Window Live Mail ?? Two different mail programs.=20 Windows Live Mail is a free download, and it runs on Windows XP,=20 Vista, and Windows 7. Windows Mail is not a download, it is included with Vista and only=20 runs on Vista.=20 --=20 Gary VanderMolen, Microsoft MVP (Mail) Microsoft MVP Program: http://mvp.support.microsoft.com "BryceV" <BryceV@discussions.microsoft.com> wrote in message = news:07A027BC-E562-41E4-B7AB-4179B33CA561@microsoft.com... > Are there two differen...