|
The base view class to be used can be selected from the second last page I guess.
Click on your view class and select its base class.
The default is CView.
|
|
|
|
|
Thanks you superman for your reply.
Another question concerns the following code snippet. I wonder why
CListView::OnInitialUpdate();
can be called directly, without declaring an instance of the class CListView.
void CMyListView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
ASSERT(GetStyle() & LVS_REPORT);
CListCtrl& theCtrl = GetListCtrl();
theCtrl.InsertColumn(0, _T("Player Name"), LVCFMT_LEFT);
LVCOLUMN col;
col.mask = LVCF_FMT | LVCF_TEXT;
col.pszText = _T("Jersey Number");
col.fmt = LVCFMT_LEFT;
theCtrl.InsertColumn(1, &col);
|
|
|
|
|
CListView is the base class of CMyListView .
The object already existing is made of both these classes and of course the other base classes.
So creating another object will not effect the current object.
Also, this is the way the overridden derived class function calls the base class function.
|
|
|
|
|
CListView::OnInitialUpdate();
is equals this->CListView::OnInitialUpdate();
CMyListView is derived from CListView. It can derives base class's function {public, protected}.
OnInitialUpdate is the virtual function. CListView::OnInitialUpdate() means call the base class 's function OnInitialUpdate() .
I think that you should read <<c++ primary="">> <<mfc programming="">> firstly.
|
|
|
|
|
Thanks for your attention on my postinngs and your replyes.
|
|
|
|
|
Hello, I have to Write/read a file with a structure wich contains CString data, if drop out the CString data from the structure it works but if I left the CString data the program crashes when attemps to read.
Here the structure
struct MyStructure
{
CString label
unsignet char data1
BYTE data2
}
the writing
struct MyStructure Estructura;
CFile FileConfig;
FileConfig.Open("ROMconfig.dat",CFile::modeCreate|CFile::modeNoTruncate|CFile::modeWrite);
FileConfig.Seek(0,CFile::begin);
FileConfig.Write(&Estructura,sizeof(Estructura));
FileConfig.Close();
the reading
struct MyStructure Estructura;
CFile FileConfig ;
FileConfig.Open("ROMconfig.dat",CFile::modeCreate|CFile::modeNoTruncate|CFile::modeRead);
FileConfig.Seek(0,CFile::begin);
FileConfig.Read(&Estructura,sizeof(Estructura));
FileConfig.Close();
What I'm doing wrong, may be is something in relation with CString size, but I'm not sure.
And the file has to be a .dat file because is modification to an older application.
|
|
|
|
|
You can't save and read your data this way. Internally, a CString object stores its data in a pointer, so you will save only the address of the pointer and not its content. I suggest you read this article[^] which is about serialization in MFC. You'll get some ideas about how to serialize your data properly.
|
|
|
|
|
Ok, thanks , i will check it, very usefull. But for the other data types is it ok to save data i as described before? , I mean pherhaps is not the elegant way but it's working (not with CString), as I have to finish this work for tomorrow I was hoping there was a easier way, I only have to store some few words.
|
|
|
|
|
It would be easier to provide a function to save and a function to load the structure (functions in the structure itself). These functions will save and load all members of the structure. For the CString type, you first have to save the lenght of the string then the string itself (when loading, you read the lenght and then read that many characters from the file).
|
|
|
|
|
If you are using MFC then you could use the CArchive[^] class.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
hi
what is the note of using SHFileOperation function in win XP?
my program work correctly in vista but in XP it is crashed!
please help me
Zo.Naderi-Iran
|
|
|
|
|
Connot you debug it? At least, to get better help, you should post here the relevant code.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
oh, thank you and excuse me
my problem solved.
its problem was in VS 2005. with VS 2008, it is ok.
thanks
Zo.Naderi-Iran
|
|
|
|
|
Hi all,
I want save the image with the annotation made on it.But i am able to save only the image but not the annotation.
I am using LeadTools 16.5 version(C DLL).
I know this is not the right place for this question.
But if anyone knows how to save the image with annotation .please help me.
I will be really greatful to you
Thanks
Raj
|
|
|
|
|
Hi
You musr ask your question in leadtools forum.
Are you working on a DICOM/PACS project?
www.logicsims.ir
|
|
|
|
|
Hi All
I try to create database and table in Access database through this way.
_CatalogPtr m_pCatalog = NULL;
CString con="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test.mdb;Jet OLEDB:Engine Type=5";
HRESULT hr = S_OK;
try
{
TESTHR(hr = m_pCatalog.CreateInstance(__uuidof (Catalog)));
m_pCatalog->Create((_bstr_t)con);
}
catch(_com_error pCE)
{
}
.
.
.
.
m_pCatalog->Release();
CoUninitialize();
Database name(test.mdb) read from list(list have more than one database name).I use here m_pCatalog->Release();
Now when i select different database name that time this line TESTHR(hr = m_pCatalog.CreateInstance(__uuidof (Catalog)));
through exception.
Exception show
HRESULT CreateInstance(const CLSID& rclsid, IUnknown* pOuter = NULL, DWORD dwClsContext = CLSCTX_ALL) throw()
{
HRESULT hr;
point out this line
_Release();
if (dwClsContext & (CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER)) {
IUnknown* pIUnknown;
hr = CoCreateInstance(rclsid, pOuter, dwClsContext, __uuidof(IUnknown), reinterpret_cast<void**>(&pIUnknown));
if (SUCCEEDED(hr)) {
hr = OleRun(pIUnknown);
if (SUCCEEDED(hr)) {
hr = pIUnknown->QueryInterface(GetIID(), reinterpret_cast<void**>(&m_pInterface));
}
pIUnknown->Release();
}
}
else {
hr = CoCreateInstance(rclsid, pOuter, dwClsContext, GetIID(), reinterpret_cast<void**>(&m_pInterface));
}
if (FAILED(hr)) {
m_pInterface = NULL;
}
return hr;
}
I use m_pCatalog->Release() because once i create database and table then i try to free particular database.
Please help me
|
|
|
|
|
What was the exception message?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks for reply
Unhandled exception at 0x004098ec in test.exe: 0xC0000005: Access violation reading location 0x00000008
|
|
|
|
|
Did you call Release , CoUninitialize , and then CreateInstance aqain?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
Hi,
When I am trying to import data from excel to table it's giving me following error :-
An exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll but was not handled in user code
Additional information: External table is not in the expected format.
I am using following code:-
Collapse
OleDbConnection excelConn = new OleDbConnection();
excelConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" + filelocation + "';Extended Properties=Excel 8.0");
excelConn.Open();
|
|
|
|
|
if i open the excel file with excel 2003, then i'll do the query again for the file,everything goes fine, why?
how can i get the data from xls, without open it in the excel 2003 at the same time, who can help me ? thanks very much!
|
|
|
|
|
Hi everyone!
I'm using ReadDirectoryChangesW for tracking any changes in the dedicated Source folder and apply it to the Destination folder.
But, when multiple files are selected and deleted at once in the Source folder, only the first file is deleted in the Destination folder.
Is there any way to delete all files at once?
Thanks beforehand.
|
|
|
|
|
I haven't used this myself, however reading the MSDN documentation it seems ReadDirectoryChangesW fills a buffer with one or more FILE_NOTIFY_INFORMATION structures, of which the NextEntryOffset field is the key to finding the next (unless zero). From your description, it seems you are ignoring this field.
[ADDED] The doc also says nothing gets returned when the buffer is too small, which is more likely to happen when lots of things need reported at the same time. You may want to ask for a bigger buffer. [/ADDED]
|
|
|
|
|
mints555 wrote: But, when multiple files are selected and deleted at once in the Source folder, only the first file is deleted in the Destination folder.
If you are having trouble deleting files, what does that have to do with ReadDirectoryChangesW() ?
What does your deletion code look like?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|