﻿#define UNICODE
#include Once "system/window9/window9.bi"    
#lang "FB" '表示为标准FB格式
#define DimP Dim shared 
#define DimS Static 

Type StringW '宽字符变长字符串类型，兼容API，末尾总是 0 字符，遇0截断。
   WStrPtr As Wstring Ptr '字符内存指针
   WstrLen As ULong '字符个数（不是字节，字节=个数*2）
   WstrSize As ULong '已分配的内存尺寸，单位字节，这是缓冲，用于大量字符串拼贴时，加速代码执行效率。
   '不管你如何优化，也无法解决在 各不同类型字符串，前后位置等复杂的字符串拼贴 速度。就算有效果，也是不多。
   '需要大批量拼贴，还是需要自己写代码优化速度快的非常多
   Declare Constructor '声明  Dim a As StringW
   Declare Destructor  '销毁时要释放内存
   Declare Constructor(wszStr As Wstring) '声明+赋值  Dim a As StringW ="xx"
   Declare Operator Cast() ByRef As Wstring '返回W字符，默认用途（可惜FB内置字符处理函数先转换A字符处理）
   Declare Operator Cast() As Wstring Ptr '返回W指针，主要兼容系统API调用，因为API用的是指针
   Declare Function WStr() ByRef As Wstring '返回给一些不支持Cast返回宽字符的，强制输出宽字符（主要是FB内置字符处理函数）
   Declare Operator Let(wszStr As Wstring) '赋值
   Declare Operator Let(wszStr As StringW) '同类赋值，没这个会发生直接复制成员值，而不是拷贝字符
   #ifdef YF_FUNTIHUI_PRINTIDEKK 
     '假如代码中没 Print 就不会包含下面代码，节约没用的代码
      Declare Constructor (ByVal n As Byte)
      Declare Constructor (ByVal n As UByte)
      Declare Constructor (ByVal n As Short)
      Declare Constructor (ByVal n As UShort)
      Declare Constructor (ByVal n As Long)
      Declare Constructor (ByVal n As ULong)
      Declare Constructor (ByVal n As LongInt)
      Declare Constructor (ByVal n As ULongInt)
      Declare Constructor (ByVal n As Single)
      Declare Constructor (ByVal n As Double)
      Declare Constructor (ByVal n As Any Ptr)
      #if __FB_VERSION__>"1.09.0"  
      Declare Constructor(ByVal n As Boolean)  ' 从1.10版才有这个类型
      #endif
   #endif   
   Declare Operator [](nIndex As ULong) ByRef As UShort '直接使用指针方式获取或修改字符编码。
   bug As Integer = 1460339748 '解决FB编译器BUG用，当作为函数返回时，当函数里没执行返回代码，将会返回一个没初始化的类，即 WStrPtr 内容是随机的，并不是0
   Declare Operator &= (wszStr As Wstring) '加速 &= 执行效率，可以比没加速时的百倍多。
End Type
Constructor StringW
   WStrPtr = CAllocate(16) '初始化时，分配
   WstrSize = 16 
End Constructor
Destructor StringW
   If WStrPtr Then Deallocate WStrPtr '销毁类时释放内存
   bug = 0 '避免内存残留数字，造成新创建的类刚好碰撞上
End Destructor
Constructor StringW(wszStr As Wstring)
   This = wszStr '变量声明时赋值
End Constructor
Operator StringW.Cast() ByRef As Wstring
   If WStrPtr = 0 Or bug <> 1460339748 Then
      WStrPtr  = CAllocate(16) '解决FB编译器的BUG，假如没初始化类而内存刚好是1460339748，那么就是天意，软件崩溃吧。
      WstrSize = 16
   End If
   Return *WStrPtr
End Operator
Operator StringW.Cast() As Wstring Ptr
   Return WStrPtr '
