Application Library examples

6 posts / 0 new
Last post
tekmage's picture
Last seen: 1 year 8 months ago
Joined: 2011-10-09 03:19
Application Library examples

Hi All,

Anyone have good examples for using the Application library. Specifically I'm looking to disable and enable the screen blanker from an app (AmiVNC).


salass00's picture
Last seen: 2 months 1 day ago
Joined: 2011-02-03 11:27
There is code to do that in

There is code to do that in CDXLPlay (source code is included):

The code is in main.c play() and pause() functions and is just:

  1. // disable screenbkanking
  2. SetApplicationAttrs(AppID,
  3. APPATTR_AllowsBlanker, FALSE,
  4. TAG_END);
  1. // enable screenblanking
  2. SetApplicationAttrs(AppID,
  3. APPATTR_AllowsBlanker, TRUE,
  4. TAG_END);

AppID is the ID you received from the RegisterApplication() function call.

trixie's picture
Last seen: 2 months 1 week ago
Joined: 2011-02-03 13:58
Re: Application Library examples

Or you can allow/disallow the blanker at app registration time, instead of calling SetApplicationAttrs() later:

AppID = IApplication->RegisterApplication("Application Name", REGAPP_AllowsBlanker, FALSE, TAG_DONE);

AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2

tekmage's picture
Last seen: 1 year 8 months ago
Joined: 2011-10-09 03:19
I pinged Vincente Gimeno and

I pinged Vincente Gimeno and he was kind enough to create a quick bit of code that compiles and sends a message to kick in the blanker:

  1. #include <proto/dos.h>
  2. #include <proto/exec.h>
  3. #include <proto/application.h>
  5. ULONG AppID;
  6. struct ApplicationMsg *AppMsg;
  8. int main(void)
  9. {
  10. /* Registering our Application, this function returns a unique Application ID
  11. * to allow it to receive or send messages to/from other applications
  12. */
  14. AppID=IApplication->RegisterApplication(NULL,
  15. REGAPP_URLIdentifier, "",
  16. REGAPP_LoadPrefs, TRUE,
  17. REGAPP_SavePrefs, TRUE,
  18. REGAPP_FileName,"blankertest", // if the FileName doesn't match the real file name from the executable, it fails registering
  19. REGAPP_NoIcon,TRUE,
  20. REGAPP_UniqueApplication, TRUE, // this will avoid that this app could be running more than once, depending on your application this may apply or not.
  21. TAG_DONE);
  23. if (AppID)
  24. {
  25. //We allocate memory for the application message
  26. if (( AppMsg = (struct ApplicationMsg *)IExec->AllocVec(sizeof(struct ApplicationMsg),MEMF_SHARED|MEMF_CLEAR)))
  27. {
  28. // Once we have an allocated ApplicationMsg, we send the application message from AppID (us) to 0 (broadcast to all)
  29. IApplication->SendApplicationMsg(AppID, 0, AppMsg,APPLIBMT_BlankerBlank);
  30. // And free the Application MSG
  31. IExec->FreeVec(AppMsg);
  32. }
  34. // Wait a little, we cannot wait for any keypress or mouse movement because it would disable the screenblanking directly ;)
  35. IDOS->Delay(600);
  37. /* Same process as before, we send a message to all aplications, it doesn't matter because all non-blanker applications will ignore this message anyway.
  38. * we could still get the blanker application name to obtain the Application ID, and use it instead of broadcasting, the usage would be:
  39. * SenderID = IApplication->FindApplication(FINDAPP_Name,"blanker app name",TAG_DONE);
  40. * the msg would then be sent to the SenderID application:
  41. * IApplication->SendApplicationMsg(AppID, SenderID, AppMsg,APPLIBMT_BlankerUnBlank);
  42. */
  44. if (( AppMsg = (struct ApplicationMsg *)IExec->AllocVec(sizeof(struct ApplicationMsg),MEMF_SHARED|MEMF_CLEAR)))
  45. {
  47. IApplication->SendApplicationMsg(AppID, 0, AppMsg,APPLIBMT_BlankerUnBlank);
  48. IExec->FreeVec(AppMsg);
  49. }
  50. // Once we finish, we tell application.library that our app is no longer registered to the system.
  51. IApplication->UnregisterApplication(AppID, NULL);
  52. }
  53. else
  54. IDOS->Printf("Error registering the Application\n.");
  55. }
Ami603's picture
Last seen: 6 years 2 months ago
Joined: 2011-10-11 23:11
ok, after being Amiga-less

ok, after being Amiga-less for a little while, i was too eager to get coding again, so i cooked this little tool to help debugging Application.library message sending.

Should be available soon over Os4 Depot:

tekmage's picture
Last seen: 1 year 8 months ago
Joined: 2011-10-09 03:19
Thanks to Ami603 I've got a

Thanks to Ami603 I've got a private build of AmiVNC4 that will disable the screen blanker when the client connects. Seams to work too. PM me if you want to give it a try.

Log in or register to post comments