Win32: Is it possible to build an app that houses other apps? - language-agnostic

I was wondering, how would you go about writing an application that basically houses other applications inside of it?
The reason I ask is that I'd love to build an app that 'conquers' my current explosion of open windows. I've used virtual window managers before and they're nice and all, but I could do so many things with an app like I mention.
Alternatively does anyone know of an easy to use/intuitive application for confining windows to 'regions' of your screen? Something like GridMove, but more intuitive and less flakey?

You could create a window, then you could enumerate all Windows that have the style WS_OVERLAPPEDWINDOW, select the ones belonging to the application you want to house, then call SetParent on the window, setting the parent to the window you created. You could also use FindWindow to find a window by its title.
All the windows inside the house can never leave the house window's boundaries, but they still follow all the same rules. You can still click-and-drag windows etc.
The problem here is that if the application inside the house creates another window, its parent will most likely be the desktop window, not the house window.

I think what you are describing is generally called a Window Manager. The Windows shell is itself a (poor) example of a window manager. You might want to investigate some alternatives. I know there has been some success in getting KDE ported to Windows, so you might want to look at the current state of that project.
Microsoft also provides a PowerToy (IIRC) that gives you virtual desktop support, but it's really bad. Have you considered just getting a second monitor (and perhaps a utility such as MultiMon Taskbar to get a second task bar on the other monitor)?

