All pastes #968385 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-04-03 00:15 UTC
rendered paste body


#include <windows.h>
WNDCLASS wc;
MSG msg;
HWND h_wnd;
HWND h_wnd2; 
HWND h_wnd3;
HWND h_wnd4;
HWND h_wnd5;
HWND h_wnd6;
HWND h_wnd7;
HWND h_wnd8;
HWND h_wnd9;
bool start;
HWND arrcount[100]  ;
int count;
INT num;
LRESULT WINAPI WindowProc(HWND, UINT,WPARAM,LPARAM);
LRESULT WINAPI CmbProc(HWND,UINT,WPARAM,LPARAM);

int WINAPI WinMain(HINSTANCE h_currinstance,HINSTANCE h_previnstance,LPSTR p_cmdline,int m_show)

{


	wc.lpfnWndProc=WindowProc;
	wc.hInstance=h_currinstance;
	wc.hbrBackground =(HBRUSH) GetStockObject(LTBLACK_BRUSH);
	wc.lpszClassName ="TheMainClass";
	wc.hCursor = LoadCursor(NULL,IDC_ARROW);
	wc.hIcon=LoadIcon(NULL, IDI_APPLICATION);
	wc.style=CS_VREDRAW | CS_HREDRAW;
	RegisterClass(&wc);
	h_wnd=CreateWindowEx(0,"TheMainClass","Defaced windowhider",WS_CAPTION | WS_BORDER | WS_SYSMENU | WS_MINIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT,430,500,0,0,h_currinstance,0);
    h_wnd2=CreateWindowEx(0,"Button","Start Hide",WS_BORDER | WS_CHILD | WS_VISIBLE |BS_PUSHBUTTON,155,200,70,35,h_wnd,(HMENU)24,h_currinstance,0);
h_wnd3=CreateWindowEx(0,"ListBox",NULL,ES_AUTOVSCROLL |WS_BORDER | WS_CHILD | WS_VISIBLE | WS_VSCROLL,30,30,330,170,h_wnd,0,h_currinstance,0); 
	h_wnd5=CreateWindowEx(0,"Static","Instructions", WS_BORDER | WS_CHILD | WS_VISIBLE | SS_CENTER,125,10,125,20,h_wnd,0,h_currinstance,0);
    h_wnd4=CreateWindowEx(WS_EX_CLIENTEDGE,"Static","Edited by newhen",WS_CHILD | WS_VISIBLE , 0,245,420,20,h_wnd,0,h_currinstance,0); 
	count=1;
SetWindowPos(h_wnd,HWND_TOPMOST,CW_USEDEFAULT, CW_USEDEFAULT,400,300,SWP_NOMOVE);
ShowWindow(h_wnd,SW_SHOWNORMAL);
SendMessage(h_wnd3,LB_ADDSTRING,75,(LPARAM)(LPCSTR) "Press H to hide any window");
SendMessage(h_wnd3,LB_ADDSTRING,75,(LPARAM)(LPCSTR) "(The mouse pointer should be above the window)");
SendMessage(h_wnd3,LB_ADDSTRING,75,(LPARAM)(LPCSTR) "Press F10 to unhide all windows");
SendMessage(h_wnd3,LB_ADDSTRING,75,(LPARAM)(LPCSTR) "Press F11 to hide me");
SendMessage(h_wnd3,LB_ADDSTRING,75,(LPARAM)(LPCSTR) "Press D to unhide me");
SendMessage(h_wnd3,LB_ADDSTRING,75,(LPARAM)(LPCSTR) "Click on the Button below to Start Hiding");

	while(GetMessage(&msg,NULL,0,0))
	{ TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
		return(msg.wParam);

}

LRESULT WINAPI  WindowProc(HWND h_wnd,UINT WinMsg,WPARAM w_param,LPARAM l_param)

{


	if (WinMsg==WM_DESTROY)
		PostQuitMessage(0);
else
    if (WinMsg==WM_TIMER)
	{
	POINT pc;
		GetCursorPos(&pc);
		
		
if (GetAsyncKeyState(VK_H))
{
	h_wnd7=WindowFromPoint(pc);
 h_wnd8=h_wnd7;
	while (h_wnd8 !=0)
	{
	 h_wnd9=h_wnd8;
		h_wnd8=GetParent(h_wnd9);
	}

	if (h_wnd9 != 0)
	{	
		h_wnd7=h_wnd9;
	}
	arrcount[count]=h_wnd7;
count=count+1;
char vel[1000];
int len=SendMessage(h_wnd7,WM_GETTEXTLENGTH,0,0) +1;
SendMessage(h_wnd7,WM_GETTEXT,len,(LPARAM)(LPCSTR) vel);
SendMessage(h_wnd3,LB_ADDSTRING,len,(LPARAM)(LPCSTR) vel);
if (h_wnd != h_wnd7) 
{
ShowWindow(h_wnd7,SW_HIDE);
}
}
	
	if (GetAsyncKeyState(VK_D))
	{
		ShowWindow(h_wnd,SW_HIDE);
     
	}
	if (GetAsyncKeyState(VK_F12))
	{
		ShowWindow(h_wnd,SW_SHOWNORMAL);
	}
	if (GetAsyncKeyState(VK_F10))
	{
       int a;
	   a=count;
	   while  (a>0)
	   {
		    ShowWindow(arrcount[a-1],SW_SHOWMAXIMIZED );
	   a=a-1;
	   }
	   count=1;
SendMessage(h_wnd3,LB_RESETCONTENT,0,0);
	   }
	}
else
	if ( WinMsg==WM_COMMAND)
	{
switch(HIWORD(w_param))
		{
		case BN_CLICKED:
SetTimer(h_wnd,1,125,NULL);
SendMessage(h_wnd5,WM_SETTEXT,40,(LPARAM)(LPCSTR) "Hidden Windows");
SendMessage(h_wnd3,LB_RESETCONTENT,0,0);
}
	}
			return DefWindowProc(h_wnd,WinMsg,w_param,l_param);
    
}