Quantcast Programming: Purebasic Webbrowser - digitalFAQ.com Forums [Archives]
  #1  
04-18-2004, 03:37 PM
rds_correia rds_correia is offline
Free Member
 
Join Date: Apr 2003
Location: Chinese Democracy starts now!
Posts: 2,563
Thanks: 1
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by kwag
Now we're off topic, but here it goes
(Please reply or comment on the programming languages threads, for further discussions )

Quote:
Originally Posted by Latexxx
C#:
Code:
namespace Microsoft.Samples.WinForms.Cs.SimpleHelloWorld {
    using System;
    using System.Windows.Forms;

    public class SimpleHelloWorld : Form {

        [STAThread]
        public static int Main(string[] args) {
            Application.Run(new SimpleHelloWorld());
            return 0;
        }

        public SimpleHelloWorld() {
            this.Text = "Hello World";
        }
    }
}
VB.net:
Code:
Imports System
Imports System.ComponentModel
Imports System.Drawing
Imports System.Windows.Forms

Namespace Microsoft.Samples.WinForms.VB.SimpleHelloWorld

    Public Class SimpleHelloWorld
        Inherits System.Windows.Forms.Form

        'Run the application
        <STAThread()> Shared Sub Main()
            System.Windows.Forms.Application.Run(New SimpleHelloWorld())
        End Sub

        Public Sub New()
            MyBase.New()
            Me.Text = "Hello World"
        End Sub
    End Class

End Namespace
End Sub/Namespace: just stupid

But its your choiche, not mine. Get your program ready![/list]
Yep. It's my choice, and that's exactly why I chose PureBasic for most of the programming I do now.
Unless I have to do a device driver, then I'll do it in C ( which is what C was designed to do. Low level stuff)
Sadly, the industry chose C/C++ for high level applications, which is probably the biggest mistake

If anyone looks closely, those samples only print "Hello World".
Well, this is what I call elegant What follows is the complete source for a complete small web browser
Code:
; ------------------------------------------------------------
;
;   PureBasic - MiniBrowser
;
;    (c) 2002 - Fantaisie Software
;
; ------------------------------------------------------------
;
; This program requiers the Microsoft freely distribuable 
; ATL.dll shared library.
;

Procedure ResizeWebWindow()
  ResizeGadget(10, -1, -1, WindowWidth(), WindowHeight()-52)
  ResizeGadget(4, -1, -1, WindowWidth()-185, -1)
  ResizeGadget(5, WindowWidth()-25, -1, -1, -1)
  ResizeGadget(6, -1, -1, WindowWidth(), -1)
EndProcedure


Procedure SizeCallback(WindowID, Message, wParam, lParam)

  ReturnValue = #PB_ProcessPureBasicEvents
  
  If Message = #WM_SIZE 
    UpdateStatusBar(0)
    ResizeWebWindow()
    ReturnValue = 1
  EndIf
  
  ProcedureReturn  ReturnValue
EndProcedure


