求教大神!!!
V831方案用MINIGUI去实现界面显示。程序编译成功,但运行到窗口创建处出错。
部分代码:
int main (int args, const char* arg[])
{
MSG Msg;
MAINWINCREATE CreateInfo;
HWND hMainWnd;
#ifdef _MGRM_PROCESSES
JoinLayer (NAME_DEF_LAYER, arg[0], 0, 0);
#endif
InitCreateInfo (&CreateInfo);
sm_debug("CreateMainWindow\n");
hMainWnd = CreateMainWindow (&CreateInfo);
if (hMainWnd == HWND_INVALID){
sm_error("CreateMainWindow fail\n");
return -1;
}
sm_debug("CreateMainWindow sucess\n");
while (GetMessage (&Msg, hMainWnd)) {
DispatchMessage (&Msg);
}
MainWindowThreadCleanup (hMainWnd);
return 0;
}
创建窗口原函数:
HWND GUIAPI CreateMainWindowEx (PMAINWINCREATE pCreateInfo,
const char* werdr_name, const WINDOW_ELEMENT_ATTR* we_attrs,
const char* window_name, const char* layer_name)
{
//
PMAINWIN pWin;
fprintf(stderr,"CreateMainWindowEx run zth\n");
if (pCreateInfo == NULL) {
return HWND_INVALID;
}
if (!(pWin = calloc(1, sizeof(MAINWIN)))) {
return HWND_INVALID;
}
fprintf(stderr,"CreateMainWindowEx run111 zth\n");
#ifdef _MGRM_THREADS
fprintf(stderr,"CreateMainWindowEx run 11\n");
if (pCreateInfo->hHosting == HWND_DESKTOP || pCreateInfo->hHosting == 0) {
/*
** Create thread infomation and message queue for this new main window.
*/
if ((pWin->pMessages = GetMsgQueueThisThread ()) == NULL) {
if (!(pWin->pMessages = mg_InitMsgQueueThisThread ()) ) {
free (pWin);
return HWND_INVALID;
}
pWin->pMessages->pRootMainWin = pWin;
}
else {
/* Already have a top level main window, in case of user have set
a wrong hosting window */
pWin->pHosting = pWin->pMessages->pRootMainWin;
}
}
else {
pWin->pMessages = GetMsgQueueThisThread ();
if (pWin->pMessages != kernel_GetMsgQueue (pCreateInfo->hHosting) ||
pWin->pMessages == NULL) {
free (pWin);
return HWND_INVALID;
}
}
fprintf(stderr,"CreateMainWindowEx run 22");
if (pWin->pHosting == NULL)
pWin->pHosting = gui_GetMainWindowPtrOfControl (pCreateInfo->hHosting);
/* leave the pHosting is NULL for the first window of this thread. */
#else
fprintf(stderr,"CreateMainWindowEx runzth 11\n");
pWin->pHosting = gui_GetMainWindowPtrOfControl (pCreateInfo->hHosting);
if (pWin->pHosting == NULL)
pWin->pHosting = __mg_dsk_win;
报错信息:
dbg line[80 ] sample_philips_recorder.c CreateMainWindow
CreateMainWindowEx run zth
CreateMainWindowEx run111 zth
CreateMainWindowEx run 11
Segmentation fault (core dumped)
求教原因!!!!