PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2] 3 4

Author Topic: CWindow Release Candidate 27  (Read 2104 times)

ganlinlao

  • FireFly3 User
  • Little Newbie FireFly
  • *
  • Posts: 23
Re: CWindow Release Candidate 27
« Reply #15 on: May 04, 2017, 12:59:36 AM »

hi,Josť Roca,Thanks your reply.

I will try to find any other convenient way to call Office.Application.

You have deleted the Cbstr,cbstrSA,csafeArray,cVariant,cdispinvoke class before, I copied back to RC27. I think it is very useful to me, although you are not satisfied with it.

In China, people generally use ms-office or Wps-office software (and ms-office very similar , also support for VBA, is also COM automation, for personal use is free), at least more than 3 million people learn VBA and use VBA. I have tried to use OpenOffice and Libre office, but it is not popular, and hardly anyone else uses it.
Some elementary schools use FreeBASIC to teach pupils to learn getting started programming, which is interesting.

thanks
ganlinlao
« Last Edit: May 04, 2017, 01:09:22 AM by ganlinlao »
Logged

ganlinlao

  • FireFly3 User
  • Little Newbie FireFly
  • *
  • Posts: 23
Re: CWindow Release Candidate 27
« Reply #16 on: May 14, 2017, 07:46:23 AM »

hi,Josť Roca

CwstrArray's sort method does not work

This is my test code:

#include once "afx/cwstrArray.inc"
#include once "afx/cwindow.inc"
using afx
dim myArr as cwstrArray=cwstrArray(4)
myArr.item(0)="1"
myArr.item(1)="2"
myArr.item(2)="3"
myArr.item(3)="4"
myarr.sort(false)
afxmsg myarr.item(2)

thanks
ganlinlao
Logged

Josť Roca

  • Moderator
  • Master FireFly Member
  • *****
  • Posts: 2444
    • Josť Roca Software
Re: CWindow Release Candidate 27
« Reply #17 on: May 14, 2017, 12:09:44 PM »

It does. It displays "2". What were you expecting?

You have specified to sort the array in descending order. Therefore myArr.item(0) becomes equal to "4", myArr.item(1)="3", myArr.item(2)="2" and myArr.item(3)="1".

Am I missing something?
Logged
Forum: http://www.jose.it-berater.org/smfforum/index.php
Website: http://www.jose.it-berater.org/index.html
SED Editor, TypeLib Browser, headers and examples.

ganlinlao

  • FireFly3 User
  • Little Newbie FireFly
  • *
  • Posts: 23
Re: CWindow Release Candidate 27
« Reply #18 on: May 14, 2017, 10:40:57 PM »

Today, the same code I recompiled, it can work
But the last time, if i added myArr.sort(false) code, the compiler can pass, it can not display, it is strange.
I apologize to you for taking your precious time

String concatenation, I'm used to using & because it can cast into a string type, but this time I do not know why
« Last Edit: May 14, 2017, 11:08:54 PM by ganlinlao »
Logged

Josť Roca

  • Moderator
  • Master FireFly Member
  • *****
  • Posts: 2444
    • Josť Roca Software
Re: CWindow Release Candidate 27
« Reply #19 on: May 15, 2017, 12:12:47 AM »

No need to apologize, but your problem was not with the Sort method, but in the use of the & operator with CWSTR strings.

As explained in the help file for the CWindow framework:

Quote
CWSTR almost behave as if it was a native data type, working directly with most intrinsic Free Basic string functions and operators, with some exceptions (e.g. LEFT, RIGHT, VAL, & operator) in which you may need that you use a double indirection, i.e. **cws, or the wstr property (e.g. cws.wstr)  to deference the string data.

Contrarily to the & operator, the + operator, always works.

Regarding MID as a statement, something like MID(cws, 2, 1) = "x" compiles but does not change the contents of the dynamic unicode string. MID(cws.wstr, 2, 1) = "x" or MID(**cws, 2, 1) = "x" works.

