|
If your class is foo and the structure is public or accessible to the calling object:
class foo
{
public:
struct myStruct
{
int a;
int b;
} myStruct;
void UseFooStruct(myStruct s);
}
class bar
{
public:
void UseFooStruct(foo::myStruct s);
}
|
|
|
|
|
I think I must have phrased it wrong. I know what you mean. But what I wanted is to expose the struct to one of my interfaces, then be able to pass the struct from Visual basic to My VC++ COM object. Is this possible?
SDE
|
|
|
|
|
Yes. You can define a user defined structure (a Type ) in VB which corresponds to your C++ structure. That way, you can pass the structure back and forth. Look in the MSDN on how to do this: Passing User-Defined Types to a DLL Procedure. Of course, your Type declaration in VB must be equivalent to the C++ version.
|
|
|
|
|
Hi all,
Wondering if anyone knows why I'm getting this error when i try to build certain DirectShow samples from the DX9SDK. Here's what i get compiling a debug
<br />
------ Build started: Project: PlayWnd, Configuration: Debug Win32 ------<br />
<br />
Linking...<br />
playwnd.obj : error LNK2019: unresolved external symbol "long __stdcall ATL::AtlWinModuleInit(struct ATL::_ATL_WIN_MODULE70 *)" (?AtlWinModuleInit@ATL@@YGJPAU_ATL_WIN_MODULE70@1@@Z) referenced in function "public: __thiscall ATL::CAtlWinModule::CAtlWinModule(void)" (??0CAtlWinModule@ATL@@QAE@XZ)<br />
playwnd.obj : error LNK2001: unresolved external symbol "class ATL::CAtlBaseModule ATL::_AtlBaseModule" (?_AtlBaseModule@ATL@@3VCAtlBaseModule@1@A)<br />
.\Debug/PlayWnd.exe : fatal error LNK1120: 2 unresolved externals<br />
There are certain samples (with names ending in ASF) that require the Windows Media SDK and a certificate. But PlayWnd isn't one of them. (PlayWndASF is.)
I'm working on a full screen video player, the other relevant samples that play video also give me the same error. "Windowless" for example.
I know it's something stupid...
|
|
|
|
|
This is using ATL7.0, I assume.
Is the source from an MS sample? It may be that it was originally written to use ATL3, and you need to make some (hopefully) minor changes.
What's your ATL specific set of includes?
Steve S
|
|
|
|
|
It's the PlayWnd sample as found in \DX90SDK\Samples\C++\DirectShow\Players\PlayWnd. I'm using VC7 (.NET 2003) so i assume it's ATL 7? Dunno, i've been away from this stuff for a few years...
Steve S wrote:
What's your ATL specific set of includes?
//------------------------------------------------------------------------------
// File: PlayWnd.cpp
//
// Desc: DirectShow sample code - a simple audio/video media file player
// application. Pause, stop, mute, and fullscreen mode toggle can
// be performed via keyboard commands.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include <dshow.h>
#include <commctrl.h>
#include <commdlg.h>
#include <stdio.h>
#include <tchar.h>
#include <atlbase.h>
#include "playwnd.h"
|
|
|
|
|
This machine only has vs6 on it;
Steve S
|
|
|
|
|
I am trying to write a Browser Helper Object, but I am having a problem making it recognisable as a BHO. Following the instructions in Dino Esposito's MSDN article, using VC++6 I generate a standard ATL Com AppWizard project, selecting .DLL as the server type. I then insert an ATL Object, selecting an Internet Explorer Object, leaving all the defaults (appartment threading, dual interface, aggregation, no errorInfo, Connection Points or Free Threaded Marshaller). I then simply add the extra registration into the .RGS file to put the CLSID into HKLM|software|microsoft|windows|Current Version|explorer|Browser Helper Objects. I do not add any extra code, but just build the project. It registers OK, and the CLSID appears in the registry as expected. However, when I run BHODemon (www.definitivesolutions.com), it does not see the new helper, nor, as far as I can tell, does Internet Explorer. I have compared my software with working BHOs such as IEhelper and Dino Esposito's HTMLEdit, but can find nothing to explain my difficulty. Can anyone help?
Dave
|
|
|
|
|
|
You know that in the RGS file there are 2 CLSID's right? Did you select the correct one?
|
|
|
|
|
Well spotted. An excellent bit of remote diagnosis. That's exactly what I didn't do. I selected the wrong one. Thanks.
Dave
|
|
|
|
|
I made a generic purpose windows class as follows.
template< class CExtBaseWnd = CWnd>
class CChartWndParent : public CExtBaseWnd
{
....
CMyClass m_classX;
}
But I also wanna use my custom class m_classX as a member variable.
This class is unfortunate separated with h/cpp, so failed to compile..
Is there any way of compiling this class?
|
|
|
|
|
You should be able to use it by adding a forward declaration of CMyClass above the definition of the CChartWndParent class.
<br />
class CMyClass;<br />
<br />
template< class CExtBaseWnd = CWnd><br />
class CChartWndParent : public CExtBaseWnd<br />
{<br />
....<br />
CMyClass m_classX;<br />
}<br />
|
|
|
|
|
This wouldn't work. If you want to use forward declarations, you must declare m_classX member as pointer to CMyClass .
(A stupid question: Why you cannot include the header file, where CMyClass is defined?)
Robert-Antonio
Love, truth and electric traction must gain victory over hate, lie
and diesel traction.
|
|
|
|
|
Hi All!
Are there D3D templates for WTL?
P.S. I'm lazy to write it
|
|
|
|
|
I learn to create ActiveX project to use in C#. I want to use mciSendString create some procedure same as Open, Play , Stop.
somebody can help me write this code step by step, or send to me your code.
thanks.
Nho'c Ti`
|
|
|
|
|
Some time ago, I tried using a vector to read from a file as follows:
vector<float> vec;
vec.reserve( 256 );
vector<float>::iterator it = vec.begin();
_read( m_FH, reinterpret_cast<unsigned char*>(it), 256 );
Unfortunately, vec.size() = 0, even though the elements could be accessed using vec[] or vec.at(). At the time, I couldn't find a way around this problem. vec.resize(256) didn't work because this calls size() and all the elements are reinitialised to 0.0.
Other than vec.assign(256), can this problem be resolved - or is this just a bad idea in the first instance?
John
|
|
|
|
|
|
Hello everyone
I have a wtl(VC6.0 and wtl7.1) project and a mfc dll.(not UNICODE)
in the mfc dll,
LPSTR a;
a = new TCHAR(nLen + 1);
memcpy(a, otherstr, nLen * sizeof(TCHAR));
a[nLen] = _T('\0');
in the wtl project, I want to free it as the following:
delete a;
but the program is died.
Could you tell me how to free it?
Thank you.
-Freehawk
|
|
|
|
|
a = new TCHAR [nLen + 1]; //mistake #1
delete [] a; // mistake #2
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Thank you for reply.
How to modify it?
-Freehawk
|
|
|
|
|
Well, you're trashing your stack due to the new[] bug that's been pointed out.
After you fix that, the problem becomes one of where is the memory being allocated? Unless you can be sure that both modules are using the same heap, you can't alloc in one module and free in the other. Because MFC has its own spiffy memory management, it probably has its own heap(s).
The way I usually do it is to alloc with CoTaskMemAlloc() and free with CoTaskMemFree() . Those use an allocator that the entire process can access.
[edit]Actually, it's not doing anything to the stack, since the memory is on the heap. It was late when I wrote that The code does write past the end of an allocated block of memory, though.[/edit]
--Mike--
Personal stuff:: Ericahist Updated Feb 6! | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
Actual sign at the laundromat I go to: "No tinting or dying."
|
|
|
|
|
Ack, I didn't even notice that Michael, thanks.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
try:
LPTSTR a; //TCHAR* a
...
delete[] a;
|
|
|
|
|
There are some ATL templates and macros that help catch COM events.
As IDispEventSimpleImpl, SINK_ENTRY_INFO etc.
But what I must to do if I do not know all events before a program start.
For example, there are Outlook::ItemsEvent for Outlook folders. I can catch any one. But I want catch all to one function. How can I register events dynamically?
Your ideas?
================================
My home is here!
|
|
|
|