PWCT 1.9 Art Documentation ( http://doublesvsoop.sourceforge.net )

2006-2011, Mahmoud Fayed ( msfclipper@users.sourceforge.net )

_____________________________________________________________________________________

 

Language Extension (Call DLL Function)

----------------------------------------

 

        ....data as expression.... DLL library to use

        ....data as value.... DLL function to call with parameters ....data as value....

        With respect to DLL functions which return a value

        The value will be stored in [Output] variable.

 

CallDLL.nova
--------------
 
I want window 
The window title is "Call Dll - Play Sound , File Sample.wav"
 
[myarray]. = (3).
[myarray]\(1)\(1). = (string). [myarray]\(1)\(2). = "(sample.wav)"
[myarray]\(2)\(1). = (number). [myarray]\(2)\(2). = (0).
[myarray]\(3)\(1). = (number). [myarray]\(3)\(2). = (0).
"(winmm.dll)" Dll Library to use
"PlaySound" dll function to call with parameters "myarray"

 

shot141.JPG

 

Sound Player Library (SoundPlayerLib.nova)
--------------------------------------------
 
        1 - Source Code 
               1.1 - SoundPlayerLib.nova 
               1.2 - SoundPlayerLibDemo.nova
        2 - Screen Shot
 
Sound Player Library procedures
---------------------------------
 
        * MySoundOpen  [input]. = "(filename.mp3)"
        * MySoundPlay
        * MySoundPause
        * MySoundResume
        * MySoundClose 
        

 

 

Sound Player Library Source
-----------------------------
 
        1 - SoundPlayerLib.nova
        2 - SoundPlayerLibDemo.nova
 
SoundPlayerLib.nova
---------------------
 
Procedure MySoundOpen.
[temparray]. = (4).
[temparray]\(1)\(1). = (string). [temparray]\(1)\(2). = '(open ")[input](" type mpegvideo alias MediaFile)'
[temparray]\(2)\(1). = (number). [temparray]\(2)\(2). = '(nil)'
[temparray]\(3)\(1). = (number). [temparray]\(3)\(2). = '(0)'
[temparray]\(4)\(1). = (number). [temparray]\(4)\(2). = '(0)'
 
"(winmm.dll)" Dll Library to use
"mciSendString" dll function to call with parameters "temparray"
end procedure
 
Procedure MySoundPlay.
 
[temparray]. = (4).
[temparray]\(1)\(1). = (string). [temparray]\(1)\(2). = '(play MediaFile)'
[temparray]\(2)\(1). = (number). [temparray]\(2)\(2). = '(nil)'
[temparray]\(3)\(1). = (number). [temparray]\(3)\(2). = '(0)'
[temparray]\(4)\(1). = (number). [temparray]\(4)\(2). = '(0)'
 
"(winmm.dll)" Dll Library to use
"mciSendString" dll function to call with parameters "temparray"
 
end procedure
 
Procedure MySoundPause.
 
[temparray]. = (4).
[temparray]\(1)\(1). = (string). [temparray]\(1)\(2). = '(pause MediaFile)'
[temparray]\(2)\(1). = (number). [temparray]\(2)\(2). = '(nil)'
[temparray]\(3)\(1). = (number). [temparray]\(3)\(2). = '(0)'
[temparray]\(4)\(1). = (number). [temparray]\(4)\(2). = '(0)'
 
"(winmm.dll)" Dll Library to use
"mciSendString" dll function to call with parameters "temparray"
 
end procedure
 
Procedure MySoundClose.
 
[temparray]. = (4).
[temparray]\(1)\(1). = (string). [temparray]\(1)\(2). = '(close MediaFile)'
[temparray]\(2)\(1). = (number). [temparray]\(2)\(2). = '(nil)'
[temparray]\(3)\(1). = (number). [temparray]\(3)\(2). = '(0)'
[temparray]\(4)\(1). = (number). [temparray]\(4)\(2). = '(0)'
 
"(winmm.dll)" Dll Library to use
"mciSendString" dll function to call with parameters "temparray"
 
end procedure
 
Procedure MySoundResume.
 
[temparray]. = (4).
[temparray]\(1)\(1). = (string). [temparray]\(1)\(2). = '(resume MediaFile)'
[temparray]\(2)\(1). = (number). [temparray]\(2)\(2). = '(nil)'
[temparray]\(3)\(1). = (number). [temparray]\(3)\(2). = '(0)'
[temparray]\(4)\(1). = (number). [temparray]\(4)\(2). = '(0)'
 
"(winmm.dll)" Dll Library to use
"mciSendString" dll function to call with parameters "temparray"
 
end procedure
 
 
SoundPlayerLibDemo.nova
-------------------------
 
Application title is Sound Player Library Demo. 
 
do file "SoundPlayerLib.nova"
 
I want window 
The window title is "Sound Player Library Demo"
 
i want button and button caption is "open test.mp3" and button top is 50.
button name is btn1.
 
i want button and button caption is play. and button top is 100.
button name is btn2.
 
i want button and button caption is pause. and button top is 150.
button name is btn3.
 
i want button and button caption is resume. and button top is 200.
button name is btn4.
 
i want button and button caption is close. and button top is 250.
button name is btn5.
 
btn1 mouse click. instructions are
        [input]. = "(test.mp3)" and do procedure MySoundOpen.
end of instructions
 
btn2 mouse click. instructions are
        do procedure MySoundPlay.
end of instructions
 
btn3 mouse click. instructions are
        do procedure MySoundPause.
end of instructions
 
btn4 mouse click. instructions are
        do procedure MySoundResume.
end of instructions
 
btn5 mouse click. instructions are
        do procedure MySoundClose.
end of instructions
 

 

shot142.JPG

 

Sound Recorder Library (SoundRecorderLib.nova)
------------------------------------------------
 
        1 - Source Code 
               1.1 - SoundRecorderLib.nova 
               1.2 - SoundRecorderLibDemo.nova
        2 - Screen Shot
 
Sound Recorder Library procedures
-----------------------------------
 
        * MySoundRecord
        * MySoundSave  [input]. = "(filename.wav)"
        

 

 

Sound Recorder Library Source
-------------------------------
 
        1 - SoundRecorderLib.nova
        2 - SoundRecorderLibDemo.nova
 
SoundRecorderLib.nova
-----------------------
 
Procedure MySoundrecord.
 
        "(winmm.dll)" Dll Library to use
 
        [temparray]. = (4).
        [temparray]\(1)\(1). = (string). [temparray]\(1)\(2). = '(open new Type waveaudio Alias recsound)'
        [temparray]\(2)\(1). = (string). [temparray]\(2)\(2). = '()'
        [temparray]\(3)\(1). = (number). [temparray]\(3)\(2). = '(0)'
        [temparray]\(4)\(1). = (number). [temparray]\(4)\(2). = '(0)'
        "mciSendString" dll function to call with parameters "temparray"
 
        [temparray]\(1)\(1). = (string). [temparray]\(1)\(2). = '(record recsound)'
        "mciSendString" dll function to call with parameters "temparray"
 
End procedure
 
Procedure MySoundSave.
 
        "(winmm.dll)" Dll Library to use
 
        [temparray]. = (4).
        [temparray]\(1)\(1). = (string). [temparray]\(1)\(2). = '(save recsound ) [input]'
        [temparray]\(2)\(1). = (string). [temparray]\(2)\(2). = '()'
        [temparray]\(3)\(1). = (number). [temparray]\(3)\(2). = '(0)'
        [temparray]\(4)\(1). = (number). [temparray]\(4)\(2). = '(0)'
        "mciSendString" dll function to call with parameters "temparray"
 
        [temparray]\(1)\(1). = (string). [temparray]\(1)\(2). = '(close recsound)'
        "mciSendString" dll function to call with parameters "temparray"
 
End procedure
 
 
SoundRecorderLibDemo.nova
---------------------------
 
Application title is Sound Recorder Library Demo. 
 
do file "SoundRecorderLib.nova"
 
I want window 
The window title is "Sound Recorder Library Demo"
 
i want button and button caption is "Record" and button top is 50.
button name is btn1.
 
btn1 mouse click. instructions are
        do procedure MySoundRecord.
end of instructions
 
i want button and button caption is "Save to test.wav" and button top is 100.
button name is btn2.
 
btn2 mouse click. instructions are
        [input]. = "(test.wav)" do procedure MySoundSave.
end of instructions
 

 

 

shot143.JPG

 

Movie Player Library (MoviePlayerLib.nova)
--------------------------------------------
 
        1 - Source Code 
               1.1 - MoviePlayerLib.nova 
               1.2 - MoviePlayerLibDemo.nova
        2 - Screen Shot
 
Movie Player Library procedures
---------------------------------
 
        * MyMovieOpen  
               [input] : filename.avi
               [input2]: Alias  , MyMovie for example
                [input3]: window handle , use command (Window handle to)
        * MyMoviePlay
               [input] : Alias
               [input2] : Movie region as : left top width height
        * MyMoviePause
               [input] : Alias
        * MyMovieResume
               [input] : Alias , MyMovie for example
        * MyMovieClose 
               [input] : Alias , MyMovie for example
        

 

 

Movie Player Library Source
-----------------------------
 
        1 - MoviePlayerLib.nova
        2 - MoviePlayerLibDemo.nova
 
MoviePlayerLib.nova
---------------------
 
Procedure MyMovieOpen.
 
        :note: " [input] = filename.avi  [input2] = Alias  [input3] = window handle"
 
        "(winmm.dll)" Dll Library to use
 
        [temparray]. = (4).
        [temparray]\(1)\(1). = (string). [temparray]\(1)\(2). = '(open ")[input](" type AVIvideo  alias ) [input2] ( style child parent ) [input3]'
        [temparray]\(2)\(1). = (number). [temparray]\(2)\(2). = '(0)'
        [temparray]\(3)\(1). = (number). [temparray]\(3)\(2). = '(128)'
        [temparray]\(4)\(1). = (number). [temparray]\(4)\(2). = '(0)'
 
        "mciSendString" dll function to call with parameters "temparray"
 
end procedure
 
Procedure MyMoviePlay.
 
        :note: " [input] = Alias  [input2] = movie region entered as left top width height"
 
        "(winmm.dll)" Dll Library to use
 
        [temparray]. = (4).
        [temparray]\(1)\(1). = (string). [temparray]\(1)\(2). = '(put ) [input] ( window client at ) [input2]'
        [temparray]\(2)\(1). = (number). [temparray]\(2)\(2). = '(0)'
        [temparray]\(3)\(1). = (number). [temparray]\(3)\(2). = '(128)'
        [temparray]\(4)\(1). = (number). [temparray]\(4)\(2). = '(0)'
 
        "mciSendString" dll function to call with parameters "temparray"
 
        [temparray]\(1)\(1). = (string). [temparray]\(1)\(2). = '(play ) [input]'
        "mciSendString" dll function to call with parameters "temparray"
 
End procedure
 
Procedure MyMoviePause.
 
        :note: " [input] = Alias "
 
        "(winmm.dll)" Dll Library to use
 
        [temparray]. = (4).
        [temparray]\(1)\(1). = (string). [temparray]\(1)\(2). = '(pause ) [input]'
        [temparray]\(2)\(1). = (number). [temparray]\(2)\(2). = '(0)'
        [temparray]\(3)\(1). = (number). [temparray]\(3)\(2). = '(128)'
        [temparray]\(4)\(1). = (number). [temparray]\(4)\(2). = '(0)'
 
        "mciSendString" dll function to call with parameters "temparray"
 
End procedure
 
Procedure MyMovieResume.
 
        :note: " [input] = Alias "
 
        "(winmm.dll)" Dll Library to use
 
        [temparray]. = (4).
        [temparray]\(1)\(1). = (string). [temparray]\(1)\(2). = '(resume ) [input]'
        [temparray]\(2)\(1). = (number). [temparray]\(2)\(2). = '(0)'
        [temparray]\(3)\(1). = (number). [temparray]\(3)\(2). = '(128)'
        [temparray]\(4)\(1). = (number). [temparray]\(4)\(2). = '(0)'
 
        "mciSendString" dll function to call with parameters "temparray"
 
 
End procedure
 
Procedure MyMovieClose.
 
        :note: " [input] = Alias "
 
        "(winmm.dll)" Dll Library to use
 
        [temparray]. = (4).
        [temparray]\(1)\(1). = (string). [temparray]\(1)\(2). = '(close ) [input]'
        [temparray]\(2)\(1). = (number). [temparray]\(2)\(2). = '(0)'
        [temparray]\(3)\(1). = (number). [temparray]\(3)\(2). = '(128)'
        [temparray]\(4)\(1). = (number). [temparray]\(4)\(2). = '(0)'
 
        "mciSendString" dll function to call with parameters "temparray"
 
End procedure
 
 
MoviePlayerLibDemo.nova
-------------------------
 
Application title is Movie Player Library Demo. 
 
do file "MoviePlayerLib.nova"
 
I want window and window back color is white. and window width is 700.
The window title is "Movie Player Library Demo"
 
i want button and button caption is "open test.avi" and button top is 50.
button name is btn1.
 
i want button and button caption is play. and button top is 100.
button name is btn2.
 
i want button and button caption is pause. and button top is 150.
button name is btn3.
 
i want button and button caption is resume. and button top is 200.
button name is btn4.
 
i want button and button caption is close. and button top is 250.
button name is btn5.
 
btn1 mouse click. instructions are
        [input]. = "(test.avi)"
        [input2]. = (mymovie).
        window handle to [input3].
        do procedure MyMovieOpen.
end of instructions
 
btn2 mouse click. instructions are
        [input]. = (mymovie).
        [input2]. = (150 10 400 300).
        do procedure MyMoviePlay.
end of instructions
 
btn3 mouse click. instructions are
        [input]. = (mymovie). and do procedure MyMoviePause.
end of instructions
 
btn4 mouse click. instructions are
        [input]. = (mymovie). and do procedure MyMovieResume.
end of instructions
 
btn5 mouse click. instructions are
        [input]. = (mymovie). and do procedure MyMovieClose.
end of instructions
 

 

 

shot144.JPG

 

Component Object Model (COM) 
------------------------------
 
        * ....data as expression.... COM Object to create of type ....data as expression....
        * ....data as expression.... COM Object to use
        * ....data as expression.... COM Property to set ....data as expression....
        * ....data as expression.... COM Property to get ....data as expression....
        * ....data as expression.... COM Method to call with parameters ....data as value....
 

 

I want window and the window title is COM Test.

I want button and button caption is Open Word Application. button width = 150.

button name = btn1.

I want button and button caption is Hide Word.

button name = btn2. and button left = 200.

I want button and button caption is Show Word.

button name = btn3. and button left = 350.

 

procedure btn1 mouse click.

    [myobj]. COM Object to create of type "(Word.Application)"

    [myobj]. COM Object to use

    "(Documents:Add)" COM method to call with parameters nothing.

    (visible). COM Property to set (1).

endprocedure

 

procedure btn2 mouse click.

    [myobj]. COM Object to use and (visible). COM Property to set (0).

endprocedure

 

procedure btn3 mouse click.

    [myobj]. COM Object to use and (visible). COM Property to set (1).

endprocedure

 

shot146.JPG

 

ADODB Sample
--------------
 
        1 - Source Code (HTML File Generated using Notepad++)
        2 - Screen Shot

 

 

I want window contains LISTBOX and the window title is Using ADODB.

Window width = 600.  and WINDOW HEIGHT = 500.

Window back color is white.

 

Listbox width = 350. and LISTBOX HEIGHT = 450.

Listbox back color is silver.

Listbox fore color is Black.

Listbox font name is arial.

Listbox font size is 14.

 

I want button and button caption is Test ADODB.

Button name = btn1. and button LEFT = 400. and button width = 150.

 

procedure btn1 mouse click.

 

    :Note: " Connect to the Database Test.MDB"

    [MYCON]. COM OBJECT TO CREATE OF TYPE "(ADODB.Connection)"

    [MYCON]. COM Object to use

    [MYARRAY]. = (1).

    [MYARRAY]\(1)\(1). = (string).

    [MYARRAY]\(1)\(2). = '(Provider=MSDASQL.1;Persist Security Info=False;Extended Properties="dsn=MS Access Database;uid=";Initial Catalog=test.mdb)'

    "(OPEN)" COM method to call with parameters MYARRAY.

 

    :Note: " Open Table MainTable"

    [MYRS]. COM OBJECT TO CREATE OF TYPE "(ADODB.Recordset)"

    [MYRS]. COM Object to use

    (CursorType). COM Property to set (3).

    (LockType). COM Property to set (3).

    (ActiveConnection). COM Property to set [MYCON].

    [MYARRAY]. = (1).

    [MYARRAY]\(1)\(1). = (String).

    [MYARRAY]\(1)\(2). = '(Select * from MainTable)'

    "(OPEN)" COM method to call with parameters MYARRAY.

 

    :Note: " Delete All Records"

    '(RECORDCOUNT)' COM PROPERTY TO GET [MYMAX].

    doif [mymax] > (0).

        [X]. = (1).

        DoWhile [x] <= [MYMAX].

            "(movefirst)" COM method to call with parameters .

            "(delete)" COM method to call with parameters .

            "(update)" COM method to call with parameters .

            [x]. = [x] + (1).

        endwhile

    endif

       

    :Note: " Add 10 Records "  

    [X]. = (1).

    DoWhile [x] <= (10).

        "(AddNew)" com method to call with parameters .

        '|fields:item("Number"):value|' COM PROPERTY TO SET [x].

        '|fields:item("Square"):value|' COM PROPERTY TO SET [x] x [x].

        "(UPDATE)" COM method to call with parameters .

        [x]. = [x] + (1).

    EndWhile

   

    :Note: " Show All Records "

    "(movefirst)" COM method to call with parameters .

    '(RECORDCOUNT)' COM PROPERTY TO GET [MYMAX].

    listbox must add item --------------------------.

    listbox must add from (Records Count = ) [MYMAX].

    listbox must add item --------------------------.

    listbox must add item Number             Square.

    listbox must add item --------------------------.

    [X]. = (1).

    DoWhile [x] <= [MYMAX].

        '|fields:item("Number"):value|' COM PROPERTY TO GET [V1].

        '|fields:item("Square"):value|' COM PROPERTY TO GET [V2].

        Listbox must add from [v1] (                      ) [v2].

        "(movenext)" COM method to call with parameters .

        [x]. = [x] + (1).

    EndWhile

   

    :Note: " Close Recordset"

    "(CLOSE)" COM method to call with parameters .

 

    :Note: " Close Connection"

    [MYCON]. COM Object to use and "(CLOSE)" COM method to call with parameters .

 

endprocedure

 

 

SHOT148.JPG