|
I've got a CHtml2View class that it's inherited from CHtmlView.
And I've got another one CMouse that handle mouse events. Somebody(I don't remember his name..) give me this code for getting mouse events. This is inside
CHml2View::OnDocumentComplete
CWnd * m_Wnd = GetWindow( GW_CHILD );
if (m_Wnd)
{
m_Wnd = m_Wnd->GetWindow( GW_CHILD );
if (m_Wnd)
{
m_Wnd = m_Wnd->GetWindow( GW_CHILD );
if (m_Wnd)
{
m_MouseWnd.SubclassWindow(m_Wnd->m_hWnd);
}
}
}
This m_mouseWnd is an instance of my CMouse class. And in the .h file of CHtml2View i've got an #include "Mouse.h" and the public variable m_mouseWnd in CMouse i've got a function that handle the right button click event. Like this
OnRButtonDown(UINT nFlags, CPoint point)
This part is workin, but i need to call back a funtion of CHtml2View called Execute, and I dont'k know how to do it, if I do an #include "Html2View.h" in Mouse.h or Mouse.cpp I've get a lot of errors !! If u need more details just ask me please. Tnx
|
|
|
|
|
Please tell me what the errors are and what the #includes are for each .cpp file, and also any #includes added to your stdafx.h
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
The includes:
In Html2View.h
#include "Mouse.h"
in Html2View.cpp
#include "stdafx.h"
#include "Html2.h"
#include "Html2Doc.h"
#include "Html2View.h"
in Mouse.cpp
#include "stdafx.h"
#include "Hml2.h"
#include "Mouse.h"
in stdafx.h:
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h>
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <afxhtml.h>
if I put an #include "Html2View.h" in Mouse.h or Mouse.cpp I get the following errors:
G:\John\Software\Visual C\Html\Hml2View.h(22) : error C2143: syntax error : missing ';' before '*'
G:\John\Software\Visual C\Html\Hml2View.h(22) : error C2501: 'CHml2Doc' : missing storage-class or type specifiers
G:\John\Software\Visual C\Html\Hml2View.h(22) : error C2501: 'GetDocument' : missing storage-class or type specifiers
G:\John\Software\Visual C\Html\Hml2View.h(59) : error C2143: syntax error : missing ';' before '*'
G:\John\Software\Visual C\Html\Hml2View.h(59) : error C2433: 'CHml2Doc' : 'inline' not permitted on data declarations
G:\John\Software\Visual C\Html\Hml2View.h(59) : error C2501: 'CHml2Doc' : missing storage-class or type specifiers
G:\John\Software\Visual C\Html\Hml2View.h(60) : error C2501: 'GetDocument' : missing storage-class or type specifiers
|
|
|
|
|
Ah, it's a view. In order to #include a view class, you need to #include the doc class first, as the view class contains a pointer to the doc, but does not include it. Try #include "Html2Doc.h", THEN include the view. Do it in the .cpp, because in the .h creates a circular reference. Put a dummy class declaration for Chtmlview in the mouse class header, as in 'class CHtmlView{};', so you can make a pointer to it a member variable.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Nop less errors but anyway it doesn't compile!! Where exactly should the dummy definition be placed? My View class it's called CHtml2View.
In Mouse.h i've got:
class CMouse : public CWnd
{
// Construction
public:
CMouse();
/ Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMouse)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMouse();
// Generated message map functions
protected:
//{{AFX_MSG(CMouse)
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
|
|
|
|
|
What were the errors ?
class CHtml2View{};
class CMouse : public CWnd
{
public:
CMouse();
CHtml2View * m_View;
/ Operations
public:
public:
virtual ~CMouse();
protected:
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
DECLARE_MESSAGE_MAP()
};
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Hi all,
What is return value in this code:
&(_variant_t("Hadi"))
I mean, return value is what kind of data types ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
surely a pointer to a variant with a char * in it ? If you want a WCHAR, then you'd do this
&(_variant_t(L"Hadi"))
Doing this would make me nervous - I don't know what would happen because you're returning the address of a variable which you're creating in the same line and is about to go out of scope. If I have to return a pointer, I create it first and don't delete it ( obviously ), so the returning function has responsibility for clearing the memory.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
It is all the source code:
long lArray = 0;
COleSafeArray ole_array;
ole_array.CreateOneDim(VT_VARIANT, 1);
ole_array.PutElement(&lArray, &(_variant_t("NAME")));
I read MSDN, i must pass void * value to second parameter in PutElement, but in this example he wrote: &(_variant_t("NAME")) !!!
I can't understand
help me ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Yes, but it's not in a return statement, like your first example, and therefore is not deleted because it is still in scope during the call.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
That creates a new _variant_t object and returns its address. However that is a temporary object, and gets destroyed at the end of whatever statement it's in, so you can't use that as a function return value, because the pointer will be invalid back in the calling code (it won't point at a valid object).
--Mike--
http://home.inreach.com/mdunn/
"....." -- Silent Bob
your with and
|
|
|
|
|
I see your website, that is nice !!!
By the way, It is all the source code:
long lArray = 0;
COleSafeArray ole_array;
ole_array.CreateOneDim(VT_VARIANT, 1);
ole_array.PutElement(&lArray, &(_variant_t("NAME")));
I read MSDN, i must pass void * value to second parameter in PutElement, but in this example he wrote: &(_variant_t("NAME")) !!!
I can't understand
help me ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
As I said already, that makes a new temporary _variant_t object and takes its address. That address is passed to the PutElement() function. Since by C++ rules, any pointer can be implicitly converted to void*, no cast is needed.
--Mike--
http://home.inreach.com/mdunn/
"....." -- Silent Bob
your with and
|
|
|
|
|
Does anyone know how to throw an exception across threads?
Is this possible at all given the stack unwinding issues? Is there perhaps some other mechanism for interrupting the logic of one thread from another without Waits or SleepEx or other sync functions. Callbacks - from timers etc. - are in the calling thread so they are no good to me.
I need to protect a block of code as follows,
Start timer
-------------
Code Block
normal exit
-------------
Timeout
timeout exit
The try/catch block is ideal but the timers run in their own threads so I don't catch nothing.
Thanks to all!
|
|
|
|
|
AFAIK throwing an exception from a thread will cause the exception to be propogated down the stack of the thread only - if it were to be caught by another thread then the operating being performed by that thread would have to be interrupted etc and it would just be a disaster as well as being unimplentable (practially at least).
A better solution is to return an error value from the thread.
--
Andrew.
|
|
|
|
|
I think you are correct and a thread can't be interrupted. I don't see any great technical difficulty in doing it (that's really what the scheduler does after all) but the system is designed not to do it, so that's that.
I looked at APCs but they only work when the thread is sleeping or waiting so that's no good to me either. I need to have functions (node/action functions for a state machine written by others) running by themselves and being timed out in the state engine which I wrote.
What do you mean "return an error value from the thread"? Do you mean the value in the terminating "return int" or some other mechanism I don't know about. I know you can get the terminating value when a thread exits is this what you mean?
Thanks for your thoughts anyway.
Joe M.
|
|
|
|
|
I think you are correct and a thread can't be interrupted. I don't see any great technical difficulty in doing it...
Yes, it is easy for threads to be suspended. However, to change the path of execution for a thread is unthinkable - I mean, if your program is carrying out a task and half way through writing to a file the control gets shifted to a code handler you've had it.
Yes, I did mena the terminating return int statement.
--
Andrew.
|
|
|
|
|
Anyone know if it's possible to automate the build process? I have about a dozen projects in one workspace, and I want to be able to say "build all" and have it build each individual project in the right order in the right configuration. Possible?
I started to automate with NMAKE and Python, but goddam it would be nice if VC++ did it for me.
J
|
|
|
|
|
Yes, Batch Build.
In the menu look for Build and then Batch Build.
Is esay to use.
Good Luck.
Happy Weekend
Carlos Antollini.
Today is Friday!!!
SShhh Bob!!!
|
|
|
|
|
That doesn't let me customize the order.
J
|
|
|
|
|
To customize the order set the dependencies. Project/Dependencies menu pick.
HTH
Jignesh
|
|
|
|
|
You can change the order with Project/dependencies but I have a secret...
shhh, don't say nothing but sometimes carlos changes the order editing the .dsw file. Is a dangerous practice, but it works. Never change the position of the principal project.
Cheers
Nice Weekend
Carlos Antollini.
Today is Friday!!!!
SSSShhh Bob!!!
|
|
|
|
|
Thanks, but I need a little more flexibility.
What I would love to have is a batch build builder. A dialog like the batch build one that would let me pick the projects and the order, and then save that as, say, the "Debug" build. Then I could create another order for the "Release" build.
I have a workspace with a dozen projects. Some are COM servers that register themselves during the build. I don't want to have a combination of debug and release servers running, so I want to be able to say "build me the debug version of everthing", or "build me the release/releaseMinDependency version of everything".
I started to write a little script that would use nmake or something to do the build, but I was just hoping that something would already exist.
Guess not, but thanks for the suggestions.
J
|
|
|
|
|
|
That's what I needed. I hadn't realized that the macro stuff was VBScript. I thought it was just keystrokes and stuff.
Thanks so much.
J
|
|
|
|