End Operator
Operator StringW.Let(wszStr As Wstring) '变量赋值时的默认函数
   WstrLen = Len(wszStr) '字符个数
   If WStrPtr = 0 OrElse (WstrLen + WstrLen + 2) > WstrSize OrElse (WstrLen * 10) < WstrSize Then
      If WStrPtr Then Deallocate WStrPtr '释放内存
      WstrSize = WstrLen * 2 + 128
      WStrPtr  = Allocate(WstrSize) '申请内存，内存不清零（速度快）
   End If
   *WStrPtr=wszStr
End Operator
Operator StringW. &= (wszStr As Wstring)
   Dim eLen As ULong = Len(wszStr) '字符个数
   Dim zLen As ULong = WstrLen + eLen
   If WStrPtr = 0 OrElse (zLen + zLen + 2) > WstrSize Then
      WstrSize = zLen * 2 * 1.25 + 128
      Dim tw As WString Ptr = Allocate(WstrSize)
      If WStrPtr Then
         *tw = *WStrPtr  ' Fb_Memcopy tw, WStrPtr, WstrLen * 2 + 2 '  
         Deallocate WStrPtr '释放内存
      End If
      WStrPtr = tw
   End If
   *(WStrPtr + WstrLen) = wszStr '  Fb_Memcopy   Cast(UInteger , WStrPtr) +  WstrLen*2, @wszStr, eLen * 2 + 2  '  
   WstrLen = zLen
End Operator
Operator StringW.Let(wszStr As StringW) '变量赋值时的默认函数
   If wszStr.WstrPtr Then This = *wszStr.WstrPtr
   'If wszStr.WstrPtr Then
   '   WstrLen = wszStr.WstrLen '字符个数
   '   If WStrPtr = 0 OrElse (WstrLen + WstrLen + 2) > WstrSize Then
   '      If WStrPtr Then Deallocate WStrPtr '释放内存
   '      WstrSize = WstrLen * 2 + 128
   '      WStrPtr  = Allocate(WstrSize) '申请内存，内存不清零（速度快）
   '   End If
   '   Fb_Memcopy WStrPtr, wszStr.WstrPtr, WstrLen * 2 + 2 '使用内存拷贝，可以支持包含 0 字符串
   'End If
End Operator
Function StringW.WStr() ByRef As WString
   If WStrPtr = 0 Or bug <> 1460339748 Then
      WStrPtr  = CAllocate(2) '解决FB编译器的BUG，假如没初始化类而内存刚好是1460339748，那么就是天意，软件崩溃吧。
      WstrSize = 2
   End If
   Return *WStrPtr
End Function
Operator StringW.[](nIndex As ULong) ByRef As UShort
   Static Zero As UShort = 0
   If nIndex > WstrLen - 1 Then Return Zero
   Operator = *Cast(UShort Ptr, WstrPtr + nIndex)
End Operator
Operator & (lhs As StringW, rhs As StringW) As StringW '必须 重载一下 & 才可以  a & b & c 的3个以上连续拼接
   Return lhs.WStr & rhs.WStr
End Operator
Operator & (lhs As StringW, rhs As Wstring) As StringW '和其它类型拼贴，主要是兼容 CWSTR 混合拼贴字符，毕竟很多 AFX函数返回是 CWSTR ，不用此就编译出错误
   Return lhs.WStr & rhs
End Operator
Operator & (lhs As Wstring, rhs As StringW) As StringW '和其它类型拼贴，主要是兼容 CWSTR 混合拼贴字符，毕竟很多 AFX函数返回是 CWSTR ，不用此就编译出错误
   Return lhs & rhs.WStr
End Operator
Operator Len(lhs As StringW) As Integer '重载一下才能正常使用
   Return lhs.WstrLen
End Operator
Function Val Overload(lhs As StringW) As Double '重载一下才能正常使用
   Return.Val(lhs.WStr)
End Function
Function ValInt Overload(lhs As StringW) As Long '重载一下才能正常使用
   Return.ValInt(lhs.WStr)
