티스토리 뷰
LRESULT CMainFrame::OnUserTray(WPARAM wParam, LPARAM lParam)
{
CMenu menu, *pSubMenu;
if (LOWORD(lParam) == WM_LBUTTONDOWN)
{
CString str("369048");
CString str1 = str.Left(3);
CString str2 = str.Right(3);
LPTSTR pstr1 = str1.GetBuffer(str1.GetLength());
LPTSTR pstr2 = str2.GetBuffer(str2.GetLength());
LPWSTR wstr1 = new WCHAR[4];
LPWSTR wstr2 = new WCHAR[4];
int len1 = MultiByteToWideChar(CP_ACP, 0, pstr1, -1, NULL, NULL);
MultiByteToWideChar(CP_ACP, 0, pstr1, -1, wstr1, len1);
int len2 = MultiByteToWideChar(CP_ACP, 0, pstr2, -1, NULL, NULL);
MultiByteToWideChar(CP_ACP, 0, pstr2, -1, wstr2, len2);
Bitmap bitmap(16, 16);
Graphics graphics(&bitmap);
FontFamily fontFamily(L"Tahoma");
Font font(&fontFamily, 7, FontStyleRegular, UnitPoint);
SolidBrush solidBrush(Color(255, 0, 0, 255));
PointF pointF1(-2, -2);
graphics.DrawString(wstr1, 3, &font, pointF1, &solidBrush);
PointF pointF2(-2, 7);
graphics.DrawString(wstr2, 3, &font, pointF2, &solidBrush);
HICON hicon;
bitmap.GetHICON(&hicon);
m_TrayIcon.SetIcon(hicon);
DestroyIcon(hicon);
delete[] wstr1;
delete[] wstr2;
}
else if (LOWORD(lParam) == WM_RBUTTONDOWN)
{
CString str("000888");
CString str1 = str.Left(3);
CString str2 = str.Right(3);
CHAR pstr1[4];
CHAR pstr2[4];
strcpy(pstr1, str1.GetBuffer(str1.GetLength()));
strcpy(pstr2, str2.GetBuffer(str2.GetLength()));
USES_CONVERSION;
WCHAR* wstr1 = A2W(pstr1);
WCHAR* wstr2 = A2W(pstr2);
Bitmap bitmap(16, 16);
Graphics graphics(&bitmap);
FontFamily fontFamily(L"Tahoma");
Font font(&fontFamily, 7, FontStyleRegular, UnitPoint);
SolidBrush solidBrush(Color(255, 255, 0, 0));
PointF pointF1(-2, -2);
graphics.DrawString(wstr1, 3, &font, pointF1, &solidBrush);
PointF pointF2(-2, 7);
graphics.DrawString(wstr2, 3, &font, pointF2, &solidBrush);
HICON hicon;
bitmap.GetHICON(&hicon);
m_TrayIcon.SetIcon(hicon);
DestroyIcon(hicon);
}
return 1;
}
{
CMenu menu, *pSubMenu;
if (LOWORD(lParam) == WM_LBUTTONDOWN)
{
CString str("369048");
CString str1 = str.Left(3);
CString str2 = str.Right(3);
LPTSTR pstr1 = str1.GetBuffer(str1.GetLength());
LPTSTR pstr2 = str2.GetBuffer(str2.GetLength());
LPWSTR wstr1 = new WCHAR[4];
LPWSTR wstr2 = new WCHAR[4];
int len1 = MultiByteToWideChar(CP_ACP, 0, pstr1, -1, NULL, NULL);
MultiByteToWideChar(CP_ACP, 0, pstr1, -1, wstr1, len1);
int len2 = MultiByteToWideChar(CP_ACP, 0, pstr2, -1, NULL, NULL);
MultiByteToWideChar(CP_ACP, 0, pstr2, -1, wstr2, len2);
Bitmap bitmap(16, 16);
Graphics graphics(&bitmap);
FontFamily fontFamily(L"Tahoma");
Font font(&fontFamily, 7, FontStyleRegular, UnitPoint);
SolidBrush solidBrush(Color(255, 0, 0, 255));
PointF pointF1(-2, -2);
graphics.DrawString(wstr1, 3, &font, pointF1, &solidBrush);
PointF pointF2(-2, 7);
graphics.DrawString(wstr2, 3, &font, pointF2, &solidBrush);
HICON hicon;
bitmap.GetHICON(&hicon);
m_TrayIcon.SetIcon(hicon);
DestroyIcon(hicon);
delete[] wstr1;
delete[] wstr2;
}
else if (LOWORD(lParam) == WM_RBUTTONDOWN)
{
CString str("000888");
CString str1 = str.Left(3);
CString str2 = str.Right(3);
CHAR pstr1[4];
CHAR pstr2[4];
strcpy(pstr1, str1.GetBuffer(str1.GetLength()));
strcpy(pstr2, str2.GetBuffer(str2.GetLength()));
USES_CONVERSION;
WCHAR* wstr1 = A2W(pstr1);
WCHAR* wstr2 = A2W(pstr2);
Bitmap bitmap(16, 16);
Graphics graphics(&bitmap);
FontFamily fontFamily(L"Tahoma");
Font font(&fontFamily, 7, FontStyleRegular, UnitPoint);
SolidBrush solidBrush(Color(255, 255, 0, 0));
PointF pointF1(-2, -2);
graphics.DrawString(wstr1, 3, &font, pointF1, &solidBrush);
PointF pointF2(-2, 7);
graphics.DrawString(wstr2, 3, &font, pointF2, &solidBrush);
HICON hicon;
bitmap.GetHICON(&hicon);
m_TrayIcon.SetIcon(hicon);
DestroyIcon(hicon);
}
return 1;
}
'Code > C C++' 카테고리의 다른 글
[C++/CLI] Marshalling : System::String^ <-> const char* (0) | 2010.05.17 |
---|---|
[C++] polymorphism.h (0) | 2010.05.17 |
[C++] How to: Convert Between Various String Types (0) | 2010.05.17 |
[C++] vector shared_ptr sample (0) | 2010.05.15 |
[MFC] Simplified MFC Structure (0) | 2010.04.24 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Regular Expressions
- autohotkey
- 애드센스감추기
- Service pack
- 스크린캡쳐
- java
- Sample Code
- download.com
- iText
- DotNetMagic
- jre
- c#
- 유틸리티
- AdSense숨기기
- Automation
- Phalanger
- Rollback Rx
- windows
- .net framework
- 애드센스숨기기
- registry
- WinAutomation
- AxWebBrowser
- tagREADYSTATE
- AdSense감추기
- iTextSharp
- ScreenHunter
- READYSTATE_COMPLETE
- Microsoft
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함