|
Are you sure that VB has generated a connnection point and not a custom event handler?
Michael
|
|
|
|
|
That's one of the problems with VB, it's hard to know exactly what's going on.
I guess my question should be, how do I create an event function that returns parameters from the client (without using a callback interface)?
Anyone have a clue on this one?
__scott
|
|
|
|
|
Why not just use the callback interface. It's easy to make in VC, and easy to use from VB...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
One of the good things about using connection points is that the client doesn't need to manage the connection to the incoming interface.
That is, to connect to the COM server callback interface, the client must pass a reference of itself to the server. Is there a way for the server to determine if the client is still there before calling the callback function? Is there a way for the server to implicitly connect to the client when the client instantiates an object from the server?
I'm not sure that made sense...oh well
__scott
|
|
|
|
|
SPENNER wrote:
I'm not sure that made sense...oh well
I know exactly what you mean. I just don't know of a solution...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
We have a communications ATL COM DLL used in a project here that used to load a Java COM object (on a web server) that communicates to a server running IMS transactions on a mainframe. The Java "object" was provided by the customer. Recently they "upgraded" to a newer component, an ActiveX DLL written in Microsoft J++. The old component wasn't a DLL, but a huge collection of Java class files. Because we couldn't import any DLL and had no Type Library to work with we had to do it the painful way, loading by ProgID (easy in VB, hard in ATL), getting the IDispatch pointer, and using Invoke.
This new version comes as a DLL which means I can easily #import the DLL itself and use that to make me a good ol smart pointer which I can use. That part was easy and appears to be fine. My smart pointer is using a single method in the new object called "processITOC". Visual Assist shows me that format of this sucker is:
_bstr_t processITOC ( BSTR * templatepath, BSTR * server, BSTR * port, BSTR * system, BSTR * UserId, BSTR * password, long * timeout, VARIANT * request, BSTR * sTranName );
Seems easy enough... more or less, I hate variants. However, every time I try to pass in the data, it blows with an Access Violation in MSVBVM60.DLL, 0xC0000005. I know this new DLL works fine because I can load it up in a VB project and use it just fine. However, in ATL it blows. I think I'm probably doing something really simple wrong but am currently lost. Could someone give me a hand?
_bstr_t Ret;
BSTR Template = L"file:///C:\\HostTemplates/";
BSTR LogDir = L"C:\\LOG\\";
BSTR Priority = L"3";
BSTR Mainframe = L"111.111.111.111";
WCHAR wchPort[10];
_itow(32000, wchPort, 10);
BSTR Port = wchPort;
BSTR User = L"user";
BSTR Password = L"password";
long Timeout = 240000;
BSTR System = L"DatabaseName";
BSTR TransID = L"ID";
VARIANT upArg;
VariantInit(&upArg);
V_VT(&upArg) = VT_BSTR;
V_BSTR(&upArg) = SysAllocString("ImAnXMLRequestwithtags");
m_pIHandler->setLoggingDirectory(&LogDir);
m_pIHandler->setLoggingPriority(&Priority);
Ret = m_pIHandler->processITOC( &Template,
&Mainframe,
&Port,
&System,
&User,
&Password,
&Timeout,
&upArg,
&TransID );
If someone could point something out I'd be grateful.
Thanks,
Matt
|
|
|
|
|
I have a COM object that returns a string to the calling program. It works perfectly under Win95(a) to Win2000. Under WinXP pro, it crashes in oleauto32 if returned as a BSTR, but passes successfully if passed as a safearray.
Any ideas? Thanks.
|
|
|
|
|
We have an ActiveX DLL containing both full controls and simple objects, implemented in C++ / ATL.
We've updated the library, and want to assign a new version number (say 2, instead of 1). If we edit the RGS and IDL files to reflect the new version number, our users find that the full controls aren't instantiated unless the registry contains the -old- version keys. When a VB project using the controls is opened, it recognizes that an updated version has been registered (asks if you want to update the project), but then can't instantiate the full controls.
There is no problem with simple controls, since there is no version number info for them in their registry entries. The problem is only exhibited with full controls.
What are we doing wrong? We've searched everywhere we can think of in MSDN and elsewhere for how to do this, but can't find any info. If someone can either answer or point us to documentation, we'd be greatly appreciative.
David Stranz
|
|
|
|
|
I've got this ActiveX Object (made w/ VC++6.0), it creates a thread (so i can have multiple running at the same time), but it also fires events to my Visual Basic App. With me creating threads cause problems for those events trying to get back to the application?
It seems that way. VB seems to crash when i Fire an event. When i use an activex control, does it have its own thread? Can i redirect the thread ID or something like that? It's just being flat out weird. Has anyone had the same trouble before? I set up connection points at the beginning when i made the obj., is there any other settings that i need to have? Even a little bit of help will go a long way for me...Thanks Y'all.
~TIM!
SHABBA!!
|
|
|
|
|
I need to be Free threaded. If you selected Apartment Threaded when you created the object it will fail.
Go into the rgs-file, and check the threading model, it should say "Free" and not "Apartment" or something else...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
As well as that, you need to initialise it as multithreaded. Do this in your thread function.
G.Luck
|
|
|
|
|
Use COM aggregation: OuterObject ICar, inner aggregated object IVehicle.
Have a VB scripting client.
When I create the (outer) car object, IntelliSense only shows me the methods and properties of this one (as in the IDL it is defines as the [default] interface for the coclass.
I would expect those of the aggregated IVehicle as well
Otherwise one can't know that IVehicle is aggregated and supported by ICar and therefore can be accessed through ICar.
The object browser only shows two separate Interfaces and its properties ICar and IVehicle.
So where can one see in VB, that ICar also supports the Interface IVehicle?
|
|
|
|
|
Hi,
I'm using ATL and have written an event that passes a SAFEARRAY (of
doubles) back to the client as one of its parameters
In the IDL file I've declared this as:
[id(2), helpstring("method SpoilValuesReadyEvent")] HRESULT
TFASpoilsReadyEvent(SAFEARRAY(double)* a, double b, double c);
producing:
HRESULT Fire_TFASpoilsReadyEvent(SAFEARRAY * * a, DOUBLE b, DOUBLE c) etc...
in the proxy file.
I'm testing the code from a VB client. The client produces:
Private Sub test_TFASpoilsReadyEvent(a() As Double, ByVal b As Double, ByVal
c As Double)
This all seems to be OK. However, when I fire the event, it is not caught
by the client. Is there any reason for this apart from probable
incompetence ?
|
|
|
|
|
Why don't you catch the error and get a error description of the failure, this way we might be able to help you ?
|
|
|
|
|
Hi, there is no error generated as such. The problems I'm having centre around:
1. The IDL complaining that an interface doesn't support automation.
2. The interface being seeminly ok until I try to use it in a client. The client (i'm testing in VB) will try to implement the event handler and either not catch it or crash at the first line of code in the handler.
Judging by other stuff i've seen on the net there seems to be a problem with passing SAFEARRAYS and VARIANTS through event interfaces.
|
|
|
|
|
download this sample from chris sells site
http://www.sellsbrothers.com/tools/CComSafeArray.zip
This has a excellent sample that uses Safearray between C++ and VB
But...
Looking at your code, everthing seems to be OK. It may be that you have some basic COM security problems. i.e. your server machine does not have the rights to fire data at your client machine.
|
|
|
|
|
Hi.
I read that there is a way to display addition attributes in Active directory on the context menu of Microsoft Window Shell and Active Directory administrative adds-in. Does anyone has a sample code for this or know where it is available?
Thank you.
|
|
|
|
|
Hi.
I read that there is a way to display addition attributes in Active directory on the context menu of Microsoft Window Shell and Active Directory administrative adds-in. Does anyone has a sample code for this or know where it is available?
Thank you.
|
|
|
|
|
In our shop we utilize an application generator "Cool Plex". It builds C++ code and compiles it into dlls. One of its abilities is to include ActiveX controls on a screen. We have written an ActiveX control that dynamically creates a form using Combo box, ListBox and Ms MaskEdBox control. A typical usage might include 2 or 3 instances of each.
The Problem:
Inside our ActiveX we capture the Tab key in each control (control_OnKeyUp) and set focus to the next control, except for the MaskedEdit controls. We get other keys in the KeyUp event, but not the Tab key!!??
If I create a VB app and embed the control in it, the tabbing works as normal, So far, even worse. Now it appears the PLEX generated application is inhibiting the Tab key from getting to the MaskedEdit control which is encapsulated in our ActiveX control. Other encapsulated controls seem to work fine.
It seems to me that these symptoms are mutually exclusive. I don't see how this is possible, but the developer on this project has convinced me that this is what is happening.
1. PLEX container passes (or never gets) Tab key presses to the ActiveX control.
2. PLEX container inhibits the Tab key when the focus inside the ActiveX control is in a MaskedEdit control.
3. I believe the encapsulated control with the focus, gets the events before PLEX, precluding inhibiting the tab key at all.
4. PLEX container has no way to differentiate the encapsulated control with the focus from any other.
5. PLEX container has no way to differentiate the type of control. How could it know that the focus in our Activex control is on a MaskEdBox?
Thanks for the help,
Bill
|
|
|
|
|
Hi,
I am using a COM component(Local Server) from a VB Client.
My client is a System-Tray Application.
In Client, During Form_Unload, I am calling a COM interface function
because, I have to call that Interface function whenever the
client exits.
When I restart the machine without exiting the client application,
i get an Automation Error...
An Outgoing Call cannot be made since the Application is dispatching
an Input Synchronous call.
This is happening because of the Interface method I am calling
from the clients Form_Unload event.
How can I Resolve this...?
I have to call that Interface function whenever the
client exits.
I dont understand which "Input Synchronous call" this error
is referring to ?
Is it Form_Unload ??
But it doesnt give this error when the Client is exited
manually (from an option in the clientUI)
Please somebody help me out...
Thanks
Firoz
|
|
|
|
|
Hi,
Use Form_QueryUnload instead of Form_Unload, this might help, becuase Form_QueryUnload called before the client exists, but Form_Unload is called when the application is already being unloaded. By the way, you can stop existing the client using Form_QueryUnload event using Cancel argument.
ShadiK.
Shadi Al-Kahwaji
|
|
|
|
|
I am new at COM and I am not understanding why when I call
hr = CoCreateInstance ( CLSID_ITvVgaOutPut,
NULL,
CLSCTX_INPROC_SERVER,
IID_ITvVgaOutPut,
(void**) &pITVO );
I get this--> error C2065: 'CLSID_ITvVgaOutPut' : undeclared identifier
and this --> error C2065: 'IID_ITvVgaOutPut' : undeclared identifier
i thought if the Interface is not found that it return a bad value that i could test with SUCCEEDED(hr)but it wont compile. Any suggestions would useful or tips. Thanks!!
|
|
|
|
|
Hi,
You need to have the Header file which defines all the
CLSIDs and IIDs.
or
You should #import the TypeLibrary/Dll/Exe of the Component.
Firoz
|
|
|
|
|
I do have the header files however even when I do a #include of the file I still get the error. Now this interface is to a video card that I do not have installed on my machine. Would that be a factor? I know that the CLSID are in the registry and it would make the most logical sense to develope on a machine where the card was located, but I did not have a machine available.
|
|
|
|
|
The problem your having is that the compiler does not know the CLSID and IID. This means that you did not include them. This has absolutely nothing to do with the COM object not being registered, this would only cause a runtime error -> CoCreateInstance returns a class or interface not registered error.
There are two way to use a COM object.
1. Import the type library (.tlb file), just as you would include a header file, e.g. #import "component.tlb" at the top of your .h or .cpp file.
2. Add the _i.c file generated by the components .idl file to your product and include the generated .h file into your .h or .cpp file. This is probably not the way for you as you wil probably not have these files and do not have the source files (read .idl file) to generate them.
|
|
|
|