Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 496
» Latest member: braveparrot
» Forum threads: 2,846
» Forum posts: 26,666

Full Statistics

Latest Threads
QBJS - ASCII Draw
Forum: QBJS, BAM, and Other BASICs
Last Post: grymmjack
15 minutes ago
» Replies: 2
» Views: 44
Fun with Ray Casting
Forum: a740g
Last Post: a740g
1 hour ago
» Replies: 7
» Views: 99
Cautionary tale of open, ...
Forum: General Discussion
Last Post: doppler
2 hours ago
» Replies: 3
» Views: 73
Extended KotD #23 and #24...
Forum: Keyword of the Day!
Last Post: SMcNeill
3 hours ago
» Replies: 0
» Views: 18
Big problem for me.
Forum: General Discussion
Last Post: JRace
8 hours ago
» Replies: 11
» Views: 173
Virtual Arrays
Forum: Site Suggestions
Last Post: hsiangch_ong
Today, 12:35 AM
» Replies: 8
» Views: 294
QBJS v0.9.0 - Release
Forum: QBJS, BAM, and Other BASICs
Last Post: hsiangch_ong
Today, 12:25 AM
» Replies: 17
» Views: 299
Very basic key mapping de...
Forum: SMcNeill
Last Post: SMcNeill
Yesterday, 11:18 PM
» Replies: 0
» Views: 30
1990's 3D Doom-Like Walls...
Forum: Programs
Last Post: a740g
Yesterday, 06:12 PM
» Replies: 10
» Views: 316
Editor WIP
Forum: bplus
Last Post: aadityap0901
Yesterday, 08:54 AM
» Replies: 12
» Views: 685

 
  BAM and QBJS: web browser (OFFLINE as well as ONLINE)
Posted by: CharlieJV - 11-10-2022, 08:05 PM - Forum: QBJS, BAM, and Other BASICs - Replies (6)

Maybe silly to mention, but just in case:

Yeah, very cool to get your QB64PE program on the web.

But also cool for sharing to keep locally a program that needs only a web browser to run and you aren't connected to the web.

Bookmark the local program in your browser favourites, and it makes for quick access to the thing.

Print this item

  BAM: How to embed your program in a web page
Posted by: CharlieJV - 11-10-2022, 06:33 PM - Forum: QBJS, BAM, and Other BASICs - Replies (7)

Create your program in BASIC Anywhere Machine.

Once you're happy with your development version, promote it to production (if you want).

Go to the Project menu, and click on Export.

