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.

Create Hidden Window With out VCL

Featured Replies

Posted

Trying to create a hidden window in delphi or (message only window) I have read up on the msdn, and come up with


var
WClass :TWndClass;
TempClass :TWndClass;
ClassRegistered :Boolean;
begin
WClass.style := 0;
WClass.lpfnwndproc := @WndProc;
WClass.cbClsExtra := 0;
WClass.cbWndExtra := SizeOf(TWndClass);
WClass.hinstance := hInstance;
WClass.hIcon := 0;
WClass.hCursor := 0;
WClass.hbrbackground := 0;
WClass.lpszMenuName := nil;
WClass.lpszClassName := 'Server';
ClassRegistered := GetClassInfo(hInstance,WClass.lpszClassName,TempClass);
if ClassRegistered = True then UnregisterClass(TempClass.lpszClassName,hInstance);
Registerclass(Wclass);
Result := CreateWindowEx(WS_EX_NOACTIVATE, WClass.lpszClassName,WClass.lpszClassName, 0, 0, 0, 0, 0, 0, hInstance, nil);

which is in a formless application (console) once the console loses focus, if i take the console away and make it run with out any console or forms i am not able to recieve window messages. i read up and saw i could post HWND_MESSAGE to the handle, however the value of this is (-3) and delphi errors violate sub bound range for a handle :(

TIA

For a message-only Window, you should be passing HWND_MESSAGE as the window parent in the hWndParent param of CreateWindowEx.

HWND CreateWindowEx(      
DWORD dwExStyle,
LPCTSTR lpClassName,
LPCTSTR lpWindowName,
DWORD dwStyle,
int x,
int y,
int nWidth,
int nHeight,
HWND hWndParent, // <-- Pass HWND_MESSAGE in this param.
HMENU hMenu,
HINSTANCE hInstance,
LPVOID lpParam
);

HWND_MESSAGE is defined as -3, I'm not sure how Delphi handles this as I don't code in it so I cant really give a Delphi example.

After a few Google searches I'd try to to:

THandle(HWND_MESSAGE)

or

MsgHandle :HWND;
MsgHandle := HWND_MESSAGE;

And pass MsgHandle in CreateWindowEx.

I'm not really sure what falls under VCL in Delphi either, so sorry if this doesn't help. :(

  • Author

var
WClass :TWndClass;
TempClass :TWndClass;
ClassRegistered :Boolean;
begin
WClass.style := 0;
WClass.lpfnwndproc := @WndProc;
WClass.cbClsExtra := 0;
WClass.cbWndExtra := SizeOf(TWndClass);
WClass.hinstance := HInstance;
WClass.hIcon := 0;
WClass.hCursor := 0;
WClass.hbrbackground := 0;
WClass.lpszMenuName := nil;
WClass.lpszClassName := 'Server';
ClassRegistered := GetClassInfo(hInstance,WClass.lpszClassName,TempClass);
if ClassRegistered = True then UnregisterClass(TempClass.lpszClassName,hInstance);
Registerclass(Wclass);
Result := CreateWindowEx(WS_EX_NOACTIVATE, WClass.lpszClassName,WClass.lpszClassName, 0, 0, 0, 0, 0, HWND(HWND_MESSAGE), 0, hInstance, nil);

for some reason doesnt work properly, if you post a C++ example i could have a go at converting it. thanks for your input :P

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.