|
I create a tri-splitter view with a CIndexView(with TVS_EDITLABELS style) in each pane, but when I click the mouse over the editbox, there is an illegal operation. the code is as following: (VC6, Debug configuration),Thanks very much!
int CTriSplitView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
// Create the splitter wnd.
m_wndSplitter.CreateStatic(this, 1, 2);
// add the third splitter pane - which is a nested splitter with 2 rows
if (!m_wndSplitter2.CreateStatic(&m_wndSplitter, // our parent window is the first splitter
2, 1, // the new splitter is 2 rows, 1 column
WS_CHILD | WS_VISIBLE | WS_BORDER, // style, WS_BORDER is needed
m_wndSplitter.IdFromRowCol(0, 1))) // new splitter is in the first row, 3rd column of first splitter
{
TRACE0("Failed to create nested splitter\n");
return -1;
}
CCreateContext *pContext = (CCreateContext*)lpCreateStruct->lpCreateParams;
if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CTreeView), CSize(150, 0), pContext))
{
TRACE0("Failed to create COutlookTreeView\n");
return FALSE;
}
if (!m_wndSplitter2.CreateView(0, 0, RUNTIME_CLASS(CTreeView), CSize(0, 450), pContext))
{
TRACE0("Failed to create COutlookTreeView\n");
return FALSE;
}
if (!m_wndSplitter2.CreateView(1, 0, RUNTIME_CLASS(CTreeView), CSize(0, 0), pContext))
{
TRACE0("Failed to create COutlookTreeView\n");
return FALSE;
}
DWORD dwTreeStyle = WS_VISIBLE | TVS_EDITLABELS;
dwTreeStyle |= TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT;
CTreeView* pView = (CTreeView*)m_wndSplitter.GetPane(0, 0);
pView->ModifyStyle(0, dwTreeStyle);
for(int i = 0; i < 10; i++)
{
CString str;
str.Format("%d", i);
pView->GetTreeCtrl().InsertItem(str);
}
return 0;
}
P.S. If above codes are placed in CMainFrame::OnCreateClient, It does work with no problem
|
|
|
|
|
sorry, there is an error:
I create a tri-splitter view with a CTreeView(with TVS_EDITLABELS style) in each pane,
CTreeView, not CIndexView
|
|
|
|
|
Anybody... I have a multiple program that access the same database file. I am using access database file and CRecordset class to implement my program. However, the different program is trying to access the database sometimes at the same time. It always give me an error that the current database file has been locked or currently in use by the user/Admin. Please.. if anybody knows my problem.. I would appreciate it very much !!!
rgrds,
Mar
Mar Solero Jr.
|
|
|
|
|
Is the database a single-user one? What mode are you opening the database and/or record set in? Is the database configured to open as shared or exclusive by default?
|
|
|
|
|
Hi David,
This is the message i encountered:
"Could not update;currently locked by user 'admin' on machine 'P1-MAR' "
Here is my code....
CTestSummary pTestSummary(NULL); // CTestSummary is derived from CRecordset class
pTestSummary.m_strFilter = "HANDLER_NAME = \'" + current_handler_name + "\'"; // select only target handler
if(pTestSummary.Open(CRecordset::dynaset,NULL)!=0)
{
pTestSummary.Edit(); // open for editing
pTestSummary.m_graph_half1 = half1; //saved the first 240 characters
pTestSummary.m_graph_half2 = half2; // saved the next 240 characters
pTestSummary.m_graph_date_time_stamp = string_default; //saved the current date time stamp
pTestSummary.Update();
}
I have several program that simultaneously edit thesame database file. I have read some documents from CRecordset class
that there will be some problem if Update() function is executed from each program , if just in case they occur at thesame time.
Is there's a way I could get some error trapping when accessing database file so that I could just bypass the Update() function if I
encountered this error. As for now, the default message box by window always show if one of this Update() failed.
Here is the construction of CTestSummary class... I use class wizard to create it..
// TestSummary.cpp : implementation file
//
#include "stdafx.h"
#include "clisock.h"
#include "TestSummary.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTestSummary
IMPLEMENT_DYNAMIC(CTestSummary, CRecordset)
CTestSummary::CTestSummary(CDatabase* pdb)
: CRecordset(pdb)
{
//{{AFX_FIELD_INIT(CTestSummary)
m_graph_half1 = _T("");
m_graph_half2 = _T("");
m_graph_date_time_stamp = _T("");
m_nFields = 3;
//}}AFX_FIELD_INIT
m_nDefaultType = dynaset;
}
CString CTestSummary::GetDefaultConnect()
{
return _T("ODBC;DSN=mddb;UID=Admin;PWD=xxxxxx");
}
CString CTestSummary::GetDefaultSQL()
{
return _T("[MachineDetails]");
}
void CTestSummary::DoFieldExchange(CFieldExchange* pFX)
{
//{{AFX_FIELD_MAP(CTestSummary)
pFX->SetFieldType(CFieldExchange::outputColumn);
RFX_Text(pFX, _T("[graph_half1]"), m_graph_half1);
RFX_Text(pFX, _T("[graph_half2]"), m_graph_half2);
RFX_Text(pFX, _T("[graph_date_time_stamp]"), m_graph_date_time_stamp);
//}}AFX_FIELD_MAP
}
/////////////////////////////////////////////////////////////////////////////
// CTestSummary diagnostics
#ifdef _DEBUG
void CTestSummary::AssertValid() const
{
CRecordset::AssertValid();
}
void CTestSummary::Dump(CDumpContext& dc) const
{
CRecordset::Dump(dc);
}
#endif //_DEBUG
I would appreciate if you could help me on this...
Thanks,
Mar
Mar Solero Jr.
|
|
|
|
|
mhar wrote:
Is there's a way I could get some error trapping when accessing database file so that I could just bypass the Update() function if I
encountered this error.
CRecordset::Update() throws a CDBException if it encounters a problem.
|
|
|
|
|
Hey, is it possible to access DLL-function as an extra procress. I need this, because some function within an User-dll are not save. Me goal is to load a DLL in an seperate process in order to prevent a crash from the main application.
|
|
|
|
|
Why not just use structured exception handlers instead?
Using this approach a hard exception such as an access violation will be caught by the __catch block and can be handled by your app in any way that's appropriate.
There's plenty on MSDN on this subject. Also check out John Robbin's "Bugslayer" series in MSJ/MSDN Magazine.
Anna
Homepage | My life in tears
"Be yourself - not what others think you should be"
- Marcia Graesch
"Anna's just a sexy-looking lesbian tart"
- A friend, trying to wind me up. It didn't work.
Trouble with resource IDs? Try the Resource ID Organiser Visual C++ Add-In
|
|
|
|
|
I can use excetions in my own code, but when I use foreign DLL function I have no chance to prevent e.g. divsion by zero ...
|
|
|
|
|
If you're using C++ exceptions that's certainly true - they won't catch "hard" exceptions such as access violations.
However, a Structured Exception Handler will. Simply wrap the calls into the DLL inside an SEH __try block.
Anna
Homepage | My life in tears
"Be yourself - not what others think you should be"
- Marcia Graesch
"Anna's just a sexy-looking lesbian tart"
- A friend, trying to wind me up. It didn't work.
Trouble with resource IDs? Try the Resource ID Organiser Visual C++ Add-In
|
|
|
|
|
Can you give me more details...?
|
|
|
|
|
I'm afraid not, but it's all in MSDN. Read the Bugslayer columns for a start.
Anna
Homepage | My life in tears
"Be yourself - not what others think you should be"
- Marcia Graesch
"Anna's just a sexy-looking lesbian tart"
- A friend, trying to wind me up. It didn't work.
Trouble with resource IDs? Try the Resource ID Organiser Visual C++ Add-In
|
|
|
|
|
|
If you want to catch exceptions coming out of the DLL function, you can do the following. However, if the DLL function is "extern C", you'll have to make sure you specify the /GX compiler option for your project.
try
{
MyUnsafeDLLFunction();
}
catch( ... )
{
AfxMessageBox( _T("The DLL function crashed :(") );
}
This should handle all exceptions coming from the DLL function.
Chris Richardson Terrain Software
|
|
|
|
|
I need to load and render an object from 3dmax(3dstudio) and show it as a 3d game.
mohsen
|
|
|
|
|
The easiest solution would be direct-x9, but there's no support for 3ds files. However, there is a converter for 3ds meshes to direct-x meshes.
I did this once, it's straightforward.
using: [VISUAL STUDIO 6.0 sp5] [WIN98/2]
|
|
|
|
|
Dear Zizilamoroso,
Thanks for your help,
Please send more information about this to me.
I want to show and move 3dMax(3dstudio) Files
by visul c++,
Best Regards,
Mohsen Jamali,
|
|
|
|
|
If you want to load meshes into c++, I assume that you know how to program in c++.
So, all you have to do is this:
- install dx SDK (min. 8, pref. 9)
- find the converter on the internet (it's called conv3ds.exe or simmilar)
- convert *.3ds to *.x
- there's an example on how to load those converted meshes (*.x) into c++ dx9.
btw. There're some helper classes in a common dir somewhere. You can do something like this:
<br />
pMesh->Load("test.x");<br />
pMesh->Render();<br />
Easy or what?
regards
Zizi
using: [VISUAL STUDIO 6.0 sp5] [WIN98/2]
|
|
|
|
|
Hi, I have an MFC application with a COM interface. When I try to load a document when a call has been made to this interface, I get an assertion in OpenDocumentFile after AfxGetMainWnd() is called (wnd == NULL). I guess this call asserts because I called it from a different thread.
Anyone knows a (clean) sollution for this one?
|
|
|
|
|
To use OpenDocumentFile() from worker threads in ED (see sig) I post a message to the main thread which calls OpenDocumentFile() and then synchronize this with the worker thread. This is the only way I've found to do this sort of thing from a worker thread.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
I was afraid that was the only way.
|
|
|
|
|
Doing anything much in any thread except the main one which has anything remotely to do with CWnd* and/or MFC Handle Maps is a real pain in the backside. I go through various hoops in ED to work-around these limitations.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hexadecimal data are stored in a string(CString type).How can I
convert them to a Hexadecimal value?
LeonOrient
|
|
|
|
|
Use the CString.GetBuffer(CString.GetLength()) function to get the buffer of the CString and then use
unsigned long strtoul( const char *nptr, char **endptr, int base ); to convert the string to an unsigned long. After this, call CString.ReleaseBuffer().
The base for the strtoul function would in your case be 16.
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
This is a difficult way. At first I think as you. But after a moment
I think that since this is a frequent convertion, so the Micro Soft
should offer a function to solve the problem.
What is the function? Can you tell me?
LeonOrient
|
|
|
|