其中涉及到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的使用的更多相关文章

  1. RichTextBoxEx2

    using System;using System.Collections.Specialized;using System.Drawing;using System.Drawing.Imaging; ...

  2. RichTextBoxEx

    using System; using System.Collections.Specialized; using System.Drawing; using System.Drawing.Imagi ...

  3. ARCGIS 出图显示not map metafile into memory.Not enough memory

    有许多的原因,比如系统有问题,磁盘空间不够,或虚拟内存设置不对等.再有就是输出地图时分辨率的设置是否太大等.    not enough memory     这个问题是ESRI的一个所谓的“臭名昭著 ...

  4. 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:/ ...

  5. Windows Server 2008 MetaFile设置占用内存限制

    最近遇到Windows Server 2008服务器内存持续飙升,48G内存用了99%,查看任务管理器的进程,也没发现具体哪个进程用的内存比较大? 于是,在网上找了了一个查看内存的工具RamMap,具 ...

  6. 读取图片文件MetaFile放入Windows剪切板

    前言 前段时间群里有个小伙在工作中遇到一个问题,透明的图片存入剪切板在粘贴到adobe PDF中出现不透明问题但是粘贴到Excel可以,还有就是从excel复制再粘贴到PDF也是可以.小伙在群里发了两 ...

  7. 在MetaFile里放图片

    procedure TForm1.Button1Click(Sender: TObject); var m : TmetaFile; mc : TmetaFileCanvas; b : tbitmap ...

  8. Insert Plain Text and Images into RichTextBox at Runtime

    Insert Plain Text and Images into RichTextBox at Runtime' https://www.codeproject.com/Articles/4544/ ...

  9. GDI+编程说明及小结

    原文地址:http://blog.csdn.net/byxdaz/article/details/5972759 GDI+(Graphics Device Interface Plus图形设备接口加) ...

随机推荐

  1. Wireshark 学习笔记 Lebal:Research

    学习Wireshark主要是为了契合我最近做的线性激光雷达项目,主要用于抓取数据包 首先是三本书比较值得一看,第一本是清华大学出版社的,侧重教学,第二三两本是人民邮电出版社的,其中第二本是许多课程的指 ...

  2. SuperSocket 学习笔记-客户端

    客户端: 定义 private AsyncTcpSession client; 初始化 client = new AsyncTcpSession(); client.Connected += Clie ...

  3. jquery实现分页效果

    通过jq实现分页的原理如下:将所有条数加载到页面中,根据每页放特定条数(例如 5 条)获取jquery对象索引,使部分条数显示,其他条数隐藏. 前提:引入jquery.js 代码 <!DOCTY ...

  4. mnist数据集下载——mnist数据集提供百度网盘下载地址

    mnist数据集是由深度学习大神 LeCun等人制作完成的数据集,mnist数据集也常认为是深度学习的“ Hello World!”. 官网:http://yann.lecun.com/exdb/mn ...

  5. linux c++ 实现http请求

    main.cpp #include HttpReq.h #include <string.h> int main(void) { HttpRequest* Http; char http_ ...

  6. numpy数组的索引和切片

    numpy数组的索引和切片 基本切片操作 >>> import numpy as np >>> arr=np.arange(10) >>> arr ...

  7. Magento开发基础知识之RequireJs

    一.RequireJS概述 RequireJS是一个工具库,主要用于客户端的模块管理.实现异步或动态加载,从而提高代码的性能和可维护性. RequireJS的基本思想是,通过define方法,将代码定 ...

  8. Codeforces - 1203D2 - Remove the Substring (hard version) - 双指针

    https://codeforces.com/contest/1203/problem/D2 上次学了双指针求两个字符串之间的是否t是s的子序列.但其实这个双指针可以求出的是s的前i个位置中匹配t的最 ...

  9. wex5 如何使用蓝牙 ble

    使用蓝牙插件   需要在js中添加 require("cordova!cordova-plugin-ble-central"); ble插件具体文档: http://docs.we ...

  10. springboot在集成mybatis的时候老是报错 The server time zone value '�й���׼ʱ��' is unrecognized

    我已经解决了,感谢万能网友. 解决办法参见:https://blog.csdn.net/yunfeng482/article/details/86698133