Actually, the answer is Yes and No. I am a developer and search the Internet for various code snippets depending on my needs and happen to stumble across this forum. After reading the responses, I decided to try all the different things to turn the lines
on and to my surprise, I could not find a way to do this in Windows 7 as an end user. As a developer, I do know that Explorer uses a SysTreeView32 control for displaying their folders and files inside the application. Because of this, the ability to have vertical
lines still exist but apparently is inaccessible by the end user. To test this, I wrote a program in C++ to simply send the TVS_HASLINES flag to the SysTreeView32 control if that flag was missing. The result was as expected in that, the lines now appeared.
The program simply searches through all running applications and checks for Explorer.exe, when found, search that window for all SysTreeView32 controls then queries them to see if they are already using the TVS_HASLINES flag. I do this so that the flag is
not set twice from a previous search. The program does not modify your system or change anything in anyway but rather acts as a bridge to an already existing feature. I would post the application but have no way to host the program. I wrote it in Visual C++
using a Win32 application. Below is the source code to achieve this in Windows Vista,7, etc.
#include <Windows.h>
#include <CommCtrl.h>
#include <Psapi.h>
#include <tchar.h>
#pragma comment(lib, "psapi.lib")
#pragma warning(disable:4996)
BOOL CALLBACK EnumChildProc(
_In_ HWND hwnd,
_In_ LPARAM lParam
)
{
char className[256] = "";
int res = ::GetClassNameA(hwnd, className, (int)sizeof(className));
if (!stricmp(className, "SysTreeView32"))
{
// Found a tree control so let's check it's style.
long lStyle = GetWindowLong(hwnd, GWL_STYLE);
if (lStyle & TVS_HASLINES)
{
// Already has lines.
}
else
{
// Add lines.
long prev = ::SetWindowLong(hwnd, GWL_STYLE, lStyle | TVS_HASLINES);
}
}
return TRUE;
// Keep enumerating.
}
BOOL CALLBACK EnumWindowsProc(
_In_ HWND hwnd,
_In_ LPARAM lParam
)
{
DWORD PID = 0L;
DWORD creatorID = ::GetWindowThreadProcessId(hwnd, &PID);
if (PID)
{
bool isExplorer = false;
char imageName[2048L] = "";
HANDLE hProc = ::OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, PID);
if (hProc)
{
::GetProcessImageFileNameA(hProc, imageName, (DWORD)sizeof(imageName));
LPTSTR fname = _tcsrchr(imageName, _T('\'));
if (fname)
{
fname++;
if (!stricmp(fname, "explorer.exe"))
{
isExplorer = true;
// Found an explorer process.
}
}
else
{
if (!stricmp(imageName, "explorer.exe"))
{
isExplorer = true;
// Found an explorer process.
}
}
::CloseHandle(hProc);
}
if (isExplorer)
{
::EnumChildWindows(hwnd, EnumChildProc, NULL);
// Attempt to find a child SysTreeView32 control.
}
}
return TRUE;
// Keep enumerating.
}
int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nCmdShow)
{
//// This was used incase the user wanted to press the ESCAPE key to exit this app.
//bool ext = false;
//do
//{
//
if (::GetAsyncKeyState(VK_ESCAPE))
//
{
//
while (::GetAsyncKeyState(VK_ESCAPE)) {}
//
ext = true;
//
}
//
else
//
{
//
::EnumWindows(EnumWindowsProc, NULL);
//
}
//
::Sleep(1L);
//}while(!ext);
for (;;)
// Endless loop to search for Explorer.exe and send the TVS_HASLINES style.
{
::EnumWindows(EnumWindowsProc, NULL);
::Sleep(1L);
}
return 0L;
}