源代码:- #include <stdio.h>
- #include <windows.h>
-
- typedef HWND (WINAPI *PROCGETCONSOLEWINDOW)();
- PROCGETCONSOLEWINDOW GetConsoleWindow;
-
- Int main()
- {
- HMODULE hKernel32 = GetModuleHandle("kernel32");
- GetConsoleWindow= (PROCGETCONSOLEWINDOW)GetProcAddress(hKernel32,"GetConsoleWindow");
- HWND cmd=GetConsoleWindow();
- HDC dc = GetDC(cmd);
- HBITMAP hBitmap;
- hBitmap=(HBITMAP)LoadImage (NULL,"1.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION);
- HDC cmdmem = CreateCompatibleDC(dc);
- SelectObject(cmdmem , hBitmap);
- BitBlt(dc , 100 , 100 , 300 , 300 , cmdmem , 0 , 0 , SRCCOPY);
- Return 1;
- }
复制代码 http://vanshell.blog.51cto.com/890307/428651 |