|
there is an article in the MSDN entitled "Including HTML Help Support Files in an Application". it goes through all the steps required.
it links to a number of other useful articles.
-c
Aiei i ea eio aoa i e eio e aigoa
|
|
|
|
|
I've created an MDI application and need some help please!!! I'm having trouble trying to find information on how to open child windows. What I want to do is select a record in my database and place the information in a child. So the idea that I have is that I would open a dialog box, which would display all the records that I could open. Once I select a particular record I would like to display the information in a child window. All information given is greatly appreciated.
Thanks, Steve...
|
|
|
|
|
Hi.
I find that I often need to make a comparison between a private variable of some class with another variable outside of the class. I would like to know the best way to make the comparison. Here are two examples.
-----
MyClass mCls;
int nNum = 1;
// Assuming GetNum() returns an int private variable of MyClass.
if (nNum == mClas.GetNum())
...
-----
Here is the second possible algorithm.
-----
MyClass mCls;
int nNum = 1;
// Assuming GetNum() accepts a const reference to an int variable.
// GetNum() returns a bool based on the comparison.
if (GetNum(nNum))
...
-----
Which if any of the example is preferred? I am also aware there are other possible solutions such as the use of a pointer. However, I believe using reference is faster and is more optimized than a pointer. In general, I use const reference when possible and pointer otherwise.
Thanks,
Kuphryn
|
|
|
|
|
kuphryn wrote:
However, I believe using reference is faster and is more optimized than a pointer.
It's not faster or more optimized. References are implemented using pointers.
If GetNum is inline, you'll get the performance equal with direct access to member variable. I'd go with classic getter method. Your second version should be called CompareNum, not GetNum.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
OH. Reference is not optimized? Hmmmm. I thought reference has always been optimized and is faster than a pointer.
Kuphryn
|
|
|
|
|
kuphryn wrote:
Hmmmm. I thought reference has always been optimized and is faster than a pointer
Faster to type, maybe.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
Does anyone know the possible reason why I'm getting assertion error messages when trying to access control variables from a dialog? E.g., I have a CCombo box (myCombo) in a dialog class. When I issue the command 'myDialog.myCombo.GetCurSel()' after a myDialog.DoModal() command, I get an assertion failure message. Do I have to somewhere instantiate the control variables? Thx,
Ralf.
ralf.riedel@usm.edu
|
|
|
|
|
After DoModal returns, your controls are no longer windows (in Win32 API sense - they aren't associated with HWNDs).
Map your combo to int variable in ClassWizard or call GetCurSel in DoDataExchange/OnOK.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
I don't want to have treectrl where all items have its own images, I just want to add images to selected items, but I don't know if this is possible. Thanks for any help.
|
|
|
|
|
You may try with passing invalid image index (like -1) to SetItemImage or InsertItem. Your image-less item will be indented, however.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
That's what I'm trying to avoid, I don't want to have indented item (I coined similar solution with invalid index but of course I got indented item), I'm affraid that this is impossible, but anyway thanks
|
|
|
|
|
Well, there's always custom draw. Might be a lot of work for minimal gain though.
Shog9
|
|
|
|
|
It is possible .. but you have to have images though..Draw any images that you want..
then onInitDialog() add this line..
m_ImageList.Create(IDB_BITMAP_LIST,16,2,RGB(255,255,255));<br />
<br />
HTREEITEM hItem; <br />
m_TreeCtrl.SetItemImage(hItem,IMAGEFILE,IMAGEFILE);
hope it helps
|
|
|
|
|
Did you actually read the question?
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
I add the TVS_CHECKBOXES style,the checkboxes of the TreeCtrl looks nice.But when I create a CImageList and associated it with TreeCtrl,the checkboxes looks ugly(the mark looks small).
How to solve this problem?
Sincerely,Pole.
|
|
|
|
|
In a map with int both as key and data, what is the result of
int i = map[index]
when index is not in the map?
In the VC 6 STL impl. i equals to 0, is that what it should be or
is the result undefined?
If it is undefined, what use is the [] operator really?
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
From the VC6 STL docs:
The member function determines the iterator it as the return value of insert( value_type(key, T())).
So, if element with given key is not present, it'll be constructed using default c'tor. In the case of simple types like int, it means zeroing the bits.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
Ok, good, then i can write some cleaner code.
Things like this return value of insert( value_type(key, T())). make my head hurt.
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
_Magnus_ wrote:
Things like this return value of insert( value_type(key, T())). make my head hurt
This behavior is by design
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
_Magnus_ wrote:
If it is undefined, what use is the [] operator really?
i have no idea. i always use the long form:
myMapIterator it = myMap.find(value);
if (it == myMap.end())
{
not in the map
}
no question about the meaning of the return code.
-c
Aiei i ea eio aoa i e eio e aigoa
|
|
|
|
|
I have always done it like that to since i was unsure of the [] operator, but i rather use the [] operator since the code will look cleaner.
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
Don't forget that the index has now been added to the map i.e. the map size has increased by one. In the case you outline this may not be significant but it can be significant in other cases as the map may grow in an uncontrolled manner.
|
|
|
|
|
Yes, i am aware of that, but as you said it does not really matter in this case.
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
It may "look" cleaner, but I would agree with Chris, using the long is MUCH clearer as too what is actually going on.
For example if you have
map<int,fooobject*> fooMap
what will
FooObject* foundFoo = fooMap[3];
actually be ?
I would expect that foundFoo would be NULL if there is no entry for the value 3, but is that what will actually happen ?
If you use the long form, it is a couple more lines of code, but you KNOW exactly what will happen - no guessing.
|
|
|
|
|
In this case i have a map with rightbits and i think that
if(map[i] & bit)
is cleaner than
iterator it = map.find(i)
if(it != map.end())
{
if((*it).second & bit)
}
But it might depend on what is in the map.
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|