|
I have wondered about how to design a logging system which has an application to view the log and a number of other applications which can write to and maybe even read from the log. My app may run on Windows 98 so I cannot use the system event log and I cannot write an NT service which acts as a
logging service (but that would be nice!).
What I thought about writing then is a COM component which manages the log. It provides methods to read from and write to the log and manages requests from different applications. What I need to know is how and if this is possible. I have written a COM component and it has methods for reading and
writing "events". The problem is that if my app has read the log it will have to reload the log to check for updates by other apps. Also, other apps may try and write to the log but they have their own instance of the COM object.
What do i do? Are connection points the solution? Does the component need to be multi-threaded?
Any ideas anyone?
|
|
|
|
|
If the user has installed the control successfully and goes back to installation url again, Is it possible to have the activex control send a msg box, "You have already installed this control" ?
|
|
|
|
|
If your browser has the following script written, it will definitely
<object id="CommonDialog1" width="32" height="32" classid="CLSID:F9043C85-F6F2-101A-A3C9-08002B2F49FB" codebase="http://myhost/acticex/Active.cab #Version=1,0,0,0">
you have to check for cab file versioning, as you can pack you ActiveX in side a cabinet file....browser will do rest of the part for you.
JUST CHCECK FOR VERSONING
<#Version=1,0,0,0">
cheers
Balkrishna Talele
|
|
|
|
|
This is for the common dialog (open Save)
It does not inform me that my control has already been installed?????
|
|
|
|
|
I made an addin by using the Addin-Wizard of Visual .NET.
I should like to install this addin on the next configuration:
- A PC with Windows XP
- there can be several users, but they haven't administrator rights.
- The installation of the addin must work in the administrator mode, but users should use it in restricted mode (not admin mode in Windows XP).
So, I have problems, because the addin fail when it is launched in restricted mode.
Visual .Net print the addin failed during the loading.
Do you know a solution for this problem ?
|
|
|
|
|
Hi,
I have this code (from a tutorial by Vipul Bansal here)
which calls a method via ms soap .
<br />
...<br />
VARIANT retval;<br />
<br />
hr = pSoapClient->Invoke( dispid, IID_NULL, <br />
LOCALE_USER_DEFAULT, DISPATCH_METHOD,<br />
&dispparams, &retval , &excepinfo, &uArgErr);<br />
The thing is that the method this code invokes, returns an object with data
that I need later in my code, but since the return value is of the VARIANT
data type, I don't know how to (propertly) convert it to the class I need or maybe set the return object in the dispparams type ?!
Here is a piece of the .wsml file.
<br />
<operation name="CreateID"><br />
<execute uses="...." method="CreateID" dispID="1"><br />
<parameter callIndex="-1" name="returnval" elementName="Result" /> <br />
<parameter callIndex="1" name="User" elementName="User" /> <br />
<parameter callIndex="2" name="Password" elementName="Password" /> <br />
</execute><br />
</operation><br />
|
|
|
|
|
wsml:
<pre>
<operation name="CreateID">
<execute uses="..." method="CreateID" dispID="1">
<parameter callIndex="-1" name="returnval" elementName="Result" />
<parameter callIndex="1" name="User" elementName="User" />
<parameter callIndex="2" name="Password" elementName="Password" />
</execute>
</operation>
</pre>
|
|
|
|
|
Take a look at the MSDN docs on VARIANT , and its three fields vt , punkVal and pdispVal . I assume you know COM/IUnknown , then it'll be clear to you how to get the object. If not, then I think you should get a book on COM as well.
--
Arigato gozaimashita!
|
|
|
|
|
Hi All.
I am Completely new with COM/DCOM/COM+ concepts.
I am A VB6.0 developer and wanna to learn about them....
I search withing Codeproject.com but could not find any sample bout creating and using A COM/COM+ program with VB6.0
could you please help me?
Thank you
|
|
|
|
|
hi
I am developing an ActiveX control in which i have placed a dialog box and and on that dialog box there are some controls like button control,edit control etc (its working fine). But when i add registered controls like flex grid control (from project>Add to project...>components and controls ...) on the dialog, the dialog box's m_hWnd member becomes NULL.
Does any one know how to solve this problem.its urgent please.
regards
Azam
|
|
|
|
|
Does your ActiveX control assert failure with a message saying "An unsupported operation was attempted"? I had a similar problem and solved it by using AfxOleInit instead of CoInitialize(NULL).
|
|
|
|
|
thanks Herbert now its working fine
|
|
|
|
|
I have apartment threaded built VB activex control hosted on ATL dialog - they reside in thread T1.
Another CComObject component in thread T2 of the same process - tries to access methods of this ActiveX control.
There is an exception.
I tried using Lock(), Unlock() provided by ATLModule, and also explicitly creating CComCriticalSection. But in vain.
Can anyone help?
|
|
|
|
|
Someone wrote:
Another CComObject component in thread T2 of the same process - tries to access methods of this ActiveX control.
Please have a look at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/htm/cmf_a2c_88tp.asp[^]
Suppose you have the interface pointer pCtrl in thread T1. Then you cannot use that pointer straight away in thread T2. You would have to do something like this:
IStream* pStream;
CoMarshalInterThreadInterfaceInStream(IID_ITheInterfaceID, pCtrl, &pStream); If the call is successful, pStream will be a stream containing a reference to your object pCtrl and apartment marshalling information.
In thread T2, you pick up the pStream object, and unmarshal the interface pointer from the stream like this:
ITheInterface* pCtrl2;
CoGetInterfaceAndReleaseStream(pStream, IID_ITheInterfaceID, (void**)pCtrl2); The interface pointer pCtrl2 will now be accessible in thread T2. Generally speaking, the interface pointer deserialized from a stream is accessible in the thread where it was deserialized.
--
Arigato gozaimashita!
|
|
|
|
|
I tried this, but due to some runtime exception, changed to Global Interface Table. Now the problem is:
I create instance of IGlobalInterfaceTable and marshal my interface into it using RegisterInterfaceInGlobal(..). It returns me HRESULT of Successful.
Now if I Unmarshall this interface in the same thread somewhere down the line, I can successfully retriev it & call methods on this interface.
Problem is that in another thread, when I create instance of Global interface table, and access the interface using global cookie, I get HRESULT of 0x8000FFFF which means catastrophic failure.
The second thread calls CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); and CoUninitialize(). Also it waits for a event handle. Apart from the wait statement, the thread returns immediately. (it does not have message pump).
|
|
|
|
|
Dear Memebers,
Wishes to all !
This is akszn.
Here i am looking for some tips to create my own utility to autofill the contents in a web page fields.
Please suggest do anybody have developed it yet. If somebody have any Idea about it. please let me know.
To know more about google toolbar please visit : http://www.google.com
I want to know can we create that toolbar like google and how ?
Please spare your time to reply this post, its urgent
With Regards
|
|
|
|
|
I have a standard componenet developed in VC.Net which will fire an event. The .Net component will send two parameters of type object with that event.
I used VC++6.0 to develop my vc++ client,
In the corresponding .idl file the declaration of the event handler is like:
methods:
[id(0x00000001), helpstring("method Moved")]
void Moved(
[in] long XPosition,
[in] long YPosition);
I have done the following in my VC++ application.
1. I have created a class derived from IDispEventImpl,as follows:
class CSinkObj : public IDispEventImpl<idc_srcobj, csinkobj="">
{
public:
HWND m_hWndList;
CSinkObj(HWND hWnd = NULL) : m_hWndList(hWnd)
{
}
BEGIN_SINK_MAP(CSinkObj)
SINK_ENTRY(IDC_SRCOBJ, 1, Moved)
END_SINK_MAP()
void __stdcall Moved(long XPosition, long YPosition)
{
AfxMessageBox("Event notification handled in MFC client");
}
};
2. In the CPP file,
I get the address using cocreateinstance and I used the AtlGetObjectSourceInterface and DispEventAdvise for my object ,as follows:
m_pSinkObj = new CSinkObj(hWndCtrl);
HRESULT hr = m_pStageSrcObj.CoCreateInstance(CLSID_Stage,NULL,
CLSCTX_INPROC_SERVER);
_ASSERTE(SUCCEEDED(hr));
hr = AtlGetObjectSourceInterface(m_pStageSrcObj, &m_pSinkObj->m_libid,
&m_pSinkObj->m_iid, &m_pSinkObj->m_wMajorVerNum, &m_pSinkObj->m_wMinorVerNum);
_ASSERTE(SUCCEEDED(hr));
all above can be compiled and linked successfully,and i set a breakpoint at AtlGetObjectSourceInterface and step over,the problem appeared like : m_pSinkObj->m_libid is not NULL,but m_pSinkObj->m_iid is NULL,so the HRESULT value returned failed! so I am not able to capture the event from the component.
Can any one of you please tell me the solution for my problem... or is there any other way to capture the event from a VC.Net component in VC++6.0
thanks !
andy_cn
|
|
|
|
|
HI,
I m new to ATL DLL
I want to make a Dll from which i want to get the functionality of CSocket class through ASP.NEt.
I run the ATL COM wizrad use ATL DLL , soporting MFC , proxt stub , MTS all ..
I added a MFC Class CSock Inherited from CSocket class.
When i compile it . it gives error .
CSocket undefined ???????????
How i can handle it.
and i want to use this DLL for ASP.NEt page to give the functionalty to a ASP.Net page connect to a client application through IP and Port.
m i doing a right solution. means ATL DLL , and use this DLL behind a ASP.NET page.
and tell me y CSocket is Undefined
thanx
Regards.
|
|
|
|
|
I want to call AtlGetObjectSourceInterface to get the interface ID of the source interface IStage,but after the function is implemented,there appears a problem like this:m_pSinkObj->m_libid is not NULL,but m_pSinkObj->m_iid is NULL,so the HRESULT value returned failed! as follows:
m_pSinkObj = new CSinkObj(hWndCtrl);
HRESULT hr = m_pStageSrcObj.CoCreateInstance(CLSID_Stage,NULL,
CLSCTX_INPROC_SERVER);
_ASSERTE(SUCCEEDED(hr));
hr = AtlGetObjectSourceInterface(m_pStageSrcObj, &m_pSinkObj->m_libid,
&m_pSinkObj->m_iid, &m_pSinkObj->m_wMajorVerNum, &m_pSinkObj->m_wMinorVerNum);
_ASSERTE(SUCCEEDED(hr));
thanks!
andy_cn
|
|
|
|
|
Hi to all
I implemented address book support in my application with IAdressBook interface. Everything is fine - application is able to open, store,resolve, contacts from address book. But if I run my application for the very first time on freshly installed MS Windows the problem occurs.
It looks that if you have never run MS Outlook express or Windows Addres Book aplication on your computer - personall address book is not created yet and some of COM function fails. I see also no way to initialize addrres book by calling some COM functions.
Here is a sample code:
hr = m_lpAdrBook->GetPAB( &lpcbEID, &lpEID);
// Open the root PAB container
// This is where all the WAB contents reside
hr = m_lpAdrBook->OpenEntry(lpcbEID,
(LPENTRYID)lpEID,
NULL,
0,
&ulObjType,
(LPUNKNOWN *)&lpContainer);
// Get a contents table of all the contents in the
// WABs root container
hr = lpContainer->GetContentsTable( 0, &lpAB); //this function fails on systems that hever had Outlook run before!.
I would be grateful for any tips how to initialize the address book in a first time.
Thanks and best regards!
Irek
Check out my software at: http://www.ireksoftware.com
|
|
|
|
|
Hi all,
Can anyone please help me to reterive the OCX properties from handle of third party application?
Thanks,
Mohan
|
|
|
|
|
Hi,
I'm not sure if this is possible, or whether it's been answered before but I've reached meltdown trying to guess the key phrase to get information on this.
What I have is:
- an existing COM DLL + idl etc which is installed in location A
What I'd like to do is:
write a new version of the DLL supporting the same interfaces as A so it is a complete replacement for A. However, I actually want to use the original DLL to do all the work.
All the new DLL is for is to journal calls in and events out of the original and forward responses back to the client application. It may eventually multiplex information elsewhere, but that's the future.
Any help would be greatly appreciated. I've been staring at MSDN too long to actually read the COM API clearly
Thanks.
Kev
|
|
|
|
|
You can import the idl file in your new idl file to get the interface information from the old file. Please see the MIDL statement import .
Note that the compiled DLL will not depend on the old DLL. You can opt to install only the new DLL on the target system.
Another way to do it is to #import (VC++ feature) the DLL and its associated type library into your C++ code.
A third way to do it is to grab the header file generated by the compilation of the IDL file beloning to the old DLL, and #include it in your new sources.
Personally, I import import in the IDL file. Please note that by doing so, the corresponding header file of the imported IDL file, must also be accessible to the C++ compiler. At work I have an include files in one directory and IDL files in another (you can have them in one directory if you're not so anal about order it as I am ). I have added those two directories to the include search path in the IDE. That way MIDL finds the idl-file, and the C++ compiler finds the corresponding header file.
--
Arigato gozaimashita!
|
|
|
|
|
Hi,
thanks for replying - all useful information.
However, I don't think I made my question clear enough.
What I am trying to achieve is to be able to install my binary-compatible version of an exisiting DLL onto a pre-existing system containing the original DLL. My new DLL would register itself and be the DLL loaded by clients of the original DLL.
My DLL, because it knows that there is an existing DLL in a known location would be able to the original to provide the clients with identical functionality.
If I was using plain DLL's I'd simply be able to install the new version so that it was found earlier in the path and load in the original DLL using LoadLibrary(). Since I know exactly what the interfaces are, I could do this with the COM DLL. However, I'm looking for an "official" COM way of short-circuiting the registry lookup.
Kev
|
|
|
|
|
Aha! My foggy brain finally seems to be kicking into gear again. I believe the answer is to:
1) Call CoLoadLibrary() to load the specific DLL into memory
2) Call GetProcAddress() to get the original's DllGetClassObject() function.
3) Call DllGetClassObject() to get the original DLL's class-factory, then off-we-go!
Pretty obvious really. Oh well
I'll try this out later on today when shipping-hell lets me.
Kev
|
|
|
|
|