End Function
Function ValLng Overload(lhs As StringW) As LongInt '重载一下才能正常使用
   Return.ValLng(lhs.WStr)
End Function
Function ValUInt Overload(lhs As StringW) As ULong '重载一下才能正常使用
   Return.ValUInt(lhs.WStr)
End Function
Function ValULng Overload(lhs As StringW) As ULongInt '重载一下才能正常使用
   Return.ValULng(lhs.WStr)
End Function


Type FormControlsPro_TYPE '保存控件的私有属性，每个控件都不同，全部在此，各取所需。
   hWndParent        As hWnd     '父窗口句柄
   nName             As String   '名称\1\用来代码中识别对象的名称\Command\
   Index             As Long     '控件数组索引，小于零表示非控件数组
   IDC               As Long     '
   CtrlFocus         As hWnd     ' 当前焦点在什么控件
   BigIcon           As HICON    '窗口大图标，主要用来主窗口
   SmallIcon         As HICON    '窗口小图标
   nText             As StringW  '
   ControlType       As Long     '控件类型，为了画控件  >=100 为虚拟控件  100=LABEL   TEXT=1 Button=2
   nData             As String   '编写控件使用，数据存放，无特定，控件根据自己需要存放任意数据。
   CtlData(99)       As Integer  '为每个控件提供 100 个数据储存(编写控件使用，控件根据自己需要存放任意数据)。
   UserData(99)      As Integer  '为每个控件提供 100 个数据储存(用户使用)。
   Style             As UInteger '样式，每个控件都有自己的定义
   TransPer          As Long     '透明度\0\窗口透明度，百分比(0--100)，0%不透明 100%全透明\0\
   TransColor        As Long = &H197F7F7F '透明颜色\3\透明颜色，需要用 GetCodeColorGDI 或 GetCodeColorGDIplue 转为 GDI 和 GDI+ 颜色值
   MousePointer      As Long '指针\2\鼠标在窗口上的形状\0 - 默认,1 - 后台运行,2 - 标准箭头,3 - 十字光标,4 - 箭头和问号,5 - 文本工字光标,6 - 不可用禁止圈,7 - 移动,8 - 双箭头↙↗,9 - 双箭头↑↓,10 - 双箭头向↖↘,11 - 双箭头←→,12 - 垂直箭头,13 - 沙漏,14 - 手型
   ForeColor         As Long = &H197F7F7F '文字色 需要用 GetCodeColorGDI 或 GetCodeColorGDIplue 转为 GDI 和 GDI+ 颜色值
   BackColor         As Long = &H197F7F7F '背景色 需要用 GetCodeColorGDI 或 GetCodeColorGDIplue 转为 GDI 和 GDI+ 颜色值
   hBackBrush        As HBRUSH  '背景刷子，返回给窗口和控件用
   nFont             As String  '字体\4\用于此对象的文本字体。\微软雅黑,9,0\
   Tag               As StringW ' 附加 \ 1 \ 私有自定义文本与控件关联。 \ \
   ToolTip           As StringW ' 提示 \ 1 \ 一个提示，当鼠标光标悬停在控件时显示它。 \ \
   ToolTipBalloon    As Long    ' 气球样式 \ 2 \ 一个气球样式显示工具提示。 \ False \ True, False
   ToolWnd           As hWnd    '提示窗口句柄，用来销毁
   nCursor           As HCURSOR '鼠标指针句柄
   nLeft             As Long    '返回/设置相对于父窗口的 X 响应DPI数值，为 100%DPI数值（像素）
   nTop              As Long    '返回/设置相对于父窗口的 Y 响应DPI数值，为 100%DPI数值（像素）
   nWidth            As Long    '返回/设置控件宽度 响应DPI数值，为 100%DPI数值（像素）
   nHeight           As Long    '返回/设置控件高度 响应DPI数值，为 100%DPI数值（像素））
   anchor            As Long    '控件布局 自动调整方式
   nRight            As Long    '控件布局 用，相对于窗口右边距离 响应DPI数值，为 100%DPI数值（像素））
   nBottom           As Long    '控件布局 用，相对于窗口底边距离 响应DPI数值，为 100%DPI数值（像素））
   centerX           As Long    '控件布局 用 中点  响应DPI数值，为 100%DPI数值（像素）
   centerY           As Long    '控件布局 用
   '等比例缩放由QQ2719379524（Cy）提供
   nParentFormWidth  As Long    '控件布局 用　保存控件父窗最初始宽度用
   nParentFormHeight As Long    '控件布局 用　保存控件父窗最初始高度用
   nOrgWidth         As Long    '控件布局 用　保存当前控件最初始高度用
   nOrgHeight        As Long    '控件布局 用　保存当前控件最初始高度用
   nOrgLeft          As Long    '控件布局 用　保存当前控件最初始Left用
   nOrgTop           As Long    '控件布局 用　保存当前控件最初始TOP用
   VrControls        As FormControlsPro_TYPE Ptr '如果是主窗口带 虚拟控件 ，就是下一个虚拟控件链表指针，直到为 0 表示没了
