|
Hi again,
Mark Salsbery wrote: What is the icon's dimensions and how often (per-second) does it get rotated?
Icon's size is 32X32 or 64X64.
Refressh rate is 4Hz(every 250msec).
I read the article from Randor's link and it seems to work,
But I think that rotating the icons instead of drawing bitmaps is more efficient...(I'm sure
that the people from MS can do the work better than me.....or not?;P).
I'm not familiar with GDI+(only GDI),but it is always good to learn something new...
Thanks,again...
With best regards,
Eli
|
|
|
|
|
You probably have your solution by now, but just to provide another option, here's GDI+ code
that rotates an icon (in a window) around its center point, 360 degrees at 0.5 degree intervals:
HICON hIcon = (HICON)::LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_MYICON), IMAGE_ICON, 96, 96, 0);
Gdiplus::Bitmap SrcBitmap(hIcon);
Graphics DstGraphics(*this);
REAL angle = 0.0f;
for (int i = 0; i < 720; ++i)
{
DstGraphics.ResetTransform();
DstGraphics.RotateTransform(angle);
DstGraphics.TranslateTransform(SrcBitmap.GetWidth()/2.0f, SrcBitmap.GetWidth()/2.0f, MatrixOrderAppend);
DstGraphics.DrawImage(&SrcBitmap, -((INT)SrcBitmap.GetWidth()/2), -((INT)SrcBitmap.GetHeight()/2), SrcBitmap.GetWidth(), SrcBitmap.GetHeight());
angle += 0.5f;
} Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
The code at codeguru: http://www.codeguru.com/Cpp/G-M/gdi/article.php/c3693/[^] optimizes quite nicely in VS2005. With speed optimization enabled, compiler intrinsics, and /ARCH:SSE the VS2005 compiler does a pretty damn good job at optimizing his code. Download the sample and give it a shot. 0 to 1% cpu usage on my laptop even when I set the timer to 1ms (of which the smallest quantum is around 10ms)
Hope it helps,
-Randor (David Delaune)
|
|
|
|
|
Btw:
You can modify the project properties at 'Output Files' and enable 'Assembler Output' as 'Assembly with Source Code /FAs'
Check out the beautiful asm code optimizations... MMX and SSE very nicely optimized by the compiler, I have been impressed with the optimizations of VS2005. I have nearly always been able to manually generate asm code by hand to outperform visual studio. This is the first compiler I have a hard time beating! Cant' wait to see VS2008 'Orcas' optimizer.
-Randor (David Delaune)
|
|
|
|
|
Hi,
you can mix the solutions.
first load the original icon as bitmap and rotate it 720 times,
store the bitmaps as 720 icons ( use CreateIcon() ),
than use the stored icons.
You need to do the computation only once at program start and avoid the
administration overhead of having 720 icons in the resource file.
Regards,
Georg
Regards,
Georg
|
|
|
|
|
Hello everyone,
I have developed a COM component using C++. And I need to invoke some functions in another DLL which is implemented in C#. I am wondering whether there are any tutorials or samples of how to do this correctly and safely?
I have this question because I noticed that the data types in C++ and C# are not the same -- how to make them compatible? This is the most of my concern.
thanks in advance,
George
|
|
|
|
|
So shouldn't that be "Calling a C++ function from a C#" ? Anyway once if you've made a function in COM you can very well call it a "COM function" rather than C++ function. And to answer your question, You can easily add or "referrence" your COM component in the C# project and start considering it a class. You create object from it, set event handlers access member variables, etc. But I suggest you have a look at here.
Introp[^]*
RCW[^]
CCW[^]
He's become a household word in the Lounge. A whole new phraseology has evolved. Post a link or reply with a smiley and rose, and you've made a "Satipsism". So what? It's an interesting thing about the Internet, the evolution (as in change, not progress) of tone, quality, terminology, etc.
-Marc Clifton.
Best wishes to Rexx[^
|
|
|
|
|
Hi VuNic,
I am talking about a different scenario -- invoking C# function from unmanaged C++ COM object. Any ideas or reference articles?
regards,
George
|
|
|
|
|
Hi George,
Little busy at work. The CCW is exactly meant for that. You may look into that. If you want a working sample them, I think Nishant Shivakumar has written nice articles about mixing up managed and unmanaged codes. You may give a dig at them. And one things is that you may look into any "unmanaged" code that access that managed code rather than trying to find "COM" calling a managed code. that's apparently if could do that in any unmanaged environment, then you should be able to do the same from COM which is of the same type right?.. So give a generic search key . Good luck
He's become a household word in the Lounge. A whole new phraseology has evolved. Post a link or reply with a smiley and rose, and you've made a "Satipsism". So what? It's an interesting thing about the Internet, the evolution (as in change, not progress) of tone, quality, terminology, etc.
-Marc Clifton.
Best wishes to Rexx[^
|
|
|
|
|
Hi VuNic,
Two more questions,
1. I have not found any articles written by Nishant Shivakumar from CodeProject, could you help to point them out please?
2. for your comments,
VuNic wrote: And one things is that you may look into any "unmanaged" code that access that managed code rather than trying to find "COM" calling a managed code. that's apparently if could do that in any unmanaged environment, then you should be able to do the same from COM which is of the same type right?
I think you mean accessing from unmanaged code to managed code is the same for both,
A. accessing from a normal native unmanaged application (or DLL) to managed code (e.g. C#);
B. accessing from native unmanaged COM code to managed code (e.g. C#).
Right?
regards,
George
|
|
|
|
|
I currently have a piece of code that parses and extracts data from WAV files using Windows fuctions like
mmioOpen
mmioDescend
mmioRead
mmioAscend
mmioClose
I now want to open and parse WAV files using an IStream interface. Is there an equivalent set of library functions or will I have to parse the files myself?
|
|
|
|
|
the first question you must answer is WHY? mmio* functions are specifically designed to handle MultiMediaInputOutput why make life hard for yourself?
|
|
|
|
|
I want to feed the sound portion of WAV files into the new IMAPI2 API which expects data via an IStream interface. It's not me that is trying to make left hard for myself!!!
|
|
|
|
|
Hi -
My application needs to implement a command type window where you type in commands, get listings and that kind of thing. More or less exactly like what the Windows "Command Prompt" cmd.exe, or the JPSoft replacements provide.
Does anybody know of any source that's available that will save me the legwork on this? Either commercial or freeware? I'm on a tight schedule on this app and any help is much appreciated!
thanks,
- robin.
|
|
|
|
|
|
i have tried to draw image on non client area(glass effect) in windows vista aero glass view with GDI+ in MFC (included alpha channel) as suggested in one of previous article. but image gets invisible there because when i write the same code in xp it draws the image in non client area. what could be the reason for it?
|
|
|
|
|
I have a form view and i am fixing a CListCtrl on that view. I have 10 row in that list. On a certain event i want to change the color of the certain entire row. Is this possible? If yes how?
Thank you.
KIRAN PINJARLA
|
|
|
|
|
R u talking about changing the color of all rows of list ctrl or few rows?
Come online at:-
jubinc@skype
|
|
|
|
|
|
I don't remember the name of the article, but there is one very good CListCtrl here in code project that implements simple row, files, cells changing colors and a lot of additional features. Take a look in the sction MFC controls or search articles CListCtrl-related
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
You can derived CListCtrl and use of cusom message to change color of items and background.
|
|
|
|
|
Hello everyone,
When converting from size_t to unsigned int, there will be a warning message,
warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
I do not know why, since in crtdbg.h, size_t is defined to int, right?
thanks in advance,
George
|
|
|
|
|
Plzz write the statement u've written in u'r source which is generating the warning.
Come online at:-
jubinc@skype
|
|
|
|
|
Hi Don,
I am using fread to read contents from a file and the return value is size_t. Then I need to pass the size_t value to another function which accepts unsigned int as input parameter, and this is why I need to do the type conversion.
Any suggestions to solve this issue? (which types should I convert to? Any possible lost of data?)
regards,
George
|
|
|
|
|
Pragma warning disable! It doesn't hurt when you send a size_t to an int param. You could do like (int)size_tVariableHere, when you pass size_t as an int argument. The "possible loss of data" could be about the sign information. size_t is unsigned, We can be sure size can't be in negative, so you can very well use it. It's not a problem at all.
btw : add this in your header:
pragma warning( disable : C4267 )
He's become a household word in the Lounge. A whole new phraseology has evolved. Post a link or reply with a smiley and rose, and you've made a "Satipsism". So what? It's an interesting thing about the Internet, the evolution (as in change, not progress) of tone, quality, terminology, etc.
-Marc Clifton.
Best wishes to Rexx[^
|
|
|
|