Click here to Skip to main content
15,913,944 members
Home / Discussions / COM
   

COM

 
QuestionWriting multiple Tables to Word from VB Pin
spikedturtle11-Jul-09 4:49
spikedturtle11-Jul-09 4:49 
AnswerRe: Writing multiple Tables to Word from VB Pin
Stuart Dootson11-Jul-09 6:00
professionalStuart Dootson11-Jul-09 6:00 
QuestionProgram crashes while updating .idl file manually Pin
chandrakar ashish10-Jul-09 1:17
chandrakar ashish10-Jul-09 1:17 
AnswerRe: Program crashes while updating .idl file manually Pin
«_Superman_»10-Jul-09 16:09
professional«_Superman_»10-Jul-09 16:09 
AnswerRe: Program crashes while updating .idl file manually Pin
Chiman110-Jul-09 20:29
Chiman110-Jul-09 20:29 
AnswerRe: Program crashes while updating .idl file manually Pin
Stuart Dootson11-Jul-09 2:11
professionalStuart Dootson11-Jul-09 2:11 
QuestionWord Document Mail Merging and then Editing in automated fashion Pin
Sandumone9-Jul-09 10:06
Sandumone9-Jul-09 10:06 
QuestionQuerInterface fails for an Interface of type IUnknown in VB .NET windows service but the same works in VB .NET forms application Pin
VM JOE9-Jul-09 3:51
VM JOE9-Jul-09 3:51 
Here is the IDL definition
[
               object,
               uuid(DAFB7D76-0158-452F-8FD0-FF97A683DEA3),
     
               helpstring("ITest Interface"),
               pointer_default(unique)
      ]
      interface ITest : IUnknown
      {
               [helpstring("method GetString")] HRESULT GetString([out,retval]   BSTR* pVal);
      };
     
[
      uuid(E768DC15-A19B-407C-ACF9-C420D6FDB1BE),
      version(1.0),
      helpstring("TestServer 1.0 Type Library")
]
library TESTSERVERLib
{
      importlib("stdole32.tlb");
      importlib("stdole2.tlb");

      [
               uuid(788571BD-030B-49CC-8C0A-2DF74E58331A),
               helpstring("Test Class")
      ]
      coclass Test
      {
               [default] interface ITest;
      };
};

The ATL COM Library uses APARTMENT threading model.

And the VB.NET windows service code fragment

                  try
                           Dim obj As New TESTSERVERLib.Test
                           Dim s As String
                           s = obj.GetString()
                  Catch ex As Exception
                           WriteToLog(ex.Message)
                           WriteToLog(ex.InnerException.ToString)
                  End Try

When the code executes the following error occurs:

Unable to cast COM object of type 'TESTSERVERLib.TestClass' to interface type 'TESTSERVERLib.ITest'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{DAFB7D76-0158-452F-8FD0-FF97A683DEA3}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
Object reference not set to an instance of an object.


But the same code works in VB.NET forms application.

Can anyone please explain the reason.
QuestionAdd extra device property sheet in Windows 7 Devices and Printers Pin
User 60869398-Jul-09 10:15
User 60869398-Jul-09 10:15 
QuestionButton on Toolbar not showing chervon effect Pin
am 20097-Jul-09 0:24
am 20097-Jul-09 0:24 
AnswerRe: Button on Toolbar not showing chervon effect Pin
zm157316-Jul-09 0:07
zm157316-Jul-09 0:07 
QuestionSMPP COM library Pin
harrisyn6-Jul-09 13:27
harrisyn6-Jul-09 13:27 
GeneralRe: SMPP COM library Pin
Md. Marufuzzaman6-Jul-09 21:49
professionalMd. Marufuzzaman6-Jul-09 21:49 
GeneralRe: SMPP COM library Pin
harrisyn7-Jul-09 12:01
harrisyn7-Jul-09 12:01 
GeneralRe: SMPP COM library Pin
Md. Marufuzzaman7-Jul-09 22:41
professionalMd. Marufuzzaman7-Jul-09 22:41 
GeneralRe: SMPP COM library Pin
harrisyn7-Jul-09 23:07
harrisyn7-Jul-09 23:07 
GeneralRe: SMPP COM library Pin
Md. Marufuzzaman8-Jul-09 18:21
professionalMd. Marufuzzaman8-Jul-09 18:21 
GeneralRe: SMPP COM library Pin
harrisyn9-Jul-09 3:37
harrisyn9-Jul-09 3:37 
GeneralRe: SMPP COM library Pin
Md. Marufuzzaman9-Jul-09 9:21
professionalMd. Marufuzzaman9-Jul-09 9:21 
GeneralRe: SMPP COM library Pin
harrisyn9-Jul-09 13:29
harrisyn9-Jul-09 13:29 
GeneralRe: SMPP COM library Pin
Md. Marufuzzaman10-Jul-09 23:48
professionalMd. Marufuzzaman10-Jul-09 23:48 
GeneralRe: SMPP COM library Pin
harrisyn11-Jul-09 2:11
harrisyn11-Jul-09 2:11 
GeneralRe: SMPP COM library Pin
harrisyn14-Jul-09 10:03
harrisyn14-Jul-09 10:03 
GeneralRe: SMPP COM library Pin
Md. Marufuzzaman19-Jul-09 22:11
professionalMd. Marufuzzaman19-Jul-09 22:11 
GeneralRe: SMPP COM library Pin
Md. Marufuzzaman14-Jul-09 19:09
professionalMd. Marufuzzaman14-Jul-09 19:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.