End Type

Function vfb_Get_Control_Ptr(hWndControl As hWnd) As FormControlsPro_TYPE Ptr '获取控件数据指针
   Return Cast(FormControlsPro_TYPE Ptr, GetPropW(hWndControl, "vfb_Control_Ptr"))
End Function
Sub vfb_Set_Control_Ptr(hWndControl As hWnd, pp As FormControlsPro_TYPE Ptr) ' 设置控件数据指针
   SetPropW hWndControl, "vfb_Control_Ptr", Cast(Any Ptr, pp)
End Sub
Sub vfb_Remove_Control_Ptr(hWndControl As Any Ptr) '删除数据指针
   RemoveProp hWndControl, "vfb_Control_Ptr"
End Sub
#ifdef YF_FUNTIHUI_PRINTIDEKK 
'假如代码中没 Print 就不会包含下面代码，节约没用的代码
Constructor StringW(a As Byte) '
   This = Str(a)
End Constructor
Constructor StringW(a As UByte) '
   This = Str(a)
End Constructor
Constructor StringW(a As Any Ptr) '
   This = Str(a)
End Constructor
#if __FB_VERSION__>"1.09.0"  
Constructor StringW(a As Boolean) '从1.10版才有这个类型
   This = Str(a)
End Constructor
#endif
Constructor StringW(a As Short) '
   This = Str(a)
End Constructor
Constructor StringW(a As UShort) '
   This = Str(a)
End Constructor
Constructor StringW(a As Long) '
   This = Str(a)
End Constructor
Constructor StringW(a As ULong) '
   This = Str(a)
End Constructor
Constructor StringW(a As LongInt) '
   This = Str(a)
End Constructor
Constructor StringW(a As ULongInt) '
   This = Str(a)
End Constructor
Constructor StringW(a As Single) '
   This = Str(a)
End Constructor
Constructor StringW(a As Double) '
   This = Str(a)
End Constructor