See also this thread: http://www.freebasic.net/forum/viewtopic.php?f=3&t=25191
« Last Edit: May 15, 2017, 12:34:57 AM by Josť Roca »
Logged
Forum: http://www.jose.it-berater.org/smfforum/index.php
Website: http://www.jose.it-berater.org/index.html
SED Editor, TypeLib Browser, headers and examples.

Josť Roca

  • Moderator
  • Master FireFly Member
  • *****
  • Posts: 2444
    • Josť Roca Software
Re: CWindow Release Candidate 27
« Reply #20 on: May 16, 2017, 11:29:47 PM »

A new project for the WinFBE editor: DShow_PlayClip. Demonstrates how to play videos using Direct Show.

Code: [Select]
' ########################################################################################
' Microsoft Windows
' DirectShow example.
' Allows to select a video clip and plays it.
' Based on an example by Vladimir Shulakov posted in the PowerBASIC forums:
' https://forum.powerbasic.com/forum/user-to-user-discussions/source-code/24615-directshow-small-example?t=23966
' Compiler: FreeBasic 32 & 64 bit
' Copyright (c) 2017 Josť Roca. Freeware. Use at your own risk.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################

#define UNICODE
#INCLUDE ONCE "Afx/CWindow.inc"
#INCLUDE ONCE "Afx/AfxCOM.inc"
#INCLUDE ONCE "win/uuids.bi"
#INCLUDE ONCE "win/dshow.bi"
#INCLUDE ONCE "win/strmif.bi"
#INCLUDE ONCE "win/control.bi"
USING Afx

DECLARE FUNCTION WinMain (BYVAL hInstance AS HINSTANCE, _
                          BYVAL hPrevInstance AS HINSTANCE, _
                          BYVAL szCmdLine AS ZSTRING PTR, _
                          BYVAL nCmdShow AS LONG) AS LONG

   END WinMain(GetModuleHandleW(NULL), NULL, COMMAND(), SW_NORMAL)

' // Menu identifiers
CONST ID_FILE_OPENCLIP = 40001
CONST ID_FILE_EXIT     = 40002

' // Custom message
CONST WM_GRAPHNOTIFY   = WM_USER + 13

' // Globals
DIM SHARED bIsPlaying AS BOOLEAN
DIM SHARED pIMediaControl AS IMediaControl PTR
DIM SHARED pIVideoWindow AS IVideoWindow PTR
DIM SHARED pIMediaEventEx AS IMediaEventEx PTR
DIM SHARED pIGraphBuilder AS IGraphBuilder PTR

' // Forward declaration
DECLARE FUNCTION WndProc (BYVAL hwnd AS HWND, BYVAL uMsg AS UINT, BYVAL wParam AS WPARAM, BYVAL lParam AS LPARAM) AS LRESULT

' ========================================================================================
' Main
' ========================================================================================
FUNCTION WinMain (BYVAL hInstance AS HINSTANCE, _
                  BYVAL hPrevInstance AS HINSTANCE, _
                  BYVAL szCmdLine AS ZSTRING PTR, _
                  BYVAL nCmdShow AS LONG) AS LONG

   ' // Set process DPI aware
   ' // The recommended way is to use a manifest file
'   AfxSetProcessDPIAware

   ' // Initialize the COM library
   CoInitialize(NULL)

   ' // Creates the main window
   DIM pWindow AS CWindow
   pWindow.Create(NULL, "DirectShow demo: Play clip", @WndProc)
   ' // Use a black brush for the background
   pWindow.Brush = CreateSolidBrush(BGR(0, 0, 0))
   ' // Sizes it by setting the wanted width and height of its client area
   pWindow.SetClientSize(400, 320)
   ' // Centers the window
   pWindow.Center

   ' // Create the menu
   DIM hMenu AS HMENU = CreateMenu
   DIM hMenuFile AS HMENU = CreatePopUpMenu
   AppendMenuW hMenu, MF_POPUP OR MF_ENABLED, CAST(UINT_PTR, hMenuFile), "&File"
   AppendMenuW hMenuFile, MF_ENABLED, ID_FILE_OPENCLIP, "&Open clip..."
   AppendMenuW hMenuFile, MF_ENABLED, ID_FILE_EXIT, "E&xit"
   SetMenu pWindow.hWindow, hMenu

   ' // Displays the window and dispatches the Windows messages
   FUNCTION = pWindow.DoEvents(nCmdShow)

   ' // Uninitalize COM
   CoUninitialize

