Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    V831方案MINIGUI创建窗口失败

    其它全志芯片讨论区
    1
    1
    1090
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Z
      zhangtanghua LV 2 last edited by

      求教大神!!!
      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)

      求教原因!!!!

      1 Reply Last reply Reply Quote Share 0
      • 1 / 1
      • First post
        Last post

      Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

      行为准则 | 用户协议 | 隐私权政策