Sub yf_FunTiHui_PrintIDE(x As WString, mask As Long)
   Static vfbWnd As hWnd
   If IsWindow(vfbWnd) = 0 Then vfbWnd = FindWindowA("yfPrintForm", NULL)
   If IsWindow(vfbWnd) = 0 Then vfbWnd = FindWindowA("VisualFreeBasic6x", NULL)
   If IsWindow(vfbWnd) = 0 Then Return 
   '避免文字超过200个
   Dim c As Long = Len(x)
   Dim As UShort Ptr m1 = @x, m2
   Dim ck As WString * 50
   If c > 500 Then
      ck = WStr(" <超500字被截断，原始长度=") & c & ">"
      c  = 500
   End If
   m2 = CAllocate(c * 8 + 4 + Len(ck) * 2)
   Dim i As Integer, ti As Long, n As String, nc As Long, ni As Long
   '让不可显示字符，显示ascii码
   If c Then
      For i = 0 To c -1
         If m1[i] < 32 Then
            m2[ti] = 60 ' <
            ti     += 1
            n      = Str(m1[i])
            nc     = Len(n)
            For ni = 0 To nc -1
               m2[ti] = n[ni]
               ti     += 1
            Next
            m2[ti] = 62 ' >
            ti     += 1
         Else
            m2[ti] = m1[i]
            ti     += 1
         End If
      Next
      c = Len(ck)
      If c Then
         For i = 0 To c -1
            m2[ti] = ck[i]
            ti     += 1
         Next
      End If
   End If
   
   Dim Param As COPYDATASTRUCT 'dwData|cbData|lpData
   Param.cbData = ti * 2 + 2
   Param.lpData = m2
   Param.dwData = mask
   SendMessageW(vfbWnd, WM_COPYDATA, &H502, Cast(lParam, Varptr(Param)))
   Deallocate m2
End Sub

Sub yf_Print_IDE(a1 As StringW = Chr(0), a2 As StringW = Chr(1), a3 As StringW = Chr(1), a4 As StringW = Chr(1), a5 As StringW = Chr(1), _
      a6  As StringW = Chr(1), a7  As StringW = Chr(1), a8  As StringW = Chr(1), a9  As StringW = Chr(1), a10 As StringW = Chr(1), _
      a11 As StringW = Chr(1), a12 As StringW = Chr(1), a13 As StringW = Chr(1), a14 As StringW = Chr(1), a15 As StringW = Chr(1))
   If a2 = WChr(1) Then yf_FunTiHui_PrintIDE a1, 1 : Return
   yf_FunTiHui_PrintIDE a1, 0
   If a3 = WChr(1) Then yf_FunTiHui_PrintIDE a2, 1 : Return
   yf_FunTiHui_PrintIDE a2, 0
   If a4 = WChr(1) Then yf_FunTiHui_PrintIDE a3, 1 : Return
   yf_FunTiHui_PrintIDE a3, 0
   If a5 = WChr(1) Then yf_FunTiHui_PrintIDE a4, 1 : Return
   yf_FunTiHui_PrintIDE a4, 0
   If a6 = WChr(1) Then yf_FunTiHui_PrintIDE a5, 1 : Return
   yf_FunTiHui_PrintIDE a5, 0
   If a7 = WChr(1) Then yf_FunTiHui_PrintIDE a6, 1 : Return
   yf_FunTiHui_PrintIDE a6, 0
   If a8 = WChr(1) Then yf_FunTiHui_PrintIDE a7, 1 : Return
   yf_FunTiHui_PrintIDE a7, 0
   If a9 = WChr(1) Then yf_FunTiHui_PrintIDE a8, 1 : Return
   yf_FunTiHui_PrintIDE a8, 0
   If a10 = WChr(1) Then yf_FunTiHui_PrintIDE a9, 1 : Return
   yf_FunTiHui_PrintIDE a9, 0
   If a11 = WChr(1) Then yf_FunTiHui_PrintIDE a10, 1 : Return
   yf_FunTiHui_PrintIDE a10, 0
   If a12 = WChr(1) Then yf_FunTiHui_PrintIDE a11, 1 : Return
   yf_FunTiHui_PrintIDE a11, 0
   If a13 = WChr(1) Then yf_FunTiHui_PrintIDE a12, 1 : Return
   yf_FunTiHui_PrintIDE a12, 0
   If a14 = WChr(1) Then yf_FunTiHui_PrintIDE a13, 1 : Return
   yf_FunTiHui_PrintIDE a13, 0
   If a15 = WChr(1) Then yf_FunTiHui_PrintIDE a14, 1 : Return
   yf_FunTiHui_PrintIDE a14, 0
   yf_FunTiHui_PrintIDE a15, 1
   
