Author Topic: Is it possible to convert a QB64 app into a "Restartable" app?  (Read 3599 times)

0 Members and 1 Guest are viewing this topic.

Offline hanness

  • Forum Regular
  • Posts: 210
    • View Profile
In Windows 10 2004 there is a new option to enable "Restartable apps". As an example, suppose I have Notepad open and I have some text typed in but I have not saved it. Prior to Windows 2004, if you restarted Windows it would ask you if you wanted to save your unsaved Notepad document. However, if you enable restartable apps in Win 10 2004, it won't even ask you if you want to save the document. Instead, when you log back on again the app will be open on your desktop right where you left it with the information you had typed right there in the Notepad Window.

This works for a number of apps like Office apps, Chromium Edge, etc.

So naturally, I'm wondering if there is any way to turn a QB64 app into a "Restartable" app.

Reference:

https://docs.microsoft.com/en-us/windows-insider/at-work-pro/wip-4-biz-whats-new#control-over-restarting-apps-at-sign-in-build-18965

Offline loudar

  • Newbie
  • Posts: 73
  • improve it bit by bit.
    • View Profile
Re: Is it possible to convert a QB64 app into a "Restartable" app?
« Reply #1 on: July 30, 2020, 11:59:24 am »
You could always have a temporary array of data that gets saved every x seconds into a temp file, then read back when you open the program. I don't know if it's possible to detect a click on the close button, so one could save it only then, which would save calculations and read/write operations.
Check out what I do besides coding: http://loudar.myportfolio.com/

FellippeHeitor

  • Guest
Re: Is it possible to convert a QB64 app into a "Restartable" app?
« Reply #2 on: July 30, 2020, 12:09:21 pm »
Regarding the IDE, every keystroke you type gets recorded. That allows you to go "back in time" with Ctrl+Z a looooong way, even across sessions. That kinda makes us a restartable app, without the API. In the event of a crash, your program can always be restored by opening the IDE, hitting CTRL+Z and confirming you want to:
 [ You are not allowed to view this attachment ]  

Now for your own programs, you can detect the user hit the CLOSE button with the _EXIT function, then you can perform any save routines before actually returning to SYSTEM.
« Last Edit: July 30, 2020, 12:14:58 pm by FellippeHeitor »

Offline hanness

  • Forum Regular
  • Posts: 210
    • View Profile
Re: Is it possible to convert a QB64 app into a "Restartable" app?
« Reply #3 on: July 31, 2020, 10:35:02 pm »
Yeah, I was really hoping to make the final compiled app restartable, I'm not concerned about the IDE. As for saving variables to an array, that would be rough one. My program is about 10,000 lines long now and has probably a couple hundred variables.

However, I do appreciate the suggestions.

Offline Gets

  • Newbie
  • Posts: 28
    • View Profile
Re: Is it possible to convert a QB64 app into a "Restartable" app?
« Reply #4 on: August 01, 2020, 03:29:41 am »
You should be able to, just check Microsoft's documentation on how it's done. There are some examples in the wiki on how to use Windows libraries with QB64. You probably won't be able to get around saving relevant variables if you want it to restart where you left off though.