|
see _scprintf[^] which returns the number of characters in the formatted string. you can use the count to dynamically allocate the buffer that is to be passed to sprintf.
if you have only static hardcoded format string such as "%d plus %d is %d" you can manually calculate the formatted string length as %d formats an integer and you know the maximum and minimum value of integer.
|
|
|
|
|
Hi all,
I've to develop and application that must satisfy some
"real time like" requirements.
The application has to do something periodically; the period
is about 10 milliseconds and it must be very accurate:
it cannot be affected by operations done in the user interface
like mouse moving or window resizing.
What's the best timer to solve this requirement ?
Is it multimedia timer ? or there are better timers ?
Thanks a lot
|
|
|
|
|
On a standard windows platform ? If yes, forget about it because windows is not a real-time operating system. You can have jitter varying up to 10 msec and there's no way to control that. You'll have to use another operating system for that (WinCE for example, which has a different scheduler).
|
|
|
|
|
ilgale wrote: What's the best timer to solve this requirement ?
Hardware timer on an embedded device...
Seriously, if your requirement for determinism is at all strict [*], a general purpose OS like windows is not for you.
The nearest I'd say is some sort of device driver (you don't actually need a device to write one) using waitable timers. But even then, you'll get jitter.
Iain.
[*] You said "very accurate". Being an engineer, I'm assuming you're not exagerating.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
Hi,
i want to get number of printers attached to my computer, i use Win32_printer class to get the printers, but before connecting WMI i impersonating to some other user. But the WMI gives the output not for the impersonated user but the one who has launched it.
I am launching the process in system accout and trying to impersonate to the logged in user to get the printer information of the logged in user. (Initially i have to launch the process in system account) Does anybody has any idea how to do this??
|
|
|
|
|
Check why the Impersonate to other user is not successful.
|
|
|
|
|
Hello friends,
I've a MFC Extension DLL in which it declares the shared variable as below
in .cpp file I have code as below
#pragma data_seg(".adshared")
int count=100;
#pragma data_seg()
#pragma comment(linker, "/SECTION:.adshared,RWS")
I've the method to get the value of count variable
bool Getvar2(int *p)
{
*p=count;
return true;
}
in .DEF file I have the code as below
Getvar2 @1
count @2
In the client application I've tried the code as below
1)
int *i;
i = (int*) GetProcAddress(m_hDLL, "count");
2)
//FunPtr2 is typedef bool(*FunPtr2)(int *p1);
p=(FunPtr2)GetProcAddress(m_hDLL,"Getvar2");
if(p(v))
{
}
In both the above cases the program crahsed when I try to access shared variable of the MFC Extension DLL.
How can we access the shared variable from the client application?
ritz1234
|
|
|
|
|
ritz1234 wrote: p=(FunPtr2)GetProcAddress(m_hDLL,"Getvar2");
Have you checked p value?
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 for the reply,
yes,I've checked the value of p and it contains the valid value.
The access violation occures at the next line after p has been intialized.
ritz1234
|
|
|
|
|
How v is declared?
Why don't you use accessor methods (i.e. int getCount() , void setCount(int x) )?
Have you made a test with a not-shared variable?
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 cPallini,
It works for me.
See you tomorrow.
ritz1234
|
|
|
|
|
i have a simple game i need creating to help later on with my course, can any one please help ASAP! thank you
|
|
|
|
|
dinozulf wrote: i have a simple game i need creating to help later on with my course, can any one please help ASAP!
Yes, someone can.
dinozulf wrote: thank you
You're welcome.
BTW have you read forum guidelines?
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
|
|
|
|
|
You will have to ask a question for someone to help you.
-Saurabh
|
|
|
|
|
How about creating a game called "LIFE" that we all are playing. It should be simple enough.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
We need to play a different game.
|
|
|
|
|
like AOM
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hello to all,
In my project I am uploading some data on to the ftp server and for this I am using classes CFtpConnection and CInternetSession, means through function "GetFtpConnection" of class CInternetSession I am getting pointer of class CFtpConnection and then using that pointer I am using function "PutFile" of class CFtpConnection which actually uploads data of my computer to the server folder mentioned.But now the problem is that, uploading is getting failed and if traced the error through "GetLastError" I am getting error code "12031" which indicates "Manifest Parse Error:Incorrect syntax was used in a comment"(as per MSDN help) but I am not getting actual meaning of this error,can anyone tell me exact meaning of this error? why my data is not getting uploaded on to the server? actually internet speed is also good but still uploading is getting failed,can anybody help me please? its very urgent,please help me.
Thanks and Regards,
Anay
|
|
|
|
|
AnayKulkarni wrote: ...if traced the error through "GetLastError" I am getting error code "12031" which indicates "Manifest Parse Error:Incorrect syntax was used in a comment"(
Are you sure that's not 14031?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
No I have checked it many times,it is 12031,please can you help me?
Anay
|
|
|
|
|
AnayKulkarni wrote: No I have checked it many times,it is 12031,
Where? I just checked here and this it what it has:
#define ERROR_SXS_XML_E_COMMENTSYNTAX 14031L
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
AnayKulkarni wrote: I am getting error code "12031" which indicates "Manifest Parse Error:Incorrect syntax was used in a comment"(as per MSDN help)
Where do you get that? MSDN states:
ERROR_INTERNET_CONNECTION_RESET
12031
The connection with the server has been reset.
(Source: WinINet Error Codes[^])
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I am doing a project on applications of ip camera.I would like to know how to connect an ipcamera to the application using vc++.Is mpeg4 format supported in VC++/MFC?
Please reply.
|
|
|
|
|
hi,
i have same problem in connecting to ip camera,
please help me.
|
|
|
|
|
Hi Friends,
please reply ......
Windows Vista provides a slider control to resize icons ( thumbnails) in My Computer Explore view.
I need such resizing in my Windows XP application. Please provide what should be the logic to achieve the things smoothly.
One solution that I think is:-
1) 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
|
|
|
|