|
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... ??
|
|
|
|
|
|
I am porting an App to a PDA (a Dell Axim), and have encountered two problems ...
GetFirstDevice / GetNextDevice works well in the emulator and appears to do what the documentation suggests, but when run on the Axim it always returns INVALID_HANDLE_VALUE . My code is taken straight from the VS2005 documentation.
<br />
DEVMGR_DEVICE_INFORMATION devInfo;<br />
HANDLE hFind = FindFirstDevice(<br />
DeviceSearchByLegacyName,<br />
L"COM*",
&devInfo );<br />
Using
<br />
HANDLE hCom = CreateFile(<br />
lpszName,<br />
GENERIC_READ | GENERIC_WRITE,<br />
0, <br />
NULL, <br />
OPEN_EXISTING, <br />
0, <br />
NULL );<br />
works well enough if I guess correctly the name of the device I want to discover.
My second problem is connected with the use of DocLists. If I use a CDocListTemplate in place of the normal SDI template, all the controls on my CFormView derived view class dissappear
Any ideas would be much appreciated.
P.S.
Why is debugging in VS2005 so unbeleivably slow ? I am getting through a cup of coffee every time I press F10.
mtzlplyk
|
|
|
|
|
I have an NT Service that was written to periodically check a directory to see if a file was present. If a file was present then the service would create of an instance of a VB object, containing various functions, using the CreateInstance call. This then would take the file and carry out the required tasks. Which works fine when it runs on NT. However when I take the DLL's and the NT service executable and install it on a machine running Windows 2003 Server I get a problem where it can't create the instance for the VB object. In the past this has been because I did not associate the VB DLL object with the NT service (the old binary compatibility issue).
I do also seem to have problems in trying to stop the service. It seems to timeout in its attempt to close down, but still seems to stop.
I have tried to build the service on a machine running Windows 2003 Server using Visual C++ 6.0, but this does not seem to correct the problem. If I take the newly created NT service executable and the VB DLL object and place it on an NT machine it all works fine. The machines are acting as Web servers so IIS is also running, since the files that are checked for are being deposited into the ftproot directory.
Is there anything I need to change or add to get the service to run correctly on the Windows 2003 Server machine.
Regards,
Simon
|
|
|
|
|
Maybe you should consider compiling those sources on a machine with VC++ 7.X/8.0 installed. It should work just fine. Good luck!
|
|
|
|
|
Do we have any way to restrict the edit control to only support accepting english characters/numbers?.
If we make a simple edit control i.e. non-rich edit control, is it dependent on the target system and the keyboard settings that edit control accepts the character, for eg. if we create a simple edit control, and run our application on chinese system, would the user be able to type in chinese characters in to this control, if yes, is there any way to force the user to enter the text only in english language irrespective of his system language.
Thanks for you responses in advance!
Regards
Suyash
|
|
|
|
|
Suyash wrote: ...is there any way to force the user to enter the text only in english language irrespective of his system language.
Is that useful? Wouldn't that be irritating to the Chinese user?
"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
|
|
|
|
|
DavidCrow wrote: Is that useful? Wouldn't that be irritating to the Chinese user?
Hello All,
Thanks for your replies and suggestion to the given problem, I would try to apply ES_NOIME solution as suggested.
Regarding this requirement, actually we do have a poker table client, wherein various players from various contries(usa, china etc. etc.) will be able to play on the same table. Each player may have his/her own different language version of our software. However we also provide a chat facility, its all lobby chat, and personal chat is allowed. and its possible that 2 chinese player, if allowed to chat in chinese language(which other players may not know), can collude and cheat other players, so thats the reason we wish to restrict the chat input window to support only the english characters. Though we understand that there is no way to prohibit languages that uses english character set, like german.
Thanks again!
Regards
Suyash
|
|
|
|
|
override the WM_CHAR even for that editBox...
but as David told, consider seriously thinking about why you need this (what problem you're trying to solve), and if you cannot solve your problem another way...
|
|
|
|
|
With Richedit controls you can set the EM_NOIME style, this will prevent the user from being able to type chinese characters.Edit controls do not have this feature so you would have to go one step further and handle the WM_IME_CHAR and WM_IME_COMPOSITION yourself. But they would still have the option of being able to paste.
Really there is no simple way to prevent it. You could override the WM_CHAR, but this would involve comparing each character entered against those in the charset GB5 for traditional and GB2312 for simplified. Or limit it even further by only allowing charcters a-z and A-Z, but here you would have problems telling the difference between single byte and multibyte characters.
Another option is to set the font for the control to a font other than system and chinese. This would cause the control to display a special character (usually a box,star or Question mark) for those characters not found in the font.
|
|
|
|
|
Walder, welcome back
i'm sorry to be opposed to you again, but i'm not the one who asked the question
sorry for the disapointment :->
|
|
|
|
|
LOL, don't worry. I'm just under a bit of pressure to get this application finished. But one things for sure, I won't be asking questions again if I can help it.
|
|
|
|
|
lol
hey, don't worry, i'm cool
if you have particuliar points that you cannot find/understand/learn alone, then I'd be glad to help you in this
cheers,
|
|
|
|
|
waldermort wrote:
With Richedit controls you can set the EM_NOIME style...
Perhaps you meant ES_NOIME ?
"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
|
|
|
|
|
haha, so I did. I have no excuse, the 'S' and 'M' are too far apart to blame the keyboard. So, if anybody ask's, it was the wife
|
|
|
|
|
Hi,
Somebody has example on how calling managed (C#) DLL from unmanaged code (VC++ 6) ? I need it for backward compatibility reason.
Thanks before.
|
|
|
|
|
write a regular DLL in managed C++
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
|
|
|
|
|
Any direct link or reference in easier language, pls ? Your blog is half chinese and unfortuantely I don't understood any single letter of it.
Thanks anyway
|
|
|
|
|