|
Hi,
I am using a Audio Player ActiveX in VB and VC++ 6.0.
In VB the control runs fine, but in VC++ the control freezes the window
when I play a song.
I'm using CreateInstance method in VC++ to instantiate the control
Can someone tell me what I should do?
Sansky
|
|
|
|
|
Some controls do not have the "windowless activation" feature (they need a window to function correctly). This may or may not be your problem.
Instead of CreateInstance, have you tried to insert the control onto a dialog template in your project? Assuming you are using the control in a CDialog derived class:
1. Click the project menu.
2. Select "Add to project" then "Component and controls".
3. Browse to select your ActiveX control.
4. The above steps will generate a C++ wrapper class derived from CWnd and also place the control on the resource toolbar, you can drag it from there onto your dialog template.
5. You can add a member for this control to your CDialog derived class.
|
|
|
|
|
Hi all,
I am suffering from a Read/Write stream operation with CComVariant.
Here is the problem. I create a stream like this:
CreateStreamOnHGlobal(NULL,TRUE,&m_pStream)
then I write to it a VARIANT through CComVariant (in doesn't matter which type it is) like this
m_comVariant = valToWrite;<br />
m_comVariant.WriteToStream(m_pStream);
and read it like this:
m_comVariant.ReadFromStream(m_pStream);<br />
*pvalToRead = m_comVariant;
As a result in the read what I get is a "Bad varibale type" error
I also tried this with CComBSTR and got the same results
Any ideas?
Thanks a million for any help
Alberto Gattegno
Software Engineer
http://www.itgil.com
|
|
|
|
|
Can Win98 clients use COM+ components on Win2000 and will the COM+ components still have the same benefits such as transactions, scalability, etc. managed automatically by COM+?
|
|
|
|
|
Hi ,
Is it possible to load other ActiveX controls from one ActiveX Control at
run time.
The ActiveX control I have to develop..whose responsibility is to load
the other activeX controls and PASS parameters they require at run time
The parameters I have to pass and the class ID of the control I will be
getting
from the html page in which my activeX control is present.
For Example:
<object classid="CLSID of My ActiveX control" width="300" height="250">
<param name="" "totalcontrolstoload"="" value="N" />
<param name="" "control="" id"="" value="ToLoad1" />
<param name="Control ID" value="ToLoad2" />
.......................
.......................
<param name="Control ID" value="ToLoad N" />
<object classid="CLSID of Some Active X control One" id="ToLoad1">
<object classid="CLSID of Some Active X control two" id="ToLoad2">
1. Is it possible to for my ActiveX control to get the information of other
activeX controls in the HTML page.
2. Is it possible to load the other active X controls using my control.
3. How do I communicate with other ActiveX controls...
i.e I know control communicates with container...But how do two controls
which are
contained in the same container communicate with each other.
Please send your Inputs/Suggestions /Improvements.
Thanks in Advance,
Raju
|
|
|
|
|
Hi,
I created an InProcServer(ToolBand.dll) on my Windows NT Wkts which works fine for NT Server4.0, Win98, 2K, and Me. This doesn't get installed on the setup of Win95 running IE5. I get error message "This function is only valid in Win32 mode". There were some "Ex" Registry API used in DllRegiserServer(). I've replaced it with normal API's i mean without "Ex", but the problem remains same. I get same error message with RegSetValue(..) API. Is there any compatibility issue?
It seems that Windows 95 is not pure win32. Hey Any comments? Why its so ironical behaviour? Should I need to build this application on VC++ running on Windows 95? I there any registry key or service to get some Win32 services on Win95.
I'm fed-up with this behaviour. Help me with any comments.
--Sumit
|
|
|
|
|
Is there any simple way of deleting an ATL interface in a VC++ ATL project?
I am a little loath to commenting out or deleting lines manually for the required interface.
|
|
|
|
|
Hi all,
This is a somewhat complex issue I guess and most probably the answer is no BUT i have to be sure.
Is the any way at all to declare an STL data type inside an interface declaration?
i.e
interface FOO
{
[helpstring("method FOOFunc")] HRESULT FOOFunc([in]std::vector < std::string > stringVec);
}
If so please tell me how to declare and how to inlude the header files without the MIDL giving me comilation errors
If not... well you can't balem me for trying.
Thanks in advance.
Alberto Gattegno
Software Engineer
http://www.itgil.com
|
|
|
|
|
|
Thanks!!!!!!!!!!
You made my day (actualy my evening)!!
I suspected that it would come to IEnumXXX at some point.
Thanks again
Alberto Gattegno
Software Engineer
http://www.itgil.com
|
|
|
|
|
The method I use in my apps is to call a function to copy my strings, vectors, etc. to IDL-compatible types before passing my data around via a COM method. Then I "unmarshal" the data back into strings, vectors, etc. on the other end. I use CComBSTR and Chris Sells's CComVector for the translation.
CodeGuy
The WTL newsgroup: over 1100 members! Be a part of it. http://groups.yahoo.com/group/wtl
|
|
|
|
|
Hey all,
I'm pretty new to COM programming in C++ (been doing it in VB for quite a while). I'm looking for an absolutely bare-bones, "instantiate one object, make one method call and spit out the results" snippet of code showing me how to write a C++ client app that uses a COM object.
Like I said, doesn't have to be anything spectacular, I just want to see the steps involved in using a COM object in C++.
I searched the site for simple examples, and even searched on the web some, but didn't find anything (if you know of any good examples, I would appreciate the URLs).
Thanks in Advance
Jeremy
|
|
|
|
|
|
If you ever are interested in getting into DCOM, I have a start-to-finish tutorial on this site. It is very easy to follow, and is simple. All you do is write a COM object with one method. You call the method, and the method tells you, "Hello, World!".
The tutorial starts at http://www.codeproject.com/com/HelloTutorial1.asp. I really recommend you follow straight through and build things yourself while following along. Hope this is a good intro!
Really, the usefulness of COM comes out in doing things between more than one computer, but you can put both the "server" and the "client" together on the same computer and you still get everything.
Hope it helps!
Sincerely Yours,
Brian Hart
"And that's the news from Lake Wobegon, where all the women are strong, the men are good-looking, and the children are above-average." - Garrison Keillor
|
|
|
|
|
Can an ActiveX component ,embedded in an webpage ,listen for IE Events?
|
|
|
|
|
|
thanks Todd,
How does the activeX register itself for IE Events?
are there any security considerations?
Is there any sample example/code provided for the same?
|
|
|
|
|
Hello all,
Just a little historyof my project. I have started to develop COM component. Now, I evolve to DCOM component -> switch from IUnknow to IDispatch and DLL server to NTService server.
I have many interfaces.
And one give me this error and it's the most important.
Here the IDL def in the Library part:
[
object,
uuid(535765EA-C024-423A-B921-9F77416CF47F),
dual,
helpstring("ISearchMidiScore Interface, the search interface and the most important"),
pointer_default(unique)
]
interface ISearchMidiScore : IDispatch
{
[helpstring("SetCompareClass, allow user to change the comparison method")]
HRESULT SetCompareClass(
[in] CompareClassEnum classType);
[helpstring("SetSettings, allow user to change the number of result returned")]
HRESULT SetSettings(
[in] int maxSearchElement,
[in] float maxScore);
[helpstring("SearchFromText, allow user to search a music from a set of midi notes separate by a coma")]
HRESULT SearchFromText(
[in, string] BSTR text,
[out] IEnumScoreResult** ppenum);
[helpstring("SearchFromAudio, allow user to search a music from a PCM or a WAV buffer")]
HRESULT SearchFromAudio(
[in] BYTE* audioBuffer,
[in] ULONG audioLength,
[out] IEnumScoreResult** ppenum);
[helpstring("SearchFromScore, allow user to search from a previous score convertion")]
HRESULT SearchFromScore(
[in, out] IScoreDesc* score,
[out] IEnumScoreResult** ppenum);
};
[
object,
uuid(54901242-0019-4986-9328-7260EAEF7D9C),
dual,
helpstring("IEnumScoreResult Interface, enum the result set construct by previous call to ISearchMidiScore search methods"),
pointer_default(unique)
]
interface IEnumScoreResult : IDispatch
{
typedef [unique] IEnumScoreResult *LPENUMSCORERESULT;
[id(1)]
HRESULT Next(
[in] ULONG celt,
[out, size_is(celt), length_is(*pceltFetched)]
IScoreResult **rgelt,
[out] ULONG *pceltFetched);
[id(2)]
HRESULT Skip(
[in] ULONG celt);
[id(3)]
HRESULT Reset();
[id(4)]
HRESULT Clone(
[out] IEnumScoreResult **ppenum);
};
I call the ISearchMidiScore::SearchFromScore(score, enum), it returns a pointer.
When I call IEnumScoreResult::Next, I got the kernel exception.
I have other function working like this 2 - one is calling and give an enumerator pointer - it always work fine.
Before I switch, they work fine too.
Can't see what it is? Do you have any idea? Do you need more info?
Bruno
|
|
|
|
|
The third variable must not be NULL. Should use a long variable and pass its adress.
This solve the problem....
|
|
|
|
|
Hello All!
I'm implementing a COM object using ATL under BCB5.
The target is a DLL. It is compiled and built OK. Also I have
a client application that calls DllGetClassObject directly
from this DLL (after dynamic linking) and tries to get
supported CLSID & IID pair.
At that moment I've got the error, that interface is not
supported. After debugging deep inside ATL implemetation
code I've discovered that _ATL_INTMAP_ENTRY map of
my object contains only IUnknown. Please could someone
point out the problem.
Here is some excerpt from implemenation header:
=========================================
class ATL_NO_VTABLE TFooIndexerImpl :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<TFooIndexerImpl, &CLSID_FooIndexer>,
public IFooIndexer
{
public:
TFooIndexerImpl()
{
}
// Data used when registering Object
//
DECLARE_THREADING_MODEL(otApartment);
DECLARE_PROGID("Indexer.FooIndexer");
DECLARE_DESCRIPTION("");
...
BEGIN_COM_MAP(TFooIndexerImpl)
COM_INTERFACE_ENTRY(IFooIndexer)
END_COM_MAP()
// IFooIndexer
public:
...
};
===========================================
And in another module an object map is defined:
===========================================
BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_FooIndexer, TFooIndexerImpl)
END_OBJECT_MAP()
===========================================
So, why the call DllGetClassObject(CLSID_FooIndexer,IID_IFooIndexer,...)
fails?
Thanks in advance.
|
|
|
|
|
Why are you calling DllGetClassObject directly? If this is a COM object instantiate it with CoCreate. If you going to call dll functions directly forgo the COM hassles and just make a normal dll and use loadlibrary.
|
|
|
|
|
Calling DllGetClassObject directly is not restricted by any standard, as I know. This approach eliminates the necessity to register a server in the system registry, moreover such a server may be located in arbitrary way implied by software. But this is not the question. Do you mean that ATL does not conform to all generally allowed methods of interactions?
After a little investigation of ATL headers I've found out that my problem arises from the fact, that OBJECT_ENTRY macro uses standard ATL's class factory class, namely CComClassFactory. Then a client asks a server to create an object with some interface, supported by my custom COM object, ATL makes a call to CComClassFactory. The ATL templates are written in such a way, that CComClassFactory does not know anything about my custom interface (it knows only IClassFactory) and returns an error. So, now, the question is, how to bind custom interfaces to standard CComClassFactory?
The other possible decision is to change client application.
I've tried to call DllGetClassObject requesting IID_IClassFactory
first, and then use an aquired pointer to call CreateInstance for
custom interface. This is the standard approach. But it doesn't
work in very strange manner:
the call to DllGetClassObject returns success and
fills provided IClassFactory pointer with _something_ like
an object without IClassFactory methods!
// obtaining &DllGetClassObject for pGetClass
...
if( SUCCEEDED((*pGetClass)(clsid, IID_IClassFactory, &pVoid)))
{
pUnk = ((LPUNKNOWN)pVoid);
pCF = (LPCLASSFACTORY)pUnk; // dummy line
// pCF->AddRef(); // if uncommented, works fine
// pCF->LockServer(TRUE); // memory exception, if uncomment
if( SUCCEEDED(pCF->CreateInstance(NULL, riid, &pVoid))) // memory
exception
{
}
// pCF->LockServer(FALSE);
pCF->Release();
return pVoid;
}
Because I haven't even started to write applied code, the results are from ATL itself. I'm confused by now.
|
|
|
|
|
Hi,
I have a DCOM application, where the component fires 8-10 events.
But all the events are similar in structure. (ie. they doesnt have any data associated with them).
The only difference is the event name.
So, I can easily use a single event to Notify all my events to
the client (And have some Parameter that distinguishes the event
to the client).
Now, my question is will this (using a single event in place of many events)
provide any PERFORMANCE benefits in a DCOM application ??
if yes, How ?? (some technical description will be appreciated)
anyway, the number of Network RoundTrips is going to be the same...
if no,
What will be a good COM programming practice in this situation.
(using a Single event or using different events)
Thanks,
Firoz.
|
|
|
|
|
Usually Events in COM are a kind of painful.
these were designed for in- process DLLs.
Each event takes 5 round trips from source to sink to complete its duty.
Just imagine, how much load on the network due to these round trips..
If you have 8- 10 events.........think.. 40-50 round trips( calls)
I will come up with more info.wait..
Cheers,
Anand.
|
|
|
|
|
I want to develop an ASP Application which will use ATL COM components.. I want to create a connection in my ATL COM components which will be called from 'Global.asa'.. i am returning a reference of _ConnectionPtr from my component...
i want to use that reference for my all the ASP pages for calling all other components.. so for that purpose i am passing that reference as first argument to all my other components functions... and in all other components i want to use that connection reference for opening my recordset...
the code is:
// Global.asa //////////////////////////////////////////////////////////////////////////////
Sub Application_OnStart
Dim ob
set ob = Server.CreateObject("MyDLL.Class")
// This method 'GetConnection' will return the reference of _ConnectionPtr
Application("con") = ob.GetConnection()
End Sub
// Other.asp //////////////////////////////////////////////////////////////////////////////
<%
Dim obj
set obj = Server.CreateObject("MyOtherDLL.Class")
result = obj.SomeFunction(Application("con"), "some string")
response.write result
%>
This is giving me error like
Type Missmatch 'SomeFunction'
//////////////////////////////////////////////////////////////////////////////////////////////
The definition of the function 'SomeFunction' is:
HRESULT SomeFunction(IDispatch *conn, BSTR str, short *result)
{
_ConnectionPtr pCon( __uuidof( Connection ) );
pCon = _variant_t( (IDispatch*)conn, true); // i think where the problem is
_RecordSetPtr pRst;
_CommandPtr pCmd;
..... rest of the code
}
Please give me some suggession ...
how can i make connection in Global.asa by means of a DLL and pass it to my other DLLs which will be called from different ASP pages...
Thanks in Advance...
JubiNishoo
|
|
|
|
|