END FUNCTION
' ========================================================================================

' ========================================================================================
' Play the movie inside the window.
' ========================================================================================
SUB PlayMovieInWindow (BYVAL hwnd AS HWND, BYREF wszFileName AS WSTRING)

   DIM hr AS HRESULT

   ' // If there is a clip loaded, stop it
   IF pIMediaControl THEN
      hr = pIMediaControl->lpvtbl->Stop(pIMediaControl)
      AfxSafeRelease(pIMediaControl) : pIMediaControl = NULL
      AfxSafeRelease(pIVideoWindow) : pIVideoWindow = NULL
      AfxSafeRelease(pIMediaEventEx) : pIMediaEventEx = NULL
      AfxSafeRelease(pIGraphBuilder) : pIGraphBuilder = NULL
   END IF

   ' // Create an instance of the IGraphBuilder object
   pIGraphBuilder = AfxNewCom(CLSID_FilterGraph)
   IF pIGraphBuilder = NULL THEN EXIT SUB

   ' // Further error checking omitted for brevity
   ' // We should add IF hr <> S_OK THEN ...

   ' // Retrieve interafce pointers
   hr = pIGraphBuilder->lpvtbl->QueryInterface(pIGraphBuilder, @IID_IMediaControl, @pIMediaControl)
   hr = pIGraphBuilder->lpvtbl->QueryInterface(pIGraphBuilder, @IID_IMediaEventEx, @pIMediaEventEx)
   hr = pIGraphBuilder->lpvtbl->QueryInterface(pIGraphBuilder, @IID_IVideoWindow, @pIVideoWindow)

   ' // Render the file
   hr = pIMediaControl->lpvtbl->RenderFile(pIMediaControl, @wszFileName)

   '// Set the window owner and style
   hr = pIVideoWindow->lpvtbl->put_Visible(pIVideoWindow, OAFALSE)
   hr = pIVideoWindow->lpvtbl->put_Owner(pIVideoWindow, cast(OAHWND, hwnd))
   hr = pIVideoWindow->lpvtbl->put_WindowStyle(pIVideoWindow, WS_CHILD OR WS_CLIPSIBLINGS OR WS_CLIPCHILDREN)

   ' // Have the graph signal event via window callbacks for performance
   hr = pIMediaEventEx->lpvtbl->SetNotifyWindow(pIMediaEventEx, cast(OAHWND, hwnd), WM_GRAPHNOTIFY, 0)

   ' // Set the window position
   DIM rc AS RECT
   GetClientRect(hwnd, @rc)
   hr = pIVideoWindow->lpvtbl->SetWindowPosition(pIVideoWindow, rc.Left, rc.Top, rc.Right, rc.Bottom)
   ' // Make the window visible
   hr = pIVideoWindow->lpvtbl->put_Visible(pIVideoWindow, OATRUE)

   ' // Run the graph
   hr = pIMediaControl->lpvtbl->Run(pIMediaControl)
   bIsPlaying = TRUE

END SUB
' ========================================================================================

