Skip to content

Instantly share code, notes, and snippets.

@jsfaint
Created June 20, 2014 09:32
Show Gist options
  • Save jsfaint/c96ff3204b737f004cab to your computer and use it in GitHub Desktop.
Save jsfaint/c96ff3204b737f004cab to your computer and use it in GitHub Desktop.
Yet Another DeskView
//deskview.exe cosplay
//[2008-09-11 jason jsfaint@gmail.com]
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pszCmdLine, int cmdShow)
{
HWND hwnd = FindWindowEx(FindWindowEx(FindWindow("Progman", NULL), 0, "SHELLDLL_DefView", NULL), 0, "SysListView32", NULL);
int iStyle = GetWindowLong(hwnd, GWL_STYLE);
/*
char szBuf[64]= {0};
sprintf(szBuf, "iStyle = 0x%x\niStyle&2 = %d", iStyle, iStyle&2);
MessageBox(hwnd, szBuf, "Information", MB_OK);
*/
int flag = iStyle &(int)2;
if (flag == 0)
SetWindowLong(hwnd, GWL_STYLE, iStyle|=(int)2);
else
SetWindowLong(hwnd, GWL_STYLE, iStyle&=~(int)2);
/*
ZeroMemory(szBuf, 64);
sprintf(szBuf, "iStyle = 0x%x\niStyle&2 = %d", iStyle, iStyle&2);
MessageBox(hwnd, szBuf, "Information", MB_OK);
*/
ShowWindow(hwnd, SW_SHOWNORMAL);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment