Recent

Author Topic: Toast notifications on Windows 10  (Read 490 times)

slicke

  • New member
  • *
  • Posts: 7
Toast notifications on Windows 10
« on: September 22, 2019, 05:56:30 pm »
Hi!

Has anyone managed to port Windows 10 desktop notifications/toasts (like the example on https://code.msdn.microsoft.com/windowsdesktop/Sending-toast-notifications-71e230a2/sourcecode?fileId=51046&pathId=1859297009) to Lazarus/FPC?

I've tried porting the code above, but my C++ isn't good enough. Is there any available library for this?

Thanks!

Thaddy

  • Hero Member
  • *****
  • Posts: 9309
« Last Edit: September 23, 2019, 07:46:38 am by Thaddy »
also related to equus asinus.

CCRDude

  • Hero Member
  • *****
  • Posts: 502
Re: Toast notifications on Windows 10
« Reply #2 on: November 11, 2019, 05:37:46 pm »
I started looking into the same thing today.

Marco Cantus blog has two links. One Dropbox link that's no longer available, and the "enhanced" version by AdSoft via Mega. The Embarcadero link basically points to Marco Cantus blog as well, mentioning that the code could be backported to Delphi XE 2.

Issue #1: many files in that later archive are Delphi RTL files, not clean translations to be reused freely.
Issue #2: unit names are using namespaces, which is easy to fix.
Issue #3: some units are unavailable in Lazarus. Looks like we can do without them. pngimage can be replaced with lazpng from package imagesforlazarus.
Issue #4: Imports are "delayed", which is not yet supported by FPC. Would need to be rewritten to dynamical dynamical loading if the code can be made to work in the first place.

You can make the code compile within an hour (setting a few $MODE Delphi, removing some unrequired code and adding some imports). It's not working right out of the box; i might spend another hour or two trying to get it to work.

@slicke: have you started (or even finished) getting the Delphi code to run on Lazarus?

CCRDude

  • Hero Member
  • *****
  • Posts: 502
Re: Toast notifications on Windows 10
« Reply #3 on: November 12, 2019, 08:36:26 am »
I have it running now, but it needs a lot of cleanup to make it (re-)usable. Will try to wrap it in a separate unit and see if I can define imports etc. without reusing Delphi RTL files.

Thaddy

  • Hero Member
  • *****
  • Posts: 9309
Re: Toast notifications on Windows 10
« Reply #4 on: November 12, 2019, 08:48:00 am »
I also got it working , but I always use {$mode delphi} by default when handling Delphi units. Waste of time to use {$mode objfpc}
also related to equus asinus.