|
I have this class declared as
-------------------------------------------------------------------
class CMyArray : public CTypedPtrArray< CObArray, CMyDataClass* ><br />
{<br />
public:<br />
...<br />
CMyArray();<br />
virtual ~CMyArray();<br />
protected:<br />
...<br />
};
-------------------------------------------------------------------
where the CMyDataClass is declared as
-------------------------------------------------------------------
class CMyDataClass:public CObject<br />
{<br />
public:<br />
CMyDataClass( );<br />
virtual ~CMyDataClass( );<br />
... <br />
protected:<br />
... <br />
};
-------------------------------------------------------------------
Upon compile I get this error:
error C2653: 'CMyArray' : is not a class or namespace name
What?! The strangest thing is that I have other classes defined in the exact same way, compiling without problems.
I searched the documentation using the error code for keyword and found some vague references to this being a known bug, but I could not work out a solution from the text. Obviously, I am doing something wrong with the CMyDataClass, since I do get the exact same construction to work with other generic classes.
------------------------------------------------------------
"Pooollyyy!! ...Polly Parrot! Wakey-wakey!"
|
|
|
|
|
I am using folowing code to insert BMP in RichEdit.
InsertPlotBitmap(CString szFileName)
{
USES_CONVERSION;
SCODE sc = ::CreateILockBytesOnHGlobal(NULL, TRUE, &m_lpLockBytes);
if (sc != S_OK)
AfxThrowOleException(sc);
ASSERT(m_lpLockBytes != NULL);
sc = ::StgCreateDocfileOnILockBytes(m_lpLockBytes,
STGM_SHARE_EXCLUSIVE|STGM_CREATE|STGM_READWRITE, 0, &m_lpStorage);
if (sc != S_OK)
{
VERIFY(m_lpLockBytes->Release() == 0);
m_lpLockBytes = NULL;
AfxThrowOleException(sc);
}
// CString szFileName=strSmile;
// attempt to create the object
sc = ::OleCreateFromFile(CLSID_NULL, T2COLE(szFileName),
IID_IUnknown, OLERENDER_DRAW, NULL, NULL, m_lpStorage, (void **) &m_lpObject);
if ( sc != S_OK )
{
TCHAR * lpMsgBuf;
::FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM, NULL,
::GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf, 0, NULL );
CString msg( lpMsgBuf );
msg += _T("\n\n\n" );
msg += szFileName;
AfxMessageBox( msg, MB_OK );
::LocalFree( lpMsgBuf );
return;
}
// m_lpObject is currently an IUnknown, convert to IOleObject
if (m_lpObject != NULL)
{
LPUNKNOWN lpUnk = m_lpObject;
m_lpObject = QUERYINTERFACE(lpUnk, IOleObject);
lpUnk->Release();
if (m_lpObject == NULL)
AfxThrowOleException(E_OUTOFMEMORY);
}
// cache the IViewObject interface
m_lpViewObject = QUERYINTERFACE(m_lpObject, IViewObject2);
if (m_lpViewObject == NULL)
return;
// setup for advises; we assume that OLE cleans them up properly
LPADVISESINK lpAdviseSink =
(LPADVISESINK)GetInterface(&IID_IAdviseSink);
// set up view advise
VERIFY(m_lpViewObject->SetAdvise(DVASPECT_CONTENT, 0, lpAdviseSink)
== S_OK);
// the server shows these in its user-interface
// (as document title and in File Exit menu)
m_lpObject->SetHostNames(T2COLE(AfxGetAppName()),
T2COLE(_T("Test")));
// all items are "contained" -- this makes our reference to this object
// weak -- which is needed for links to embedding silent update.
OleSetContainedObject(m_lpObject, TRUE);
// CHARRANGE cr;
//m_Ctrl_RichEdit.GetSel( cr );
//cr.cpMin = cr.cpMax -1;
//m_Ctrl_RichEdit.SetSel( cr );
REOBJECT reo;
memset( &reo, 0, sizeof( reo ) );
reo.cbStruct = sizeof( reo );
CLSID classID;
if ( m_lpObject->GetUserClassID( &classID ) != S_OK)
classID = CLSID_NULL;
reo.clsid = classID;
reo.cp = REO_CP_SELECTION;
reo.poleobj = m_lpObject;
reo.pstg = m_lpStorage;
LPOLECLIENTSITE lpClientSite;
GetIRichEditOle()->GetClientSite( &lpClientSite );
reo.polesite = lpClientSite;
SIZEL sizel;
sizel.cx = sizel.cy = 0; // let richedit determine initial size
reo.sizel = sizel;
reo.dvaspect = DVASPECT_CONTENT;
reo.dwFlags = REO_RESIZABLE;
reo.dwUser = 0;
HRESULT hr = GetIRichEditOle()->InsertObject( &reo );
}
This code works fine if i call from same window.But it gives error if i invoke from another dialog it gives error in the following line .
GetIRichEditOle()->GetClientSite( &lpClientSite );
can any body help me .
Learner always
|
|
|
|
|
rver wrote:
But it gives error...
And what would that error be?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
It Gives "Assertion Failed" in following function
IRichEditOle* CRichEditCtrl::GetIRichEditOle() const
{
ASSERT(::IsWindow(m_hWnd));
...
}
As in this it cannt get m_hWnd is 0x00000000.
Learner always
|
|
|
|
|
hi all,
how to prevent mfc dialog based app beign displayed on taskbar ?
Either when maximised and minimised.
Thanks.
|
|
|
|
|
hi friend,
I quote the folowing from MSDN 2003, I dont know if it really works but I hope so:
I will simply tell you the answer: you must create your dialog as a child of an invisible window that has WS_EX_TOOLWINDOW set, and you must make sure your dialog has the WS_EX_APPWINDOW style turned off. If you read the documentation’s fine print, you might figure this out—but only if you use a powerful magnifying glass.
<br />
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)<br />
{<br />
if (CFrameWnd::PreCreateWindow(cs)) {<br />
cs.dwExStyle |= WS_EX_TOOLWINDOW;<br />
return TRUE;<br />
}<br />
return FALSE;<br />
}<br />
.<br />
.<br />
.<br />
<br />
BOOL CMyApp::InitInstance()<br />
{<br />
CMainFrame* pFrame = new CMainFrame;<br />
m_pMainWnd = pFrame;<br />
pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPED, NULL, NULL);<br />
CMyDlg dlg(pFrame);<br />
int nResponse = dlg.DoModal();<br />
if (nResponse == IDOK) {<br />
} else if (nResponse == IDCANCEL) {<br />
}<br />
return FALSE;<br />
}
hope it helps
good luck
A candle looses nothing by lighting another candle
|
|
|
|
|
hi friend,
I found something on MSDN 2003 and i hope its helpful:
quote says:
I will simply tell you the answer: you must create your dialog as a child of an invisible window that has WS_EX_TOOLWINDOW set, and you must make sure your dialog has the WS_EX_APPWINDOW style turned off. If you read the documentation’s fine print, you might figure this out—but only if you use a powerful magnifying glass.
<br />
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)<br />
{<br />
if (CFrameWnd::PreCreateWindow(cs)) {<br />
cs.dwExStyle |= WS_EX_TOOLWINDOW;<br />
return TRUE;<br />
}<br />
return FALSE;<br />
}<br />
.<br />
.<br />
.<br />
BOOL CMyApp::InitInstance()<br />
{<br />
CMainFrame* pFrame = new CMainFrame;<br />
m_pMainWnd = pFrame;<br />
pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPED, NULL, NULL);<br />
CMyDlg dlg(pFrame);<br />
int nResponse = dlg.DoModal();<br />
if (nResponse == IDOK) {<br />
} else if (nResponse == IDCANCEL) {<br />
}<br />
return FALSE;<br />
}
I hope its helpful
Mohammad.
A candle looses nothing by lighting another candle
|
|
|
|
|
I have a SDI project. When I run the project there is a resource loaded that appears in the main window that has buttons, edit boxes, list boxes, etc....the user interface. I have never really understood where in the code or when a resource is loaded so that it appears in the main window. Can someone help me with this?
Thanks.
Jerry
|
|
|
|
|
Assuming you are talking about a CFormView app.
The resource is loaded and created in the CFormView::Create function. (viewform.cpp)
Which is called from the CMainFrame::OnCreate function via the CFrameWnd::OnCreate call.
Michael
CP Blog [^]
|
|
|
|
|
Hello guys and gals,
First of i'm not a programmer myself so take it easy on the programming lingo
But i'm confident you guys can help me with what im looking for or at least guide me in the right direction.
What i want to do:
I want to be able to read/search a specific processes allocated memory for specified data and then export it to notepad or whatever. For those of you that ever tried GameHack might understand better the thing im after.
Are there any tools you know of that can help me with this? If not do you have any other ideas on how i can achive this?
Thanks a bunch guys!
|
|
|
|
|
See this thread and this article for ideas.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks... Kinda helpfull. TSearch seems to be usefull in "automating" the feature. Meaning i can assign hotkeys to take snapshots (and hopefully export to txt format) at any given time.
Someone mentioned to me that perl maybe the best language to create the "ultimate" tool im looking for. Any comments on whether or not perl would be usefull for this?
|
|
|
|
|
stumdoes wrote:
Any comments on whether or not perl would be usefull for this?
The only thing I know about Perl is how to spell it.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
ha ha ha.. Kinda saw that one comming since im in the C++ fora
Merry Xmas mate and thanks for the help so far!
|
|
|
|
|
stumdoes wrote:
Kinda saw that one comming since im in the C++ fora
I do know plenty of other programming languages, Perl just happens to not be on that list. With the potpourri of programmers we have here, surely someone can offer some insight, although you might have to try different forums. There's also the Usenet newsgroups.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Well ive been doing some reading here and on diffrent forums. Seems some have been wanting to do the same thing i am after with VB and have been shutdown but other programmers since they say its simply to hard in VB. Alltho they recomend C for the job.
Lets say i can identify the addresses of the memory data im intressted in with TSearch for instance. How hard would it be to program a piece of C to simply read these addresses and dump them to a txt file with a push of a button/hotkey? Im pretty sure you can add parameters to the ReadProcessMemory function, no?
|
|
|
|
|
stumdoes wrote:
Lets say i can identify the addresses of the memory data im intressted in with TSearch for instance. How hard would it be to program a piece of C to simply read these addresses and dump them to a txt file with a push of a button/hotkey?
In effect, that's what the picture in this article depicts. The contents of memory location 0x791188 are being displayed in the bottom box.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi all ,
\LibraryAppl.cpp(44) : error C2143: syntax error : missing ';' before '*'
\LibraryAppl.cpp(44) : error C2501: '_Connection' : missing storage-class or type specifiers
\LibraryAppl.cpp(44) : error C2501: 'gCon' : missing storage-class or type specifiers
MainFrm.cpp
Generating Code...
Can anybody help for above Error ...
if i import the Msado15.dll and delcare _Connection Globaly it give me error
but if i do it in new work space it does not ......
( and i dont wnat to write the application again )
Thx..
x86
|
|
|
|
|
Do you have source code for LibraryAppl.cpp ?
Can you post another message with lines 43, 44, and 45 of that source file?
It seems that LibraryAppl.cpp did not get the include file for Ado before compilation of the source file started.
|
|
|
|
|
Can any body give the simple code by which i can count total number of characters typed in a RichEdit Control 2.
Pls
Learner always
|
|
|
|
|
How about GetWindowTextLength() ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Can any body tell me the code to insert emoticons ("bmp picture") in RichEdit Control 2 which replace by special character like ':' and ')'.
Learner always
|
|
|
|
|
Hello,
I want to invoke a webservice from a C++ project with a structure as a parameter. I ve tried that with a soap COM object through the "invoke" procedure but it accepts only predefined types (of type VARIANT). There is no possibility to put a user defined structure as a parameter.
can someone help on this issue to find an alternative or a work around ?
Thanks in advance
Selim Ben Yedder
|
|
|
|
|
Are you using Visual Studio 6.0 ?
If yes, consider moving to Visual Studio .Net 2003. It has the excellent Add Web Reference wizard, which will generate wrapper classes for Web Services. This means that if a Web Service's WSDL defines that it takes an array, the invoking method of the class also requires an array.
If you can't upgrade the environment, try fetching the latest SOAP Toolkit from Microsoft and installing it. It's support will be retired in April 2005, but it's still available for download here[^]. The main reason for SOAP Toolkit deprecation is the coming of .NET Framework, which inherently supports Web Services. Using .NET requires Visual Studio .Net 2002 or later, though, so you're in the same problem again.
The SOAP Toolkit specifies the COM object SoapClient30 . This COM object can initialize itself based on a WSDL file. Having said that, obtain a WSDL file for the Web Service you wish to use, use COM to create the SoapClient30 object, initialize it with the WSDL file, and you can directly call the method that takes an array as a parameter.
-Antti Keskinen
----------------------------------------------
"If we wrote a report stating we saw a jet fighter with a howitzer, who's going to believe us ?"
-- R.A.F. pilot quote on seeing a Me 262 armed with a 50mm Mauser cannon.
|
|
|
|
|
I have an App. A which is accessing a text file. I have created App. B to update automatically the contents of the text file. But I do not want to exit App. A just to recognize my changes. What should I do to make this possible. The only changes I can do is on App. B, since I have just created that application.
|
|
|
|