c++ - DrawText WinAPI Not Showing Result -


i tried use windows api drawtext() draw string on current program's console window, program suppose(i think) draw "hello world" in green color(0x33cc33), don't result showing up, don't know did wrong.

here's piece of code:

#include <stdio.h> #include <windows.h>  int main(void) {     rect rect;     setconsoletitlea("win32cpptest");     hwnd winhandle = findwindowa("consolewindowclass", "win32cpptest");     if (winhandle == null) {         printf("failed find target window hande.\n");         return getlasterror();     };     hdc windc = getwindowdc(winhandle);     if (windc == null) {         printf("failed target window dc.\n");         return getlasterror();     };     getclientrect(winhandle, &rect);    //get rect structure target handle      settextcolor(windc, 0x33cc33);      //set text color green     setbkmode(windc, transparent);      //set background mix mode     rect.left = 40;                     //set font format     rect.top = 10;     drawtexta(windc, "hello world!", -1, &rect, dt_singleline | dt_noclip);    //this function call not showing on console window     deletedc(windc);    //i set breakpoint here hdc structure won't destory     return 0; }; 


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -