I have a C# application, which uses Microsoft UI Automation functionality, e. g. a call like AutomationElement.RootElement.FindFirst(...).
Now I need to do the same thing (use MS UI Automation) in Delphi 2009.
How can I
a) declare that my Delphi code uses MS UI Automation library and
b) make calls like AutomationElement.RootElement.FindFirst(...)
?
There are several tutorials (tutorial 1, tutorial 2) explaining how to package one's own .NET code so that it can be used with Delphi, but in my case I need to use "pre-packaged" (already installed) assembly in Delphi.
Update 1
Now I can get access to AutomationElement.RootElemeent on one machine, but it doesn't work on another.
How can I find out the reason, why the attempt to execute uiAutomation := CoCUIAutomation.Create; fails on the second machine?
As stated in the comments you have to import the UI Automation type library (COM Object) into your project, this can be done with the "Import Component" wizard (Component -> Import Component) in Delphi 2010.
Microsoft kept the COM Object's interface really close to it's .NET counterpart so you shouldn't have much trouble to use it if you are already familiar with the .NET automation library.
Related
what is the options for unit testing in delphi XE4? i'm trying to use DUnit but it seems didn't have any official version for XE4 and source didn't compile
Delphi has for a long time, and XE4 is no different, shipped with DUnit. You need to make sure that you select it in the install options.
The version that is shipped with Delphi is already updated to work with the version of Delphi that it ships with. Looking at the DUnit sourceforge project, it seems rather moribund. The last commit to the SVN archive that mentions Delphi versions is for Delphi 2009. So it seems clear to me that you are best sticking with the version that ships with Delphi.
You may be interested with the unit testing features available within our mORMot Open Source framework. See this StackOverflow answer.
In addition with unit testing with classes, just like DUnit, you have at hand a whole mocking/stubbing framework.
Using interfaces, in a SOLID context, is therefore more integrated within this framework than with DUnit. For instance, interface mocking directly links to a test case, so is able to be integrated within the unit test suit.
It is perfectly working with Delphi XE4, in both 32 bit and 64 bit Windows platforms.
There is a new project called DUnitX. It is intended to take advantage of newer features in the language and framework and works with Delphi 2010 and later.
Still very much a work in progress, but it is currently active and you will probably recognise some of the people who are working on it.
Is it possible to use custom component derived from default one to be visible only as part of the project? The advantage of this solution is that I need not to distribute source code of component separately from that of application. Also there is no need for other developers to always check if they have installed the latest version. I need not to manage various versions and copy them somewhere to share my changes with other developers in team (whether it be network disk or SVN server). They get new version with every SVN update from server.
If i used delphi there would be solution - interposer class but this is not applicable to me. MS Visual Studio has possibility to use component only as part of Solution (analogy to MS VS Solution is ProjectGroup in C++ Builder).
What you are asking for is only possible if the component is created dynamically at run-time only. If the component needs to be accessible at design-time, then it must be installed into the IDE before the project can then use it.
I'm looking at Delphi web server apps, and the first thing I notice when I go into the New Items dialog is that there are several different frameworks.
WebBroker looks the nicest from a conceptual standpoint, but in the documentation it looks like its DB and session-management code is tied to the BDE, which makes it somewhat less than useful today.
WebSnap looks very similar, but the documentation says it's deprecated and IW ("VCL for the Web") should be used instead.
So I look at IW, and I can't make heads or tails of how it's supposed to work. The sample code is full of stuff that looks like it belongs in a desktop app, like clicking a button to fire an event handler to change the caption of a form element. (Wouldn't that have to be done client-side in JavaScript if we're creating a webpage?)
So what's the current standard framework for building a web server in Delphi?
While there are several commercial options available for writing web apps with Delphi, in my opinion Delphi no longer ships with a modern web development solution included as part of the package.
If I had to give an answer to your question though I would say that the current out of the box Delphi web framework is WebBroker. WebBroker is the only web framework included with Delphi that isn't deprecated or restricted in its functionality.
WebBroker was introduced perhaps as far back as Delphi 4. It's a good honest work horse but it hasn't really been improved much since it was first introduced. It leaves you to do most of the heavy lifting but it also doesn't get in your way. WebSnap and IntraWeb were built using WebBroker as their foundation which gives you idea of the level of services it provides.
A full version of IntraWeb has been bundled with Delphi Enterprise for many years but as of Delphi XE it now has several limitations (no SSL, no ISAPI deployment, 20 minute idle timeout) that will very likely mean you'll need to buy a license from AtoZed to use it seriously.
The version of IntraWeb bundled with Delphi Pro has always been far too limited to be considered anything other than an evaluation version.
Old question but still deserves an up-to-date answer.
Current 'settled in' solutions are:
IntraWeb:
https://www.atozed.com/intraweb/
uniGUI:
http://unigui.com/
Introduction
uniGUI Web Application Framework extends Web application development experience to a new dimension. uniGUI enables Delphi developers to create, design and debug web applications in IDE using a unique set of visual components. Each component is designed to provide same functionality of its counterpart visual component in Delphi VCL. This provides a very comfortable development environment very close to native VCL application development with an easy learning curve. uniGUI Web applications can be deployed to a server using one of the available deployment options such as Windows Service, Standalone Server or ISAPI Module.
Product Highlights:
Based on industry's most advanced JavaScript library Sencha Ext JS.
Includes OEM license for Sencha Ext JS. (Please see licensing for details).
A unique platform to create stateful web applications.
Complete IDE support for creating projects, designing forms, frames and handling data modules.
Advanced support for scripting client side JavaScript events.
Library core is fully optimized to achieve highest level of scalability.
Including advanced Stress Test Tool utility.
Comes with various deployment options: ISAPI Module, Standalone Server and Windows Service.
Supported Delphi versions: Turbo Delphi Pro, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, XE2, XE3, XE4, X5, XE6, XE7, XE8, Delphi 10 Seattle, 10.1 Berlin, 10.2.3 Tokyo and 10.3.3 Rio (Win32 & Win64 platforms). (Linux support is in the roadmap)
C++ Builder supported.
Supported Browsers: IE 9+, Microsoft Edge, FireFox, Chrome, Safari and Opera
New state-of-the-art uniGUI HyperServer technology.
TMS WebCore:
https://www.tmssoftware.com/site/tmswebcore.asp
RADical Web
Modern SPA web application model
Pure HTML5/CSS3/Javascript based applications
Standard component framework for common UI controls and access to browser features
Debugging in Pascal code via the browser
Backed by a solid & proven Delphi Pascal to Javascript compiler that was years in development
Reuse skills and components Component based RAD development integrated
in the Delphi IDE A truly revolutionary & innovative TMS FNC component
framework that is now also web enabled, allowing to create UI controls
that can be used on VCL, FMX, LCL and WEB! Open to consume other
existing Javascript frameworks & libraries Open to use HTML/CSS for
design Open to use other jQuery controls or even other Javascript
frameworks Offers Pascal class wrappers for jQuery controls from the
jQWidgets library Easy interfacing to REST cloud services including to
TMS XData for database
Easy Deployment Application consists of HTML & Javascript files only
that can be easily deployed on any light or heavyweight webservers Use
any existing load-balancing software and/or techniques for highest
performance Small and convenient debug webserver is included for fast
RAD development
http://docwiki.embarcadero.com/RADStudio/en/DataSnap_Overview_and_Architecture
DataSnap has been there for a long time, and the latest releases is DCOM-free. You can utilize it to build up server side piece (S in both C/S and B/S). Its current role is almost like WCF in .NET world.
Then if you are building a web site front end, you can use IW. But DataSnap makes it even possible to build up front end using PHP or other web technologies.
https://github.com/relativ/pascalweb
PascalWeb use pascalscript compiler , you can create web app, like php or python
First of all (before this question get down voted): I am a developer developing 99,99% of my programs using Delphi targeting Win32 (developing in Delphi 7 still, very slowly migrating to Delphi 2010).
When Delphi 2006 or 2007 (can't remember which version at the moment) came out I bought the RAD Studio edition to be able to start developing .net applications using Delphi.net and VCL.net.
I played around with it for some short time, but in the end, due to work load just kept using Delphi 7 as development platform.
When Delphi 2010 came was released, I decided to give .net a go once more, and (foolishly) bought the Studio License once more thinking the include PRISM was the previous Delphi.net (to be developed in the Delphi IDE).
Now that I have installed PRISM (and the Visual Studio 8 IDE - o horror), I am just wondering whether PRISM is a new version of Delphi.Net or not (probably not). And if I can use some of my Win32 code under Prism.
UPDATE AFTER SOME REPLIES: I keep the question open because you get more answers when a answer has not been selected yet.
I do miss the Delphi IDE though. It's all a mather of taste but having to develop in two different IDE's (where f.i. the keyboard shortcuts are different - and I don't want to give up the Delphi ones, thank you)) is not my idea of spending my development time.
Prism is a replacement for Delphi .Net - it has been developed by RemObjects and its original names were Oxygene and Chrome ( http://www.remobjects.com/ ).
Because it's much more mature than Delphi .Net in the .Net segment it now is included in Delphi RAD Studio instead of Delphi .Net.
You won't be able to use all of your W32 code, but the syntax is very similar and most algorithms will probably work without any change.
See http://prismwiki.codegear.com/en/Win32_Delphi_vs._Delphi_Prism for a detailed comparison of Delphi W32 and Delphi Prism.
No. Delphi.NET was designed specifically to be backwards-compatible with Win32 Delphi code. Prism is not. It was not developed by the Borland/CodeGear team, doesn't include VCL support, and has a handful of minor language differences. It's better to think of it as a new dialect of Object Pascal than as Delphi.NET.
The main difference was that Delphi.Net was mainly a port of the RTL/VCL to .Net, as well as an adaptation of Object Pascal to be a .Net language.
It had to include a full blown IDE with a special Delphi.Net Form Designer.
The goal was to help move a VCL Forms application to .Net with a minimum of changes, or create new application without having to re-learn the IDE and the library.
Delphi Prism is also an adaptation of Object Pascal to the .Net world but with more emphasis on being a fully fledged .Net language (even more so than C#) and much less worries on being compatible with Delphi.
It is just the language, hosted in Visual Studio, and does use whatever designer is provided by the IDE.
So in the end pure Pascal code will be very much similar, and easily ported, but rich GUI applications will need more rewriting/redesigning.
Yes and no.
Oxygene (FKA Delphi Prism) replaces Delphi for .NET, but it is not a new version of it.
They have different design philosophies and are not 100% compatible. As Francois pointed out, Prism does not include the VCL.Net. Instead it focuses completely on supporting the .NET GUI Frameworks: WPF, Silverlight, Prism, WinForms, ASP.NET, etc.
Delphi for .NET was all about migrating and backwards compatibility. Delphi Prism is all about being a full featured .NET development language and "forward compatibility."
You can create you pure business logic as code compatible between Delphi native and Delphi Prism, but all the GUI and IO code (anything that makes use of the VCL or RTL) will be specialized.
Check out the Oxidizer and ShineOn for more help in migrating and code compatibility with Delphi Prism.
No, Prism has been labeled Delphi more to make it more popular, like Delphi PHP.
It's not like Delphi.NET, with a VCL-alike etc, or even a compatible language (it uses method instead of procedure and many other deviations).
So you can see if you like it, but from what I have seen from it, having used Delphi won't be much of an help, and neither do existing codebases.
I recently bought Bob's book Delphi XML, SOAP & Web Services
in page 85 of this book the (Delphi 2006 8used) comes with several New Item Categories such as
C# Projects
C++ Builder projects
Delphi for .NET Projects
something that you don't have in a fresh installation
I need this ASP.NET Web Service Application that is inside Delphi for .NET Projects, but I can't find how do we get this plugin(?) to install in Delphi so we get all this new projects categories.
Does any of you use this and can tell me what is the Plugin?
image from the book showing what we are after
alt text http://www.balexandre.com/temp/2009-08-31_1322_asmx_in_delphi.png
We tried Delphi prism but it is not that as Prism works in Visual Studio it self and not in Delphi Studio.
We also tried to send an email to Bob Swart but no answer from him :(
We thought and we own RAD Studio 2007 Professional, and that comes with that Delphi for .NET Projects but not the ASP.NET Web Services, so, we are thinking that it only be available for the Enterprise or Architect versions, but I can't find any information regarding where is this (bundle details and what's inside what) :(
Thanks
The Delphi.Net functionality was removed after Delphi 2007, so I am not sure why you do not see the project type. But as Delphi.Net is a pretty dead technology it would probably make sense to look for an alternative for .Net development like Delphi Prism or C#.
Actually, since Delphi 2007, the functionality has been split into three different product, plus a fourth studio product. There's Delphi for WIN32 which includes C++ and Delphi for .NET which includes C# and ASP.NET. And then there's the Developers Studio which combines these development systems into one product. There are also products called Turbo Delphi, Turbo C++, Turbo C# and Turbo Delphi for .NET.
To be honest, Borland/Codegear/Embarcadero is trying to find the most popular combinations of these products making it very unclear for developers to choose the right version. Now we have Delphi Prism for .NET which integrates in Visual Studio, plus Delphi and Delphi for .NET or whatever. Anyway, I stopped upgrading Delphi since I bought Developer Studio 2007 simply because they're making a big mess of their marketing strategy.
Plus, they're becoming too expensive. For .NET development, Visual Studio will provide plenty of options already, especially when designing web applications. I will upgrade once the price becomes reasonable again and their marketing strategy becomes more normalized. I fear it will be a cold day in Hell when that happens.
You're probably using just the WIN32 version, not the Studio version which would combine both. Or you just installed the WIN32 and not the .NET part! Or, with Delphi 2007, you just start the WIN32 identity, not the whole Studio identity. (Delphi will install multiple icons, one for Delphi/WIN32, one for C++, one for C#/.NET and one for the complete studio.)
Just adding that I myself use the RAD Developer Studio 2007 and it does contain the ASP.NET Web Services. Just make sure you've included them during installation!
Got it.... (finally)
The best way to integrate Delphi code in a .NET output (in my case ASP.NET Web Services) is to download Delphi Prism (free trial version for evaluation) and use it.
File > New Website > ASP.NET Web Service > Language: Oxygene > Choose the required Framework
alt text http://www.balexandre.com/temp/2009-09-01_0857.png
This will create a normal ASMX Web Service with the .pas file as the Code Behind :)
Exactly what I'm after!