|
Hi,
Well the problem is the constructor.
If you create an array of objects then the default constructor is called for each object in your array. If you have no default constructor, that is a constructor with no parameters or all parameters set to default values, the construction of the array will fail.
I think that's the reason why you need to implement ConstructElements to make sure the right constructor gets called.
Regards
G. Steudtel
|
|
|
|
|
Hi,
Thanks for the response.
First, I'm confused about how allocating memory for a CArray works, and second I have no idea what I'm supposed to do to store objects with a dynamically allocated data member in a CArray.
1)My book says the default version of ConstructElements() allocates memory for the number of elements you want to store in the array, but it does not call a constructor for your objects. I assume that it must allocate memory using sizeof(<class name>) then. Now, how come a regular object can be stored in the CArray but you have to do something extra for an object with a dynamically allocated data member?
2) How do you implement ConstructElements() for the simple object with a dynamiclly allocated data member that I listed in my first post?
|
|
|
|
|
Hi all,
I am using the MMC Snap in object.
i have a property sheet (the mmc property sheet). i've added 3 pages to it
and displayed it. now i need to disable tab 2 and 3......
in the call back method CreatePropertyPages(LPPROPERTYSHEETCALLBACK lpProvider,long handle, IUnknown* pUnk, DATA_OBJECT_TYPES type) - i am creating the pages using
hr = lpProvider->AddPage(....)
my question is how do i disable this page now??? the LPPROPERTYSHEETCALLBACK doesn't supply a method to do that...
can any1 help?
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
My application should properly setup with several environment variables.
I must set these before i begin debugging so i debug in the dos command line now. How can i set the environment variables in the IDE of vc6 or vs7?
Any idea?
|
|
|
|
|
Assuming you are using Windows 2000 (and probably XP), open the System applet in Control panel. Click on the Advanced tab. Click the Environment Variables button.
You can do the same thing with Windows 9x, but I'm not familiar enough with the UI to say.
|
|
|
|
|
Hi,
i want to add a link to my MFC dialog, which shall popup outlooks window for sending mails. I know how i can popup this window, but i don't know how i can add a link into my dialog which looks like the same as real links (like them in a html-Site)
|
|
|
|
|
|
Thank you, dominik!
Greetings,
hph
|
|
|
|
|
ShellExecute(..., "mailto:", ...) would be one way.
|
|
|
|
|
You can do that if you derive your dialog from CDHtmlView.
|
|
|
|
|
Hi everyone. I need to detect whether or not DAO 3.5 or higher is installed on a system, specifically the Jet engine. Both my installer and the program itself will detect this. I looked over at codeguru and found an article which says to check to see if the key "HKEY_LOCAL_MACHINE\Software\Microsoft\Jet\3.5\Engines". I assume, logically, I would check to see if the Jet 3.5 subkey exists to check if the Jet 3.5 engine is installed.
My question is, is this the best way to do this, and is it the way Microsoft recommends? I searched MSDN for hours and couldn't find an article on the proper way to detect a DAO installation. And, will this work if the user has a higher version than 3.5 installed? Thanks!
|
|
|
|
|
I have no idea what is the recommended way by Microsoft but I would enumerate all registry keys under HKEY_LOCAL_MACHINE\Software\Microsoft\Jet\ and parse the returned strings to version numbers...
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
We use a try-catch around AfxDaoInit() function to test if DAO is working correctly and abort/warn if it is not. It throws a CDaoException if something isn't right.
Joel Lucsy
|
|
|
|
|
Hi all
How to get a file's last modified time?
Thanks
|
|
|
|
|
Use the CreateFile Windows API function to get a handle to the file you wish to retrieve the date/time. Then use this function:
BOOL GetFileTime(
HANDLE hFile,
LPFILETIME lpCreationTime,
LPFILETIME lpLastAccessTime,
LPFILETIME lpLastWriteTime
);
Hope that helps
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
CFileStatus status;<br />
CFile::GetStatus("C:\\config.sys", status);<br />
CTime tm = status.m_mtime;
|
|
|
|
|
Dear All,
I am developing an application in MFC VC++ Version 6.0 for Windows 2000.
I have a structure of format
//////////////////////////
struct ren
{
char src[150];
char desc[150];
};
//////////////////////////
I am fillng this structure with some values and then store this structure in a file for unfixed number of times (there may be more than
1000 entries and at same time no entry) during my program execution.
And at an click of event i read this file as
/////////////////////////////////////////////////
OFSTRUCT of;
HFILE hfile = OpenFile(RenFile,&of,OF_READ);
do
{
n=_lread(hfile,(char *)&ren,sizeof(ren));
....................................
....................................
....................................
}
while(n!=0);
_lclose(hfile);
/////////////////////////////////////////////////
This piece of code reads the structure from the beginning of file till END OF FILE structure by structure. Now I want to it to read the other way round!!
ie. I want to read the file from last structure to the beginning of file in an efficient manner.
ie.
if the file containts the entries
ram kali--------(1)
hari kumar--------(2)
lal singh --------(3)
the file should read 3 structure first , then second and then first.
Please send your useful suggestions.
Feel free to ask any further queries in this regards,
Thanks
Rohit Dhamija
|
|
|
|
|
MapViewOfFile.
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
"Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
What do u mean by this ?????
|
|
|
|
|
This is my Logo. No offence buddy -- You are C++ guy anyway.
Regards
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
lol
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Please go through the _lseek function
Thanx
TAKE CARE
|
|
|
|
|
do u want the algo ???
Thanx
TAKE CARE
|
|
|
|
|
no the algo , i just wanted to find some ways to accomplish the task and find out the most efficient way to do.
|
|
|
|
|
I am using
fseek( stream, 0L, SEEK_END);
fseek( stream, -sizeof(FileAdd), SEEK_CUR);
to go to the last structure and will then go the second last and so on....
Please suggest some other alternatives.
Rohit
|
|
|
|