|
Hi,
I try to use a Dragonfly ActiveX - XY-Plotter in Matlab SP3.
You will find the Dragonfly ActiveX Library here: http://www.dragonflydas.com/
It's possible to set the properties of the object like colour, grid etc.
I have the problem to plot the data, because I have to call the function PlotXYData of the object with datatype Variant.
I use cell arrays or struct arrays to plot the data, but it didn't work.
I only get the bool value false back.
May you help me, how I should handle functions with datatype Variant in Matlab?
Best Regards
Tolpan
The Matlabcode:
dfpos = get(0,'DefaultFigurePosition');
hfig = figure('Position', dfpos,'Menu', 'none','Name', 'ActX-Test');
hXYChart = actxcontrol('Scope.XYChart.1',[0 0 0 0],hfig);
posfig = get(hfig,'Position'); % Clientfläche des Parent-Windows
sizeactx = [0 0 1 1].*posfig([3 4 3 4]); % Berechnung der ActX-Element-Fläche
move(hXYChart, sizeactx);
hXYChart.invoke('ResetAll'); % Eventuelle Voreinstellungen zurücksetzen
hXYChart.set('bkColor', 140000); % Farbeinstellungen
hXYChart.set('PlotBackgroundColor', 60000);
hXYCurveProp = actxserver('Scope.XYCurveProp.1');
hXYCurveProp.set('Name', 'Curve1');
hXYCurveProp.set('Key', 'Curve1');
hXYCurveProp.set('Unit', 'm');
hXYCurveProp.set('UnitFactor', 1);
hXYCurveProp.set('Max', 100);
hXYCurveProp.set('Min', 0);
hXYCurveProp.set('Color', 0);
hXYCurveProp.set('Width', 1);
hXYCurveProp.set('LineStyle', 0);
hXYCurveProp.set('CurveStyle', 0);
hXYCurveProp.set('PointSize', 6);
hXYCurveProp.set('PointStyle', 2);
% Kurve zum XYChart hinzufügen:
hXYChart.invoke('AddCurve', hXYCurveProp)
% Zeilenvektoren erzeugen:
x = [0 10 20 30 40 50 60 70 80 90 100];
y = [0 10 20 30 40 50 60 70 80 90 100];
xv=num2cell(x);
yv=num2cell(y);
size=length(x);
a=hXYChart.invoke('PlotXYData', 'Curve1', size, xv,yv)
The methods of the object are:
AddCurve = bool AddCurve(handle, handle)
GetCurveProperties = [bool, handle] GetCurveProperties(handle, string)
PlotXYData = bool PlotXYData(handle, string, int32, Variant, Variant)
RemoveCurve = bool RemoveCurve(handle, string)
ResetAll = void ResetAll(handle)
ResetCurve = void ResetCurve(handle, string)
SetAreaCurveTop = void SetAreaCurveTop(handle, string)
SetCurveProp = bool SetCurveProp(handle, string, handle)
hWnd = int32 hWnd(handle)
|
|
|
|
|
I am using the following code to test the speech api,
using SpeechLib;
using System.Security ;
[SuppressUnmanagedCodeSecurityAttribute()]
private void Button1_Click(object sender, System.EventArgs e)
{
try
{
SpVoice voice = new SpVoice();
voice.Speak("Hello",SpeechLib.SpeechVoiceSpeakFlags.SVSFDefault);
}
catch(Exception ex)
{
Response.Write(ex.ToString()) ;
}
}
I have added a reference to Microsoft Speech API through Add Reference tab-Com Componentes, i have also added the aspcompat=true @Page attribute
But it is giving the error:
System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x8004503A
Please help me to get the code to Speak.
Thanks in advance
This is naresh
|
|
|
|
|
I want to learn COM ,
am a naive to COM .
pls send me some links or simple examples
Vikas Amin
Embin Technology
Bombay
|
|
|
|
|
|
thank you
Vikas Amin
Embin Technology
Bombay
|
|
|
|
|
Hi,
hm... how to start ... I work with MSVS VC++ .NET 2003 (Windows XP SP2)
I created simple MFC DLL with automation (should work in-proccess) and added
a interface to it (based on CCmdTarget class). Everything compilation and
registration succeeds.
In my application which will be using DLL, when I do:
#import "path_to_DLL_file"
use namespace LibTest;
LibTest::ITrackerPtr ptrTrack;
HRESULT hr = CoInitialize( NULL );
hr = ptrTrack.CreateInstance( "LibTest.Tracker" );
CreateInstance returns REGDB_E_CLASSNOTREG error (CoCreateInstance returns
E_OUTOFMEMORY).
When I create similar project in MSVS VC++ 6.0 everything works fine and
problem with initiation DLL doesn't exist.
Anyone knows how to resolve this problem ? Maybe I forgot about something ?
Please help !
Mila
|
|
|
|
|
Hi. I have a problem, which I was trying to solve since a lot of hours and reading docs in the web.
The situation is:
I created an inproc-dll using the ATL-COM Wizard in VC++6. I added an ATL-class using "new atl-object". I added one property for testing purposes. I created the dll and tested it in VB6. It worked. I could create an object in VB6, set the property and read the property.
But:
If I create two objects in VB6 (using SET ... = NEW ...) and set the property in one of them, the property has the same value in the other object. So internally there is only one object with two references.
Or:
If I create an object in VB6 (using SET ... = NEW ... again), set the value and set the object to NOTHING, and then create it by new, the property still has the value.
It seems, that there is only one object in the dll, and it will not be terminated, it lives on and keeps all values ...
(As a workaround I created the same project in the same way, only as an ActiveX-EXE, set the "hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
REGCLS_SINGLEUSE)", and now I can have multiple object with separated properites and lifes and so on. But each object creates a new task in the system, and it is not an inproc-solution.
My Question is:
How can I easily change my inproc-solution, so that I can have multiple instances with separated properties and InitInstance and Terminate and so on?
Or does anyone have any sample for me?
Lots of thanks in advance ...
Heiko from GPSoverIP
|
|
|
|
|
Allowing multiple instances is normal for ATL generated COM objects. Check your source for the following macro:
DECLARE_CLASSFACTORY_SINGLETON
If this is present in an object then the object will behave as you describe.
Steve
|
|
|
|
|
Hi,
I am working on a project which involves drag and drop of data between a namespace extension and windows explorer. In this, when a file is dragged from my namespace extension and dropped on explorer I need to know on which folder the file was dropped.
Can someone please help me with this?
Thanks and Regards,
Anil
|
|
|
|
|
Hi,
I have an application in which my application uses COM of some other interfacing application. Because of this interdependency i need to recompile my COM components whenever there is any chnage in the interfacing COM Components. Is there any way to resolve the inter dependency issue. Can i use MIDL (Microsoft Interface Definition Language) to resolve this issue or can i use DCOM.
regards
Sumit
|
|
|
|
|
Can you describe this "interdependency"?
Steve
|
|
|
|
|
Hi Have an application which have COM (compatibility set to Project Compatibility). These COm have interfaces with other COM of different application. When ever there is any change (new function added or deleted, any modification) happens in interface COM i need to recopile again my COM using these new Changed COM of interfacing application.
Is there any way to sort this out. Can i use interface file(IDL) so that if in any case if there is any chnage in interface COM i need to chnage just the interface file not to recopile my COM
Regards
Sumit
|
|
|
|
|
Hi Sumit.
msumit wrote: Is there any way to sort this out
The short answer for this is simply "No, you have to rebuild".
The reason is that if there is an interface change the virtual table for the interface will change as well. If you don't use the correct virtual table you will "jump" to the wrong address when calling an interface function.
On the other hand, one of the corner stones of COM is never to change a distributed interface. You haven't provided enough information about your situation but I assume that the interfaces you are using are under construction and has not been completely specified yet and therefore, I hope, are distributed to a very small, controllable environment. Otherwise you will end up having a situation where you have clients that are incompatible with their servers among your end users and they won't be very happy about that.
Most software that are "kept alive" will usually need some kind of improvement. These improvements could be new functionality through COM interfaces. If this is the case, changing existing interfaces would break the "contract" between the server and its client(s) and the client(s) will not function properly. The symptoms will vary depending on the interface changes.
The correct solution would be to create new interface(s) for the new functionality and also not to make the interfaces too complicated and large. A guideline would be to consider splitting an interface if it contains more than 20 functions. It's a design issue.
Sometimes an original interface require modification. In that case you usually create a new version of the interface appending a number to the interface name and assign a new GUID for it in order not to break the contract between the server and its clients.
Have a look in OLE/COM viewer and you will see interfaces such as IViewObject and IViewObject2. New clients should use the IViewObject2 interface in this case and old clients would continue to use the IViewObject interface like nothing happened even if a server with the new IViewObject2 interface is distributed.
Hope this helps
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
3 steps to reduce (not to avoid completely) interdependencies between COM projects
The basic idea is that interfaces themselves change not every time the implementation modul changes. When you change some code in any source file, the module will be compiled and target binary file wil be linked.
1) Remove project dependencies from external com modules in your solution file.
2) Obtain external interfaces by using #import directive. If your external COM project has .tlb (this is the common case), #import this tlb file, not the target .dll or .exe.
3) (optional. useful for solving cross-dependencies) Collect .idl files of external COM modules in a new project that will be built first during solution build. Exclude those files from build in their native projects.
hallelujah
|
|
|
|
|
hi,
i want to open a popup window of a web page as a simple child window rather than as popup any body can help plz..??
thanx,
sufyan
|
|
|
|
|
Hi,
I am have some problems calling a DLL in embedded Pocket PC. The CoCreateInstance reply a error "Class not registered."
I have already register the DLL in the Pocket PC device and even in the emulator but I still keep getting the same error.
I have a running version for desktop but the same is having problems on embedded. In debug mode, I found that the DLLMain's parameter dwReason is = DLL_PROCESS_DETACH.
Can someone please help me?
Thanks in advance.
|
|
|
|
|
Hello All,
Not to toot my own horn...well, OK...to toot my own horn
You may recall my step-by-step DCOM tutorial for VC6, which I posted at
http://www.codeproject.com/com/HelloTutorial1.asp[^]
The tutorial isn't meant to reveal the underlying theory and gory detail of DCOM itself, just like the Scribble tutorial wasn't exactly meant to tour every nook and cranny of MFC. However, the tutorial shows each step to take to build a very simple DCOM server and client.
People have been asking me to update the tutorial for VS.NET. And, at last, the new tutorial series is in the midst of being written. Check it out at
Step 1: http://www.codeproject.com/useritems/HelloTutorial1NET.asp[^]
The tutorial is written in several "Steps" -- the main parts of the process. Step 1 is linked above, and each Step contains links to every other step.
Do me a favor, and use the rating at the bottom of each step to score that Step, and post to the Steps' message boards with your questions, and also suggestions on how to make a certain Step better etc. I welcome any and all input, and both positive kudos and constructive feedback together are great. Thanks!
Sincerely Yours,
Brian Hart
Department of Physics and Astronomy
University of California, Irvine
-- modified at 4:31 Saturday 31st December, 2005
|
|
|
|
|
I'd like to embed an IE browser control in a window, but suppress the 3D frame and scrollbars.
Using CreateControl() in an MFC project, I've created a WebBrowser2 control, which I then query to get a IWebBrowser2 interface, whose document I query to get an ICustomDoc interface, which I use to call SetUIHandler, passing my own container.
So, basically, I have a container window (subclass of CWnd), which contains the browser control, and then container window implements IDocHostUIHandler in order to implement GetHostInfo() and have it modify some of the flags that control some its appearance (DOCHOSTUIFLAG_NO3DOUTERBORDER and DOCHOSTUIFLAG_SCROLL_NO).
The only mysterious thing is that during runtime, after I call SetUIHandler(), my container window class (the one implementing IDocHostUIHandler) receives only two calls to its QueryInterface, neither of which ask for IDocHostUIHandler! First, it asks for IID_IOleCommandTarget (just after I call SetUIHandler), and later it is asked for {C4D244B0-D43E-11CF-893B-00AA00BDCE1A} which is apparently IDocHostShowUI.
Does this mean I'm going to have to implement these other two interfaces as well?
Could the browser control not be requesting IDocHostUIHandler because of the earlier failures?
Has anyone ever managed to pull off this sort of trick? (Changing embedded (as MFC control CWnd-derivative) browser's appearance)
-- modified at 13:37 Friday 30th December, 2005
|
|
|
|
|
|
Hi, hope someone can help me with this COM access violation on DLL exit...
I have a class (CXmlDom) which wraps MS IXMLDOM COM object to give some XML capability to a DLL. It was based on Tom Archers excellent article "Introducing the XML Document Object Model (DOM)" http://www.codeguru.com/Cpp/misc/misc/article.php/c3707.
The class is used, but not exposed, by dll. The dll has been successfully used in Visual Studio projects in the past.
I tried using the DLL in a new DLL, but now I get access violation on exit.
TestDlg >> NewDll >> OldXmlDll >> CXmlDom
The error occurs (in debug mode) in the destructor of CXmlDom:
_com_ptr_t<_com_IIID<msxml::ixmldomnode,&_guid_2933bf80_7b36_11d2_b20e_00c04f983e60> >::operator=(MSXML::IXMLDOMNode * 0x00000000) line 216 + 3 bytes
_com_ptr_t<_com_IIID<msxml::ixmldomnode,&_guid_2933bf80_7b36_11d2_b20e_00c04f983e60> >::operator=(int 0) line 240
CXmlDom::~CXmlDom() line 702
Based on suggestions on the web, I tried setting the smart pointers IXMLDOMNodePtr and IXMLDOMDocumentPtr to null in ~CXmlDom()
(I had assumed they took care of themselves, being smart).
However, this still gives me access violation on exit, in "pOldInterface->Release();" line 216 of COMIP.h (when it is saving interface)
I am guessing my inexperience with COM and DLLs are leading me to access stuff that has already been destroyed, perhaps due to the use of "nested" dlls.
I tried to use release and detach on smartpointers, but I still get access violations.
Any advice on how to use / unload / release the IXMLDOM COM object in DLLs would be appreciated
(I’m wondering if the COMplicated smart pointers are too smart for me – should never have tried to combine with DLLs )
Thanks
Jens Winslow
|
|
|
|
|
Make sure CoUnitialize() isn't being called before all your smart pointers go out of scope.
|
|
|
|
|
Thanks - I am not calling counitialize deliberetly, but I am guessing it is called indirectly when dll's exit / destructors called. leaves me with problem of how to stop it happening - perhaps forcing order of dll "unload" - anyone have a clue how to do that?
thanks any way - at least it gives me something to work with
Jens
|
|
|
|
|
|
Thanks Sohail - an interesting article linked on your blog
seems to be exactly my problem...but I found the solution unclear.
Sounds like I need a "pre destruct" function to call in first dll, to set the smart pointers to null (as I tried, but failed to do during destruction), then call this function before 2nd calling dll starts its destruction. Only problem is, what if 1st dll destroys first, then calling it will also fail. Seems either way I might get an access violation unless I can control sequence of dll unload.
Hm, perhaps application need to call predestructor, before terminating - except then dll is destryed for other use (not an issue in my case, but not nice - althiugh I guess I am "only" clearing non-global smart pointers, so I guess that is ok...but ugly)
<br />
App >> Dll2 >> Dll1(with smartptrs)<br />
|______>Dll2.predestoy<br />
...........|___>Dll1.predestroy<br />
Any suggestions are welcome
Jens
(Sometimes I miss the old C "you allocate it, you deallocate it" days. Sure, we made mistakes, but atleast we knew what was happening.)
PS edited to get my code picture looking right, had to add "." as spaces were stripped - what kind of code view strips spaces and indentation anyway?
-- modified at 15:51 Thursday 5th January, 2006
|
|
|
|
|
Hey this is my simple soluction, can u try this and
tell me whether it is solved or not...
In the main termination of your application:-
you can do one of the following
CYourClass::ExitInstance()
{
HANDLE h1 = GetModuleHandle("dll1.dll")
HANDLE h2 = GetModuleHandle("dll2.dll")
Now you got wto handles you can free those libraries in
the order you specified as
FreeLibrary(h1);
FreeLibrary(h2);
or
FreeLibrary(h2);
FreeLibrary(h1);
}
mithun
|
|
|
|
|