Author Topic: Here's a crazy idea, or is it???  (Read 2015 times)

0 Members and 1 Guest are viewing this topic.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Here's a crazy idea, or is it???
« on: January 29, 2021, 09:49:32 am »
I've been considering a separate but communicating popup routine in my WP project. It would allow a resize of the doc, without affecting the size of the popup. It  would also save me making a moving popup function. However, since this method shells to run an additional separate instance of the program, there is a bit of a lag factor on slower computers.

I could use Windows API to maintain focus, and even get rid of the top Windows border on the popup. Right now, I'm just fiddling with some things, beginning with appearance, which isn't too bad.

Note: This demo won't create any files on your system. It just references itself, via an error trap for an open the exe file for input with a  LOCK in place. That creates a trapped error 70, permission denied. This method is fine for this demo, but only allows the user to press the popup key once. An actual temp file method would be employed, to solve that situation, if I go forward with this concept. I've already done similar projects with network handling of shared files over multiple computers.

Now maybe there are some new QB64 commands I'm unaware of that can do something similar to this already?

Anyway, to get this to work, you have to save it as myprog22xyz.bas and let the QB64 IDE compile it into myprog22xyz.exe. If you fail to do so, no popup will occur when you press the F3 key.

Oh, the "Hello Heaven" message is just a joke. Although considering the time it might take me to put this all together, it might also be a prophecy.

Code: QB64: [Select]
  1. ON ERROR GOTO handler
  2. ff1% = FREEFILE
  3. OPEN "myprog22xyz.exe" FOR INPUT SHARED AS #ff1%
  4. LOCK #ff1%
  5.  
  6.     CASE 0
  7.         $RESIZE:ON
  8.         WIDTH 120, 43
  9.         COLOR 0, 7: CLS
  10.         _DELAY .2
  11.         _SCREENMOVE _MIDDLE
  12.         _DELAY .2
  13.         _RESIZE ON , _SMOOTH
  14.         LOCATE 10, 54: PRINT "Hello Heaven!"
  15.         DO
  16.             _LIMIT 30
  17.             b$ = INKEY$
  18.             IF LEN(b$) THEN
  19.                 SELECT CASE b$
  20.                     CASE CHR$(27): UNLOCK #ff1%: SYSTEM
  21.                     CASE CHR$(0) + CHR$(61)
  22.                         IF NOT shell1% THEN
  23.                             shell1% = -1
  24.                             SHELL _HIDE _DONTWAIT "start myprog22xyz.exe"
  25.                         END IF
  26.                 END SELECT
  27.             END IF
  28.         LOOP
  29.     CASE 70
  30.         er1% = 0
  31.         WIDTH 60, 6
  32.         COLOR 15, 1: CLS
  33.         _DELAY .2
  34.         _SCREENMOVE _MIDDLE
  35.         _DELAY .2
  36.         LOCATE 3, 3: PRINT "Find: ";
  37.         COLOR 7, 0
  38.         PRINT SPACE$(50);
  39.         LOCATE 3, 10: PRINT "It worked!";
  40.         DO
  41.             _LIMIT 30
  42.         LOOP UNTIL LEN(INKEY$)
  43.         SYSTEM
  44.     CASE ELSE
  45.         PRINT "Unexpected error, code ="; er1%: END
  46.  
  47. handler:
  48. er1% = ERR


Pete
« Last Edit: January 29, 2021, 09:55:53 am by Pete »
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/