mrexodia Posted September 22, 2012 Posted September 22, 2012 (edited) 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, 2012 by Mr. eXoDia 1
kao Posted September 22, 2012 Posted September 22, 2012 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
paul Posted September 22, 2012 Posted September 22, 2012 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.
mrexodia Posted September 22, 2012 Author Posted September 22, 2012 @kao: thanks for your suggestion, but I've already seens that page..@paul: good suggestion, but I already embedding a manifest in my exe 1
mrexodia Posted September 23, 2012 Author Posted September 23, 2012 (edited) 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, 2012 by Mr. eXoDia 1
alaphate Posted October 1, 2012 Posted October 1, 2012 Mr. eXoDia,Great share! This keygen code is elite.
mrexodia Posted October 1, 2012 Author Posted October 1, 2012 (edited) 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, 2012 by Mr. eXoDia
alaphate Posted October 2, 2012 Posted October 2, 2012 I added a WM_TIMER message with interval of 100ms.keygenDemo.zip 1
mrexodia Posted October 3, 2012 Author Posted October 3, 2012 Smart one indeed, will keep it Greetings
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now