请教:brew画字问题
大家好:我写了一个简单的程序来练习剪切板的用法,建立了两个工程,第一个工程填充数据,第二个工程复制数据:
第一个工程的源码:
static void test_SetData(ShareData_Set* pMe){ int ret = 0; ShareData data; data.a = 1; data.b = 2; MEMSET(data.buf, 0, sizeof(data.buf)); data.buf[0] = 'a'; data.buf[1] = 'b'; data.buf[2] = 'c'; data.buf[3] = 'd'; data.buf[4] = 'e'; ret = ICLIPBOARD_SetData(pMe->m_pClipboard, FGTIAN_DATA_FORMAT, &data, sizeof(data)); if (ret) { DBGPRINTF("ICLIPBOARD_SetData error: %d", ret); } // 启动past程序,然后发送一个消息过去 ISHELL_StartApplet(pMe->a.m_pIShell, AEECLSID_SHAREDATA_PASTE); ISHELL_PostEvent(pMe->a.m_pIShell, AEECLSID_SHAREDATA_PASTE, EVT_USER_PASTE, 0, 0);}
case EVT_USER_PASTE: test_PasteData(pMe); return TRUE;static void test_PasteData(ShareData_Paste* pMe){ ShareData data; char buf[64]; AECHAR display[64] = {0}; int len = sizeof(data); MEMSET(&data, 0, sizeof(data)); ICLIPBOARD_GetData(pMe->m_pClipboard, FGTIAN_DATA_FORMAT, &data, &len); SPRINTF(buf, "a = %d, b = %d, buf: %s", data.a, data.b, data.buf); STRTOWSTR(buf, display, sizeof(display)); IDISPLAY_ClearScreen(pMe->a.m_pIDisplay); IDISPLAY_DrawText(pMe->a.m_pIDisplay, AEE_FONT_NORMAL, display, -1, 0, 0, 0, IDF_ALIGN_MIDDLE); IDISPLAY_Update(pMe->a.m_pIDisplay);}
case AVK_CLR:{ ISHELL_PostEvent(pMe->a.m_pIShell, AEECLSID_SHAREDATA_SET, EVT_USER_CLOSED, 0, 0); ISHELL_CloseApplet(pMe->a.m_pIShell, FALSE); return TRUE;}
case EVT_USER_CLOSED:{ PrintInfo(pMe, L"the second applet closed"); return TRUE;}static void PrintInfo(ShareData_Set* pMe, AECHAR* text){ IDISPLAY_ClearScreen(pMe->a.m_pIDisplay); IDISPLAY_DrawText(pMe->a.m_pIDisplay, AEE_FONT_NORMAL, text, -1, 0, 0, 0, IDF_ALIGN_MIDDLE); IDISPLAY_Update(pMe->a.m_pIDisplay);}