本文整理汇总了C++中DeleteEnhMetaFile函数的典型用法代码示例。如果您正苦于以下问题:C++ DeleteEnhMetaFile函数的具体用法?C++ DeleteEnhMetaFile怎么用?C++ DeleteEnhMetaFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DeleteEnhMetaFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WndProc
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
ENHMETAHEADER emh ;
HDC hdc, hdcEMF ;
HENHMETAFILE hemfOld, hemf ;
PAINTSTRUCT ps ;
RECT rect ;
switch (message)
{
case WM_CREATE:
// Retrieve existing metafile and header
hemfOld = GetEnhMetaFile (TEXT ("..\\emf3\\emf3.emf")) ;
GetEnhMetaFileHeader (hemfOld, sizeof (ENHMETAHEADER), &emh) ;
// Create a new metafile DC
hdcEMF = CreateEnhMetaFile (NULL, TEXT ("emf7.emf"), NULL,
TEXT ("EMF7\0EMF Demo #7\0")) ;
// Enumerate the existing metafile
EnumEnhMetaFile (hdcEMF, hemfOld, EnhMetaFileProc, NULL,
(RECT *) & emh.rclBounds) ;
// Clean up
hemf = CloseEnhMetaFile (hdcEMF) ;
DeleteEnhMetaFile (hemfOld) ;
DeleteEnhMetaFile (hemf) ;
return 0 ;
case WM_PAINT:
hdc = BeginPaint (hwnd, &ps) ;
GetClientRect (hwnd, &rect) ;
rect.left = rect.right / 4 ;
rect.right = 3 * rect.right / 4 ;
rect.top = rect.bottom / 4 ;
rect.bottom = 3 * rect.bottom / 4 ;
hemf = GetEnhMetaFile (TEXT ("emf7.emf")) ;
PlayEnhMetaFile (hdc, hemf, &rect) ;
DeleteEnhMetaFile (hemf) ;
EndPaint (hwnd, &ps) ;
return 0 ;
case WM_DESTROY:
PostQuitMessage (0) ;
return 0 ;
}
return DefWindowProc (hwnd, message, wParam, lParam) ;
}
示例2: Picture_writeToWindowsMetafile
void Picture_writeToWindowsMetafile (Picture me, MelderFile file) {
try {
HENHMETAFILE metafile = copyToMetafile (me);
MelderFile_delete (file); // overwrite any existing file with the same name
DeleteEnhMetaFile (CopyEnhMetaFile (metafile, Melder_peek32toW (file -> path)));
DeleteEnhMetaFile (metafile);
} catch (MelderError) {
Melder_throw (U"Picture not written to Windows metafile ", file);
}
}
示例3: PaintRoutine
void PaintRoutine (HWND hwnd, HDC hdc, int cxArea, int cyArea)
{
ENHMETAHEADER emh ;
HENHMETAFILE hemf ;
int cxMms, cyMms, cxPix, cyPix, cxImage, cyImage ;
RECT rect ;
cxMms = GetDeviceCaps (hdc, HORZSIZE) ;
cyMms = GetDeviceCaps (hdc, VERTSIZE) ;
cxPix = GetDeviceCaps (hdc, HORZRES) ;
cyPix = GetDeviceCaps (hdc, VERTRES) ;
hemf = GetEnhMetaFile (TEXT ("emf11.emf")) ;
GetEnhMetaFileHeader (hemf, sizeof (emh), &emh) ;
cxImage = emh.rclFrame.right - emh.rclFrame.left ;
cyImage = emh.rclFrame.bottom - emh.rclFrame.top ;
cxImage = cxImage * cxPix / cxMms / 100 ;
cyImage = cyImage * cyPix / cyMms / 100 ;
rect.left = (cxArea - cxImage) / 2 ;
rect.top = (cyArea - cyImage) / 2 ;
rect.right = (cxArea + cxImage) / 2 ;
rect.bottom = (cyArea + cyImage) / 2 ;
PlayEnhMetaFile (hdc, hemf, &rect) ;
DeleteEnhMetaFile (hemf) ;
}
示例4: CloseEnhMetaFile
bool EmfPaintEngine::end()
{
HENHMETAFILE metafile = CloseEnhMetaFile( metaDC );
DeleteEnhMetaFile( metafile );
DeleteDC( metaDC );
return true;
}
示例5: HENHMETAFILE_UserFree
void __RPC_USER HENHMETAFILE_UserFree(unsigned long *pFlags, HENHMETAFILE *phEmf)
{
TRACE("("); dump_user_flags(pFlags); TRACE(", &%p\n", *phEmf);
if (LOWORD(*pFlags) != MSHCTX_INPROC)
DeleteEnhMetaFile(*phEmf);
}
示例6: SaveMetafile
VOID SaveMetafile(HWND hWnd)
{
HENHMETAFILE currentImage = RefreshMetafileDC(hWnd);
TCHAR buffer[4 * MAX_LOADSTRING];
OPENFILENAME openFileName = InitializeOpenFileNameStructure(hWnd, OFN_SHOWHELP | OFN_OVERWRITEPROMPT, buffer);
TCHAR szDescription[MAX_LOADSTRING];
LoadString(hInst, IDS_DESCRIPTIONSTRING,
(LPWSTR)szDescription, sizeof(szDescription));
for (int i = 0; szDescription[i]!='\0'; i++)
{
if (szDescription[i] == '%')
szDescription[i] = '\0';
}
GetSaveFileName(&openFileName);
GetClientRect(hWnd, &rect);
HDC windowDC = GetDC(hWnd);
RECT newRect = GetRect(windowDC);
HDC newMetafileDC = CreateEnhMetaFile(windowDC, (LPTSTR) openFileName.lpstrFile, &newRect, (LPWSTR)szDescription);
ReleaseDC(hWnd, windowDC);
PlayEnhMetaFile(newMetafileDC, currentImage, &rect);
currentImage = CloseEnhMetaFile(newMetafileDC);
PlayEnhMetaFile(metafileDC, currentImage, &rect);
ReleaseDC(hWnd, newMetafileDC);
DeleteEnhMetaFile(currentImage);
}
示例7: WndProc
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc ;
HENHMETAFILE hemf ;
PAINTSTRUCT ps ;
RECT rect ;
switch (message)
{
case WM_PAINT:
hdc = BeginPaint (hwnd, &ps) ;
GetClientRect (hwnd, &rect) ;
rect.left = rect.right / 4 ;
rect.right = 3 * rect.right / 4 ;
rect.top = rect.bottom / 4 ;
rect.bottom = 3 * rect.bottom / 4 ;
hemf = GetEnhMetaFile (TEXT ("..\\emf3\\emf3.emf")) ;
EnumEnhMetaFile (hdc, hemf, EnhMetaFileProc, NULL, &rect) ;
DeleteEnhMetaFile (hemf) ;
EndPaint (hwnd, &ps) ;
return 0 ;
case WM_DESTROY:
PostQuitMessage (0) ;
return 0 ;
}
return DefWindowProc (hwnd, message, wParam, lParam) ;
}
示例8: OpenEnhMetaFile
void OpenEnhMetaFile(HWND hWnd)
{
OPENFILENAME LFile;
WCHAR FileName[MAX_PATH], FilePath[MAX_PATH];
FileName[0] = '\0';
FilePath[0] = '\0';
LFile.lStructSize = sizeof(OPENFILENAME);
LFile.hwndOwner = hWnd;
LFile.lpstrFilter =L"EMF (*.emf)\0";
LFile.lpstrCustomFilter = 0;
LFile.lpstrFile = FilePath;
LFile.nMaxFile = MAX_PATH * sizeof(WCHAR);
LFile.lpstrFileTitle = FileName;
LFile.nMaxFileTitle = MAX_PATH * sizeof(WCHAR);
LFile.lpstrInitialDir = 0;
LFile.lpstrDefExt = L"emf\0";
LFile.lpstrTitle = L"Open file from:";
LFile.Flags = OFN_PATHMUSTEXIST;
GetOpenFileName(&LFile);
HENHMETAFILE enhFile = GetEnhMetaFile(LFile.lpstrFile);
RECT client;
GetClientRect(hWnd, &client);
client.left += scrhor / 3;
client.top += scrvert / 3;
client.right += scrhor / 3;
client.bottom += scrvert / 3;
PlayEnhMetaFile(hdc1, enhFile, &client);
PlayEnhMetaFile(hdc2, enhFile, &client);
DeleteEnhMetaFile(enhFile);
InvalidateRect(hWnd, NULL, false);
}
示例9: free
HENHMETAFILE CxImageWMF::ConvertEmfFiletoEmf(CxFile *pFile, ENHMETAHEADER *pemfh)
{
HENHMETAFILE hMeta;
long iLen = pFile->Size();
BYTE* pBuff = (BYTE *)malloc(iLen);
if (!pBuff) return (FALSE);
// Read the Enhanced Metafile
long iLenRead = pFile->Read(pBuff, 1, iLen);
if (iLenRead != iLen) {
free(pBuff);
return (FALSE);
}
// Make it a Memory Metafile
hMeta = SetEnhMetaFileBits(iLen, pBuff);
free(pBuff); // finished with this one
if (!hMeta) return (FALSE); // oops.
// Get the Enhanced Metafile Header
UINT uRet = GetEnhMetaFileHeader(hMeta, // handle of enhanced metafile
sizeof(ENHMETAHEADER), // size of buffer, in bytes
pemfh); // address of buffer to receive data
if (!uRet) {
DeleteEnhMetaFile(hMeta);
return (FALSE);
}
return (hMeta);
}
示例10: DeleteEnhMetaFile
void VPictureData_MacPicture::_DisposeMetaFile()const
{
if (fMetaFile)
{
#if VERSIONWIN
DeleteEnhMetaFile(fMetaFile);
#else
QDPictRelease(fMetaFile);
#endif
fMetaFile = NULL;
}
if (fTrans)
{
#if VERSIONWIN
#if ENABLE_D2D
VWinD2DGraphicContext::ReleaseBitmap(fTrans);
#endif
delete fTrans;
#elif VERSIONMAC
CFRelease(fTrans);
#endif
fTrans = NULL;
}
#if VERSIONWIN
if (fGdiplusMetaFile)
delete fGdiplusMetaFile;
fGdiplusMetaFile = 0;
#endif
}
示例11: ReadEnhMetaFile
void EMFRecordEditorFrame::GetRecordListFromFile()
{
HENHMETAFILE hMeta = ReadEnhMetaFile(m_file.GetFullPath(), GetHwnd());
if (!hMeta)
return;
// get meta header
if (GetEnhMetaFileHeader(hMeta, sizeof(g_hMetaHeader), &g_hMetaHeader) !=
sizeof(ENHMETAHEADER))
return;
// init data touched by the callback
FreeEMFStuff();
g_pHandleTable = NULL;
g_nHandles = 0;
g_pMetaRecords = NULL;
g_nRecords = 0;
g_nRecordsMax = 0;
m_pList->DeleteAllItems();
// get the list of meta records
EnumEnhMetaFile( NULL,
hMeta,
(ENHMFENUMPROC)EnumEnhMetafileProc,
(LPVOID)m_pList,
NULL );
DeleteEnhMetaFile(hMeta);
// update GUI
m_pList->SetColumnWidth(0, wxLIST_AUTOSIZE);
m_pList->SetColumnWidth(1, wxLIST_AUTOSIZE);
SetStatusText(wxString::Format(wxT("%d records"), g_nRecords), 2);
}
示例12: rectdraw0
void rectdraw0(long *w, long *x, long *y, long lw)
{
char tmppath[MAX_PATH], fname[MAX_PATH];
struct plot_eng plotWin32;
HDC hEmf;
int bg_r,bg_g,bg_b;
GetTempPath(sizeof(tmppath), tmppath);
sprintf(fname, "%s\\gp-ploth-%lx.emf", tmppath, time(NULL)/(24*60*60)*1000+GetTickCount());
hEmf = CreateEnhMetaFile(GetDC(NULL), fname, NULL, NULL);
SetMapMode(hEmf, MM_TEXT);
SelectObject(hEmf, GetStockObject(DEFAULT_GUI_FONT));
color_to_rgb(gel(GP_DATA->colormap,1), &bg_r, &bg_g, &bg_b);
SetBkColor(hEmf, RGB(bg_r,bg_g,bg_b));
SetBkMode(hEmf, OPAQUE);
plotWin32.sc=&SetForeground;
plotWin32.pt=&DrawPoint;
plotWin32.ln=&DrawLine;
plotWin32.bx=&DrawRectangle;
plotWin32.mp=&DrawPoints;
plotWin32.ml=&DrawLines;
plotWin32.st=&DrawString;
plotWin32.pl=&pari_plot;
plotWin32.data=(void*)hEmf;
gen_rectdraw0(&plotWin32, w, x, y, lw, 1, 1);
DeleteEnhMetaFile(CloseEnhMetaFile(hEmf));
ShellExecute(NULL,NULL,fname,NULL,NULL,SW_SHOWDEFAULT);
}
示例13: DeleteEnhMetaFile
int CMetafileDisplay::CreateFromFile(LPCTSTR fileName)
{
if (enhMF != NULL)
{
DeleteEnhMetaFile(enhMF);
enhMF = NULL;
}
int ret = 0;
// Open the file, find out how big it is, allocate memory then read it in
HANDLE hFile = CreateFile(fileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
if (hFile != (HANDLE)-1)
{
LPVOID pBuf = NULL;
DWORD dwFileHigh = 0;
DWORD dwFile = GetFileSize(hFile, &dwFileHigh);
if (dwFileHigh == 0 && (pBuf = LocalAlloc(0, dwFile)) != NULL)
{
DWORD dwRead;
if (ReadFile(hFile, pBuf, dwFile, &dwRead, NULL) && dwRead == dwFile)
ret = LoadBits((UINT) dwFile, pBuf);
LocalFree(pBuf);
}
else
ret = -1;
CloseHandle(hFile);
}
else
{
ret = -1;
ATLTRACE(_T("Metafile Load: %d\n"), GetLastError());
}
return ret;
}
示例14: DeleteEnhMetaFile
/**
* Free the meta file clipboard data if we have one.
*/
void ClipboardData::FreeClipboardEnhmetafile()
{
if (data)
{
DeleteEnhMetaFile((HENHMETAFILE)data);
data = NULL;
}
FreeClipboardName();
}
示例15: RefreshWindow
VOID RefreshWindow(HWND hWnd)
{
HDC windowDC = GetDC(hWnd);
HENHMETAFILE currentImage = RefreshMetafileDC(hWnd);
PlayEnhMetaFile(memoryDC, currentImage, &rect);
PlayEnhMetaFile(metafileDC, currentImage, &rect);
DeleteEnhMetaFile(currentImage);
ReleaseDC(hWnd, windowDC);
}