|
I doubt very much that this is causing your problem if you never actually reference (or allocate) these pointers. What happens when you remove the pointer array?
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
thanks for your reply!
well I don't know what I did but the error is no longer there...
hope it doesn't come back
marcela bovio
|
|
|
|
|
marcela wrote:
thanks for your reply!
You're welcome.
marcela wrote:
hope it doesn't come back
We're here if it does
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
Yeah, some newbie questions
I'm having some strange behaviour in my visual studio. It's the first time that I experience such problems.
CString string("test");
MessageBox(string);
This code gives following error:
'MessageBoxA' : function does not take 1 parameters
And the inline autofill doesn't work anymore for mfc classes, but I touched nothing in the preferences. Autofill for my own classes works fine.
Bluute tette!
|
|
|
|
|
MessageBox takes four parameters, you want AfxMessageBox.
What do you mean by inline autofill ? If you mean autocomplete, you should try visual assist from www.wholetomato.com anyhow, it's heaps better.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
|
I think that question is answered by the fact that he's using CString
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
Tom Archer wrote:
I think that question is answered by the fact that he's using CString
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
You know I'm playing with you Nish
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
Tom Archer wrote:
You know I'm playing with you Nish
Yup, I do know that Tom
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
By the way, I know it would be a pain to program and not a high-priority item, but wouldn't it be great if when someone posted a "smart app" took parameters that were specifid to a given forum so that it would make helping others easier? How many times do we see questions and the first follow-up is "Are you using MFC?". Therefore, in this forum, the Ask a Question dialog would be defined to require the answering of questions like Are you MFC (y/n), What version of VC++ are you using, etc. What do you think?
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
Hey Tom,
Good idea. Maybe, people who post questions can use a header as :-
Platform :- XP
Dev Tool :- VC++ 6.0
Libraries :- MFC
That might help.
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
Didn't this site once state that the discussion board software was open source? If so, where can the source be found?
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
Tom Archer wrote:
Didn't this site once state that the discussion board software was open source? If so, where can the source be found?
Yeah there is a CP article by I think Uwe Keim with the source code, but it's long since it has been updated.
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
Yeah I was hoping that the link would always be kept to point to the current build
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
Yep, I'm using MFC and Visual c++ 6.0
But the main problem is the autocomplete. After you've typed a "." or a "->" a box comes up with the member functions, well that doesn't work anymore for the mfc classes (it works for my own) in a certain project. Autocomplete is "on" in the prefs.
and that messagebox?
Bluute tette!
|
|
|
|
|
frisco wrote:
and that messagebox?
The MFC MessageBox wrapper is available only inside CWnd derived classes. Which class are you trying to call MessageBox from? Not CWinApp derived I hope. There you can either use the API MessageBox call or AfxMessageBox.
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
does anyone know how i can do the following as i am quite new to this language. all help greatly Appreciated.
i want to be able to create a text file, then through C++ i want to be able to add records to this text file, for example
create a new customer record, add to text file 'customer', add surname, first name etc. how do i do this
then i want to be able to search for a record within a text file. also how can i search for a record and copy it to another text file.
Cheers Si
SI
|
|
|
|
|
You want to use iostreams. There are several articles in the STL section which show you how.
Essentially:
#include <iostream>
using std::ofstream;
using std::endl;
int main()
{
ofstream file("c:\\MyFile.txt");
file << count << endl;
for (int i = 0; i < count; ++i)
{
file << customer[i].surname << endl;
file << customer[i].firstname << endl;
file << customer[i].whatever << endl;
}
file.close();
}
I have an article on how you could write a handler to stream the customer struct all in one go as well.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
<i>And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned.</i> - <b>Christopher Duncan - 18/04/2002</b>
|
|
|
|
|
Hi all,
Just wondering, after subclassing a combo-box or list-box,
What is the trick for painting a bmp as background on which
to write our text?
Making a more exciting control,
Thanks!
Orlanda
Coding is a family business
|
|
|
|
|
Never done it, but i'd try implementing a handler for WM_ERASEBKGND (MFC OnEraseBkgnd() and drawing the bitmap to the provided device context.
--------
all the modern things
have always existed
they've just been waiting
to come out
and multiply
and take over Björk, The Modern Things
|
|
|
|
|
hi,
Could you detail your explanation?
I grasp your idea.
Just that I'm kinda new to MFC...
Thanks!
Orlanda
Coding is a family business
|
|
|
|
|
Alright, so you've got this custom listbox class... Add a member variable of type HBITMAP . Call it m_pbmpPattern . Initialize it to NULL . Add the line ON_WM_ERASEBKGND() to it's message map. Add the function BOOL OnEraseBkgnd(CDC* pDC) to the class. Use this code for the implementation:
BOOL CMyListBox::OnEraseBkgnd(CDC* pDC)
{
CRect rectClient;
GetClientRect(&rectClient);
if ( NULL == m_pbmpPattern )
m_pbmpPattern = static_cast<HBITMAP>(::LoadImage(AfxGetResourceHandle(),
MAKEINTRESOURCE(IDB_BACKGROUND), IMAGE_BITMAP, 0,0, LR_SHARED));
if ( NULL == m_pbmpPattern )
return FALSE;
CDC dcPat;
dcPat.CreateCompatibleDC(pDC);
CBitmap* pbmpOld = dcPat.SelectObject(m_pbmpPattern);
BITMAP bitmap;
if ( m_pbmpPattern->GetBitmap(&bitmap) && bitmap.bmWidth > 0 && bitmap.bmHeight > 0 )
{
for (int y=0; y<rectClient.bottom+bitmap.bmHeight; y += bitmap.bmHeight)
{
for (int x=0; x<rectClient.right+bitmap.bmWidth; x += bitmap.bmWidth)
{
pDC->BitBlt(x,y, bitmap.bmWidth, bitmap.bmHeight, &dcPat, 0,0, SRCCOPY);
}
}
}
dcPat.SelectObject(pbmpOld);
return TRUE;
} Note, this is not the best way of accomplishing this; but it is a start. Read the articles on writing custom controls here at CP to get a better grip of the basics.
--------
all the modern things
have always existed
they've just been waiting
to come out
and multiply
and take over Björk, The Modern Things
|
|
|
|
|
Hey Guys
Just a quick question about good programming practice should i delete all variables i use in a function and program or just deallocate memory i have pointed to an initalise the pointers to null and let the rest be deallocated when the function/program drops out.
Peter
|
|
|
|
|
What do you mean by "deleting variables" in opposition to "deallocating memory"?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|