Main > Main Forum

MaLa FE. Under new management.

Pages: << < (4/5) > >>

loadman:


--- Quote from: lettuce on May 24, 2008, 08:11:10 am ---When will we see an update then?  ;D

--- End quote ---

Sooner than if Swindus did not pass the code onto me   ;D  :laugh2:

I can't answer that. I just am spending my spare time getting me head around his code. I don't want to create a batch of new bugs by a 'premature release   ;)

Please be patient.  :P

TheShanMan:


--- Quote from: loadman on May 24, 2008, 02:34:17 am ---Cool, Cam I post that on the malafe.net site until I get it fixed?

--- End quote ---

Yes. And I neglected to mention that the C runtime files (the non .plugin files) need to go in the mala directory itself. If you put them in the plugin directory then the plugin won't find them - windows looks for them in the directory of the exe, not of the .plugin file.


--- Quote from: headkaze on May 24, 2008, 07:35:38 am ---TheShanMan: I'm curious how does that plugin work? Are you using GetForegroundWindow and then bringing MaLa to the foreground if it returns NULL?

--- End quote ---

Exactly. Since loadman is going to make this publicly available and you inquired about it, I'll quote what I said to loadman via PM:


--- Quote ---It starts a thread which has a hidden window, and a timer fires every 1/4 second. In the timer handler it calls the windows API GetForegroundWindow. If the window is NULL (no window has focus), then it tries to set focus back to MaLa.
--- End quote ---

It pretty much logs everything it finds to a log file, since the original intention was simply to find the cause of the focus problem (I thought some background app was taking focus). So it might be helpful for people to isolate the cause of their focus problems (be it MaLa or some background app) if you periodically check your log file for cases where some other application has the focus, or focus is NULL.

Some notes regarding what is seen in the log file:

* Of course, MaLa shouldn't always have focus - focus will shift to mame and may even legitimately be NULL sometimes (not sure on that one - perhaps this happens before MaLa gets focus back), so just because something other than MaLa has focus doesn't automatically mean there's a problem.
* This only checks focus every 1/4 second, so you can't assume that this is a perfect record of focus changes. It could certainly miss focus changes. The intention was to catch the problem where focus is stuck somewhere that it shouldn't be, and every 1/4 second is plenty for that. Plus I wanted to keep this plugin from consuming any more cpu cycles than necessary.
* If you see focus shifting to some background app, I'm not sure you can blame MaLa, or expect MaLa to be "fixed" for that. You probably need to look into getting rid of the background app.

headkaze:


--- Quote from: TheShanMan on May 24, 2008, 12:30:21 pm ---Exactly. Since loadman is going to make this publicly available and you inquired about it, I'll quote what I said to loadman via PM:
--- End quote ---

I thought it was a good idea so I wrote a little program to do the same, it might help me figure out why a few people are having focus problems with CPWizard. Perhaps I need to do something like your plugin in CPWizard to check if it's foreground and force it to be when it should.

BTW I read this about GetForegroundWindow on MSDN


--- Quote ---The return value is a handle to the foreground window. The foreground window can be NULL in certain circumstances, such as when a window is losing activation.
--- End quote ---

I notice it will return NULL when changing focus between applications including when switching between CPWizard and Mame.

Anyway thanks for the info, and we better give this thread back to loadman!

TheShanMan:


--- Quote from: headkaze on May 24, 2008, 12:39:45 pm ---BTW I read this about GetForegroundWindow on MSDN


--- Quote ---The return value is a handle to the foreground window. The foreground window can be NULL in certain circumstances, such as when a window is losing activation.
--- End quote ---

I notice it will return NULL when changing focus between applications including when switching between CPWizard and Mame.

--- End quote ---

Yep, I knew about that, and that's why I said focus can sometimes be NULL legitimately. I assume that's why sometimes the SetForegroundWindow call fails even though the foreground window is reported to be NULL (I log whether the call succeeds or fails).

Feel free to PM me if there's anything I can do to help you incorporate this kind of focus enforcement in CPWizard, or if you learn something about it that might be beneficial to my plugin.

loadman:


--- Quote from: TheShanMan on May 24, 2008, 12:30:21 pm ---
--- Quote from: loadman on May 24, 2008, 02:34:17 am ---Cool, Cam I post that on the malafe.net site until I get it fixed?

--- End quote ---

Yes. And I neglected to mention that the C runtime files (the non .plugin files) need to go in the mala directory itself. If you put them in the plugin directory then the plugin won't find them - windows looks for them in the directory of the exe, not of the .plugin file.


--- End quote ---

Cool I worked that out the hard way  ;)

You Plug-in is now on the site.

http://malafe.net/index.php?page=plugins#malafocuslogger

Pages: << < (4/5) > >>

Go to full version