Jump to content

Vicky

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by Vicky

  1. After conversion SMP function fails on below highlighted code VB6 Code:Public Function If VBA.IsObject(strGrpName) = Fa GetSPMProp(ByVal strGrpName As Variant, _ ByVal strPrpName As String, _ ByRef blnExists As Boolean) As Variant Dim spmGrp As COMSVCSLib.SharedPropertyGroup Dim spmPrp As COMSVCSLib.SharedProperty Dim blnGrpExists As Boolean ' get the SPM group lse Then Set spmGrp = GetSPMGroup(LockSetGet, strGrpName, blnGrpExists) Else Set spmGrp = strGrpName End If ' create the SPM property Set spmPrp = spmGrp.CreateProperty(strPrpName, blnExists) ' get property value GetSPMProp = spmPrp.Value Set spmPrp = Nothing If VBA.IsObject(strGrpName) = False Then Set spmGrp = Nothing Else 'Set spmGrp = strGrpName End If If GetSPMProp = "0" Then GetSPMProp = "" End If Set spmGrp = Nothing Set spmPrp = Nothing End Function VB.Net Code Public Function GetSPMProp(ByVal strGrpName As Object, ByVal strPrpName As String, ByRef blnExists As Boolean) As Object Dim spmGrp As System.EnterpriseServices.SharedPropertyGroup Dim spmPrp As System.EnterpriseServices.SharedProperty Dim blnGrpExists As Boolean ' get the SPM group 'UPGRADE_WARNING: IsObject has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"' If IsReference(strGrpName) = False Then 'UPGRADE_WARNING: Couldn't resolve default property of object strGrpName. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' spmGrp = GetSPMGroup(COMSVCSLib.__MIDL___MIDL_itf_autosvcs_0001_0164_0001.LockSetGet, strGrpName, blnGrpExists) Else spmGrp = strGrpName-----this line throws error Unable to cast System.string to System.EnterpriseServices.SharedPropertyGroup End If ' create the SPM property spmPrp = spmGrp.CreateProperty(strPrpName, blnExists) ' get property value 'UPGRADE_WARNING: Couldn't resolve default property of object GetSPMProp. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' GetSPMProp = spmPrp.Value 'UPGRADE_NOTE: Object spmPrp may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6E35BFF6-CD74-4B09-9689-3E1A43DF8969"' spmPrp = Nothing 'UPGRADE_WARNING: IsObject has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"' If IsReference(strGrpName) = False Then 'UPGRADE_NOTE: Object spmGrp may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6E35BFF6-CD74-4B09-9689-3E1A43DF8969"' spmGrp = Nothing Else 'Set spmGrp = strGrpName End If 'UPGRADE_WARNING: Couldn't resolve default property of object GetSPMProp. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' If GetSPMProp = "0" Then 'UPGRADE_WARNING: Couldn't resolve default property of object GetSPMProp. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' GetSPMProp = "" End If 'UPGRADE_NOTE: Object spmGrp may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6E35BFF6-CD74-4B09-9689-3E1A43DF8969"' spmGrp = Nothing 'UPGRADE_NOTE: Object spmPrp may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6E35BFF6-CD74-4B09-9689-3E1A43DF8969"' spmPrp = Nothing End Function
  2. I have converted my vb6 code to c#, after conversion i ran the application and i am getting below for CopyMemory function in kernal32.cs Marshal.StructureToPtr(Dest, source, true) Error: System.AccessVoilationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use