The equivalent C++ MFC code for the VisualBasic function  
Author Message
bioan





PostPosted: Visual C++ General, The equivalent C++ MFC code for the VisualBasic function Top

Which is the equivalent C++ MFC code of the following VisualBasic function

Function SelectMany(sSetName As String) As MyApp.SelectionSet
Dim filterTypes() As Integer
Dim filterData() As Variant
ReDim filterTypes(1 To 2)
ReDim filterData(1 To 2)
filterTypes(1) = 0: filterData(1) = "line,arc,circle,LWpolyline"
filterTypes(2) = 62: filterData(2) = 256
Set SelectMany = thisdrawing.SelectionSets.Add(sSetName)
Call SelectMany.SelectOnScreen(filterTypes, filterData)
End Function

Ioan



Visual C++13  
 
 
cgraus





PostPosted: Visual C++ General, The equivalent C++ MFC code for the VisualBasic function Top

There is not always a direct match between VB and MFC. What type is thisdrawing

What are you trying to do



 
 
bioan





PostPosted: Visual C++ General, The equivalent C++ MFC code for the VisualBasic function Top

The main problem in the code is these lines with declaration of VARIANT's variables. I do not know how to translate in C++/MFC..

Dim filterTypes() As Integer
Dim filterData() As Variant
ReDim filterTypes(1 To 2)
ReDim filterData(1 To 2)
filterTypes(1) = 0: filterData(1) = "line,arc,circle,LWpolyline"
filterTypes(2) = 62: filterData(2) = 256

The rest of the code, i can handle..
Kind regards,
Ioan

 
 
cgraus





PostPosted: Visual C++ General, The equivalent C++ MFC code for the VisualBasic function Top

msdn2.microsoft.com/en-us/library/x295h94e.aspx

_variant_t is a wrapper that makes it much easier to have to dealt with VARIANTs



 
 
Viorel.





PostPosted: Visual C++ General, The equivalent C++ MFC code for the VisualBasic function Top

Perhaps this can help:

 

#include "stdafx.h"

#include <comutil.h>

 

. . .

 

_bstr_t     s              = "line,arc,circle,LWpolyline";

int         filterTypes[2] = { 0, 62 };

_variant_t  filterData[2]  = { s, 256 };