OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 3122|回复: 3

关于stemwin父窗口与子窗口之间对调之间的问题,求朋友帮忙解决一下

[复制链接]

1

主题

7

帖子

0

精华

初级会员

Rank: 2

积分
79
金钱
79
注册时间
2015-10-23
在线时间
15 小时
发表于 2017-1-15 15:27:58 | 显示全部楼层 |阅读模式
   问题就是:我在主窗口下建立了子窗口,为什么我在实验过程中一点击子窗口就会自动返回到父窗口,我目前以为是因为子窗口的句柄问题导致的,我就把原先guibuilder生成的代码,把Hitem改为hitem1,把下面生成的封装函数中的Hwin改为hwin1,可是还是解决不了这个问题,有没有哪位朋友给予解答方法?子窗口程序如下:
#include "DIALOG.h"#include "led.h"@正点原子
#include "beep.h"

/*********************************************************************
*
*       Defines
*
**********************************************************************
*/
#define ID_WINDOW_0 (GUI_ID_USER + 0x00)
#define ID_IMAGE_0 (GUI_ID_USER + 0x01)
#define ID_SCROLLBAR_0 (GUI_ID_USER + 0x02)
#define ID_BUTTON_0 (GUI_ID_USER + 0x03)
#define ID_BUTTON_1 (GUI_ID_USER + 0x04)
#define ID_BUTTON_2 (GUI_ID_USER + 0x05)
#define ID_BUTTON_3 (GUI_ID_USER + 0x06)
#define ID_BUTTON_4 (GUI_ID_USER + 0x07)
#define ID_BUTTON_5 (GUI_ID_USER + 0x08)
#define ID_BUTTON_6 (GUI_ID_USER + 0x09)
#define ID_BUTTON_7 (GUI_ID_USER + 0x0A)
#define ID_BUTTON_8 (GUI_ID_USER + 0x0B)

#define ID_IMAGE_0_IMAGE_0 0x00

// USER START (Optionally insert additional defines)
// USER END

/*********************************************************************
*
*       Static data
*
**********************************************************************
*/
/*********************************************************************
*
*       _acImage_0, "C:\Users\Administrator\Desktop\±¸óÃí¼±ê\true_00001.bmp", ID_IMAGE_0_IMAGE_0
*/
static const U8 _acImage_0[230454] = {
图片数组
};

// USER START (Optionally insert additional static data)
// USER END

/*********************************************************************
*
*       _aDialogCreate
*/
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
  { WINDOW_CreateIndirect, "Mp3", ID_WINDOW_0, 0, 0, 240, 320, 0, 0x0, 0 },
  { IMAGE_CreateIndirect, "Mp3", ID_IMAGE_0, 1, 0, 240, 320, 0, 0, 0 },
  { SCROLLBAR_CreateIndirect, "Scrollbar", ID_SCROLLBAR_0, -11, 191, 258, 10, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "1", ID_BUTTON_0, 67, 203, 30, 30, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "2", ID_BUTTON_1, 112, 203, 30, 30, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "3", ID_BUTTON_2, 156, 203, 30, 30, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "4", ID_BUTTON_3, 31, 257, 30, 30, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "5", ID_BUTTON_4, 66, 255, 35, 35, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "6", ID_BUTTON_5, 105, 252, 40, 40, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "7", ID_BUTTON_6, 150, 255, 35, 35, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "8", ID_BUTTON_7, 189, 258, 30, 30, 0, 0x0, 0 },
        { BUTTON_CreateIndirect, "9", ID_BUTTON_8, 205, 2, 30, 30, 0, 0x0, 0 },
  // USER START (Optionally insert additional widgets)
  // USER END
};

/*********************************************************************
*
*       Static code
*
**********************************************************************
*/
/*********************************************************************
*
*       _GetImageById
*/
static const void * _GetImageById(U32 Id, U32 * pSize) {
  switch (Id) {
  case ID_IMAGE_0_IMAGE_0:
    *pSize = sizeof(_acImage_0);
    return (const void *)_acImage_0;
  }
  return NULL;
}

// USER START (Optionally insert additional static code)
// USER END

/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
  const void * pData;
  WM_HWIN      hItem1;
  U32          FileSize;
  int          NCode;
  int          Id;
  // USER START (Optionally insert additional variables)
  // USER END
        static u8 ledflag=0;
        static u8 beepflag=0;

  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    //
    // Initialization of 'Mp3'
    //
    hItem1 = WM_GetDialogItem(pMsg->hWin, ID_IMAGE_0);
    pData = _GetImageById(ID_IMAGE_0_IMAGE_0, &FileSize);
    IMAGE_SetBMP(hItem1, pData, FileSize);
    // USER START (Optionally insert additional code for further widget initialization)
    // USER END
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id) {
    case ID_SCROLLBAR_0: // Notifications sent by 'Scrollbar'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_0: // Notifications sent by '1'
      switch(NCode) {
                                hItem1 = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0 );
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
              LED1=~LED1;                //LED1·′×a
                                                        ledflag=~ledflag;
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_1: // Notifications sent by '2'
      switch(NCode) {
                                hItem1 = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1 );
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        BEEP=~BEEP;                //·äÃùÆ÷·′×a                                               
                          beepflag=~beepflag;
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_2: // Notifications sent by '3'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_3: // Notifications sent by '4'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_4: // Notifications sent by '5'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_5: // Notifications sent by '6'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_6: // Notifications sent by '7'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_7: // Notifications sent by '8'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
                        case ID_BUTTON_8: // Notifications sent by '9'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    // USER START (Optionally insert additional code for further Ids)
    // USER END
    }
    break;
  // USER START (Optionally insert additional message handling)
  // USER END
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}

/*********************************************************************
*
*       Public code
*
**********************************************************************
*/
/*********************************************************************
*
*       CreateMp3
*/
WM_HWIN CreateMp3(void);
WM_HWIN CreateMp3(void) {
  WM_HWIN hWin1;

  hWin1 = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
  return hWin1;//Ö÷′°¿ú·μ»ØÖμ
}

// USER START (Optionally insert additional public code)
// USER END

/*************************** End of file ****************************/


正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

1

主题

7

帖子

0

精华

初级会员

Rank: 2

积分
79
金钱
79
注册时间
2015-10-23
在线时间
15 小时
 楼主| 发表于 2017-1-16 13:30:33 | 显示全部楼层
是不是应该在原先的程序里创建子窗口,然后在进行调用
回复 支持 反对

使用道具 举报

1

主题

7

帖子

0

精华

初级会员

Rank: 2

积分
79
金钱
79
注册时间
2015-10-23
在线时间
15 小时
 楼主| 发表于 2017-1-16 16:31:48 | 显示全部楼层
问题已解决,也没有人帮我
回复 支持 反对

使用道具 举报

15

主题

65

帖子

0

精华

中级会员

Rank: 3Rank: 3

积分
343
金钱
343
注册时间
2017-7-17
在线时间
68 小时
发表于 2017-8-8 17:34:58 | 显示全部楼层
等待式恋爱 发表于 2017-1-16 16:31
问题已解决,也没有人帮我

请问怎么解决的,我的是父窗口创建一个子窗口1,然后删除窗口1,创建窗口2,删除窗口2 ,接下来应该显示父窗口(可是显示窗口1,这时已经删除了),不知道问题出在哪?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2024-11-23 08:25

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表