In the Export Options window, click on either Program Deployment (DEV) or Program Deployment (PROD) (to create either a deployment file for the development version of your application or the production version of your application.

Take the HTML file and upload it to your web server/site.  If you just want to share that program as is, share the URL link to that HTML file.

To embed your in-the-one-HTML-file program in any website, do like I'm showing below for this program I have hosted on the web:

Code: (Select All)
<iframe src="https://basicanywheremachine.neocities.org/sample_programs/Rotating%204D%20cube.prod.run.html" style="width:500px;height:400px;"></iframe>

[Image: Screenshot-2022-11-10-2-57-37-PM.png]

Print this item

  SENDKEYS Win32 API Constants
Posted by: Pete - 11-10-2022, 06:15 PM - Forum: Utilities - Replies (15)

Hi Royal Subjects,

Ever get tired of looking up virtual key codes for things like using SENDKEYS in Win32 API? I sure do, and no matter how many Midol I pop, it doesn't seem to help. Did you know they now come in chewables? Umm, cherry, but I digress...

So while we went off topic to talk bloat, here's some bloat that's back on topic!

Code: (Select All)
DECLARE DYNAMIC LIBRARY "user32"
    SUB SENDKEYS ALIAS keybd_event (BYVAL bVk AS LONG, BYVAL bScan AS LONG, BYVAL dwFlags AS _UNSIGNED LONG, BYVAL dwExtraInfo AS _UNSIGNED LONG)
END DECLARE

CONST KEYEVENTF_KEYUP = &H2 ' Key up (Released).
CONST VK_LBUTTON = &H01 'Left mouse button
CONST VK_RBUTTON = &H02 'Right mouse button
CONST VK_CANCEL = &H03 'Control-break processing
CONST VK_MBUTTON = &H04 'Middle mouse button (three-button mouse)
CONST VK_XBUTTON1 = &H05 'X1 mouse button
CONST VK_XBUTTON2 = &H06 'X2 mouse button
CONST VK_BACK = &H08 'BACKSPACE key
CONST VK_TAB = &H09 'TAB key
CONST VK_CLEAR = &H0C 'CLEAR key
CONST VK_RETURN = &H0D 'ENTER key
CONST VK_SHIFT = &H10 'SHIFT key
CONST VK_CONTROL = &H11 'CTRL key
CONST VK_MENU = &H12 'ALT key
CONST VK_PAUSE = &H13 'PAUSE key
CONST VK_CAPITAL = &H14 'CAPS LOCK key
CONST VK_KANA = &H15 'IME Kana mode
CONST VK_HANGUEL = &H15 'IME Hanguel mode (maintained for compatibility; use VK_HANGUL)
CONST VK_HANGUL = &H15 'IME Hangul mode
CONST VK_IME_ON = &H16 'IME On
CONST VK_JUNJA = &H17 'IME Junja mode
CONST VK_FINAL = &H18 'IME final mode
CONST VK_HANJA = &H19 'IME Hanja mode
CONST VK_KANJI = &H19 'IME Kanji mode
CONST VK_IME_OFF = &H1A 'IME Off
CONST VK_ESCAPE = &H1B 'ESC key
CONST VK_CONVERT = &H1C 'IME convert
CONST VK_NONCONVERT = &H1D 'IME nonconvert
CONST VK_ACCEPT = &H1E 'IME accept
CONST VK_MODECHANGE = &H1F 'IME mode change request
CONST VK_SPACE = &H20 'SPACEBAR
CONST VK_PRIOR = &H21 'PAGE UP key
CONST VK_NEXT = &H22 'PAGE DOWN key
CONST VK_END = &H23 'END key
CONST VK_HOME = &H24 'HOME key
CONST VK_LEFT = &H25 'LEFT ARROW key
CONST VK_UP = &H26 'UP ARROW key
CONST VK_RIGHT = &H27 'RIGHT ARROW key
CONST VK_DOWN = &H28 'DOWN ARROW key
CONST VK_SELECT = &H29 'SELECT key
CONST VK_PRINT = &H2A 'PRINT key
CONST VK_EXECUTE = &H2B 'EXECUTE key
CONST VK_SNAPSHOT = &H2C 'PRINT SCREEN key
CONST VK_INSERT = &H2D 'INS key
CONST VK_DELETE = &H2E 'DEL key
CONST VK_HELP = &H2F 'HELP key
CONST VK_LWIN = &H5B 'Left Windows key (Natural keyboard)
CONST VK_RWIN = &H5C 'Right Windows key (Natural keyboard)
CONST VK_APPS = &H5D 'Applications key (Natural keyboard)
CONST VK_SLEEP = &H5F 'Computer Sleep key
CONST VK_NUMPAD0 = &H60 'Numeric keypad 0 key
CONST VK_NUMPAD1 = &H61 'Numeric keypad 1 key
CONST VK_NUMPAD2 = &H62 'Numeric keypad 2 key
CONST VK_NUMPAD3 = &H63 'Numeric keypad 3 key
CONST VK_NUMPAD4 = &H64 'Numeric keypad 4 key
CONST VK_NUMPAD5 = &H65 'Numeric keypad 5 key
CONST VK_NUMPAD6 = &H66 'Numeric keypad 6 key
CONST VK_NUMPAD7 = &H67 'Numeric keypad 7 key
CONST VK_NUMPAD8 = &H68 'Numeric keypad 8 key
CONST VK_NUMPAD9 = &H69 'Numeric keypad 9 key
CONST VK_MULTIPLY = &H6A 'Multiply key
CONST VK_ADD = &H6B 'Add key
CONST VK_SEPARATOR = &H6C 'Separator key
CONST VK_SUBTRACT = &H6D 'Subtract key
CONST VK_DECIMAL = &H6E 'Decimal key
CONST VK_DIVIDE = &H6F 'Divide key
CONST VK_F1 = &H70 'F1 key
CONST VK_F2 = &H71 'F2 key
CONST VK_F3 = &H72 'F3 key
CONST VK_F4 = &H73 'F4 key
CONST VK_F5 = &H74 'F5 key
CONST VK_F6 = &H75 'F6 key
CONST VK_F7 = &H76 'F7 key
CONST VK_F8 = &H77 'F8 key
CONST VK_F9 = &H78 'F9 key
CONST VK_F10 = &H79 'F10 key
CONST VK_F11 = &H7A 'F11 key
CONST VK_F12 = &H7B 'F12 key
CONST VK_F13 = &H7C 'F13 key
CONST VK_F14 = &H7D 'F14 key
CONST VK_F15 = &H7E 'F15 key
CONST VK_F16 = &H7F 'F16 key
CONST VK_F17 = &H80 'F17 key
CONST VK_F18 = &H81 'F18 key
CONST VK_F19 = &H82 'F19 key
CONST VK_F20 = &H83 'F20 key
CONST VK_F21 = &H84 'F21 key
CONST VK_F22 = &H85 'F22 key
CONST VK_F23 = &H86 'F23 key
CONST VK_F24 = &H87 'F24 key
CONST VK_NUMLOCK = &H90 'NUM LOCK key
CONST VK_SCROLL = &H91 'SCROLL LOCK key
CONST VK_LSHIFT = &HA0 'Left SHIFT key
CONST VK_RSHIFT = &HA1 'Right SHIFT key
CONST VK_LCONTROL = &HA2 'Left CONTROL key
CONST VK_RCONTROL = &HA3 'Right CONTROL key
CONST VK_LMENU = &HA4 'Left ALT key
CONST VK_RMENU = &HA5 'Right ALT key
CONST VK_BROWSER_BACK = &HA6 'Browser Back key
CONST VK_BROWSER_FORWARD = &HA7 'Browser Forward key
CONST VK_BROWSER_REFRESH = &HA8 'Browser Refresh key
CONST VK_BROWSER_STOP = &HA9 'Browser Stop key
CONST VK_BROWSER_SEARCH = &HAA 'Browser Search key
CONST VK_BROWSER_FAVORITES = &HAB 'Browser Favorites key
CONST VK_BROWSER_HOME = &HAC 'Browser Start and Home key
CONST VK_VOLUME_MUTE = &HAD 'Volume Mute key
CONST VK_VOLUME_DOWN = &HAE 'Volume Down key
CONST VK_VOLUME_UP = &HAF 'Volume Up key
CONST VK_MEDIA_NEXT_TRACK = &HB0 'Next Track key
CONST VK_MEDIA_PREV_TRACK = &HB1 'Previous Track key
CONST VK_MEDIA_STOP = &HB2 'Stop Media key
CONST VK_MEDIA_PLAY_PAUSE = &HB3 'Play/Pause Media key
CONST VK_LAUNCH_MAIL = &HB4 'Start Mail key
CONST VK_LAUNCH_MEDIA_SELECT = &HB5 'Select Media key
CONST VK_LAUNCH_APP1 = &HB6 'Start Application 1 key
CONST VK_LAUNCH_APP2 = &HB7 'Start Application 2 key
CONST VK_OEM_1 = &HBA 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the ';:' key
CONST VK_OEM_PLUS = &HBB 'For any country/region, the '+' key
CONST VK_OEM_COMMA = &HBC 'For any country/region, the ',' key
CONST VK_OEM_MINUS = &HBD 'For any country/region, the '-' key
CONST VK_OEM_PERIOD = &HBE 'For any country/region, the '.' key
CONST VK_OEM_2 = &HBF 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '/?' key
CONST VK_OEM_3 = &HC0 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '`~' key
CONST VK_OEM_4 = &HDB 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '[{' key
CONST VK_OEM_5 = &HDC 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '\|' key
CONST VK_OEM_6 = &HDD 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the ']}' key
CONST VK_OEM_7 = &HDE 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the 'single-quote/double-quote' key
CONST VK_OEM_8 = &HDF 'Used for miscellaneous characters; it can vary by keyboard.
CONST VK_OEM_102 = &HE2 'The <> keys on the US standard keyboard, or the \\| key on the non-US 102-key keyboard
CONST VK_PROCESSKEY = &HE5 'IME PROCESS key
CONST VK_PACKET = &HE7 'Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT, SendInput, WM_KEYDOWN, and WM_KEYUP
CONST VK_ATTN = &HF6 'Attn key
CONST VK_CRSEL = &HF7 'CrSel key
CONST VK_EXSEL = &HF8 'ExSel key
CONST VK_EREOF = &HF9 'Erase EOF key
CONST VK_PLAY = &HFA 'Play key
CONST VK_ZOOM = &HFB 'Zoom key
CONST VK_NONAME = &HFC 'Reserved
CONST VK_PA1 = &HFD 'PA1 key
CONST VK_OEM_CLEAR = &HFE 'Clear key

REM Keyboard numbers and letters reference.
REM &H30 '0 key
REM &H31 '1 key
REM &H32 '2 key
REM &H33 '3 key
REM &H34 '4 key
REM &H35 '5 key
REM &H36 '6 key
REM &H37 '7 key
REM &H38 '8 key
REM &H39 '9 key
REM &H41 'A key
REM &H42 'B key
REM &H43 'C key
REM &H44 'D key
REM &H45 'E key
REM &H46 'F key
REM &H47 'G key
REM &H48 'H key
REM &H49 'I key
REM &H4A 'J key
REM &H4B 'K key
REM &H4C 'L key
REM &H4D 'M key
REM &H4E 'N key
REM &H4F 'O key
REM &H50 'P key
REM &H51 'Q key
REM &H52 'R key
REM &H53 'S key
REM &H54 'T key
REM &H55 'U key
REM &H56 'V key
REM &H57 'W key
REM &H58 'X key
REM &H59 'Y key
REM &H5A 'Z key

' Use Code (Block $IF/THEN REM statement hack.)
$IF  THEN
        SENDKEYS Constant, 0, 0, 0 'stant Value Description
        SENDKEYS Constant, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_LBUTTON, 0, 0, 0 'Left mouse button
        SENDKEYS VK_LBUTTON, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_RBUTTON, 0, 0, 0 'Right mouse button
        SENDKEYS VK_RBUTTON, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_CANCEL, 0, 0, 0 'Control-break processing
        SENDKEYS VK_CANCEL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_MBUTTON, 0, 0, 0 'Middle mouse button (three-button mouse)
        SENDKEYS VK_MBUTTON, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_XBUTTON1, 0, 0, 0 'X1 mouse button
        SENDKEYS VK_XBUTTON1, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_XBUTTON2, 0, 0, 0 'X2 mouse button
        SENDKEYS VK_XBUTTON2, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_BACK, 0, 0, 0 'BACKSPACE key
        SENDKEYS VK_BACK, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_TAB, 0, 0, 0 'TAB key
        SENDKEYS VK_TAB, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_CLEAR, 0, 0, 0 'CLEAR key
        SENDKEYS VK_CLEAR, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_RETURN, 0, 0, 0 'ENTER key
        SENDKEYS VK_RETURN, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_SHIFT, 0, 0, 0 'SHIFT key
        SENDKEYS VK_SHIFT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_CONTROL, 0, 0, 0 'CTRL key
        SENDKEYS VK_CONTROL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_MENU, 0, 0, 0 'ALT key
        SENDKEYS VK_MENU, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_PAUSE, 0, 0, 0 'PAUSE key
        SENDKEYS VK_PAUSE, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_CAPITAL, 0, 0, 0 'CAPS LOCK key
        SENDKEYS VK_CAPITAL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_KANA, 0, 0, 0 'IME Kana mode
        SENDKEYS VK_KANA, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_HANGUEL, 0, 0, 0 'IME Hanguel mode (maintained for compatibility; use VK_HANGUL)
        SENDKEYS VK_HANGUEL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_HANGUL, 0, 0, 0 'IME Hangul mode
        SENDKEYS VK_HANGUL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_IME_ON, 0, 0, 0 'IME On
        SENDKEYS VK_IME_ON, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_JUNJA, 0, 0, 0 'IME Junja mode
        SENDKEYS VK_JUNJA, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_FINAL, 0, 0, 0 'IME final mode
        SENDKEYS VK_FINAL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_HANJA, 0, 0, 0 'IME Hanja mode
        SENDKEYS VK_HANJA, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_KANJI, 0, 0, 0 'IME Kanji mode
        SENDKEYS VK_KANJI, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_IME_OFF, 0, 0, 0 'IME Off
        SENDKEYS VK_IME_OFF, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_ESCAPE, 0, 0, 0 'ESC key
        SENDKEYS VK_ESCAPE, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_CONVERT, 0, 0, 0 'IME convert
        SENDKEYS VK_CONVERT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NONCONVERT, 0, 0, 0 'IME nonconvert
        SENDKEYS VK_NONCONVERT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_ACCEPT, 0, 0, 0 'IME accept
        SENDKEYS VK_ACCEPT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_MODECHANGE, 0, 0, 0 'IME mode change request
        SENDKEYS VK_MODECHANGE, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_SPACE, 0, 0, 0 'SPACEBAR
        SENDKEYS VK_SPACE, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_PRIOR, 0, 0, 0 'PAGE UP key
        SENDKEYS VK_PRIOR, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NEXT, 0, 0, 0 'PAGE DOWN key
        SENDKEYS VK_NEXT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_END, 0, 0, 0 'END key
        SENDKEYS VK_END, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_HOME, 0, 0, 0 'HOME key
        SENDKEYS VK_HOME, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_LEFT, 0, 0, 0 'LEFT ARROW key
        SENDKEYS VK_LEFT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_UP, 0, 0, 0 'UP ARROW key
        SENDKEYS VK_UP, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_RIGHT, 0, 0, 0 'RIGHT ARROW key
        SENDKEYS VK_RIGHT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_DOWN, 0, 0, 0 'DOWN ARROW key
        SENDKEYS VK_DOWN, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_SELECT, 0, 0, 0 'SELECT key
        SENDKEYS VK_SELECT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_PRINT, 0, 0, 0 'PRINT key
        SENDKEYS VK_PRINT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_EXECUTE, 0, 0, 0 'EXECUTE key
        SENDKEYS VK_EXECUTE, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_SNAPSHOT, 0, 0, 0 'PRINT SCREEN key
        SENDKEYS VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_INSERT, 0, 0, 0 'INS key
        SENDKEYS VK_INSERT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_DELETE, 0, 0, 0 'DEL key
        SENDKEYS VK_DELETE, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_HELP, 0, 0, 0 'HELP key
        SENDKEYS VK_HELP, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_LWIN, 0, 0, 0 'Left Windows key (Natural keyboard)
        SENDKEYS VK_LWIN, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_RWIN, 0, 0, 0 'Right Windows key (Natural keyboard)
        SENDKEYS VK_RWIN, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_APPS, 0, 0, 0 'Applications key (Natural keyboard)
        SENDKEYS VK_APPS, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_SLEEP, 0, 0, 0 'Computer Sleep key
        SENDKEYS VK_SLEEP, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NUMPAD0, 0, 0, 0 'Numeric keypad 0 key
        SENDKEYS VK_NUMPAD0, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NUMPAD1, 0, 0, 0 'Numeric keypad 1 key
        SENDKEYS VK_NUMPAD1, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NUMPAD2, 0, 0, 0 'Numeric keypad 2 key
        SENDKEYS VK_NUMPAD2, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NUMPAD3, 0, 0, 0 'Numeric keypad 3 key
        SENDKEYS VK_NUMPAD3, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NUMPAD4, 0, 0, 0 'Numeric keypad 4 key
        SENDKEYS VK_NUMPAD4, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NUMPAD5, 0, 0, 0 'Numeric keypad 5 key
        SENDKEYS VK_NUMPAD5, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NUMPAD6, 0, 0, 0 'Numeric keypad 6 key
        SENDKEYS VK_NUMPAD6, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NUMPAD7, 0, 0, 0 'Numeric keypad 7 key
        SENDKEYS VK_NUMPAD7, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NUMPAD8, 0, 0, 0 'Numeric keypad 8 key
        SENDKEYS VK_NUMPAD8, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NUMPAD9, 0, 0, 0 'Numeric keypad 9 key
        SENDKEYS VK_NUMPAD9, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_MULTIPLY, 0, 0, 0 'Multiply key
        SENDKEYS VK_MULTIPLY, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_ADD, 0, 0, 0 'Add key
        SENDKEYS VK_ADD, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_SEPARATOR, 0, 0, 0 'Separator key
        SENDKEYS VK_SEPARATOR, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_SUBTRACT, 0, 0, 0 'Subtract key
        SENDKEYS VK_SUBTRACT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_DECIMAL, 0, 0, 0 'Decimal key
        SENDKEYS VK_DECIMAL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_DIVIDE, 0, 0, 0 'Divide key
        SENDKEYS VK_DIVIDE, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F1, 0, 0, 0 'F1 key
        SENDKEYS VK_F1, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F2, 0, 0, 0 'F2 key
        SENDKEYS VK_F2, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F3, 0, 0, 0 'F3 key
        SENDKEYS VK_F3, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F4, 0, 0, 0 'F4 key
        SENDKEYS VK_F4, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F5, 0, 0, 0 'F5 key
        SENDKEYS VK_F5, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F6, 0, 0, 0 'F6 key
        SENDKEYS VK_F6, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F7, 0, 0, 0 'F7 key
        SENDKEYS VK_F7, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F8, 0, 0, 0 'F8 key
        SENDKEYS VK_F8, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F9, 0, 0, 0 'F9 key
        SENDKEYS VK_F9, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F10, 0, 0, 0 'F10 key
        SENDKEYS VK_F10, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F11, 0, 0, 0 'F11 key
        SENDKEYS VK_F11, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F12, 0, 0, 0 'F12 key
        SENDKEYS VK_F12, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F13, 0, 0, 0 'F13 key
        SENDKEYS VK_F13, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F14, 0, 0, 0 'F14 key
        SENDKEYS VK_F14, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F15, 0, 0, 0 'F15 key
        SENDKEYS VK_F15, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F16, 0, 0, 0 'F16 key
        SENDKEYS VK_F16, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F17, 0, 0, 0 'F17 key
        SENDKEYS VK_F17, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F18, 0, 0, 0 'F18 key
        SENDKEYS VK_F18, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F19, 0, 0, 0 'F19 key
        SENDKEYS VK_F19, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F20, 0, 0, 0 'F20 key
        SENDKEYS VK_F20, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F21, 0, 0, 0 'F21 key
        SENDKEYS VK_F21, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F22, 0, 0, 0 'F22 key
        SENDKEYS VK_F22, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F23, 0, 0, 0 'F23 key
        SENDKEYS VK_F23, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F24, 0, 0, 0 'F24 key
        SENDKEYS VK_F24, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NUMLOCK, 0, 0, 0 'NUM LOCK key
        SENDKEYS VK_NUMLOCK, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_SCROLL, 0, 0, 0 'SCROLL LOCK key
        SENDKEYS VK_SCROLL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_LSHIFT, 0, 0, 0 'Left SHIFT key
        SENDKEYS VK_LSHIFT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_RSHIFT, 0, 0, 0 'Right SHIFT key
        SENDKEYS VK_RSHIFT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_LCONTROL, 0, 0, 0 'Left CONTROL key
        SENDKEYS VK_LCONTROL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_RCONTROL, 0, 0, 0 'Right CONTROL key
        SENDKEYS VK_RCONTROL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_LMENU, 0, 0, 0 'Left ALT key
        SENDKEYS VK_LMENU, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_RMENU, 0, 0, 0 'Right ALT key
        SENDKEYS VK_RMENU, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_BROWSER_BACK, 0, 0, 0 'Browser Back key
        SENDKEYS VK_BROWSER_BACK, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_BROWSER_FORWARD, 0, 0, 0 'Browser Forward key
        SENDKEYS VK_BROWSER_FORWARD, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_BROWSER_REFRESH, 0, 0, 0 'Browser Refresh key
        SENDKEYS VK_BROWSER_REFRESH, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_BROWSER_STOP, 0, 0, 0 'Browser Stop key
        SENDKEYS VK_BROWSER_STOP, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_BROWSER_SEARCH, 0, 0, 0 'Browser Search key
        SENDKEYS VK_BROWSER_SEARCH, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_BROWSER_FAVORITES, 0, 0, 0 'Browser Favorites key
        SENDKEYS VK_BROWSER_FAVORITES, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_BROWSER_HOME, 0, 0, 0 'Browser Start and Home key
        SENDKEYS VK_BROWSER_HOME, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_VOLUME_MUTE, 0, 0, 0 'Volume Mute key
        SENDKEYS VK_VOLUME_MUTE, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_VOLUME_DOWN, 0, 0, 0 'Volume Down key
        SENDKEYS VK_VOLUME_DOWN, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_VOLUME_UP, 0, 0, 0 'Volume Up key
        SENDKEYS VK_VOLUME_UP, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_MEDIA_NEXT_TRACK, 0, 0, 0 'Next Track key
        SENDKEYS VK_MEDIA_NEXT_TRACK, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_MEDIA_PREV_TRACK, 0, 0, 0 'Previous Track key
        SENDKEYS VK_MEDIA_PREV_TRACK, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_MEDIA_STOP, 0, 0, 0 'Stop Media key
        SENDKEYS VK_MEDIA_STOP, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_MEDIA_PLAY_PAUSE, 0, 0, 0 'Play/Pause Media key
        SENDKEYS VK_MEDIA_PLAY_PAUSE, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_LAUNCH_MAIL, 0, 0, 0 'Start Mail key
        SENDKEYS VK_LAUNCH_MAIL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_LAUNCH_MEDIA_SELECT, 0, 0, 0 'Select Media key
        SENDKEYS VK_LAUNCH_MEDIA_SELECT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_LAUNCH_APP1, 0, 0, 0 'Start Application 1 key
        SENDKEYS VK_LAUNCH_APP1, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_LAUNCH_APP2, 0, 0, 0 'Start Application 2 key
        SENDKEYS VK_LAUNCH_APP2, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_1, 0, 0, 0 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the ';:' key
        SENDKEYS VK_OEM_1, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_PLUS, 0, 0, 0 'For any country/region, the '+' key
        SENDKEYS VK_OEM_PLUS, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_COMMA, 0, 0, 0 'For any country/region, the ',' key
        SENDKEYS VK_OEM_COMMA, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_MINUS, 0, 0, 0 'For any country/region, the '-' key
        SENDKEYS VK_OEM_MINUS, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_PERIOD, 0, 0, 0 'For any country/region, the '.' key
        SENDKEYS VK_OEM_PERIOD, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_2, 0, 0, 0 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '/?' key
        SENDKEYS VK_OEM_2, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_3, 0, 0, 0 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '`~' key
        SENDKEYS VK_OEM_3, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_4, 0, 0, 0 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '[{' key
        SENDKEYS VK_OEM_4, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_5, 0, 0, 0 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '\|' key
        SENDKEYS VK_OEM_5, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_6, 0, 0, 0 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the ']}' key
        SENDKEYS VK_OEM_6, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_7, 0, 0, 0 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the 'single-quote/double-quote' key
        SENDKEYS VK_OEM_7, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_8, 0, 0, 0 'Used for miscellaneous characters; it can vary by keyboard.
        SENDKEYS VK_OEM_8, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_102, 0, 0, 0 'The <> keys on the US standard keyboard, or the \\| key on the non-US 102-key keyboard
        SENDKEYS VK_OEM_102, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_PROCESSKEY, 0, 0, 0 'IME PROCESS key
        SENDKEYS VK_PROCESSKEY, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_PACKET, 0, 0, 0 'Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT, SendInput, WM_KEYDOWN, and WM_KEYUP
        SENDKEYS VK_PACKET, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_ATTN, 0, 0, 0 'Attn key
        SENDKEYS VK_ATTN, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_CRSEL, 0, 0, 0 'CrSel key
        SENDKEYS VK_CRSEL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_EXSEL, 0, 0, 0 'ExSel key
        SENDKEYS VK_EXSEL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_EREOF, 0, 0, 0 'Erase EOF key
        SENDKEYS VK_EREOF, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_PLAY, 0, 0, 0 'Play key
        SENDKEYS VK_PLAY, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_ZOOM, 0, 0, 0 'Zoom key
        SENDKEYS VK_ZOOM, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NONAME, 0, 0, 0 'Reserved
        SENDKEYS VK_NONAME, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_PA1, 0, 0, 0 'PA1 key
        SENDKEYS VK_PA1, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_CLEAR, 0, 0, 0 'Clear key
        SENDKEYS VK_OEM_CLEAR, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H30, 0, 0, 0 '0 key
        SENDKEYS &H30, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H31, 0, 0, 0 '1 key
        SENDKEYS &H31, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H32, 0, 0, 0 '2 key
        SENDKEYS &H32, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H33, 0, 0, 0 '3 key
        SENDKEYS &H33, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H34, 0, 0, 0 '4 key
        SENDKEYS &H34, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H35, 0, 0, 0 '5 key
        SENDKEYS &H35, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H36, 0, 0, 0 '6 key
        SENDKEYS &H36, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H37, 0, 0, 0 '7 key
        SENDKEYS &H37, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H38, 0, 0, 0 '8 key
        SENDKEYS &H38, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H39, 0, 0, 0 '9 key
        SENDKEYS &H39, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H41, 0, 0, 0 'A key
        SENDKEYS &H41, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H42, 0, 0, 0 'B key
        SENDKEYS &H42, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H43, 0, 0, 0 'C key
        SENDKEYS &H43, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H44, 0, 0, 0 'D key
        SENDKEYS &H44, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H45, 0, 0, 0 'E key
        SENDKEYS &H45, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H46, 0, 0, 0 'F key
        SENDKEYS &H46, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H47, 0, 0, 0 'G key
        SENDKEYS &H47, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H48, 0, 0, 0 'H key
        SENDKEYS &H48, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H49, 0, 0, 0 'I key
        SENDKEYS &H49, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H4A, 0, 0, 0 'J key
        SENDKEYS &H4A, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H4B, 0, 0, 0 'K key
        SENDKEYS &H4B, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H4C, 0, 0, 0 'L key
        SENDKEYS &H4C, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H4D, 0, 0, 0 'M key
        SENDKEYS &H4D, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H4E, 0, 0, 0 'N key
        SENDKEYS &H4E, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H4F, 0, 0, 0 'O key
        SENDKEYS &H4F, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H50, 0, 0, 0 'P key
        SENDKEYS &H50, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H51, 0, 0, 0 'Q key
        SENDKEYS &H51, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H52, 0, 0, 0 'R key
        SENDKEYS &H52, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H53, 0, 0, 0 'S key
        SENDKEYS &H53, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H54, 0, 0, 0 'T key
        SENDKEYS &H54, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H55, 0, 0, 0 'U key
        SENDKEYS &H55, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H56, 0, 0, 0 'V key
        SENDKEYS &H56, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H57, 0, 0, 0 'W key
        SENDKEYS &H57, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H58, 0, 0, 0 'X key
        SENDKEYS &H58, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H59, 0, 0, 0 'Y key
        SENDKEYS &H59, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H5A, 0, 0, 0 'Z key
        SENDKEYS &H5A, 0, KEYEVENTF_KEYUP, 0
$END IF

Kidding aside, I hope to make availble snippets like this, eventually, in my Sam-Clip project at:

Sam-Clip: https://qb64phoenix.com/forum/showthread.php?tid=1042

Special thanks to Dav for the DECLARE LIBRARY header:

Pete (API Princess)
[Image: b6b7782ed5fa6b3493e346c22db729e4.jpg]

Print this item

  My Second Game
Posted by: Gadgetjack - 11-10-2022, 05:29 PM - Forum: Programs - Replies (3)

I remembered playing Apple Panic many years ago. It was based on the arcade Space Panic game. I think it was the very first platformer game to be made. I again "borrowed" a lot of sprites and ideas from the tutorial and created the first level of Mario Apple Panic. It plays a lot like the original game , dig a hole and the apples fall in. The space bar digs. Esc key quits. If you get hit about 3 times , game over. If you clear all 4 apples, you win and game over. It could use some more levels if I get time later , or someone here got really interested. I will include the game and all its parts in a zip, and a screen shot of the game. Again . play it , improve it. It is all open.



Attached Files Thumbnail(s)
   

.zip   Apple.zip (Size: 2.21 MB / Downloads: 45)
Print this item

  Pete's Front Nine
Posted by: dbox - 11-10-2022, 03:35 PM - Forum: QBJS, BAM, and Other BASICs - Replies (6)

Hey Pete, here's a little proof of concept for your golf score card project.  I didn't have your background image file so I just focused on the mechanics of what I think you are trying to achieve.

As you enter the scores the total field is updated automatically.  Clicking the Save Scores button will add the current set of scores to the saved score list.  This list will be saved to the browser's local storage as well as to a "scores.csv" file in the QBJS virtual file system.  You can access this in the Files tab of the Console.

Code: (Select All)
Import Dom From "lib/web/dom.bas"
Import Storage From "lib/web/storage.bas"

Dim Shared savedScores As String
Dim Shared scores(10) As Object

_Title "Pete's Front Nine"

' Load the saved scores from local browser storage
savedScores = Storage.Get("savedScores")
Print savedScores
RefreshSavedScores

' Create the containing div
Dim div: div = Dom.Create("div")
div.style.backgroundColor = "#ccc"
div.style.padding = "20px"

' Create the inputs
Dim i As Integer
For i = 1 To 10
    scores(i) = Dom.Create("input", div)
    scores(i).tabIndex = i
    scores(i).type = "number"
    scores(i).style.width = "40px"
    scores(i).style.marginRight = "2px"
    If i = 10 Then
        scores(i).disabled = true
    Else
        Dom.Event scores(i), "change", sub_UpdateScore
    End If
Next i

Dim btn As Object
Dom.Create "br", div
Dom.Create "br", div
btn = Dom.Create("button", div, "Save Scores")
Dom.Event btn, "click", sub_SaveScores

' Updates the total when one of the scores is changed
Sub UpdateScore
    Dim total As Integer
    Dim i As Integer
    For i = 1 To 9
        total = total + CInt(scores(i).value)
    Next i
    scores(10).value = total
End Sub

' Saves the scores when the button is clicked
Sub SaveScores
    If savedScores <> "" Then
        savedScores = savedScores + Chr$(10)
    End If
   
    savedScores = savedScores + Date$ + " " + Time$
    Dim i As Integer
    For i = 1 To 10
        savedScores = savedScores + ", " + scores(i).value
        scores(i).value = ""
    Next i
   
    ' Save the scores to the browser's local storage
    Storage.Set "savedScores", savedScores
   
    ' Save the scores to the QBJS virtual file system
    Open "scores.csv" For Output As #1
    Print #1, savedScores
    Close #1

    RefreshSavedScores
End Sub

' Refreshes the saved score display
' Using the main QB screen for testing
Sub RefreshSavedScores
    Cls
    Print "Saved Scores"
    Print "--------------------------------------------------------"
    Print savedScores
End Sub

View in QBJS

Print this item

  DAY 005: ERDEV$
Posted by: SMcNeill - 11-10-2022, 06:04 AM - Forum: Keyword of the Day! - Replies (1)

Umm...

Our first mystery command!  I honestly have no idea what it is, where it came from, who added it to the keyword list or in the IDE, or what the heck it's supposed to do for us.  Checking the wiki, I found no entry for it..

Our word of the day is based off the syntax highlighter in the IDE, and for some reason there's both an ERDEV and a ERDEV$ which get highlighted as a keyword.

Anyone with any idea of what this is, where it comes from, and when/how we'd make use of it, kindly feel free to speak up on it.  As it is, I'm afraid that this time even the mighty Steve has to hang his head in shame -- I have no idea what the heck this beast is!!

Code: (Select All)
Print erdev$

Print erdev

The above works.  I don't see where it does anything but print a blank line and then a zero, but it *does* highlight both of those as keywords.

Let's see who can solve the mystery of this one for us!

Print this item

  Scientific Notation
Posted by: james2464 - 11-10-2022, 04:27 AM - Forum: Help Me! - Replies (13)

I'm curious about why this shows up so often as the answer for a number that is nearly zero.

For example,

a = 1 / 256
Print a

(I get 3.90625E-03)

Is this just a matter of using an appropriate variable type?

Print this item

  For Pete -- Keeping a window topmost and active
Posted by: SMcNeill - 11-10-2022, 02:15 AM - Forum: Help Me! - Replies (3)

So this is what I've came up with, and it works...

Code: (Select All)
'public domain

Const SWP_NOSIZE = &H0001 'ignores cx and cy size parameters
Const SWP_NOMOVE = &H0002 'ignores x and y position parameters
Const SWP_NOZORDER = &H0004 'keeps z order and ignores hWndInsertAfter parameter
Const SWP_NOREDRAW = &H0008 'does not redraw window changes
Const SWP_NOACTIVATE = &H0010 'does not activate window
Const SWP_FRAMECHANGED = &H0020
Const SWP_SHOWWINDOW = &H0040
Const SWP_HIDEWINDOW = &H0080
Const SWP_NOCOPYBITS = &H0100
Const SWP_NOOWNERZORDER = &H0200
Const SWP_NOSENDCHANGING = &H0400
Const SWP_DRAWFRAME = SWP_FRAMECHANGED
Const SWP_NOREPOSITION = SWP_NOOWNERZORDER
Const SWP_DEFERERASE = &H2000
Const SWP_ASYNCWINDOWPOS = &H4000
Const HWND_TOP = 0 'window at top of z order no focus
Const HWND_BOTTOM = 1 'window at bottom of z order no focus
Const HWND_TOPMOST = -1 'window above all others no focus unless active
Const HWND_NOTOPMOST = -2 'window below active no focus

Declare Dynamic Library "user32"
    '    Function FindWindowA%& (ByVal lpClassName%&, Byval lpWindowName%&)
    Function SetWindowPos& (ByVal hWnd%&, Byval hWndInsertAfter%&, Byval X&, Byval Y&, Byval cx&, Byval cy&, Byval uFlags~&)
    Function GetForegroundWindow%&
    Function SetForegroundWindow%& (ByVal hwnd As _Offset) 'set foreground window process(focus)
End Declare

Declare Dynamic Library "kernel32"
    Function GetLastError~& ()
End Declare

Dim hWnd As _Offset





_Title "This Window will always be on Top" 'any title

_Delay .5 'delay allows user to click focus on other windows
hWnd = _WindowHandle 'FindWindowA(0, _OFFSET(t))
If 0 = SetWindowPos(hWnd, HWND_TOPMOST, 200, 200, 0, 0, SWP_NOSIZE Or SWP_NOACTIVATE) Then
    Print "SetWindowPos failed. 0x" + LCase$(Hex$(GetLastError))
End If



Do
    Cls
    x%& = GetForegroundWindow%& 'find currently focused process handle
    Locate 3, 1
    Print "Program handle:"; hWnd; "Focus handle:"; x%&
    If x%& <> hWnd Then
        Print "Not Active"
        junk%& = SetForegroundWindow(hWnd)
    Else
        Print "Active"
    End If
    _Limit 30
Loop Until _KeyDown(27)



Now, the problem that I'm having is that this works -- but it only works *ONCE*.   Start it up, click off to a different window, it jerks focus back to itself as expected.   Click to a different window again, and...   it detects it's not active, but it won't jerk focus back to itself like it's supposed to.

Any of you windows API gurus out there see something obvious that I'm missing here?  (@Spriggsy)  Why's this work once and then decide, "Nah!  I don't wanna do that again??"  Any ideas at all on this one would be appreciated.  Wink

Print this item

  BAM _Trees!
Posted by: James D Jarvis - 11-09-2022, 11:57 PM - Forum: Programs - No Replies

Just some digital doodling.  Generate a simple forest landscape of leafy trees.

Code: (Select All)
'BAM_Trees
'quick random leafy random trees
'why is it called BAM-Trees? Because the draw_leaves routine is a variant from a sample at:
'         https://sites.google.com/view/basicanywheremachine
'
'press any key to generate a new image
'press <esc> to quit
'
Randomize Timer
Screen _NewImage(1100, 600, 32)
_Title "BAM_Trees!"
Do
    Cls
    hrz = Int(Rnd * 30 + 120)
    Line (0, 0)-(_Width, hrz), _RGB32(Rnd * 10, Rnd * 10, Rnd * 200 + 40), BF
    Line (0, hrz)-(_Width, _Height), _RGB32(Rnd * 200 + 40, Rnd * 200 + 40, Rnd * 10), BF
    For r = 1 To 4
        treetopx = 10: treetopy = r * 120
        numtinrow = Int(Rnd * 13 + 6)
        For b = 1 To numtinrow
            treetopx = treetopx + Int(Rnd * 5 + 5) * (10 * 25 / numtinrow): treetopy = Int(Rnd * 100 + r * 100)
            draw_trunk treetopx, treetopy
            draw_leaves treetopx, treetopy, Int(Rnd * 20) + 20, Rnd * 5 + 6, Int(Rnd * 360)
        Next b
    Next r
    Do
        _Limit 30
        kk$ = InKey$
    Loop Until kk$ <> ""
Loop Until kk$ = Chr$(27)



Sub draw_leaves (x%, y%, length%, line_count%, start_angle%)

    angle_increment% = 360 / line_count%
    my_color~& = _RGB32(40, Rnd * (256 - (y% / 6)), 60)
    For i% = 0 To (line_count% - 1)
        _Limit 40000
        Draw "bm " + Str$(x%) + "," + Str$(y%)
        Draw "C" + Str$(my_color~&) + " TA" + Str$(start_angle% + angle_increment% * i%) + " r" + Str$(length%)
        If length% > (Rnd * 11.4 + 3.5) Then
            Call draw_leaves(Point(0), Point(1), Int(length% / (1.125 + Rnd * 2.25)), line_count%, start_angle% + angle_increment% * (i% + 1))
        End If
    Next
End Sub
Sub draw_trunk (tx, ty)
    tw = Int(Rnd * 25 + 10)
    For t = 1 To tw
        trunk~& = _RGB32(Rnd * 50 + 20, Rnd * 50 + 50, Rnd * 20)
        Line (tx, ty)-(tx + Rnd * (8 * tw / 30), ty + 60 + Rnd * 30), trunk~&, BF
    Next t
End Sub

Print this item

  What are your best and worst coding traits?
Posted by: Pete - 11-09-2022, 06:29 PM - Forum: General Discussion - Replies (11)

Well let's say maybe list 3 to 5, or a few, whatever. No order needed, unless ranking is one of your positive traits!

For me, it would be tenacity, interest in the projects I'm involved with, drive, mechanics, and somewhat creativity. What I consider to be  negative traits would be typing speed, about half that of a pro, being impatient with documentation, organizing works in folders, variable naming, and consistency (I like to do projects differently.) One that I used to love but have been missing over the years, the ability to keep a program straight in my head, as well as on the screen. That was cool.

Pete

Print this item