Thursday 7 June 2012

Invoking JavaScript function from WinForms

I've been working on application that needs to load page and display it in WebBrowser control. Requirement was to allow interaction between WinForms application and web page.
Here I will show a sample application where JavaScript function is called from WinForms application.
For this Blog I will be using Google Web elements , Google Web Elements allow you to easily add your favorite Google products to your website.
Process can be described by following steps:
Create Windows Forms application
Drop WebBrowser control into Form
Create Html with JavaScript function you want to call
Calling JavaScript function from WinForms application isn't so difficult.
.NET WebBrowser control has property Document which gets an HtmlDocument representing the Web page currently displayed in the WebBrowser control.
Well this javascript part is not well written ,maybe my Web God-Like Buddy (Rustan)) can clean this mess..lol
anyway here's the script
JAVASCRIPT
  1. <script type="text/javascript">
  2. google.load("elements", "1", {packages: "keyboard"});
  3. var kbd;
  4. function onLoad() {
  5. var content = document.getElementById('content');
  6. // Create the HTML for out text area
  7. content.innerHTML = '<div>' +
  8. 'Demo of Invoking JavaScript using .NET' +
  9. '.</div>' +
  10. '<textarea id="t1" cols="47" rows="7"></textarea>';
  11. kbd = new google.elements.keyboard.Keyboard(
  12. [google.elements.keyboard.LayoutCode.ENGLISH],
  13. ['t1']);
  14. }
  15. function ChangeLayout() {
  16. var LayOut=document.getElementById('txtLang').value;
  17. kbd.setLayout(LayOut);
  18. }
  19. function toggleVisible() {
  20. if (kbd.isVisible()) {
  21. kbd.setVisible(false);
  22. } else {
  23. kbd.setVisible(true);
  24. }
  25. }
  26. google.setOnLoadCallback(onLoad);
  27. </script>
So how can you call JavaScript functions in your WebBrowser control? Call the InvokeScript method on the HtmlDocument.
.NET CODE (winforms)
  1. Sub SHOW_HIDE_VIR_KEYBOARD()
  2. With Me.WBrowser
  3. .Document.InvokeScript("toggleVisible", New Object() {""}) 'call the javascript from the .htm files
  4. End With
  5. End Sub
  6. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdShow.Click
  7. SHOW_HIDE_VIR_KEYBOARD()
  8. End Sub
  9. Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
  10. With Me.WBrowser
  11. .Document.GetElementById("txtLang").InnerText = Trim(Me.ComboBox1.Text) 'parse data from winforms to Htm files
  12. .Document.InvokeScript("ChangeLayout", New Object() {""}) 'call the javascript from the .htm files
  13. End With
  14. End Sub
Conclusions:
With the ability to call JavaScript from .NET App you can now embed and extend web applications into native applications with ease. A native application gives you more control over the environment and access to computer resources that you cannot access from a web page. You can Mashup web applications with computer hardware or software in new and interesting ways.
For the complete sample please download the demo project
For questions just Contact me @ the Addresses below:
Download Code: 
Sample Project
Facebook Fan Page



comments

Software Freedom Day Philippines 2011


Greetings from the Software Freedom Network!
We are cordially inviting you to participate in the celebration of Software Freedom Day (SFD) 2011 in the Philippines on September 17, 8:00am – 5:00pm at the University of Santo Tomas (UST). SFD is a yearly celebration of software freedom that aims to educate the public about the value and importance of software
freedom.
Free and open source software (FOSS) are free, high-quality alternatives to proprietary software ranging from your operating system to applications you would use at home, in business, education and other social purposes. The affordability and viablity of FOSS tools have important economic and social impacts especially in third world countries like the Philippines.
The FOSS community intends to share its role in advancing the Filipino people's right to freedom of information in this year's SFD celebration, with the theme "FOSS: Enabling Freedom of Information". The event will have parallel plenary sessions on topics and issues regarding FOSS in the morning, followed by
breakout sessions in the afternoon featuring introductory trainings on FOSS applications and concepts. Hundreds of teams worldwide celebrated SFD in 2010. Over 700 celebrants trooping to the University of the Phililppines Diliman Campus and around 1,500 pre-event celebrants in Lipa City College. And we are expecting more participants this year! Your full participation in the event would definitely contribute to this year's success.
The SFD 2011 network is composed of the Computer Professionals' Union as the main organizer, and the University of Sto. Tomas Computer Science Society as host organization. Partner organizations supporting the event are Junior Computer Professionals' Union, UP Network for Educational Technology, ACT Teachers, Office of Rep. Hon. Teddy Casiño, Taguig City University Developers Society, Polytechnic University of the Philippines Taguig Computer Society, Technological University of the Philippines Manila Computer Association, Philippine Blender Users Group, GroupAid, OpenStreetMap Philippines, Exist Global, DevCon, Wikimedia Philippines, Mozilla Firefox, and many more.
We are still accepting interested partner organizations.
Thank you very much, and thank you for your full participation. Let the world know that CHANGE is
FOSSible!
Join vis FB!
Source: 
comments

