Idea similar to _exit - Printable Version +- QB64 Phoenix Edition (https://staging.qb64phoenix.com) +-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3) +---- Forum: Help Me! (https://staging.qb64phoenix.com/forumdisplay.php?fid=10) +---- Thread: Idea similar to _exit (/showthread.php?tid=921) Pages:
1
2
|
Idea similar to _exit - eoredson - 09-26-2022 Hi, I had an idea.. Since _exit traps Control-Break which is int x1B then why not trap _print with PrintScreen which is int x05 Erik. RE: Idea similar to _exit - mnrvovrfc - 09-26-2022 I made a quick look at "libqb.cpp", toward the bottom, at the "big fat main loop". It doesn't look like "_EXIT" is being handled by ancient interrupts. What you're requesting might have to be programmed like that for "_EXIT" but check for a different keystroke combination. Why do you want to trap "Print Screen" key? Oh OK you must actually have a printer and it's annoying to press it. Or it's annoying that Windows interferes when it guesses the user must have wanted to print a text file via Notepad. You have to remember that any trace of "CALL INTERRUPT" is emulated by QB64PE only with the first three or so mouse functions, because those calls were quite common in programs written for QBasic, especially those by "TheBob". Cannot emulate BIOS or MS-DOS like we could do in M$QB or QBasic many years ago. Therefore, any emulation of ancient interrupts have to be implemented. Oh no somebody is going to request the "BSOD" one or the disk sector one... just ignore them devs. The same thing goes on with the ancient input and output ports. Because so many QB/QBasic programs played around with EGA/VGA bit planes, the ports were emulated at that end. One more thing to emulate might have had to do with the keyboard. Otherwise Windows Vista and later was going to make it a pain installing a DLL only to be able to use "INP()" and "OUT" and "WAIT" in a QB program away from 16-bit. RE: Idea similar to _exit - Pete - 09-26-2022 15 innings? How can you stand sitting through 15 innings of baseball? Now if you will excuse me, I have to watch golf. Pete RE: Idea similar to _exit - SpriggsySpriggs - 09-26-2022 (09-26-2022, 04:46 AM)mnrvovrfc Wrote: I made a quick look at "libqb.cpp", toward the bottom, at the "big fat main loop". It doesn't look like "_EXIT" is being handled by ancient interrupts. What you're requesting might have to be programmed like that for "_EXIT" but check for a different keystroke combination. Why do you want to trap "Print Screen" key? Oh OK you must actually have a printer and it's annoying to press it. Or it's annoying that Windows interferes when it guesses the user must have wanted to print a text file via Notepad. I'm very confused as to why you are bringing up mouse interrupts and such. I think all he's saying is that he wants a way to catch if someone has pressed "PrintScreen". Very easy to do, as far as I can tell. Not easy to make a new keyword to do it (for me, at least) but definitely easy to do it with Win32 API in a program. It's the "VK_SNAPSHOT" key (0x2C). I'm not sure why he said it was 0x05. That's "VK_XBUTTON1". GetAsyncKeyState (MSDN page for the function used to check for key presses from the Virtual Key Codes page) RE: Idea similar to _exit - mnrvovrfc - 09-26-2022 (09-26-2022, 07:13 PM)Spriggsy Wrote: I'm very confused as to why you are bringing up mouse interrupts and such.I based my answer on the OP saying which ancient interrupt did this or that, but that's all. There shouldn't have been any confusion. Anyway, you could explain to @eoredson better than I did what is happening. The OP also said "INT 0x05" which is something you've obviously missed. It's not a virtual keyboard code. It was a BIOS interrupt. https://en.wikipedia.org/wiki/BIOS_interrupt_call RE: Idea similar to _exit - SpriggsySpriggs - 09-26-2022 Either way, the pages I referenced will provide what he's looking for since he's trying to catch those events. He's familiar with Win32. RE: Idea similar to _exit - eoredson - 10-10-2022 The assembly code I am using to trap x1b and x05 is this: Code: (Select All) ;Traps and ignores Print-Screen and Control-Break. v1.1a PD 2020. RE: Idea similar to _exit - a740g - 10-10-2022 (10-10-2022, 03:42 AM)eoredson Wrote: The assembly code I am using to trap x1b and x05 is this: This looks like real mode x86 ASM. Brings back a lot of old memories. None of this stuff is going to work with QB64 though because QB64 works under protected mode operating systems that does not allow you to use interrupts like we could with DOS. You'll need to use the appropriate OS APIs to achieve what you are trying to do. I would suggest looking at what @Spriggsy said if you are writing your code for Windows. I am quite certain that there are relevant APIs for Linux and macOS too. However, I am not too familiar with those OSes. RE: Idea similar to _exit - eoredson - 10-11-2022 What I found interesting is where iret exits after a Control-Break bios interrupt. then in that area of code either a subroutine could be called or a variable such as _exit could be set. My reasoning is thus: If inline assembly could be injected into 'C' and inline 'C' could be injected (such as Mem.h) into QB64, then why not inject assembly into QB64!? (I know it doesn't work like that but it is a passing idea).. RE: Idea similar to _exit - mnrvovrfc - 10-12-2022 (10-11-2022, 04:29 AM)eoredson Wrote: My reasoning is thus:It might be darned confusing, but you could employ "dot-h" files to include into QB64 code. The "dot-h" file could have something like is talked about in section 6.47 of "info gcc" manual: "How to use inline assembly language in C code". https://gcc.gnu.org/onlinedocs/gcc/Using-Assembly-Language-with-C.html It would have to be tested because QB64PE counts on "g++" not on the C compiler of "gcc". Also @eoredson, it might not be supported by "MinGW" which comes with QB64 v2.0.2 32-bit which you have. |