Posted September 22, 201212 yr Hey everyone,Today I've wasted quite a lot of hours with trying to make a transparent edit box, which operates properly.I managed to create this transparent background, but when I typ is stuff or remove stuff it goes all bad (on windows xp only)I use this code to make the edit transparent:case WM_CTLCOLOREDIT:{ RECT rect_edit= {0}; RECT rect_window= {0}; GetWindowRect(hwndDlg, &rect_window); //Window placement GetWindowRect((HWND)lParam, &rect_edit); //Control placement SetBkMode((HDC) wParam, TRANSPARENT); //Transparent control SetTextColor((HDC) wParam, RGB(255, 255, 255)); //White text //Set the brush origin (relative placement) SetBrushOrgEx((HDC)wParam, rect_window.left-rect_edit.left, rect_window.top-rect_edit.top, 0); return (BOOL)hBrush;}My question to you guys: What should I do? Maybe handle some messages and force redraw?Thanks in advance,Mr. eXoDiaPS I attached the full source code...KeyGen_example.rarPS2 For the ones who cannot download my source: http://codepad.org/ajqIvwl1 Edited September 23, 201212 yr by Mr. eXoDia
September 22, 201212 yr Last time I tried something like that loooooong time ago, and it was annoyingly hard. Maybe this article will help: http://www.drx.dk/bktxtedit.php
September 22, 201212 yr If you're using MSVC , try adding this to your main cpp file. #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' ""version='6.0.0.0' processorArchitecture='X86' publicKeyToken='6595b64144ccf1df' language='*'\"")Don't really know if it'll help in your case but I used to have issues with the way controls showed up in XP as well and this fixed it back in the day.
September 22, 201212 yr Author @kao: thanks for your suggestion, but I've already seens that page..@paul: good suggestion, but I already embedding a manifest in my exe
September 23, 201212 yr Author I solved it!Basically the only thing I had to do was redrawing the window every time the user entered something in the text box. I simply added:case WM_COMMAND: RedrawWindow((HWND)lParam, 0, 0, RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE);Thanks for all your suggestions, hopefully this is helpful to somebody else too!Greetings,Mr. eXoDia Edited September 23, 201212 yr by Mr. eXoDia
October 1, 201212 yr Author Mr. eXoDia, Great share! This keygen code is elite. Hehe, not THAT elite though... Try dragging another window so it overlaps the keygen window and then type stuff in the editbox. It still fails Edited October 1, 201212 yr by Mr. eXoDia
Create an account or sign in to comment