|
|
overide the WM_CTLCOLOR message and put the following code inside it
if( nCtlColor == CTLCOLOR_STATIC)
{
pDC->SetBkMode( TRANSPARENT );
}
this make the text backGround transparent.
To change the color use pDC->SetBkColor( RGB(0,255,0)); instead of SetBkMode
nave
|
|
|
|
|
Naveen R wrote: if( nCtlColor == CTLCOLOR_STATIC)
{
pDC->SetBkMode( TRANSPARENT );
}
Groupbox is not a static control but a button control with style BS_GROUPBOX .
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
It's the button style, but its CTLCOLOR classification is CTLCOLOR_STATIC not CTLCOLOR_BTN
It seems that what naveen said was correct.
SaRath.
"It is your attitude, not your aptitude, that determines your altitude - Zig Ziglar."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
SaRath C wrote: CTLCOLOR_STATIC not CTLCOLOR_BTN
whitesky
|
|
|
|
|
I created one static class for it
whitesky
|
|
|
|
|
WhiteSky wrote: I created one static class for it
just for changing the color?
nave
|
|
|
|
|
ah no?, write one class for mimimimilaw
whitesky
|
|
|
|
|
Try it creating a sample application...
I am sure my code will work....?
nave
|
|
|
|
|
I wrote one example for you and i change background color from groupbox
whitesky
|
|
|
|
|
get the dc and make it transparent.
hello
|
|
|
|
|
I want to develop an MFC application that has
1. Either a control bar or dialog bar which has some button objects
2. The bar needs to be always accessible. That means I want to be able to click on the buttons on the bar even if a modal dialog showing.
One way I thought of to put the dialog bar in its user thread, but this is almost impossible as it dialog bar needs to send a message to the main windows. Another way was not to show modal dialogs, but this would complicate the design as to manage the number of different dialogs to be displayed.
Any thought as to how to put a controls bar/dialog bar/or even a child windows on its own thread that can always listen to user actions? A pointer to an article or sample code would be great.
Thanks,
/* I can C */
// or !C
Yusuf
|
|
|
|
|
I didn't get the exact situation over there. I will put my suggestions.
If you want to keep the UI alive, It is best to keep it in a separate UI thread and keep posting messages. There is always a defenite way to do that.
Also the use of Modal dialog demands the user to deal with the dialog ,and with nothing else when it is shown. You still have chances of improvement over here.
Sher
|
|
|
|
|
Thanks Sher,
The whole UI doesn't need to be alive, but a portion of it needs to be alive all the time. Think it this way, I want my toolbars to be alive all the time.
I started looking into creating my toolbar as a CDialogBar item which will run in it's own CWinThread. I though this will isolate it from the whole UI message loop. Since the CDialogBar object is created inside the CFrameWnd object, whenever the main UI is blocked, so does goes the second CWinThread which has my CDialogBar object.
I could create my CDialogBar as a child of the Desk top, which solves the blocking issue, but it lives outside the main UI frame, which does not meet my requirement.
Any idea as to how I might be able to solve this?
/* I can C */
// or !C
Yusuf
|
|
|
|
|
DoModal will block its parent by PreModalDialog API and releases using PostModalDialog
Have you tried modeless dailogs?
SaRath.
"It is your attitude, not your aptitude, that determines your altitude - Zig Ziglar."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
Yes I thought of modeless dialogs. But there is AfxMessageBox() which acts as modal dialog.
I though overriding PreModalDialog(), DoModal() to prevent the main UI from being blocked. it turns out, I will need to handle more cases, and alost have my own CDialog code.
Hmm, I guess I might be trying to do the impossible?
/* I can C */
// or !C
Yusuf
|
|
|
|
|
I'm studying and coding in MFC about Text To Speech in Microsoft Word. I need to find Materials of Text To Speech to present what I'm studing. What page or what material can I find ?
Thanks.
|
|
|
|
|
Use Microsoft speech API in MSDN
Also You can find materials at IBM(IBM's Speech APIs and ViaVoice Documentation).
Herbert
|
|
|
|
|
I don't know Signal Strength.
I codding Signal Strength and no error , run but discontinue.
Why discontinue program. Please Signal Strength program.~~
IWbemServices *pSvc = NULL;
IEnumWbemClassObject * pEnumerator = NULL;
HRESULT hres = pSvc->ExecQuery(bstr_t("WQL"), bstr_t("SELECT * FROM MSNdis_80211_ReceivedSignalStrength Where active=true"),
WBEM_FLAG_FORWARD_ONLY || WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumerator);
IWbemClassObject *pclsObj;
ULONG uReturn = 0;
while (pEnumerator)
{
HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj,
&uReturn); //WBEM_INFINITE
if(0 == uReturn)
{
//cout << "Need to BREAK!" << endl;
break;
}
VARIANT vtProp;
VariantInit(&vtProp);
// Get the value of the Name property
hr = pclsObj->Get(L"Ndis80211ReceivedSignalStrength", 0, &vtProp, 0, 0);
// wcout << " OS Name : " << vtProp.bstrVal << endl;
VariantClear(&vtProp);
}
|
|
|
|
|
Hey Guys,
Using the Win32 API, how do I change the text and color in a button once it is clicked? I have tried looking on MSDN and on google, but the process appears to be more complicated than I believe it seems.
I can change the text using SetDlgItemTxt but when using SetTextColor it does not change the color of the text (my guess is that the button is not being redrawn with the new COLORREF parameter).
All I picked up from MSDN is that I have to create a new brush, destroy the dialog control, re-create it with the new text in a different color and then destroy the brush. I dont think its that complicated and hopefully someone can steer me on the right path.
Thanks,
Robbie
|
|
|
|
|
Google and MSDN eh???
Did you look here: http://www.codeproject.com/buttonctrl/[^]
I'm almost 110% postive you'll find a custom control or article which explains just what you want
Cheers
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
|
I want to implement in Visual C the DOS command "attrib" - to change files attributes such as: read-only, hidden, system. How can I do this?
|
|
|
|
|
|
See Here[^] maybe it is some helpful to you
whitesky
|
|
|
|
|
Hello there.
I am writing picture editor and I have a problem with saving images to the same file.
Of course I can save them to the different file names, but not to the original filename.
So I've searched and found a page where are couple of steps that I have to do.
1. Open the image file
2. create a temporary in-memory image the same size as the original
3. obtain a Graphics object for the temporary image
4. Draw the original image onto the temporary one
5. dispose of the original
6. do any drawing you'd like on the image using the Graphics you have
7. Dispose of the Graphics
8. Write the temporary file to any filename and any format you please including the same name and format if you wish.
The idea is clear to me, and I know what I have to do, but I have one problem.
There is no such function as Dispose() in GDI+. It is in MFC of course, but not in GDI and I don't know how to "Close the file" so I can save the image under the same filename.
I've tried CloseHandle(HANDLE) function, but it seems it doesn't work.
Can anybody help me with this ?
soyo
|
|
|
|