HWND EM OCX

GABRIEL.LOGAN 26/07/2005 21:02:47
#96130
Galera fiz minha OCX , mas não estou conseguindo colocar a opção hWnd .

Estou tentando fazer assim:


Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
PropBag.WriteProperty "hWnd", Rich.hWnd
End Sub

Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
Rich.hWnd = PropBag.ReadProperty("Hwnd", Rich.hWnd)
End Sub

Public Property Get hWnd() As Long
hWnd = Rich.hWnd
End Property

Public Property Let hWnd(NovahWnd As Long)
Rich.hWnd = NovahWnd
PropertyChanged "hWnd"
End Property


Porem aparece o seguinte erro:

Run-Time Error: '383'
Property is Read-Only


O Erro é na seguinte linha:

[txt-backcolor=#C0C0C0]Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
Rich.hWnd = PropBag.ReadProperty("Hwnd", Rich.hWnd)
End Sub[/txt-backcolor]

Alguem sabe como devo fazer pra dar certo?

Alguem ja fez alguma OCX com Hwnd? Pode me Ajudar?


Obrigado

FLW
GABRIEL.LOGAN 27/07/2005 16:11:52
#96255
Depois de muita luta consegui:

O erro era pq o HWND não pode existir na propriedade Private Sub UserControl_ReadProperties(PropBag As PropertyBag)

O certo seria:

Private Sub UserControl_WriteProperties(PropBag As PropertyBag) 
PropBag.WriteProperty "hWnd", Rich.hWnd
End Sub

Public Property Get hWnd() As Long
hWnd = Rich.hWnd
End Property

Public Property Let hWnd(NovahWnd As Long)
Rich.hWnd = NovahWnd
PropertyChanged "hWnd"
End Property


Obrigado pela força pessoal, e um obrigado especial para mim mesmo, afinal eu descobri a solução.

Flw.
Tópico encerrado , respostas não são mais permitidas