*TUT* C/C++ Screen Melting Effect / Prank - Zer0Memo0ry - Oct 31, 2016
This program creates a full screen transparent overlapping window, in which a "melting" effect is created to make the computer look like it's screen is melting.
Code #include <Windows.h>
int ScreenWidth, ScreenHeight;
int Interval = 100;
// callback for the melting effect
LRESULT CALLBACK Melter(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch (Msg)
{
case WM_CREATE:
{
HDC Desktop = GetDC(HWND_DESKTOP);
HDC Window = GetDC(hWnd);
BitBlt(Window, 0, 0, ScreenWidth, ScreenHeight, Desktop, 0, 0, SRCCOPY);
ReleaseDC(hWnd, Window);
ReleaseDC(HWND_DESKTOP, Desktop);
SetTimer(hWnd, 0, Interval, 0);
ShowWindow(hWnd, SW_SHOW);
break;
}
case WM_PAINT:
{
ValidateRect(hWnd, 0);
break;
}
case WM_TIMER:
{
HDC Window = GetDC(hWnd);
int X = (rand() % ScreenWidth) - (150 / 2),
Y = (rand() % 15),
Width = (rand() % 150);
BitBlt(Window, X, Y, Width, ScreenHeight, Window, X, 0, SRCCOPY);
ReleaseDC(hWnd, Window);
break;
}
case WM_DESTROY:
{
KillTimer(hWnd, 0);
PostQuitMessage(0);
break;
}
return 0;
}
return DefWindowProc(hWnd, Msg, wParam, lParam);
}
int APIENTRY WinMain(HINSTANCE Inst, HINSTANCE Prev, LPSTR Cmd, int showcmd)
{
// Get the width & height of current display
ScreenWidth = GetSystemMetrics(SM_CXSCREEN);
ScreenHeight = GetSystemMetrics(SM_CYSCREEN);
// class for initializing the window
WNDCLASS wndClass = { 0, Melter, 0,0, Inst, 0, LoadCursorW(0,IDC_ARROW), 0, 0, L"ScreenMelter" };
// register the class
if (RegisterClass(&wndClass))
{
// Create the "melter", an overlapping window.
HWND hWnd = CreateWindowExA(WS_EX_TOPMOST, "ScreenMelter", 0, WS_POPUP,
0, 0, ScreenWidth, ScreenHeight, HWND_DESKTOP, 0, Inst, 0);
if (hWnd) //if the window is created successfully
{
// seed for randomization
srand(GetTickCount());
MSG Msg = { 0 };
// Run the melter loop as long as the program isn't given the shutdown signal
while (Msg.message != WM_QUIT)
{
if (PeekMessage(&Msg, 0, 0, 0, PM_REMOVE))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
}
}
}
return 0;
}
* - Pink-Tshirt - Oct 31, 2016
Did you copy/pasta it from web or you made it ?
* - Hoodie+ - Oct 31, 2016
(Oct 31, 2016 12:58 PM)Vaphreze Wrote: Did you copy/pasta it from web or you made it ?
He made it.
* - Zer0Memo0ry - Oct 31, 2016
(Oct 31, 2016 12:58 PM)Vaphreze Wrote: Did you copy/pasta it from web or you made it ?
I was inspired by someone's idea, and a code snippet. But this code is written by me.
* - Nathan2000 - Nov 1, 2016
(Oct 31, 2016 12:37 PM)Zer0Memo0ry Wrote: This program creates a full screen transparent overlapping window, in which a "melting" effect is created to make the computer look like it's screen is melting.
Code #include <Windows.h>
int ScreenWidth, ScreenHeight;
int Interval = 100;
// callback for the melting effect
LRESULT CALLBACK Melter(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch (Msg)
{
case WM_CREATE:
{
HDC Desktop = GetDC(HWND_DESKTOP);
HDC Window = GetDC(hWnd);
BitBlt(Window, 0, 0, ScreenWidth, ScreenHeight, Desktop, 0, 0, SRCCOPY);
ReleaseDC(hWnd, Window);
ReleaseDC(HWND_DESKTOP, Desktop);
SetTimer(hWnd, 0, Interval, 0);
ShowWindow(hWnd, SW_SHOW);
break;
}
case WM_PAINT:
{
ValidateRect(hWnd, 0);
break;
}
case WM_TIMER:
{
HDC Window = GetDC(hWnd);
int X = (rand() % ScreenWidth) - (150 / 2),
Y = (rand() % 15),
Width = (rand() % 150);
BitBlt(Window, X, Y, Width, ScreenHeight, Window, X, 0, SRCCOPY);
ReleaseDC(hWnd, Window);
break;
}
case WM_DESTROY:
{
KillTimer(hWnd, 0);
PostQuitMessage(0);
break;
}
return 0;
}
return DefWindowProc(hWnd, Msg, wParam, lParam);
}
int APIENTRY WinMain(HINSTANCE Inst, HINSTANCE Prev, LPSTR Cmd, int showcmd)
{
// Get the width & height of current display
ScreenWidth = GetSystemMetrics(SM_CXSCREEN);
ScreenHeight = GetSystemMetrics(SM_CYSCREEN);
// class for initializing the window
WNDCLASS wndClass = { 0, Melter, 0,0, Inst, 0, LoadCursorW(0,IDC_ARROW), 0, 0, L"ScreenMelter" };
// register the class
if (RegisterClass(&wndClass))
{
// Create the "melter", an overlapping window.
HWND hWnd = CreateWindowExA(WS_EX_TOPMOST, "ScreenMelter", 0, WS_POPUP,
0, 0, ScreenWidth, ScreenHeight, HWND_DESKTOP, 0, Inst, 0);
if (hWnd) //if the window is created successfully
{
// seed for randomization
srand(GetTickCount());
MSG Msg = { 0 };
// Run the melter loop as long as the program isn't given the shutdown signal
while (Msg.message != WM_QUIT)
{
if (PeekMessage(&Msg, 0, 0, 0, PM_REMOVE))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
}
}
}
return 0;
}
Non funziona il codice😖
* - Linus Torvalds - Nov 2, 2016
Seems pretty cool, might install windows to test it.
* - Zer0Memo0ry - Nov 9, 2016
(Nov 1, 2016 01:09 PM)Nathan2000 Wrote:
Non funziona il codice😖
In English?
* - chiikriamsih - Nov 22, 2016
thanks, going to try this right now haha!
* - mongbean - Dec 1, 2016
errors in the code.
Severity Code Description Project File Line Suppression State
Error C2664 'HCURSOR LoadCursorW(HINSTANCE,LPCWSTR)': cannot convert argument 2 from 'LPSTR' to 'LPCWSTR'
Line 56
* - Mouse❤️ - Dec 1, 2016
(Dec 1, 2016 03:53 PM)mongbean Wrote: errors in the code.
Severity Code Description Project File Line Suppression State
Error C2664 'HCURSOR LoadCursorW(HINSTANCE,LPCWSTR)': cannot convert argument 2 from 'LPSTR' to 'LPCWSTR'
Line 56 That's not an error in the code. That's a difference in your locale.
* - CichyCichoCiemny - Dec 1, 2016
This is not a tutorial tho :/
* - Zer0Memo0ry - Dec 2, 2016
(Dec 1, 2016 04:09 PM)CichyCichoCiemny Wrote: This is not a tutorial tho :/
There is no a source code section on HF
* - CichyCichoCiemny - Dec 2, 2016
(Dec 2, 2016 02:10 PM)Zer0Memo0ry Wrote: There is no a source code section on HF
There's the C++ section. You just have to add a [Source] tag before the title.
* - vfragtasticv - Dec 2, 2016
(Dec 2, 2016 02:42 PM)CichyCichoCiemny Wrote: There's the C++ section. You just have to add a [Source] tag before the title.
Man just gives free thing soo you need be thankful. You cunt !
🤝
* - CichyCichoCiemny - Dec 2, 2016
(Dec 2, 2016 02:45 PM)vfragtasticv Wrote: Man just gives free thing soo you need be thankful. You cunt !
🤝
I never said i am not thankful, the title is simply missleading.
|