0
#import "IDManTypeInfo.tlb" 
#include "IDManTypeInfo.h"                
#include "IDManTypeInfo_i.c" 
#include <atlbase.h>     //for CComBSTR class
int main(int argc, char* argv[])
{
    //.........
}
Alex K
  • 8,269
  • 9
  • 39
  • 57
Lê Sang
  • 11
  • 3
  • That's C++, you can't really directly translate it to C#. However, you can always do some wrapper .dll in C++ and get it's functions invoked / called in C#. – Bruno Monteiro Sep 02 '14 at 14:44
  • Check this out [How to call IDM(Internet Download Manager) from my C# application](https://stackoverflow.com/questions/8746703/how-to-add-download-links-to-idm-from-a-program/50661678#50661678) – Ahmed Soliman Jun 02 '18 at 22:29

1 Answers1

2

It's fairly easy, theoretically speaking.

IDM seems to be a COM library, all you need to do is throw the TLB file into tlbimp and it will generate C# lib.

How to: Create COM Wrappers: http://msdn.microsoft.com/en-us/library/ms404285(v=vs.110).aspx

You can use tlbimp.exe for this. In my computer there is this file:

C:\Program Files (x86)\Internet Download Manager\idmantypeinfo.tlb

You now have to run tlbimp command to generate the specific C# library:

C:\Program Files (x86)\Internet Download Manager>tlbimp idmantypeinfo.tlb
Microsoft (R) .NET Framework Type Library to Assembly Converter 3.5.30729.1
Copyright (C) Microsoft Corporation.  All rights reserved.

Type library imported to IDManLib.dll

C:\Program Files (x86)\Internet Download Manager>

You now have generated IDManLib.dll that contains the necessary stuff.

Erti-Chris Eelmaa
  • 25,338
  • 6
  • 61
  • 78