' ========================================================================================
' Main window procedure
' ========================================================================================
FUNCTION WndProc (BYVAL hwnd AS HWND, BYVAL uMsg AS UINT, BYVAL wParam AS WPARAM, BYVAL lParam AS LPARAM) AS LRESULT

   SELECT CASE uMsg

      CASE WM_SYSCOMMAND
         ' // Capture this message and send a WM_CLOSE message
         IF (wParam AND &HFFF0) = SC_CLOSE THEN
            SendMessageW hwnd, WM_CLOSE, 0, 0
            EXIT FUNCTION
         END IF

      CASE WM_COMMAND
         SELECT CASE GET_WM_COMMAND_ID(wParam, lParam)
            CASE IDCANCEL, ID_FILE_EXIT
               ' // If ESC key pressed, close the application by sending an WM_CLOSE message
               IF GET_WM_COMMAND_CMD(wParam, lParam) = BN_CLICKED THEN
                  SendMessageW hwnd, WM_CLOSE, 0, 0
                  EXIT FUNCTION
               END IF
            CASE ID_FILE_OPENCLIP
               ' // Open file dialog
               IF GET_WM_COMMAND_CMD(wParam, lParam) = BN_CLICKED THEN
                  DIM wszFile AS WSTRING * MAX_PATH = "*.wmv"
                  DIM wszInitialDir AS STRING * MAX_PATH = CURDIR
                  DIM wszFilter AS WSTRING * 260 = "Video Files (*.MPG;*.MPEG;*.AVI;*.MOV;*.QTM;*.WMV)|*.MPG;*.MPEG;*.AVI;*.MOV;*.QT;*.WMV|" & "All Files (*.*)|*.*|"
                  DIM dwFlags AS DWORD = OFN_EXPLORER OR OFN_FILEMUSTEXIST OR OFN_HIDEREADONLY
                  DIM wszFileName AS WSTRING * MAX_PATH
                  wszFileName = AfxOpenFileDialog(hwnd, "", wszFile, wszInitialDir, wszFilter, "wmv", @dwFlags, NULL)
                  IF LEN(wszFileName) THEN PlayMovieInWindow(hwnd, wszFileName)
                  EXIT FUNCTION
               END IF
         END SELECT

      CASE WM_GRAPHNOTIFY

         ' // WM_GRAPHNOTIFY is an ordinary Windows message. Whenever the Filter Graph Manager
         ' // puts a new event on the event queue, it posts a WM_GRAPHNOTIFY message to the
         ' // designated application window. The message's lParam parameter is equal to the third
         ' // parameter in SetNotifyWindow. This parameter enables you to send instance data with
         ' // the message. The window message's wParam parameter is always zero.

         DIM lEventCode AS LONG
         DIM lParam1 AS LONG_PTR
         DIM lParam2 AS LONG_PTR

         IF pIMediaEventEx THEN
            DO
               DIM hr AS HRESULT
               hr = pIMediaEventEx->lpvtbl->GetEvent(pIMediaEventEx, @lEventCode, @lParam1, @lParam2, 0)
               IF hr <> S_OK THEN EXIT DO
               pIMediaEventEx->lpvtbl->FreeEventParams(pIMediaEventEx, lEventCode, lParam1, lParam2)
               IF lEventCode = EC_COMPLETE THEN
                  IF pIVideoWindow THEN
                     pIVideoWindow->lpvtbl->put_Visible(pIVideoWindow, OAFALSE)
                     pIVideoWindow->lpvtbl->put_Owner(pIVideoWindow, NULL)
                     AfxSafeRelease(pIVideoWindow)
                     pIVideoWindow = NULL
                  END IF
                  AfxSafeRelease(pIMediaControl): pIMediaControl = NULL
                  AfxSafeRelease(pIMediaEventEx) : pIMediaEventEx = NULL
                  AfxSafeRelease(pIGraphBuilder) : pIGraphBuilder = NULL
                  bIsPlaying = FALSE
                  AfxRedrawWindow hwnd
                  EXIT DO
               END IF
            LOOP
         END IF

      CASE WM_SIZE
         ' // Optional resizing code
         IF wParam <> SIZE_MINIMIZED THEN
            ' // Resize the window and the video
            DIM rc AS RECT
            GetClientRect(hwnd, @rc)
            IF pIVideoWindow THEN
               pIVideoWindow->lpvtbl->SetWindowPosition(pIVideoWindow, rc.Left, rc.Top, rc.Right, rc.Bottom)
               RedrawWindow hwnd, @rc, 0, RDW_INVALIDATE OR RDW_UPDATENOW
            END IF
         END IF

      CASE WM_ERASEBKGND
         ' // Erase the window's background
         IF bIsPlaying = FALSE THEN
            DIM hDC AS HDC = cast(HDC, wParam)
            DIM rc AS RECT
            GetClientRect(hwnd, @rc)
            FillRect hDC, @rc, GetStockObject(BLACK_BRUSH)
            FUNCTION = CTRUE
            EXIT FUNCTION
         END IF

    CASE WM_DESTROY
         ' // Stop de video if it is playing
         IF pIMediaControl THEN
            pIMediaControl->lpvtbl->Stop(pIMediaControl)
            AfxSafeRelease(pIMediaControl)
         END IF
         ' // Clean resources
         IF pIVideoWindow THEN
            pIVideoWindow->lpvtbl->put_Visible(pIVideoWindow, OAFALSE)
            pIVideoWindow->lpvtbl->put_Owner(pIVideoWindow, NULL)
            AfxSafeRelease(pIVideoWindow)
         END IF
         AfxSafeRelease(pIMediaEventEx)
         AfxSafeRelease(pIGraphBuilder)
         ' // Ends the application by sending a WM_QUIT message
         PostQuitMessage(0)
         EXIT FUNCTION

   END SELECT

   ' // Default processing of Windows messages
   FUNCTION = DefWindowProcW(hwnd, uMsg, wParam, lParam)

