PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: COM servers (a great alternative to Windows DLLs)  (Read 294 times)

Paul Squires

  • Administrator
  • Master FireFly Member
  • *****
  • Posts: 8104
  • Windows 10
    • PlanetSquires Software
COM servers (a great alternative to Windows DLLs)
« on: August 16, 2017, 10:23:51 PM »

Jose has created code that allows us to crate low level COM servers that act very similarly to standard Windows DLL's. They are small, extremely fast, and the code overhead is very small (less than 2K).

Follow this link to play with a simply COM dll and example code that simply loads the dll and sends and receives a string from it:
http://www.planetsquires.com/protect/forum/index.php?topic=4073.msg30860#msg30860
The above link and a few posts after it demonstrate the basic code and then several refinements that make the code even smaller and clearer to read.

This following link is to a great summary post that Jose wrote to explain the similarities between standard Windows DLL and COM dll's. It also helps simplify COM in broad terms: http://www.planetsquires.com/protect/forum/index.php?topic=4073.msg30875#msg30875

I encourage everyone who is now programming in FreeBasic to read those posts.

 
Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

Josť Roca

  • FireFly3 Registered User
  • Master FireFly Member
  • *
  • Posts: 2785
    • Josť Roca Software
Re: COM servers (a great alternative to Windows DLLs)
« Reply #1 on: August 17, 2017, 07:45:45 PM »

The best tutorials for learning COM programming (for an ansi C, FreeBasic or PowerBasic programmer) that I know are:

COM in plain C - Part 1
https://www.codeproject.com/Articles/13601/COM-in-plain-C

COM in plain C - Part 2
https://www.codeproject.com/Articles/13862/COM-in-plain-C-Part

COM in plain C - Part 3
https://www.codeproject.com/Articles/14037/COM-in-plain-C-Part

COM in plain C - Part 4
https://www.codeproject.com/Articles/14117/COM-in-plain-C-Part

COM in plain C - Part 5
https://www.codeproject.com/Articles/14183/COM-in-plain-C-Part

COM in plain C - Part 6
https://www.codeproject.com/Articles/14905/COM-in-plain-C-Part

COM in plain C - Part 7
https://www.codeproject.com/Articles/15037/COM-in-plain-C-Part

COM in plain C - Part 8
https://www.codeproject.com/Articles/17038/COM-in-plain-C-part

Embed an HTML control in your own window using plain C
https://www.codeproject.com/Articles/3365/Embed-an-HTML-control-in-your-own-window-using-pla

However, for understanding what I have done to create a low-level COM server with FreeBasic, only the first part is needed (and you can ignore the "Install the DLL, and register the object" part of the article) or better read what I have posted (reading too much about COM programming without a good knowledge of the basic principles can be very confusing). You must learn to walk before trying to run.
« Last Edit: August 17, 2017, 07:54:32 PM by Josť Roca »
Logged

Josť Roca

  • FireFly3 Registered User
  • Master FireFly Member
  • *
  • Posts: 2785
    • Josť Roca Software
Re: COM servers (a great alternative to Windows DLLs)
« Reply #2 on: August 17, 2017, 08:05:14 PM »

Here is an article to understand reference counting:

Managing the Lifetime of an Object
https://msdn.microsoft.com/en-us/library/windows/desktop/ff485846(v=vs.85).aspx