Metafile::EmfToWmfBits的使用
其中涉及到string转换LPCWSTR以及模块绝对路径的调用
#include <iostream>
#include <stdio.h>
#include <WINDOWS.H>
#include <shellapi.h>
#include <gdiplus.h>
#include <Shlwapi.h>
#include <string> #pragma comment (lib,"Shlwapi.lib")
#pragma comment(lib,"gdiplus.lib")
#pragma comment(lib, "shell32.lib") using namespace Gdiplus;
using std::string; LPWSTR ConvertToLPWSTR(const std::string& s)
{
LPWSTR ws = new wchar_t[s.size() + ]; // +1 for zero at the end
copy(s.begin(), s.end(), ws);
ws[s.size()] = ; // zero at the end
return ws;
} int main(int argc, char **argv)
{
UINT size1 = ;
WCHAR path[MAX_PATH];
string name; GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); std::cout << "Please input a file name" << std::endl;
std::cin >> name;
LPCWSTR name_ = LPCWSTR(ConvertToLPWSTR(name)); GetModuleFileNameW(NULL, path, MAX_PATH);
PathRemoveFileSpecW(path);
PathAppendW(path, name_); Metafile myMetafile(path);
Status S_ch = myMetafile.GetLastStatus(); HENHMETAFILE hEmf = myMetafile.GetHENHMETAFILE();
size1 = Metafile::EmfToWmfBits(
hEmf,
,
NULL,
MM_ANISOTROPIC,
EmfToWmfBitsFlagsEmbedEmf);
std::cout << size1 << std::endl; }
Metafile::EmfToWmfBits的使用的更多相关文章
- RichTextBoxEx2
using System;using System.Collections.Specialized;using System.Drawing;using System.Drawing.Imaging; ...
- RichTextBoxEx
using System; using System.Collections.Specialized; using System.Drawing; using System.Drawing.Imagi ...
- ARCGIS 出图显示not map metafile into memory.Not enough memory
有许多的原因,比如系统有问题,磁盘空间不够,或虚拟内存设置不对等.再有就是输出地图时分辨率的设置是否太大等. not enough memory 这个问题是ESRI的一个所谓的“臭名昭著 ...
- Arcgis map export or print Error: Cannot map metafile into memory. Not enough memory
Arcgis map export or print Error: Cannot map metafile into memory. Not enough memory Link: https:/ ...
- Windows Server 2008 MetaFile设置占用内存限制
最近遇到Windows Server 2008服务器内存持续飙升,48G内存用了99%,查看任务管理器的进程,也没发现具体哪个进程用的内存比较大? 于是,在网上找了了一个查看内存的工具RamMap,具 ...
- 读取图片文件MetaFile放入Windows剪切板
前言 前段时间群里有个小伙在工作中遇到一个问题,透明的图片存入剪切板在粘贴到adobe PDF中出现不透明问题但是粘贴到Excel可以,还有就是从excel复制再粘贴到PDF也是可以.小伙在群里发了两 ...
- 在MetaFile里放图片
procedure TForm1.Button1Click(Sender: TObject); var m : TmetaFile; mc : TmetaFileCanvas; b : tbitmap ...
- Insert Plain Text and Images into RichTextBox at Runtime
Insert Plain Text and Images into RichTextBox at Runtime' https://www.codeproject.com/Articles/4544/ ...
- GDI+编程说明及小结
原文地址:http://blog.csdn.net/byxdaz/article/details/5972759 GDI+(Graphics Device Interface Plus图形设备接口加) ...
随机推荐
- PyQt4 Python GUI窗体应用程序
目录 目录 前言 软件环境 PyQT简介 Setup PyCharm Setup SIP Setup PyQt4 测试PyQt是否安装成功 常见错误 最后 前言 还是一句老话,公司要什么我就做什么.这 ...
- sql 查询某一列最大的数据
select colm1,Max(colm2),max(colm3) from table where condition group by colm1
- Function程序设计及应用
Function也称为函数,它是SAP中一个独物的程序模式,一般是一段单独的程序代码,可独立执行或直接被SAP其他程序所调用.Function支持远程访问模式,即提供接口供SAP程序使用(如VB,.N ...
- 自己用canvas写的贪吃蛇代码
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- Shell编程、part3
本节内容 1. shell流程控制 2. for语句 3. while语句 4. break和continue语句 5. case语句 6. shell编程高级实战 shell流程控制 流程控制是改变 ...
- Spark集群架构
集群架构 SparkContext底层调度模块 Spark集群架构细化
- 关于多线程efcore dbcontext 的解决方案。
首先我们大部分的efcore框架用的DbContext(或者封装的repo)都是底层注入的上下文容器实体. 然后Dbcontext不是线程安全的,也就是说,你在当前线程中,只能创建一个 DbConte ...
- PTA(Basic Level)1011.A+B和C
给定区间 [−231,231] 内的 3 个整数 A.B 和 C,请判断 A+B 是否大于 C. 输入格式: 输入第 1 行给出正整数 T (≤10),是测试用例的个数.随后给出 T 组测试用例,每组 ...
- springboot -- 2.0版本自定义ReidsCacheManager的改变
1. 问题发现 在1.0版本中,我们配置redis的cacheManager是这种方式: //缓存管理器 @Bean public CacheManager cacheManager(@Suppres ...
- cpu和内存的使用率统计
统计cpu和内存一个月的平均使用率: #!/bin/bash totalcpu_rate=0.0 totalmem_rate=0.0 num_days=$(ls -l /var/log/sa/sa[0 ...