Visualizzazione dei risultati da 1 a 4 su 4
  1. #1
    Utente di HTML.it
    Registrato dal
    Jun 2003
    Messaggi
    4,826

    [c++]valore opzionale e com

    ciao .
    Ho le seguente funzione da richiamare in c++ su un activex :

    Syntax
    SapObject.SapModel.PropFrame.GetNameList

    VB6 Procedure
    Function GetNameList(ByRef NumberNames As Long, ByRef MyName() As String, Optional ByVal PropType As eFramePropType) As Long

    Parameters
    NumberNames

    The number of frame section property names retrieved by the program.

    MyName

    This is a one-dimensional array of frame section property names. The MyName array is created as a dynamic, zero-based, array by the API user:

    Dim MyName() as String

    The array is dimensioned to (NumberNames - 1) inside the SAP2000 program, filled with the names, and returned to the API user.

    PropType

    This optional value is one of the following items in the eFramePropType enumeration.

    SECTION_I = 1

    SECTION_CHANNEL = 2

    SECTION_T = 3

    SECTION_ANGLE = 4

    SECTION_DBLANGLE = 5

    SECTION_BOX = 6

    SECTION_PIPE = 7

    SECTION_RECTANGULAR = 8

    SECTION_CIRCLE = 9

    SECTION_GENERAL = 10

    SECTION_DBCHANNEL = 11

    SECTION_AUTO = 12

    SECTION_SD = 13

    SECTION_VARIABLE = 14

    SECTION_JOIST = 15

    SECTION_BRIDGE = 16

    SECTION_COLD_C = 17

    SECTION_COLD_2C = 18

    SECTION_COLD_Z = 19

    SECTION_COLD_L = 20

    SECTION_COLD_2L = 21

    SECTION_COLD_HAT = 22

    SECTION_BUILTUP_I_COVERPLATE = 23

    SECTION_PCC_GIRDER_I = 24

    SECTION_PCC_GIRDER_U = 25


    If no value is input for PropType, names are returned for all frame section properties in the model regardless of type.

    Remarks
    This function retrieves the names of all defined frame section properties of the specified type.

    The function returns zero if the names are successfully retrieved; otherwise it returns nonzero.

    Il problema è che il compilatore mi richiede il valore proptype mentre leggo questo:
    If no value is input for PropType, names are returned for all frame section properties in the model regardless of type.

    come fare a passare un valore "mancante" in c++?

    ho trovato questo:
    http://support.microsoft.com/kb/q238981/

    che spiega come creare un valore opzionale , solo che il compilatore mi richiede il parametro del tipo SAP2000::eFramePropType e il cast a questo tipo sula variabile variant non funziona!

    c:\CMPFRG\CMPIMPORTAPI\BaseApiSapData.cpp(297): error C2664: 'SAP2000::_cPropFrame::GetNameList' : cannot convert parameter 3 from 'VARIANT' to 'SAP2000::eFramePropType'

    Grazie.

  2. #2
    Utente di HTML.it L'avatar di shodan
    Registrato dal
    Jun 2001
    Messaggi
    2,381
    Beh, opzionale significa che si può omettere, ma anche no.
    Che succede se usi uno di quei valori? La funzione fa quello che ti aspetti o no?

  3. #3
    Utente di HTML.it
    Registrato dal
    Jun 2003
    Messaggi
    4,826
    no , mi da subito errore il compilatore,se passo un VARIANT ,questo:
    c:\CMPFRG\CMPIMPORTAPI\BaseApiSapData.cpp(297): error C2664: 'SAP2000::_cPropFrame::GetNameList' : cannot convert parameter 3 from 'VARIANT' to 'SAP2000::eFramePropType'

  4. #4
    Utente di HTML.it L'avatar di shodan
    Registrato dal
    Jun 2001
    Messaggi
    2,381
    Intendevo dire se passi un 'SAP2000::eFramePropType' alla funzione.
    Hai il prototipo di quella funzione in C++ (o C ) generato dal compilatore? Richiede per forza un VARIANT?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.