If OpenWindow(0, 100, 100, 500, 300, #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget, "PureBasic MiniBrowser v1.0")

  CreateStatusBar(0, WindowID())
    StatusBarText(0, 0, "Welcome to the world's smallest Browser ! :)", 0)
      
  CreateGadgetList(WindowID())
    ButtonGadget(1,   0, 0, 50, 25, "Back")
    ButtonGadget(2,  50, 0, 50, 25, "Next")
    ButtonGadget(3, 100, 0, 50, 25, "Stop")
  
    StringGadget(4, 155, 5, 0, 20, "http://www.purebasic.com")
    
    ButtonGadget(5, 0, 0, 25, 25, "Go")
    
    Frame3DGadget(6, 0, 30, 0, 2, "", 2) ; Nice little separator
  
    If WebGadget(10, 0, 31, 0, 0, "http://www.purebasic.com") = 0 : MessageRequester("Error", "ATL.dll not found", 0) : End : EndIf
  
  AddKeyboardShortcut(0, #PB_Shortcut_Return, 0)
  
  ResizeWebWindow()
  
  SetWindowCallback(@SizeCallback())
  
  Repeat
    Event = WaitWindowEvent()
    
    Select Event
      Case #PB_Event_Gadget
      
        Select EventGadgetID()
          Case 1
            SetGadgetState(10, #PB_Web_Back)
          
          Case 2
            SetGadgetState(10, #PB_Web_Forward)
          
          Case 3
            SetGadgetState(10, #PB_Web_Stop)
          
          Case 5
            SetGadgetText(10, GetGadgetText(4))
            
        EndSelect      
      
      Case #PB_Event_Menu ; We only have one shortcut
        SetGadgetText(10, GetGadgetText(4))
      
    EndSelect
      
  Until Event = #PB_Event_CloseWindow
   
EndIf
That's what I call elegant
BTW, here's the compiled WebBrowser.exe, weighting at only ~18KB
http://www.kvcd.net/WebBrowser.exe

Also, here's a link to some of the commercial applications that have been written in PB.
These are VERY expensive applications, so PB is not a toy ( as many see it )
http://www.reelmedia.org/c3/
And look at the prices http://www.reelmedia.org/c3/03.html

So I really think once (not even twice) before coding anything in C/C++ these days

-kwag
Hey,
About this webbrowser Kwag: is it IE dependable? That is, if I don't have IE on my PC it doesn't work?
Or is it completely independant?
Cheers
__________________
Rui
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Site Staff / Ad Manager
 
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
04-18-2004, 03:44 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by rds_correia
Hey,
About this webbrowser Kwag: is it IE dependable? That is, if I don't have IE on my PC it doesn't work?
Or is it completely independant?
Cheers
Hi Rui,

As the source says on the top:
;
; This program requiers the Microsoft freely distribuable
; ATL.dll shared library.
;


You only need that DLL in your system.
You don't need IE at all

-kwag
Reply With Quote
  #3  
04-19-2004, 04:45 PM
rds_correia rds_correia is offline
Free Member
 
Join Date: Apr 2003
Location: Chinese Democracy starts now!
Posts: 2,563
Thanks: 1
Thanked 0 Times in 0 Posts
Oh man!
Just what I needed.
A small fast and effective webbrowser.
Do I have to buy it or is it freeware
Cheers buddy
__________________
Rui
Reply With Quote
  #4  
04-19-2004, 06:06 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by rds_correia
Oh man!
Just what I needed.
A small fast and effective webbrowser.
Do I have to buy it or is it freeware
Cheers buddy
The browser, or the development system
The browser is free, because I compiled it, and I own a license for the development system
If you want to create and distribute applications, then you must purchase the development system, which I consider one of the best software buys I've ever made 59.00 Euros

-kwag
Reply With Quote
  #5  
04-20-2004, 03:56 PM
rds_correia rds_correia is offline
Free Member
 
Join Date: Apr 2003
Location: Chinese Democracy starts now!
Posts: 2,563
Thanks: 1
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by kwag
The browser, or the development system
The browser is free, because I compiled it, and I own a license for the development system
Hehe. I was talking about the browser

Quote:
Originally Posted by kwag
If you want to create and distribute applications, then you must purchase the development system, which I consider one of the best software buys I've ever made 59.00 Euros
-kwag
That CHEAP
Man I still remember coding BASIC on ZX Spectrum and then on PC with gwbasic and some years later on TurboBasic.
Do you think I've lost the touch (that I never had anyway)
__________________
Rui
Reply With Quote
  #6  
04-20-2004, 04:10 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by rds_correia
Man I still remember coding BASIC on ZX Spectrum and then on PC with gwbasic and some years later on TurboBasic.
So did I
Quote:
Do you think I've lost the touch (that I never had anyway)
BASIC is so simple, and the new generations of BASICs are completely different to the "old" BASICs.
Now, some are even "Object Oriented", and just about everyone is structured (no more line numbers or needed GOTOs).
So if you are going to give PureBasic a try, you're in for many surprises
Clear syntax, easy and coincise language, and powerful as C, but with the speed of assembly language written code. That was one of the key factors that led me to buy and use the system. Plus it's feature rich
Code:
   - Huge set of internal commands (600+) to quickly and easily build any application or game
   - All BASIC keywords are supported
   - Very fast compiler which creates highly optimized executables
   - No external DLLs, runtime interpreter or anything else required when creating executables
   - Procedure support for structured programming with local and global variables
   - Access to full OS API for advanced programmers
   - Easy but very fast 2D game support trough dedicated libraries (DirectX, SDL, ...)
   - Easy and high quality 3D support based on OGRE
   - Optimal use of the available hardware by using highly optimized (assembly) commands
   - Source code is fully portable between AmigaOS, Windows and Linux, for both games and applications
   - Dedicated editor and development environment
   - Integrated debugger to easily trace programming bugs.
BTW, did you try the Pure Racer Demo
http://home.t-online.de/home/misztal/pureracer/

-kwag
Reply With Quote
  #7  
04-20-2004, 06:38 PM
Zyphon Zyphon is offline
Free Member
 
Join Date: Oct 2003
Location: London, England (UK)
Posts: 1,035
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by rds_correia
That CHEAP
Man I still remember coding BASIC on ZX Spectrum and then on PC with gwbasic and some years later on TurboBasic.
Do you think I've lost the touch (that I never had anyway)
OMG! I used to program with ZX Spectrum BASIC to on my trusty old ZX Spectrum +, brings back memories also on my friends Acorn Electron (With was based on the BBC Micro) I liked the Electrons basic with its procedure labels and stuff.

!Sigh! Brings back memories.

EDIT: >Here< is a link to said Acorn Electron if any1 might be interested. Also my old trusty ZX Speccy + >Here<.
__________________
Regards.

Michael.
Reply With Quote
  #8  
04-20-2004, 06:56 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Zyphon

EDIT: >Here< is a link to said Acorn Electron if any1 might be interested. Also my old trusty ZX Speccy + >Here<.
Then you might like this http://www.virtualacorn.co.uk/

Hey, don't laugh!, but the first computer I actually bought, was this one http://www.old-computers.com/museum/...asp?st=1&c=937

-kwag
Reply With Quote
  #9  
04-20-2004, 07:07 PM
Zyphon Zyphon is offline
Free Member
 
Join Date: Oct 2003
Location: London, England (UK)
Posts: 1,035
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by kwag
Quote:
Originally Posted by Zyphon

EDIT: >Here< is a link to said Acorn Electron if any1 might be interested. Also my old trusty ZX Speccy + >Here<.
Then you might like this http://www.virtualacorn.co.uk/

Hey, don't laugh!, but the first computer I actually bought, was this one http://www.old-computers.com/museum/...asp?st=1&c=937

-kwag
Thanks for that virtualcorn link Kwag much appreciated and OMG i remember the trusty old TRS80 by Tandy Radio Shack. I guess the kids of today would just call it a over powered calculator makes me feel old lol.

I also remember the Commodore Vic 20 & the Dragon 32 & 64 or and of course the Commordore 64. Happy days.

I know we are off topic a bit here going down that nostalgic road but do you remember the Sinclair QL comp? Check it out >here<
__________________
Regards.

Michael.
Reply With Quote
  #10  
04-20-2004, 07:39 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Zyphon
I know we are off topic a bit here going down that nostalgic road but do you remember the Sinclair QL comp? Check it out >here<
Yes, I remember reading about it, but I never had one
I did have a Sinclair ZX-81
But my biggest fun days in programming, were with my ATARI 800
And I did A LOT with that machine.
Circa 1983, I used an ATARI 800 at work, and I developed a paging encoder application, which was used as a test equipment where I worked at. The program generated Motorola 2 tone sequential paging tones, 5 tone, and also generated IMTS (Improved Mobile Telephone System) signaling to "ring" the car telephones we used at that time. This was pre-cellular times
It also generated what was called "Golay Sequential Code" digital paging format, via the Joystick I/O ports.
What I did was I programmed some of the input ports as output, and then implemented the software in ATARI assembler
The data would be fed directly to a signal generator, and depending on the menu options, either analog audio out of the sound connector or digital data out of the joystick ports, would be fed via a simple capacitor/resistor attenuator/buffer, and that's how test paging was done at the workbench by the technicians.

I also ripped out the digital logic out of an old Motorola (2 tone) paging terminal, and wrote a program with the ATARI 800 ( again using the joystick ports ) and then the ATARI would detect via 5 bits ( 4 for data, 1 for activity ) the touch tones that an operator was keying in, and I would map the DTMF data to a lookup table, and generate the corresponding 2 tone or 5 tone paging signals for the addressed pager, key up the transmitter via microwave (Motorola Starpoint, MR-200, and MC-400 channel bank. I still remember the names ), and send the page
Damn, those were the days
All done with a 24KB of RAM and at 1.77Mhz and on one 80KB floppy disk

Sorry, now I really went off topic

-kwag
Reply With Quote
  #11  
04-20-2004, 08:13 PM
Zyphon Zyphon is offline
Free Member
 
Join Date: Oct 2003
Location: London, England (UK)
Posts: 1,035
Thanks: 0
Thanked 0 Times in 0 Posts
Lol Wow! that sounded like fun work mind you i bet it was hard work sometimes. I remember programming in Assembly language on my Speccy with all those nmemonics for the Z80, me and a friend of mine was working on making a game but we only half completed it before the good old Amiga 500 came out then it was the Amiga/Atari ST war.

Off topic again sorry.
__________________
Regards.

Michael.
Reply With Quote
  #12  
04-20-2004, 08:22 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Oh yes, it was fun
Actually, it was more fun that writing PC software today
Those machines were so "rich" in specialized hardware, like the ATARI, which had a special chips (GTIA) for graphics, POKEY, ANTIC, etc., and you could do so much with so little RAM
For example, today, a statement such as:PRINT "Hello World!" in Visual Basic, takes ~2MB in runtime and libraries What a joke
In 1982, a complete game for an ATARI 800, written in assembler, FORTH or even ATARI BASIC, would fit in 8KB
What happened
As I've said before: We're going backwards in time
Maybe that's one reason I like PureBasic so much It's SO efficient
(Now we're really derailed off topic )

-kwag
Reply With Quote
  #13  
04-21-2004, 04:08 AM
Zyphon Zyphon is offline
Free Member
 
Join Date: Oct 2003
Location: London, England (UK)
Posts: 1,035
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by kwag
For example, today, a statement such as:PRINT "Hello World!" in Visual Basic, takes ~2MB in runtime and libraries What a joke
In 1982, a complete game for an ATARI 800, written in assembler, FORTH or even ATARI BASIC, would fit in 8KB
What happened
As I've said before: We're going backwards in time
Maybe that's one reason I like PureBasic so much It's SO efficient
(Now we're really derailed off topic )

-kwag
Yeah I know what you mean I loved programming in BASIC it was the most easiest program to write programs for I dont know why they dont use it so much these days, i mean they could just include a compiler with it that would convert it to machine code. I remember FORTH but I loved assembly language also.

Like you said you could make a game in just 8KB mind I guess games have gotten more complex today.

Also I still have my Commodore Amiga A1200 (Stored in a cubboard somewhere lol) I keep it for nostalgic reasons but to me the Amiga was also more efficient than PC's and storing data like for example it could format a floppy to 880k as opposed to the 720k on the pc.

I had the HDD version and installing games took less compared to the pcs of the day. With tools like Amos and Blitz Basic which I bought both of them and still have lol. Alas I never had an Atari ST but a friend of mine did and the music on that machine was awesome to.

Again sorry for the off-topic but I love talking about these old mahines as they pioneered what we take for granted these days.

I agree about VB 2MB just to put a PRINT statement is beyond a joke and I feel we need to get back to BASICs lol.
__________________
Regards.

Michael.
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming: PureBasic v4.0 beta released incredible Avisynth Scripting 3 02-08-2006 07:49 AM
Programming: PureBasic 3.94 released rds_correia Avisynth Scripting 4 09-22-2005 03:09 AM
Programming: Purebasic 3.92 has been released rds_correia Avisynth Scripting 4 01-31-2005 06:17 PM
Programming: Any courses in PureBasic available? danpos Avisynth Scripting 3 11-11-2004 04:53 AM
Programming: PureBasic looks like a must-buy Zyphon Avisynth Scripting 20 05-06-2004 09:00 AM

Thread Tools



 
All times are GMT -5. The time now is 04:59 AM  —  vBulletin © Jelsoft Enterprises Ltd