Click here to Skip to main content
       

C / C++ / MFC

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
QuestionAnyone heard of an Anonymous Statistics / User Experience API or ToolkitmemberBlake Miller29 Jan '13 - 6:11 
I am wondering if someone has used an API or Toolkit to incorporate Anonymous Usage or User Experience into their product.
 
For exmaple, when you install Visual Studio, it asks if you want to participate in the Installation User Experience to provide feedback to Microsoft regarding your installation experience.
 
Other product have similar types of options, which basically come down to the application reporting back some information about how the inlstallation was operated, problems encountered, etc.
 
So if you have used or heard of such an API or toolkit to incorporate such features into an application, please respond.
 
Thanks.
I need a 32 bit unsigned value just to hold the number of coding WTF I see in a day …

QuestionHow to load a png image in PictureControl?groupVCProgrammer29 Jan '13 - 1:41 
hi all,
 
i want to load a png image from resource in picture control.
 
how can i do this.
 
thanks.
QuestionRe: How to load a png image in PictureControl?mvpRichard MacCutchan29 Jan '13 - 3:33 
Do you mean via the LoadResource function[^]?
AnswerRe: How to load a png image in PictureControl?groupyu-jian29 Jan '13 - 15:40 
#include "atlimage.h"

Image*	m_pImage;
 
char *pStr = strTempIMGPath.GetBuffer(0);
int size = MultiByteToWideChar(GetACP(), 0, pStr, -1, NULL, 0);
MultiByteToWideChar(GetACP(), 0, pStr, -1, szFile, size);
strTempIMGPath.ReleaseBuffer();
if (m_pImage != NULL)
{
	delete m_pImage;
	m_pImage = NULL;
}
m_pImage = new Image(szFile, FALSE);
 

void CPNGButton::OnPaint()
{
	CPaintDC dc(this);
	Graphics graphics(dc.m_hDC);
	if(m_pImage != NULL && (m_pImage->GetLastStatus() == Gdiplus::Status::Ok))
	{
		graphics.DrawImage(m_pImage, 0, 0, m_pImage->GetWidth(), m_pImage->GetHeight());
	}
}
 


GeneralRe: How to load a png image in PictureControl?groupVCProgrammer30 Jan '13 - 22:19 
i want to load png file from Resources not with using file path of any selected file location.
GeneralRe: How to load a png image in PictureControl?groupyu-jian1 Feb '13 - 4:04 
I event tried to load the PNG file from the resource. But I failed.
If you find the way, please tell me.
GeneralRe: How to load a png image in PictureControl?groupVCProgrammer4 Feb '13 - 1:24 
LPCTSTR szResourceName =MAKEINTRESOURCE(IDB_PNG1);
	LPCTSTR szResourceType=_T("PNG");
	HMODULE hresModule=AfxGetResourceHandle(); 
 
	HRSRC hPicture = FindResource(hresModule,szResourceName,szResourceType);
	HGLOBAL hResData;
 
	// Load the dialog box into global memory.
	if (!hPicture || !(hResData = LoadResource(hresModule,hPicture)))
	{
		TRACE(_T("Load (resource): Error loading resource %s\n"),szResourceName);
		return ;
	};
	DWORD dwSize = SizeofResource(hresModule,hPicture);	
 
	// hResData is not the real HGLOBAL (we can't lock it)
	// let's make it real

	HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE | GMEM_NODISCARD,dwSize);
	if (!hGlobal)
	{
		TRACE(_T("Load (resource): Error allocating memory\n"));
		FreeResource(hResData);
		return ;
	};
	
	char *pDest = reinterpret_cast<char *> (GlobalLock(hGlobal));
	char *pSrc = reinterpret_cast<char *> (LockResource(hResData));
	if (!pSrc || !pDest)
	{
		TRACE(_T("Load (resource): Error locking memory\n"));
		GlobalFree(hGlobal);
		FreeResource(hResData);
		return  ;
	};
 
	//IStream* pStream;
	ULONG ulWritten=0;
	ulWritten = 0;
 
	CopyMemory(pDest,pSrc,dwSize);
 
	HRESULT hr = ::CreateStreamOnHGlobal(hGlobal,FALSE,&pStream);
	pStream->Write(pDest, dwSize, &ulWritten);
 
	FreeResource(hResData);
	GlobalUnlock(hGlobal);
 
	Bitmap oBmp(pStream,0);
 
  	m_Image_ics.Load(pStream);
	HDC memdc;
	CRect rect;
	this->GetClientRect(&rect);     
	//=====
	HBITMAP hBmp;
	oBmp.GetHBITMAP(0, &hBmp);
	::SendMessage(png_bnr->GetSafeHwnd(),STM_SETIMAGE,IMAGE_BITMAP,(LPARAM)hBmp);
 

QuestionIn win7 ,how to modify registry with Non - administrator permissionmemberhaha_c28 Jan '13 - 21:08 
Hi,I want to write registry with Non - administrator account In MFC(vs2010),but failed.Can you have any idea to write registry.
AnswerRe: In win7 ,how to modify registry with Non - administrator permissionmemberJochen Arndt28 Jan '13 - 21:38 
There is a reason that parts of the registry can be only changed by administrators. To store user dependant information use the HKCU (current user) tree where you can write with user privileges.
GeneralRe: In win7 ,how to modify registry with Non - administrator permissionmemberhaha_c28 Jan '13 - 22:02 
In win7 ,When open UAC,it also cannot write registry,how
to avoid

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web03 | 2.6.130523.1 | Last Updated 23 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid