|
File mapping, that's it allright
I hope that's not too buggy, that ms lib.
tnx!
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
Grote Smurf (aka frisco) wrote:
I hope that's not too buggy, that ms lib
File mapping is a feature implemented at OS level - so it's hardly a 'lib'
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
So, it's really "core"-gates stuff? I'm already having a breakdown ...
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
|
Almost finished ...
It's not so hard cause I don't need to syncronise between processes. One process writes and another reads. While one process writes, the read processes can be disposed without further action.
With syncronisation, that's another pair of sleeves
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
Hello,
I need to include instructions of compiling different kinds of files to others. I have all those compilers on my computer, but how can I tell my makefile or visual studio where they are. I know I could put the path in front of the compiler name, but the problem is that some of those use preprocessors and those I don't call myself.
-Janetta
|
|
|
|
|
In VC, you can use the Tools:options and directories to configure the executable files (paths) that are searched for the compilers/linkers used in your makefile.
Roger Allen
Sonork 100.10016
I think I need a new quote, I am on the prowl, so look out for a soft cute furry looking animal, which is really a Hippo in disguise. Its probably me.
|
|
|
|
|
I use the splitter window in my project.Left view is derived from CTreeView , and the right view derived from CFormView.I added MS FlexGrid 6.0 and Remote Data Control 6.0 onto Form , set the DataSource of FlexGrid is connect to the RDC.Complied successfully,but when run it , reported Assert error.
Why?
Sincerely,Pole.
|
|
|
|
|
This:
Pole wrote:
Complied successfully,but when run it , reported Assert error.
is a bit vague.
Without knowing details about FlexGrid and RemoteDataControl I try to answer...
You are not trying to access the control variables before the OnInitialUpdate() has been called?
At that Time they may not yet exist.
|
|
|
|
|
I set the FlexGrid's Datasource attribute in Resource Editor.I did not code a line.
Sincerely,Pole.
|
|
|
|
|
Pole wrote:
I set the FlexGrid's Datasource attribute in Resource Editor.I did not code a line.
Maybe it is better to set the FlexGrid's Datasource attribute in ViewClass::InitialUpdate()?
|
|
|
|
|
But how to code it?I tried to do it like you say,but failed.
Sincerely,Pole.
|
|
|
|
|
In yout CFormView derived Class, you can use the C++ Class Wizard to make you a Handler for the Message 'OnInitialUpdate'.
In the body of this message-handler function, you can do the calls needed.
OnInitialUpdate() is the right function for all first-time initialisations of views and their childs.
|
|
|
|
|
I know that,but I don't know how to set FlexGrid's DataSource so that connect to the RDC(Remote Data Ctrl).
How to pragrammically set its DataSource attribute?
Sincerely,Pole.
|
|
|
|
|
Hello,
I’m trying to load A listbox object with table names from an access database file. I’m working with two dialogs. One is my main Dialog and the other is a dialog with a listbox object attached to it. When I try to add table names
To the list box an ASSERTION happens. I believe the Dialog with the listbox is destroyed before the AddString() function can load the table names. If this is true is there away around this? Any help would be much appreciated.
Thanks
Karl
<br />
void CLoadTablesDlg::OnButtonOpen() <br />
{<br />
CTableDlg dlgTable;<br />
<br />
_RecordsetPtr m_pRstOpenSchema;<br />
_ConnectionPtr m_pConnection;<br />
<br />
TCHAR szFilters[] = _T("Access files(*.mdb) | *.mdb | All files(*.*) | *.*||");<br />
<br />
CFileDialog dlg (TRUE, _T("mdb"), _T("*.mdb"),<br />
OFN_FILEMUSTEXIST | OFN_HIDEREADONLY, szFilters);<br />
<br />
if(dlg.DoModal () == IDOK)<br />
m_sFileName = dlg.GetPathName();<br />
<br />
HRESULT hr;<br />
<br />
_bstr_t strCnn("Provider=Microsoft.Jet.OLEDB.3.51; Data Source= " + m_sFileName + ";");<br />
<br />
try<br />
{<br />
hr = m_pConnection.CreateInstance(__uuidof(Connection));<br />
if(SUCCEEDED(hr))<br />
{<br />
m_pConnection->Open(strCnn, "", "", adModeUnknown);<br />
m_pRstOpenSchema = m_pConnection->OpenSchema(adSchemaTables);<br />
<br />
while (!(m_pRstOpenSchema->adoEOF))<br />
{<br />
_bstr_t table_name = m_pRstOpenSchema->Fields->GetItem("TABLE_NAME")->Value;<br />
<br />
CString strTableName = (LPCSTR)table_name;<br />
dlgTable.m_lstTables.AddString(strTableName);<br />
m_pRstOpenSchema->MoveNext();<br />
}<br />
<br />
}<br />
}<br />
catch (_com_error &e)<br />
{<br />
_bstr_t bstrSource(e.Source());<br />
_bstr_t bstrDescription(e.Description());<br />
TRACE( "Exception thrown for classes generated by #import" );<br />
TRACE( "\tCode = %08lx\n", e.Error());<br />
TRACE( "\tCode meaning = %s\n", e.ErrorMessage());<br />
TRACE( "\tSource = %s\n", (LPCTSTR) bstrSource);<br />
TRACE( "\tDescription = %s\n", (LPCTSTR) bstrDescription);<br />
}<br />
catch(...)<br />
{<br />
TRACE( "*** Unhandled Exception ***" );<br />
}<br />
<br />
}<br />
|
|
|
|
|
You can call AddString only after DoDataExchange was called (it's called by CDialog::OnInitDialog) and before dialog ends modal state.
You'll have to add strings in DoDataExchange or in InitDialog.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
Russ Freeman wrote:
I want to add a toolbar to a view and I would like it to use the command routing for enabling and disabling of buttons
You don't route commands through toolbar. All you need to do is ensure that CToolBar::OnUpdateCmdUI is called - it will use MFC routing for enabling/disabling buttons.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
Hi,
I'm trying to send a piece of mail using Simple MAPI's MAPISendMail function and, the linker is complaining that it can't find the function.
I'm linking to mapi32.lib, but this seems not to contain the function (mapi32.dll does, however, because I can access it from GetProcAddress). Does anyone know what the problem is?
Thanks,
Rich
|
|
|
|
|
I had the same problem in the past. You've got to do the lynking dynamically yourself (Microsoft admits the error here[^]. Here's some lines for the program I wrote back then, I guess it'll save you some tedious coding:
#include <mapi.h>
static HINSTANCE hMAPI=NULL;
#undef MAPILogon
#undef MAPILogoff
#undef MAPISendMail
#undef MAPISendDocuments
#undef MAPIFindNext
#undef MAPIReadMail
#undef MAPISaveMail
#undef MAPIDeleteMail
#undef MAPIFreeBuffer
#undef MAPIAddress
#undef MAPIDetails
#undef MAPIResolveName
#define MAPILogon (*lpfnMAPILogon)
#define MAPILogoff (*lpfnMAPILogoff)
#define MAPISendMail (*lpfnMAPISendMail)
#define MAPISendDocuments (*lpfnMAPISendDocuments)
#define MAPIFindNext (*lpfnMAPIFindNext)
#define MAPIReadMail (*lpfnMAPIReadMail)
#define MAPISaveMail (*lpfnMAPISaveMail)
#define MAPIDeleteMail (*lpfnMAPIDeleteMail)
#define MAPIFreeBuffer (*lpfnMAPIFreeBuffer)
#define MAPIAddress (*lpfnMAPIAddress)
#define MAPIDetails (*lpfnMAPIDetails)
#define MAPIResolveName (*lpfnMAPIResolveName)
static LPMAPILOGON lpfnMAPILogon=NULL;
static LPMAPILOGOFF lpfnMAPILogoff=NULL;
static LPMAPISENDMAIL lpfnMAPISendMail=NULL;
static LPMAPISENDDOCUMENTS lpfnMAPISendDocuments=NULL;
static LPMAPIFINDNEXT lpfnMAPIFindNext=NULL;
static LPMAPIREADMAIL lpfnMAPIReadMail=NULL;
static LPMAPISAVEMAIL lpfnMAPISaveMail=NULL;
static LPMAPIDELETEMAIL lpfnMAPIDeleteMail=NULL;
static LPMAPIFREEBUFFER lpfnMAPIFreeBuffer=NULL;
static LPMAPIADDRESS lpfnMAPIAddress=NULL;
static LPMAPIDETAILS lpfnMAPIDetails=NULL;
static LPMAPIRESOLVENAME lpfnMAPIResolveName=NULL;
if((hMAPI=LoadLibrary("MAPI32.DLL"))==NULL)
{
}
if(
(lpfnMAPILogon=(LPMAPILOGON)GetProcAddress(hMAPI,"MAPILogon"))==NULL||
(lpfnMAPILogoff=(LPMAPILOGOFF)GetProcAddress(hMAPI,"MAPILogoff"))==NULL||
(lpfnMAPISendMail=(LPMAPISENDMAIL)GetProcAddress(hMAPI,"MAPISendMail"))==NULL||
(lpfnMAPISendDocuments=(LPMAPISENDDOCUMENTS)GetProcAddress(hMAPI,"MAPISendDocuments"))==NULL||
(lpfnMAPIFindNext=(LPMAPIFINDNEXT)GetProcAddress(hMAPI,"MAPIFindNext"))==NULL||
(lpfnMAPIReadMail=(LPMAPIREADMAIL)GetProcAddress(hMAPI,"MAPIReadMail"))==NULL||
(lpfnMAPISaveMail=(LPMAPISAVEMAIL)GetProcAddress(hMAPI,"MAPISaveMail"))==NULL||
(lpfnMAPIDeleteMail=(LPMAPIDELETEMAIL)GetProcAddress(hMAPI,"MAPIDeleteMail"))==NULL||
(lpfnMAPIFreeBuffer=(LPMAPIFREEBUFFER)GetProcAddress(hMAPI,"MAPIFreeBuffer"))==NULL||
(lpfnMAPIAddress=(LPMAPIADDRESS)GetProcAddress(hMAPI,"MAPIAddress"))==NULL||
(lpfnMAPIDetails=(LPMAPIDETAILS)GetProcAddress(hMAPI,"MAPIDetails"))==NULL||
(lpfnMAPIResolveName=(LPMAPIRESOLVENAME)GetProcAddress(hMAPI,"MAPIResolveName"))==NULL){
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi, everyone!
I wondered where the variable __STDC__ is defined.
I write a simple C program to test it, before include
other .h files, the variable is already defined.
(I use #ifdef to test the existence)
I have two question about the variable:
1. Where is the variable defined?
2. What is the function of the variable?
Cheers,
George
|
|
|
|
|
__STDC__ isn't a variable. It's a predefined preprocessor macro. Your Visual C++ help would tell you that __STDC__ Indicates full conformance with the ANSI C standard. Defined as the integer constant 1 only if the /Za compiler option is given and you are not compiling C++ code; otherwise is undefined. .
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
Thanks, Tomasz my old friend!
I still have a question. Who should
define value of the macro? The source code
developer by hand? Or the system will
automatically add the setup of the macro
to the source code?
Cheers,
George
|
|
|
|
|
George Ma wrote:
Or the system will automatically add the setup of the macro to the source code?
'The system' isn't going to add the macro to sourc code. It will be predefined given the conditions described in MSDN. You can use the macro for preprocessor directives like #ifdef.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
Thanks, Tomasz pal!
I think the macro is defined at the compling time,
am I correct?
Cheers,
George
|
|
|
|
|
Hello,
This might be a stupid question . I'm trying to save and load settings in my program using CFileDialog. The problem is that opening the file I've saved fails most of the times, but not always. I'm assuming that it is because of a sharing violation, because CFileException gets a value 0xb, which means CFileException::sharingViolation. Please correct me if I'm wrong. lOsError got a value 0x20, but I can't find what that means.
So my question is, why does'nt the opening succeed? If it's because of sharing violation, what might be causing it? Not closing the file last time it was used might be, but I think it's something else, because opening fails randomly, like if I try to open it two times a row, the first trying fails and the next one succeeds.
Here's how I'm trying to do it:
void SettingsDlg::OnLoadButton()
{
UpdateData();
CString cstrFileName;
CFileDialog FileDlg(TRUE,
"cnf",
NULL,
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_NOCHANGEDIR,
"Configuration files (*.cnf)|*.cnf|All files (*.*)|*.*||");
if ( FileDlg.DoModal() == IDOK )
{
cstrFileName = FileDlg.GetPathName();
CFile* pFile = new CFile();
ASSERT (pFile != NULL);
CFileException *pExc = new CFileException(TRUE);
if ( !pFile->Open(cstrFileName, CFile::modeRead | CFile::shareExclusive, pExc) )
{
MessageBox("Error: Unable to open the file.");
delete pFile;
pFile = 0;
return;
}
bool bReading = true;
CArchive* pArchive = NULL;
try
{
pFile->SeekToBegin();
UINT uMode = (bReading ? CArchive::load : CArchive::store);
pArchive = new CArchive (pFile, CArchive::load);
ASSERT (pArchive != NULL);
}
catch (...)
{
MessageBox("Error: Unable to read from the file");
pFile->Close();
delete pFile;
pFile = 0;
return;
}
Serialize(*pArchive);
UpdateData(FALSE);
delete pArchive;
pArchive = 0;
pFile->Close();
delete pFile;
pFile = 0;
}
}
Please, help me
-Janetta
|
|
|
|