|
Hi there, I think I need a little help with include files. Let's say I've 4 files: foo.h, foo.cpp, yak.h, yak.cpp.
foo.h has to include yak.h in order to use the classes it has. However yak.h needs a class from foo.h, let's say class bar. If I include foo.h in yak.h everything gets messed up. Can I do sth else? Can extern help me, if yes, how?
Thankx, Themis
|
|
|
|
|
well i usually get around this but not using those classes in my header file except for pointers ( i.e pointer parameters and member variables ) If you do that than all you need to do is include a class prototype for the object you are going to be using at the top of the file. If you a non-pointer variable you must use the header file because it will try to construct the object and hence require knowledge of the implementation.
Joseph Dempsey
joseph_r_dempsey@yahoo.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
I have array of characters.I want to send it as a parameters to other function and this character may contain '0',when I do it like the code below,it only pass up to '0' character.
char c[1000];
for(int i ; i<1000; i++)
c[i] =value;
myfunc(c);
Before the last line it containcorrect value,but in myfunc() it contain only value up to '0' value.So how can I pass it correctly?
Mazy
No sig. available now.
|
|
|
|
|
What is the parameter definition of myfunc()? Does it accept a pointer to char?
myfunc(char *);
Kuphryn
|
|
|
|
|
kuphryn wrote:
What is the parameter definition of myfunc()? Does it accept a pointer to char?
myfunc(char *);
myfunc(const char szbody[]);
Mazy
No sig. available now.
|
|
|
|
|
What is the starting value for i? Hint: it ain't 0!
|
|
|
|
|
DavidCrow wrote:
What is the starting value for i? Hint: it ain't 0!
Its 0. Its just miss-typing.
Mazy
No sig. available now.
|
|
|
|
|
Miss-typing and omission are two different things:
char c[1000];
for(int i = 0; i<1000; i++)
c[i] =value;
myfunc(c);
|
|
|
|
|
maybe the problem is the declaration of myfunc(), your upper code seems alright to me...
is the declaration
myfunc(char* c) ????
is the argument a pointer?
greets,
jason
|
|
|
|
|
jason99 wrote:
is the argument a pointer?
As I said before, NO.
Mazy
No sig. available now.
|
|
|
|
|
Since arrays decay immediately into pointers, an array is never actually passed to a function. Allowing pointer parameters to be declared as arrays is a simply a way of making it look as though the array was being passed.
Therefore, any parameter declarations which "look like" arrays, e.g.
f( char a[])
{ ... }
are treated by the compiler as if they were pointers, since that is what the function will receive if an array is passed:
f( char *a)
{ ... }
This conversion holds only within function formal parameter declarations, nowhere else. If the conversion bothers you, avoid it.
|
|
|
|
|
try this:
BYTE c[1000];
for (int i=0; i<1000; i++)
c[i] = value;
myfunc(c, 1000);
and here is the definition of myfunc:
void myfunc(BYTE* p, int iLen);
|
|
|
|
|
Hi,
I'd like to use the VC IDE also with a non-MFC project.
Can I create a simple project which:
- runs a 'buildall.pl' script when I click on build icon (all dependency checking etc is done
from the build script itself).
- runs 'application.exe' when I click on run icon?
Thanks for help,
Moak
|
|
|
|
|
Anonymous wrote:
- runs a 'buildall.pl' script when I click on build icon
Yes, the IDE can perform both pre-link and post-build operations.
- runs 'application.exe' when I click on run icon?
Assuming your project is named 'application', then clicking the Run button will execute it.
|
|
|
|
|
DavidCrow wrote:
Yes, the IDE can perform both pre-link and post-build operations.
I wonder how? Do I need to create a specific project type, at which position would I enter my build script path?
Thanks, Moak
|
|
|
|
|
On the Project Settings (Alt+F7) dialog, you will see a Pre-link and a Post-build tab.
|
|
|
|
|
I only see a post-build step in the current settings (I have choosen a "tool project"). Entering a path in there has no effect for the 'build' button.
I guess, I have to choose a different type of project - anzthing you recommend?
Thanks again, Moak
|
|
|
|
|
I'm not familar with a "tool project." I do not see such an option in the Projects list.
|
|
|
|
|
Sorry, it was a "Utility project".
I tried a "Makefile" now, which let me specify everything I want. Well, basically it works, just the python-script has some problems being called from VC6. I post a new thread.
Thanks so far, Moak
|
|
|
|
|
I have a static picture control as the bottom-most control on a particular dialog box. When i create said box and show it, the picture control does not show up. I've tried setting the background mode to transparent, i've tried playing around with brushes, etc but to no avail.
Does anyone have any suggestions?
thanks in advance!
|
|
|
|
|
Hi ,
I would like to sort items contained by my columns into a CListCtrl when I click on the column header. There is a lot of example out there but they are all for Dialog App. How can I do this if I have a ClistCtrl into a CFormView? Up to now, It doesn't work.
I tried to catch message into my CformView class with OnNotify or OnChildNotify, but It don't seem to work.
Thanks for helping
Mykel
Everything's beautiful if you look at it long enough...
|
|
|
|
|
A list control is a list control, whether it's on a dialog or a form view. Assuming you are not already, you need to be processing the LVN_COLUMNCLICK message. Otherwise, provide a code snippet of what you are trying.
|
|
|
|
|
Hi!
I tried to catch it with OnNotify() but I'm not sure how to use it.
I tried this, but It's doesn't work:
BOOL CDataBaseManagerView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
NMHDR *pHdr = (NMHDR*)lParam;
if(pHdr->code == HDN_ITEMCLICK)
{
// Do my stuff over here.
}
return CFormView::OnNotify(wParam, lParam, pResult);
}
thanks
Everything's beautiful if you look at it long enough...
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CMyView, CFormView)
//{{AFX_MSG_MAP(CMyView)
ON_NOTIFY(NM_CLICK, IDC_LIST1, OnClickList1)
ON_NOTIFY(NM_RCLICK, IDC_LIST1, OnRclickList1)
ON_NOTIFY(LVN_COLUMNCLICK, IDC_LIST1, OnColumnclickList1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CMyView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
m_list.InsertColumn(0, "This is column 1");
m_list.InsertColumn(1, "This is column 2");
m_list.InsertColumn(2, "This is column 3");
m_list.InsertColumn(3, "This is column 4");
}
void CMyView::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
TRACE2("OnClickList1()\titem=%d\tsubitem=%d\n", pNMListView->iItem, pNMListView->iSubItem);
*pResult = 0;
}
void CMyView::OnRclickList1(NMHDR* pNMHDR, LRESULT* pResult)
{
TRACE("OnRclickList1()\n");
*pResult = 0;
}
void CMyView::OnColumnclickList1(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
TRACE1("OnColumnclickList1()\tsubitem=%d\n", pNMListView->iSubItem);
*pResult = 0;
}
|
|
|
|