|
I've studied up on the issue enough to have convinced myself that any further effort to use any system capabilities to determine the count of bytes previously written to an IStream would be fruitless. While Microsoft's documentation does push the analogy that IStreams are pretty much like files, the fact is that the analogy only goes so far. It appears that some file capabilities don't exist for IStreams in compound storage, and I'd guess at this point marking the end of written bytes is one of them. It follows from this that there is nothing akin to a SetEndOfFile().
It occurs to me that these missing capabilities could be coded into an app that uses compound document files, for example creating a seperate IStream to store the actual length of data written into other IStreams.
|
|
|
|
|
Hi all,
i checking the link status some times it takes so much time i want if the link status is not return in 2 min its time out this function and process further commands and functions.
please tell me how can i do this.
thanks in advance.
|
|
|
|
|
|
When I did this, I called HttpSendRequest() in a separate thread. See MSDN article Q224318 for details.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
If you use the nested loop do something. you can count the time, if overtime, show one your timeout excetpion to goto the outest .
|
|
|
|
|
Hi,
How to generate this type of number in header files?
#if !defined(AFX_COL_H__1C5B8C95_F2A0_424C_9CAB_CCF5E76B642E__INCLUDED_)
#define AFX_COL_H__1C5B8C95_F2A0_424C_9CAB_CCF5E76B642E__INCLUDED_
|
|
|
|
|
They are usually generated automatically when you create a new class through the MFC wizard.
On the other hand, you can perfectly attribute one yourself, usually the filename is used in someone (e.g. MYFILE_H). As long as the identifier is unique, its perfectly fine. You can also use the #pragma once directive which has been added in more recent compiler versions.
|
|
|
|
|
To get new GUID s you've to use guidgen tool, see here[^] for the steps required to run the tool from the Visual Studio IDE.
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
[My articles]
|
|
|
|
|
The other replies must be good enough for you.
Nevertheless, you can do this programmatically using APIs like UuidCreate , UuidCreateSequential etc.
|
|
|
|
|
Thank you!
I thought there might be a way to generate the uid along with the header creation.
In the above all replies we've to get uid separately and then append it to the header macro separately....
|
|
|
|
|
But my visual studio do not output uid insteaded by "#pragma once"
|
|
|
|
|
Is there any way to find how many instance of an applications are running?
|
|
|
|
|
using EnumWindows API.
Which is give the handle of running applications .
Get window text from from CWnd * wnd and compare text with your application name.
|
|
|
|
|
Click here ->[^]
May be this link will help you..
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
As long as your code compiles to an exe, you can do it this way:
- Add the following lines on top of one of your cpp files:
#pragma data_seg("shared")
LONG g_counter = 0; #pragma data_seg()
#pragma comment(linker, "/section:shared,rws") - Execute the following instruction as soon as possible at startup of your application:
InterlockedIncrement(&g_counter); - Execute the following instruction immediately before exiting from your application:
InterlockedDecrement(&g_counter); - When you need the number of instance of your application currently running, use this code:
LONG instances = InterlockedExchangeAdd(&g_counter, 0);
This method works properly only with exe because they are never relocated while loaded; the trick is to create a section whith the read, write and shared attributes and put there a variable used to count the instances. This way that variable is shared between all the instances of your application, and you can use the Interlocked Variable Access[^] functions to safely access the variable.
See also data_seg (C/C++)[^] and /SECTION[^] for more details on how this code works.
|
|
|
|
|
hi all,
i have an application which requires to monitor USB activities(only USB mass storage devices).
i need a small help on how to differentiate between USB mass storage devices and USB Mouse/Keyboard/Printer (USB HUMAN INTERFACE DEVICES) etc...
could it be done through device ID??
some code will help a great deal...
Thank You all.
|
|
|
|
|
In USB terminology, an interface is what we normally would call a device.
For example, a printer can have a scanner and mass storage in a single unit.
Each interface has a property called an interface class.
For mass storage, this property will have a value of 8.
You can see a list here - http://www.usb.org/developers/defined_class[^]
You can get this by reading the configuration descriptor of the device.
|
|
|
|
|
Hi _Superman_,
i already know the device descriptor properties...
however, if i could get some code help it would be great....code on how to enumerate the base class of a USB device....
|
|
|
|
|
The interface class is one of the fields in the interface descriptor.
The field name is bInterfaceClass .
So after you get the interface descriptor, check if bInterfaceClass is 8 for Mass Storage.
|
|
|
|
|
Hi all
I have question about Sleep Function.If i use Sleep function and set sleep values 30mins. But After 10mins i want to change Sleep values like 1mins or 2min.
Is it possible.Please advice me.
|
|
|
|
|
Yes, it is possible: just set the Sleep interval to 1 minute (or whatever appropriate) and iterate it 30 times, then, whenever you need to shorten the wait delay, decrease the iteration limit.
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
[My articles]
|
|
|
|
|
But if you give sleep 1 hour, then what happen?
I think it is not possible or we need to interrupt hardware.
|
|
|
|
|
Well, you may use WaitForSingleObject instead.
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
[My articles]
|
|
|
|
|
OK,but How we stop sleep function? as we already put sleep for 1 hour.
|
|
|
|
|
You cannot stop it (well, without a hammer...).
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
[My articles]
|
|
|
|