|
I look for a function that doing it
|
|
|
|
|
Hexadecimal, octal and decimal representations of numbers are used only when the number is converted to text for reading by humans. The computer always handles the number as binary. If you want to save it in a text file as hexadecimal, use the fprintf function instead of printf.
|
|
|
|
|
i wrote some code in destructor for the purpose of deletion after object have been used.
by the way, error is occured in "delete pObject" sentence.
i don't know why the sentence is happened.
the code is like the following.
********************************************************************************
CPerson::~CPerson()
{
for(int i=0; i< m_PtArray.GetSize(); i++) // m_PtArray is CObArray type.
{
CObject* pObject = (CObject*)m_PtArray.GetAt(i);
delete pObject;
}
m_PtArray.RemoveAll();
}
********************************************************************************
have a nice day
|
|
|
|
|
Why do you need to do the case ? Is it not a CObject * already ? If it isn't, then surely the wrong destructor is going to be called ?
Also, have you tried going in reverse order ?
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
Try:
CObject* pObject
for(int i=0; i< m_PtArray.GetSize(); i++) {
pObject = NULL;
pObject = (CObject*)m_PtArray.GetAt(i);
if(pObject)delete pObject;
}
|
|
|
|
|
Hi all,
I'm writing program about database.
In my database i have 3 tables:
CDINFO, PERSON, GETGIVE
And i have 3 fields in CDINFO table:
FILMNAME ---> Text
FILMCODE ---> Integer
COUNT ---> Integer
I'm using of three objects of CDaoRecordset for opening each table ...
Now, i want to add new record in CDINFO:
COleVariant var;
char *szFilm = new char[50];
var.vt = VT_INT;
GetDlgItemText(IDC_EDIT1, szFilm, 50);
var.intVal = GetDlgItemInt(IDC_EDIT2);
m_rsCDINFO->AddNew();
m_rsCDINFO->SetFieldValue("FILMCODE", var);
m_rsCDINFO->SetFieldValue("FILMNAME", szFilm);
m_rsCDINFO->SetFieldValue("COUNT", var);
m_rsCDINFO->Update();
SetDlgItemText(IDC_EDIT1, "");
SetDlgItemText(IDC_EDIT2, "");
delete[] szFilm;
This code have not any error or warning, but when i'll running this code, program indicate to me error about: "Out of memory" !!!
Please tell me, what is my wrong ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I need to put a jpeg in a dialog , i used a CImgEdit .
when i use it in a regular mfc application it's working good,
but when i use it in a dll ( the same application but i changed it
from Exe to Dll ) it isn't working.
can someone help me ?
Thanks.
|
|
|
|
|
Hello all, I want to use microsoft's text to speech, to let my software speek, but I don't know how and where to get TextToSpeech API, can you help me?
|
|
|
|
|
http://www.microsoft.com/speech/
Tons of documents, downloads, and links from there. Good luck.
|
|
|
|
|
I am developing a chm help file tool, so I need a specification for .chm file, but I cannot find it in microsoft.com, any help?
Thanks!
|
|
|
|
|
What is the purpose of the .chm file? Is is specific to a particular program or something? That info sure would help me help you....
-Reid the C++/C# programmer
(Caution: I am a teenager, and that means that I think I know everything...but probably don't...)
Maybe this will help you understand:
CPerson Reid = "Teenager";
CPerson All_C_Programmers[9999999999];
int i;
int num_Programmers_That_Are_Teenagers = 0;
for (i=0;i<9999999999;i++)
{
if (All_C_Programmers[i]=="Teenager")
{
num_Programmers_That_Are_Teenagers++;
}
}
cout << num_Programmers_That_Are_Teenagers;
-------------
1 <------
|
|
|
|
|
how can i learn visual c++ in ashort way or in the long way
but not in along time.where can i get exampels an stuff?
thank you for your help
itai
|
|
|
|
|
This is bad, bad advice. Some of the books mentioned are good books, but no-one, repeat no-one should EVER set out to learn programming Windows without learning C++. In fact the Visual C++ in 21 days is a very simple book, it was my second. The reason I grasped it easily and this person obviously did not is not my stunning intellect ( ask anyone who has met me ), it's because my first book was C++ in 24 hours. Forget windows, menus and everything else until you know enough C++ to write a linked list, populate it from command line input and write it to a file. Once you know some C++, then you'll know half of the stuff in the Visual C++ book, and you'll be able to concentrate on the other half.
C++ is a language created by Bjarne Stroustrup, which amonst other things added classes to the C language. The C++ language does not know about MFC, you can write Windows programs in C++ without using C++, but MFC is a class library that *does* simplify Windows programming.
I'd also recommend buying books instead of downloading them - it takes forever and in the end they are not practical. The books I downloaded early on I either did not use, or I bought.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
Thank you
You look very boring ...
AHMAD ALWASHALI
|
|
|
|
|
I'm sorry if you took my comment personally, but your advice *was* bad, and I'm also sorry that you think learning to program properly sounds 'boring'.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
I was wondering in terms of efficiency, what is the best way of passing strings and arrays around? What is the penalty one incurs when passing a CString as a opposed to a CString * or when you simply pass by reference?
|
|
|
|
|
If a function takes a CString, a call to the copy constructor is made since the function gets its own copy of the parameter. Passing a CString* or CString& avoids this.
The CString copy constructor is quick (it just increases the string's reference count) but that's not always the case with all classes. If the function is going to just read the string, make the parameter a const CString&, which is best semantically and speed-wise.
--Mike--
http://home.inreach.com/mdunn/
"Make sure that if you are using a blow torch that you don't set anything on fire."
-- Chris Maunder
|
|
|
|
|
does anyone know how to open up a serial port under NT?
i have had no problems with it under 98, but whenever i attempt to get it to work under NT nothing seems to happen...
Nik V
|
|
|
|
|
There's no fundamental difference between both OSs when it comes to opening serial ports. This should open up "COM1"
HANDLE hCOM1=CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Ever since I have been using Windows ME, Most MFC apps I create that use Docs do not have the familiar "Untitled" on the titlebar. What I get is this: "____- Appname". Also, many message boxes have only "____" instead of actual text. Common dialogs like the SaveAs dlg will often have "_______" in the titlebar. I have noticed this in other programs that I did not code. MS Paint comes to mind.
Has anyone else experienced this?
Steve
|
|
|
|
|
You know, I think Ive seen error messages come up as "______- Appname" in Win ME, but havent had the time to find out why.
Its probably something really basic that Im missing.
|
|
|
|
|
How can I get a CListCrtl Item into, say, a CString when it is clicked?
Thanks.
Richard
|
|
|
|
|
When you assign the CListCtrl a variable in the Class Wizard, make sure you assign a variable to the control, and the value...Cumon, you know what im talking about... when you assign the CListCtrl's control ID a variable, it asks for a name: m_?????
then a catagory (in a combo box): Control <----select VALUE here
then for a type (in a combo box): CListCtrl (or whatever)<---select CString here
-Reid the C++/C# programmer
(Caution: I am a teenager, and that means that I think I know everything...but probably don't...)
Maybe this will help you understand:
CPerson Reid = "Teenager";
CPerson All_C_Programmers[9999999999];
int i;
int num_Programmers_That_Are_Teenagers = 0;
for (i=0;i<9999999999;i++)
{
if (All_C_Programmers[i]=="Teenager")
{
num_Programmers_That_Are_Teenagers++;
}
}
cout << num_Programmers_That_Are_Teenagers;
-------------
1 <------
|
|
|
|
|
Not true. I am a teenager too.
-Matt Newman
|
|
|
|
|
The fool who considers himself wise is a fool indeed.
|
|
|
|