|
If you set 800x600 on CreateWindow, then the overall size of the window (including borders) will be 800x600.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
I now realized thats correct. My Question should have actually been what should be the size of my background image so that it will fit.
So I guess I'll figure out what the dimensions of the border and I'll reduce the dimensions of the background image by that.
Thanks.
|
|
|
|
|
GetClientRect [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Thanks again, I'll try that.
|
|
|
|
|
I've created a MFC project in Visual Studio 2008.
The manifest is correctly getting embed in the program if the configuration is Unicode otherwise, it will show an error like this (on changing the character set to Multibyte and build, (not rebuild) the soulution).
1>mt.exe : general error c101008a: Failed to save the updated manifest to the file ".\Debug\SampleProgram.exe.embed.manifest". The parameter is incorrect.
This error will resolve when I Rebuild the entire project but manifest is not embedding inside the executable
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
I do get same error during build but not always. Typically if I build (not rebuild) again it do not occur again. Well I don't have solution but just sharing my expereince.
-Saurabh
|
|
|
|
|
The comctl32.dll version 6 supports only UNICODE version. If you open the stdafx.h you can find the switch as follows
#ifdef _UNICODE<br />
#if defined _M_IX86<br />
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")<br />
#elif defined _M_IA64<br />
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")<br />
#elif defined _M_X64<br />
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")<br />
#else<br />
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")<br />
#endif<br />
#endif
|
|
|
|
|
Dear Naveen,
Thanks for your reply.
Naveen wrote: The comctl32.dll version 6 supports only UNICODE version
I just removed the #ifdef _UNICODE and #endif. and it's working fine. In a post of Raymond Chen, it's saying that Common Control 6 supports only UNICODE[^]. When I started using Windows XP, I enabled visual styles for existing applications by just putting "exe_name.exe.manifest" file in the same folder. I can't figure out how it's working it in a non-UNICODE build (even if Common Control 6 supports only Unicode).
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
I think untill you deal with message that handles strings, problem may not raise. Also if we subclass a control and handle messages that contains text, problem can arise. The comcomctl will be sending the text as wide char, but our program will interpret it as multibyte which can lead to undefined errors.
|
|
|
|
|
Hi Friends,
Windows Vista provides a slider control to resize icons ( thumbnails) in My Computer Explore view.
I need such resizing in my Windows XP application ( MFC ) application.
I create and delete the ImageList of current view as user resizes but overhead of creating and deleting is very high.
I need smooth resizing.
Any help is highly appreciated.
Thanks in advance.
Subhash Madhukar
|
|
|
|
|
Hi all!
I'm having a problem when compiling this code:
template<class t=""> inline CImage operator-(T value)<br />
{<br />
CImage tmpImage(CImagePtr(NULL));<br />
<br />
switch ( getDepth() )<br />
{<br />
case IMAGE_DEPTH_32F:<br />
SubtractFloat(getImage(),tmpImage.getImage(),value,false); <br />
break;<br />
default:<br />
SubtractInt(getImage(),tmpImage.getImage(),value,false);<br />
}<br />
return tmpImage;<br />
}<br />
<br />
inline CImage operator-(CImage& imageB)<br />
{<br />
CImage tmpImage(ImagePtr(NULL)); <br />
Subtract(getImage(),imageB.getImage(),tmpImage.getImage());<br />
return tmpImage;<br />
}<br />
</class>
SubstractFloat substracts one constant "value" (float) from a CImage. SubstractInt does the same with int type. And Substract substracts a CImage from a CImage.
I'm calling these functions as this way, for example:
CImage imResult;<br />
double minVal = 50;<br />
imResult = imResult-minVal;
This code was running and compiling without problems in VC++6.0. Now, in 7.0 the compiler is throwing me these errors:
error C2664: 'SubtractFloat' : cannot convert the parameter 3 from 'Icar::CImage' to 'float'<br />
error C2664: 'SubtractInt' : cannot convert the parameter 3 from 'Icar::CImage' to 'int'
If I force a cast to (double)value the compiler then says that there isn't an operator defined for double.
Thanx for your help. Every idea is welcome!
|
|
|
|
|
How aer declared (and defined) SubtractFloat and SubtractInt ?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
IPLAPI(void, SubtractS,(CImage* srcImage, CImage* dstImage, int value, BOOL flip))
IPLAPI(void, SubtractSFP,(CImage* srcImage,CImage* dstImage,float value,BOOL flip))
|
|
|
|
|
Provided the operators are methods of CImage class, I see no problems in your code.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
The operators are methods of CImage, the Substract procedures no.
Here is the problem, the code compiles well under vc++6 but not under vc++7.
modified on Wednesday, April 23, 2008 10:29 AM
|
|
|
|
|
Template support in VC++ 6.0 is poor. It was improved a lot in VC++ 7.0 hence lot of code which used to work in VC++ 6.0 doesn't work in VC++ 7.0.
jonnyvargazz wrote: template inline CImage operator-(T value)
Why do you have template without parameters in the function definition? It should be
template<typename t=""> inline CImage operator - (T value)</typename>
-Saurabh
|
|
|
|
|
Sorry I had an error writing the header. The correct is:
template<class T> inline CImage operator - (T value)
No, no, it seems that the "<class T>" didn't displayed well.
|
|
|
|
|
Hi did you able to solve the problem. It seems somehow type of T is being initialized to CImage but is not obvious with the code you posted. Can you share the how you define the class CImage.
-Saurabh
|
|
|
|
|
I think the problem is that the compiler interprets that if there is an operator definition with a Cimage parameter, and then is an override with a template parameter, the basic parameter is a CImage, and it has no possibilities about reinterpret the parameter as a number.
For the moment I've took out the template, and declared the override with a size_t parameter. It's enough for me at the moment, I think, because this declarations could run with every kind of numeric params. Isn't it?
Thank you very much!
|
|
|
|
|
I tried to test this with a simple class with just two operators similar to yours. I works fine and I got no errors. So I am not sure where is the problem.
-Saurabh
|
|
|
|
|
CImage class is using a CImage namespace. May it has something relative to the problem.
|
|
|
|
|
I'm developing an animated game on Win32.
my message-loop looks like this:
MSG msg;
ZeroMemory( &msg, sizeof(msg) );
while( msg.message!=WM_QUIT )
{
if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
else
{
CPTWindowManager::GetInstance()->RenderAllGames();
}
}
I have noticed that takes 50% of the CPU.
I wonder if this 50% are "for real". If so, it is not desirable.
I tried to use GetMessage() but I don't know how to figure out the "idle" state when using GetMessage() .
Note that the rendering stuff are relatively simple rendering and thus the time they take is unnoticeable.
|
|
|
|
|
No matter how long the "rendering stuff" is taking, you have a busy loop all the time: there's nowhere a 'pause' in the loop (sleep or wait for something...). But don't worry too much, that's usually how games are written: you want to achieve the best possible performance, so it's normal that you will eat up all remaining CPU time.
In your case it is probably taking 50% of the CPU because you have a dual-core, am I right ?
|
|
|
|
|
Yes I have a dual-core.
Also, I don't 'feel' the 50% slowing down my windows experience.
I have, however, saw a similar game that when run only eats several %.
Perhaps they did some scheme with the WM_PAINT messages - they cause the window to refersh, by InvalideRect() I guess, and render on the WM_PAINT s.
Sound like something I should try ?
Thanks
|
|
|
|
|
It depends which kind of game it is. For example, if it is something static (like solitaire, mine sweeper, ...) then you don't need to repaint the view dynamically. You can simply repaint the view when something changed.
So, I can't really answer your question, it depends of the kind of game you are trying to write.
|
|
|
|