Win32 ãªã½ã¼ã¹ã¨ãã£ã¿ â å çãä¿®æ£ãªã©ããã¾ããããé¡ããã¾ãã ã¬ãã¥ã¼ã解説ãåºæ¥ãæ¹ãããããããããã XN Resource Editor XN Resource Editor æ¥æ¬èªç - Version 2.1.1.1 JBuild 02 XNResourceEditor 3.0.0.1 ã®æ¥æ¬èªå ResEdit çªã®æ - ResEdit BCCForm and BCCSkelton(Windows95/98/Me / ããã°ã©ãã³ã°) WEditRes - å ¬å¼ãµã¤ã ã®ãã©ã¼ãweditressetup.exe ãé¸æ RadASM assembler IDE - ResEd Resource editor - IDE ã¨ã¯å¥ã®ã¹ã¿ã³ãã¢ãã³ã¢ã㪠WinAsm Studio - IDE ã«ãªã½ã¼ã¹ã¨ãã£ã¿ãä»å± Cnvfrm(Windows95/98/Me
GDI+ ã¯ã¨ã¦ãå¼·åãªæç»å½ä»¤ãæã£ã¦ãã¦ä¾¿å©ã ãã©ãã使ã£ã¦ã¿ãã¨ããªãé ãã ããªãåç´ãªå³å½¢ããæç»ããªãã¦ãé ããã¨ãããã¨ã§ãæç»èªä½ã®é度ã¯ã¨ããããæç»ããGDI+ã®ãªãã¹ã¯ãªã¼ã³ãµã¼ãã§ã¹ãããã¦ã¤ã³ãã¦ã¸ã®è»¢éé度ã足ãå¼ã£å¼µã£ã¦ãããã ã webã§æ¢ãã¦ã¿ã¦ããã¯ããªãã¹ã¯ãªã¼ã³ãµã¼ãã§ã¹ããã®è»¢éé度ãé ãã¨ãããã¨ãæ¸ãã¦ãããã¼ã¸ãããã¤ãè¦ã¤ãã£ãã(ãã®ã¸ãã¨ã) ã¨ãããã¨ã§ãèªåã§ããããã調æ»ãã¦ã¿ãã ã¾ãã¯ä¸çªã·ã³ãã«ã§ä¸è¬çã¨æãããã³ã¼ãã¯ä»¥ä¸ã§ããããããé ãã // ãªãã¹ã¯ãªã¼ã³ãµã¼ãã§ã¹ã®çæ Gdiplus::Bitmap bitmap(rect.Width(), rect.Height(), PixelFormat24bppRGB); // ãªãã¹ã¯ãªã¼ã³ãµã¼ãã§ã¹ã« Graphicsã¯ã©ã¹ã使ã£ã¦æç» Gdiplus::Graph
åé¡:[.NET å ¨è¬] https://hack.jp/?p=1057 ãã®ãã¼ã¸ã«ãã㨠Windows10ç°å¢ã§ã¯DWMãæå¹ã«ãªã£ã¦ããããã GDI+ã使ãã¨æç»é度ãé ããªãããã§ãã 代ããã«ãGDIã使ãããããã«ãããã¡ãªã³ã°ã使ãã¨éããªãããã§ãã ããã§ãGDIã使ããã¨ãæ¤è¨ãã¦ããã®ã§ããã ãã¡ãªããã¯ã³ã¼ãã£ã³ã°ãå¤ããããªããã¨ã ãã§ããããï¼ https://qiita.com/Zuishin/items/b16ac64fa6e414005e96 ããã¹ãã®åºåæ¹æ³ã¯ TextRenderer.DrawText(graphics, text, Font, new Point(50, 50), ForeColor); ã§ãããã¨ãåãã£ãã®ã§ããã ã©ã¤ã³ãåè§å½¢ãªã©ã¯ã©ã®ããã«ãããè¯ãã§ããï¼ ã©ããã«GDIã®ä½¿ãæ¹ãã¾ã¨ãã¦ãããµã¤ãã¯ãããã¾ãã§ã
Microsoft MSDN ãã©ã¼ã©ã ã§ä¸è¨ã®ãããªæ稿ãããã¾ããã Windows 10 ã® Display æéãé ã https://social.msdn.microsoft.com/Forums/ja-JP/9119bf4d-f07d-4a61-8290-e6d10cfe3680 調ã¹ã¦ã¿ãã¨ããã®åé¡ã¯ Windows 10 ã®åé¡ã¨ãããã㯠Desktop Window Manager (DWM) ãæå¹ã®ã¨ããGDI+ ã®ç»é¢ã¸ã®ç´æ¥æç»ãé ããªãåé¡ãããããã§ããDWM 㯠Windows 10 ã§ã¯å¿ ãæå¹ã¨ãªã£ã¦ãããWindows 7 ã§ã¯ã·ã¹ãã ã®è¨å®ã§ ON / OFF ãåãæ¿ãããã¨ãã§ãã¾ããWindows 7 ã§ã¿ã¤ãã«ãã¼ãåéæã«ãªãç¶æ ï¼Aero ãæå¹ã®ã¨ãï¼ã§ DWM ãæå¹ã¨ãªã£ã¦ããããã§ãã æç»é度ã調ã¹ãéã«ä½æããããã°ã©ã
ãªã½ã¼ã¹ããPNGãJPEGãèªã¿è¾¼ã ã²ã¼ã ãä½ãã«ããã£ã¦ãå©ç¨ããç»åã¯Bitmapããã¡ãã£ã¨ã°ãã大ãããããã ããå§ç¸®çãé«ãä¸ã«8bitã¢ã«ãã¡ãæã£ã¦ãPNGã使ãããããã£ã¬ã¯ããªããèªã¿è¾¼ãå ´åã¯ã¦ã¼ã¶ã«ç»åãåæã«ä½¿ãããããexeåä½ã§é å¸ã§ããªããããããªã½ã¼ã¹ã«ãã¦ãã¾ãããããããå ´åã®ã話ã PNGãªã©ã®ãªã½ã¼ã¹ããèªã¿è¾¼ãå ´åã¯ãBitmapã¨ä»ã§å¥ã®æ¹æ³ãã¨ããªããã°ãªããªã*1ãããã¦ãããã¡ããã¨æéã ãããããã®Win32APIã¯ç¥ããªããã°åèªèª¿ã¹ã»ãããæé ã¯ãããªæãã«ãªãã FindResourceé¢æ°ã§ãªã½ã¼ã¹ãã³ãã«ãåå¾ SizeofResourceé¢æ°ã§ãµã¤ãºãåå¾ LoadResourceé¢æ°ã§ãªã½ã¼ã¹ãèªã¿åºãLockResourceé¢æ°ã§ããã㯠GlobalAllocé¢æ°ã§ã¡ã¢ãªãç¢ºä¿ GlobalLocké¢æ°ã§ã¡ã¢ãªããã
ããããããã®ãã«ããããã¡ãªã³ã° æ¦è¦ï¼ãã©ãããæå¶ãã ã²ã¼ã ã®ãããªé«éã«æç»ããã¢ããªã±ã¼ã·ã§ã³ã§ã¯ããã©ããã大ããªåé¡ã«ãªãã¾ãã ãããæå¶ããææ³ããã«ããããã¡ãªã³ã°ã§ãã â ãã©ããã®åå ãã©ãããçºçããåå ã¯äºã¤ããã¾ãã âæ´æ°é åã®èæ¯ãæ¶å»ãã¦ããåæç»ããã èæ¯ã®æ¶å»ã«ããã¦ã£ã³ãã¦æ¬æ¥ã®èæ¯è²(WNDCLASS ã®hbrBackground)ã ä¸ç¬ã ãè¦ãã¦ãã¾ãããã§ãã âä¸ã¤ã®å®æããç»åãä½ãããã«ã表ç»é¢ã«ä½åº¦ãæç»ãã 表ç»é¢ã¸ã®æç»ã¯ãã®é½åº¦è¡¨ç¤ºãããã®ã§ã ä¸ã¤ã®å®æããç»åãä½ãéç¨ãè¦ãã¦ãã¾ãããã§ãã ä¾ãã°ãèæ¯ç»åãæç»ãã¦ããã ãã®ä¸ã«ç´ æã¨ãªãç»åãæç»ããäºãèãã¦ã¿ã¾ãããã æ´æ°é åã®èæ¯ãæ¶å»ããªãã§ä¸æ¸ããããã¨ãã¦ãã èæ¯ç»åã ããæç»ãããç¶æ ã ããã¦ãã®ä¸ã«ç´ æç»åãæç»ãããç¶æ ã®ãããããã
ããã«ãããã¡ã®æé ã¨ãµã³ãã« ããã¤ã¹ã³ã³ããã¹ãããçæããGraphicsãªãã¸ã§ã¯ãã«æç»ãã¦ããå ´åãã¦ã£ã³ãã¦ãåããããããã¨ç»é¢ãã¡ãã¤ããããã¯æç»ã®å¦çã追ãã¤ãã¦ããªãããã«ãä¸åº¦æ¶ãã¦çã£ç½ã«ãªã£ãèæ¯ãè¦ãã¦ãã¾ãããã§ãããããããã¡ãã¤ããé²ãã®ãããã«ãããã¡ãªã³ã°(double buffering)ã§ãããç»é¢è¡¨ç¤ºã«éãããé³å£°åçãªã©è²ã ãªå ´æã§ç¨ããããæè¡ã§ããããããGDI+ãã§å®è£ ãã*1ã æé ã¯ä»¥ä¸ã®ã¨ãã ã¯ã©ã¤ã¢ã³ãé åã¨åããµã¤ãºã®Bitmapãªãã¸ã§ã¯ã"offScreenBitmap"ãç¨æããã "offScreenBitmap"ããGraphicsãªãã¸ã§ã¯ã"offScreen"ãä½æããã "offScreen"ã«å¯¾ãã¦æç»ãè¡ãã ããã¤ã¹ã³ã³ããã¹ããã³ãã«ããGraphicsãªãã¸ã§ã¯ã"onScreen"ãä½æããã
ä»æ´ãªè©±é¡ã§ããã¡ã¢ã ãCreateCompatibleDCãã使ã£ã¦ãæç»ãè¡ãããã¦ã¤ã³ãã¦ã®ããã¤ã¹ã³ã³ããã¹ã㨠åãå±æ§ã®ããã¤ã¹ã³ã³ããã¹ããä½æãã¦ãããã«æç»å¦çãã¦ãæ¬æ¥ã®æ¹ã¸ã³ãã¼ãããæãã§ããã 注æç¹ã¨ãã¦ã¯ã ã»ãCreateCompatibleBitmapãã§ã¡ã¢ãªä¸ã®æç»ã¨ãªã¢ã®ãµã¤ãºãªã©ã確å®ãã¾ããã¾ãããã¼ã¹ã«ãªãHDCã¯ãCreateCompatibleDCãã§ä½æãããã®ã使ç¨ããªãã®ããã½ã§ãã ã»ãã³ããã©ã·ãªã©ãä½æãã¦æå¾ã«åé¤ãã¾ãããSelectObjectã§ããã¤ã¹ã³ã³ããã¹ãã«é¢é£ä»ããã¾ã¾ã ã¨ä½æããããããããããéæ¾ãããªãã®ã§æ¿ããã¡ã¢ãªãªã¼ã¯ãèµ·ããã¾ãã ã»å®æ°ã®ãCOLOR_STATICãã¯ãWinCEã®ã¿ã®ããã§ãã ã§ã¯ããµã³ãã«ã HDC hCDC; HBITMAP hCBitmap,hOldCBitmap;
ééPNGç»åããã¤ã¢ãã°ä¸ã®ã³ã³ããã¼ã«ã¨ãã¦è¡¨ç¤ºããå¿ è¦ãåºæ¥ãã®ã§ããªã½ã¼ã¹ããPNGç»åãèªã¿è¾¼ã¿ Gdiplus::Bitmap ã§åå¾ããã³ã¼ããæ¸ãã¾ããã ã¤ãã§ã«ãããããã(BMP)ç»åã Gdiplus ã§æ±ããããããã« Bitmap ã§åå¾ããããã«ã¨æã£ãã®ã§ãããä½æ ãåãæ¹æ³ã§ã¯ãã¾ãè¡ããã Gdiplus::Bitmap ã«ã¯ãªã½ã¼ã¹ãã Bitmap ãä½æããã¡ã½ãããç¨æããã¦ããã®ã§ããã使ãããã«ãã¾ããã ï¼ãã ã¤ã³ã¹ã¿ã³ã¹ãæå®ããªããã°ãããããããä½ããªãã®ã§å¥æ®µããã«å®è£ ããå¿ è¦ã¯ç¡ãã£ãããã»ã»ã»ï¼ æé ã¨ãã¦ã¯ä»¥ä¸ã®ããã«ãªãã¾ãã ï¼ï¼FindResource()ã§ãªã½ã¼ã¹ãæ¢ãã¾ãã ï¼ï¼SizeofResource()ã§ãªã½ã¼ã¹ã®ãµã¤ãºãåå¾ã ï¼ï¼LoadResource()ã§ãªã½ã¼ã¹ãèªã¿è¾¼ã㧠LockResource
Windows Vista/7 ã§ã¯ã以ä¸ã®ããã«ã¦ã£ã³ãã¦ã®ã¯ã©ã¤ã¢ã³ãé åã®ä¸é¨ãéãããããã¨ãã§ãã¾ãã ããã«ã以ä¸ã®ãããªã¢ã«ãã¡ä»ãã®ç»åãæç»ããæ¹æ³ãç´¹ä»ãã¾ãã ã¾ããã¯ã©ã¤ã¢ã³ãé åã®ä¸é¨ãéããããããã®å¦çãæ¸ãã¾ãã ã¦ã£ã³ãã¦ãéããããã«ã¯ãWindows Vista 以éã§å©ç¨ã§ãã DWM (Desktop Window Manager) ã®æ©è½ã使ãã¾ãã #include <windows.h> // ãã¤ãã®ããã #include <dwmapi.h> // DWM ã®ããã // DWM ã®ã©ã¤ãã©ãªããªã³ã¯ããæå®ã§ã #pragma comment(lib, "dwmapi.lib") // ã¦ã£ã³ãã¦ãéããããé¢æ°ã§ã bool ApplyAero( HWND hwnd, // éããããã¦ã£ã³ãã¦ã®ãã³ãã«ã§ã const MARGI
EXEãã¡ã¤ã«ã¨åä¸ãã©ã«ãã¼ã«ããimage.jpgãã¡ã¤ã«ãfreadã§ã¡ã¢ãªä¸ã«èªã¿è¾¼ãã Jpegãã¡ã¤ã«ã®ã¤ã¡ã¼ã¸ãã¡ã¢ãªã¹ããªã¼ã ã«å¤æãGDI+ã§æç»ããããã°ã©ã ã§ãã 使ç¨ä¾ã¨ãã¦ã¯ãWMAãã¡ã¤ã«ãªã©Jpegãã¡ã¤ã«ã®ã¤ã¡ã¼ã¸ããã®ã¾ã¾ãã¡ã¤ã«ã«åãè¾¼ã¾ãã¦ããå ´åããã®ã¤ã¡ã¼ã¸ãã¡ã¢ãªã«åãè¾¼ãã°è¡¨ç¤ºãå¯è½ã¨ãªãã¾ãã ã³ã³ãã¤ã© Visual C++ 2008/2013 Express 32/64bit ãã«ããã¤ã/UNICODE å®è¡ç°å¢ Windows XP Professional Service Pack 3 32bit(Virtual Boxä¸ã®ä»®æ³ãã·ã¼ã³) Windows 7 Enterprise Service Pack 1 64bit jpgviewmem.cpp _tWinMain GdiplusStartupã«ããGDI+ã®åæåããã¾ãã ã
Win32ã®ãããã° Win32ã¢ããªã±ã¼ã·ã§ã³ã§ã¯ããããã°æ å ±ãã³ã³ã½ã¼ã«ã«åºåãããããªãã¨ãã§ãã¾ãããæ軽ãªMessageBoxé¢æ°ã使ãæ¹æ³ã¨ããããã°ããµãã¼ãããAPIã«ã¤ãã¦è§£èª¬ãã¦ããã¾ãã MessageBoxã使ã MessageBoxé¢æ°ã¯ç°¡åãªãããã°ã«ã¯ä¾¿å©ã§ããä¾ãã° MessageBox( NULL, "å¼ã°ããã", "title", MB_OK); ã¨ããã°ã次ã®ãããªãã¤ã¢ãã°ã表示ããã¾ãã ã¡ãã»ã¼ã¸ããã¯ã¹ã®ä¾ MessageBoxã§ç¾ãããã¤ã¢ãã°ã¯ã¢ã¼ãã«ãªã®ã§ããã¤ã¢ãã°ãéããã¾ã§å¶å¾¡ã¯å¸°ã£ã¦ãã¾ãããä¾ãã°ãã¢ããªã±ã¼ã·ã§ã³ãç°å¸¸çµäºãã¦ãã¾ãå ´åã¯ãåå ã¨ãªããããªå¨è¾ºã«ï¼è¡ã¥ã¤MessageBoxé¢æ°ãæ¿å ¥ããã°ãã©ãã§ç°å¸¸çµäºãçºçãã¦ããããå¤æã§ãã¾ãã ãã ããMessageBoxã«ã¯ãprintfé¢æ°ã®ããã«å¤æ°ã®å¤ã表
ããã¦æã¯åãåºã ååããããã¿ã¤ã ã使ã£ãå¦çæ¹æ³ã説æãã¾ãã ããã§ãç¡éã«ã¼ãã®ãããªå¦çãå¯è½ã«ãªãã¾ã ããããããã ãã§ã¯ã¢ãã¡ã¼ã·ã§ã³ãªã©ãä½æãããã¨ã¯ã§ãã¾ãã ã¢ãã¡ã¼ã·ã§ã³ãå®ç¾ããã«ã¯ãCPUã®é度ã«ä¾åãããã¨ã®ãªããã ããç¨åº¦ã®æéãå¾ æ©ããããããªå¦çãå¿ è¦ãªã®ã§ã å®éã«ã500 Mhz 以ä¸ã®é度ãæã¤ã¤ã³ãã«ã®CPUãªãã° ååã®æ¹æ³ã§ãå¡ãã¤ã¶ãããç©å½¢ãé»ãã赤è²ã«ãã§ã¼ãããããã°ã©ã ãå®è¡ãã㨠ä¸ç¬ã§ä½æ¥ãçµãã£ã¦ãã¾ããä½ãèµ·ãã£ãã®ãããããªãã§ããã ããã§ãPeekMessage() ã¨ã¯éã£ãæ¹æ³ã§ãããå®ç¾ãããªããã°ãªãã¾ãã ãã®ãããªåä½ã¯ã¿ã¤ãã¼ã«ãããæéå·®å¦çã好ã¾ããã¨æãã¾ã ã¿ã¤ãã¼ã¨ã¯ãããä¸å®ã®æå®ããæéãçµéãã㨠ã¡ãã»ã¼ã¸ãã¥ã¼ã«ã¡ãã»ã¼ã¸ããã¹ãããã¨ãã便å©ãªæ©è½ã§ã ãããã®ä½æ¥ã¯ä¸è¦éåæ
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}