#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
#include <stdlib.h>
#pragma comment(lib, "comctl32.lib")
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch (uMsg) {
case WM_DESTROY:
PostQuitMessage(0);
return 0;
case WM_CREATE: {
// Crear TreeView
HWND hTreeView = CreateWindowEx(0, WC_TREEVIEW, NULL,
WS_VISIBLE | WS_CHILD | TVS_HASLINES,
10, 10, 200, 400, hwnd, NULL, NULL, NULL);
// Crear ListView
HWND hListView = CreateWindowEx(0, WC_LISTVIEW, NULL,
WS_VISIBLE | WS_CHILD | LVS_REPORT,
220, 10, 400, 400, hwnd, NULL, NULL, NULL);
// Configurar ListView
LVCOLUMN lvc;
lvc.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
lvc.pszText = "Nombre";
lvc.cx = 300;
ListView_InsertColumn(hListView, 0, &lvc);
break;
}
case WM_NOTIFY: {
// Manejar eventos de TreeView y ListView aquí
break;
}
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
// Inicializar la biblioteca de controles comunes
InitCommonControls();
// Crear la ventana
const char CLASS_NAME[] = "ExploradorClase";
WNDCLASS wc = { 0 };
wc.lpfnWndProc = WindowProc;
wc.hInstance = hInstance;
wc.lpszClassName = CLASS_NAME;
RegisterClass(&wc);
HWND hwnd = CreateWindowEx(0, CLASS_NAME, "Explorador de archivos",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 640, 480,
NULL, NULL, hInstance, NULL);
ShowWindow(hwnd, nCmdShow);
// Bucle de mensajes
MSG msg;
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}