Jump to content
Software FX Community

Q: Handling events in Chart FX DLL? (working example included)


User (Legacy)
 Share

Recommended Posts

Hi, (VC++ 6, Chart FX Client Server, ATL, no MFC)

Briefly first, I am not able to write the code to capture Chart FX

events via implementing ICfxEvents. On the other hand, I am

including the working example that captures the events via

WM_COMMAND.

Is anybody there to help me with the ICfxEvents?

Recently, I have read "Q1381010. Handling events in Chart FX DLL".

It says that there are two ways to capture events:

1. (COM oriented) via implementing ICfxEvents interface,

2. (not-COM oriented) via WM_COMMAND sent to the parent window.

I am including source for working application that uses the second

approach. You can extract the files to a working directory and

compile it by typing "nmake". The Debug subdirectory then contains

CFXevents.exe. No MFC is used.

Capturing of only some events is implemented, and even

some of the events are not captured even when I try (the

CN_MOUSEMOVE being the example). Probably, capturing events via

WM_COMMAND is not reliable

The article shows the basics of how CCfxEvents class is derifed from

ICfxEvents. I have also found the

"Q1381039. Implementing ICfxEvents. A template"

Putting these two together, I tried to succeed but I failed even to

build the application. While the compilation seems to be O.K., the

linker complains that the external symbol _IID_ICfxEvents cannot

is unresolved:

Linking...

CfxEventHandler.obj : error LNK2001: unresolved external symbol

_IID_ICfxEvents

Debug/Market.exe : fatal error LNK1120: 1 unresolved externals

Error executing link.exe.

The CfxEventHandler.obj is the result of compilation of the

CCfxEvents class that was built as shown in Q1381010. I still

cannot discover where the problem is.

Could you help me here?

Thanks for your time and experience,

Petr

--

Petr Prikryl, SKIL s.r.o., e-mail: prikrylp at skil dot cz

Link to comment
Share on other sites

Both methods are reliable,

In particular the MouseMoving (CN_MOUSEMOVE) is not fired by default for

performance reasons, you need to enable mouse tracking by doing:

ChartFX1->TypeMask |= CT_TRACKMOUSE;

As for implementing ICFXEvents, it's like implementing any other interface.

The error you are getting is produced because you are not defining

IID_ICfxEvents anywhere, this is common in COM when you forget to include

the header file in GUIDS.CPP file or similar that has no precompiled headers

and includes "initguid.h" prior to including anything else.

So my suggestion to you is:

- Create a GUIDS.CPP if you don't have one.

- Set the file settings so that it doesn't use precompiled headers

- Edit GUIDS.CPP and add all the appropriate windows includes

- Add #include <initguid.h>

- Add #include "CfxEvents.h"

- Recompile

post-2107-13922392282534_thumb.png

Link to comment
Share on other sites

Thanks, it works now!

Just to add, the

#include <comobj.h>

must be done before the #include <initguid.h>

Thanks again

Petr

FP wrote.

>[...]

>The error you are getting is produced because you are not defining

>IID_ICfxEvents anywhere, this is common in COM when you forget to include

>the header file in GUIDS.CPP file or similar that has no precompiled

headers

>and includes "initguid.h" prior to including anything else.

>

>So my suggestion to you is:

>

>- Create a GUIDS.CPP if you don't have one.

>- Set the file settings so that it doesn't use precompiled headers

>- Edit GUIDS.CPP and add all the appropriate windows includes

>- Add #include <initguid.h>

>- Add #include "CfxEvents.h"

>- Recompile

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...