|
I figured it out.
The code I was using to shutdown was not closing the other thread. It works now, thanks.
Like it or not, I'm right.
|
|
|
|
|
I think that you should place your own code in _tWinMain between lines (in block defined by bRun==TRUE):
if (bRun)
{
Here.
_Module.StartMonitor();
...
...
Sleep(dwPause);
}
With best wishes,
Vita
|
|
|
|
|
Hi!
I'm looking for a free way of signing files. Does anyone know how could I get that?
Thanks!
|
|
|
|
|
The tools are free... but you have to pay Verisign or someone to get the files to sign with. Sorry, it's not a freebie.
|
|
|
|
|
|
Having trouble adding a method or property using Visual Studio IDE.
The Steps I followed:
1. Highlight interface "IMyInter" in the workspace
2. Right click and chose to add a method..
3. After inputs for method name etc. On Ok, I am getting an error "Unable to create the function because the header file or the implementation file could not be found"
Any pointers please. Thanks
|
|
|
|
|
delet the .ncb file for the solution and everything would be back to normal
|
|
|
|
|
No didnt fix it..
I deleted .ncb and recompiled it. I see the file created but now I can find my interface "IMyInter" in the workspace..
|
|
|
|
|
One thing that I found is that all files need to be in the project (header and code) or strange things may happen.
I had problems where I my header files were not added to the project, so my classes would not show up in the class view.
Francisco
|
|
|
|
|
Is the IDL file in the project?
|
|
|
|
|
Solution:
I am not sure if the .OPT file is any way related to this problem. But when I deleted .OPT file, everthing worked fine.
Thanks gentlemen for your help..
|
|
|
|
|
I have a problem while adding a combobox to a toolbar. I am creating a customize toolbar and associating it with Internet explorer. I have done it in ATL using Ideskband interface. Now when the toolbar is enabled in Internet Explorer, I close that instance and when again launhing internet explorer instance the drop down list for the combo placed in toolbar is not coming Plz help
|
|
|
|
|
Hi,
I have a ATL Server (EXE). I am able to access it from a C++ client, but I tried using it from VBScript and I get an Error 424 : Object Required.
What could I be doing wrong ? (I am a newbie in VBScript)
Thanks
Vivek
Here is the VBS Code
<HTML>
<HEAD>
<TITLE>Working With VBScript</TITLE>
<SCRIPT LANGUAGE="VBScript">
' -------------------------------------
' Subroutine for testing Pinger
'
' Author: Vivekr
' -------------------------------------
Sub cmdClickMe_OnClick
Dim TPinger 'Pinger COM Object
Dim Message
Dim Error
On Error Resume Next 'Proceed after error
'--------------------------------
'Create the ATL COM Pinger Object
'--------------------------------
Set TPinger = Atutils.VPinger4
MsgBox Err.Description
Message = "Error = " & Err.number
MsgBox "Created Object" & Message
End Sub
</SCRIPT>
<BODY>
<H1>VBScript Testbed</H1>
<P> By utilizing VBScript you can give your Web pages actions.
Click on the button below to see what we mean. </P>
<FORM NAME="frmExercise1">
<INPUT TYPE="Button" NAME="cmdClickMe" VALUE="Create Object">
</FORM>
</BODY>
</HTML>
|
|
|
|
|
You must call "CreateObject"
soptest
|
|
|
|
|
soptest-
Thanks for the tip. I will give it a shot
Vivek
|
|
|
|
|
Also (you may already know this) all your interfaces MUST derive from IDispatch, not just IUnknown.
|
|
|
|
|
Thanks Jim,
All my interfaces derive from IDispatch.
Is VARIANT the only type of argument allowed ? Will BSTR, short work with VB Script ?
I am still strugglinh with this. I keep getting the same error 424
Thanks-
Vivek
|
|
|
|
|
BSTR will work, I think the basic primitive types will work like short, long.
Collections need to use the IEnumXXX interfaces or something similar (I think - not a 100% sure on this one). Wrapping things in variants probably is a good idea though, even if it is more work.
|
|
|
|
|
I think that it must be
Set TPinger = New Atutils.VPinger4
or
Set TPinger = CreateObject("Atutils.VPinger4")
With best wishes,
Vita
|
|
|
|
|
--->>???? Set TPinger = New Atutils.VPinger4 !!!!
Will not work
soptest
|
|
|
|
|
I have created an ATL COM object in its interface I have a method that receives another interface of the same type and wish to modify some of its properties, however I do not want these properties to be exposed by its interface i.e. equivalent of protected member in C++ class.
I have the following code:
in header:
//this class ultimately derives from IMyComObject so
// I cast a IMyComObject* to CMyComObject*
class ATL_NO_VTABLE CMyComObject :
public CComObjectRootEx<ccomsinglethreadmodel>,
public CComCoClass<cmycomobject, &clsid_mycomobject="">,
public IDispatchImpl<imycomobject, &iid_imycomobject,="" &libid_mylib="">
{
....
protected:
IMyComObjectPtr m_pConnectedTo;
}
in method implementation:
STDMETHODIMP CMyComObject::ConnectTo(IMyComObject *pMyComObject)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
IMyComObjectPtr pMyComObjectPtr = pMyComObject;
if ( m_pConnectedTo )
Disconnect();
if ( pMyComObjectPtr->IsConnected )
pMyComObjectPtr->Disconnect();
//////////this is the 'nasty' part it does work but I dont like it!!
//////////is there a more elegant way to achieve this or is what I am doing OK?
CMyComObject* pMyBodgeCast = dynamic_cast<cmycomobject*>(pMyComObject);
pMyBodgeCast->m_pConnectedTo = this;
//////////////////////////////////////////////////////////////////////////
m_pConnectedTo = pMyComObject;
return S_OK;
}
If anyone has any comments I would really like to hear them. Thanks.
|
|
|
|
|
Anonymous wrote:
//////////this is the 'nasty' part it does work but I dont like it!!
//////////is there a more elegant way to achieve this or is what I am doing OK?
CMyComObject* pMyBodgeCast = dynamic_cast(pMyComObject);
pMyBodgeCast->m_pConnectedTo = this;
//////////////////////////////////////////////////////////////////////////
Hi -
What you are doing is clearly bad !! I think casting an interface to an implementation goes against the very princple of COM (separation of impl and interface).
It works for you because
(a) you have an INPROC DLL, so there is no marshalling
(b) you guarantee that the only implementaton of IMYComObject is CMyCOMObject.
I had a similar problem when I wanted prvate interfaces. I think this is a major limitation of COM interfaces. You can use the [hidden] or [restricted] keywords in IDL. But that wouldnt prevent C++ users from using it. If you dont include it in the typelib,or register it, then it wont be marshalled across apartments. The solution I used is kludgy, have a private token or key as a parameter for each of the interface methods. So, the private interface would be visible, but not usable by others because they dont know the secret key.
Here is how you might do this.
1) Specify the [hidden] or [restricted] keyword in the IDL for the IMyComObjectPrivateUse, so VB cant use it.
2) Create a private interface IMyComObjectPrivateUse, add the method SetConnectedObject(DWORD token,IMyComObject *)
3) Implement IMyComObjectPrivateUse in CMyComObject, the method looks like
STDMETHODIMP CMyComObject::SetConnectedObject(DWORD token,IMyComObject *pObj)
{
if(token!=0xfeedf00d) {
return E_NOTIMPL;
}
pObj->AddRef();
m_pConnectedTo=pObj;
return S_OK;
}
4) In your ConnectTo implementation, just QI for IMyComObjectPrivateUse and call the set method with the correct key
IMyComObjectPrivateUse * pPriv;
pMyComObject->QI(IID_IMYComObjcetPrivateUse,(LPVOID*)&pPriv)
pPriv->SetConnected(0xfeedf00d,pMyComObject);
I would love to hear anyone who has other ideas. I am currently using the above mechanism.
Hope that helps -
Vivek
|
|
|
|
|
Just declare implemented interface IMyInterface *_pi;
then assign incomming to _pi
_pi = pIn;
If incomming interface is different then you need just typecast incomming interface. (COM object must implement all of those interfaces)
And that is it. You do not need to do QueryInterface because vtlb has all pointers to all methods of all implemented interfaces.
P.S. Typecasting interface to class which implements this interface is bad idea (because the class may have other functions implemented which are not exposed by implemented interface/s, and data members), never do this.
soptest
|
|
|
|
|
soptest wrote:
then assign incomming to _pi
_pi = pIn;
If incomming interface is different then you need just typecast incomming interface. (COM object must implement all of those interfaces)
This approach is not recommended because, it wouldnt work for aggregated & tearoff interfaces.
Thanks-
Vivek
|
|
|
|
|
It has nothing to do with it. COM object does not implement them through vtlb, so it is the same thing as this example:
struct _tearoffObj{};
struct _A
{
void GetObj(void** pObj)
{
*pObj = new _tearoffObj();
}
}
_A does not implement _tearoffObj.
So the statement "_pi = pIn;" is 100% correct.
soptest
|
|
|
|