|
I am wanting to use COM controls in my management scripts written in VBS. Which controls are available to me and how can I use them.
Thanks in advance.
God answers knee mail.
|
|
|
|
|
I am porting an app from VB to C++, it uses Crystal Reports and in the VB app an event is handled using the "Handles" operator, I now need to handle that event in C++.
I am #import'ing the CRAXDDRT20.dll and using the IApplicationPtr and IReportPtr objects to initialise and start a report export, the event fired is called "BeforeFormatPage" in VB, how would I go about handling it in C++? (This is the first time I have used COM in C++ BTW)
|
|
|
|
|
|
I have read that and played around with the example but I just don't get it.
I have found this code in the .tlh file for my object:
#pragma implementation_key(2)
inline HRESULT CRAXDDRT20::IReportEvent::BeforeFormatPage ( long PageNumber ) {
return _com_dispatch_method(this, 0x2, DISPATCH_METHOD, VT_EMPTY, NULL,
L"\x0003", PageNumber);
}
Does that give any clues as to what direction I should be heading in.
Sorry if this sounds really dumb, I feel really dumb, I can normally understand and make most things work but COM is really baffling me
Cheers,
Dan.
|
|
|
|
|
Why are you reading .tlh file sir!,that the compiler generate for you when you import COM dll in your project.
i think you Event returning LONG as parameter
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
|
|
|
|
|
It was the .tli file, not .tlh, that was a typo but it was the only file I could find a reference to the event I was interested in and so thought it might provide a clue as to how to capture the event.
As for importing a COM dll into my project, I have never done that, would that possibly be a step towards capturing this event?
I am not using MFC or classes BTW, just plain C.
|
|
|
|
|
I am always getting a return value of E_INVALIDARG when the function AddNamedCommand is called:
CComPtr<envdte::command> pCreatedCommand;
hr = pCommands->AddNamedCommand(m_pAddInInstance, CComBSTR(commandname), CComBSTR(commandtext), CComBSTR(tb_name), VARIANT_FALSE, IDB_LOGO, NULL, EnvDTE::vsCommandStatusSupported+EnvDTE::vsCommandStatusEnabled, &pCreatedCommand);
IDB_LOGO is a 16x16 Bitmap.
I am using Visual Studio .NET 2003 on Win XP SP2. I have looked at the documentation and at other examples but I can't find where I am going wrong. I have exactly the same code as everybody else, but theirs works fine.
Any ideas?
I am the handsome one in the crowd.
|
|
|
|
|
Hello,
I want to implement an ActiveX Control (made in VB6) in VB 6 application.
It is working fine on my system, but if i am going to implement it on different computer it giving error like "The connection cannot be used to perform this operation. It is either closed or invalid in its context."
abc
|
|
|
|
|
Hi,
I'm pretty new to all this interop stuff, and I've come up against a bit of an obstacle. In my method I'm trying to return an instance of another class from C# assembly. Great! Except it doesn't work. I keep getting Error 5 "Object variable or with block not set" in my VB client. Here's some sample code I knocked together to demonstrate...
C# COM Server
<br />
using System;<br />
using System.Runtime.InteropServices;<br />
<br />
namespace COMReturnTest<br />
{<br />
[Guid("883EF833-3874-4831-9757-B44E987E80DF")]<br />
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]<br />
public interface _ReturnType<br />
{<br />
string TestString { get; }<br />
int TestInt { get; }<br />
}<br />
<br />
[Guid("29B3F02E-27A6-4535-8835-62D23BA2DA1E")]<br />
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]<br />
public interface _TestClass<br />
{<br />
COMReturnTest._ReturnType StringEmptyTest();<br />
COMReturnTest._ReturnType StringNullTest();<br />
COMReturnTest._ReturnType StringSetTest();<br />
System.String StringReturn();<br />
}<br />
<br />
[Guid("01A699E1-05ED-404e-A5B9-7C2735F97268")]<br />
[ClassInterface(ClassInterfaceType.None)]<br />
[ProgId("COMReturnTest.ReturnType")]<br />
public class ReturnType : COMReturnTest._ReturnType<br />
{<br />
#region class members<br />
<br />
private string _teststring = String.Empty;<br />
private int _testint = 0;<br />
<br />
#endregion<br />
<br />
#region class constructors<br />
<br />
public ReturnType(string TestString, int TestInt)<br />
{<br />
_teststring = TestString;<br />
_testint = TestInt;<br />
}<br />
<br />
#endregion<br />
<br />
#region _ReturnType Members<br />
<br />
public string TestString<br />
{<br />
get { return _teststring; }<br />
}<br />
<br />
public int TestInt<br />
{<br />
get { return _testint; }<br />
}<br />
<br />
#endregion<br />
}<br />
<br />
[Guid("73FB94E2-23EA-4e2c-A366-B234415FB4FE")]<br />
[ClassInterface(ClassInterfaceType.None)]<br />
[ProgId("COMReturnTest.TestClass")]<br />
public class TestClass : COMReturnTest._TestClass<br />
{<br />
<br />
public TestClass()<br />
{<br />
}<br />
<br />
#region _TestClass Members<br />
<br />
public COMReturnTest._ReturnType StringEmptyTest()<br />
{<br />
COMReturnTest.ReturnType rt = new COMReturnTest.ReturnType(String.Empty, 100);<br />
return rt;<br />
}<br />
<br />
public COMReturnTest._ReturnType StringNullTest()<br />
{<br />
COMReturnTest.ReturnType rt = new COMReturnTest.ReturnType(null, 100);<br />
return rt;<br />
}<br />
<br />
public COMReturnTest._ReturnType StringSetTest()<br />
{<br />
COMReturnTest.ReturnType rt = new COMReturnTest.ReturnType("bugger", 100);<br />
return rt;<br />
}<br />
<br />
public String StringReturn()<br />
{<br />
return "Buggeration!!!";<br />
}<br />
<br />
#endregion<br />
}<br />
}<br />
The StringReturn function is just in there to make sure I can return something. Which I can!
VB6 Client
<br />
Option Explicit<br />
<br />
Private Sub Command1_Click()<br />
On Error GoTo Command1_Click_Err<br />
<br />
Dim tc As New COMReturnTest.TestClass<br />
Dim rt As COMReturnTest.ReturnType<br />
rt = tc.StringEmptyTest<br />
<br />
Command1_Click_Err:<br />
MsgBox "An error occurred" + vbCrLf + vbCrLf + "Error: 0x" + Hex(Err.Number) + vbCrLf + _<br />
"Description: " + Err.Description + vbCrLf + "Source: " + Err.Source<br />
End Sub<br />
<br />
Private Sub Command2_Click()<br />
On Error GoTo Command2_Click_Err<br />
<br />
Dim tc As New COMReturnTest.TestClass<br />
Dim rt As COMReturnTest.ReturnType<br />
rt = tc.StringNullTest<br />
<br />
Command2_Click_Err:<br />
MsgBox "An error occurred" + vbCrLf + vbCrLf + "Error: 0x" + Hex(Err.Number) + vbCrLf + _<br />
"Description: " + Err.Description + vbCrLf + "Source: " + Err.Source<br />
End Sub<br />
<br />
Private Sub Command3_Click()<br />
On Error GoTo Command3_Click_Err<br />
<br />
Dim tc As COMReturnTest.TestClass<br />
Dim rt As COMReturnTest.ReturnType<br />
Set tc = New COMReturnTest.TestClass<br />
rt = tc.StringSetTest<br />
<br />
Command3_Click_Err:<br />
MsgBox "An error occurred" + vbCrLf + vbCrLf + "Error: 0x" + Hex(Err.Number) + vbCrLf + _<br />
"Description: " + Err.Description + vbCrLf + "Source: " + Err.Source<br />
End Sub<br />
<br />
Private Sub Command4_Click()<br />
On Error GoTo Command4_Click_Err<br />
<br />
Dim tc As COMReturnTest.TestClass<br />
Dim str As String<br />
Set tc = New COMReturnTest.TestClass<br />
str = tc.StringReturn<br />
<br />
Command4_Click_Err:<br />
MsgBox "An error occurred" + vbCrLf + vbCrLf + "Error: 0x" + Hex(Err.Number) + vbCrLf + _<br />
"Description: " + Err.Description + vbCrLf + "Source: " + Err.Source<br />
End Sub<br />
Now having extensively googled (and I do mean extensively!) I've come to the conclusion that all I'm missing is some kind of attribute decoration, probably on the methods in the class. Infact I've been tinkering with the MarshalAs attribute with the UnmanagedType.IDispatch , UnmanagedType.Interface and UnmanagedType.IUnknown parameters. (With the return: override of course.) These don't seem to have much of an effect.
Has anyone done this kind of thing before? If you have, how did you do it? And if not, any pointers? Please?!?
Cheers, Steve
|
|
|
|
|
Of course after about twenty hours looking at this I discovered what the error was immediately after posting!!!
steve_hocking wrote:
Private Sub Command3_Click()<br />
On Error GoTo Command3_Click_Err<br />
<br />
Dim tc As COMReturnTest.TestClass<br />
Dim rt As COMReturnTest.ReturnType<br />
Set tc = New COMReturnTest.TestClass<br />
SET rt = tc.StringSetTest<br />
<br />
Command3_Click_Err:<br />
MsgBox "An error occurred" + vbCrLf + vbCrLf + "Error: 0x" + Hex(Err.Number) + vbCrLf + _<br />
"Description: " + Err.Description + vbCrLf + "Source: " + Err.Source<br />
End Sub
You need to SET objects in wonderful vb...
Thanks anyway, I'm just getting me coat, if you can call a taxi for me...
|
|
|
|
|
Hi!
I'm trying to use WIA Automation component to use a web cam (a standard Logitech USB) in a .Net app.
The API makes it very straightforward to grab one picture from the camera or to get a video preview (OCX) automatically embedded in a window. Neat.
Now my problem is that I actually want to get a video stream -- that is images, possibly between 1 and 10 frames per second. The "TakePicture" command is the only command support by the device, it cannot work at the same time than the VideoPreview and anyway taking one snapshot takes between 3 and 10 seconds (it seems to reinitialize the camera each time!)
So... how am I supposed to use this API to do anything useful with a video device besides automatic preview?
|
|
|
|
|
I want to use Band in Box with the rme Digi96/8 PAD but i cant get a virtual MIDI device running.
I tried Roland Virtual Sound Canvas or otherwise the Microsoft GS Wavetable SW Synth.
Using DxDiag i can test Microsoft GS Wavetable SW Synth and Tadaa it works over the Digi96 but its not possible to use it in System Audio Settings.
After hours searching the registry to activate SW Synth working with my Digi96, i gave up!!
I need help!!!!!
|
|
|
|
|
Hi All!
I am new in C++ but I am mad to listen voice of Telephone line via a Sound Card in my PC...
How can I write soft to forward voice (normal voice of telephone user)from the modem to the PCI Sound Card??? And then my microphone sound from Sound Card into the modem connected to the phone line...
Any idea? for Visual C++6 or Borland C++...
I do love comments a lot...in code...
Thanks
Vova
vovik@indiatimes.com:
sigh:
|
|
|
|
|
I think You are looking For TAPI i.e. Telephone API,you will good reference for it in DEVELOPER GUIDE to Visual C++ and MSDN
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
if you wanna start programming you should run away from windows
and thy b*!"#%!#$%
|
|
|
|
|
|
I'm very new to COM. For some reason I just cannot seem to create this object CLSID_VideoMixingRenderer9. I'm basically using code copied right out of the DirectX SDK. The program compiles fine but when the program runs CoCreateInstance returns doesnt create the object. I've compaired the HRESULT returned from CoCreateInstance to the possible return values listed for CoCreateInstance but none of them match. The value of HRESULT is -2147220877.
PLEASE HELP THIS IS DRIVING ME OUT OF MY MIND.
|
|
|
|
|
Either DirectDraw has not been installed or the Video Card capabilities are not suitable. Make sure the display is not in 16 color mode.
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Hello,
I know the CLSID of the COM- object and I would like to retrieve the TypeLibrary ID of the Type Library describing it. (I want to get the ITypeLib interface of the typelib..)
I noticed in the Windows registry that the TypeLib ID is present in a subkey of the CLSID so I could get it from there, but I think that might not be the correct way to get to it... So if anybody knows I`ld be gratefull if you would share your knowledge.
Greetings,
Davy
|
|
|
|
|
I would probably use that way you described - seek in registry and load it by LoadRegTypeLib getting the ITypeLib interface.
Other possibility, but somehow limited is that if you have an object, who support IDispatch interface, you can create the object using the CLSID you know, asking for the IDispatch .
Then you can use the IDispatch::GetTypeInfo , returning the ITypeInfo , which in turn you can ask for the ITypeLibrary by using ITypeInfo::GetContainingTypeLib .
But this requires the component to support IDispatch .
Another way, I got from the head is getting the path to the dll or exe, where the object resides and use the LoadTypeLib function.
Hope this helps
|
|
|
|
|
hi
i have embeded an ActiveX control in a web page, when the page is accessed the control downloads and registers successfully on client's machine but it is not shown on the web page, instead a cross icon comes at its place
what might be wrong
plz help me its urgent
regards.
Muhammad Azam
|
|
|
|
|
Is your client using WinXP SP2 ?
modified 21-Apr-21 21:01pm.
|
|
|
|
|
hi Mr.Sohail Kadiwala
No, Windows 2000 professional is installed on client machine.
thanks for quering me, i have been looking for some solution from my MFCian mates but stll no responce.
Thanks in anticipation
i have to do it at earliest so plz help me out.
best wishes
Muhammad Azam
|
|
|
|
|
Hello everybody,
(For starters I'm new at COM and such so bear with me)
I am writing projects for handheld devices (PocketPC, ARM, MIPS, etc..) these devices need to access a COM - component on a desktop PC. So after some reading about COM it seemed that DCOM(communication over network with COMcomponents) was what I need. Allas DCOM apparantly is not supported on the WindowsCE (if I'm wrong here please let me know..)
So now I'm thinking about writing a desktop app that will capture messages from the handheld devices it would then, depending extra data it sends, contact the requested COM component and execute certain methods, and finally the app would send data back to the device (communication with device using windows sockets).
My documentation concerning COM is not the latest stuff that's out there (1996 ), so I will very quickly lay out my plan and I would like to ask you if my ideas are outdated or not (better ways to get where I want and how or URL's are welcome).
My idea roughly outlined:
(desktop app needs to be able to handle all kind of com-componentes so should be kind of generic)
The device makes a connection to a predefined port on the PC where the app is listening (Windows sockets). After connection is succesfully established:
Step 1: Device sendsCLSID or ProgID of the COM-class it wants to use-> the desktopApp searches for CLSID and checks if Component is known and accessible
Step 2: Device sends method it wants to invoke(optional sends also the Interface) -> The desktop app searches (incase no interface was passed)using the ITypeLib and ITypeInfo for an interface that implements the method and if it is found calls the method. Afterwards the desktop app return any data to the device.
Step 3: after device is finished with all its method calls it sends a quit or smthing-> desktop app releases the COM-obj.
This is a very brief layout of my idea(I know implementing it will get much more complicated but I just want to get your comments on the basic idea)... Is this the way to get the job done? Is there a better technology out there that does this?
Thanks to anyone that might help,
Greetings,
Davy
|
|
|
|
|
You don't say which version on WinCE you're using, and whether you can alter the build of the devices (your own products based on SBCs), or if they are 'canned' (like HP iPaq).
Steve S
Developer for hire hired!
|
|
|
|