END FUNCTION
' ========================================================================================
« Last Edit: May 17, 2017, 04:43:53 PM by Josť Roca »
Logged
Forum: http://www.jose.it-berater.org/smfforum/index.php
Website: http://www.jose.it-berater.org/index.html
SED Editor, TypeLib Browser, headers and examples.

ganlinlao

  • FireFly3 User
  • Little Newbie FireFly
  • *
  • Posts: 23
Re: CWindow Release Candidate 27
« Reply #21 on: May 17, 2017, 07:51:22 AM »

 :)Well,Thanks

Every time I see winMain, wndproc, defwndproc, I always think,  can not have a more easy way to use?
Especially:   select case uMsg
                          Case
                          Case
                          Case
                          ...
A long list of  handling events, special annoyance, why not add an eventList or controls collection? Easy to write code and debug code

Logged

Josť Roca

  • Moderator
  • Master FireFly Member
  • *****
  • Posts: 2444
    • Josť Roca Software
Re: CWindow Release Candidate 27
« Reply #22 on: May 17, 2017, 12:33:51 PM »

I like this way of coding. It is the most efficient and less bloated.

Alternatives: You can use message crackers, like Paul is doing in his WinFBE editor, or instead of calling pWindow.DoEvents, you can replace it with a call to your own function, where you can do wathever you like. If you want controls collection and/or other VB-like features, you will have to write your own class or use one of the available toolkits, such GTK or IUP.
« Last Edit: May 17, 2017, 12:36:10 PM by Josť Roca »
Logged
Forum: http://www.jose.it-berater.org/smfforum/index.php
Website: http://www.jose.it-berater.org/index.html
SED Editor, TypeLib Browser, headers and examples.

TechSupport

  • Administrator
  • Master FireFly Member
  • *****
  • Posts: 7913
  • Windows 10
    • PlanetSquires Software
Re: CWindow Release Candidate 27
« Reply #23 on: May 17, 2017, 04:53:11 PM »

I'm working on something that should make it easier to create CWindow applications. Just need to get at least a prototype posted so people can see if it is worth developing more deeply.
Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

TechSupport

  • Administrator
  • Master FireFly Member
  • *****
  • Posts: 7913
  • Windows 10
    • PlanetSquires Software
Re: CWindow Release Candidate 27
« Reply #24 on: May 17, 2017, 05:18:11 PM »

Code would look like this. No need to deal with message pumps or Window Procedures.