End Sub

#endif

#ifdef YF_FUNTIHUI_DEGUG_SHUCHUHANSUHANGHAO  '调试编译，需要添加函数名和行号，然后输出到共享内存中，崩溃后可以根据最后执行到的函数来判断崩溃 
Type DEGUG_SHUCHUHANSUHANGHAO
   hID As ULong '线程ID
   SubName As Wstring * 50 '函数名称
   HangHao As Long   '行号，属于函数的第几行
   jTims   As Double '时间，Timer 获取时间，超过100秒 就认为线程已经终止 最大86400
End Type
'创建内存共享
Dim Shared VFB_DEGUG_hMapFile As HANDLE, VFB_DEGUG_pBuf As DEGUG_SHUCHUHANSUHANGHAO Ptr
VFB_DEGUG_hMapFile = CreateFileMappingW( _
   INVALID_HANDLE_VALUE, _ ' 不关联实际文件（匿名共享内存）
   NULL, _           ' 默认安全属性
   PAGE_READWRITE, _ ' 可读可写
   0, _ ' 高位文件大小（0表示由低位决定）
   Len(DEGUG_SHUCHUHANSUHANGHAO) * 30, _ ' 共享内存大小 ，最多支持30个线程
   "VFB_DEGUG_" & GetCurrentProcessId) ' 全局命名（跨会话访问需加Global\前缀）
If VFB_DEGUG_hMapFile Then
   VFB_DEGUG_pBuf = MapViewOfFile(VFB_DEGUG_hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, 0)
End If
Sub VFB_DEGUG_XIERUMINZI(nName As WString, HangHao As Long)
   If VFB_DEGUG_pBuf = 0 Then Return
   Dim tid      As ULong = GetCurrentThreadId
   Dim curTimer As Double = Timer
   Dim i        As Long, ti As Long = -1, timeDiff As Double
   '查找自己的线程位置
   For i = 0 To 29
      If tid = VFB_DEGUG_pBuf[i].hID OrElse VFB_DEGUG_pBuf[i].hID = 0 Then ' 优先找自身线程已占用的槽位（或空槽位）
         ti = i
         Exit For
      End If
      timeDiff = curTimer - VFB_DEGUG_pBuf[i].jTims '若没找到自身槽位，检查超时槽位
      If timeDiff < 0 Then timeDiff += 86400 '修正跨天的时间差（Timer返回0-86400，负数即跨天）
      If timeDiff > 100 OrElse timeDiff < 0 Then '超过100秒或超过2天
         ti = i
         Exit For
      End If
   Next
   If ti > -1 Then
      With VFB_DEGUG_pBuf[ti] ' 写入数据（With语法减少多次寻址）
         .hID = tid
         .SubName = nName
         .HangHao = HangHao
         .jTims   = curTimer
      End With
   End If
End Sub
#endif

' 程序员可以通过共享APP变量访问的公共信息。
Type APP_TYPE
   Comments        As Wstring * 100 ' 注释
   CompanyName     As Wstring * 100 ' 公司名
   EXEName         As Wstring * 100 ' 程序的EXE名称
   FileDescription As Wstring * 100 ' 文件描述
   HINSTANCE       As HINSTANCE ' 程序的实例句柄
   Path            As Wstring * 260 ' EXE的当前路径
   ProductName     As Wstring * 100 ' 产品名称
   LegalCopyright  As Wstring * 100 ' 版权所有
   LegalTrademarks As Wstring * 100 ' 商标
   ProductMajor    As Long    ' 产品主要编号
   ProductMinor    As Long    ' 产品次要编号
   ProductRevision As Long    ' 产品修订号
   ProductBuild    As Long    ' 产品内部编号
   FileMajor       As Long    ' 文件主要编号
   FileMinor       As Long    ' 文件次要编号
   FileRevision    As Long    ' 文件修订号
   FileBuild       As Long    ' 文件内部编号
   ReturnValue     As Integer ' 返回的用户值
