Writing Your Own Web Browser PowerBuilder Journal
Writing Your Own Web Browser PowerBuilder Journal
Writing Your Own Web Browser PowerBuilder Journal
http://pbdj.sys-con.com/node/42165
Welcome!
Register | Sign-in
Search
Jump to a Magazine
PowerBuilder:
Email Alerts
Newsletters
Get PowerBuilder:
Homepage
Mobile
.NET | AJAX | CLOUD | ECLIPSE | FLEX | OPEN WEB | IPHONE | JAVA | LINUX | OPEN SOURCE | ORACLE | POWERBUILDER | SECURITY | SOA | VIRTUALIZATION | WEB 2.0
PowerBuilder Authors: Liz McMillan, Ian Thain, Bruce Armstrong, Kevin Benedict, Chris Pollach Related Topics: PowerBuilder
PowerBuilder: Article
Comments
No One is Moving from Flex to HTML5
By Rob Rusher
READS:
19,849
Imagine creating your own Web browser that can provide the full power of Internet Explorer (IE) including scripting, parsing and rendering of HTML pages. It has become standard for stand-alone and client/server applications to contain Web browsers. A perfect example is Intuit's popular Quicken program. Quicken has the normal look and feel of a stand-alone application, but the startup sheet is a Web browser that presents up-to-the-minute Intuit information to the user. You too can build this functionality into your PowerBuilder application. In this article I'll describe how to use Microsoft's WebBrowser ActiveX control to build your own Web browser application in PowerBuilder. About Microsoft's WebBrowser ActiveX Control The ActiveX control, necessary files and registry settings are all included in the installation of Internet Explorer. The entire functionality of the control is in the file SHDOCVW.DLL, which is usually located in the system32 directory. This control lets you build applications that allow users to browse sites on the intranet/Internet, as well as folders in the local file system and on a network; however, there are restrictions on navigation. Like the full version of IE, it maintains a history list and allows the user to browse forward and backward through previously browsed documents. Applications can use this control as a document container to host documents, such as Excel spreadsheets or Word documents, that can be opened and edited within this control. It can also be a container to host any other ActiveX control. In addition, this control allows access to the DHTML document object model and extends it. Imagine creating a Web application without a Web server! Note: To distribute your application with this control to users who don't have IE installed, you need to obtain a license to distribute IE from Microsoft. Getting Started First, make sure you have IE. If not, you can install it (the latest version is 5.01) by downloading it from Microsoft's Web site, www.microsoft.com/windows /ie.The WebBrowser control should be ready for use after installation. To use the ActiveX control you'll need the 32-bit version of PB for development. I developed my sample Web browser application using PB version 7.0 and Internet Explorer version 5.0 Creating the Browser Visual User Object First, create a PowerBuilder application with the Application Painter. Then create a custom visual user object, add an OLE control and select the Microsoft WebBrowser control from the Insert Control tab as shown in Figure 1. All the events, properties and methods of this control are well documented at the Web site, http://msdn.microsoft.com/workshop/browser. In the
ckendrick99 wrote: Speaking as someone who knows what's going on in more than one company :) .. some of the world's largest organizations have made strong, company-wide policy changes that they need to move off of Flex. Others don't get it yet, as you point out. What is more telling, there is major brain drain in the Flex team at Adobe Adobe's own people understand that Flex has no future. They are seeking greener pastures. Apr. 12, 2012 02:21 PM EDT
read more & respond
Latest Articles
Latest Blogs
Latest News
What PowerBuilder Users Are Planning for Mobile Development Best Way to Grow Enterprise Mobility In-House What Ever Happened to Device Convergence? SAP Buys US Mobile Platform House Syclo Perhaps I Havent Made Myself Clear... TechWave into TechEd Does Go!!! Five Points the Mobile Info Worker Expects from Mobile Enterprise Data Five Points for Mobile Apps in Shaping the New Business Enterprise Five Points that Makes an Engaging Enterprise Mobile App Five Points on How Mobile Developers Improve Relationships with End Users Five Points When Building the Business Case for Mobile Enterprise Apps The PowerBuilder DataWindow as an Image Thumbnail Display Control
Savings
Virtualization Conference & Expo Early Bird Savings Expire on Friday !..
More Articles... Mobile Commerce News Weekly Week of April 22, 2012 ISUG Benefit Update Mobile Health News Weekly Week of April 8, 2012 SAP Acquires Syclo A Second Cup of Coffee and 25 Comments PowerBuilderTV - May, 2012 QweryBuilder Tips and Tricks Kevin Benedict Speaking about Mobile Strategies in Atlanta on April 26th Field Mobility and M2M News Weekly Week of
Dell
Dell & VMware Deliver the Enterprise Hybrid Cloud
PLATINUM PLUS SPONSORS:
1 de 8
26/04/2012 13:55
http://pbdj.sys-con.com/node/42165
constructor event add the following line of code that will open up the home page by default when the browser is visible. ole_1.object.GoHome() The GoHome method of the browser control takes you to the home page, which depends on the registry key value of HKEY_CURRENT_USER/Software/ Microsoft/Internet Explorer/Main/Start Page. I had set it to "about:blank", so it would initially show me a blank page on the browser. If you want the home page to be the PBDJ Web site, set the registry key value to www.syscon.com/pbdj. To see this effect, save the user object (u_browser) and close its painter. Create a window object (w_browser), place the user object in it and save. Open the browser window by adding appropriate code in the application's open event and run the application. Voil! The browser is now ready for surfing the PBDJ Web site. Navigating with the Browser Control Let's now add browsing functionality by adding buttons, statictexts and a drop-down listbox to the user object (u_browser) as shown in Figure 2. In the modified event of the drop-down listbox add the following lines of code to navigate to a URL. ole_1.Object.Navigate2(Text) IF ddlb_1.FindItem(text, 1) < 0 THEN ddlb_1.AddItem(Text) END IF The Navigate2 method of the browser control actually does the trick. The other lines above add the sites to the drop-down list as in IE. Add the following line of code in the clicked event of Back button. ole_1.object.GoBack() Add the following lines of code in the clicked event of Forward button. ole_1.object.GoForward()
Abiquo
Are Financial Services Organizations Risking Security by Avoiding Cloud Computing?
What's New in HTML5 - Week of April 1, 2012 Mobility News Weekly Week of April 1, 2012 Mobile Strategies and Consumer Products Companies More Blogs... Tech Allies Consulting Announces Addition of Mark Tussey as Plant Maintenance Practice Manager Confio Enhances Award-winning Ignite Software to Help DBAs Stay Ahead of Database Performance Issues Sybase 365 Provides Broadest Global Offering For Enterprise Messaging And Mobile Customer Engagement SAP Announces 2012 First Quarter Results SAP Establishes Global Managing Board to Lead Company RedSeal Networks Creates Powerhouse Management Team With the Addition of Key Executives From McAfee and ArcSight/HP
Oracle
From Consolidation to Enterprise Private PaaS
PLATINUM SPONSORS:
Intel
Driving the Transformation to Next Generation Cloud Data Centers
Rackspace
The Inevitability of an Open Cloud
GOLD SPONSORS:
CA Technologies
Follow YOUR path to Cloud Computing
Interxion
Who Keeps the Cloud in the Air?
More Than Two-Thirds of North American Bankers Believe Regulatory Burdens and Data Latency Issues Consume Significant Portion of Resources
Microsoft
Patterns for Cloud Computing
SAP Announces 2012 First Quarter Preliminary Results SAP to Acquire Syclo, Extends Leadership in
PerspecSys
War in the Clouds: Are you ready?
Mobilizing the Enterprise SAP Unveils Unified Strategy for Real-Time Data Management to Grow Database Market Leadership SAP Drives Openness and Choice for Millions of Mobile App Developers AlienVault Expands Board of Directors with Appointment of John M. Jack
ServiceMesh
The Big Win: Stop Playing Small-Ball with Your Cloud Strategy
Terremark
Evaluating Enterprise Clouds
More News...
Xiotech
Cloud Storage: Myths and Realities
POWER PANELS:
Cloud Expo New York: CTO Power Panel Cloud Expo New York: CEO Power Panel Cloud Expo New York: CMO Power Panel Cloud Expo New York: Wrap-Up Power Panel
Click For 2010 West Event Webcasts
The GoBack and GoForward methods are used to browse back and forth through the sites maintained in the browser's history list during each browser session. The status of the browser control can be obtained using the Busy property, which indicates whether the control is engaged in a navigation or downloading operation. Using this property, add the following lines of code to the clicked event of the Stop button. IF ole_1.Object.Busy THEN ole_1.object.Stop() END IF You can set the Cancel property to true for the Stop button so that the clicked event gets fired when you press the escape (Esc) key, as in IE. Just as the Stop method of the browser control stops a Web page from loading, we have a Refresh method to refresh the contents of the current page. Add the following lines of code to the clicked event of the Refresh button. IF NOT ole_1.object.busy THEN ole_1.object.Refresh() END IF Call the constructor event of the browser user object from the clicked event of the Home button to navigate directly to the home page, as shown below.
2 de 8
26/04/2012 13:55
http://pbdj.sys-con.com/node/42165
Parent.Event Trigger Constructor() To utilize the search engines, use the GoSearch method and add the following line of code in the clicked event of the Search button. ole_1.object.GoSearch() The GoSearch method, which is similar to the GoHome method, depends on the registry key value of HKEY_CURRENT_USER/Software/Microsoft/Internet Explorer/Main/Search Page. I had set it to www.yahoo.com, so it would show me the home page of Yahoo! MSN is the search page by default when you install this browser control. Useful Events of the Browser Control The browser control triggers a number of different events to notify an application of user- and browser-generated activity. When the browser is about to navigate to a new location, it triggers a BeforeNavigate2 event. This event also includes a flag that can be set to cancel the pending navigation request. I added the following lines of code in this event to prevent the user from browsing a network-mapped drive U or a site that contains the word "sex" in the URL. IF Pos(Lower(ddlb_1.text), "u:") > 0 OR & Pos(Lower(ddlb_1.text), "sex") > 0 THEN MessageBox("Navigation Restriction."', "Cannot Access this drive.") cancel = true END IF This event is one of the most powerful events for canceling the navigation request to the URL for unauthorized Web sites or local and network folders. The NavigateComplete2 event is fired after the browser has navigated to a new location. Add the following line of code in the NavigateComplete2 event so that the drop-down listbox reflects the correct URL currently being navigated. ddlb_1.text = ole_1.object.LocationURL Caution, BeforeNavigate2 and NavigateComplete2 events don't work in PB 6.x but they work in PB 7.0. Add the following line of code in the StatusTextChange event of the browser control to show the exact activity of the browser control. st_2.text = text
Abiquo
Eliminate Vendor Lock-in with Next-Generation Virtualization Management
This is the event used by IE to show the current downloading status. Add the following lines of code in the TitleChange event of the browser control to set the Adaptivity Building the Cloud title of the window in which this user object is placed. Blueprint for Enterprise IT window lw_browser lw_browser = this.GetParent().GetParent() lw_browser.title = text The text, if present within the <TITLE> tag of the HTML page, is actually displayed on the titlebar of the window. There's a trick to disabling and enabling the Back and Forward command buttons. The CommandStateChange event of the browser control is fired when the Forward or Back buttons need to be enabled or disabled, so add the following lines of code in this event. CHOOSE CASE command CASE 1 //CSC_NAVIGATEFORWARD cb_2.enabled = enable CASE 2 //CSC_NAVIGATEBACK cb_1.enabled = enable END CHOOSE The two arguments - command and enable - of the above event are used to enable or disable the appropriate Back and Forward command buttons in the browser user object. The browser control supports several common file operations, such as Print, Page Setup, Save and Properties, with the ExecWB method. I'll show you how to add the save HTML document functionality using the ExecWB method. Add a command button called Save As (see Figure 2) and add the following lines of code in the clicked event. ole_1.object.ExecWB( 4, 1)
GOLD SPONSORS:
Cordys
Continuous Business Transformation: The Cloud Value Chain
Microsoft
Microsoft's Cloud Services Approach
Navisite
Defining Enterprise-Class Cloud Computing: Managed Cloud Services
Surgient
Deploy an Enterprise Private Cloud in Less Than 30 Days with Surgient
Terremark
Parting the Clouds Evaluating Clouds and Cloud Providers for the Enterprise
The Planet
The Clouds Not the Revolution: Cloud Usage Is
3 de 8
26/04/2012 13:55
http://pbdj.sys-con.com/node/42165
Value 4 for the first argument and value 1 for the second argument bring up the Save HTML document dialog box. Similarly, value 6 would bring up the Print dialog box and value 8 would bring up the Page Setup dialog box. To print the Web page, you can use the Print menu item from the popup menu that appears when the user right-clicks on the browser control at runtime. It's good practice to trap the ExternalException event for this control as it returns an OLE exception whenever anything fails, such as trying to navigate backward or forward further than the existing pages or selecting the cancel button in a Save As dialog box. For this purpose, add the following lines of code in this event for a simple error handler to prevent the application from halting because of an Application System Error. MessageBox("OLE External Exception", source) action = ExceptionIgnore! Running the Customized Browser Application Save the user object with all the above lines of code and close the user object painter. Run the application. The customized browser application is now ready with most of the features of IE. Conclusion With the quantity of intranet/Internet applications mushrooming, this ActiveX control can be a key element to Web-enabling your applications. Coupled with the new Web DataWindow features, this object can add a lot of power to business applications. This control allows us to take advantage of the rich GUI that can be seen in Web pages. Another advantage of this control is to track and verify user navigation, thus securing your Web-enabled application. By reusing this control on the client side with DHTML forms and embedded ActiveX controls delivered from a Web server, the client's application or a remote machine on the network, difficult application development and deployment problems can be solved. You can download this article and the source code developed using PowerBuilder version 7.0 from the URL www.intac.com/~kaudata/download
Unisys
Storm Clouds - Disruptive Technologies Creating the "New Normal"
Virtual Ark
Third-Generation Outsourcing Is Here!
Click For 2009 West Event Webcasts
Topics
All Sections PBDJ Archives Case Studies Cover Story DataWindows Features From the Editor Guest Editorial Industry News Interviews PowerBuilder News Desk Product Review Show Report Tips & Tools Write For Us
Published March 1, 2000 Reads 19,849 Copyright 2000 SYS-CON Media, Inc. All Rights Reserved. Syndicated stories and blog feeds, all rights reserved by the author.
Related Stories
Building Your Own Amazon CloudWatch Monitor in Five Steps
Related Links
Figure 1 Figure 2
Comments (0)
Share your thoughts on this story. Add your comment You must be signed in to add a comment. Sign-in | Register In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.
4 de 8
26/04/2012 13:55
http://pbdj.sys-con.com/node/42165
This Month
All Time
User Group Malaise? What's New in HTML5 Going Mobile in 2012 Appeon Mobile: First-Ever Mobility Solution for the PowerBuilder Community M2M News Weekly Week of February 27, 2012 SAP Buys US Mobile Platform House Syclo Take PB to the Web, Mobile & More! Enterprise Mobility Asia News Weekly Week of March 25, 2012 Mobility News Weekly Week of February 27, 2012 What's New in HTML5 - Week of April 1, 2012 Building a Snap-In App Framework Using Dynamic PowerBuilder Assemblies SAP Executive Interview with Raj Nathan Research and Markets: Global Mobile Device Management Enterprise Software Market 2010-2014 Includes a Discussion of the Key Vendors Operating in This Market Enterprise Mobility Asia News Weekly - Week of February 6, 2012 User Group Malaise? Looking into Enterprise iOS Mobility News Weekly - Week of January 30, 2012 What's New in HTML5 Going Mobile in 2012 Appeon Mobile: First-Ever Mobility Solution for the PowerBuilder Community M2M News Weekly Week of February 27, 2012 SAP Buys US Mobile Platform House Syclo Mobility in Business Is Now a Necessity! Developing Your Enterprise Mobile 'iDea' Where Are RIA Technologies Headed in 2008? PowerBuilder History - How Did It Evolve? The Top 250 Players in the Cloud Computing Ecosystem DDDW Tips and Tricks Dynamically Creating DataWindow Objects OLE - Extending the Capabilities of PowerBuilder Working with SOA & Web Services in PowerBuilder DataWindow.NET How To: Data Entry Form Custom Common Dialogs Using SetWindowsHookEx Sybase ASE 12.5 Performance and Tuning Office 2003 Toolbar: A New Look For Your Old PowerBuilder App Book Excerpt: Sybase Adaptive Server Anywhere
Top Stories
1. Cloud Expo
Virtualization
Web 2.0
Open Source
.NET
5 de 8
26/04/2012 13:55
http://pbdj.sys-con.com/node/42165
2. Wireless
iPhone
Java
Websphere
Rick Ware Racing Announces the Addition of Adia Nutrition to the 2012 RWR North American Professional Motorsports Tour Powered by POYNT
eircom and PGi Announce Strategic Alliance Offering PGis Video, Web and Audio Conferencing Solutions, Including iMeet and GlobalMeet, to eircom Business Customers 95%+ Winning Trades Over Nine Years Make "Stock Alerts" a Must for Traders Illume Mobile Delivers Another World Class Mobile App With The Richards Group Apps Genius Acquires GetFunded.com and Prepares to Launch Crowdfunding Site for Entrepreneurs
TSYS Completes Conversion of Banco Carrefour S.A. Cloud Expo New York: IndustryLeading CxOs to Present June 11-14
Kalido Achieves Oracle Exadata Optimized Status appzero announces availability of zapp cloud migrator Are Your Cloud Computing Platforms Obsolete? Book Excerpt: Java Application Architecture Lenovo Continues to Speed Up PC Boot, Start Times with Enhanced Experience 3 Article One Partners Names Peter Vanderheyden as Chief Product Officer Essex Technology Group, Inc. Achieves IBM System Storage Specialty Elite Certification Infonetics Research: BYOD Trend Shaping Both the Traditional and Mobile Security Client Software Markets
Ultimate Software to Offer Ping Identity Single Sign-On Solutions for UltiPro Human Capital Management
Christophe Ramstein Named President and CEO of Strategic Polymers, Inc. Agencyport Software Extends Market Reach with New Version of BookSmart Eloqua's Social Media ProBook Wins "Killer Content" Award BID2WIN Software Delivers New Enhancements for Estimating and Bidding
Security
Complying with PCI DSS Part 5: Regularly Monitor and Test Networks
Cloud Expo New York Speaker Profile: Jill T. Singer NRO Dome9 Introduces 1-Click Cloud Server Secure Access Whos Responsible for Protecting Data Stored in the Cloud? The Future of Cloud Computing: Industry Predictions for 2012
3. Search
Adobe Flex
Apache
Eclipse
Open Web
6 de 8
26/04/2012 13:55
http://pbdj.sys-con.com/node/42165
Storage Network
Low-Profile SingleHop Gets $27.5 Million in Funding
WILS: The Many Faces of TCP Hosting Controller Validated by Microsoft as a Control Panel for Hosted Exchange Cloudera Partners With IBM to Bring Big Data Insights to Joint Customers
XML
4. Linux
PowerBuilder
GovIT
ColdFusion
SYS-CON.TV
Federal CIO Steven VanRoekel To Speak At InformationWeek's Government IT Leadership Forum On May 3rd
Ultra Electronics AEP Networks launches the first FIPS 140-3 level 4 ready hardware security module Rackspace Starts the Great OpenStack Migration StillSecure Joins Amazon Web Services Solution Providers Program to Drive Cloud Security Microsoft Sets Up an Open Source Subsidiary
Cloud Expo New York Speaker Profile: Dave Asprey Trend Micro
Cloud Expo New York Speaker Profile: Dave Linthicum Blue Mountain Labs Gap in the Clouds MeriTalk Study Shows $12 Billion Cloud Savings Opportunity vs. $5.5 Billion Cloud Savings Reality Cloud Expo New York Speaker Profile: James Weir UShareSoft Cloud Expo New York Speaker Profile: Treb Ryan OpSource
7 de 8
26/04/2012 13:55
http://pbdj.sys-con.com/node/42165
Cloud Expo
Home Register Keynotes Speakers Sessions Schedule Exhibitors Sponorship Info Conference Info Hotel Info Press Registration Call For Papers Media Sponsors Advisory Board Volunteers
Is Your Business 100% Ready for the New Era of Cloud Computing and Big Data? The Only Enterprise IT Event in 2012 Covering the Entire Scope of both Cloud & Big Data
Come to New York and get yourself up to date with the Big Data revolution! As advanced data storage, access and analytics technologies aimed at handling high-volume and/or fast moving data all move center stage, aided by the Cloud Computing boom, Cloud Expo is the single most effective event for you to learn how to use you own enterprise data processed in the Cloud most effectively to drive value for your business. There is little doubt that Big Data solutions will have an increasing role in the Enterprise IT mainstream over time. Get a jump on that rapidly evolving trend at Big Data Expo, which we are introducing in June at Cloud Expo New York. Cloud Expo was announced on February 24, 2007, the day the term "cloud computing" was coined. That same year, the first Cloud Expo took place in New York City with 450 delegates. Next June, Cloud Expo is returning to New York with more than 10,000 delegates and over 600 sponsors and exhibitors. "Cloud" has become synonymous with "computing" and "software" in two short years. Cloud Expo is the new PC Expo, Comdex, and InternetWorld of our decade. By 2012, more than 50,000 delegates per year will participate in Cloud Expo worldwide. The cloud is certainly a compelling alternative to running all applications within a traditional corporate data center. But moving from theory into practice is where things get complicated, and this is where attending a top industry event like Cloud Expo comes in. No one can take full advantage of cloud computing without first becoming familiar with the latest issues and trends, which is why the organizing principle of the 10th International Cloud Conference & Expo on June 11-14, 2012 - is to ensure - through an intensive four-day schedule of keynotes, general and breakout sessions, and our bustling Expo Floor - that attending delegates leave the Javits Center with abundant resources, ideas and examples they can apply immediately to leveraging the Cloud, helping them to maximize performance, minimize cost and improve the scalability of their Enterprise IT endeavors. Delegates will leave Cloud Expo with dramatically increased understanding the entire scope of the entire cloud computing spectrum from storage to security. Whether you're an enterprise or small to medium business, you'll soon be benefiting from the Cloud. Join your peers in New York City June 11-14, and maximize those benefits already in 2012. See you in New York City!
Register Now!
Save $500 on your Golden Pass! Call 201.802.3020 or click here to Register Early Bird Expires Friday.
Speaker Opportunities
Submit your speaking proposal for the upcoming Cloud Expo in New York City [June 11-14, 2012]
Exhibitor Info
Please Call 201.802.3021 events (at) sys-con.com. Carmen Gonzalez, carmen (at) sys-con.com. Produced and presented by Cloud Expo, Inc.
Terms of Use & Our Privacy Statement - About Newsfeeds / Videofeeds. Copyright 1994-2012 Ulitzer, Inc. All Rights Reserved. All marks are trademarks of Ulitzer, Inc. Reproduction in whole or in part in any form or medium without express written permission of Ulitzer, Inc. is prohibited.
8 de 8
26/04/2012 13:55