Code: [Select]
Dim byref frmMain as clsForm = wlNew(clsForm, "frmMain")
with frmMain
   .Size = 600, 400
   .StartPosition = FormStartPosition.CenterScreen
   .Text = "Form1"
   .OnLoad = @frmMain_Load()
   .OnActivated = @frmMain_Activated()
   .OnDeactivate = @frmMain_Deactivate()
   .OnShown = @frmMain_Shown()
   .OnMouseMove = @frmMain_MouseMove()
   .OnFormClosing = @frmMain_FormClosing()
   .OnFormClosed = @frmMain_FormClosed()
   .OnMove = @frmMain_Move()
   .OnResize = @frmMain_Resize()
end with

Dim byref cmdShowPopup as clsButton = wlNew(clsButton, "cmdShowPopup")
with cmdShowPopup
   .Text = "Show Popup"
   .SetBounds(200, 100, 100, 30)
   .OnClick = @cmdShowPopup_Click()
end with
frmMain.Controls.Add(cmdShowPopup)

''
''
function frmMain_Load( byref sender as object, byref e as EventArgs ) as LRESULT
   Dim byref frmMain as clsForm = wlCast(clsForm, sender)
   print "Form Load  hWin = "; frmMain.hWindow
   function = 0
END FUNCTION

''
''
function frmMain_Activated( byref sender as object, byref e as EventArgs ) as LRESULT
   Dim byref frmMain as clsForm = wlCast(clsForm, sender)
   print "Form Activated hWin = "; frmMain.hWindow
   function = 0
END FUNCTION

''
''
function frmMain_Deactivate( byref sender as object, byref e as EventArgs ) as LRESULT
   Dim byref frmMain as clsForm = wlCast(clsForm, sender)
   print "Form Deactivate hWin = "; frmMain.hWindow
   function = 0
END FUNCTION

''
''
function frmMain_Shown( byref sender as object, byref e as EventArgs ) as LRESULT
   Dim byref frmMain as clsForm = wlCast(clsForm, sender)
   print "Form Shown hWin = "; frmMain.hWindow
   function = 0
END FUNCTION

''
''
function frmMain_FormClosing( byref sender as object, byref e as CancelEventArgs ) as LRESULT
   Dim byref frmMain as clsForm = wlCast(clsForm, sender)
   print "Form Closing hWin = "; frmMain.hWindow
   
   ' To prevent the Form from closing set the Cancel proprty to TRUE
   ' e.Cancel = true
   
   function = 0
END FUNCTION

''
''
function frmMain_FormClosed( byref sender as object, byref e as EventArgs ) as LRESULT
   Dim byref frmMain as clsForm = wlCast(clsForm, sender)
   print "Form Closed hWin = "; frmMain.hWindow
   function = 0
END FUNCTION

Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

Richard Kelly

  • FireFly3 Registered User
  • Senior FireFly Member
  • *
  • Posts: 299
Re: CWindow Release Candidate 27
« Reply #25 on: May 17, 2017, 05:21:04 PM »

Code would look like this. No need to deal with message pumps or Window Procedures.

I like that. Simple and easy to jump in when you need to.

Rick
Logged

Josť Roca

  • Moderator
  • Master FireFly Member
  • *****
  • Posts: 2444
    • Josť Roca Software
Re: CWindow Release Candidate 27
« Reply #26 on: May 17, 2017, 11:05:33 PM »

When coding by hand, as I always do, this approach doesn't make it any easier, but more convoluted. So, I assume that what you mean is that you need it for your planned visual designer.
Logged
Forum: http://www.jose.it-berater.org/smfforum/index.php
Website: http://www.jose.it-berater.org/index.html
SED Editor, TypeLib Browser, headers and examples.

ganlinlao

  • FireFly3 User
  • Little Newbie FireFly
  • *
  • Posts: 23
Re: CWindow Release Candidate 27
« Reply #27 on: May 18, 2017, 03:22:40 AM »

       Yes, write the base class of the package is very hard, but the appropriate package class, the use of people will become more simple and easy to use.
