Skip to content
View in the app

A better way to browse. Learn more.

Komuniti @PuTeRA

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Mengenai Hwnd

Featured Replies

Bagaimana untuk kita create satu object/control di dalam form secara runtime berdasarkan hwnd sesuatu object ? Saya kebuntuan.

Test Container
CODE
Option Explicit

Private IWindowDef_Form As TestOCX.frmContainer

Private Sub Class_Initialize()
    Set IWindowDef_Form = New TestOCX.frmContainer
End Sub

Private Sub Class_Terminate()
    Call Unload(IWindowDef_Form)
    Set IWindowDef_Form = Nothing
End Sub


Public Property Get IWindowDef_Hwnd() As Long
    If Not IWindowDef_Form Is Nothing Then
        IWindowDef_Hwnd = IWindowDef_Form.fContainer.hWnd
    End If
End Property

Public Property Get IWindowDef_Width() As Long
    If Not IWindowDef_Form Is Nothing Then
        IWindowDef_Width = IWindowDef_Form.fContainer.Width
    End If
End Property

Public Property Let IWindowDef_Width(value As Long)
    If Not IWindowDef_Form Is Nothing Then
        IWindowDef_Form.fContainer.Width = value
    End If
End Property

Public Property Get IWindowDef_Height() As Long
    If Not IWindowDef_Form Is Nothing Then
        IWindowDef_Height = IWindowDef_Form.fContainer.Height
    End If
End Property

Public Property Let IWindowDef_Height(value As Long)
    If Not IWindowDef_Form Is Nothing Then
        IWindowDef_Form.fContainer.Height = value
    End If
End Property

Public Property Get IWindowDef_Top() As Long
    If Not IWindowDef_Form Is Nothing Then
        IWindowDef_Top = IWindowDef_Form.fContainer.Top
    End If
End Property

Public Property Let IWindowDef_Top(value As Long)
    If Not IWindowDef_Form Is Nothing Then
        IWindowDef_Form.fContainer.Top = value
    End If
End Property
Public Property Get IWindowDef_Left() As Long
    If Not IWindowDef_Form Is Nothing Then
        IWindowDef_Left = IWindowDef_Form.fContainer.Left
    End If
End Property

Public Property Let IWindowDef_Left(value As Long)
    If Not IWindowDef_Form Is Nothing Then
        IWindowDef_Form.fContainer.Left = value
    End If
End Property


Test form
CODE
Option Explicit

'Private clsTestOCX As TestOCX.clsTest
Private clsTestOCX As Object

Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long

Private Sub Form_Load()
    Dim m_res As Long
'    Set clsTestOCX = New TestOCX.clsTest
    Set clsTestOCX = CreateObject("TestOCX.clsTest")
    m_res = SetParent(clsTestOCX.IWindowDef_Hwnd, Frame1.hWnd)
    clsTestOCX.IWindowDef_Height = Frame1.Height
    clsTestOCX.IWindowDef_Width = Frame1.Width
    clsTestOCX.IWindowDef_Left = 0
    clsTestOCX.IWindowDef_Top = 0

'    Frame1.hWnd = clsTestOCX.IWindowDef_Hwnd
End Sub


Seperti yang kita tahu property Hwnd adalah read-only.

Setakat ni trick yg saya tahu adalah dengan

CODE
SetParent(clsTestOCX.IWindowDef_Hwnd, Frame1.hWnd)


ada cadangan lain ?

Edited by fatah

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.