Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[SOLVED] [C++, WinApi] Transparent EditBox

Featured Replies

Posted

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. eXoDia

PS I attached the full source code...

KeyGen_example.rar

PS2 For the ones who cannot download my source: http://codepad.org/ajqIvwl1

Edited by Mr. eXoDia

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

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.

  • 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

  • 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 by Mr. eXoDia

  • 2 weeks later...

Mr. eXoDia,

Great share! This keygen code is elite.

  • 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 by Mr. eXoDia

I added a WM_TIMER message with interval of 100ms.

keygenDemo.zip

  • Author

Smart one indeed, will keep it :)

Greetings

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.