|
This is just a guess since I'm a COM newbie, but if you created your ATL object with a "dual" interface then the above IDL won't work. You'll need to either use a VARIANT safearray to pass the data in, or create your object with a "custom" interface when you're on the ATL object wizard dialog.
Hope that helps,
Pros
|
|
|
|
|
Oh,thanks a lot .and also thanks for your reply in the previous message
I posted as cg.
I've tried again . I use
[in]short nSize,[in,size_is(nSize)]byte buffer[].
I found that it works both in the "dual" interface and custom interface .
But I don't know now why it failed before .a little confused
cg
|
|
|
|
|
Hello COM gurus
I'm trying to create a UI-less MFC ActiveX control that can be accessed from VBScript in an HTML page. I'm not using ATL because I want to minimize the possibility that the user's machine needs a restart. I've looked at MSDN's safectl tutorial which implements IObjectSafety to allow for scripting in hopes of getting some idea of what's going on. However, when I try to invoke a user-defined automation method in this control from VBScript, I get a "Catastrophic Error" (8000FFFF). This can't be good.
Can anyone suggest what I should look at/implement to expose methods to VBScript? Thanks for any suggestions.
|
|
|
|
|
Nevermind, I found the problem...See http://support.microsoft.com/support/kb/articles/Q146/1/20.ASP
|
|
|
|
|
I am trying to create a very simple com server, everything goes well until the last phase of the build process,
during the registration phase visual C++ freezes, I tried reinstalling VC++ but that did not help. Any ideas?
|
|
|
|
|
Are you on Win 9x? And running Norton AntiVirus? There's a known bug with NAV 2000 and 2001 on 9x which makes VC hang if you're running the Auto-Protect (background scanner) and do a build that makes VC launch another program in a custom build step (such as regsvr32 in an ATL project). Just disable AP (right-click the tray icon, pick Disable Auto-Protect) before doing your build.
Annoying, I know.
--Mike--
http://home.inreach.com/mdunn/
The Signature, back by popular demand: Buffy. Pajamas.
|
|
|
|
|
i am daily facing this problem even thou any auto protect program is not running. After restart if kill both winoldap and Visual Studiofrom next on wards it freeze please help me.
|
|
|
|
|
Warning: COM newbie...
If I do all the code inline, no problems. Inside the function, everything works fine also. The moment it returns, pMyObj gets set to NULL (Like it's going out of scope?) What have I missed here, and how can I fix it such that I pass in a CComPtr and have it setup inside the function, but still valid outside the function (i.e. not reset to NULL)?
NB: Angle brackets converted to square brackets coz they were being treated as HTML.
BOOL DoStuff( CComPtr[IMyObj] pMyObj ); // Declaration
BOOL DoStuff( CComPtr[IMyObj] pMyObj ) // Definition
{
hr = pMyObj.CoCreateInstance( CLSID_MyObj );
if( FAILED( hr ) return FALSE;
return TRUE
}
void MyDlg::MyFunc( void )
{
CComPtr[IMyObj] pMyOutsideObj; // Usage
if( !DoStuff( pMyOutsideObj ) )
return;
}
|
|
|
|
|
The changes that DoStuff() makes to its parameter aren't reflected outside the function. This is how C function parameters work. You can fix your code by changing the parameter to a reference:
BOOL DoStuff ( CComPtr<IMyObj>& pMyObj );
--Mike--
http://home.inreach.com/mdunn/
The Signature, back by popular demand: Buffy. Pajamas.
|
|
|
|
|
Hi,
A project I am currently working on relies heavily on COM, connecting to remote servers etc... The system is in use for a few years now, and as part of "new" work on the project, we have to provide a "workaround" for calls to remote servers when they become incontestable i.e. an application\infrastructure component of the system holds a cached interface pointer to a component on server B, server B becomes disconnected from the network, and the application\infrastructure component attempts to make a call to that component. COM takes up to 15minutes to resolve the call and return an error, here in lies the problem.
The system has been in field for a few years now and is quite large, thus the workaround of determining if a server is contactable before each individual COM call is not a valid option. Some thought was put into getting down to the "COM" level i.e. proxy stub level. Has anyone had to workaround this problem before? Any ideas\help will be gratefully appreciated...
Cheers in advance,
Simon
|
|
|
|
|
I am beginner in C++. I am strugling with data type convertion. I am using ADO to get date data from DB. But problems start when I want to convert it and add it to ostringstream.
I am thankful for any hint.
date= pRsPtr->GetCollect(L"d_Date").date;
buffer<<""<
|
|
|
|
|
I want to know how to implement custom marshaling between machine and machine.but I can't find even one example anywhere.Can you offer me one?
Bill
Thank you all for your help!
|
|
|
|
|
Maybe this question is same to the last .Could anyone explain it to me?
::CoInitialize(NULL);
ISomeInterfacePtr ppv;
ppv.CreateInstance("MYSERVER.SOMEINTERFACE.1");
ppv->SomeFunction();
The code can be successful if the com object is in a dll .But failed
when the com object is in the exe-server .
I used ATL to create the exe-server project . Do I need to add additional
codes if it is created as an exe?
|
|
|
|
|
What is the error code when the object is in the exe-server? Did you register the proxy/stub for the exe server?
|
|
|
|
|
Thanks a lot . As I have no materials at hand now, I don't know what the error code means,which is a negative number .
But what do you mean that the proxy/stub need to be registered ?
After I compile and link the source code , the VC has helped me to register the exe-server .
I tried to create a dual interface in this Atl project ,and I found that I can use it in the client code . But if the interface was an custom interface which means it inherits from the IUnknown ,not IDispatch , I found the problem I posted last time .
Why?
|
|
|
|
|
For dual interfaces COM can use Automation(aka Unversal) marshaller and there is no need for separate proxy/stub dll. If you have custom interfaces and expect to the marshalling to be envolved (call the object methods from another apartment, in case of out-of-proc object this is always true), than you need to build and register proxy/stub dll. IDL compiler generates all necessary files for that and ATL wizard creates .def & makefile to build it (<yor projectname="">ps.def and <youprojectname>ps.mk.
Edward
|
|
|
|
|
If selected to create a custom interface, you'll need to register the proxy server marshalling dll for your EXE COM server. Look at the file with the WinMain(), Unlock(), and Monitor() functions that SCM uses to startup your COM server. At the top of the file you'll see some comments that look like this:
// Note: Proxy/Stub Information
// To build a separate proxy/stub DLL,
// run nmake -f [Your EXE name here]ps.mk in the project directory.
Just do what it says. (NOTE: You may need to run vcvars32.bat in your VC directory to setup the paths to nmake and stuff.) After doing that you should have a proxy/server marshalling DLL file. You'll also need to register the DLL: regsvr32 [The newly created proxy/server]ps.dll
A way to automate this is to put it in your Project | Settings under the "Post-Build Step":
nmake /f MyComponent.mk
regsvr32 /c /s MyComponenetps.dll
- Pros
|
|
|
|
|
when I added the custom event in the dll-server ,which means the event interface inherits from IUnknown ,I can Advise using Sink-Object from the client code . But when the server is exe , Advise failed from the client code .Why?
|
|
|
|
|
In one of my articles I wrote how we can use a VB activex dll component in a VC app. The problem is that when I try to create the component from a new thread, everything bonks. Is this a threading problem? I think my activex dll is apartment threaded(STA) whereas I wanna use it in an MTA. Hence the problem.... So what's the solution? Maybe I can use an activex exe cause it runs in it's own thread..
Any comments/help is welcome.
TIA.
Hush..Hush.. thought I heard you calling my name now...
|
|
|
|
|
Gidday (dead give-away where I live) .. Im pretty new at
this so dont shout too loud if I mess up..
Anyway - I have an NT Service, based on service generated by
the ATL wizard (VC++ 6.0). The Service will install on NT 4.0 Workstation,
NT 4.0 Enterprise Server 64 bit encryption.
It wont however install on NT 4.0 Enterprise Server 128 bit
encryption - the UpdateRegistryFromResource call appears to
fail in the CserviceModule::RegisterServer code, but its
real hard to figure out what the error means ... 'Class not
registered' - I have used "service.exe /regserver"
Just a thought Im having, is, should I install VC++ on the
new platform (Its installed on a 64 bit encryption platform)
compile and generate the code with a new GUID ???
Has anyone else got any ideas, short of pulling off that
128 bit encryption version of NT Server, and installing
a 64 bit version ?? (this appears to be the only real
difference in the machines...)
Garth Lancaster
g.lancaster@mbf.com.au
|
|
|
|
|
'bugger' - I just realised that our e-mail system will be
down till 5pm Saturday Australia time (=18 to 22 hours
ahead of the states) .. snigger - this means that you cant
flame me directly - as you might tell, my Net experiences
havent been great so far - there are more people out there
interested in nit-pickin and flaming than there are in helping,
imho
In the meantime, Im going to install Visual Studio Pro on the
NT Server with the Enterprise Server 4.0 128 Bit encryption
version on it, build a nothing ATL COM Service with the
wizard, and see if that works ..
'G'
G J Lancaster
|
|
|
|
|
Almost the end of the saga .. after installing VC++ on the
NT Server (4.0 Enterprise, 128 bit encryption), I generated
the same dummy ATL_Service using the wizard ... and it
installed and ran .. so then I tried the original
service that wouldnt install.. and lo and behold it worked,
too..
so Im almost happy .. I say almost, because I still really
do know what went on here, and why installing VC++ fixed it.
If anyone out there has been watching this, and knows the
answer, please put me out of my (semi) misery
regards from 'Down Under'
Garth
|
|
|
|
|
If you didn't specify _ATL_STATIC_REGISTRY atl will try to use "Registrar" component to register your server and probably this component was not installed on your server.
Edward
|
|
|
|
|
Thanks Edward ... If Id have known that on Saturday, I would
have had an easier time
CUL, Garth
|
|
|
|
|
Hello all the ATL/COM/C++ gurus!!!
The little and unnoticed ATL beginner desparately needs your help.
I am trying to build my project with ReleaseMinSize configuration with _ATL_MIN_CRT flag.
Note that I don't have any runtime header files included, but I use #import-ed VB-based COM objects.
Note that I disabled "exception handling" mechanisms and MFC support.
All data types I am using are _com_ptr_t, _bstr_t, _variant_t from import-created .tlh and .tli files, plus regular C/C++ scalar types.
My problem: link error 2001 with the bunch of unresolved external symbols.
Does anyone know where the problem is.
BIG TIME thanks to all with the BIG heart.
Kirill.
|
|
|
|