|
comments for my previous post: m_strExpression is std::string of course...
An idea came across my mind: Maybe its somehow involved with this
Bug fix? But it seems highly unlikely...
Hannes
|
|
|
|
|
I don't think it has to do with that bug --the manifestations are different.
I don't know. It beats me. It's so simple I cannot figure out what more to test. Are you 100% sure m_strExpression doesn't contain whitespace although you've typed it in? How are you checking the actual value of this variable?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
when the child window is moved over the parent window,what message does the parent window receives?
Neha
|
|
|
|
|
That's a tough one!
Here's a tip though - if you have Visual Studio, you'll have a utility called Spy++ - you can use it to hook and display selected messages for a window, in this case the parent. (Use the Window Finder and select Messages).
Once you get Spy++ displaying the messages for the parent, drag your child window over it. You'll find all sorts of interesting stuff.
|
|
|
|
|
The parent window may receive a WM_PAINT message if moving the child window unconvered part of the parent. Otherwise, I don't think the parent window will receive any message.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I want to use a CPaintDC as public member,I want to put CPaintDC of OnPaint into this member,but there is no '=' operator for this class,is there any way for doing this?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Mazdak wrote:
I want to use a CPaintDC as public member ...
Not a good idea - CPaintDC is designed to be constructed and destroyed within the context of an OnPaint handler.
If you want a static device context for your window, declare a window class that has the CS_OWNDC flag set, then use GetDC to initialize the member CDC or hDC. However, you should still only draw to this DC within the context of a WM_PAINT message.
|
|
|
|
|
It is also important to remember that if you go this route, that you must call ValidateRect or ValidateRgn if you decide to go this route. If you don't, the invalid region for the window that is receiving the paint message will not be erased, and this window will continue to receive these paint messages even when there is no need to paint, kind of like an infinite loop of paints.
Also, when you use GetDC, you will be given a DC that has the ability to paint on the entire window, depending on the type of painting that you are doing, this may cause flickering. That is why if you use this technique, again, you should call GetInvalidRgn on the window, before you call ValidateRect or ValidateRgn.
Usually you would use this technique if you want to perform painting outside of the paint handler.
Even if you use the CS_OWNDC style in your window class, when you call BeginPaint, it will return the same DC that is cached by your window. I believe that this is your best route, to making the best looking window.
Remember, there are only so many resources available on the system, and you should weigh the circumstances of your window design carefully before you try to cache window DC's. You do not need to worry about this so much on the NT based systems, however the 9x systems have a limited number of concurrent DC's that can be created.
I know alot about the internals of the Windows paint architecture, if you need any more information, please let me know.
|
|
|
|
|
Can you tell a green field,
From a cold, steel rail,
A smile from a veil,
Do you think you can tell?
Did they get you to trade,
Your heroes for ghosts,
Hot ashes for trees,
Hot air for a cool breeze,
Cold comfort for change,
Did you exchange,
A walk-on part in the war,
For a lead role in a cage?
One of my favorite songs!
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Use CClientDC outside of OnPaint. You would be better to make a bitmap a public member and just select it into a DC when you need it.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
|
|
|
|
|
Christian Graus wrote:
to make a bitmap a public member
You mean I should paint into this "bitmap"?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Yes, you need to select it into a DC, but it's the bitmap, and not the DC, that should be a public member.
If you don't select a bitmap into a DC then not much is going to happen, unless it's a PaintDC or ClientDC (which has one already).
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
|
|
|
|
|
I'm programing in C language.
I'd like to use the wsprintf function with a LPTSTR variable.
here my code:
void GetDescription (LPTSTR Description)
{
char TypeRes[100];
char Resources[100];
lstrcpy (TypeRes, "Bitmap");
lstrcpy (Resource, "file.bmp");
Description=wsprintf (Description, "<%s : %s>", TypeRes, Resources);
}
It doesn't work! The variable Description is empty or invalid. But I have to use LPTSTR not char[xxx], otherwise, my program is very slow and I get a memory error.
Help me!!!!!!
Appstmd
|
|
|
|
|
If you use wsprintf() I guess you have defined UNICODE and _UNICODE, in that case you can not ude char, but should instead use wchar_t.
Description=wsprintf() fails, wsprintf returns the number of characters the function put in to a string, not the string itself, so you should use something like int result = wsprintf (Description, "<%s : %s>", TypeRes, Resources);.
Make sure that Description are large enough to contain the text you pun into it with wsprintf()
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
If you use wsprintf() I guess you have defined UNICODE and _UNICODE, in that case you can not ude char, but should instead use wchar_t.
This is not correct. The function has ANSI and UNICODE versions. In this case, the w does not refer to a wide character variant. It refers to a windoze-specific function that resides in user32.dll and is not part of the C runtime library.
|
|
|
|
|
Oops
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
The rest of your answer was mostly right though. The assignment to Description is inappropriate and is causing the problem.
FWIW, wsprintf is mostly like sprintf but it does not support floating point values.
|
|
|
|
|
Thks a lot!
The code now works perfectly. My variable Description was not large enough ... Here the changes:
Lenght=lstrlen(TypeRes)+lstrlen(Resource);
Description = (char*) malloc(Lenght);
Description[Lenght]='\0';
wsprintf (Description, "<%s : %s>", TypeRes, Resource);
Appstmd
|
|
|
|
|
The code is still wrong, you don't allocate enough space for the Description string. Look at the wsprintf() format - you have the two substrings, two angle brackets, two spaces, and a colon. Plus the terminating null. So you should malloc (lstrlen(TypeRes) + lstrlen(Resource) + 6)*sizeof(TCHAR)
--Mike--
Fetchez la vache!
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
You should:- use the
TEXT() or _T() macros for all your string literals - use
TCHAR instead of char - include
tchar.h - and if you have
UNICODE and _UNICODE defined (ie you are using unicode version of wsprintf ), make sure you check the "Display unicode strings" options under the Debug tab of the VC++'s Options dialog.
PS. Are you sure you have a valid buffer in Description ?
PPS. Just saw you assigning Description from the results of wsprintf . Did you read the docs at all? LPTSTR is not a string class ! You are making the Description pointer to point to some invalid address after the function call.
|
|
|
|
|
Assuming the calling code is passing a valid buffer in the Description parameter, take out the "Description =" part and it will work. Then do all the TCHAR-related stuff the other posts have mentioned (although they are wrong about Unicode; wsprintf() is not a Unicode-only function, that would be swprintf()).
--Mike--
Fetchez la vache!
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
Hahaha... I am Alpha Intelligence(AI). And I'm a chinese boy.
I want to write a software like "Clone CD"?
So I want to know about CD's files structs. But you see, I don't know how can I get it. And Where I can get it.
Thanks a lot!
I want to become programmer!!!
|
|
|
|
|
CloneCD does a raw copy of the CD, it completely ignores any file structure (or differences between CD-DA and CD-ROM). If you decide that you don't want to do another CloneCD after all, the file system on CD-ROMs is defined in the standard ISO 9660. A draft version is viewable here There are various extensions to handle long file names, bootable discs, etc. See www.cdrfaq.org for more information.
|
|
|
|
|
Hi,
I am fairly new to anything involving graphics! But been playing around GDI+
What i want is to merge two images, using transparency. Can someone give me an overview of doing this in GDI+ using alphablending.
Cheers
Rich
|
|
|
|
|
I'm not sure if you can select a bitmap and specify transparency when you draw it. I seem to recall I did it using direct pixel access ( GetBitmapData, from memory is how to do that ), and then merging the pixels myself.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
|
|
|
|