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.

PNG As Window/Region?

Featured Replies

Posted

Hi, I was wondering if anyone has any code they could share that demonstrates how to use a png image as a window. I have no idea where to start... I assume Either GDI+ or pnglib, but that's about it... :sweat:

But yeah... If anyone has anything they can share, I would be delighted to look at it. Hopefully in C/C++ or MASM, but I'm sure anything will be fine if I can adapt it.

Thanks,

Hyperlisk

Here's a small C snippet using pnglib, pretty straight forward really:


#include <windows.h>
#include <commctrl.h>
#include "resource.h"
#include "pnglib.h"// Prototypes
INT_PTR CALLBACK Messagehandler(HWND, UINT, WPARAM, LPARAM);// Global vars
HINSTANCE Instance;PNGINFO PNGMain;
HBITMAP BmpMain;
BITMAP BmpDimensions;// ---int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
{
Instance = hInstance;
InitCommonControls(); DialogBox(Instance, MAKEINTRESOURCE(IDD_MAIN), 0, &Messagehandler);
ExitProcess(NULL);
}INT_PTR CALLBACK Messagehandler(HWND Window, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_INITDIALOG:
// Load background png
PNG_Init(&PNGMain);
PNG_LoadResource(&PNGMain, Instance, MAKEINTRESOURCE(PNG_MAIN));
PNG_Decode(&PNGMain);
BmpMain = PNG_CreateBitmap(&PNGMain, Window, PNG_OUTF_AUTO, false);
GetObject(BmpMain, sizeof(BmpDimensions), &BmpDimensions);
break; case WM_PAINT:
PAINTSTRUCT ps;
HDC hdc, hdcMem; hdc = BeginPaint(Window, &ps);
hdcMem = CreateCompatibleDC(hdc); SelectObject(hdcMem, BmpMain);
BitBlt(hdc, 0, 0, BmpDimensions.bmWidth, BmpDimensions.bmHeight, hdcMem, 0, 0, SRCCOPY); DeleteDC(hdcMem);
EndPaint(Window, &ps);
break; case WM_CLOSE:
EndDialog(Window, 0);
break; case WM_DESTROY:
DeleteObject(BmpMain);
PNG_Cleanup(&PNGMain);
break; default:
return false;
} return true;
}

I removed some stuff to make it a more basic example, there might be an error two, haven't run it through a compiler :>

My lib patchLib does this as well if you want to take a look at it's code to see how I did it. You can find it here:
/>http://wiccaan.gamedeception.net/patchLib/

  • Author

Thanks for the help guys, I'll check it out.

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.