簡體   English   中英

Windows窗體替換控制台窗口

[英]Substitute Console window by Windows Forms

我已經在Visual Studio 2012 C ++中創建了Win32控制台應用程序項目。

如何用更具吸引力的GUI(例如Windows Forms)代替“控制台”窗口?

int32_t main(int32_t argc, char* argv[])
{
const char *date = "20150428_1\\";
int     mode=0; 
_CallServerPtr      pCallServer;
uint32_t start_address_comp=0;
uint32_t start_address_module=0;
const char*  xmlFile_tx_dbb="tx_dbb.xml";;
char str[100] = "\0";
char localeStr[64];
memset(localeStr, 0, sizeof localeStr);
const char *l_path = "..\\XERCES\\Configs\\";
std::string buf = "";
double Fsym_Hz=(1/1.15)*1e9;
int selection=0;
int user_selection=0;


try
{
    if (strlen(localeStr))
    {
        XMLPlatformUtils::Initialize(localeStr);
    }
    else
    {
        XMLPlatformUtils::Initialize();
    }
}

catch (const XMLException& toCatch)
{
     XERCES_STD_QUALIFIER cerr << "Error during initialization! :\n"
          << StrX(toCatch.getMessage()) << XERCES_STD_QUALIFIER endl;
}


static const XMLCh gLS[] = { chLatin_L, chLatin_S, chNull };

DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(gLS);
DOMLSParser       *parser = ((DOMImplementationLS*)impl)->createLSParser(DOMImplementationLS::MODE_SYNCHRONOUS, 0);
DOMConfiguration  *config = parser->getDomConfig();
DOMLSSerializer   *theSerializer = ((DOMImplementationLS*)impl)->createLSSerializer();
DOMLSOutput       *theOutputDesc = ((DOMImplementationLS*)impl)->createLSOutput();



config->setParameter(XMLUni::fgDOMDatatypeNormalization, true);


DOMCountErrorHandler errorHandler;
config->setParameter(XMLUni::fgDOMErrorHandler, &errorHandler);
XERCES_STD_QUALIFIER ifstream fin;

//reset error count first
 errorHandler.resetErrors();*/

 // reset document pool
 parser->resetDocumentPool();


char* pszHostname = NULL;
pSaIn  = 0;
pSaOut = 0;

// Initialize the COM Library
CoInitialize(NULL);


    if (!pszHostname)
    {
        // Create the CallServer server object on the local computer
        pCallServer.CreateInstance(CLSID_CallServer);
    }

    if (pCallServer == NULL)
        throw "Failed to create the CallableVEE CallServer object";


// Load the VEE User Function library
    char strpath[256];
    strcpy (strpath,reposity_path);
    strcat (strpath,l_path_vee);

    _bstr_t bstrLibPath(strpath);
    LibraryPtr pLib = pCallServer->GetLibraries()->Load(bstrLibPath);
    // Print out the names of the UserFunctions in this library.
    UserFunctionsPtr pUserFuncColl = pLib->GetUserFunctions();

    VARIANT_BOOL bDebug = VARIANT_FALSE;

    pCallServer->PutDebug(bDebug);


    // Variables added by ivi
    float *freq =(float *)_aligned_malloc(6,16); // Read frequency vector
    // Previous variables
    int32_t devIdx;
    int32_t modeClock;
    int32_t ifType;
    const char *devType;
    char fpga_device_type[32];
    int32_t rc;
    int32_t ref_clk=0;
    uint32_t carrier=0;
    uint32_t odelay_dac0 = 0;
    uint32_t odelay_dac1 = 0;




    // Parse the application arguments
    if(argc!=5) {
            printf("Usage: FMCxxxApp.exe {interface type} {device type} {device index} {clock mode} \n\n");
            printf(" {interface type} can be either 0 (PCI) or 1 (Ethernet). At CEIT, we use 1 (Ethernet).\n");
            printf(" {device type} is a string defining the target hardware (VP680, ML605, ...). At CEIT, we use VC707.\n");
            printf(" {device index} is a PCI index or an Ethernet interface index. This value depends on the PC.\n");
            printf(" {clock mode} can be either 0 (Int. Clock) or 1 (Ext. Clock)\n");
            printf("\n");
            printf("\n");
            printf("Example: Fmc230APP.exe 1 VC707 0 0\n");
            printf("\n");
            printf("\n");
            printf(" List of NDIS interfaces found in the system {device index}:\n");
            printf(" -----------------------------------------------------------\n");
            if(sipif_getdeviceenumeration(API_ENUM_DISPLAY)!=SIPIF_ERR_OK) {
                    printf("Could not obtain NDIS(Ethernet) device enumeration...\n Check if the 4dspnet driver installed or if the service started?\n");
                    printf("You can discard this error if you do not have any Ethernet based product in use.");
            }

            if( EXIT_IF_ERRORS)
            {
                sipif_free();
                system("pause");
                return -1;
            }
         ...
  }  

您的意思是在Windows窗體中具有相同的代碼。 那行不通。 printf和其他命令僅在控制台應用程序中起作用。 您必須創建一個Windows窗體應用程序並為其重寫代碼。 您必須重寫在Windows窗體應用程序中不起作用的所有命令。 可能存在一個轉換應用程序,但是對於這段簡短的代碼,我認為最好重寫它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM