|
try this:
in Root.h
class Root
{
public:
Child myChild;
}
in Child.h
class Root;
class Child
{
public:
Root* pmyRoot;
}
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Do da' phrase "spaghetti" ring a bell?
|
|
|
|
|
Great, that part works now I got to setup the pointer and use it. I will post if problems.
|
|
|
|
|
Is there a way to tell how many socket buffers are waitint for recv's at the Kernel level?
In other words, how many recv's are pending, ready for recv calls?
Thanks...
Thanks...
|
|
|
|
|
i am looking for an application that can print an HTML file without any promp dialog box, just print and that's it.i know it can be done with cHtmlView, but i don't know how to bypass the dialog box of the print.
if anyone has an application like that i would be happy to get it
thanks a lot
grospa
|
|
|
|
|
CHtmlView::ExecWB( IDM_PRINT, ...)
|
|
|
|
|
Has anybody else had this problem and if so how do you get round it.
I have the following piece of code
#ifndef Pi
#define Pi 3.1415926535897932384626433832795
#endif
#ifndef DEGS_TO_RADS
#define DEGS_TO_RADS (Pi/180.0)
#endif
double dCosine, dRotationAngle;
dCosine = cos(dRotationAngle * DEGS_TO_RADS);
In one perticular place the rotation angle is 90 degrees, and as I am sure you are aware the cosine of 90 degrees is 0. But in the above code the resulkt from the cos function is a very small number, 6.1230317691119e-017, but but this still is not zero.
Any Ideas
Cheers
AndyC
|
|
|
|
|
|
First multiply, then divide. This could have better precision, but it's hard to tell.
You are doing: angle * (pi/180)
(pi/180) is a small number, while 90 (angle) is not. Multiplying such different numbers could lead to loss of precision.
You could enhance results by doing: (angle * pi) / 180
This way 90*3.14 is comparable to 180, so you lose less precision.
Using double data type should also help.
Paolo.
|
|
|
|
|
Hello All,
I have a quick question.
I was wondering if there is an API to check if a given file (.DLL, .exe, or .OCX) is registered on the machine where the application is running.
Well, what I'm trying to do is: once my application starts I want to check if some files are registered or not, and use this information to do some setup for the application.
The other way to do this (at least what I thought of ) is to search the registry for each file, which I'm not really enthusiastic about.
Thanks in advance for your help
Fady Elias
|
|
|
|
|
You should use COM Categories to check for interfaces of a particular category.
Check out this month's MSDN Magazine - July 2001 p149
Ollie
|
|
|
|
|
Just try to instantiate the required object and check the return value. If it has not been registered you will get a "Class not registered" error.
|
|
|
|
|
instantiate? what do you mean with that?
would that work for all 3 file types : DLLs, EXEs, OCXs?
a couple of lines of codse would be great
Thanks
Fady Elias
|
|
|
|
|
The following declaration is from two header files for two classes.
Class Abstract
{
...
...
}
Class Specific : public Abstract
{
private
static const int m_nNumberOfColumns;
static const char* m_pszColumnsTitles[];
}
In the implementation file of each 'specific' class, the variables are initialised as
const int Specific::m_nNumberOfColumns = 2;
const char* Specific::m_pszColumnsTitles[Specific::m_nNumberOfColumns] = {"Account Number", "Account Name"};
As I have started to develop several 'specific' classes, I have come across a couple of
methods that should be implemented in the Abstract class like the following
for ( int i = 0; i < m_nNumberOfColumns; i++ )
{
InsertColumn(i, m_pszColumnsTitles[i]);
}
What protected data types should I declare in the Abstract class and how should I initialise them in the
specific class ctor, so that the above for loop could be put into a method of the Abstract class.
Suggestions gratefully appreciated. Thanks.
Chris
|
|
|
|
|
I'd add the following abstract members to Abstract class:
virtual int GetColumnCount() const = 0
virtual const char* GetColumnName(int columnIndex) const = 0;
The code in the 'Abstract' class would look like this:
for (int i = 0; i < GetColumnCount(); i++ )
{
InsertColumn(i, GetColumnName(i));
}
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Tomasz, thanks a lot. That's exactly what I was searching for, but the fog is clearing a little slower today than normal.
Chris
|
|
|
|
|
I am trying to create a multi column list box, using a list control with a report view. The problem is i can't seem to add text to the second and third columns. The code fragment i perform on init of my dialog is show below.
m_list.InsertColumn(1,"DISEASE",LVCFMT_LEFT,350,0);
m_list.InsertColumn(2,"CODE",LVCFMT_LEFT,80,1);
m_list.InsertColumn(3,"DESCRIPTION",LVCFMT_LEFT,350,2);
LV_ITEM lvitem;
lvitem.mask = LVIF_TEXT;
lvitem.iItem = 0;
lvitem.iSubItem = 0;
lvitem.pszText = "tester";
m_list.InsertItem(&lvitem);
LV_ITEM lvitem2;
lvitem2.mask = LVIF_TEXT;
lvitem2.iItem = 0;
lvitem2.iSubItem = 1;
lvitem2.pszText = "tester2";
m_list.InsertItem(&lvitem2);
Anyone Any Clues?
Cheers
Rich
|
|
|
|
|
The function CListCtrl::InsertItem() is used to insert new items. You need to use thr function CListCtrl::SetItem().
|
|
|
|
|
You only call InsertItem() once per row, to create the row. Use SetItemText() to put text in all the columns after the first.
--Mike--
http://home.inreach.com/mdunn/
Sometimes, arming yourself with a big pointy stake just won't do you any good.
|
|
|
|
|
Hi all,
Sorry to keep asking stupid questions, but I am very new to MFC and don't have any good reference books yet. I want to attach to the system image list in 9x / NT to display OS icons in a CListView. I've got the system imagelist handle from a call to SHGetFileInfo(...), the only way I know how, and now I want to attach it to a CImageList, but the HIMAGELIST parameter appears to be a structure of some type and I can't find any useful declarations of it in the header files.
So, the question simply is; How to I attach to the system image list??
Thanks.
Jonathan Thorpe.
|
|
|
|
|
|
That's the problem, SHGetFileInfo(...) doesn't return a HIMAGELIST, it returns a DWORD that is the handle of the system imagelist. The only way to make Attach(...) accept it is to cast it to HIMAGELIST, which works fine, but the imagelist contains 0 images (so I don't reckon it worked), although I now have no icons on the start menu anymore!! Anymore ideas? Is there a way to get a handle to the system imagelist via MFC that will return the necessary HIMAGELIST or a pointer to a CImageList object?
Jon.
|
|
|
|
|
Just cast the value returned by SHGetFileInfo:
HIMAGELIST hImgList = (HIMAGELIST)SHGetFileInfo(...);
HIMAGELIST hImgList = reinterpret_cast<HIMAGELIST>(SHGetFileInfo(...));
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
although I now have no icons on the start menu anymore!!
That's because you didn't detach your CImageList from the image list, so the CImageList destructor destroyed the underlying image list. Or you were using a list control and it didn't have the LVS_SHAREIMAGELISTS style, so when the control was destroyed, it destroyed the image list. Oops! Bye-bye icons. You'll need to reboot to fix that.
--Mike--
http://home.inreach.com/mdunn/
Sometimes, arming yourself with a big pointy stake just won't do you any good.
|
|
|
|
|
Send a message to the ListView control (for example):
TreeView_SetImageList(*this, hSysImageList, TVSIL_NORMAL);
Paolo.
|
|
|
|