VFB IDE【Visual Freebasic】Like vb6@Updae2023-3-6

User projects written in or related to FreeBASIC.
Post Reply
xiaoyao
Posts: 117
Joined: May 05, 2020 2:01

Re: VFB IDE【Visual Freebasic】Like vb6@Updae2023-3-6

Post by xiaoyao »

VB6 How do I create copies of forms by name

Code: Select all

Dim NewForm1 As Form
Dim NewForm2 As Form2

Private Sub Command1_Click()
    Set NewForm1 = Forms.Add("Form1")
    NewForm1.Show
    NewForm1.Caption = "Form1 New Copy"
    
    Set NewForm2 = Forms.Add("Form2")
    NewForm2.Show
End Sub
IN VFB (Visual Freebasic ide)

Code: Select all

Sub Form1_Command1_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd)   
   Me.Caption = "i'm Main Window"   
    Dim C As Class_Form
    C = FormsAdd("Form1")
    C.CAPTION = "A form created by a dynamic copy Form1"
    
   Dim D As Class_Form
    D = FormsAdd("Form2","A form created by a dynamic copy Form2")     
End Sub

Function FormsAdd Overload(ByVal FormName As String) As Class_Form
    'GetNewFormByName
     Return FormsAdd(FormName,"")
End Function
Function FormsAdd Overload(ByVal FormName As String, Title As String) As Class_Form
   Dim Class1  As Class_Form
   Select Case   FormName
      Case "Form1"
         Dim Form1Copy As Form1_Class_Form
         Form1Copy.show 0, False
         Class1= Form1Copy
         
      Case "Form2"
         Dim Form2Copy As Form2_Class_Form
         Form2Copy.show 0, False
         Class1= Form2Copy
   End Select
   If Title <> "" Then Class1.caption = Title   
   return Class1
End Function   
Last edited by xiaoyao on May 19, 2023 3:24, edited 1 time in total.
xiaoyao
Posts: 117
Joined: May 05, 2020 2:01

Re: VFB IDE【Visual Freebasic】Like vb6@Updae2023-3-6

Post by xiaoyao »

vfb has not supported dynamic window creation, which is a pain in the heart.
I spent the morning deciphering his principles and unpublished methods.

The next step is how to create controls on the fly, creating arrays of controls on the fly, which can be very interesting, but also very difficult.
After all, an IDE was not developed by Microsoft, and the author was not interested in some of the features, so he had to make some magic changes himself.
What if it works? It'll get more and more interesting

This similar VB6 software is free, also have open source version, interested friends can send me an email, developed a new function, can be incorporated into the latest version.
Any bugs are welcome to point them out. Hopefully VB6 and tools like VB6 will keep us entertained for another 30 to 50 years.

Let the new UI style and more syntactic sugar work for us
xiaoyao
Posts: 117
Joined: May 05, 2020 2:01

Re: VFB IDE【Visual Freebasic】Like vb6@Updae2023-3-6

Post by xiaoyao »

How do I create a New form in code
in vb6

Code: Select all

dim A as New form1
in Freebasic
The new copy of the form created is shared globally

'code put on first
Dim Shared PublicForm2As Form2_Class_Form


Sub Form1_Command2_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd)
PublicForm2.show 0, False

Dim Form2Copy As Form2_Class_Form
Form2Copy.show 0, False
End Sub
xiaoyao
Posts: 117
Joined: May 05, 2020 2:01

Re: VFB IDE【Visual Freebasic】Like vb6@Updae2023-3-6

Post by xiaoyao »

Makoto WATANABE wrote: May 17, 2023 22:13 I updated the Japanese Language files for VFB.
Thank you for your support and love of VFB. If you have the time and technical ability, we hope to add new features to the VFB IDE extension.
I completed a function to create a form dynamically in the morning, with very little code, but it took almost 4 hours.

If you deliberately miswrite a sentence in your code, the compiler will leave the original code, which you can open and study in its entirety.
Directory: Project path \release
= = = = = = = = = = = = = = = = = = = = = = = = = =
DECLARES.inc finds: Declare Function MsgBox Overload, which supports multiple overloads with different parameters
#include Once "Form\ClsForm.inc" loads the basic form class, where methods such as form1.caption come from

