NO

Author Topic: Toast Notifications demo in plain C  (Read 838 times)

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
Toast Notifications demo in plain C
« on: November 09, 2023, 03:21:27 PM »
If you're not hungry, but want taste windows toast notifications...  ;D
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

Offline MrBcx

  • Global Moderator
  • Member
  • *****
  • Posts: 176
    • Bcx Basic to C/C++ Translator
Re: Toast Notifications demo in plain C
« Reply #1 on: November 09, 2023, 04:00:02 PM »
Excellent demo Frankie!

It boggles the mind why MS makes some things so damn difficult to use.

Thank you for sharing this.
Bcx Basic to C/C++ Translator
https://www.BcxBasicCoders.com

Offline Vortex

  • Member
  • *
  • Posts: 802
    • http://www.vortex.masmcode.com
Re: Toast Notifications demo in plain C
« Reply #2 on: November 09, 2023, 07:12:04 PM »
Hi Frankie,

Thanks for your efforts. The executable does not run on Windows 7 64-bit :

Code: [Select]
\PellesC\bin\podump.exe /IMPORTS ToastDemo.exe | findstr ".dll"
Code: [Select]
        KERNEL32.dll
        ADVAPI32.dll
        USER32.dll
        ole32.dll
        api-ms-win-core-winrt-l1-1-0.dll
        api-ms-win-core-winrt-string-l1-1-0.dll

The last two DLLs are missing on my system.

Installing the Update for Universal C Runtime ( Windows 7 ) didn't help.

https://github.com/dotnet/core/issues/6976
Code it... That's all...

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: Toast Notifications demo in plain C
« Reply #3 on: November 10, 2023, 08:36:37 AM »
Testing Win 7 and using missing dlls
Code: [Select]
Second chance exception 0xC0000005 (Access Violation) occurred in "TOASTDEMO.EXE" at address 0x000000013FEB160C.
Code: [Select]
22.08.2013  13:45             4 096 api-ms-win-core-threadpool-l1-1-0.dll
22.08.2013  13:42             3 584 api-ms-win-core-winrt-error-l1-1-0.dll
22.08.2013  13:42             3 584 api-ms-win-core-winrt-l1-1-0.dll
22.08.2013  13:42             3 072 api-ms-win-core-winrt-robuffer-l1-1-0.dll
22.08.2013  13:42             4 096 api-ms-win-core-winrt-string-l1-1-0.dll
here it crash:
Code: [Select]
if (!SUCCEEDED(RoGetActivationFactory(hsToastNotificationManager, &IID_IToastNotificationManagerStatics, (LPVOID*)&pToastNotificationManager)))
return 1;
Better to do this:
Code: [Select]
if (!SUCCEEDED(RoGetActivationFactory(hsToastNotificationManager, &IID_IToastNotificationManagerStatics, (LPVOID*)&pToastNotificationManager)))
return 1;
if (!pToastNotificationManager)
return 2;
« Last Edit: November 11, 2023, 06:14:59 PM by TimoVJL »
May the source be with you

Offline Vortex

  • Member
  • *
  • Posts: 802
    • http://www.vortex.masmcode.com
Re: Toast Notifications demo in plain C
« Reply #4 on: November 10, 2023, 10:11:32 AM »
Hello,

On a Windows 11 system, the application works fine. Testing on a Windows 10 computer, I can only type 1 line as the Enter key has no any effect.
Code it... That's all...

Offline John Z

  • Member
  • *
  • Posts: 796
Re: Toast Notifications demo in plain C
« Reply #5 on: November 10, 2023, 10:48:30 AM »
Hi all,

Well my Win 7 Home Premium with service pack 1 also has the missing dll issue. 
api-ms-win-core-winrt-l1-1-0.dll   (maybe more but stops here)

I searched the web it seems a very common lament about Win 7. 
I did not find any site deemed safe enough to try to download.

Win 11 as with everyone else works great, but leaves a console window open (maybe on purpose?)

