|
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).
|
|
|
|
|
HI
I am developing a DCOM project and which i want to give an optional arguments
Plz tell me how to make argument as optional.
My code looks like...
STDMETHODIMP CInsideDCOM::vListMachine(VARIANT SrvName, VARIANT Domain)
{
...
...
}
Suppose I want to make any one of the above arguments as optional then how to do it ? In which file to make changes ?
Plz, I am in hurry...
Can you tell me ?
Thank you
Amarelia
|
|
|
|
|
Hi there,
What you have to modify is your IDL code to use the [optional] attribute for the method declaration.
So your code should look something like this
[id(0x00000001)] HRESULT vListMachine([in] VARIANT SrvName, [in, optional] VARIANT Domain); where Domain is an optional parameter.
Check the MSDN for the MIDL optional attribute.
Fabian
|
|
|
|
|
I have my own server application which starts another COM server application (e.g. excel). I would like to pass a COM object from my application. My app can run with multiple instances, and the other application needs to know the sender ...
Do you think your method is the adequate technique for my problem?
|
|
|
|
|
Hello
I am developing an simple DCOM application which lists all the computer that are currently logged on in a perticular network.
The function to do that is NetServerEnum. I don't know how to pass all variable in to DCOM STDMETHOD ? My code is like this....
--------------------------------------------------------------------
void ListServer()
{
LPSERVER_INFO_101 pBuf = NULL;
LPSERVER_INFO_101 pTmpBuf;
DWORD dwLevel = 101;
DWORD dwPrefMaxLen = -1;
DWORD dwEntriesRead = 0;
DWORD dwTotalEntries = 0;
DWORD dwTotalCount = 0;
DWORD dwServerType = SV_TYPE_SERVER; // all servers
DWORD dwResumeHandle = 0; // This should always be Zero
NET_API_STATUS nStatus;
LPTSTR pszServerName = NULL; //This should be NULL
DWORD i;
nStatus = NetServerEnum(pszServerName, dwLevel,(LPBYTE *) &pBuf,dwPrefMaxLen,&dwEntriesRead,&dwTotalEntries,dwServerType,NULL,&dwResumeHandle);
// If the call succeeds,
if ((nStatus == NERR_Success) || (nStatus == ERROR_MORE_DATA))
{
if ((pTmpBuf = pBuf) != NULL)
{
// Loop through the entries and
// print the data for all server types.
for (i = 0; i < dwEntriesRead; i++)
{
assert(pTmpBuf != NULL);
if (pTmpBuf == NULL)
{
fprintf(stderr, "An access violation has occurred\n");
break;
}
wprintf(L"\tName: %s\n", pTmpBuf->sv101_name); printf("\n");
// Also print the comment associated with the server.
pTmpBuf++;
dwTotalCount++;
} // End of for loop
// Display a warning if all available entries were
// not enumerated, print the number actually
// enumerated, and the total number available.
if (nStatus == ERROR_MORE_DATA)
{
fprintf(stderr, "\nMore entries available!!!\n");
fprintf(stderr, "Total entries: %d", dwTotalEntries);
}
}
}// End of if ((nStatus == NERR_Success) || (nStatus == ERROR_MORE_DATA))
else
fprintf(stderr, "A system error has occurred: %d\n", nStatus);
//Free the memory
if (pBuf != NULL)
NetApiBufferFree(pBuf);
}
----------------------------------------------------------------
I want to use this function in my DCOM application and want to putthe code into one method called
STDMETHODIMP CHelloMaWinLink::ListServer(All parameters here....)
{
...
...
}
-------------------------------------------------------------------
This is what I want to do....
Can you help me plz ? It's very urgent ?
Thanking You
Mahesh
Amarelia Maehsh
Gujarat
India
|
|
|
|
|
Hi COM gurus,
I have a doubt regarding Inheritence in COM
If I have a COM cleint (lets say Client) and another COM class (Parent) and a child C++ class (Child)
Child (c++ class)inherits from Parent(COM class)
//this is not the real program just to make things
//clear so donot go for syntax and all
Parent
{
virtual foo() = 0;
}
Child : public Parent
{
foo()
{
"Hello";
}
}
Client
{
Parent* p;
p = new Child();
p->foo() ; //this calls child method
}
so is this possible p = new Child()
how will queryinterface and all will be taken care.
Thanks in advance,
Gaurav
Gaurav
|
|
|
|
|
my assumption is that you're confusing the Server and the Client.
On the server (i.e.: in the DLL for in-proc server and in the executable or out-of-process server) you will use some language (C++, VB, VB.NET, other) to implement the functionality you expose using COM. How you implement it isnt really important as long as you follow the rules of COM like the rule mentioned for QueryInterface that says that no matter which Interface i Query for, i can query for any other type of interface that object exposes and get a new valid interface pointer to the same object (or something of that kind). i.e.: If i get an IUnknown interface pointer, i can Query it for an IDispatch interface pointer, and from it i can Query for an IUnknown interface pointer and i will get the same interface pointer i started from.
On the client, all you know about is the interfaces exposed. An interface pointer is nothing more than a pointer to pointers ..etc of functions. The server needs to expose 1 COClass for any object you want to be able to create or get access to using a ClassId or a ProgId. So, on the client you will never use "new" because the client doesnt know about class "Child" or class "Parent", but it knows about interface "Parent". If you want to get a new Object, you use CreateObject() or CoGetClass() etc .. and they return to you an IUnknown interface pointer from which you can query to get further functionality.
Hope this clarifies things a bit ?
|
|
|
|
|
I am very new to COM, and don't have a full understanding of what it does. I'd like the opinions of some seasoned COM programmers before I continue down the COM path.
I have a program with a server and several clients, which all run on the same CPU. The server sends and recieves very simple (four byte) messages from the clients. I want a client to be an executable that someone starts, and, if the server is not running, starts the server. Outside of that, the messages should be treated as mailbox messages. I also want to allow other people to develop thier own clients.
The question I have is, should I be using COM, windows-messaging, or a combination of the two?
Thanks
John
|
|
|
|
|
Hi all,
This might be a stupid question, When we write any Win32 Program we start with these steps
1. RegisterWinodwClass
2. CreateWindow()
3. Showwindow()
4. UPdateWindow()
5 Infinite winodw Loop break on WM_QUIT.
6 return
But when is the message map is created for given window and who creates it? and at what particular stage it is created and do we any control over that ?
Thanks
Abhi Lahare
|
|
|
|
|
I have a much terrible problem . I need a dll to accomplish a Dictionary(dll 's name) which contain any object called VB6.0. The Dictionary using c++ ' s stl std::map<anytype key="" ,="" anytype="" object=""> , the key type must adapt for a self defined class or a object , that is the method Add(para1, para2 ) can also deliver that argument para1 is object. The destination goal is Add(Object obj1, Object obj2).
can you help me ? thank you in advance!
following is the source :
project name : TestDictionary
// TestDictionary.cpp : Implementation of CTestDictionary
#include "stdafx.h"
#include "TestDictionary.h"
#include ".\testdictionary.h"
// CTestDictionary
STDMETHODIMP CTestDictionary::Add(BSTR key, VARIANT object)
{
// TODO: Add your implementation code here
wstring keystirng(key);
_map[keystirng] = object;
return S_OK;
}
STDMETHODIMP CTestDictionary::get_Items(BSTR key, VARIANT* pVal)
{
// TODO: Add your implementation code here
wstring keystirng(key);
*pVal = _map[keystirng];
return S_OK;
}
STDMETHODIMP CTestDictionary::put_Items(BSTR key, VARIANT newVal)
{
// TODO: Add your implementation code here
wstring keystirng(key);
_map[keystirng] = newVal;
return S_OK;
}
head source:
// TestDictionary.h : Declaration of the CTestDictionary
#pragma once
#include "resource.h" // main symbols
// ITestDictionary
[
object,
uuid("AB33763D-A604-42CF-9F86-4EA61D8B51EA"),
dual, helpstring("ITestDictionary Interface"),
pointer_default(unique)
]
__interface ITestDictionary : IDispatch
{
[id(1), helpstring("method Add")] HRESULT Add([in] BSTR key, [in] VARIANT object);
[propget, id(2), helpstring("property Items")] HRESULT Items([in] BSTR key, [out, retval] VARIANT* pVal);
[propput, id(2), helpstring("property Items")] HRESULT Items([in] BSTR key, [in] VARIANT newVal);
};
[
object,
uuid("{8FA3C023-1EF5-4b1b-91F7-41815B8A5294}"),
dual, helpstring("ITestEnumrator Interface"),
pointer_default(unique)
]
__interface ITestEnumrator : IDispatch
{
[id(1), helpstring("method Next")] HRESULT Next([out,retval] VARIANT* pObject);
};
// CTestDictionary
[
coclass,
threading("apartment"),
vi_progid("ComLib.TestDictionary"),
progid("ComLib.TestDictionary.1"),
version(1.0),
uuid("B610EB97-5CEC-451A-90D9-A13EED57C168"),
helpstring("TestDictionary Class")
]
class ATL_NO_VTABLE CTestDictionary :
public ITestDictionary,
public ITestEnumrator
{
public:
CTestDictionary()
{
}
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
STDMETHOD(Add)(BSTR key, VARIANT object);
private:
map<wstring,variant> _map;
map<wstring,variant>::iterator _iter;
public:
STDMETHOD(get_Items)(BSTR key, VARIANT* pVal);
STDMETHOD(put_Items)(BSTR key, VARIANT newVal);
};
thank u
|
|
|
|
|
can u be more specific, why you need key type as an object. why can't u put that object as a member/property of the value type object. ie param1 object as a data member/property of param2.
rgds..mil10
|
|
|
|
|
Thank you Mil10 for the answer. Our system referenced a Dictionary , which is component of Microsoft scripting runtime , the disigner used it filled with variable case ,included set object(self defined class) as container 's key. My project leader check the our system to find memory leak, and the leak 's destinate position just is the referenced Dictionary . so , be going to write a component to replace it .
I want to accomplish a COM interface Add(key , item). The first argument "key" is deliver any basic type and self defined class or object , and the second argument "object" does not to explain. How to implement this ?
I am very puzzled . I try to using stl template map class , such as std::map <variant ,="" variant="">, but when I add into container with element , the result did not accomplish my goal. The problem is the first argemnt VARIANT that i could not process it .
Can you help me ? Can you have others method ? thank u in advance.
thank u
|
|
|
|
|