Here is code that uses FindWindow / SetParent to create a tabbed view combining different applications Jedi Window Dock
I also wrote an application (not free, not open source) that takes this idea a bit further called WindowTabs.
The only caution I would give you is that not all applications like being parented. If your writing .NET, there are some "Gotcha's" there (which is why WindowTabs doesn't use parenting).
Also, in general, once you do a SetParent, you are joining the threads at a Win32 level meaning that if one hangs, all of them are toast.

Multiple Document Interfaces could help you out.
Despite the multiple down votes, I stand by this answer because the OP never stated the source of the "explosion of windows." I've seen business apps that open several windows at a time (or users that would open several instances "to save time") where MDI would've been a nice feature for them.
If the OP is a power user who has a need for another window manager because he runs many apps at once, then this really doesn't apply. It also isn't the problem I'd be addressing -- it would be finding a way to have fewer windows.

In general, there's always a VM.
It may be overkill or it may not work depending on the specifics of what you're trying to do. But VMWare will let you copy/paste files and text between your VM and local machine, so it's not that far off of being a true window manager. The system requirements aren't even that outrageous, considering how much memory iTunes + a typical browser eat up.

Related

How can I tell if a Chrome app is already running

I'm looking for means of telling whether other instances of a Chrome app are already running but Chrome's excellent context isolation makes it quite difficult.
Also, I was hoping chrome.runtime APIs would help but it doesn't seem to be the case.
Essentially, I want to make sure only one instance can run at any given time.
Thanks!
Your background page can store global state that lets you keep track of which windows have been launched by the app.
Your app can only have one background (or event) page at a time.
If you are wanting to prevent multiple windows from launching, make sure your chrome.app.window.create call has an "id" option. That means only one window will be created with that given id.

Embed frame of a local .exe in a web browser

The question may sound a little odd but I'm currently in a project where this could help solving many problems.
Is it somehow possible to embed an .exe into any web browser? I don't want to run the program directly in the browser (would be major security risk I guess), I just want the window of the .exe being embeded into a browser page. So the .exe is running locally on the system but instead of a "windows window" I have it displayed in the web browser. Think of it like VNC, I only need my "video" and the possiblity of user interaction (the program is an interactive 3D visualization).
I don't have much hope for this being possible so I'm also glad about any suggestion that would allow me to display web pages while my program is running in the same (fullscreen) window. Doesn't necessarily has to be a "real" browser but should allow basic stuff like HTML, CSS etc.
This kinda sound more like a SuperUser question rather than a StackOverflow one.
Anyway, I have a number of possible solutions for you:
You could use a second monitor.
Maybe all you really need is setting the "exe" window to "always be on top".
I could swear that used to be an option in the Windows' default Task Manager in the earlier versions of Windows but I use a 3rd-party piece of software for around 10 years now for that and many other purposes, however there are many such options to be found online.
Can't risk endorsing the one I use here, since it tends to spook people into thinking I'm trying to infect them with HAX.
In case you have the sources for the "exe" you are running, have you considered going the other way around and building a web renderer into your desktop program? Something like WebKit, Servo and suchlike.
Or you could make the program listen on a port to network packets you can be sending from the page you'd have to make — like a remote control.
Then there's also the cgi-bin option if you run the server.
And, to see what you're controlling, you might wanna stream it to some streaming platform (if you get it to stream an obscured window), embed their player widget in an iframe on your custom local webpage and keep the website you are reaching in another frame.
Maybe even code the program to read XInput and stream it through Mixer using its MixPlay feature to control it.
Hope any of this helps.

Flex - Run Air Application In Background

I am trying to provide my users with the option to have my application launch automatically and complete a task at a certain time every week.
I can make my application launch at log in using NativeApplication.nativeApplication.startAtLogin=true but I then want to detect if the time is the time they selected and if it isn't then run the application in the background until the time does match or the user shuts down their computer.
Does anyone know of a way to do this? On Adobe's webpage comparing Flex web apps and desktop apps it implied to me that applications could be run in the background but I'm struggling to find anything.
You can close the initial native window without killing the process
NativeApplication.nativeApplication.autoExit = false;
NativeWindow(this.stage.nativeWindow).close();
OR
You can close the initial native window and create a new window that acts as a desktop widget without appearing in the taskbar with either the UTILITY or LIGHTWEIGHT window type.
http://help.adobe.com/en_US/air/reference/html/flash/display/NativeWindowInitOptions.html#type
Either you keep the process running which times when the next 'job' should be ran, or you can set a system cron job (or something similar) which is specific to the OS. You'll want to use the NativeWindow option of 'LIGHTWEIGHT' so that your application doesn't show up to the user.
Personally, for these kinds of processes, I don't even try to use Air since it isn't really made for this kind of stuff. It's meant to be used for UI based apps and not process based. Use Java or C# instead.

What turns away users/prospective users?

In your experience as a developer, what kinds of things have turned away users and prospective users from using your programs? Also, what kinds of things turn you away from using someone else's programs?
For example, one thing that really bugs me is when someone provides free software, but require you to enter your name and email address before you download it. Why do they need my name and email address? I just want to use the program! I understand that the developer(s) may want to get a feel for how many users they have, etc, but the extra work I have to do really makes me think twice about downloading their software, even if it does really great things.
Requiring lots of information when signing up -- name and email is bad enough, as you say, but some registration forms have many many fields. The fewer the better.
Charging money but refusing to disclose the price unless you speak to a sales rep
Having a web site that only works in certain browsers
No releases since 2003
No documentation
Support forum with many questions and no answers
Here are a few annoyances that I haven't seen anyone else mention:
Programs that auto-launch one or more processes at system startup that run constantly in the background (invisibly, in the clock tray, or otherwise).
While some of these are necessary, most would either be better implemented with a utility that runs periodically (use the system's task scheduler!) or don't need to be launched until the associated program is launched.
Dialog boxes that pop up on top of all open windows (even those of other applications).
This is even more annoying if you run full-screen apps.
Pop-up dialogs that won't let you switch to another app until they are dismissed make me want to throw something.
Stealing my file type associations or changing the icons associated with a MIME type when I already have that type assigned to another application. At an absolute minimum, ask me first.
Storing user data/documents in file types that can't be opened by other applications
The worst is when files are also bound to a specific version of the application
Automatically cluttering my desktop and quick launch menus with icons
Automatically adding a link to your crappy website into my web browser's bookmarks
Assuming I use Internet Explorer and launch it specifically instead of querying the system for the default browser (same goes for media player, email client, etc)
Failing to understand the difference between user-specific settings and system-wide settings
Re-mapping common, near-universal keyboard shortcuts (cut, paste, undo, print, refresh, etc) for no good reason
If you're going to re-map Ctrl+C from "copy" to "close without saving anything", at least pop up a dialog warning people when they use it
Requiring an exact version of a library or framework. I don't want to have to uninstall the .Net 2.0 framework and re-install 1.1 just to run your program.
Spelling, punctuation, or grammar errors in the user interface or documentation. If you can't be bothered to at run (at least) an automated spelling checker, then you probably also didn't bother testing your app properly.
Displaying error messages to the user in a way that isn't useful. I don't care if "unexpected error #3410 occurred", I want to know what on earth that means and what I should do about it.
If you thought the error was important enough to program in a unique error message, why did you instead program error-handling code that could gracefully handle the situation? Only let me know about an error if I caused it directly or if I can fix it.
On a related note, aren't all errors unexpected?
Sending me to a website when I click "Help" instead of including help files with the local installation. I don't mind if you periodically download updated help files from the web, but people still need documentation when an Internet connection isn't available.
Bulleted lists that are way too long.
Setup programs that come bundled with all sorts of freeware (even things like Google toolbar) that are selected by default. I just want the program I downloaded, not all sorts of other programs. I can understand that developers might get something in return for including these add-ons in their setups but I hate it when they are selected to be installed by default.
Automatic updates and "information" screens that pop up every single system startup.
Yes, you updated yourself good job but I don't care nor want to know that you have. Do I really have to click "No, I don't want to upgrade to the pricier version" every single time I start my computer?
Ad infections. You know the kind where if you scroll your mouse over the text your reading it'll pop up a thing so you can't read it anymore. And flash ads that have sound(especially that you can't turn off. this was the reason I installed adblock plus) and pop up windows that happen multiple times while your sitting on a page.
Also, pop ups telling me to join a sites news letter mailing list. (where the "no" button is very small)
I will rethink downloading something if I think they will start sending me SPAM if I give them my e-mail address.
At a previous employer we had a program I helped write that was online as a "free" download. They had to put something in for Name, address, phone, and e-mail. Oh, and no opt-out checkbox. It annoys me when other companies do this, but I didn't have any say in the matter.
The info needed for free things gets me too, but other than that:
Bundled software, most of the time adware or browser bars
Having to click too many times to do a simple action
Websites that advertise "Free Download!" for something that turns out to be a paid app. Wow, so generous to allow me to transfer data over the internet for free.
Putting an icon in the taskbar when I don't want it there.
I installed an app called Pamella that records Skype calls. I'm fine with 1 icon in the taskbar -- Skype's icon -- but Pamela adding a second just got me angry and I uninstalled it.
Ugly / unfit user-interface. For me, this is really important.
Having to register to download the program (specially if it's freeware)
Browser-specific / requiring special/other applications to work properly
Bloated applications that start with a few MBs and finally grow to 100's of MBs and huge mem consumption.
That'd be most of the things that turn me away from a program.
One of the things that bugs me the most (using, not downloading to try in the first place...):
I download or buy software it is because I want to USE it for something. If it is so friendly that it is 100% intuitive and needs no documentation before being useful, great! If it has comprehensive on-line or other help that answers all my questions as they come up, that's OK too.
However, if it has any kind of learning curve at all and nothing but my own persistent trial and error before I can do anything with it.... Off the drive it goes, within the first 5 minutes. Well, maybe I will use it if I am being paid to, but even in these cases I would probably recommend something else.
A user interface that is so simple that practically no documentation is required, or that has documentation that is accessible is a joy to use. If the program is complex and requires non-trivial documentation, that documentation should explain EVERYTHING a user might want to know, making no assumptions about his or her prior knowledge. That also puts my appreciation meter way up there.
Make your software actually do something people want done, and make it painless for them to do that with it, and you will have lots of satisfied users and word of mouth recommendations.
I left this on my list but it's a big enough annoyance that it probably stands on its own:
Software that requires users to pay for bug fixes, security patches, or critical updates.
If you have a patch that adds some new feature that I want, I don't mind paying for it. If you made a mistake and you are trying to get me to pay you to fix your mistake, then that's where we have a problem. Any physical product manufactured and sold would call this a "recall" and wouldn't dare charge customers to fix it.
In the past, some software products have shipped with known flaws to encourage users to buy the "critical updates subscription". This is downright evil.
How much pain am I going to endure to develop a conscious competence in using the program? Some computer games I tried to play but after a few hours if I haven't figured things out, I'll stop playing. If a program is hard to use and I don't have a really good motivation to resolve it, that will stop me right there.
How complicated is the installation process? How many minutes will I spend getting the basics of the program understood so I can be productive with it? How close to other programs is it, so that I can leverage how I use other programs to use this,e.g. if I've used Microsoft Office for years are the menus similar to that or is it someone else's idea of the ultimate menu system? Those are the questions I tend to wrestle with in a new program.
If something takes hours to install and then more hours to configure for my use, this really makes me question how useful is the software, really. I can understand the appeal of software that can be customized in a bazillion ways, but if I'm just getting used to the software, do I want these options at this point? To give an example of how absurd this would be in other situations, imagine if you had to list all the ingredients in a pizza or an automobile before getting to the options that mattered to you? You have to list everything in the pizza dough or car's body that most people don't think twice about what is there.

How to take screenshot of rendered HTML page

Our web analytics package includes detailed information about user's activity within a page, and we show (click/scroll/interaction) visualizations in an overlay atop the web page. Currently this is an IFrame containing a live rendering of the page.
Since pages change over time, older data no longer corresponds to the current layout of the page. We would like to run a spider to occasionally take snapshots of the pages, allowing us to maintain a record of interactions with various versions of the page.
We have a working implementation of this (Linux), but the snapshot process is a hideous Python/JavaScript/HTML hack which opens a Firefox window, screenshotting and scrolling and merging and saving to a file. This requires us to install the X stack on our normally headless servers, and takes over a minute per page.
We would prefer a headless implementation with performance closer to that of the rendering time in a regular web browser, but haven't found anything.
There's some movement towards building something using Mozilla source as a starting point, but that seems like overkill to me, as well as a maintenance nightmare if we try to keep it up to date.
Suggestions?
An article on Digital Inspiration points towards CutyCapt which is cross-platform and uses the Webkit rendering engine as well as IECapt which uses the present IE rendering engine and requires Windows, natch. Nothing off the top of my head which uses Gecko, Firefox's rendering engine.
I doubt you're going to be able to get away from X, however. Since CutyCapt requires Qt, it requires either X or a Windows installation. And, similarly, IECapt will require Windows (or Wine if you want to try to run it under Linux, and then you're back to needing X). I doubt you'll be able to find a rendering engine which doesn't require Qt, Gtk, GDI, or Cocoa, and therefore requires a full install of display libraries.
Why not store the HTML that is sent out to the client? You could then use that to redisplay in a webbrowser as a page to show what it looked like.
Using your webanalytics data about use actions, you could they use that to default the combo boxes, fields etc to the values the client would have had, even change the CSS on buttons, etc, to mark them as being pushed.
As a benefit, you don't need the X stack, don't need to do any crawling or storing of images.
EDIT (Re Andrew Moore):
This is were you store the current CSS/images under a version number. Place an easily parsable version number in a comment in the HTML. If you change your CSS/images and use the existing names, increment the version number in the HTML output sent out.
The system that stores the HTML will know that it needs to grab a new copy and store under a new number. When redisplaying, it simply uses the version number to determine which CSS/image set to use.
We currently have a system here that uses a very similiar system so we can track users actions and provide better support when they call our help desk, as they can bring up the users session and follow what they did, even some-what live.
you can even code it to auto-censor sensitive fields when it is stored.
depending on the specifics of your needs perhaps you could get away with using one of the many free webpage thumbnail services? snapcasa, for example lets you generate thousands per month / no charge no advertizing .. (not ever used, just googled 'free thumbnail service') to find this.
just a thot