Wednesday 6 June 2012

Sending SMS using AT Commands via GSM Modem/GSM Phone (receiving SMS-updated)

SMS Server VB Classic version

THE FULL SEND AND RECEIVED SMS SERVER with  complete Source Codes for developers are available to purchase.
.NET version is also available 
Feel free to contact me at the addresses and links below:
Demo:
This a sample how to send SMS using AT Commands like in Hyper Terminal via GSM Modem or compatible GSm phone attatched to the PC Comport or USB port..
For this sample i used Huawei E160 GSM/HSDPA/GPRS modem..
demonstrate how to use MSComm Control in VB6 in order to send data to the GSM Modem
TODO:
this code may not work with other modem so better check your modem's specs and manual
check your modem's settings (baud Rate,RtsHold,HandShake, etc .and comport number in order to run this project..
Good NEWS:
java and php version will out this month..
THE FULL SEND AND RECEIVED SMS SERVER with  complete Source Codes for developers are available to purchase.
Feel free to contact me at the addresses and links below:
feel free to use and improved my sample code, 
Goodluck
Questions and request?
Download Code: 
Sample Project
Facebook Fan Page

comments

Google Acquires Meebo Chat And Social Network



It’s been revealed today that Google has acquired chat and social sharing website Meebo, for an undisclosed sum. Meebo began its life back in 2005 as a browser based instant messaging program, which supported various different IM Services. Including Facebook Chat, Google Talk, CafeMom to name just a few.



Meebo then expanded its service into Meebo Bar, that allows its 190 million unique users, to chat with friends via hundreds of websites, and currently send over 90 million messages daily through its service.
Meebo also has iOS and Android application developed for its service. Both Google and Beebo have approved the transaction that is subject to customary closing conditions. Meebo explained on its blog post today.
“Together with Google, we’re super jazzed to roll up our sleeves and get cracking on even bigger and better ways to help users and website owners alike,”-”We’ve had a blast building Meebo so far and we’re really excited to start the next leg of our journey.”

Source: IntoMobile
comments

How to use GOOGLE MAP API and GOOGLE Earth PLUG-IN in VB6



This tutorial shows how to use Google Map API and google earth Plugins in vb 6. I used HTML file to view the Google Map interface in VB form. I used this in my GPS SMS, Tracking System, Flight Simulation and some Mapping projects so i cannot provide the complete project , just the sample how to run the API in your VB Form. You can figure it Out
 TODO; 
>fast internet connection is needed to run the sample >for this sample i used my current Latitude and longitude to plot the placemark. you can freely customize or improved it and use any programming language that you want(PHP, C#, HTML, ASP.NET, Android, FLASH and many more. 


Goodluck Questions and request or Custom projects?



Download Code: 
Sample Project
Facebook Fan Page

comments

.NET Code (Sending and Receiving SMS using AT Commands via GSM Phone )

You can request for the Demo version or obtain the full source code of .NET SMS Server (pure AT commands, no OCX or dll) , just contact me @ the addresses below.







comments

.NET TV Tuner (Digital/Cable/Analog )



By 2015 all analog/Cable TV will be replalced by Digital TVs using Digital Signal like in Japan and other advance countries
The NTC decided that the Philippines will use and adopt the ISDB-T, finally.
So geek-gadgets people can watch live HD Channels for  free and Paid (PPV) from their PSP, Mobile Phones ,Tablets and ofcource PC and Laptops.
Sources:
I decided to do a research in order to interface and  create a Windows based Digital TV Tuner using .NET and COM32 components. 

Hardware Requirements:
1)Digital TV Tuner Installed (in my case I used Pixel View and Encore TV Tuners)
Programming Requirements:
1)MSVidCtl (COM32 Components)
sample Codes still in BETA.

Thanks and Enjoy!!! HAppy Coding!!!
Download Code: 
Sample Project
Facebook Fan Page




comments