|
try this
CPoint pt;
GetItemPosition( 0, &pt );
int nItem = HitTest( pt);
if( -1 != nItem)
{
// u will get the item index here
}
nave
-- modified at 3:52 Friday 21st April, 2006
|
|
|
|
|
|
iterator find(const key_type& k);
const_iterator find(const key_type& k) const;
-- modified at 1:11 Friday 21st April, 2006
|
|
|
|
|
followait wrote: iterator find(const key_type& k);const_iterator find(const key_type& k) const;
There function Signature will be same at compile time!
"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
|
|
|
|
|
I have tried this in DLL:-
class AFX_EXT_CLASS me
{
public:
int find(const int & k);
const int find(const int & k) const;
};
and funtion signature comes out to be
:-
?find@me@@QBE?BHABH@Z(for non const function) and ?find@me@@QAEHABH@Z for const function
"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
|
|
|
|
|
Yes. The first one returns an iterator that you can use to manipulate the stored value, the second one does not. There is more to it than that, the second will also be called by other methods that are marked with const without the compiler getting upset.
Try something like this to see the diffence:
class MyClass
{
public:
int Func(int i) { return(i); }
int Test() const { return(Func(0)); }
};
The compiler should complain when you call Test().
class MyClass
{
public:
int Func(int i) { return(0); }
const int Func(int i) const { return(0); }
int Test() const { return(Func(i)); }
};
The comiler should no longer be complaining, because it can now call a version of Func() that promisses not to change any of the data.
I have not tested these particular examples, but they should work. Note that the return of const int is not needed here, it could be changed to int . The key is the const following the declataion, which is a promise that it will not change the state of the class.
I hope that helps and that you now understand that it does make sense.
INTP
Every thing is relative...
|
|
|
|
|
followait wrote: iterator find(const key_type& k);
const_iterator find(const key_type& k) const;
While return-types are insignificant for overloading, const ness makes a difference.
So these two functions are really two different functions with the same parameters.
The const flavour is called when you invoke find() on a const map -object and returns only const references.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
Is there any API to check whether a folder with a given name is already there in the system?
|
|
|
|
|
Hi,
I can't remember that I've ever met similar function but you can use others to check existence - it depends on what do you want to get e.g.:
- if you only want to check existence:
if( GetFileAttributes( sFileName ) == -1 )
return FALSE;
- if your folder should always to be: CreateDirectory
etc.
-----------
Mila
|
|
|
|
|
But all these functions are checking the current directory only. I want to check the entire system.
|
|
|
|
|
hm I'm not sure that I understand ...
e.g. GetFileAttributes (GetFileAttributesEx) checks file/folder pointed at (first) parameter - it can be useful when you know what are you want to check.
If you want to move along your folders and theirs subfolders on your disk, better way is use FindFirstFile & FindNextFile functions.
-----------
Mila
|
|
|
|
|
Aryan S wrote: Is there any API to check whether a folder with a given name is already there in the system?
try api PathFileExists
"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
|
|
|
|
|
I have only the directory name. I dont have any path. Now I want to check whether the directory is present in my system or not (Like windows search option). Is it possible witj any API?
|
|
|
|
|
Use the FindFirstFile() /FindNextFile() pair.
"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
|
|
|
|
|
hi all,
i would like to write a small app that detects which .NET runtime (if any) are installed on the client. this way the can check for the runtime without actually having it.
if a minimum requirement is not met it forwards them to a site which has the requirement for download.
how do i actually get the .net runtime?
i can do it from c# but i dont want that.
1. should i enumerate registry (not really backward compatable) or
2. looks for fs directories (this may vary)
3. use windows API (this is where i need the help) or is there another way ?
kind regards,
g00fy
|
|
|
|
|
May somebody tell me how to get the selected text in the editView?( not using GetSelectedText() )
3ks!
|
|
|
|
|
Use GetDlgItemText()
or
GetWindowText()
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
-- modified at 0:04 Friday 21st April, 2006
|
|
|
|
|
first get the edit ctrl in the CEditView using
CEditView:GetEditCtrl()
Now u will get a pointer of CEdit from which u can get the selected text
nave
|
|
|
|
|
GetWindowText() can do the trick for you.
Project4Hire.com - Find Freelance Progammers and Graphic Designers for all your project needs
|
|
|
|
|
1) Use GetEditCtrl() to get a pointer to the edit control.
2) Use the edit control method GetSel() to get the starting and ending character positions.
3) Use that information to read the selected text by using the edit controls CharFromPos() method in a loop.
INTP
Every thing is relative...
|
|
|
|
|
Hello, everyone!
I encounter a strange question.
I create a CPropertyPageEx object and pass a "HBITMAP hBitmap" as
a parameter to the CPropertyPageEx::construct()
But in Vista the bitmap can't be displayed, however in XP it can
be displayed.
Who can tell me the reason, thank you !
|
|
|
|
|
Heyho everyone,
I'm currently working on a Network Application with a Client and 3 Servers who split up work. A lot of Data has to be transfered especially to one of those servers. I worked out a Data Packet Layout and I wanted to ask you if you think that this is a good idea. Because I'm not sure. It's an XML-based Packet Communication and looks like this:
<DataPacket>
<Header>
<Some Tag>Blablabla</Some Tag>
<Another Tag>Hello World</Another Tag>
<Checksum>The Checksum</Checksum>
</Header>
<Data>
<Type>Some Type</Type>
<Length>Length</Length>
<Checksum>The Checksum</Checksum>
<Data> Our real Data ! </Data>
</Data>
</DataPacket>
So this is the layout. But I'm not really happy with it because I think this is getting a huge bunch of Data.
How would you do this ? Or do you have any improvements ? Or shall I maybe don't do this with XML and just as a binary packet ?
Thank you,
Benedikt
|
|
|
|
|
I am a C# programmer, I have the C++ complier, but not the full blown version. I was wondering if anyone would mind making me a DLL really quick, I have all the code done(not sure if it works perfectly.) I have tested the code with another small app written in C++ but it was complied using 3rd party software and that software doesn't allow DLLs to be created.
Thanks for any help!
|
|
|
|
|
I am running a program that manipulates images using int arrays as a substitute for the images. Well I can't create another one because it causes a stack overflow error.
If I make it 200x100, I have enough space. If I make it 200x200, it goes over. I have read that you can increase the stack size using /F 1024000 but that doesn't seem to work.
Any ideas?
Right now I have converted all the arrays to short instead of int as a workaround but that seems silly on a machine with 512MB of RAM.
|
|
|
|
|