topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Monday March 1, 2021, 5:02 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Gerome [ switch to compact view ]

Pages: prev1 2 3 4 5 6 [7]
151
Developer's Corner / FBSL - XML Class
« on: February 07, 2006, 05:02 AM »
Hello,

Here's an XML Class to manipulate XML files under windows using XML DOM COM interface...

$Apptype CONSOLE
#Option Explicit


' ---------------------------------------------
' // Sample Test
' ---------------------------------------------
Dim %xml
CXml.Init()
xml = CXml.LoadXml( ".\Album.xml" )
    If CXml.myStrerr = "" Then
        CXml.GetNodeListCount( "title" )
        ? "The 1st 'title' of the 1st 'Album' tag is :", CrLf, CXml.GetNodeListItem(1), CrLf
        CXml.GetNodeListCount( "artist" )
        ? "Its 'artist' is :", CrLf, CXml.GetNodeListItem(1), CrLf       
    End If
CXml.Terminate()
Pause


' ---------------------------------------------
'// XML Class
' ---------------------------------------------
#region XML Class by Gerome GUILLEMIN
Class CXml()
Dim %myObj, %theNodeList, $myStrerr

    Sub Init()
        ComWarnings(False)
        myObj = CreateObject( "Microsoft.XMLDOM" )
        PutValue( myObj, ".async(%b)", False )
        PutValue( myObj, "ValidateOnParse = %b", True )
    End Sub

    Function %LoadXml( Byref $szXmlFileName ) 'As Object
        If myObj = False Then Return False
        If FileExist( szXmlFileName ) = False Then
            myStrerr = "File does not exist!"
            Return False
        End If
        CallMethod( myObj, ".Load(%s)", szXmlFileName )
        If GetValue( "%d", myObj, ".parseError.errorCode" ) <> False Then
            myStrerr = "Error at line : " & GetValue( "%d", myObj, ".parseError.line" ) & _
            GetValue( "%s", myObj, ".parseError.srcText" )
            Return False
        End If
        Return myObj
    End Function

    Function %GetNodeListCount( Byref $szNodeName )
        If myObj = 0 Then Return False
        If theNodeList <> False Then ReleaseObject(theNodeList)
        Set theNodeList = GetValue( "%o", myObj, ".getElementsByTagName(%s)", szNodeName )
        If theNodeList = False Then
            ReleaseObject(theNodeList)
            Return False
        Else
            Return GetValue( "%d", theNodeList, ".Length" )
        End If
    End Function

    Function $GetNodeListItem( Byref %theiTem )
        If myObj = 0 Then Return ""
        Return GetValue( "%s", theNodeList, ".item(%d).text", theiTem-1 )
    End Function

    Sub Terminate()
        If theNodeList <> False Then ReleaseObject(theNodeList)
        If myObj <> False Then ReleaseObject(myObj)
        myStrerr = ""
        ComWarnings(True)
    End Sub

End Class
' ---------------------------------------------
#endregion
' ---------------------------------------------

To test this class, you need the following XML file (saved as 'album.xml') :
<?xml version="1.0"?>
<Albums>
   <Album ref="CD142" category="Folk">
      <title>Boil The Breakfast Early</title>
      <artist>The Chieftains</artist>
   </Album>
   <Album ref="CD720" category="Pop">
      <title>Come On Over</title>
      <artist>Shania Twain</artist>
   </Album>
   <Album ref="CD024" category="Country">
      <title>Red Dirt Girl</title>
      <artist>Emmylou Harris</artist>
   </Album>
</Albums>

Enjoy FBSL :)

152
Developer's Corner / FBSL - How to embedd a flash PACMAN
« on: February 06, 2006, 05:46 PM »
Hello,

This code is an FBSL one.
This will show you how to embedd a flash game into a GUI application :)

To compile this script into a real stand alone EXEcutable, i invite you to copy/paste this script there :
http://gedd123.free..../studio/fbsl2exe.php

'// ----------------------------------------
'// ATL control
'// Purpose : running a Flash GAME
'// Author  : Gerome GUILLEMIN
'// ----------------------------------------
Dim %oFlash, %hWnd

Sub Form_Load()
   Apicall( "AtlAxWinInit", "ATL" )
   Dim $WinName = "{D27CDB6E-AE6D-11CF-96B8-444553540000}"
   hWnd = FBSL_Control("AtlAxWin", Me, WinName, 0, 0, 15, 620, 460, WS_Child + WS_Visible, WS_Ex_ClientEdge)
   Apicall( "AtlAxGetControl", "ATL", hWnd, @oFlash )
   PutValue( oFlash, ".Movie=%s", "http://www.80smusiclyrics.com/games/pacman/pacman.swf" )
End Sub

Sub RefreshAfxControl()
Dim %Lefti, %Topi, %Righti, %Bottomi
   GetClientRect( Me, Lefti, Topi, Righti, Bottomi )
   ReSize(hWnd, 0, 30, Righti - 15, Bottomi - 60)
   Refresh(hWnd)
End Sub

Sub Main()
   Fbsl_SetText( Me, "PaC-man..." )
   Resize(Me, 0, 0, 640, 480 )
   Center(Me): Show(Me): Form_Load()
   RefreshAfxControl()
   Begin Events
      If CBMsg = WM_CLOSE Then
          ReleaseObject( oFlash ): ExitProgram(0)
      End If
      If CBMSG = WM_SIZE Then RefreshAfxControl()
   End Events
End Sub

Any comments ? :)
Enjoy ;)

153
Post New Requests Here / Re: Farr's calculator
« on: February 06, 2006, 05:05 PM »
Hello,

Yes, i'm the original FBSL author since 2001 :)
FBSL was made for Basic lovers, but one can easily come from C, PHP or Pascal :)
It's simple to use and versatile, it's documentation is about 500 pages and quite complete, bundled with tons of samples + tutorials!
For people who are aware of FBSL capacities, i invite you to get the full Setup (1.5 MB) there :
http://gedd123.free.fr/FBSLv3.exe

And thanks to Mouser for his support!
Enjoy ;)

Pages: prev1 2 3 4 5 6 [7]