Forcefully Embedded Applications
Community Forums/Showcase/Forcefully Embedded Applications
| ||
I felt like going back into my embedded applications stuff, and I made this rather useful code to demonstrate its usefulness. It enables you to embed any program into yours. I have coded it to only do Mozilla Firefox or Internet Explorer running www.blitzbasic.com (or any other page with the title "The Official Blitz Website"), but if you wanted to it wouldn't be too hard to make it work as you wanted using ExecFile and some command line stuff. This post, in fact, is written inside of the very Blitz app that I am showcasing. Because of the window Hierarchy here, Blitz3d is not stealing window events, which is what usually happens with such things. What does all this mean? With a second of time getting the class name for a web browser, you can embed it inside of Blitz in about 5 seconds, allowing for some rather attractive help windows, and other such nice features. You could even, for example, have the windows calculator right inside of your blitz program, or solitaire, or Pain (t). Now, also so you know, api_FindWindow does not search child windows. To search for the child windows of a window, you will need to change that function to api_FindWindowEx. This means that actually getting it inside of the actual web page content may need a little session with WinDowse. What I find exceptionally cool here is that, thanks to the win32 api, I now have full control over the appearance of the web browser window. You'll need User32.decls to run this. If you don't have it: http://www.blitzbasic.com/codearcs/codearcs.php?code=1179 Lastly, how to run this code: Have either Internet Explorer or Mozilla Firefox running, viewing BlitzBasic.com (or any other web site with the title "The Official Blitz Website"). Now, run the program, hit any key a few times (I recommend the space bar), and it's there! There's a bit of artifacting to clear up, but this is just a very basic demonstration. This also (sort of... not very well though yet) works in the opposite direction! I'll post Blitz in a web browser shortly, eventually followed by Blitz in a Java applet, which will be in this same thread (but I have no idea when that will be) |
| ||
Works great. Btw, how can you find the window class of certain program? |
| ||
There's a program called WinDowse that does that and more: http://www.greatis.com/delphicb/windowse/ I just modified it a bit, so that internet explorer is opened automatiically. now all you have to do is run the program. Which means: It works much better now :) Still a bit clumsy because it first requires that the browser be openned in a seperate window, but, on my computer at least, it's loaded into the Blitz window so quickly that most people would hardly realize it was ever out. For this example with ExecFile, I have removed the check for Firefox. The execFile thing actually does work with Firefox, but I have decided that IE is more compatible with the demo (and everybody has it). I have also made some obvious changes to the window style for IE, which is now resizeable. (It was only Firefox that messed up the resizing... I think it also stole my window close button event). |
| ||
Does not work for me like it should (or i think it should) When i start this ap a black window pops up (like every other blitzapp before graphics mode), and then internetexplorer pops up in another window, just like execfile. Not more not less. |
| ||
That's strange then... What web page is it showing? What version of Internet Explorer do you have? Put Print "Blah" Into the Repeat... Until loop (Line 111) and tell me if you get anything. (If it writes anything to the screen) This is what it should look like: ![]() |
| ||
see, THIS... i have a use for! >Write synth Front End in VB again >Write Engine in blitz. >Imbed VB IDE into Blitz using the above code :D coolies :D |
| ||
Careful with it though, you may end up wasting a lot of time unless you can find out how to get that windows' handle using Win32. In the API-Guide tool ( http://www.mentalis.org/agnet/apiguide.shtml ) there's a list of most of (maybe all of) the ways that you can find a windows' handle. Just pop api_ onto the start of those commands, and, assuming you have user32.decls, they'll probably be highlighted. You can also have the window to be embedded get its own handle and pass it to the Blitz3d window (for my case, this would be done by executing the b3d program with a window handle in the command line). So, obviously, there are restrictions. api_ActiveWindow() is a command which I don't recommend, because it has a terrible success rate... For many others, the window needs a unique class name/window name that would not be used by other windows. |
| ||
This could be used for the failing BlitzNCS project I started but now is dead. |
| ||
Here a screen:![]() |
| ||
Strange... Is that the theme your using which is removing the title bar on the IE window, or my program? If it's the theme, then perhaps it's the getWindow() function being stupid... |
| ||
Update (I know it's been years later) - I use Windows Internet Explorer 8 right now, so I just added a couple lines and this code worked for me: (I also have a very long and complete user32.decls in my userlib) This wasn't exactly the kind of code I was looking for, but at least it semi-works. I did notice that if I double-clicked the blank title bar, the window would jump out of the frame (as if I was "maximizing" the window), even though blitz still seemed to be running. So hrm. Kind of a misfeature? But it is what it is. some code snippets - just find the similar lines and add in a few more window titles to look for: - first add in a couple more window titles to look for: Const IEClass$="IEFrame" Const IETitle$="http://www.blitzbasic.com/ - Microsoft Internet Explorer" Const IETitle2$="The Official Blitz Website - Microsoft Internet Explorer" Const IETitle3$="http://www.blitzbasic.com/ - Windows Internet Explorer" Const IETitle4$="The Official Blitz Website - Windows Internet Explorer" and then a bit more code to detect them: ; Print "Looping" parent=api_FindWindow(IEClass,IETitle) ;IE displays this title when loading the web site If parent = 0 Then parent= api_FindWindow(IEClass,IETitle2) ;If the web site has already been loaded, this title is displayed If parent = 0 Then parent= api_FindWindow(IEClass,IETitle3) ; or maybe this one? If parent = 0 Then parent= api_FindWindow(IEClass,IETitle4) ; or this one? ;loops = loops+1 Last edited 2011 |