John Z

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: Toast Notifications demo in plain C
« Reply #6 on: November 10, 2023, 12:16:43 PM »
This didn't help.
runtime.win7-x64.Microsoft.NETCore.Windows.ApiSets
Code: [Select]
Loaded "RPCRTREMOTE.DLL" at address 0x000007FEFCC00000.  Successfully hooked module.
DllMain(0x000007FEFCC00000, DLL_PROCESS_ATTACH, 0x0000000000000000) in "RPCRTREMOTE.DLL" called.
DllMain(0x000007FEFCC00000, DLL_PROCESS_ATTACH, 0x0000000000000000) in "RPCRTREMOTE.DLL" returned 1 (0x1).
Second chance exception 0xC0000005 (Access Violation) occurred in "TOASTDEMO.EXE" at address 0x000000013F11160C.
Exited "TOASTDEMO.EXE" (process 0x27E8) with code -1073741819 (0xC0000005).
Code: [Select]
13.06.2016  21:46            19 704 api-ms-win-core-winrt-l1-1-0.dll
13.06.2016  21:46            20 240 api-ms-win-core-winrt-string-l1-1-0.dll
13.06.2016  21:46            19 728 api-ms-win-core-winrt-error-l1-1-0.dll
13.06.2016  21:46            19 224 api-ms-win-core-winrt-robuffer-l1-1-0.dll
13.06.2016  21:46            19 240 api-ms-win-core-threadpool-l1-1-0.dll
EDIT: can't work with stub dlls and code don't check actual pointers
« Last Edit: November 11, 2023, 05:34:17 PM by TimoVJL »
May the source be with you

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
Re: Toast Notifications demo in plain C
« Reply #7 on: November 10, 2023, 12:44:39 PM »
Hi Frankie,

Thanks for your efforts. The executable does not run on Windows 7 64-bit :

Code: [Select]
\PellesC\bin\podump.exe /IMPORTS ToastDemo.exe | findstr ".dll"
Code: [Select]
        KERNEL32.dll
        ADVAPI32.dll
        USER32.dll
        ole32.dll
        api-ms-win-core-winrt-l1-1-0.dll
        api-ms-win-core-winrt-string-l1-1-0.dll

The last two DLLs are missing on my system.

Installing the Update for Universal C Runtime ( Windows 7 ) didn't help.

https://github.com/dotnet/core/issues/6976
It seems that the problem is bigger, because the changes in the framework are incompatible (seems a Python issue ?).
Anyway a solution has been crafted to allow Blender to run on WIN7. You can find it on github.
Let me know if it works.

Hi all,

Well my Win 7 Home Premium with service pack 1 also has the missing dll issue. 
api-ms-win-core-winrt-l1-1-0.dll   (maybe more but stops here)

I searched the web it seems a very common lament about Win 7. 
I did not find any site deemed safe enough to try to download.

Win 11 as with everyone else works great, but leaves a console window open (maybe on purpose?)

John Z
Yes John the code let the console running, for what purpose I don't know. It was the original demo that I already modified, I have to haircut it a bit more... ;D

EDIT: Added compiled DLL for X86 and X64.
« Last Edit: November 10, 2023, 01:03:17 PM by frankie »
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

Offline Vortex

  • Member
  • *
  • Posts: 802
    • http://www.vortex.masmcode.com
Re: Toast Notifications demo in plain C
« Reply #8 on: November 10, 2023, 07:42:05 PM »
Hi Frankie,

Thanks for your help. Your zip attachment contains the file api-ms-win-core-path-l1-1-0 but the ToastDemo.exe is asking for api-ms-win-core-winrt-l1-1-0.dll ( later probably the DLL api-ms-win-core-winrt-string-l1-1-0.dll )

Code it... That's all...

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
Re: Toast Notifications demo in plain C
« Reply #9 on: November 11, 2023, 04:13:42 PM »
Hi Frankie,

Thanks for your help. Your zip attachment contains the file api-ms-win-core-path-l1-1-0 but the ToastDemo.exe is asking for api-ms-win-core-winrt-l1-1-0.dll ( later probably the DLL api-ms-win-core-winrt-string-l1-1-0.dll )
Hi Erol,
I made a mistake  ;D
Confused names  ::)
Anyway seems that there isn't solution for this problem of missing dll under win7.
The functions in the library are in different libraries. The work to do is to remove the library "runtimeobject.lib", and add to the linker the "api-ms-win-core-winrt-*.dll" libraries present on the WIN7 system containing the same functions present in "runtimeobject.lib".
Honestly I'm not intrigued by revitalizing WIN7, Now I'm more attracted with the toast notifications thing.
You can make some trials, and to help on this I attach the definition file of "runtimeobject.lib", 64 bits version, to identify the required functions.
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

Offline Vortex

  • Member
  • *
  • Posts: 802
    • http://www.vortex.masmcode.com
Re: Toast Notifications demo in plain C
« Reply #10 on: November 12, 2023, 05:38:16 PM »
Hi Frankies,

Thanks, no worries. Sadly, M$ is deliberately complicating a lot of things. :(
Code it... That's all...

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
Re: Toast Notifications demo in plain C
« Reply #11 on: November 21, 2023, 12:12:50 AM »
Excellent demo Frankie!

It boggles the mind why MS makes some things so damn difficult to use.

Thank you for sharing this.
Yes this thing is so damned difficult, but very very flexible and powerful indeed  :D.
So to make things simpler you may want try my toast library on github;D
« Last Edit: November 21, 2023, 12:29:03 AM by frankie »
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide