|
When you use the Device Manager within Windows to look at any connected devices (i.e. keyboard) it has a 'Device Status' field. Can anyone tell me how I can access this information?
cheers,
Andy
|
|
|
|
|
have a look
DeviceIoControl
Device Management Control Codes
http://msdn2.microsoft.com/en-us/library/aa363226.aspx
|
|
|
|
|
|
As I understand, you will only need the DDK for the headers when you're compiliing the application, not for an end user to run it...
Just make sure to test on a more normal envirnnment before distribution!
Iain.
|
|
|
|
|
Hi,
I have a function which i am trying to optimize.The structure is something like this
for(..)
for(...)
if(cond true)
val = 0;
else
val = 1;
The outer loop repeats for about 600 times and the inner loop 400 times.This structure is repeated in a lot of places in the entire code.I want to know if i can attain some performance gain if i used conditional operator(?) instead of the if-else statements since it is within a loop.
Thanks
AJ
|
|
|
|
|
IMHO no gain.
However, maybe you can improve the overall design to increase performance.
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.
|
|
|
|
|
It seems to me that you would want to break out of the loop as soon as possible. Not having enough info to make an "educated guess", I present you with code based on the "wild-assed guess".
int nVal = 0;
for (int i=...)
{
for (int j=...)
{
nVal = (condition is true) ? 1 : 0;
if (nVal != 0)
{
break;
}
}
if (nVal != 0)
{
break;
}
}
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hello All,
Sorry if this question is off topic. I've just started messing around with C++.
I'm trying to set the Text property of a window using :
<br />
SendMessage(handle,WM_SETTEXT,0,(LPARAM)"Hello");<br />
This works fine. The proplem comes when i try the replace "Hello" with a string
variable like so:
<br />
string s;<br />
s = "Hello";<br />
SendMessage(handle_of_editbox,WM_SETTEXT,0,(LPARAM)s);<br />
I get the following error: "Struct 'std::string' used where a "LPARAM" was expected.
And if i don't use the cast the error says it can not convert string to LPARAM.
How can i avoid this?
Thanks
|
|
|
|
|
SendMessage(handle_of_editbox,WM_SETTEXT,0,(LPARAM)s.c_str());
|
|
|
|
|
You need to do this...
SendMessage(handle_of_editbox,WM_SETTEXT,0,(LPARAM)s.c_str());
so that you print out the contents of the string.
|
|
|
|
|
Thank you both very much. That worked perfectly.
|
|
|
|
|
Hi there,
I am working on a system that sends receive messages via TCP sockets and I need to have a way to inform a service person if the link is down from one application to the other by sending a text message (email, SMS). The application that sends and recive messages in writen in C++ but I am not sure how I can add this feature to it. Also I was thinking if I could have a second application that would watch the first one for connection integrity. Could anyone please give me some help (any tutorial, code sample...)
I appreciate any help.
|
|
|
|
|
nahitan wrote: I am working on a system that sends receive messages via TCP sockets and I need to have a way to inform a service person if the link is down from one application to the other by sending a text message (email, SMS). The application that sends and recive messages in writen in C++ but I am not sure how I can add this feature to it. Also I was thinking if I could have a second application that would watch the first one for connection integrity. Could anyone please give me some help (any tutorial, code sample...)
there are many SMS gateway available on net. which can help you in same.. look at cellebrum.com
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief
|
|
|
|
|
I have an application that has been brought out of mothballs, and am trying to determine the root of an obvious difference in performance between running on a Win2K machine and running on a WinXP machine.
Originally, the application would crash sporadically on a Windows XP machine. The application had been compiled many moons ago, so I set up VStudio 6 on a Windows XP machine, and recompiled the source code. Now the application will run on either Windows 2000 or Windows XP, but exhibits a definite performance decrease on a Windows XP machine.
The source code is not mine, so I don't know it intimately, and it has been many moons since I coded in Visual C++. But I have been able to recall enough to debug into it some. The UI is a thin layer on top of a calculation engine written in (from what I can tell) very generic C/C++ code. In other words, file I/O operations are done using fopen, fprintf, etc. The main calculation loop has 4 main steps, and it loops for every day of a given year. I placed local variables to track average tick count for each of these steps, and can see that one of these steps takes significantly longer than the rest. But again, diving into this function, all I see is standard C/C++ code.
My basic question is, are there any known performance differences when using C/C++ code on these two platforms. Does calloc perform awful on WinXP for some reason unless a particular compiler option is set? Does qsort perform fine on Win2Kbut awful on WinXP? Everything in my experience tells me, there should be no difference. So I think I'm looking for a needle in a haystack. Has anyone come across anything similar?
Any suggestions are greatly appreciated...
Cheers,
Carl
|
|
|
|
|
Do you have VS6 installed on both platforms? If so, you could use the profiler to find the bottleneck.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
David,
Thanks for the response. I don't have a profiler on both platforms, but do on a development XP system. I had some time the other day, and tried to get some decent info out. Unfortunately, I'll need to find more time to put to it, my quick attempt at profiling did not yield much useful information. But thank you for pointing me in that direction. I don't think I'd ever used the profiling tools provided with VStudio, though I have used things like BoundsChecker and RedGate ANTS Profiler, so I get the general concepts.
Thanks again for the suggestion. If you know any parituclarly good tutorials on using PREP and PROFILE, I'd appreciate it. Otherwise, I'll research and see what I can find...
Cheers,
Carl
|
|
|
|
|
Hi,
My sample dlg application having two buttons alloc and free. intially application size on memory is 2.5 mb. after allocating memory arround 100k the application size of memory is increased to 2.6 mb. now try to free the allocated memory after freeing the memory application is same as 2.6 mb.in the sample ok. but some huge amount of memory allocation and free and once allocation having problem. how to solve?
Thanks in Advance!
Have A Nice Day!
Murali.M
|
|
|
|
|
Post the code from your alloc and free functions so that we can take a look and help.
regards,
|
|
|
|
|
You seem to be confused on how the memory manager works. Just because you free 100KB of memory does not mean your address space (that number that folks look at via Task Manager) will suddenly shrink by 100KB. Those bytes are available for future allocation, but they still remain in your process' address space.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
If you are using XP or greater you can use SetProcessWorkingSetSize to attempt to reduce pages in physical RAM. http://msdn2.microsoft.com/en-us/library/ms686234.aspx[^]
SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1);
This is generally not recommended for most applications... the NT memory manager does a decent job. Your applications performance can suffer greatly if this function is abused.
Best Wishes,
-Randor (David Delaune)
|
|
|
|
|
hi i am having a list control in my dialog to list all the files and folders of drive. how to list subitems and open the file types. pls help me im new to this. i need some guidance
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
deeps_cute wrote: how to list subitems and open the file types.
Please explain.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i have to list files similar to windows explorer in my dialog.
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
For finding files, if you are using MFC, check out the CFileFind class.
Do you know how to add items to a list control?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|