这篇教程C++ GlobalUnlock函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GlobalUnlock函数的典型用法代码示例。如果您正苦于以下问题:C++ GlobalUnlock函数的具体用法?C++ GlobalUnlock怎么用?C++ GlobalUnlock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GlobalUnlock函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: DdeMessageWindowstatic LRESULT CALLBACK DdeMessageWindow(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){ switch (msg) { case WM_DDE_INITIATE: { ATOM hSzApp = LOWORD(lParam); /* no UnpackDDElParam() here */ ATOM hSzTopic = HIWORD(lParam); if ((hSzApp == GlobalFindAtom(DDEAPP) && hSzTopic == GlobalFindAtom(DDETOPIC)) || !hSzApp) { hSzApp = GlobalAddAtom(DDEAPP); hSzTopic = GlobalAddAtom(DDETOPIC); if (hSzApp && hSzTopic) /* PackDDElParam() only for posted msgs */ SendMessage((HWND)wParam, WM_DDE_ACK, (WPARAM)hwnd, MAKELPARAM(hSzApp, hSzTopic)); if (hSzApp) GlobalDeleteAtom(hSzApp); if (hSzTopic) GlobalDeleteAtom(hSzTopic); } } return 0; case WM_DDE_EXECUTE: /* posted message */ HGLOBAL hCommand; if (UnpackDDElParam(msg, lParam, NULL, (PUINT_PTR)&hCommand)) { /* ANSI execute command can't happen for shell */ if (IsWindowUnicode((HWND)wParam)) { TCHAR *pszCommand = (TCHAR*)GlobalLock(hCommand); if (pszCommand != NULL) { TCHAR *pszAction = GetExecuteParam(&pszCommand); TCHAR *pszArg = GetExecuteParam(&pszCommand); if (pszArg != NULL) { /* we are inside miranda here, we make it async so the shell does * not timeout regardless what the plugins try to do. */ if (!mir_tstrcmpi(pszAction, _T("file"))) CallFunctionAsync(FileActionAsync, mir_tstrdup(pszArg)); else if (!mir_tstrcmpi(pszAction, _T("url"))) CallFunctionAsync(UrlActionAsync, mir_tstrdup(pszArg)); } GlobalUnlock(hCommand); } } DDEACK ack; memset(&ack, 0, sizeof(ack)); lParam = ReuseDDElParam(lParam, msg, WM_DDE_ACK, *(PUINT)&ack, (UINT_PTR)hCommand); if (!PostMessage((HWND)wParam, WM_DDE_ACK, (WPARAM)hwnd, lParam)) { GlobalFree(hCommand); FreeDDElParam(WM_DDE_ACK, lParam); } } return 0; case WM_DDE_TERMINATE: PostMessage((HWND)wParam, msg, (WPARAM)hwnd, 0); /* ack reply */ return 0; case WM_DDE_REQUEST: case WM_DDE_ADVISE: case WM_DDE_UNADVISE: case WM_DDE_POKE: /* fail safely for those to avoid memory leak in lParam */ { ATOM hSzItem; DDEACK ack; memset(&ack, 0, sizeof(ack)); if (UnpackDDElParam(msg, lParam, NULL, (PUINT_PTR)&hSzItem)) { lParam = ReuseDDElParam(lParam, msg, WM_DDE_ACK, *(PUINT)&ack, (UINT)hSzItem); if (!PostMessage((HWND)wParam, WM_DDE_ACK, (WPARAM)hwnd, lParam)) { if (hSzItem) GlobalDeleteAtom(hSzItem); FreeDDElParam(WM_DDE_ACK, lParam); } } return 0; } } return DefWindowProc(hwnd, msg, wParam, lParam);}
开发者ID:kxepal,项目名称:miranda-ng,代码行数:75,
示例2: vd_printf// If handle_clipboard_request() fails, its caller sends VD_AGENT_CLIPBOARD message with type// VD_AGENT_CLIPBOARD_NONE and no data, so the client will know the request failed.bool VDAgent::handle_clipboard_request(VDAgentClipboardRequest* clipboard_request){ VDAgentMessage* msg; uint32_t msg_size; UINT format; HANDLE clip_data; uint8_t* new_data = NULL; long new_size = 0; size_t len = 0; CxImage image; VDAgentClipboard* clipboard = NULL; if (_clipboard_owner != owner_guest) { vd_printf("Received clipboard request from client while clipboard is not owned by guest"); return false; } if (!(format = get_clipboard_format(clipboard_request->type))) { vd_printf("Unsupported clipboard type %u", clipboard_request->type); return false; } // on encoding only, we use HBITMAP to keep the correct palette if (format == CF_DIB) { format = CF_BITMAP; } if (!IsClipboardFormatAvailable(format) || !OpenClipboard(_hwnd)) { return false; } if (!(clip_data = GetClipboardData(format))) { CloseClipboard(); return false; } switch (clipboard_request->type) { case VD_AGENT_CLIPBOARD_UTF8_TEXT: if (!(new_data = (uint8_t*)GlobalLock(clip_data))) { break; } len = wcslen((LPCWSTR)new_data); new_size = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)new_data, (int)len, NULL, 0, NULL, NULL); break; case VD_AGENT_CLIPBOARD_IMAGE_PNG: case VD_AGENT_CLIPBOARD_IMAGE_BMP: { DWORD cximage_format = get_cximage_format(clipboard_request->type); HPALETTE pal = 0; ASSERT(cximage_format); if (IsClipboardFormatAvailable(CF_PALETTE)) { pal = (HPALETTE)GetClipboardData(CF_PALETTE); } if (!image.CreateFromHBITMAP((HBITMAP)clip_data, pal)) { vd_printf("Image create from handle failed"); break; } if (!image.Encode(new_data, new_size, cximage_format)) { vd_printf("Image encode to type %u failed", clipboard_request->type); break; } vd_printf("Image encoded to %lu bytes", new_size); break; } } if (!new_size) { vd_printf("clipboard is empty"); goto handle_clipboard_request_fail; } if ((_max_clipboard != -1) && (new_size > _max_clipboard)) { vd_printf("clipboard is too large (%ld > %d), discarding", new_size, _max_clipboard); goto handle_clipboard_request_fail; } msg_size = sizeof(VDAgentMessage) + sizeof(VDAgentClipboard) + new_size; msg = (VDAgentMessage*)new uint8_t[msg_size]; msg->protocol = VD_AGENT_PROTOCOL; msg->type = VD_AGENT_CLIPBOARD; msg->opaque = 0; msg->size = (uint32_t)(sizeof(VDAgentClipboard) + new_size); clipboard = (VDAgentClipboard*)msg->data; clipboard->type = clipboard_request->type; switch (clipboard_request->type) { case VD_AGENT_CLIPBOARD_UTF8_TEXT: WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)new_data, (int)len, (LPSTR)clipboard->data, new_size, NULL, NULL); GlobalUnlock(clip_data); break; case VD_AGENT_CLIPBOARD_IMAGE_PNG: case VD_AGENT_CLIPBOARD_IMAGE_BMP: memcpy(clipboard->data, new_data, new_size); image.FreeMemory(new_data); break; } CloseClipboard(); write_clipboard(msg, msg_size); delete[] (uint8_t *)msg; return true;handle_clipboard_request_fail://.........这里部分代码省略.........
开发者ID:freedesktop-unofficial-mirror,项目名称:spice__win32__vd_agent,代码行数:101,
示例3: WndProcLRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam){ static HWND hList; static HWND hButton; switch (msg) { case WM_CREATE: hButton = CreateWindow(TEXT("BUTTON"), TEXT("取得"), WS_VISIBLE | WS_CHILD | WS_DISABLED, 0, 0, 0, 0, hWnd, (HMENU)IDOK, ((LPCREATESTRUCT)lParam)->hInstance, 0); hList = CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("LISTBOX"), 0, WS_VISIBLE | WS_CHILD | WS_VSCROLL | LBS_NOINTEGRALHEIGHT | LBS_HASSTRINGS | LBS_NOTIFY, 0, 0, 0, 0, hWnd, 0, ((LPCREATESTRUCT)lParam)->hInstance, 0); PostMessage(hWnd, WM_COMMAND, IDOK, 0); break; case WM_SIZE: MoveWindow(hButton, 10, 10, 256, 32, TRUE); MoveWindow(hList, 10, 50, LOWORD(lParam) - 20, HIWORD(lParam) - 60, TRUE); break; case WM_COMMAND: if (LOWORD(wParam) == IDOK) { EnableWindow(hButton, FALSE); SendMessage(hList, LB_RESETCONTENT, 0, 0); DWORD_PTR dwSize; LPBYTE lpByte = DownloadToMemory(TEXT("https://api.github.com/users/kenjinote/repos"), &dwSize); { picojson::value v; std::string err; picojson::parse(v, lpByte, lpByte + dwSize, &err); if (err.empty()) { picojson::array arr = v.get<picojson::array>(); for (auto v : arr) { picojson::object obj = v.get<picojson::object>(); const INT_PTR nIndex = SendMessageA(hList, LB_ADDSTRING, 0, (LPARAM)(obj["name"].to_str().c_str())); std::string strCloneUrl = obj["clone_url"].to_str(); LPSTR lpszCloneUrl = (LPSTR)GlobalAlloc(0, strCloneUrl.size() + 1); lstrcpyA(lpszCloneUrl, strCloneUrl.c_str()); SendMessage(hList, LB_SETITEMDATA, nIndex, (LPARAM)lpszCloneUrl); } } } GlobalFree(lpByte); EnableWindow(hButton, TRUE); } else if ((HWND)lParam == hList && HIWORD(wParam) == LBN_SELCHANGE) { const INT_PTR nIndex = SendMessage(hList, LB_GETCURSEL, 0, 0); if (nIndex != LB_ERR) { LPSTR lpData = (LPSTR)SendMessage(hList, LB_GETITEMDATA, nIndex, 0); HGLOBAL hMem = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, lstrlenA(lpData) + 1); LPSTR lpszBuf = (LPSTR)GlobalLock(hMem); lstrcpyA(lpszBuf, lpData); GlobalUnlock(hMem); OpenClipboard(0); EmptyClipboard(); SetClipboardData(CF_TEXT, hMem); CloseClipboard(); } } break; case WM_DESTROY: { const INT_PTR nSize = SendMessage(hList, LB_GETCOUNT, 0, 0); for (int i = 0; i < nSize; ++i) { LPSTR lpData = (LPSTR)SendMessage(hList, LB_GETITEMDATA, i, 0); GlobalFree(lpData); } } PostQuitMessage(0); break; default: return DefWindowProc(hWnd, msg, wParam, lParam); } return 0;}
开发者ID:kenjinote,项目名称:GetGitHubRepositoryList,代码行数:76,
示例4: test_bomstatic void test_bom(void){ static const WCHAR versionW[] = {'v','e','r','s','i','o','n','=','"','1','.','0','"',0}; static const WCHAR utf16W[] = {'u','t','f','-','1','6',0}; static const WCHAR xmlW[] = {'x','m','l',0}; static const WCHAR aW[] = {'a',0}; IXmlWriterOutput *output; unsigned char *ptr; IXmlWriter *writer; IStream *stream; HGLOBAL hglobal; HRESULT hr; hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); ok(hr == S_OK, "got 0x%08x/n", hr); hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output); ok(hr == S_OK, "got %08x/n", hr); hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); ok(hr == S_OK, "Expected S_OK, got %08x/n", hr); hr = IXmlWriter_SetProperty(writer, XmlWriterProperty_OmitXmlDeclaration, TRUE); ok(hr == S_OK, "got 0x%08x/n", hr); hr = IXmlWriter_SetOutput(writer, output); ok(hr == S_OK, "got 0x%08x/n", hr); /* BOM is on by default */ hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); ok(hr == S_OK, "got 0x%08x/n", hr); hr = IXmlWriter_Flush(writer); ok(hr == S_OK, "got 0x%08x/n", hr); hr = GetHGlobalFromStream(stream, &hglobal); ok(hr == S_OK, "got 0x%08x/n", hr); ptr = GlobalLock(hglobal); ok(ptr[0] == 0xff && ptr[1] == 0xfe, "got %x,%x/n", ptr[0], ptr[1]); GlobalUnlock(hglobal); IStream_Release(stream); IUnknown_Release(output); /* start with PI */ hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); ok(hr == S_OK, "got 0x%08x/n", hr); hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output); ok(hr == S_OK, "got %08x/n", hr); hr = IXmlWriter_SetOutput(writer, output); ok(hr == S_OK, "got 0x%08x/n", hr); hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW); ok(hr == S_OK, "got 0x%08x/n", hr); hr = IXmlWriter_Flush(writer); ok(hr == S_OK, "got 0x%08x/n", hr); hr = GetHGlobalFromStream(stream, &hglobal); ok(hr == S_OK, "got 0x%08x/n", hr); ptr = GlobalLock(hglobal); ok(ptr[0] == 0xff && ptr[1] == 0xfe, "got %x,%x/n", ptr[0], ptr[1]); GlobalUnlock(hglobal); IUnknown_Release(output); IStream_Release(stream); /* start with element */ hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); ok(hr == S_OK, "got 0x%08x/n", hr); hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output); ok(hr == S_OK, "got %08x/n", hr); hr = IXmlWriter_SetOutput(writer, output); ok(hr == S_OK, "got 0x%08x/n", hr); hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); ok(hr == S_OK, "got 0x%08x/n", hr); hr = IXmlWriter_Flush(writer); ok(hr == S_OK, "got 0x%08x/n", hr); hr = GetHGlobalFromStream(stream, &hglobal); ok(hr == S_OK, "got 0x%08x/n", hr); ptr = GlobalLock(hglobal); ok(ptr[0] == 0xff && ptr[1] == 0xfe, "got %x,%x/n", ptr[0], ptr[1]); GlobalUnlock(hglobal); IUnknown_Release(output); IStream_Release(stream); /* WriteElementString */ hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); ok(hr == S_OK, "got 0x%08x/n", hr);//.........这里部分代码省略.........
开发者ID:GYGit,项目名称:reactos,代码行数:101,
示例5: ImageToHBITMAP//.........这里部分代码省略.........%% The format of the ImageToHBITMAP method is:%% HBITMAP ImageToHBITMAP(Image *image)%% A description of each parameter follows:%% o image: the image to convert.%*/MagickExport void *ImageToHBITMAP(Image *image){ BITMAP bitmap; ExceptionInfo *exception; HANDLE bitmap_bitsH; HBITMAP bitmapH; register ssize_t x; register const PixelPacket *p; register RGBQUAD *q; RGBQUAD *bitmap_bits; size_t length; ssize_t y; (void) ResetMagickMemory(&bitmap,0,sizeof(bitmap)); bitmap.bmType=0; bitmap.bmWidth=(LONG) image->columns; bitmap.bmHeight=(LONG) image->rows; bitmap.bmWidthBytes=4*bitmap.bmWidth; bitmap.bmPlanes=1; bitmap.bmBitsPixel=32; bitmap.bmBits=NULL; length=bitmap.bmWidthBytes*bitmap.bmHeight; bitmap_bitsH=(HANDLE) GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE,length); if (bitmap_bitsH == NULL) { char *message; message=GetExceptionMessage(errno); (void) ThrowMagickException(&image->exception,GetMagickModule(), ResourceLimitError,"MemoryAllocationFailed","`%s'",message); message=DestroyString(message); return(NULL); } bitmap_bits=(RGBQUAD *) GlobalLock((HGLOBAL) bitmap_bitsH); q=bitmap_bits; if (bitmap.bmBits == NULL) bitmap.bmBits=bitmap_bits; (void) TransformImageColorspace(image,RGBColorspace); exception=(&image->exception); for (y=0; y < (ssize_t) image->rows; y++) { p=GetVirtualPixels(image,0,y,image->columns,1,exception); if (p == (const PixelPacket *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { q->rgbRed=ScaleQuantumToChar(GetRedPixelComponent(p)); q->rgbGreen=ScaleQuantumToChar(GetGreenPixelComponent(p)); q->rgbBlue=ScaleQuantumToChar(GetBluePixelComponent(p)); q->rgbReserved=0; p++; q++; } } bitmap.bmBits=bitmap_bits; bitmapH=CreateBitmapIndirect(&bitmap); if (bitmapH == NULL) { char *message; message=GetExceptionMessage(errno); (void) ThrowMagickException(&image->exception,GetMagickModule(), ResourceLimitError,"MemoryAllocationFailed","`%s'",message); message=DestroyString(message); } GlobalUnlock((HGLOBAL) bitmap_bitsH); GlobalFree((HGLOBAL) bitmap_bitsH); return((void *) bitmapH);}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,
示例6: DragQueryFileIFACEMETHODIMP LiferayNativityContextMenus::Initialize(LPCITEMIDLIST pidlFolder, LPDATAOBJECT pDataObj, HKEY hKeyProgID){ if (pDataObj) { FORMATETC fe = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; STGMEDIUM stm; if (FAILED(pDataObj->GetData(&fe, &stm))) { return E_INVALIDARG; } HDROP hDrop = static_cast<HDROP>(GlobalLock(stm.hGlobal)); if (hDrop == NULL) { return E_INVALIDARG; } _nFiles = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0); if (_nFiles > 0) { _contextMenuUtil = new ContextMenuUtil(); wchar_t szFileName[MAX_PATH]; for (UINT i = 0; i < _nFiles; i++) { UINT success = DragQueryFile(hDrop, i, szFileName, ARRAYSIZE(szFileName)); if (success != 0) { _contextMenuUtil->AddFile(szFileName); } } } GlobalUnlock(stm.hGlobal); ReleaseStgMedium(&stm); } else if (pidlFolder) { wstring folderPath; folderPath.resize(MAX_PATH); if (!SHGetPathFromIDList(pidlFolder, &folderPath[0])) { return E_INVALIDARG; } _nFiles = 1; _contextMenuUtil = new ContextMenuUtil(); _contextMenuUtil->AddFile(folderPath); } return S_OK;}
开发者ID:iterate-ch,项目名称:liferay-nativity,代码行数:62,
示例7: MakeDibstatic HANDLE MakeDib( HBITMAP hbitmap, UINT bits ){ HANDLE hdib ; HDC hdc ; BITMAP bitmap ; UINT wLineLen ; DWORD dwSize ; DWORD wColSize ; LPBITMAPINFOHEADER lpbi ; LPBYTE lpBits ; GetObject(hbitmap,sizeof(BITMAP),&bitmap) ; // // DWORD align the width of the DIB // Figure out the size of the colour table // Calculate the size of the DIB // wLineLen = (bitmap.bmWidth*bits+31)/32 * 4; wColSize = sizeof(RGBQUAD)*((bits <= 8) ? 1<<bits : 0); dwSize = sizeof(BITMAPINFOHEADER) + wColSize + (DWORD)(UINT)wLineLen*(DWORD)(UINT)bitmap.bmHeight; // // Allocate room for a DIB and set the LPBI fields // hdib = GlobalAlloc(GHND,dwSize); if (!hdib) return hdib ; lpbi = (LPBITMAPINFOHEADER)GlobalLock(hdib) ; lpbi->biSize = sizeof(BITMAPINFOHEADER) ; lpbi->biWidth = bitmap.bmWidth ; lpbi->biHeight = bitmap.bmHeight ; lpbi->biPlanes = 1 ; lpbi->biBitCount = (WORD) bits ; lpbi->biCompression = BI_RGB ; lpbi->biSizeImage = dwSize - sizeof(BITMAPINFOHEADER) - wColSize ; lpbi->biXPelsPerMeter = 0 ; lpbi->biYPelsPerMeter = 0 ; lpbi->biClrUsed = (bits <= 8) ? 1<<bits : 0; lpbi->biClrImportant = 0 ; // // Get the bits from the bitmap and stuff them after the LPBI // lpBits = (LPBYTE)(lpbi+1)+wColSize ; hdc = CreateCompatibleDC(NULL) ; GetDIBits(hdc,hbitmap,0,bitmap.bmHeight,lpBits,(LPBITMAPINFO)lpbi, DIB_RGB_COLORS); // Fix this if GetDIBits messed it up.... lpbi->biClrUsed = (bits <= 8) ? 1<<bits : 0; DeleteDC(hdc) ; GlobalUnlock(hdib); return hdib ;}
开发者ID:xinyaojiejie,项目名称:Dale,代码行数:61,
示例8: LogTrace//当用户点击我们添加的菜单项时该方法将被调用HRESULT CCCopyPathEx::InvokeCommand ( LPCMINVOKECOMMANDINFO pCmdInfo ){ HWND m_pWnd = NULL; LogTrace("菜单ID:%d", LOWORD(pCmdInfo->lpVerb)); m_pWnd = FindWindow(NULL,_T("Spring {8192000D-A7B6-433a-8B40-53A3FC3EC52A}")); // 查找DataRecv进程. if(m_pWnd == NULL) { MessageBox(NULL, TEXT("Unable to find DataRecv."), NULL, MB_OK); //return; } COPYDATASTRUCT cpd = {0}; // 给COPYDATASTRUCT结构赋值. cpd.dwData = 0; try { // copy the string to the clipboard if (!::OpenClipboard(pCmdInfo->hwnd)) { // Fail silently return S_OK; } int cTextBytes = 0; if ( 1 == m_cFiles ) { cTextBytes = (_tcslen( m_szFile ) + 1) * sizeof(TCHAR); } else { for ( int iFile = 0; iFile < m_cFiles; iFile++ ) { cTextBytes += ((m_lstFiles[ iFile ].length() + 2 /*/r/n*/) * sizeof(TCHAR)); } cTextBytes += sizeof(TCHAR); // null terminator } HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, cTextBytes ); if (hGlobal != NULL) { LPVOID lpText = GlobalLock(hGlobal); memset( lpText, 0, cTextBytes ); if ( 1 == m_cFiles ) { memcpy(lpText, m_szFile, cTextBytes); LogTrace("选择一个文件,文件名:%s;", m_szFile); //MessageBox(NULL, m_szFile, "Tips", MB_OK); cpd.cbData = strlen(m_szFile); cpd.lpData = (void*)lpText; ::SendMessage(m_pWnd, WM_COPYDATA, NULL, (LPARAM)&cpd); //m_pWnd->SendMessage(WM_COPYDATA,NULL,(LPARAM)&cpd);// 发送. } else { LPTSTR szText = (LPTSTR)lpText; for ( int iFile = 0; iFile < m_cFiles; iFile++ ) { _tcscat( szText, m_lstFiles[ iFile ].c_str() ); _tcscat( szText, _T("/r/n") ); } LogTrace("选择%d个文件,文件名:/r/n%s;", iFile, szText); //MessageBox(NULL, szText, "Tips", MB_OK); cpd.cbData = strlen(szText); cpd.lpData = (void*)szText; //m_pWnd->SendMessage(WM_COPYDATA,NULL,(LPARAM)&cpd);// 发送. ::SendMessage(m_pWnd, WM_COPYDATA, NULL, (LPARAM)&cpd); } EmptyClipboard(); GlobalUnlock(hGlobal);#ifdef _UNICODE SetClipboardData(CF_UNICODETEXT, hGlobal);#else SetClipboardData(CF_TEXT, hGlobal);#endif } CloseClipboard(); } catch ( ... ) { return E_FAIL; } return S_OK; ///////////////////////////////////////////////////////////////////////// //// 如果lpVerb 实际指向一个字符串, 忽略此次调用并退出. //if ( 0 != HIWORD( pCmdInfo->lpVerb )) // return E_INVALIDARG; //// 点击的命令索引 C++ Global_Variable_Query函数代码示例 C++ GlobalToLocal函数代码示例
|