none
converting a C++ interface member to vb.NET RRS feed

  • Question

  • i want to convert this sample of code from c++ to vb.NET:

    the first method (these are an interface methods):

            

    virtual void STDMETHODCALLTYPE RSSetViewports( 
                /* [annotation] */ 
                _In_range_(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE)  UINT NumViewports,
                /* [annotation] */ 
                _In_reads_opt_(NumViewports)  const D3D10_VIEWPORT *pViewports) = 0;

    remark : D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE = 16

    the second method  is:

      virtual void STDMETHODCALLTYPE ClearRenderTargetView( 
                /* [annotation] */ 
                _In_  ID3D10RenderTargetView *pRenderTargetView,
                /* [annotation] */ 
                _In_  const FLOAT ColorRGBA[ 4 ]) = 0;

    remark: FLOAT is float type

    my convertion is:

    Sub RSSetViewports(ByRef NumViewports As UInteger,
                           ByVal pViewports() As IntPtr)

    but in run-time,  nothing happens!!!

     Sub ClearRenderTargetView(ByVal pRenderTargetView As ID3D10RenderTargetView,
                                    ByVal ColorRGBA As D3DXVECTOR4)

     Public Structure D3DXVECTOR4
           
            Dim x As Single
            
            Dim y As Single
          
            Dim z As Single
            
            Dim w As Single
            Public Sub New(ByVal xp As Single, ByVal yp As Single, ByVal zp As Single, ByVal wp As Single)
                x = xp
                y = yp
                z = zp
                w = wp


            End Sub
        End Structure


    i can't to check out the result of these 2 procedures because they are sub and not a functions returning an HRESULT.
    Monday, July 16, 2018 8:29 PM

All replies

  • Hi,

    thanks for posting here.

    This forum is about c++ code issues. For your case which is more related to VB.net coding, I will move it to VB forum for better support.

    Your understanding and cooperation will be grateful.

    Best Regards,

    Baron Bi


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, July 17, 2018 7:46 AM
  • Hi 

    You have defined two pure virtual functions in C++. Do you want to convert two pure virtual functions into vb.net? But vb.net's way of writing virtual methods is:

    Overridable Sub RSSetViewports(ByRef NumViewports As UInteger, ByVal pViewports() As IntPtr)

    Overridable Sub ClearRenderTargetView(ByVal pRenderTargetView As ID3D10RenderTargetView,
                                    ByVal ColorRGBA As D3DXVECTOR4)

    Subclass inherits the parent class and then overrides the method

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, July 17, 2018 8:42 AM
    Moderator
  • i am talking about the signatures, are they corrects?

    also , the overridable is not allowed for using in interface members.

    remark: the 2 methods are contained in an interface not a class.
    Tuesday, July 17, 2018 9:18 AM