控制台程序如何加入对话框?
现在有一个编译通过的控制台程序,现在想把它改成对话框的或者是想用对话框来控制程序的执行,比如程序要输出显示信息时就以对话框形式弹出,而主程序就停止,当点击对话框后主程序继续运行,本人是初学者,还请各位大虾指教!我贴出一部分源程序:
int
main(int argc, char *argv[])
{
BOARD_INFO tBoardInfo;
FIRMWAREINFO tFirmwareInfo;
DRIVERINFO tDriverInfo;
RCS_MESSAGE tMsg;
RCS_TELEGRAMHEADER_10 *ptRcsTelegramheader10;
DDLM_DOWNLOAD_REQUEST *ptDownloadRequest;
DPM_PLC_PARAMETER tDpmPlcParameter;
DPM_SLAVE_SINGLE_DIAGNOSTICS *ptDpmSlaveSingleDiagnostic;
unsigned char *ptCfgData;
DPM_BUS_DP *ptBusDpm;
DPM_SL_PRM_HEADER *ptDpmSlPrmHeader;
DPM_SL_PRM_PRM_DATA *ptDpmSlPrmPrmData;
unsigned short usUserParameterDataLen;
DPM_SL_PRM_CFG_DATA *ptDpmSlCfgData;
DPM_SL_PRM_ADD_TAB *ptDpmSlPrmAddTab;
unsigned char bInputDataLen;
unsigned char bInputCount;
unsigned char bOutputDataLen;
unsigned char bOutputCount;
unsigned char bDevManufactorDataLen;
DPM_SL_PRM_USR_DATA *ptDpmSlPrmUsrData;
/* offset pointer in I/O area of dual-port memory */
unsigned short usInputOffset = 0;
unsigned short usOutputOffset = 0;
short sRet;
unsigned short i,j;
UNREFERENCED_PARAMETER( argv);
UNREFERENCED_PARAMETER( argc);
/*
* initialize global variables 初始化全局变量
*/
/* open driver first 首先打开驱动 */
if ( ( sRet = DevOpenDriver(0)) != DRV_NO_ERROR )
{
printf("DevOpenDriver(0): %d\n", sRet);
}
else
if ( (sRet = DevGetBoardInfo(0, sizeof(tBoardInfo), &tBoardInfo)) != DRV_NO_ERROR )
{
printf("DevGetBoardInfo(0, sizeof(BOARD_INFO), %p): %d\n", tBoardInfo, sRet);
DevCloseDriver(0);
}
else
{
/*
* scan all available boards for DNM-firmware
*/
for ( i = 0; i < MAX_DEV_BOARDS; i++ )
{
if ( tBoardInfo.tBoard[i].usAvailable == 1 )
{
/*
* found an available board, check if it has the DNM firmware 查找到可用的板卡,检查是否有DNM硬件
*/
if ( (sRet = DevInitBoard(tBoardInfo.tBoard[i].usBoardNumber, NULL)) != DRV_NO_ERROR )
{
/*printf("DevInitBoard(%d, NULL): %d, board skipped\n", tBoardInfo.tBoard[i].usBoardNumber, sRet); */
}
else
if ( (sRet = DevGetInfo( tBoardInfo.tBoard[i].usBoardNumber,
GET_FIRMWARE_INFO,
sizeof(tFirmwareInfo),
&tFirmwareInfo)) != DRV_NO_ERROR )
{
DevExitBoard(tBoardInfo.tBoard[i].usBoardNumber);
}
else
if ( strncmp((char*)&tFirmwareInfo.abFirmwareName, "PB-COMBI", 8) &&
strncmp((char*)&tFirmwareInfo.abFirmwareName, "DPM ", 8)
)
{
DevExitBoard(tBoardInfo.tBoard[i].usBoardNumber);
}
else
{
break;
} /* if ( sRet = DevInitBoard(i, NULL) != DRV_NO_ERROR ) else ... else */
} /* if ( ((BOARD_INFO *)abInfo)->tBoard[i].usAvailable == 1 ) */
} /* for ( i = 0; i < MAX_DEV_BOARDS; i++ ) */
if ( i < MAX_DEV_BOARDS )
{
/*
* found a board with DP capable firmware
*/
usBoardNumber = tBoardInfo.tBoard[i].usBoardNumber;
/*
* print firmware information 输出硬件信息
*/
/* HWND CreateDialogParam( HINSTANCE hInstance,
LPCTSTR lpTemplateName,
HWND hWndParent,
DLGPROC lpDialogFunc,
LPARAM dwInitParam);*/
printf("Board %d: ", usBoardNumber);
for ( i = 0; i < 16; i++ ) putchar(tFirmwareInfo.abFirmwareName[i]);
putchar(' ');
for ( i = 0; i < 16; i++ ) putchar(tFirmwareInfo.abFirmwareVersion[i]);
printf("\n");
比如红色代码部分想改成对话框输出