mfc

How to show menu bitmaps with transparent background

China☆狼群 提交于 2021-02-08 03:01:23
问题 I am using this code: m_bmpSwap.LoadBitmap(IDB_BITMAP2); pMnuPopup->SetMenuItemBitmaps(0, MF_BYPOSITION, &m_bmpSwap, &m_bmpSwap); It looks like: It was only a test image: How exactly do I get my image to look as if it has a transparent background? It is 24 bit image. I have seen this but I can't work it out. I adjusted to a 8 bit image with 192/192/192 as the background and loaded like this: HBITMAP hBmp; hBmp = (HBITMAP)::LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_BITMAP2), IMAGE

How to show menu bitmaps with transparent background

依然范特西╮ 提交于 2021-02-08 03:01:22
问题 I am using this code: m_bmpSwap.LoadBitmap(IDB_BITMAP2); pMnuPopup->SetMenuItemBitmaps(0, MF_BYPOSITION, &m_bmpSwap, &m_bmpSwap); It looks like: It was only a test image: How exactly do I get my image to look as if it has a transparent background? It is 24 bit image. I have seen this but I can't work it out. I adjusted to a 8 bit image with 192/192/192 as the background and loaded like this: HBITMAP hBmp; hBmp = (HBITMAP)::LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_BITMAP2), IMAGE

How to show menu bitmaps with transparent background

假装没事ソ 提交于 2021-02-08 03:00:47
问题 I am using this code: m_bmpSwap.LoadBitmap(IDB_BITMAP2); pMnuPopup->SetMenuItemBitmaps(0, MF_BYPOSITION, &m_bmpSwap, &m_bmpSwap); It looks like: It was only a test image: How exactly do I get my image to look as if it has a transparent background? It is 24 bit image. I have seen this but I can't work it out. I adjusted to a 8 bit image with 192/192/192 as the background and loaded like this: HBITMAP hBmp; hBmp = (HBITMAP)::LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_BITMAP2), IMAGE

How to load a PNG from RESOURCES into a CImage

孤者浪人 提交于 2021-02-07 19:58:16
问题 According to this documentation for LoadFromResource it states: Loads an image from a BITMAP resource So, I have this in my code: rImage.LoadFromResource(AfxFindResourceHandle(), IDB_PNG1); Doesn't work. I then realised I am using PNG files and not BMP files. I assume this is the reason the resources can't be found. I have also tried using AfxGetInstanceHandle() . But that also doesn't work. Thus, at the moment I am using external PNG files. It works fine. But is there any way to load a PNG

How to validate a valid integer and floating number in VC++ CString

坚强是说给别人听的谎言 提交于 2021-02-07 18:17:41
问题 Can some one tell me a valid way to validate a number present in CString object as either a valid integer or floating number? 回答1: Use _tcstol() and _tcstod(): bool IsValidInt(const CString& text, long& value) { LPCTSTR ptr = (LPCTSTR) text; LPTSTR endptr; value = _tcstol(ptr, &endptr, 10); return (*ptr && endptr - ptr == text.GetLength()); } bool IsValidFloat(const CString& text, double& value) { LPCTSTR ptr = (LPCTSTR) text; LPTSTR endptr; value = _tcstod(ptr, &endptr); return (*ptr &&

How to validate a valid integer and floating number in VC++ CString

谁都会走 提交于 2021-02-07 18:17:00
问题 Can some one tell me a valid way to validate a number present in CString object as either a valid integer or floating number? 回答1: Use _tcstol() and _tcstod(): bool IsValidInt(const CString& text, long& value) { LPCTSTR ptr = (LPCTSTR) text; LPTSTR endptr; value = _tcstol(ptr, &endptr, 10); return (*ptr && endptr - ptr == text.GetLength()); } bool IsValidFloat(const CString& text, double& value) { LPCTSTR ptr = (LPCTSTR) text; LPTSTR endptr; value = _tcstod(ptr, &endptr); return (*ptr &&

Get Disk Utilized by each process in c++ windows

大憨熊 提交于 2021-02-07 17:12:21
问题 I am trying to build a tool which is something similar to Task Manager. I was able to get the CPU and Memory of each processes, but I couldn't figure out the Disk statistics. I was able to get the I/O Read, Write bytes, but it includes all file, disk and network. How could I get only the Disk Utilized by each processes?? Otherwise is it possible to segregate the disk statistics from those I/O bytes? If yes, how could I do it? 来源: https://stackoverflow.com/questions/32948539/get-disk-utilized

Get Disk Utilized by each process in c++ windows

一世执手 提交于 2021-02-07 17:07:27
问题 I am trying to build a tool which is something similar to Task Manager. I was able to get the CPU and Memory of each processes, but I couldn't figure out the Disk statistics. I was able to get the I/O Read, Write bytes, but it includes all file, disk and network. How could I get only the Disk Utilized by each processes?? Otherwise is it possible to segregate the disk statistics from those I/O bytes? If yes, how could I do it? 来源: https://stackoverflow.com/questions/32948539/get-disk-utilized

Why would the PIDL for the control panel be different?

拟墨画扇 提交于 2021-02-07 14:55:28
问题 I see that one should do this to compare PIDLs: IShellFolder::CompareIDs(). In particular, I'm trying to detect if a given absolute PIDL (or relative) is that of the Control Panel. However, in practice I end up with two PIDLs which IShellFolder::CompareIDs() claims are not equal, when they should be (looking at the GetDisplayName() for each, I can see that we're indeed looking at the Control Panel). Basically, I'm obtaining the absolute PIDL for the Control panel by: PIDL iidControlPanel =

Why would the PIDL for the control panel be different?

亡梦爱人 提交于 2021-02-07 14:55:23
问题 I see that one should do this to compare PIDLs: IShellFolder::CompareIDs(). In particular, I'm trying to detect if a given absolute PIDL (or relative) is that of the Control Panel. However, in practice I end up with two PIDLs which IShellFolder::CompareIDs() claims are not equal, when they should be (looking at the GetDisplayName() for each, I can see that we're indeed looking at the Control Panel). Basically, I'm obtaining the absolute PIDL for the Control panel by: PIDL iidControlPanel =