Type Form1_Class_Form Extends Class_Form, which is also a fun class

If you have 2 forms, you can add a new Form1B
Dim Shared Form1 As Form1_Class_Form
Dim Shared Form1B As Form1_Class_Form
Dim Shared Form2 As Form2_Class_Form

----------------------
Form1_FORM.inc file
Form1_Class_Form.Show, you can also add some new features
xiaoyao
Posts: 117
Joined: May 05, 2020 2:01

Re: VFB IDE【Visual Freebasic】Like vb6@Updae2023-3-6

Post by xiaoyao »

HOW to New Button by Freebasic Code?
MY CODE IS RIGHT?

Code: Select all

Function NewControl(ByVal ControlClass As String, ControlName As String, Text As String,Left2 As Long,Top2 As Long ) As .hWnd 
'.hWnd  CHANGE TO  HWND
      Dim hWndControl As .hWnd 
      'Dim pWindow As CWindow Ptr = New CWindow("CWindowNew")     
      hWndControl = pWindow2->AddControl(ControlClass, Me.hWnd, 102, Text, Left2, Top2, 200, 30, WS_CHILD Or WS_CLIPSIBLINGS Or ES_LEFT Or WS_VISIBLE Or ES_AUTOHSCROLL Or WS_TABSTOP Or ES_WANTRETURN, WS_EX_CLIENTEDGE,, Cast(Any Ptr, @Form2_CODEPROCEDURE))
      Return hWndControl
 End Function

   Dim ObjHwnd As .hWnd, Button4 As Class_Button 

   ObjHwnd = NewControl("BUTTON", "ButtonX", "'new Button", 0, 0)
   Button4.hWnd =ObjHwnd
   MsgBox("Button4.Caption=" & Button4.Caption)
   Button4.Caption = "New Button XXX"
LIKE THIS:
vb6 adds controls dynamically
'

Code: Select all

Private Sub Form_Load()
Add: PICTURE1 control, button control
'
Example: Form1.Controls.Add "VB.CommandButton", "cmdObj1", Frame1
'
Dim NewText1 As TextBox
Set NewText1 = Me.Controls.Add("VB.Textbox", "Text1ABC", Picture1)
NewText1.Visible = True
'End Sub
xiaoyao
Posts: 117
Joined: May 05, 2020 2:01

Re: VFB IDE【Visual Freebasic】Like vb6@Updae2023-3-6

Post by xiaoyao »

The new COM object wrapper makes it a little easier to use
by :驰骋乾坤

Code: Select all

    Dim excel as CObject = createobject("excel.application")
    dim Workbooks As CObject = excel.Get("Workbooks")
   Workbooks.Clear
   dim Workbooks As CObject = excel.Get("Workbooks")
   dim Workbook As CObject = Workbooks.Run("Add")
   Workbook.Run("saveas" ,"c:\1.xlsx")
   Workbook.Run("close")
   Workbooks.Clear
   Workbook.Clear
   excel.Run("quit")
   excel.Clear

      dim demo as CObject
      demo.CreateObject("Demo.DemoClass" , ,"Demo.dll.manifest")
      debug.Print demo.Run("Add" ,123 ,456).ToString
xiaoyao
Posts: 117
Joined: May 05, 2020 2:01

Re: VFB IDE【Visual Freebasic】Like vb6@Updae2023-3-6

Post by xiaoyao »

It would be nice if you could consider redeveloping a new IDE in Freebasic or VB.NET. Because of the older version of VB6, only 32-bit programs can be generated and some new syntax support is missing. Such as multiline text, JSON strings, etc.

VB.NET as a background compiler, compatible with VB6 engineering or syntax, and then generate 64 - bit procedures, is a very interesting creative design
It also has access to.NET's extensive libraries and beautiful UI components. VB6 and VB.NET,JS code can be used at the same time programming.
Post Reply