Main > Software Forum

MameWah Technical Thread (for MinWah)

<< < (4/4)

Minwah:

--- Quote from: headkaze on November 03, 2005, 09:39:32 am ---With the StartProcess() function using CreateProcess() API (which returns a handle to the process),  I then use enumeration of all windows and use GetWindowThreadProcessId() API function for checking which one matches the hprocess. So that way is pretty much automatic. That will work fine for most .exe's and most emulators.

--- End quote ---

This is pretty much what Mamewah does currently, for launching exe's.


--- Quote ---With the StartShortcut() function using ShellExecuteEx is quite different. I'm pretty sure it's not possible to launch a .lnk and get the handle without using FindWindow. LaunchShortcut("notepad.exe"...) will work using a "trick", but not shortcuts. I was thinking the window title could be placed in the ini files by the user manually. I think it's the only way (for .lnk's at least). Since in general one ini file is for one emulator, the titlebar will remain the same. If the title bar changes for each game eg. "Chankast - Game1", "Chankast - Game 2" etc.

--- End quote ---

Thing is there is never really any need to use a shortcut for emulators, exe's do just fine.  The only reason to use shortcuts is for PC apps/games, which will obviously all have different titles.


--- Quote --- I can modify the code to search out just "Chankast" instead of a full string using enumeration. The current example uses FindWindow() which only works with an exact match of the window title. StartShorcut() will only be needed for the apps that need to launch from a lnk (for example Chankast Launch works well launched from a shortcut with command line parameters)

--- End quote ---

The thing is the titlebar can say anything, not neccessarily including anything useful like the exename.  So for this reason the above isn't really a 100% reliable method, is it?

headkaze:

--- Quote from: Minwah on November 03, 2005, 10:02:20 am ---The thing is the titlebar can say anything, not neccessarily including anything useful like the exename.
--- End quote ---

Minwah:

--- Quote from: headkaze on November 24, 2005, 06:58:12 am ---I found a reasonable solution to launching a shortcut and getting it's window handle. Basically I read in the shortcut's target and then use that to launch it as usual.

--- End quote ---

This is what I already do.  The problem is that the target does not include any additional switches or whatever, which is why you need to add them into the _commandline parameter.

Navigation

[0] Message Index

[*] Previous page

Go to full version