|
Did you try SetBkColor(hDC, color) ?
This should set the text's background and only that. Other parts not covered by text use the parent's background. Try handling WM_ERASEBKGND for the static control and setting a transparent text background, so you have only one place in which you specify the background color.
SetBkMode(hDC, TRANSPARENT) in your WM_CTLCOLORSTATIC to set transparent text.
have fun!
Paolo
|
|
|
|
|
hmm
I already tried this but it does not work...
I am using the following lines of code...
[code]
case WM_CTLCOLORSTATIC:
SetBkMode((HDC) wParam, TRANSPARENT);
break;
[/code]
But it does not change anything..
I hope you can help me with this.
Jakob W.
|
|
|
|
|
Are you returning a HBRUSH?
Try with ::GetStockObject(HOLLOW_BRUSH);
Paolo.
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
how do i get the lenght of the remote http file, before downloading it ?
[code]
define HTTPBUFLEN 512 // Size of HTTP Buffer...
char httpbuff[HTTPBUFLEN];
TCHAR szCause[255];
CString Cause;
CString contentlength;
Cause.Format("YES");
DWORD length;
CInternetSession mysession;
CStdioFile *remotefile = mysession.OpenURL(url,1,INTERNET_FLAG_TRANSFER_BINARY|INTERNET_FLAG_RELOAD);
CFile myfile("C:\\test.txt", CFile::modeCreate|CFile::modeWrite|CFile::typeBinary);
int numbytes;
total=0;
do
{
ProcessMessages();
m_status.Format("%i",total);
UpdateData(FALSE);
numbytes = remotefile->Read(httpbuff, HTTPBUFLEN);
total+=numbytes;
myfile.Write(httpbuff, numbytes);
}while (numbytes);
[/code]
hope you can help me, thanks
|
|
|
|
|
ah yes by the way : GetLength() doesnt work..
|
|
|
|
|
Cast remotefile to a CHttpFile, and use
CHttpFile::QueryInfo(HTTP_QUERY_CONTENT_LENGTH ...)
|
|
|
|
|
I am having problems with giving a toolbar a custom background color. I understand that I have to handle the WM_NOTIFY message with the lParam being a NMTBCUSTOMDRAW pointer, but I can't figure out what to do next!!!! Please could someone show me how its done?
Thanks,
James Bird - birdjames@bigfoot.com
|
|
|
|
|
Hello
how can i add a progress bar to a column of a listCtrl?
(like in Napster)
thanks
|
|
|
|
|
First you need to be able to create a Progress Bar and List w/ CWnd::Create(EX) and not the Dialog editor. Make sure the Progress Bars is the child window of the List in CWnd::Create(EX). The List and Progress Bars created in the dialog editor or subclassing maybe harder to impossible to do. You may want to use array of Progress Bar objects because it maybe easier for moving the Progress Bars when the List is scroll(more on the later). Check MSDN for rect placement and sizeing functions in CListCtrl/CWnd. This placement is for CWnd::Create(EX) only in creating Progress Bars.
Next you find a way to get the to get new rect placement and sizeing after scroll and add/delete items. In CListCtrl placement and sizeing handlers you need to move the Progress Bars. I would add a item and subitem indexs to each object so you can pass then rect placement and sizeing functions in CListCtrl/CWnd then you move the Progress Bar window the window w/ CWnd::MoveWindow(). You will want to set the indexes before CWnd::Create(EX).
This is a general look at some hard stuff. I will try some code next if you need it and if I have time...
Real World Coding:
POP& BuyAPop(Money ADollar){...};
|
|
|
|
|
if u'll post some code, that will be great!
RG
|
|
|
|
|
Use owner-draw or custom-draw.
I wouldn't use child Progress controls. Better to draw the progress bar by yourself. Once you understand OwnerDraw or CustomDraw, that is very easy (just draw a filled rect).
There are some articles here and on CodeGuru, about those techniques. If you're lucky you only have to do some Cut&Paste.
Paolo.
|
|
|
|
|
Hi.
I designed a database as data source for an application I wrote. The
database has about 19 tables and several 1:n relations.
Esspecially one table, that has 2-3 relations, like [Patienten].[Kasse] =
[Kassen].[ID].
Now I'd like to query this table and instead of all the reference longs
should stay the [name] field of the related record.
I know how to do it for one field with an inner join like
'SELECT Name, Vorname, Kassen.Name FROM Patienten INNER JOIN Kassen ON
Patienten.Kasse = Kassen.ID'
But how can I do it for more fields? I can't cascade INNER JOIN, or is it
possible?
Thankfull for any answer...
--------------------------------------------------
"Pseudocode is code to demonstrate a concept, not designed to be run.
Like certain Microsoft software. "
|
|
|
|
|
Don't mind, I found out that cascading inner joins is possible.
--------------------------------------------------
"Pseudocode is code to demonstrate a concept, not designed to be run.
Like certain Microsoft software. "
|
|
|
|
|
|
SetFileAttributes(lpFileName, FILE_ATTRIBUTE_HIDDEN);
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
I have a custom windows message, that I need to map for my MFC project. However, I have NO clue on how to map a custom message, since it obviously doesn't appear in the "standard" list of messages.
Can anyone help?
|
|
|
|
|
If your message ID is a constant, use ON_MESSAGE. If you get the ID by calling RegisterWindowMessage(), then use ON_REGISTERED_MESSAGE.
--Mike--
http://home.inreach.com/mdunn/
"Make sure that if you are using a blow torch that you don't set anything on fire."
-- Chris Maunder
|
|
|
|
|
Hello all,
Could you please help me with this situation?
In the middle of my program, I create a FULL SCREEN TRANSPARENT HIDDEN WINDOW which is TOPMOST. When I click on my left mouse button, I want to retrieve the handle to the window under cursor(next z-order) underneath this transparent hidden window.
I am doing it like this when handling WM_MOUSEMOVE message, it is causing too much flickering.
// A full screen transparent window shows up
// Temporarily ShowWindow(hwnd, SW_HIDE) the full screen transparent window
// GetCursorPos() and do a WindowFromPoint() to get the window under cursor
// ShowWindow(hwnd, SW_SHOW) full screen transparent window
Could you show me how to use WindowFromPoint(), ChildWindowFromPoint(), and ChildWindowFromPointEx() to achieve this without hiding and showing the full-screen transparent window? Or is there any other way to do this? Thank you very much in advance.
|
|
|
|
|
Is it impossible to save and read struct to file if it contain the type CString so:
---------------------------
typedef struct p{
CString name;
int age;
}p
--------------------
p* s = new p;
...
...
file.Write(s, sizeof(p));
|
|
|
|
|
A CString doesn't contain the actual contents of the string, but a pointer to it. So you can't just write a binary copy of the struct to a file. Either use the MFC serialization mechanism or define your own I/O routines for the struct that save and restore the text in the string.
|
|
|
|
|
|
how can i display the progress of the CFptConnection::GetFile() method using the CProgressBar?
thanks
|
|
|
|
|
You wont be able to do it with the CFptConnection::GetFile() method, you'll have to use a combination of CFptConnection::OpenFile() and CInternetFile::Read(). Then all you need to do is a simple calculation based on the file size and the amount that you have downloaded.
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
I'm having a hard time trying to create a new dialog box and getting it to open whenever the program opens in a Dialog Based application in MFC. Can ANYONE help?
I Want Chicken, I Want Liver, Meow Mix, Meow Mix, Please Deliver...
|
|
|
|
|
If you want to show a dialog when the program opens you can declare the dialog instance and the DoModal. Note: This is not the way to create a splash screen.
Ex:
CMyDialog dlg;
dlg.DoModal();
You should include the above code on the PreCreateWindow or similar.
Hope it helped!
|
|
|
|