<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>https://wiki.shelek.ru/index.php?action=history&amp;feed=atom&amp;title=FAQ%3AWinAPI_VCPP%3A%D0%BE%D1%82%D0%BE%D0%B1%D1%80%D0%B0%D0%B7%D0%B8%D1%82%D1%8C_%D0%BA%D0%B0%D1%80%D1%82%D0%B8%D0%BD%D0%BA%D1%83_%D0%B8%D0%B7_%D1%84%D0%B0%D0%B9%D0%BB%D0%B0_%D0%B2_IPicture</id>
		<title>FAQ:WinAPI VCPP:отобразить картинку из файла в IPicture - История изменений</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.shelek.ru/index.php?action=history&amp;feed=atom&amp;title=FAQ%3AWinAPI_VCPP%3A%D0%BE%D1%82%D0%BE%D0%B1%D1%80%D0%B0%D0%B7%D0%B8%D1%82%D1%8C_%D0%BA%D0%B0%D1%80%D1%82%D0%B8%D0%BD%D0%BA%D1%83_%D0%B8%D0%B7_%D1%84%D0%B0%D0%B9%D0%BB%D0%B0_%D0%B2_IPicture"/>
		<link rel="alternate" type="text/html" href="https://wiki.shelek.ru/index.php?title=FAQ:WinAPI_VCPP:%D0%BE%D1%82%D0%BE%D0%B1%D1%80%D0%B0%D0%B7%D0%B8%D1%82%D1%8C_%D0%BA%D0%B0%D1%80%D1%82%D0%B8%D0%BD%D0%BA%D1%83_%D0%B8%D0%B7_%D1%84%D0%B0%D0%B9%D0%BB%D0%B0_%D0%B2_IPicture&amp;action=history"/>
		<updated>2026-05-27T09:35:45Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.25.1</generator>

	<entry>
		<id>https://wiki.shelek.ru/index.php?title=FAQ:WinAPI_VCPP:%D0%BE%D1%82%D0%BE%D0%B1%D1%80%D0%B0%D0%B7%D0%B8%D1%82%D1%8C_%D0%BA%D0%B0%D1%80%D1%82%D0%B8%D0%BD%D0%BA%D1%83_%D0%B8%D0%B7_%D1%84%D0%B0%D0%B9%D0%BB%D0%B0_%D0%B2_IPicture&amp;diff=803&amp;oldid=prev</id>
		<title>RXL в 19:14, 3 октября 2009</title>
		<link rel="alternate" type="text/html" href="https://wiki.shelek.ru/index.php?title=FAQ:WinAPI_VCPP:%D0%BE%D1%82%D0%BE%D0%B1%D1%80%D0%B0%D0%B7%D0%B8%D1%82%D1%8C_%D0%BA%D0%B0%D1%80%D1%82%D0%B8%D0%BD%D0%BA%D1%83_%D0%B8%D0%B7_%D1%84%D0%B0%D0%B9%D0%BB%D0%B0_%D0%B2_IPicture&amp;diff=803&amp;oldid=prev"/>
				<updated>2009-10-03T19:14:17Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 19:14, 3 октября 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;L86&quot; &gt;Строка 86:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Строка 86:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:FAQ:WinAPI VCPP]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:FAQ:WinAPI VCPP&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]] [[Category:FAQ:MFC&lt;/ins&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>RXL</name></author>	</entry>

	<entry>
		<id>https://wiki.shelek.ru/index.php?title=FAQ:WinAPI_VCPP:%D0%BE%D1%82%D0%BE%D0%B1%D1%80%D0%B0%D0%B7%D0%B8%D1%82%D1%8C_%D0%BA%D0%B0%D1%80%D1%82%D0%B8%D0%BD%D0%BA%D1%83_%D0%B8%D0%B7_%D1%84%D0%B0%D0%B9%D0%BB%D0%B0_%D0%B2_IPicture&amp;diff=738&amp;oldid=prev</id>
		<title>RXL: Новая: ===Как при помощи IPicture отобразить картинку из файла?===  Пример - несложная функция, отображающая картин...</title>
		<link rel="alternate" type="text/html" href="https://wiki.shelek.ru/index.php?title=FAQ:WinAPI_VCPP:%D0%BE%D1%82%D0%BE%D0%B1%D1%80%D0%B0%D0%B7%D0%B8%D1%82%D1%8C_%D0%BA%D0%B0%D1%80%D1%82%D0%B8%D0%BD%D0%BA%D1%83_%D0%B8%D0%B7_%D1%84%D0%B0%D0%B9%D0%BB%D0%B0_%D0%B2_IPicture&amp;diff=738&amp;oldid=prev"/>
				<updated>2009-10-03T13:01:21Z</updated>
		
		<summary type="html">&lt;p&gt;Новая: ===Как при помощи IPicture отобразить картинку из файла?===  Пример - несложная функция, отображающая картин...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;===Как при помощи IPicture отобразить картинку из файла?===&lt;br /&gt;
&lt;br /&gt;
Пример - несложная функция, отображающая картинку из файла. Поддерживаются форматы BMP, GIF, JPEG, PNG, TIFF, EMF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;quot;atlconv.h&amp;quot;&lt;br /&gt;
#define HandleIsValid(H) (H != (HANDLE) - 1 &amp;amp;&amp;amp; H != (HANDLE)0)&lt;br /&gt;
&lt;br /&gt;
// *pDestDC - CDC, на который предполагается вывод картинки&lt;br /&gt;
// pchzFilePath - путь к файлу&lt;br /&gt;
// pWid - (возвращает) ширина картинки&lt;br /&gt;
// pHig - (возвращает) высота картинки&lt;br /&gt;
bool DrawBitmapFromFile(CDC* pDestDC, const char* pchzFilePath, int *pWid = 0, int *pHig = 0)&lt;br /&gt;
{&lt;br /&gt;
	bool result = false;&lt;br /&gt;
&lt;br /&gt;
	if (pWid)&lt;br /&gt;
		*pWid = 0;&lt;br /&gt;
&lt;br /&gt;
	if (pHig)&lt;br /&gt;
		*pHig = 0;&lt;br /&gt;
&lt;br /&gt;
	int Wid = 0;&lt;br /&gt;
	int Hig = 0;&lt;br /&gt;
&lt;br /&gt;
	IPicture* pPic = 0;&lt;br /&gt;
	try&lt;br /&gt;
	{&lt;br /&gt;
		IPicture* ptmpPic = 0;&lt;br /&gt;
		USES_CONVERSION;&lt;br /&gt;
		HRESULT hr;&lt;br /&gt;
&lt;br /&gt;
		CString txt = pchzFilePath;&lt;br /&gt;
		hr = ::OleLoadPicturePath(&lt;br /&gt;
			const_cast&amp;lt;LPOLESTR&amp;gt;(T2COLE(txt)),&lt;br /&gt;
			0,&lt;br /&gt;
			0,&lt;br /&gt;
			0,&lt;br /&gt;
			IID_IPicture,&lt;br /&gt;
			reinterpret_cast&amp;lt;void **&amp;gt;(&amp;amp;ptmpPic)&lt;br /&gt;
		);&lt;br /&gt;
&lt;br /&gt;
		if (hr == S_OK &amp;amp;&amp;amp; ptmpPic)&lt;br /&gt;
			pPic = ptmpPic;&lt;br /&gt;
		else&lt;br /&gt;
			throw 0;&lt;br /&gt;
&lt;br /&gt;
		OLE_XPOS_HIMETRIC cxSrc;&lt;br /&gt;
		OLE_YPOS_HIMETRIC cySrc;&lt;br /&gt;
&lt;br /&gt;
		if (S_OK != pPic-&amp;gt;get_Width(&amp;amp;cxSrc))&lt;br /&gt;
			throw 0;&lt;br /&gt;
&lt;br /&gt;
		if (S_OK != pPic-&amp;gt;get_Height(&amp;amp;cySrc))&lt;br /&gt;
			throw 0;&lt;br /&gt;
&lt;br /&gt;
		Wid = cxSrc / 26;&lt;br /&gt;
		Hig = cySrc / 26;&lt;br /&gt;
&lt;br /&gt;
		// рисуем&lt;br /&gt;
		if (S_OK != pPic-&amp;gt;Render(pDestDC-&amp;gt;GetSafeHdc(),&lt;br /&gt;
			0, Hig, Wid, -Hig, 0, 0, cxSrc, cySrc, 0))&lt;br /&gt;
		{&lt;br /&gt;
			throw 0;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	catch (...)&lt;br /&gt;
	{&lt;br /&gt;
		result = false;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	if (pPic)&lt;br /&gt;
	{&lt;br /&gt;
		pPic-&amp;gt;Release();&lt;br /&gt;
		pPic = 0;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	if (pWid)&lt;br /&gt;
		*pWid = Wid;&lt;br /&gt;
&lt;br /&gt;
	if (pHig)&lt;br /&gt;
		*pHig = Hig;&lt;br /&gt;
&lt;br /&gt;
	return result;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ:WinAPI VCPP]]&lt;/div&gt;</summary>
		<author><name>RXL</name></author>	</entry>

	</feed>