I have four small single-form utility applications that I have written in Delphi (Win32), that every once in awhile I want to use in a way that makes them "feel" as if they are all one application, mostly to make switching back and forth between them super-easy. It would be great, for instance, to be able to insert them as containers inside a TabSheet, or something along those lines.
AppControls makes a neat little component that does something similar with TForm descendents, allowing them to be inserted inside another container in a Delphi application (see acEmbeddedForm http://www.appcontrols.com/appcontrols/overview.html'>here ), but I don't see any way to do this with four separate applications unless I build a fifth application with this end result in mind, and compile in all the forms of the original four applications.
I could also imagine wanting to "contain" or embed some other application as well (say, for instance, Notepad).
Is this possible in Delphi? (all things are possible... <g>)... and if so, would it be super difficult, and require massive amounts of under-the-hood Windows API familiarity?
I'm thinking the respective answers to these are probably yes, and yes, but hoping the answers are yes, and no. Thought I would ask just to be sure. <g>
If I am dreaming here from a programming perspective, and this is way more work than it's worth; any recommendations for utilities that make switching back and forth between a standard set of three or four applications simpler than it normally is in Windows?
You could make your small apps into OLE servers and create a new application that hosts them in one main form. OLE is nicely supported by Delphi, so it should be both fairly easy and not require much API fiddling.
This other SO question could provide some hints. Basically it states that you use SetParent. You could also enumerate over existing windows (such as notepad.exe) using FindWindow and call SetParent on them to reparent under your own.
With regards to embedding programs you don't have control over: I suspect you'll have a lot of trouble trying to do what you're describing, and if it's even possible at all (something I doubt), it would rely on a lot of low-level API calls and general nastiness.
If you wanted to restructure your application somewhat, you could make your four programs into plugins, and create a fifth "host" application that could load any or all of them.
I suggest you take a look at the JEDI plugin system, available for free from http://delphi-jedi.org.
I went with the "make a fifth app" solution when I combined a number of internal apps into a single app with tabs to select between them.
frmShipRef := TfrmShipRef.Create(self);
frmShipRef.Parent := tabShipRef;
frmShipRef.BorderStyle := bsNone;
frmShipRef.Align := alClient;
frmShipRef.Show;
I just set up a new form with tabs, then create each other form with the code above. This has worked well, and with a little conditional compiling I was able to add a panel on the left which provides a sort of "meta-copy-and-paste" to allow them to pass data between themselves.
Since all of your other apps are single form, you could cut/paste/save all components in each app onto a separate "background" panel saved as a Component Template. Then you could load your Component Template onto its own PageControl/Tab.
Related
Was wondering if this: https://code.visualstudio.com/docs/editor/codebasics could be implemented with WinApi or by DLL calls/injection globally in every application?
Which api call could be relevant to get me started?
This cannot be done. There are too many problems that need to be solved for which there is no general solution.
The standard carets have a hard limit of one caret per queue. With that in mind you would now have to solve not one, but two problems: Getting a custom caret implementation, and fighting the system-provided one.
That might still sound doable, but even just getting your custom-rendered carets injected into foreign windows isn't possible. There is no infrastructure in the system that allows you to safely tap into the rendering of arbitrary (or even standard) controls you do not own.
Now even if you got a solution to all of the above, how would you communicate those multiple selection marks back to client code? EM_GETSEL is strictly limited to one selection mark at most.
So far, this was mostly just about standard controls. Things won't get any easier with custom control implementations. WPF, to my knowledge, uses a pretty much closed down control library, that doesn't even provide the customization points of Windows' common controls. Same goes for UI toolkits like Qt. While open source, Qt doesn't allow for any external customization.
I'm sure there are more problems that don't have a general solution. While not an exhaustive list, the above problems prevent implementation of multi-selection in arbitrary UIs outside your control.
I currently have 3 very similar, but slightly different mfc applications, which would normally be opened at the same time as part of their workflow and usage in a Windows environment. I would like to keep them as 3 separate applications, but somehow group them together, under a single UI container to provide more clarity to the user.
I've so far considered using named pipes to send data from two of the applications to the third, the latter one being solely responsible for drawing the GUI (possibly having 3 different tabs at the highest GUI level, one for each application). I got this idea from SergeWautier's answer from this post. After looking into the possibility of doing this, there seems to be a lot of work involved in achieving this.
Is there any other (possibly simpler) way of achieving something similar?
Old answer
I have in the mean time come across the TaskSpace tool, which is the closest thing to what I'm looking for. It's liteware and getting the full functionality (e.g. saving a particular tabbing configuration, which I am most interested in) requires purchasing a licence. What would be really cool would be to restrict the user from adding any other windows apart from the 3 applications and have better control over the titles of the tabs & top-level window. At this point, writing a similar tool to TaskSpace would be the ideal solution.
I've also been playing around with tidytabs. It's not exactly what I want, because it doesn't provide a 'wrapper GUI', but I thought it's worth mentioning here in case it helps someone else.
Update
I've found exactly what I was looking for in Window Tabifier, which is open source and I can modify to fit my needs in accordance with the CPOL Licence provided. Very nicely written code too.
There are many applications for Windows these days that don't use native windows controls, don't have standard window frames and generally look different. What are some recommended techniques for creating such interfaces?
There are good reasons not to. Like that you will most likely not do a better job than Windows does. (Maybe it will look better (in your opinion), but will it behave?). Or that it's not what most users expect. Or that it will look like s**** on Windows 2011.
That said, it's not hard. You simply handle the WM_NC* events like WM_NCPAINT or WM_NCHITTEST. NC stands for Non Client (window area). And of course, there is a trick on Vista/Win7 (you have to announce it to the DWM).
From an implementation aspect, you could employ WPF (Windows Presentation Foundation) assuming you code for .NET :) It has pretty bunch of skinnable controls, that may look like native and may not.
From a design aspect, if your interface isn't going to follow documented standards (like the Windows UI guidelines), it has to be intuitive. I think the new generation of Windows applications will go through a growing phase in a manner similar to the early days of the Web. After a time, some standards or common themes will evolve.
Can you give us some sample applications? Some apps that don't use native windows controls use cross-platform GUI libraries, like Qt for C++ or Tkinker. These maintain the same look across different platforms.
I wouldn't really recommend making your user interface different deliberately. You don't stand to gain much. Your controls are almost always going to be buggier than native controls, and you are requiring the user to learn something new. Now, if you're controls add a large enough value to be worth the users' time it can be okay. But making them get used to different looking buttons is rarely worth it.
I`m not sure if this answer your question.
You can use third party skinning controls like from Infragistics, or SkinSoft for example.
But like Bubba said I`d recommend going for WPF.
Model-View-Controller! It's as valuable here as in web apps or anywhere else. Be sure to keep the part of your program that generates the custom UI separate from the part of your program that flashes the BIOS.
I know this question is 10 years old but none of the answers mention using an option in visual studio, dont know if it existed at the time.
Theres an option to remove the border of the window in visual studio (called borderStyle). Thats the easiest way to do it, using C#. After removing the border, all you have to do is create a new interface. If you're looking to do it in C++, i think you need to use DWM. I will let an example i found here.
https://github.com/melak47/BorderlessWindow
Another example (maybe without DWM? didnt test):
https://social.msdn.microsoft.com/Forums/vstudio/en-US/b98c4c06-9581-44d3-8e5a-4adb2316e653/win32-about-styles-how-can-i-do-a-borderless-window?forum=vclanguage
There is a lot of people disencouraging to do it in this thread but there's no reason to not do it, if you know what you're doing your application can look great.
I've done plenty of programming before for CLI and the web, however recently I am getting into desktop GUI programming.
Most of the tutorials for GUI programming I found just explain the different controls you can use and leave it at that. Some of the better ones also skim over a few usability issues.
However, my problem is not with the APIs, or the theory but with my code.
How are you supposed to organise different views your application might have (e.g. a IM application has a login view, a contacts list view, a conversation view etc.).
Are these supposed to be different classes or different methods on one class?
Different panels that are hidden and revealed, or different windows altogether?
I'm hoping for answers as language agnostic as possible, but in case that's not possible, the languages/frameworks I am considering are Java/Swing or C#/WPF. However, if there's another language/framework that is significantly better for learning from, I would consider using that.
Normally each view will be a seperate class in a seperate file. The class will then most likely implement some base class like Window or Control.
As far as organization, if it's a simple app, put them in the root or in a UI folder. Or perhaps a Window folder and Controls folder.
If it's a large app with several views, than break them out into functionality, i.e. an IM folder.
I would say go with what Joshua said and as far as using different panels that are hidden and revealed, i've worked on old code and it's a nightmare to re-use (8000+ lines of Delphi 6!) so stick with different windows as much as possible!
The generally recommended overall structure of the program is the model-view-controller (MVC) type of structure. So, first off, don't make the actual data part of the views, it goes into the model. From here, since the only data in each view window is now almost entirely just layout information and what to do on an action (click, data display, etc), if these are different, they should probably be different classes. If there's some general functionality that can be factored out, you can make this a base class and inherit from it, but in the end, windows with different functionalities should be different classes.
If you are going to be using one of the mainstream IDEs it will handle some of this work for you. The default will be a different class for each form. Hidden panels and tabbed interfaces are nice features but do yourself a favor and learn the ins and outs of embedding groups of controls into form. Some frameworks allow you to directly embed one form into another. Others have special containers that can be be embedded.
The point of these is to break up your functionality so you don't wind up with a bloated form class that's difficult to wade through.
I would also spend some time looking at some of the architectural patterns for keeping your business logic separate from your UI. Check out this link for a good starting point.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
This question isn't about unit-testing. And it is for a desktop product.
This is about testing of the gui and testing that the right stuff is input in the right text box at the right time.
A company I used to work at used WinRunner (different department so I don't know much more that that), but that has now been shutdown by HP but they don't seem that bothered whether you stay with HP or go elsewhere. You can't read about the product until you've signed up which is annoying.
The tool has to work with MFC (non-negotiable) and the ideal tool will also...
be automated.
be scriptable.
work with different screen resolutions automatically.
be able to 'spy' on individual static text boxes, etc.
intuitive enough so non-programmers can create the scripts.
have reporting tools, including email of individual users.
What do other SO users do for automated GUI testing?
We use the SAFS framework for Rational Robot (RRAFS). There are also SAFS implementations for WinRunner (WRAFS) and it looks like they have a new "Image-Based Testing" implementation, which I'm not familiar with.
This framework does a nice job of seperating the UI implementation from the test scripts. I've tested four releases of a web application developed by two different teams (one team using classic ASP, one using ASP.NET) and I only had to change the application map of my UI objects, the tests themselves didn't need to change.
That said, the language of the framework is cumbersome and takes getting used to. It's not very robust, in terms of language constructs, but with some effort you can do anything you need to. It's sort of like "programming" in Windows Batch language, but for tests ;)
To address your individual requirements above:
1) The tool has to work with MFC (non-negotiable).
The SAFS framework uses a 3rd party "record-playback" tool to drive the tests, like Rational Robot or Mercury WinRunner. If that tool can interact with MFC apps, then the framework can. I don't know how the "Image-Based Testing" implementation drives the tests, but I'd guess it can also work with MFC.
2) be automated.
The SAFS framework integrates with the STAF framework, which will allow you to automate the execution of your tests. I have a proof-of-concept test that uses STAF to start a VM image from a pool of images, install the application under test, run the RRAFS test, and put the results on a web server for others to get at.
3) be scriptable.
Yes, but as mentioned, it's not the most robust programming language. I wrote an Excel add-in that our testers use to write their tests that simplifies things a little bit.
4) work with different screen resolutions automatically.
Yes, since it's looking "under the covers" at the UI objects and not the screen. Except for maybe the "Image-based Testing" option...
5) be able to 'spy' on individual static text boxes, etc.
Yes, you can wait for a UI object to appear, disapper, to have a value, for a value to be changed, etc.
6) intuitive enough so non-programmers can create the scripts.
With some training. We've had limited success. Some QA folks can write the tests, some struggle.
7) have reporting tools, including email of individual users.
Yes, using the STAF framework you can post results to a web server, send out emails, etc.
Lots of good answers here, but I wanted to address this goal statement, specifically:
intuitive enough so non-programmers
can create the scripts
I can understand why you'd want this, but it's a lot harder than you might think. While you can find any number of tools out there that'll claim to make writing scripts easy, in practice, you're going to need at least some people on your automation team who understand programming. Writing scripts that are reasonably robust is going to involve one or more of looping, if/then/else, and subroutine calls. Not the kind of thing that non-programmers are going to find intuitive.
Be especially wary of the idea that you can "record" a person using a tool, then play it back for testing. That sort of "automation" is often so brittle that you'll end up modifying or re-recording the script for nearly every change in the software.
Coming from a strong Mercury/HP background, I would highly recommend using QuickTest Professional for your GUI testing. It has a lot of the same functionality as WinRunner, but without a lot of code. Simple GUI checks can be done through the QTP interface with minimal, if any, custom VB code. Checks for text next to boxes can be done with simple compares using the datasheet in QTP.
If you are used to WinRunner, and know VBScript (not so much TSL), then I would definantly look at QTP.
As far as your other requirements, QTP also has the Spy feature, like WinRunner, that will list all properties and actions you can perform on objects. And as for simplicity of use, at my old job, we would have business or system testers create simple smoke scripts, then I would take them and code them for more in-depth testing (multiple data values, error checking, etc). And as for reporting, QTP will do simple reporting of pass/fail/warning on tags that you put in, along with custom data you can input. So you could use a case statement to populate your output values based on your results. It won't do e-mail naitevly, but if you integrate with TestDirector/QualityCenter, you can setup through there, along with automating the kick-off of your scripts, and parameterizing data right from there (which is nice to send back to testers to have populate data without being involved in the script itseld).
Pat
See User Interface Testing.
Desktop or Web apps alike have the same testing pattern here (I've worked in both).
Place as little logic as possible in the UI and test everything below it. So you say, but what if I want to test that such and such happens when a button is clicked? The method that is called when that button is clicked should call out to another class that actually does the thinking.
You might say, but I'm using some static classes/methods that can only exist in my UI, wrap those with an adapter and utilize that interface in order to make your code testable.
The parts of your GUI tests that you want to automate should be automated below the UI. There are parts of your GUI that you can't automate. Checking to make sure things "look right", or testing that you can see certain elements, etc. All of that is what your humans should be doing. Ensuring that events are properly firing, and that values are being appropriately returned from your business objects, that's all unit tests.
I can see from your question that you've already pretty much decided you need an automated GUI tester, but that's not the right tool for this job. If you decide to use that you're trying to find the best way of doing the wrong thing.
If you think that this isn't about unit testing because you're testing GUI interactions, then I can guarantee you're not unit testing close enough to your UI. If you were, you'd feel like most of what you'd be testing was redundant.
If you disagree with me, please post some reasons and we'll hash this out.
There are a lot more (open source) alternatives if you are testing a web product. For a desktop product, some popular general purpose desktop GUI automation tools below (in no particular order). I've worked with all of these personally, and they all get the job done. If you choose to go with a vendor tool, get POCs for the ones you are considering, and make the decision based on what tool is the best fit for the company in general. One tool may be a better fit for a particular application, but there may be other projects/applications to consider.
QuickTest Pro (HP's successor to WinRunner)
Rational Functional Tester (IBM's successor to Robot)
TestPartner