In China, some people use pure c depth to transform lua language, named Aardio, it is an explanatory language, support oop, the following is a simple example: In this example, we do not see a long list of select case Umsg, do not see wndproc, defwndproc, do not see com -> lpvtbl, they are hidden very well, the use of people to write code becomes very easy.
Although aardio and freebasic are two different languages, not comparable, but I still believe that the appropriate class package, can really bring convenience.

=========================
import win.ui;
import com;
/*DSG{{*/
var winform = win.form(text="window mediaplayer control";right=626;bottom=482)
winform.add(
btnDump={cls="button";text="Show wmplayer members";left=427;top=445;right=589;bottom=472;db=1;dr=1;z=4};
btnPlay={cls="button";text="play";left=224;top=445;right=312;bottom=472;db=1;dr=1;z=2};
btnStop={cls="button";text="stop";left=328;top=445;right=416;bottom=472;db=1;dr=1;z=3};
static={cls="static";left=32;top=16;right=606;bottom=434;db=1;dl=1;dr=1;dt=1;edge=1;notify=1;z=1}
)
/*}}*/

winform.static.oncommand = function(id,event){
   //winform.msgbox( winform.static.text );   
}
//Create a ocx control
var wmplay = winform.static.createEmbed("{6BF52A52-394A-11d3-B153-00C04F79FAA6}");   
wmplay._object.Url  = "file:/G:\Freebasic\FBTest\DShow_PlayClip\DShow_PlayClip\Secretarys_ass.wmv"
wmplay._object.stretchToFit = true;

/*
The following code prevents the video from blinking when the drag changes the window size
Note that winform.static should not be set to transparent
*/
winform.static.modifyStyle(, 0x2000000/*_WS_CLIPCHILDREN*/ )
winform.modifyStyle(, 0x2000000/*_WS_CLIPCHILDREN*/ )

winform.btnStop.oncommand = function(id,event){
    wmplay._object.controls.stop()
}
winform.btnPlay.oncommand = function(id,event){
    wmplay._object.controls.play()
}
winform.btnDump.oncommand = function(id,event){
    io.open();
    com.DumpTypeInfo(wmplay._object)
}

winform.show(true)
win.loopMessage();
==============================
« Last Edit: May 18, 2017, 08:15:32 AM by ganlinlao »
Logged

TechSupport

  • Administrator
  • Master FireFly Member
  • *****
  • Posts: 7913
  • Windows 10
    • PlanetSquires Software
Re: CWindow Release Candidate 27
« Reply #28 on: May 18, 2017, 08:43:51 AM »

When coding by hand, as I always do, this approach doesn't make it any easier, but more convoluted. So, I assume that what you mean is that you need it for your planned visual designer.

For both really. It should (I hope) make it easier for the general programmer to quickly put together a working application; and also help with code generation once I get the visual designer front end done. I fear that without this type of approach that a lot of the CWindow functionality will go unused because a lot of Windows programmers are very apprehensive about learning the Win32 api programming techniques (we've seen that with PowerBasic and now also with FreeBasic).


Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

Josť Roca

  • Moderator
  • Master FireFly Member
  • *****
  • Posts: 2444
    • Josť Roca Software
Re: CWindow Release Candidate 27
« Reply #29 on: May 21, 2017, 12:42:21 AM »

The Aardio example clearly uses Automation. To support such a syntax with Free Basic, a pre-processor would be needed. Too much work.

Besides, the examples aren't comparable because mine is using DirectShow and the Aardio one is embedding Windows Media Player, which does not work very well with High DPI aware applications.

With DirectShow, you can build your own media player. Automation only languages can't use DirectShow or the new Media Foundation interfaces.

Probably because I never have used Classic Visual Basic, I don't have developed a phobia about message pumps and window procedures.
« Last Edit: May 21, 2017, 12:44:30 AM by Josť Roca »
Logged
Forum: http://www.jose.it-berater.org/smfforum/index.php
Website: http://www.jose.it-berater.org/index.html
SED Editor, TypeLib Browser, headers and examples.
Pages: 1 [2] 3 4