Main > Software Forum
MameWah Technical Thread (for MinWah)
Minwah:
--- Quote from: headkaze on November 02, 2005, 10:15:15 am ---I think so, but without looking at your current code I can't say what the differences are exactly. If you use Sub Main then I wonder how you create your window.. are you using a form? If you are, I am totally convinced that my method is better. Without experience in C it's hard to explain the advantages other than saying it's more API friendlier. The point is my application is meant to work like a normal C program would but using VB. I know the advantages of using VB too since I've programed for a a few years, but C is the way to go. I'm not about to write my own C front end though because I don't have the time, yours is (almost) perfect for my needs anyways. Hope you eventually see my reasons for the way I do things.
--- End quote ---
Yes I am just using Sub Main to show a form. I'm sure you method has it's advantages but since I don't have any real problems I'll leave it for now. In any case I plan to use DirectDraw eventually which probably means I'll be doing some re-writing in this area anyhow.
--- Quote ---Your saying that my application continues after launching the shortcut? Of course it does, so does MameWah. Are you using WaitForSingleObject(hProcess, INFINITE)? Otherwise how do you wait in the background for the process launched to end? Mine does the same except it waits a while, processes the message system, checks if the process has ended and loops. Its basically the same, and designed to take very little processor time.
--- End quote ---
Mamewah doesn't launch shortcuts directly, for this reason. When launching .exe's yes I use WaitForSingleObject IIRC. In your example after launching a shortcut execution continues immediately - this is the point I am making, I want to avoid this which is why I don't launch shortcuts, rather determine the target .exe and launch that. For the most part, this is suffiient anyway except for a few cases (one of the other threads here highlights a good example of this).
--- Quote ---Well, I think your method should definately not be removed, rather, my method added as an option. Removing the cursor is ok for some apps, moving the cursor would be a better option for some apps I believe. In that case the cursor is still available just out of view (if you grab control of the mouse or trackball, there you go the cursor is there.
--- End quote ---
Using the {cursor filename} flag you can specify a cursor to use should the app being launched require one, so you already have the best of both worlds.
--- Quote ---Of course you can use the code..
--- End quote ---
Cool, just saves me sourcing it from elsewhere...and yes we all pinch a bit of code, no point re-inventing the wheel afterall ;)
--- Quote ---Well, Mame is a command line application, therefore how do you get the handle to the window? You can't. But I havn't looked at this specifically, perhaps the command prompt window can be accessed and the keys send to that. You know what I'm thinking arn't you? "remove that damn warning message to type ok or move the joystick" hehe, its possible I believe.
--- End quote ---
Yeah I tried for a long time to achieve this (got the idea from ArcadeOS) but was never able to do it...I came to the conclusion it must be pretty hard! I'll be very impressed if you can figure it out!
--- Quote ---Thanks for checking out my ideas, I hope they may help in some way.
Keep in touch, I think we can work together on some of this :)
--- End quote ---
Sure, thanks for your interest. BTW sorry if you feel I have shunned any of your ideas...it's just that I spent a lot of time on it over the years and the launch stuff in particular I am quite reluctant to change since it works just about perfectly already imo. Why fix what's not broken I suppose is my thinking...
headkaze:
--- Quote ---Sure, thanks for your interest. BTW sorry if you feel I have shunned any of your ideas...it's just that I spent a lot of time on it over the years and the launch stuff in particular I am quite reluctant to change since it works just about perfectly already imo. Why fix what's not broken I suppose is my thinking...
--- End quote ---
np, well I guess I am a little dissapointed, but the thing is, if MameWah works the way I want, I'll be happy. Perhaps B8 does this, but mainly it's important that I can launch lnk's with full command line arguments. That way I can launch PC exe's, chankast using Chankast Launch etc. Plus I intend on writing mini apps for other stuff that requires specific stuff. This means command line parameters are a must, through shortcuts (hopefully). Expect a Mame Launcher from me soon that will send the ok etc. so if B8 can launch shortcuts with parameters I'll be happy.
I guess you can consider my code example for some later releases. The thing is, I was thinking it would be nice to put the code into the front end instead of launching wrapper apps. Hell, MameWah could do it all really.. send the keys, force the full screen, etc. Well it was a dream I guess :)
headkaze:
--- Quote ---Mamewah doesn't launch shortcuts directly, for this reason. When launching .exe's yes I use WaitForSingleObject IIRC. In your example after launching a shortcut execution continues immediately - this is the point I am making, I want to avoid this which is why I don't launch shortcuts, rather determine the target .exe and launch that. For the most part, this is suffiient anyway except for a few cases (one of the other threads here highlights a good example of this).
--- End quote ---
In my code I use WaitForSingleObject also, but I just process messages as well (I would say a better and safer way of running an app in the background). It's standard stuff in C programming, so there is no problem. You say "after launching a shortcut execution continues immediately", well it always will, whether you wait for it to exit or not. There is always processessing going on in MameWah until it exits, my loop is practically equal to waiting INFINITE, execpt it processes messages, like DoEvents, thats normal coding in C. Coding in C is always the "right way to code".
--- Quote ---Yeah I tried for a long time to achieve this (got the idea from ArcadeOS) but was never able to do it...I came to the conclusion it must be pretty hard! I'll be very impressed if you can figure it out!
--- End quote ---
Well if ArcadeOS can do it, so can we! For a start we can use an API Viewer to view what this program does exactly. The question is, where does it send the keys to? Well, obviously without a window we must send to the command prompt window (thats a guess).
Minwah:
--- Quote from: headkaze on November 02, 2005, 11:44:22 am ---In my code I use WaitForSingleObject also, but I just process messages as well (I would say a better and safer way of running an app in the background). It's standard stuff in C programming, so there is no problem. You say "after launching a shortcut execution continues immediately", well it always will, whether you wait for it to exit or not. There is always processessing going on in MameWah until it exits, my loop is practically equal to waiting INFINITE, execpt it processes messages, like DoEvents, thats normal coding in C. Coding in C is always the "right way to code".
--- End quote ---
In simplest terms, what I'm getting at is that if you add another line of code after 'StartProcess'/'StartShortcut' to say display a messagebox...for Method '1' the message box will not appear until you close notepad. For Method '2' the messagebox appears before you close notepad.
From what you say I'm sure there is a way around it. FWIW Mamewah processes messages too, I added this in order to deal with powering the pc down while emulators/apps are running.
--- Quote ---Well if ArcadeOS can do it, so can we! For a start we can use an API Viewer to view what this program does exactly. The question is, where does it send the keys to? Well, obviously without a window we must send to the command prompt window (thats a guess).
--- End quote ---
ArcadeOS is a dos program though, and probably does it at a lower level than is possible with Windows (I guess).
headkaze:
--- Quote ---In simplest terms, what I'm getting at is that if you add another line of code after 'StartProcess'/'StartShortcut' to say display a messagebox...for Method '1' the message box will not appear until you close notepad. For Method '2' the messagebox appears before you close notepad.
--- End quote ---
Thats strange, they always appear first for me. But anyways, the messagebox isn't supposed to be there anyway, its just to explain whats happening. The messagebox's are always causing wierd and wonderful effects... thats why in a production release they would be removed.
--- Quote ---ArcadeOS is a dos program though, and probably does it at a lower level than is possible with Windows (I guess).
--- End quote ---
If they can do it in DOS we can do it in windows :) Both can work on the same level, just that Windows now restricts access per user access level. So no problem, if they can do it so can we :)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version