From: Jack T. on 1 Jan 2010 12:13 Read my follow up post. I realized I answered the wrong question. "MikeD" <nobody(a)nowhere.edu> wrote in message news:%23OHCvSwiKHA.4872(a)TK2MSFTNGP05.phx.gbl... > > I don't see where that in itself changes the font's color. Also, you > omitted some important information in that you must destroy the font > resource by calling DeleteObject. > > -- > Mike > > > "Jack T." <anywhere(a)anywhere.com> wrote in message > news:#6x29DwiKHA.1236(a)TK2MSFTNGP04.phx.gbl... >> Yes >> >> hFont = CreateFont(13, 0, 0, 0, 700, 1, 0, 0, 1, 0, 0, 0, 0, "Verdana") >> >> SendMessage statusbar.hwnd, WM_SETFONT, hFont, ByVal True >> >> >> "LondonLad" <LondonLad(a)discussions.microsoft.com> wrote in message >> news:47FE43E7-0895-45BF-B0CA-A61C10941FA8(a)microsoft.com... >>> Hi MikeD >>> >>> Q. Would it also be possible to change the font color in the statusbar? >
From: C. Kevin Provance on 1 Jan 2010 12:21 "MikeD" <nobody(a)nowhere.edu> wrote in message news:uSFbBFwiKHA.1236(a)TK2MSFTNGP04.phx.gbl... | Not that I know of. There is no message for setting the text color. If you | can make a StatusBar owner-drawn, then maybe...but I don't see anything in | its documentation for making it owner-drawn. You could probably fake it by | overlaying a picture box and then either printing directly onto the picture | box or using Label controls contained in the picture box. But it's not | something I would really recommend. For that matter, I really don't even | recommend changing the backcolor except for short durations to temporarily | bring attention to something in the status bar. It can be done with subclassing. In a nutshell, subclass the statusbar for WM_DRAWITEM + CCM_FIRST. Copy the lp to a DRAWITEMSTRUCT (uDIS). The panel item would then be uDIS.itemID + 1. Then changing the backcolor and text can be done in one stroke. CopyRect the uDIS.rcItem to a RECT type. SetTextColor using uDIS.hDC and the desired forecolor. Then CreateSolidBrush and FillRect to set the backcolor. Now the actual text will have to be drawn, so the RECT type should be adjusted as necessary +/- 3 or however long one might want the indent to be. SetBkMode to 1 and then DrawText with whatever flags desired. Doing this also requires trapping WM_PRINTCLIENT and WM_ERASEBKGND and eating them. Of course, all of this assumes the OP knows his stuff. I didn't bang out all the code since it requires subclassing and each person uses their own method. I encapusulated all of this in a class module so I could handle each property properly (and used Karl's IHookSink to do all the subclassing. Piece of cake. :-)
From: Karl E. Peterson on 8 Jan 2010 18:13 After serious thinking Nobody wrote : > Use "ByVal 1&" to pass TRUE to API functions. Most API functions use 0 for False, and <>0 as True, though, just as VB does. Occassionally you run across the dipsh!t subsystem coder who tested for a specific value, but those are very rare. -- ..NET: It's About Trust! http://vfred.mvps.org
From: MikeD on 9 Jan 2010 07:20 "Karl E. Peterson" <karl(a)exmvps.org> wrote in message news:eSbm5gLkKHA.1864(a)TK2MSFTNGP05.phx.gbl... > After serious thinking Nobody wrote : >> Use "ByVal 1&" to pass TRUE to API functions. > > Most API functions use 0 for False, and <>0 as True, though, just as VB > does. Occassionally you run across the dipsh!t subsystem coder who tested > for a specific value, but those are very rare. > Yes, but there's really no way of knowing which API functions specifically are coded to be 1 and which are coded to be <>0; so, to be safe, it's best (at least IMO) to always use 1 for an API TRUE. Not -1 and not VB's intrinsic True. -- Mike
From: Ralph on 9 Jan 2010 07:52 "MikeD" <nobody(a)nowhere.edu> wrote in message news:OTapwYSkKHA.5076(a)TK2MSFTNGP05.phx.gbl... > > > "Karl E. Peterson" <karl(a)exmvps.org> wrote in message > news:eSbm5gLkKHA.1864(a)TK2MSFTNGP05.phx.gbl... > > After serious thinking Nobody wrote : > >> Use "ByVal 1&" to pass TRUE to API functions. > > > > Most API functions use 0 for False, and <>0 as True, though, just as VB > > does. Occassionally you run across the dipsh!t subsystem coder who tested > > for a specific value, but those are very rare. > > > > Yes, but there's really no way of knowing which API functions specifically > are coded to be 1 and which are coded to be <>0; so, to be safe, it's best > (at least IMO) to always use 1 for an API TRUE. Not -1 and not VB's > intrinsic True. > Actually the only thing you can be sure about is that zero, null, nul, and 'empty' is false and anything else is true. But this is only of any real interest when examining the result from comparison operators, in which case assuming a result of "1" as true will always get you into trouble sooner or later. Confusing "Success" with True and False will also get you into trouble. All functions in the Win32 API, and those libraries not formally in Win32API, but considered as part of the Windows API, clearly document what is expected. -ralph
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: Problem updateing an Access database Next: Serial VS USB |