|
You can try CWnd::GetControlUnknown() from the control container or CCmdTarget::GetControllingUnknown() inside an ActiveX control's source(an undocumented function and may not function in future versions of MFC)
My blogs:
http://blog.joycode.com/jiangsheng
http://blog.csdn.net/jiangsheng
http://bloglines.com/public/jiangsheng
Command what is yours
Conquer what is not
---Kane
|
|
|
|
|
I posted this same question two days ago but have so far not gotten an answer. I am assuming that there is no way to do what I want, but I will ask again just in case someone who does know missed my question the first time.
Given an HCURSOR handle, how can one tell if it is an animated cursor (loaded from an .ani file or RT_ANICURSOR resource) or not?
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
A cursor is almost identical to an Icon. So in theory you should be able to use the ExtractIconEx() function to return an array of Icons. If you have more than one icon, then you are dealing with an animated cursor.
Take a look here[^] for more ideas.
|
|
|
|
|
The theory is not bad, but unfortunately it does not work. ExtractIcon and ExtractIconEx are used to retrieve icons from a file (.exe, .dll, or .ico), not from an HICON or HCURSOR handle.
I am writing a wrapper class around HCURSOR, and there are some things that I can do with a static cursor that I can not do with an animated one, such as compare them to see if they are the same or change the location of the hotspot. Being able to tell if an HCURSOR is animated or not would be handy.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Then why don't you try the DrawIconEx and set the istepIfAniCur member to something greater than 0. I'm sure the function would fail if it's not an animated cursor.
|
|
|
|
|
From MSDN:
istepIfAniCur
[in] Specifies the index of the frame to draw, if hIcon identifies an animated cursor.
This parameter is ignored if hIcon does not identify an animated cursor.
But I will try it anyway
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
I might be able to make this work, if I draw frame zero and frame one and then compare them. If they are different I got an animated cursor, if they are the same I got a static cursor. Seems like a really bad hack but until something better comes along
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Do not use the CopyCursor function for animated cursors. Instead, use the CopyImage function.
I'm wondering if CopyCursor returns an error if you pass it an animated cursor?
Montreal great Guy Lafleur, quoted by CBC on being mugged while vacationing recently in Buenos Aires: "I didn't have any time to react before I got a sucker-punch in the eye. It was like one of the players from the Bruins."
|
|
|
|
|
Jack Squirrel wrote: I'm wondering if CopyCursor returns an error if you pass it an animated cursor?
No error, it just creates a static cursor containing the first frame of the animated cursor.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Hi, I am using ADO 2.81 with C++ 6.
In my program I have a datagrid which is filled with data from adodatacontrol. Whenever i select a different row, my app needs to display information about it. The problem is, I can't find in which row the user clicked...
Is there any code that can help me?
i am trying to put it in the function:
void CMyDlg::RowColChangeDatagrid(VARIANT* LastRow, short LastCol)
here lastRow shows the last row clicked not the present.
I tried with dataGrid.get_Row();
this works fine if I dont scrool the data grid. But if I do so, it gives me the same informations (like I am not scrolling)
PLS help
|
|
|
|
|
Hello all,
Will u give me way to claculate the execution time of a program(or between any statemants) in Microseconds (in VC++).
I was able to get the execution time in Milliseconds anyway by using GetTickCount API.
Are there any way to calaculate in Microseconds(programmatically!!!!!!).
Problem in above said API is that,when the range goes below 0 (in ms), the Microsecond
value is not displayed( but rather 0 is Displayed).
I am in immediate need!!
Thanks in advace..
Rane
|
|
|
|
|
Rane wrote: Are there any way to calaculate in Microseconds(programmatically!!!!!!).
Yes, just multiply milliseconds by 1000.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
But I was not able to get values below 0 ms.(in microseconds range).If it is more ur ans is correct.
For Ex:
Try finding the execution time of 2 or 3 statements, u will get the answer as 0 ms.
Isn't it.
Then what is the time spent in executing those statements!!!.
Thanks 4 ur Reply
Rane
|
|
|
|
|
Read here to make sure you know what you are asking (and why it may not be available).
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
With a little work, you can get there. You'll need to use the function QueryPerformanceCounter()[^] along with QueryPerformanceFrequency()[^].
Before you start though, you should really read an excellent article here on CP by Joseph Newcomer: Time is the Simplest Thing... to make sure you have a grasp of the many things that can ( and will! ) throw off your timing measurements in the Windows environment.
Regards,
Dan
Remember kids, we're trained professionals. Don't try this at home!
|
|
|
|
|
Is it possible to use profiler to do this job?
If so,how to turn it on & how to include in my Program.
Help me Plzzzz
Rane
|
|
|
|
|
I have tried using the APIs which u have mentioned.
It is giving the value in mSec .Is it a correct value or a blurred one?
Thanks in Advance.
|
|
|
|
|
Here is a simple console application (developed under VC++ 6 ). It measures the time it takes a 'printf()' statement to execute and displays that time in microseconds.
#include <windows.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
LARGE_INTEGER perfFreq;
if( !::QueryPerformanceFrequency(&perfFreq) )
{
printf( "High Performance Counter not available!\n" );
return -1;
}
printf( "Performance Counter Frequency: %I64d ticks / second\n", perfFreq.QuadPart );
printf( " or %e microseconds / tick \n\n", 1.0e6 / perfFreq.QuadPart );
LARGE_INTEGER perfStartTime;
LARGE_INTEGER perfEndTime;
::QueryPerformanceCounter( &perfStartTime );
printf( "\n(* This is the statement that I am timing *)\n\n\n" );
::QueryPerformanceCounter( &perfEndTime );
printf( "Measured Time: %I64d ticks\n", perfEndTime.QuadPart - perfStartTime.QuadPart );
printf( " or %f microseconds\n\n\n", 1.0e6 * ( perfEndTime.QuadPart - perfStartTime.QuadPart ) / perfFreq.QuadPart );
return 0;
}
On my machine the output produced is:
Performance Counter Frequency: 3579545 ticks / second
or 2.793651e-001 microseconds / tick
(* This is the statement that I am timing *)
Measured Time: 80 ticks
or 22.349209 microseconds
Dan
Remember kids, we're trained professionals. Don't try this at home!
|
|
|
|
|
Thanks for your Information!
Rane
|
|
|
|
|
Have you tried using the profiler (part of Visual Studio)? Search MSDN for information.
I think it gives sub-millisecond resolution (haven't used it for a while, can't remember how to turn it on . . . )
|
|
|
|
|
I've been trying to write a console program that parses an XML file and displays the results in a console window. The parser is working great, but displaying the UTF-8 strings the parser reads is turning out to be a problem. I need to use a variation of printf() to display my strings (I'm using wprintf() currently). Aparently, even though Windows XP supports unicode, the default code page won't let me display anything but english characters with functions in the standard C library. I'd like to use a unicode code page to display the characters so I won't have to manually change the code page every time a different language is used. But, if I want to keep this program relatively cross platform (and so far it is) I don't see any other way besides using setlocale() to get the correct code page set. The only problem is, I can't find any info on which string setlocale() needs to be fed to get a unicode code page. I'm not even sure if setlocale() supports unicode with the Visual C++ 8.0 CRT. Supposedly it does on *nix platforms, although I don't have a way of testing that at the moment. Anyway, so does anyone know a way to get setlocale() to give me a unicode code page (preferably UTF-8, but UTF-16 is ok too), or any other cross platform way to get one. Or failing that, how about even a non cross platform solution since I can always special case the Windows solution. :p
-- modified at 13:36 Tuesday 28th March, 2006
|
|
|
|
|
Interesting... With a little further research, I was able to determine that _setmbcp(), which should have been the non cross platform solution I was looking for, did not allow you to set the code page to unicode. I brute forced the function to get all the possible values it accepted, and while it did accept most of the code pages on Microsoft's list (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/unicode_81rn.asp) it did not accept any unicode page values. I have no idea why this would be though. I made sure to define both UNICODE and _UNICODE in my application, and none of the other apps I run on my computer have any problem dealing with unicode. Come to think of it, if Microsoft's implementation of setlocale() calls _setmbcp(), that could explain why setting unicode code pages with that function didn't work either. Well, I'll continue researching this, but if anyone else already knows the solution then don't hold out on me.
|
|
|
|
|
Hi,
I need to develop a application that makes tests on hardware of a pc. I would like to do that using C or C++. I'm here to ask you for resources, code example or anything else to help me.
Grateful!
Hélio
|
|
|
|
|
Hello honae,
What kind of tests?? CPU arithmetic tests, 3D capabilities, memory bandwith, file I/O performance etc... ??
|
|
|
|
|