|
hi there,
while working on an CFileDialog that automaticly selects all files in the browse-dialog
like this one from here
http://www.codeproject.com/dialog/select_all_button.asp
But I get a zero handler for the IShellBrowser
by calling this line , causing an abort
IShellBrowser* pShBrowser =
(IShellBrowser*)::SendMessage( p->m_hWnd, WM_GETISHELLBROWSER, 0, 0 );
---
the hook is assigned to the dialog that reacts properly. :
static UINT_PTR CALLBACK DialogHook(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
{
if (uMsg==296) // init finish
{
//jumps in here
IShellBrowser* pShBrowser =
(IShellBrowser*)::SendMessage( p->m_hWnd,
WM_GETISHELLBROWSER, 0, 0 );
}
}
btw,hwnd returns the right handler to my CFileDialog
any ideas how to get the IShellBrowser from the CFileDialog ?
thanks in advance,
zerwuff
|
|
|
|
|
i'm trying to add a button to the internet explorer toolbar. The button is supposed to hide and show an explorer bar that I customized. I have succeeded in adding the required keys in the registry (as instructed in MSDN library) and I can add the button by going to tools -> customize and adding the button from the list of availabe buttons. I am trying to do this process automatically so that once the user runs the program and opens internet explorer, the button automatically appears on the explorer bar. Does anyone have an idea how to do that?
I'm using visual C++ 6 on Windows XP Home edition.
Rola
|
|
|
|
|
Could someone tell me what on Earth are 'non-exposed interfaces' ?
All I know is that a COM object can have interfaces, which can be accessed by using QueryInterface , for example. I would assume that an interface needs to be exposed by the object in order for QueryInterface to be able to retrieve it.
This problem relates to the Microsoft Knowledge Base Article Q281417 (Found here[^]) and the ability to accomplish the same on Visual C++. Even if I queried for any interface on the object, then queried for IUnknown and queried for the target interface, it always fails with E_NOINTERFACE .
Any ideas, suggestions or other ?
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
I had gone thru Q281417. The term non-exposed they used in the sense non-creatable . That means u can not say
Private Obj As <big>new </big>IMsTscNonScriptable
Only thing u can do is to get a reference to an existing IMsTscNonScriptable object in the terminal server client connection activex. ie,
Private Obj As IMsTscNonScriptable<br />
set obj = MsTscAx1.Object
If u chk the IDL of the activex u can see the "noncreatable " keyword in the attribute section of IMsTscNonScriptable declaration. This noncreatable attribute will prevent a client from queryinterfacing that interface.
rgds..mil10
|
|
|
|
|
Thank you for the swift answer.
The next logical question is naturally: how to get this interface in the VC++ side. I tried looking for the ActiveX control in the Running Object Table, but it doesn't register itself there.. Also, using this method also requires you to use QueryInterface, which will result in a failure..
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Antti....
As per the MSDN sample code in vb we can get an existing IMsTscNonScriptable pointer as follows:
Private Obj As IMsTscNonScriptable<br />
set obj = MsTscAx1.Object
So the VC++ equivalent of the above code is:
CComPtr<IMsTscNonScriptable> pIMsTscNonScriptable;<br />
m_MsTscAx1.Object( reinterpret_cast<void**>(&pIMsTscNonScriptable) )
Here i assume u will insert the activex control into ur app and will add a member variable to it named m_MsTscAx1 .
Unfrntly i don't have that ocx installed on my mechine. So i am not sure whethr it is a moniker provider and is supposed to be in the ROT.
hope this will help... rgds...mil10.
|
|
|
|
|
The ActiveX control was added to the dialog template, and I used 'Add Member Variable' to add a control variable into it. Visual Studio automatically generated the IDispatch wrapper class for the object. However, looking at the class declaration, it's derived from CWnd.
Thus, the member variable doesn't have a function called 'Object'. I tried attaching the CComPtr object into the m_MsTscAx1, and although this compiled properly, the attempt to call any methods resulted in an assertion.
Any more suggestions ?
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Problem solved.
As the m_MsTscAx1 is derived from CWnd , it also has a method called CWnd::GetControlUnknown , which returns a pointer to the existing IUnknown interface of the object. This interface pointer can be used to query for other existing interfaces on the object. Even those interfaces that are marked as 'non-creatable' can be accessed in this way, because querying for the interfaces doesn't create new interface objects.
The pointer returned by GetControlUnknown must not be released, as that might terminate the object (all interfaces released). However, all interfaces queried from here on should be released in the normal way. The key issue here is that QueryInterface only casts the given IUnknown pointer to the target interfaces, while adding the reference count at the same time.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
its cooool man.. so u did it.
ur correct, noncreatable does not prevent from queryinterfacing an interface. More specifically noncreatable attribute is for a coclass, not for an interface. It just prevents that coclass from being instantiated. Also, if u r able to queryinterface that interface from the activex IUnknown, then that terminal cleint interface is not a separate coclass and not noncreatable attributed. I revoked the defenition i had given for a non exposed interface. I rephrase it as just another interfaec under the activex coclass, apart from the activex dispinterface and its event dispinterface .
What exactly it means is Scripting engins like Vbs need at least one IDsipatch derived interface. So normally COM servers that expect scripting engins as clients will always derive interfaces from IDispatch. But the limitation of COM is that a coclass can have only one IDispatch implimented interface.(Well, COM_INTERFACE_ENTRY2 is there to specify which Idispatch is 2 b considered) So if we need to have more than one interface in a coclass, then the remaining interfaces shud b iunknown derived (to make it compliant with vbs like apps). And As far as vb is concerned these IUnknown derived interfaces are "non exposed ". That means vbs like clients can't get it directly, but they can queryinterface the IDispatch. If ur familiar with vb, u cud catch it easly. Or more clearly u can leave that term, it is specificaly for vb programmers we can say.
BTW GetControlUnknown is just an alternative to invoke mthds on an activex. As per the msdn sample the vb code gets the terminal cleint interface thru the object method. if such a method is there in the activex, then ofcource that method will be there in the wrapper class also. coz, as u said wrapper class is just an idispatch wrapper for invoking methods on the activex. So it will contain all the methods in the activex. if u do a search for "object" in the wrapper class header file, it will be there. if it is not there, then that msdn sample code is wrong. i don't have that control installed on my mechine. generate the idl of that ocx and chk for "object" in the idl.
rgds...mil10
|
|
|
|
|
I need a code example for a custom-DLL.
How get I access from a server to my I/O device?
My development environment is visual c++.
Thank you.
Ronny
|
|
|
|
|
A program I wrote in C++ is running under local system account (a service is executing it) in windows XP professional edition. The program is tiring to connect to a DCOM server located on the same PC and fails. This is the error information:
Product: Windows Operating System
ID: 10010
Source: DCOM
Version: 5.0
Component: System Event Log
Symbolic Name: EVENT_RPCSS_SERVER_START_TIMEOUT
Message: The server %1 did not register with DCOM within the
required timeout.
Explanation
The Component Object Model (COM) infrastructure tried to start the
named server; however, the server did not reply within the required
timeout period. There might be a deadlock, or the program might
not have responded to the server initialization code within the
timeout period of two minutes.
When I'm running the same program under a regular user account its work
perfectly. Why is that???
Thanks for your help
|
|
|
|
|
hi boss .. try this..
1) Run dcomcnfg.exe
2) Select ur Dcom server
3) Click properties
4) Goto security tab
5) Click on "Use custom access permissions"
5.1) Click on "Edit" button
5.2) Add "SYSTEM" account from the listbox
6) Click on "Use custom launch permissions"
7) Goto 5.1
rgds..mil10
|
|
|
|
|
Thank alot for your help.
It works like a charm !!
|
|
|
|
|
Hi, there.
I'm a Unix or embeded programmer and well... have good exp. with c/c++, assembler and whatever except "MS" things. Btw, now I have to do Active-X programming with VC. WTF!!!
So, I would like to ask you two questions:
1. Is it possible to learning Active-X without knowing COM or ATL, and with little bit VC exp.(Just little bit more than "hello world")?
2. Do you think "How long do I take to know Active-X"?
Please give a comment, suggestion or whatever... to me
Sorry for my poor English and Thank you for your help.
=^.^=
|
|
|
|
|
hi.. it is not possible to learn activex without knowing com and atl, but it is possible to do an activex using mfc app wizard , without knownig much abt com and atl. Just understand the basics of activex like method, properties and events. that will do... rgds...mil10
|
|
|
|
|
If you are not limited to mfc, you will find ActiveX development much quicker using Visual Basic 6. Much of the lower level work is done for you and you can concentrate on your application specifics.
|
|
|
|
|
Dear fellow CPians,
I have a simple COM component with two coclasses. I'd like to be able to instantiate one CoClass from a method of the other CoClass and be able to access the instantiated CoClasse's methods directly, and not through its interface (so I can supply it with some object data, not only basic data types).
Is there a way to do this? There should be, as the two CoClasses are under the same application and library. I only know the CoCreateInstance method, but with this method I only have access to the interface for the new created object.
Thanks in advance for your time with this.
Best regards.
G. Raven
|
|
|
|
|
Yes, U can use CComObject class for this.
Suppose u have a collection class CTables of CTable . CTables has a method called Item which is supposd to rtn a CTable object and we need to initialize a private member called Ordinal in CTable .
So the Item method of CTables will be
STDMETHODIMP CTables::Item(ITable **pT)
{
CComObject<ctable> *objTable;
objTable->CreateInstance(&objTable);
objTable->Ordinal = 117;
*pT= NULL;
objTable->QueryInterface(IID_ITable, reinterpret_cast<void**>(pT) );
return S_OK;
}
does this make sence....mil10
|
|
|
|
|
Thank you very much, Mil10. This makes perfect sense and is exactly what I was looking for.
Regards.
G. Raven
|
|
|
|
|
Guyz,
help me!!
I am creating a .net 2003/ATL COM dll, and am including some header files of the legacy application. Now am getting some great compilation errors:
[B]error C2146: syntax error : missing ';' before identifier 'int_type'
error C2838: 'int_type' : illegal qualified name in member declaration[/B]
These error belongs to the following code snippet in my legacy .h file
typedef Base::int_type int_type;
another error:
[B]error C2226: syntax error : unexpected type 'T'[/B]
this belongs to :
template <class t="">
class CAfwASOFileSet
{
public:
CAfwASOFileSet(T* aso, T::_FsdFileSets fileset) :
........
Any idea guyz?!
I desperately need a solution!
Pl help me
Thnx!!
|
|
|
|
|
isnt it supposed to be something like:
template <class t="">
class CAfwASOFileSet
{
.....
|
|
|
|
|
Greets,
i need a idea, how i can convert a sepzific (graphic) file to a bitmap witch is based in memory.
Reason is: i can't write out a bitmap-file, and load it after writting, cause the file information have to be secure. After the bitmap staying in memory i can load, show, and destroy it. I think so?
I know the bitmap file format, and i have the informations from the spezific file to fill bitmap-structure-components. So what i don't know is: witch interface can i use to open and get the spezific file informations, how i can load the packed bitmap, after i fill the structure, into the memory, and how i can display this packet bitmap.
thanks for every answer
codefire
|
|
|
|
|
What does this have to do with COM?
|
|
|
|
|
I've just started to use MFC to make COM object..
My book told me that CCmdTarget is base class to make COM object..
and CCmdTarget class implement IUnknown..
BTW, What I found in the class 'CCmdTarget' was just Internalxxx function and
Externalxxx function..(xxx means AddRef and Release and QueryInterface..)
I coundn't find where exactly QueryInterface implementation is...
I know when client call CoCreateInstance, internally QueryInterface function is called..
Where is the QueryInterface function in CCmdTarget Class?
(I guess when QueryInterface is called in MFC COM Object, QueryInterface function might delegate to the Internal/ExternalQueryInterface..)
|
|
|
|
|
Actually we have created our own database Engine (ETL Tool), which can connect any kind of database supported by OLEDB provider (Udl File).We are using a NT Security. Only single user are able to connect through it.
Example:
I have created 2 Users--User1 & User2
I m able to connect through User1 on Multiple Machines simultaneously.if i will try to connect through User2 at the time when User1 is Connected then it will show the blank database at User2 Machines. User2 will be connected only when user1 will disconnect from all machines.
Can anybody please tell me, what are the settings of Dcomcnfg for multiple user access?
Sushil Suri
I m working on BI Domain(Datawarehousing,CRM analysis,campaign Management).For any type of Queries,then send me a mail at ersushilsuri@yahoo.com or free to call me at 91-9871119909(India-New Delhi).
|
|
|
|