What bone-head thing did I miss this time? - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10) +---- Thread: What bone-head thing did I miss this time? (/showthread.php?tid=1012) Pages:
1
2
|
What bone-head thing did I miss this time? - Pete - 10-28-2022 Windows API for set window active should register a number in this little test routine, but it doesn't. I threw in a couple of other API functions that register just fine. Anyone know what I missed here? Code: (Select All) DECLARE DYNAMIC LIBRARY "user32" Pete RE: What bone-head thing did I miss this time? - bplus - 10-28-2022 Would a program that sets the active window have to be active itself to work? Looks sorta like this program can only call itself and that only if it is saved under title$ name (with an .exe) and I recall you have to add an end of string character for Windows calls. A couple of things to try until Spriggsy weighs in... RE: What bone-head thing did I miss this time? - mnrvovrfc - 10-28-2022 @Pete you should put an "INKEY" test or something like that to get away from the first loop which has the potential to be a CPU-locking endless loop. Or it might just quit after one iteration so it's worthless... IDK: https://qb64phoenix.com/qb64wiki/index.php/WINDOWHANDLE https://qb64phoenix.com/qb64wiki/index.php/WINDOWHASFOCUS RE: What bone-head thing did I miss this time? - Pete - 10-28-2022 I've used _WINDOWHANDLE before. It's basically the same as the old-school method I applied using: FindWindowA The INKEY$ is just a =there so anyone who tests it and sees the SetActiveWindow just won't register can easily quit using the keyboard. At this stage I don't expect the SetActiveWindow to be the complete answer, but if I coded it wrong, I can't even test out its behavior. Oh, I've seen that add CHR$(0) to the title, but I've never had a need to do so. This one gets the handle just fine, with or without it. Ultimately what I'm looking for is a better way than the hack I created to activate alternate opened messenger windows, here: https://qb64phoenix.com/forum/showthread.php?tid=1005&pid=8671#pid8671 Pete RE: What bone-head thing did I miss this time? - SpriggsySpriggs - 10-29-2022 This is a very dirty way of doing this but here, @Pete : Code: (Select All) Declare Dynamic Library "user32" Basically, I'm checking if the window has focus. If it doesn't, I'm forcing the focus back to the window by minimizing it with ScreenIcon and then maximizing it with ShowWindow. The stuff like SetActiveWindow, SetForegroundWindow, etc are all buggy as hell and don't work half the time and no one ever has a good explanation why. Hope this helps you at least a little, Pete. RE: What bone-head thing did I miss this time? - Pete - 10-29-2022 Hi Spriggsy, Wow, when you and I both have to develop a hack to get a desired Windows API result, I'd say we reached the end of the trail. After all, you are the API King and I swear to God Steve, if I log in tomorrow and find API Queen in my profile, we are gonna have words! I'll have a look at the icon one, new to me, but my hack was to also to min and restore each window, as that does force focus. https://qb64phoenix.com/forum/showthread.php?tid=1005&pid=8671#pid8671 In other news, Paul Pelosi apparently still didn't learn his lesson from his last drunk driving incident, as I hear he's still getting hammered! Pete RE: What bone-head thing did I miss this time? - SpriggsySpriggs - 10-29-2022 (10-29-2022, 01:41 AM)Pete Wrote: Hi Spriggsy, Ha! I didn't even really read the other post so I had no idea that you were doing a minimize/maximize thing! Great minds think alike, eh? RE: What bone-head thing did I miss this time? - bplus - 10-29-2022 (10-29-2022, 01:28 AM)Spriggsy Wrote: This is a very dirty way of doing this but here, @Pete : This is pretty cool. I remember somewhere, sometime we discussed how to keep a Window on top but danged if I could find the code. This works, is it the same thing? RE: What bone-head thing did I miss this time? - Pete - 10-29-2022 I've made three different ways to handle that. One of the simplest... Code: (Select All) CONST HWND_TOPMOST%& = -1 Pete API Queen... Dammit Steve! RE: What bone-head thing did I miss this time? - bplus - 10-29-2022 (10-29-2022, 02:06 AM)Pete Wrote: I've made three different ways to handle that. One of the simplest... OK now I've got two of 'em to lose! thanks! |