|
Only in the event of fire, fudge or extreme drunkeness.
Anna
Homepage | My life in tears
"Be yourself - not what others think you should be"
- Marcia Graesch
"Anna's just a sexy-looking lesbian tart"
- A friend, trying to wind me up. It didn't work.
Trouble with resource IDs? Try the Resource ID Organiser Visual C++ Add-In
|
|
|
|
|
but how does the windows calc do it?
IceMatrix
|
|
|
|
|
It probably uses a custom datatype or a third party library containing one.
Do a search on the web and you should find something suited to your needs. It may not, however, be free.
Anna
Homepage | My life in tears
"Be yourself - not what others think you should be"
- Marcia Graesch
"Anna's just a sexy-looking lesbian tart"
- A friend, trying to wind me up. It didn't work.
Trouble with resource IDs? Try the Resource ID Organiser Visual C++ Add-In
|
|
|
|
|
float f;
double d;
f = 3.1415926535897932384626433832795f;
d = 3.1415926535897932384626433832795;
printf( "%.32f\n", f );
printf( "%.32lf\n", d );
Output:
3.14159274101257320000000000000000
3.14159265358979310000000000000000
double has to be more precise, but the function doesnt show it!
|
|
|
|
|
I am looking for a way to get Windows to notify my application when a new USB device is attached or detached from the system.
The ideal solution would be a callback method of some kind, but a small low overhead polling loop could also work.
Thank you.
|
|
|
|
|
Windows sends a (rather, a few) WM_DEVICECHANGE message to all top level windows when *anything* in the device list changes.
You can also register for notifications for a specific device class, usign RegisterDeviceNotification()
Note: There's a bug in Win98 that makes UnregisterDeviceNotification crash.
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
Can this be done? I tried it and got assertion errors.
-- Steve
|
|
|
|
|
Maybe this will help you
http://www.codeproject.com/dialog/CDialogEx.asp
sledge
|
|
|
|
|
Hi,
I have a doubt. Please help me.
Myprogram.exe opens a text file in network with CFile::modeReadWrite | CFile::shareDenyWrite flag. Another instance of Myprogram.exe from another computer try to open the same file with CFile::modeReadWrite | CFile::shareDenyWrite flag at the same time. I would like to give the second Instance only read permission and show him the network ID of the person who has opened this file for writing.
How will I achieve it?
Thanking You
Kindi
|
|
|
|
|
Well, the first thing is easy. Just try to open the file with write access and if it fails, try open it again using only the read parameter (Use CFile::Open, not the constructor). The second thing with the network ID is a bit harder and depends on your file server.
Isn't it CVS what you want?
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Hi,
Thank you for the reply.But how would I get the network ID..Could you please tell some steps to achieve this.
How will get a valid handle of the open file..how will I get the SECURITY_DESCRIPTOR pointer and computer name..or Is there some other way to do this?
Thanking You
Kindi
|
|
|
|
|
If you are only using NT-based systems, then SECURITY_DESCRIPTOR is the right way to do it. Just keep in mind that non-NT-based systems won't work with the security API.
To open a file and get a security descriptor for it, use the Windows API function CreateFile . As far as I know the MFC class CFile doesn't support security descriptors. It sounds like it would create a file, but it also opens files normally. Read MSDN for more.
This security descriptor also contains a structure which identifies the current owner (i.e. the one who has opened the file with write permission currently).
I am sorry that I cannot provide you a short source code snippet, I never used the security descriptor APIs.
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Hi
Thank you once agian..
GetSecurityInfo() fn gives a pointer to the owner SID which needs a valid handle of open file.
LookupAccountSid() returns the account name but needs system name and a pointer to the owner SID(can be obtained from GetSecurityInfo()) .
So what we need really is system name of the process which opened the file and a valid handle of the open file
CreateFile() returns INVALID_HANDLE_VALUE for an open file whose write permission is denied.
What we have is only a file name..I don't know how to get those two parameters
Do you have more suggestions like using a mutex or opening a socket??
Thanking You
Kindi
|
|
|
|
|
Hi,
I'm using C++ in VS.NET. I've created an dialogbased MFC application.
How can I display a jpeg-picture in a dialog (MFC)? I wan't to load the picture from a file stored on my HD or/and from a char* pointing at the picture data.
Can I use the Picture Control or something easy like that?
|
|
|
|
|
Good news and bad news:
the picture control is for bitmaps only. Sorry. However, you could find a custom control that displays JPEGS and attach it to a CStatic object in your dialog. I couldn't tell you where this control could be found, but i'm sure it's out there somewhere.
-- Steve
|
|
|
|
|
You would have to use someone else's control to do that, cximage (an article on code project) seems like the most popular way to do this.
|
|
|
|
|
Here's my problem.
I've got an array of integers that are sorted. I want to find the number of elements between a range defined by a pair of values - lower and higher.
Okay so they are sorted, so I can just use a binary search on each value of a range, to find the element - but I'm not expecting exact matches so the nearest will do.
Also where there are duplicates, I want to find the lowest, and highest in respect to which value of the range I'm looking for. I don't want when searching for the low end to land first time on the right value, and find that its 1 of 3 duplicates and I may not have included it.
I cannot see anything in STL (I'm using a vector for now - though of using a multiset but not really great difference).
I could write my own with 2 binary searches leaning to finding the lowest, and the highest, but these things are frought with nast bugs, and I was hoping that someone else has done it - well they have - you need it for a database by using the BETWEEN statement in SQL!!!
Thing is I cannot find an implementation on google.
Any ideas?
"Je pense, donc je mange." - Rene Descartes 1689 - Just before his mother put his tea on the table.
Shameless Plug - Distributed Database Transactions in .NET using COM+
|
|
|
|
|
Giles wrote:
Okay so they are sorted, so I can just use a binary search on each value of a range, to find the element - but I'm not expecting exact matches so the nearest will do.
Well, binary search has pretty good time complexity - O(log2 n).
Is your array so large you want one better than that?
As for the duplicates, I'm stumped.
Vikram.
-----------------------------
My site due for a massive update.
"Good lord you yanks are getting worse than a defensive VB developer at a C++ conference." - Paul Watson in the Lounge, 31 May 2003.
"Do not give redundant error messages again and again." - A classmate of mine, while giving a class talk on error detection in compiler design.
|
|
|
|
|
No its not a large array, its just that I need to extend the binary searches so that rather than returning yes - a value exists and this is one of them, I need here are all the values between this range.
e.g.
Position/Value
0 2
1 7
2 7
3 14
4 15
5 16
6 20
7 21
8 21
9 22
I want the positions between and including 7 and 20
Poitions 1-6
Notice that I must not accidently think position 2 is the first - is the same value and must be included.
"Je pense, donc je mange." - Rene Descartes 1689 - Just before his mother put his tea on the table.
Shameless Plug - Distributed Database Transactions in .NET using COM+
|
|
|
|
|
You can use either a linear or binary search, however and inject a count and then just return the count. If you are familiar with the STL, you can implement a map and then use the equal_range member function.
-Nick Parker
|
|
|
|
|
Yep, I'm familiar with STL. Thing is, with equal_range on a map or set, it returns the iterators representing the start and end positions in the binary tree for which a number would not break the sorting. Its similar but no quite the same I think.
"Je pense, donc je mange." - Rene Descartes 1689 - Just before his mother put his tea on the table.
Shameless Plug - Distributed Database Transactions in .NET using COM+
|
|
|
|
|
There's a global version of binary_search in <algorithm> that you can use with your vector.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
you can use lower_bound and upper_bound to find the range.
there's a global version which can even be used on TYPE *'s
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
Is there a way to play a *.wav file wihtout having to link libraries to the project? Thanks
-KMaz
|
|
|
|
|
as far as i know only with linking a dll etc...
IceMatrix
|
|
|
|