End Type
Sub VFB_RegisterClass(wszClassName As WString , xhInstance As HINSTANCE, lpfnWndProc As Any Ptr) '注册窗口类，主要用来创建新控件。
   Dim wAtom As ATOM                     
   Dim wcexw As WNDCLASSEXW     
   With wcexw
      .cbSize = SizeOf(wcexw)
      .style = CS_DBLCLKS Or CS_HREDRAW Or CS_VREDRAW 
      .lpfnWndProc = lpfnWndProc
      .cbClsExtra = 0
      .cbWndExtra = SIZEOF(HANDLE)
      .HINSTANCE = xhInstance
      .HCURSOR = ..LoadCursorW(NULL, Cast(LPCWSTR, IDC_ARROW))
      .hbrBackground = Cast(HBRUSH, COLOR_3DFACE + 1)
      .lpszMenuName = NULL
      .lpszClassName = @wszClassName
      .hIcon = 0
      .hIconSm = 0
   End With
   wAtom = RegisterClassExW(@wcexw)
End Sub

Dim Shared App As APP_TYPE
{FF_APPSTART}

Sub Setting_up_Application_Common_Information()
   '设置共享应用程序变量的值
   #if __FB_OUT_EXE__
      App.HINSTANCE = GetModuleHandle(NULL)
   #else
      Dim mbi as MEMORY_BASIC_INFORMATION
      VirtualQuery(@Setting_up_Application_Common_Information, @mbi, SizeOf(mbi))
      App.HINSTANCE = mbi.AllocationBase
   #endif
   Dim zTemp As WString * MAX_PATH
   Dim x     As Long
   App.CompanyName     = WStr("{APP_COMPANY_NAME}")
   App.FileDescription = WStr("{APP_FILE_DESCRIPTION}")
   App.ProductName     = WStr("{APP_PRODUCTNAME}")
   App.LegalCopyright  = WStr("{APP_COPYRIGHT}")
   App.LegalTrademarks = WStr("{APP_TRADEMARKS}")
   App.Comments        = WStr("{APP_COMMENTS}")
   
   App.ProductMajor    = {APP_PRODUCTMAJOR_VER}
   App.ProductMinor    = {APP_PRODUCTMINOR_VER}
   App.ProductRevision = {APP_PRODUCTREVISION_VER}
   App.ProductBuild    = {APP_PRODUCTBUILD_VER}
   
   App.FileMajor    = {APP_FILEMAJOR_VER}
   App.FileMinor    = {APP_FILEMINOR_VER}
   App.FileRevision = {APP_FILEREVISION_VER}
   App.FileBuild    = {APP_FILEBUILD_VER}
   
   'App.hInstance 在WinMain / LibMain中设置
   
   '检索程序完整路径和 EXE/DLL 名称
   GetModuleFileNameW App.HINSTANCE, zTemp, MAX_PATH
   x = InStrRev(zTemp, Any ":/\")
   If x Then
      App.Path    = Left(zTemp, x)
      App.EXEname = Mid(zTemp, x + 1)
   Else
      App.Path    = ""
      App.EXEname = zTemp
   End If
End Sub
Setting_up_Application_Common_Information
' 声明/等同 项目中的所有函数，表单和控件
{ALL_INCLUDES}

{FF_WINMAIN}

{FF_PUMPHOOK}

Function FLY_Win_Main(ByVal hInstance As HINSTANCE) As Long
   
  
   ' 调用 FLY_WinMain()函数。 如果该函数返回True，则停止执行该程序。
   If FF_WINMAIN(hInstance) Then Return True
   ' 创建启动窗体。
   #if __FB_OUT_EXE__
      {STARTUP_FORM_NAME}
       
   #endif
   Function = 0
End Function



Public Sub WinMainsexit() Destructor
   FF_WINEND(App.hInstance)
End Sub
FLY_Win_Main(App.hInstance)




