Updated with progress. Still far to go....

svn path=/trunk/; revision=3219
This commit is contained in:
Robert Dickenson 2002-07-14 17:59:36 +00:00
parent 5705c99d2a
commit cf0bb98945
47 changed files with 3147 additions and 858 deletions

View file

@ -30,10 +30,10 @@ RCFLAGS = -DGCC -D_WIN32_IE=0x0400
OBJS = about.o \ OBJS = about.o \
debug.o \ framewnd.o \
regtree.o \ listview.o \
reglist.o \ treeview.o \
$(TARGET).o main.o
LIBS = -lgdi32 -luser32 -lkernel32 -lcomctl32 LIBS = -lgdi32 -luser32 -lkernel32 -lcomctl32
@ -46,41 +46,20 @@ $(TARGET).exe: $(OBJS) $(TARGET).coff
$(NM) --numeric-sort $(TARGET).exe > $(TARGET).sym $(NM) --numeric-sort $(TARGET).exe > $(TARGET).sym
about.o: about.cpp about.h resource.h main.h: resource.h
affinity.o: affinity.cpp affinity.h about.o: about.c about.h main.h
applicationpage.o: applicationpage.cpp applicationpage.h processpage.h $(TARGET).h resource.h main.o: main.c main.h framewnd.h
column.o: column.cpp column.h resource.h framewnd.o: framewnd.c framewnd.h listview.h treeview.h main.h
debug.o: debug.cpp debug.h listview.o: listview.c listview.h main.h
endproc.o: endproc.cpp endproc.h treeview.o: treeview.c treeview.h main.h
font.o: font.cpp font.h debug.o: debug.c debug.h main.h
graph.o: graph.cpp graph.h resource.h
graphctrl.o: graphctrl.cpp graphctrl.h resource.h
optnmenu.o: optnmenu.cpp optnmenu.h resource.h
perfdata.o: perfdata.cpp perfdata.h
performancepage.o: performancepage.cpp performancepage.h perfdata.h graphctrl.h graph.h $(TARGET).h resource.h
priority.o: priority.cpp priority.h
processpage.o: processpage.cpp processpage.h perfdata.h column.h proclist.h $(TARGET).h resource.h
proclist.o: proclist.cpp proclist.h
run.o: run.cpp run.h
trayicon.o: trayicon.cpp trayicon.h resource.h
$(TARGET).o: $(TARGET).cpp $(TARGET).h resource.h
clean: clean:
- $(RM) $(OBJS) - $(RM) $(OBJS)
@ -88,4 +67,4 @@ clean:
- $(RM) $(TARGET).sym - $(RM) $(TARGET).sym
- $(RM) $(TARGET).coff - $(RM) $(TARGET).coff
include ../rules.mak include $(PATH_TO_TOP)/rules.mak

69
rosapps/regedit/about.c Normal file
View file

@ -0,0 +1,69 @@
/*
* ReactOS About Dialog Box
*
* about.c
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#endif
#include "main.h"
#include "about.h"
extern HINSTANCE hInst;
LRESULT CALLBACK AboutDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND hLicenseEditWnd;
TCHAR strLicense[0x1000];
switch (message) {
case WM_INITDIALOG:
hLicenseEditWnd = GetDlgItem(hDlg, IDC_LICENSE_EDIT);
LoadString(hInst, IDS_LICENSE, strLicense, 0x1000);
SetWindowText(hLicenseEditWnd, strLicense);
return TRUE;
case WM_COMMAND:
if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL)) {
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
}
return 0;
}
void ShowAboutBox(HWND hWnd)
{
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, (DLGPROC)AboutDialogWndProc);
}

View file

@ -23,8 +23,15 @@
#ifndef __ABOUT_H__ #ifndef __ABOUT_H__
#define __ABOUT_H__ #define __ABOUT_H__
#ifdef __cplusplus
extern "C" {
#endif
void ShowAboutBox(HWND hWnd); void ShowAboutBox(HWND hWnd);
#ifdef __cplusplus
};
#endif
#endif // __ABOUT_H__ #endif // __ABOUT_H__

39
rosapps/regedit/debug.c Normal file
View file

@ -0,0 +1,39 @@
/*
* ReactOS Application Debug Routines
*
* debug.c
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#endif
#include "main.h"
#include "debug.h"

View file

@ -1,7 +1,7 @@
/* /*
* ReactOS Application Debug Routines * ReactOS Application Debug Routines
* *
* debug.cpp * debug.h
* *
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org> * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
* *
@ -23,6 +23,15 @@
#ifndef __DEBUG_H__ #ifndef __DEBUG_H__
#define __DEBUG_H__ #define __DEBUG_H__
#ifdef __cplusplus
extern "C" {
#endif
#endif // __DEBUG_H__
#ifdef __cplusplus
};
#endif
#endif // __DEBUG_H__

439
rosapps/regedit/framewnd.c Normal file
View file

@ -0,0 +1,439 @@
/*
* ReactOS regedit
*
* framewnd.c
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#endif
#include "main.h"
#include "about.h"
#include "framewnd.h"
#include "treeview.h"
#include "listview.h"
#include <shellapi.h>
//#include <winspool.h>
////////////////////////////////////////////////////////////////////////////////
// Global Variables:
//
HWND hTreeWnd; // Tree Control Window
HWND hListWnd; // List Control Window
HWND hSplitWnd; // Splitter Bar Control Window
int nOldWidth; // Holds the previous client area width
int nOldHeight; // Holds the previous client area height
BOOL bInMenuLoop = FALSE; // Tells us if we are in the menu loop
////////////////////////////////////////////////////////////////////////////////
// Local module support methods
//
static void resize_frame_rect(HWND hWnd, PRECT prect)
{
// int new_top;
RECT rt;
/*
if (IsWindowVisible(hToolBar)) {
SendMessage(hToolBar, WM_SIZE, 0, 0);
GetClientRect(hToolBar, &rt);
prect->top = rt.bottom+3;
prect->bottom -= rt.bottom+3;
}
*/
if (IsWindowVisible(hStatusBar)) {
GetClientRect(hStatusBar, &rt);
prect->bottom -= rt.bottom;
}
// MoveWindow(hWnd, prect->left-1,prect->top-1,prect->right+2,prect->bottom+1, TRUE);
}
static void resize_frame(HWND hWnd, int cx, int cy)
{
RECT rect = {0, 0, cx, cy};
resize_frame_rect(hWnd, &rect);
}
void resize_frame_client(HWND hWnd)
{
RECT rect;
GetClientRect(hWnd, &rect);
resize_frame_rect(hWnd, &rect);
}
static void draw_splitbar(HWND hWnd, int x)
{
RECT rt;
HDC hdc = GetDC(hWnd);
GetClientRect(hWnd, &rt);
if (IsWindowVisible(hStatusBar)) {
RECT rect;
GetClientRect(hStatusBar, &rect);
rt.bottom -= rect.bottom;
}
rt.left = x - SPLIT_WIDTH/2;
rt.right = x + SPLIT_WIDTH/2+1;
InvertRect(hdc, &rt);
ReleaseDC(hWnd, hdc);
}
#define _NO_EXTENSIONS
static int nSplitPos = 250;
static void ResizeWnd(int cx, int cy)
{
HDWP hdwp = BeginDeferWindowPos(2);
RECT rt = {0, 0, cx, cy};
cx = nSplitPos + SPLIT_WIDTH/2;
if (IsWindowVisible(hStatusBar)) {
RECT rect;
GetClientRect(hStatusBar, &rect);
rt.bottom -= rect.bottom;
}
DeferWindowPos(hdwp, hTreeWnd, 0, rt.left, rt.top, nSplitPos-SPLIT_WIDTH/2-rt.left, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
DeferWindowPos(hdwp, hListWnd, 0, rt.left+cx+1, rt.top, rt.right-cx, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
EndDeferWindowPos(hdwp);
}
static void OnSize(WPARAM wParam, LPARAM lParam)
{
if (wParam != SIZE_MINIMIZED) {
ResizeWnd(LOWORD(lParam), HIWORD(lParam));
}
}
/*
// OnSize()
// This function handles all the sizing events for the application
// It re-sizes every window, and child window that needs re-sizing
static void OnSize(UINT nType, int cx, int cy)
{
int nParts[3];
int nXDifference;
int nYDifference;
RECT rc;
if (nType == SIZE_MINIMIZED)
return;
nXDifference = cx - nOldWidth;
nYDifference = cy - nOldHeight;
nOldWidth = cx;
nOldHeight = cy;
// Update the status bar size
GetWindowRect(hStatusBar, &rc);
SendMessage(hStatusBar, WM_SIZE, nType, MAKELPARAM(cx, cy + (rc.bottom - rc.top)));
// Update the status bar pane sizes
nParts[0] = bInMenuLoop ? -1 : 100;
nParts[1] = 210;
nParts[2] = cx;
SendMessage(hStatusBar, SB_SETPARTS, bInMenuLoop ? 1 : 3, (long)nParts);
GetWindowRect(hStatusBar, &rc);
MoveWindow(hTreeWnd,0,0,cx/2,cy-(rc.bottom - rc.top),TRUE);
MoveWindow(hListWnd,cx/2,0,cx,cy-(rc.bottom - rc.top),TRUE);
}
*/
void OnEnterMenuLoop(HWND hWnd)
{
int nParts;
// Update the status bar pane sizes
nParts = -1;
SendMessage(hStatusBar, SB_SETPARTS, 1, (long)&nParts);
bInMenuLoop = TRUE;
SendMessage(hStatusBar, SB_SETTEXT, (WPARAM)0, (LPARAM)_T(""));
}
void OnExitMenuLoop(HWND hWnd)
{
RECT rc;
int nParts[3];
// TCHAR text[260];
bInMenuLoop = FALSE;
// Update the status bar pane sizes
GetClientRect(hWnd, &rc);
nParts[0] = 100;
nParts[1] = 210;
nParts[2] = rc.right;
SendMessage(hStatusBar, SB_SETPARTS, 3, (long)nParts);
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)_T(""));
}
void OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
{
TCHAR str[100];
strcpy(str, TEXT(""));
if (nFlags & MF_POPUP) {
if (hSysMenu != GetMenu(hWnd)) {
if (nItemID == 2) nItemID = 5;
}
}
if (LoadString(hInst, nItemID, str, 100)) {
// load appropriate string
LPTSTR lpsz = str;
// first newline terminates actual string
lpsz = _tcschr(lpsz, '\n');
if (lpsz != NULL)
*lpsz = '\0';
}
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)str);
}
////////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG)
//
// PURPOSE: Processes WM_COMMAND messages for the main frame window.
//
//
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
switch (LOWORD(wParam)) {
// Parse the menu selections:
case ID_REGISTRY_PRINTERSETUP:
//PRINTDLG pd;
//PrintDlg(&pd);
//PAGESETUPDLG psd;
//PageSetupDlg(&psd);
break;
case ID_REGISTRY_OPENLOCAL:
/*
{
HWND hChildWnd;
// hChildWnd = CreateWindow(szFrameClass, szTitle, WS_OVERLAPPEDWINDOW | WS_CHILD,
// CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, hWnd, NULL, hInst, NULL);
hChildWnd = CreateWindow(szFrameClass, szTitle, WS_OVERLAPPEDWINDOW | WS_CHILD,
0, 0, 150, 170, hWnd, NULL, hInst, NULL);
if (hChildWnd) {
ShowWindow(hChildWnd, 1);
UpdateWindow(hChildWnd);
}
}
*/
break;
case ID_REGISTRY_EXIT:
DestroyWindow(hWnd);
break;
case ID_VIEW_REFRESH:
// TODO:
break;
case ID_HELP_HELPTOPICS:
// WinHelp(hWnd, _T("regedit"), HELP_CONTENTS, 0);
WinHelp(hWnd, _T("regedit"), HELP_FINDER, 0);
break;
case ID_HELP_ABOUT:
#ifdef WINSHELLAPI
ShellAbout(hWnd, szTitle, "", LoadIcon(hInst, (LPCTSTR)IDI_REGEDIT));
#else
ShowAboutBox(hWnd);
#endif
break;
default:
return FALSE;
}
return TRUE;
}
////////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: FrameWndProc(HWND, unsigned, WORD, LONG)
//
// PURPOSE: Processes messages for the main frame window.
//
// WM_COMMAND - process the application menu
// WM_PAINT - Paint the main window
// WM_DESTROY - post a quit message and return
//
//
LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static int last_split;
PAINTSTRUCT ps;
HDC hdc;
switch (message) {
case WM_CREATE:
//HWND CreateListView(HWND hwndParent/*, Pane* pane*/, int id, LPTSTR lpszPathName);
hTreeWnd = CreateTreeView(hWnd, 1000, "c:\\foobar.txt");
hListWnd = CreateListView(hWnd, 1001, "");
break;
case WM_COMMAND:
if (!_CmdWndProc(hWnd, message, wParam, lParam)) {
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_SIZE:
// resize_frame_client(hWnd);
// OnSize(wParam, LOWORD(lParam), HIWORD(lParam));
// break;
OnSize(wParam, lParam);
goto def;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
// TODO: Add any drawing code here...
//RECT rt;
//GetClientRect(hWnd, &rt);
//DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER);
EndPaint(hWnd, &ps);
break;
break;
case WM_TIMER:
break;
case WM_SETCURSOR:
if (LOWORD(lParam) == HTCLIENT) {
POINT pt;
GetCursorPos(&pt);
ScreenToClient(hWnd, &pt);
if (pt.x>=nSplitPos-SPLIT_WIDTH/2 && pt.x<nSplitPos+SPLIT_WIDTH/2+1) {
SetCursor(LoadCursor(0, IDC_SIZEWE));
return TRUE;
}
}
goto def;
case WM_LBUTTONDOWN: {
RECT rt;
int x = LOWORD(lParam);
GetClientRect(hWnd, &rt);
if (x>=nSplitPos-SPLIT_WIDTH/2 && x<nSplitPos+SPLIT_WIDTH/2+1) {
last_split = nSplitPos;
#ifdef _NO_EXTENSIONS
draw_splitbar(hWnd, last_split);
#endif
SetCapture(hWnd);
}
break;}
case WM_LBUTTONUP:
if (GetCapture() == hWnd) {
#ifdef _NO_EXTENSIONS
RECT rt;
int x = LOWORD(lParam);
draw_splitbar(hWnd, last_split);
last_split = -1;
GetClientRect(hWnd, &rt);
nSplitPos = x;
ResizeWnd(rt.right, rt.bottom);
#endif
ReleaseCapture();
}
break;
#ifdef _NO_EXTENSIONS
case WM_CAPTURECHANGED:
if (GetCapture()==hWnd && last_split>=0)
draw_splitbar(hWnd, last_split);
break;
#endif
case WM_KEYDOWN:
if (wParam == VK_ESCAPE)
if (GetCapture() == hWnd) {
RECT rt;
#ifdef _NO_EXTENSIONS
draw_splitbar(hWnd, last_split);
#else
nSplitPos = last_split;
#endif
GetClientRect(hWnd, &rt);
ResizeWnd(rt.right, rt.bottom);
last_split = -1;
ReleaseCapture();
SetCursor(LoadCursor(0, IDC_ARROW));
}
break;
case WM_MOUSEMOVE:
if (GetCapture() == hWnd) {
RECT rt;
int x = LOWORD(lParam);
#ifdef _NO_EXTENSIONS
HDC hdc = GetDC(hWnd);
GetClientRect(hWnd, &rt);
rt.left = last_split-SPLIT_WIDTH/2;
rt.right = last_split+SPLIT_WIDTH/2+1;
InvertRect(hdc, &rt);
last_split = x;
rt.left = x-SPLIT_WIDTH/2;
rt.right = x+SPLIT_WIDTH/2+1;
InvertRect(hdc, &rt);
ReleaseDC(hWnd, hdc);
#else
GetClientRect(hWnd, &rt);
if (x>=0 && x<rt.right) {
nSplitPos = x;
ResizeWnd(rt.right, rt.bottom);
rt.left = x-SPLIT_WIDTH/2;
rt.right = x+SPLIT_WIDTH/2+1;
InvalidateRect(hWnd, &rt, FALSE);
UpdateWindow(hTreeWnd);
UpdateWindow(hWnd);
UpdateWindow(hListWnd);
}
#endif
}
break;
case WM_ENTERMENULOOP:
OnEnterMenuLoop(hWnd);
break;
case WM_EXITMENULOOP:
OnExitMenuLoop(hWnd);
break;
case WM_MENUSELECT:
OnMenuSelect(hWnd, LOWORD(wParam), HIWORD(wParam), (HMENU)lParam);
break;
case WM_DESTROY:
WinHelp(hWnd, _T("regedit"), HELP_QUIT, 0);
PostQuitMessage(0);
default: def:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}

View file

@ -0,0 +1,47 @@
/*
* ReactOS regedit
*
* framewnd.h
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __FRAMEWND_H__
#define __FRAMEWND_H__
#ifdef __cplusplus
extern "C" {
#endif
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
extern HWND hTreeWnd; // Tree Control Window
extern HWND hListWnd; // List Control Window
extern HWND hSplitWnd; // Splitter Bar Control Window
LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM);
#ifdef __cplusplus
};
#endif
#endif // __FRAMEWND_H__

250
rosapps/regedit/listview.c Normal file
View file

@ -0,0 +1,250 @@
/*
* ReactOS regedit
*
* listview.c
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#endif
#include <windowsx.h>
#include <assert.h>
#define ASSERT assert
#include "main.h"
#include "listview.h"
////////////////////////////////////////////////////////////////////////////////
// Global Variables:
//
extern HINSTANCE hInst;
extern HWND hMainWnd;
static WNDPROC g_orgListWndProc;
////////////////////////////////////////////////////////////////////////////////
// Local module support methods
//
#define MAX_LIST_COLUMNS (IDS_LIST_COLUMN_LAST - IDS_LIST_COLUMN_FIRST + 1)
static int default_column_widths[MAX_LIST_COLUMNS] = { 175, 100, 100 };
static int column_alignment[MAX_LIST_COLUMNS] = { LVCFMT_LEFT, LVCFMT_RIGHT, LVCFMT_RIGHT };
static void CreateListColumns(HWND hWndListView)
{
TCHAR szText[50];
int index;
LV_COLUMN lvC;
// Create columns.
lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
lvC.pszText = szText;
// Load the column labels from the resource file.
for (index = 0; index < MAX_LIST_COLUMNS; index++) {
lvC.iSubItem = index;
lvC.cx = default_column_widths[index];
lvC.fmt = column_alignment[index];
LoadString(hInst, IDS_LIST_COLUMN_FIRST + index, szText, sizeof(szText));
if (ListView_InsertColumn(hWndListView, index, &lvC) == -1) {
// TODO: handle failure condition...
break;
}
}
}
// OnGetDispInfo - processes the LVN_GETDISPINFO
// notification message.
static void OnGetDispInfo(NMLVDISPINFO* plvdi)
{
static TCHAR buffer[200];
// Entry* entry = (Entry*)plvdi->item.lParam;
// ASSERT(entry);
plvdi->item.pszText = NULL;
switch (plvdi->item.iSubItem) {
case 0:
// plvdi->item.pszText = entry->data.cFileName;
break;
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
default:
_tcscpy(buffer, _T(" "));
plvdi->item.pszText = buffer;
break;
}
}
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (LOWORD(wParam)) {
// case ID_FILE_OPEN:
// break;
default:
return FALSE;
}
return TRUE;
}
////////////////////////////////////////////////////////////////////////////////
static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
// ChildWnd* child = (ChildWnd*)GetWindowLong(GetParent(hWnd), GWL_USERDATA);
// Pane* pane = (Pane*)GetWindowLong(hWnd, GWL_USERDATA);
// ASSERT(child);
switch (message) {
/*
case WM_CREATE:
//CreateListView(hWnd);
return 0;
*/
case WM_COMMAND:
if (!_CmdWndProc(hWnd, message, wParam, lParam)) {
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
}
break;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case LVN_GETDISPINFO:
OnGetDispInfo((NMLVDISPINFO*)lParam);
break;
case NM_DBLCLK:
{
NMITEMACTIVATE* nmitem = (LPNMITEMACTIVATE)lParam;
LVHITTESTINFO info;
if (nmitem->hdr.hwndFrom != hWnd) break;
// if (nmitem->hdr.idFrom != IDW_LISTVIEW) break;
// if (nmitem->hdr.code != ???) break;
#ifdef _MSC_VER
switch (nmitem->uKeyFlags) {
case LVKF_ALT: // The ALT key is pressed.
// properties dialog box ?
break;
case LVKF_CONTROL: // The CTRL key is pressed.
// run dialog box for providing parameters...
break;
case LVKF_SHIFT: // The SHIFT key is pressed.
break;
}
#endif
info.pt.x = nmitem->ptAction.x;
info.pt.y = nmitem->ptAction.y;
if (ListView_HitTest(hWnd, &info) != -1) {
LVITEM item;
item.mask = LVIF_PARAM;
item.iItem = info.iItem;
if (ListView_GetItem(hWnd, &item)) {
// Entry* entry = (Entry*)item.lParam;
// OpenTarget(hWnd, entry->data.cFileName);
}
}
}
break;
default:
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
}
break;
case WM_KEYDOWN:
if (wParam == VK_TAB) {
//TODO: SetFocus(Globals.hDriveBar)
//SetFocus(child->nFocusPanel? child->left.hWnd: child->right.hWnd);
}
break;
default:
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
break;
}
return 0;
}
HWND CreateListView(HWND hwndParent/*, Pane* pane*/, int id, LPTSTR lpszPathName)
{
RECT rcClient; // dimensions of client area
HWND hwndLV; // handle to list view control
// Entry* entry = pane->root;
// pane->treePane = 0;
// Get the dimensions of the parent window's client area, and create the list view control.
GetClientRect(hwndParent, &rcClient);
hwndLV = CreateWindowEx(0, WC_LISTVIEW, _T("List View"),
WS_VISIBLE | WS_CHILD | WS_BORDER | LVS_REPORT,
0, 0, rcClient.right, rcClient.bottom,
hwndParent, (HMENU)id, hInst, NULL);
// Initialize the image list, and add items to the control.
/*
if (!InitListViewImageLists(hwndLV) ||
!InitListViewItems(hwndLV, lpszPathName)) {
DestroyWindow(hwndLV);
return FALSE;
}
*/
ListView_SetExtendedListViewStyle(hwndLV, LVS_EX_FULLROWSELECT);
CreateListColumns(hwndLV);
SetWindowLong(hwndLV, GWL_USERDATA, (LPARAM)lpszPathName);
g_orgListWndProc = SubclassWindow(hwndLV, ListWndProc);
//SendMessage(hwndLV, WM_SETFONT, (WPARAM)Globals.hFont, FALSE);
// insert entries into listbox
// if (entry) {
// InsertListEntries(hwndLV, entry, -1);
// }
return hwndLV;
}
void RefreshList(HWND hWnd/*, Entry* entry*/)
{
if (hWnd != NULL) {
ListView_DeleteAllItems(hWnd);
/*
if (entry != NULL) {
TRACE("RefreshList(...) entry name: %s\n", entry->data.cFileName);
InsertListEntries(hWnd, entry, -1);
}
*/
}
}

View file

@ -0,0 +1,43 @@
/*
* ReactOS regedit
*
* listview.h
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __LISTVIEW_H__
#define __LISTVIEW_H__
#ifdef __cplusplus
extern "C" {
#endif
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
HWND CreateListView(HWND hwndParent/*, Pane* pane*/, int id, LPTSTR lpszPathName);
void RefreshList(HWND hWnd/*, Entry* entry*/);
#ifdef __cplusplus
};
#endif
#endif // __LISTVIEW_H__

167
rosapps/regedit/main.c Normal file
View file

@ -0,0 +1,167 @@
/*
* ReactOS regedit
*
* main.c
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#endif
#include "main.h"
#include "framewnd.h"
#include "treeview.h"
#include "listview.h"
#include <shellapi.h>
//#include <winspool.h>
////////////////////////////////////////////////////////////////////////////////
// Global Variables:
HINSTANCE hInst;
HWND hMainWnd;
HWND hStatusBar;
TCHAR szTitle[MAX_LOADSTRING];
TCHAR szFrameClass[MAX_LOADSTRING];
//TCHAR szWindowClass[MAX_LOADSTRING];
////////////////////////////////////////////////////////////////////////////////
//
//
// FUNCTION: InitInstance(HANDLE, int)
//
// PURPOSE: Saves instance handle and creates main window
//
// COMMENTS:
//
// In this function, we save the instance handle in a global variable and
// create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
int nParts[3];
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)FrameWndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_REGEDIT);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)SS_BLACKRECT/*(COLOR_WINDOW+1)*/;
// wcex.lpszMenuName = (LPCSTR)IDC_REGEDIT;
wcex.lpszMenuName = (LPCSTR)IDR_REGEDIT_MENU;
wcex.lpszClassName = szFrameClass;
wcex.hIconSm = LoadIcon((HINSTANCE)wcex.hInstance, (LPCTSTR)IDI_SMALL);
RegisterClassEx(&wcex);
// Initialize the Windows Common Controls DLL
InitCommonControls();
hInst = hInstance; // Store instance handle in our global variable
hMainWnd = CreateWindow(szFrameClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
if (!hMainWnd) {
return FALSE;
}
// Get the minimum window sizes
// GetWindowRect(hMainWnd, &rc);
// nMinimumWidth = (rc.right - rc.left);
// nMinimumHeight = (rc.bottom - rc.top);
// Create the status bar
hStatusBar = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS,
_T(""), hMainWnd, STATUS_WINDOW);
if (!hStatusBar)
return FALSE;
// Create the status bar panes
nParts[0] = 100;
nParts[1] = 210;
nParts[2] = 400;
SendMessage(hStatusBar, SB_SETPARTS, 3, (long)nParts);
/*
hSplitWnd = CreateWindow(szFrameClass, "splitter window", WS_VISIBLE|WS_CHILD,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
hMainWnd, (HMENU)SPLIT_WINDOW, hInstance, NULL);
if (!hSplitWnd)
return FALSE;
*/
ShowWindow(hMainWnd, nCmdShow);
UpdateWindow(hMainWnd);
return TRUE;
}
////////////////////////////////////////////////////////////////////////////////
void ExitInstance(void)
{
// DestroyMenu(hMenuFrame);
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MSG msg;
HACCEL hAccel;
// Initialize global strings
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_REGEDIT_FRAME, szFrameClass, MAX_LOADSTRING);
// LoadString(hInstance, IDC_REGEDIT, szWindowClass, MAX_LOADSTRING);
// Store instance handle in our global variable
hInst = hInstance;
// Perform application initialization:
if (!InitInstance(hInstance, nCmdShow)) {
return FALSE;
}
hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDC_REGEDIT);
// Main message loop:
while (GetMessage(&msg, (HWND)NULL, 0, 0)) {
if (!TranslateAccelerator(msg.hwnd, hAccel, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
ExitInstance();
return msg.wParam;
}

73
rosapps/regedit/main.h Normal file
View file

@ -0,0 +1,73 @@
/*
* ReactOS regedit
*
* main.h
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __MAIN_H__
#define __MAIN_H__
#ifdef __cplusplus
extern "C" {
#endif
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "resource.h"
#define STATUS_WINDOW 2001
#define TREE_WINDOW 2002
#define LIST_WINDOW 2003
#define SPLIT_WINDOW 2004
#define MAX_LOADSTRING 100
#define SPLIT_WIDTH 3
////////////////////////////////////////////////////////////////////////////////
// Global Variables:
extern HINSTANCE hInst;
extern HWND hMainWnd;
extern HWND hStatusBar;
extern TCHAR szTitle[];
extern TCHAR szFrameClass[];
//extern TCHAR szWindowClass[];
#ifndef _MSC_VER
typedef struct tagNMITEMACTIVATE{
NMHDR hdr;
int iItem;
int iSubItem;
UINT uNewState;
UINT uOldState;
UINT uChanged;
POINT ptAction;
LPARAM lParam;
UINT uKeyFlags;
} NMITEMACTIVATE, FAR *LPNMITEMACTIVATE;
#endif
#ifdef __cplusplus
};
#endif
#endif // __MAIN_H__

View file

@ -1,6 +1,5 @@
//Microsoft Developer Studio generated resource script. //Microsoft Developer Studio generated resource script.
// //
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS #define APSTUDIO_READONLY_SYMBOLS
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -31,12 +30,12 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// Icon with lowest ID value placed first to ensure application icon // Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems. // remains consistent on all systems.
IDI_REGEDIT ICON DISCARDABLE "regedit.ICO" IDI_REGEDIT ICON DISCARDABLE "res/regedit.ico"
IDI_SMALL ICON DISCARDABLE "SMALL.ICO" IDI_SMALL ICON DISCARDABLE "res/small.ico"
IDB_OPEN_FILE BITMAP DISCARDABLE "folder1.bmp" IDB_OPEN_FILE BITMAP DISCARDABLE "res/folder1.bmp"
IDB_CLOSED_FILE BITMAP DISCARDABLE "folder2.bmp" IDB_CLOSED_FILE BITMAP DISCARDABLE "res/folder2.bmp"
IDB_ROOT BITMAP DISCARDABLE "folder3.bmp" IDB_ROOT BITMAP DISCARDABLE "res/folder3.bmp"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -48,11 +47,11 @@ IDC_REGEDIT MENU DISCARDABLE
BEGIN BEGIN
POPUP "&File" POPUP "&File"
BEGIN BEGIN
MENUITEM "E&xit", IDM_EXIT MENUITEM "E&xit", ID_REGISTRY_EXIT
END END
POPUP "&Help" POPUP "&Help"
BEGIN BEGIN
MENUITEM "&About ...", IDM_ABOUT MENUITEM "&About ...", ID_HELP_ABOUT
END END
END END
@ -60,21 +59,20 @@ IDR_REGEDIT_MENU MENU DISCARDABLE
BEGIN BEGIN
POPUP "&Registry" POPUP "&Registry"
BEGIN BEGIN
MENUITEM "&Import Registry File...", ID_REGISTRY_IMPORTREGISTRYFILE MENUITEM "&Import Registry File...", ID_REGISTRY_IMPORTREGISTRYFILE, GRAYED
MENUITEM "&Export Registry File...", ID_REGISTRY_EXPORTREGISTRYFILE MENUITEM "&Export Registry File...", ID_REGISTRY_EXPORTREGISTRYFILE, GRAYED
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Connect Network Registry...", MENUITEM "&Connect Network Registry...",
ID_REGISTRY_CONNECTNETWORKREGISTRY ID_REGISTRY_CONNECTNETWORKREGISTRY, GRAYED
MENUITEM "&Disconnect Network Registry...", MENUITEM "&Disconnect Network Registry...",
ID_REGISTRY_DISCONNECTNETWORKREGISTRY ID_REGISTRY_DISCONNECTNETWORKREGISTRY, GRAYED
, GRAYED
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Print\tCtrl+P", ID_REGISTRY_PRINT MENUITEM "&Print\tCtrl+P", ID_REGISTRY_PRINT, GRAYED
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "E&xit", IDM_EXIT MENUITEM "E&xit", ID_REGISTRY_EXIT
END END
POPUP "&Edit" POPUP "&Edit"
BEGIN BEGIN
@ -94,8 +92,8 @@ BEGIN
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Copy Key Name", ID_EDIT_COPYKEYNAME MENUITEM "&Copy Key Name", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Find\tCtrl+F", ID_EDIT_FIND MENUITEM "&Find\tCtrl+F", ID_EDIT_FIND, GRAYED
MENUITEM "Find Ne&xt\tF3", ID_EDIT_FINDNEXT MENUITEM "Find Ne&xt\tF3", ID_EDIT_FINDNEXT, GRAYED
END END
POPUP "&View" POPUP "&View"
BEGIN BEGIN
@ -107,7 +105,7 @@ BEGIN
END END
POPUP "&Favourites" POPUP "&Favourites"
BEGIN BEGIN
MENUITEM "&Add to Favourites", ID_FAVOURITES_ADDTOFAVOURITES MENUITEM "&Add to Favourites", ID_FAVOURITES_ADDTOFAVOURITES, GRAYED
MENUITEM "&Remove Favourite", ID_FAVOURITES_REMOVEFAVOURITE MENUITEM "&Remove Favourite", ID_FAVOURITES_REMOVEFAVOURITE
, GRAYED , GRAYED
END END
@ -115,10 +113,17 @@ BEGIN
BEGIN BEGIN
MENUITEM "&Help Topics", ID_HELP_HELPTOPICS MENUITEM "&Help Topics", ID_HELP_HELPTOPICS
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&About Registry Editor", IDM_ABOUT MENUITEM "&About Registry Editor", ID_HELP_ABOUT
END END
END END
STRINGTABLE DISCARDABLE
BEGIN
IDS_LIST_COLUMN_NAME "Name"
IDS_LIST_COLUMN_TYPE "Type"
IDS_LIST_COLUMN_DATA "Data"
END
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
@ -170,7 +175,6 @@ END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
IDS_APP_TITLE "ReactOS Registry Editor" IDS_APP_TITLE "ReactOS Registry Editor"
IDS_HELLO "Hello World!"
ID_REGISTRY_MENU "Contains commands for working with the whole registry" ID_REGISTRY_MENU "Contains commands for working with the whole registry"
ID_EDIT_MENU "Contains commands for editing values or keys" ID_EDIT_MENU "Contains commands for editing values or keys"
@ -184,7 +188,7 @@ BEGIN
ID_REGISTRY_CONNECTNETWORKREGISTRY "Connects to a remote computer's registry" ID_REGISTRY_CONNECTNETWORKREGISTRY "Connects to a remote computer's registry"
ID_REGISTRY_DISCONNECTNETWORKREGISTRY "Disconnects from a remote computer's registry" ID_REGISTRY_DISCONNECTNETWORKREGISTRY "Disconnects from a remote computer's registry"
ID_REGISTRY_PRINT "Prints all or part of the registry" ID_REGISTRY_PRINT "Prints all or part of the registry"
IDM_EXIT "Quits the registry editor" ID_REGISTRY_EXIT "Quits the registry editor"
ID_EDIT_MODIFY "Modifies the value's data" ID_EDIT_MODIFY "Modifies the value's data"
ID_EDIT_NEW_KEY "Adds a new key" ID_EDIT_NEW_KEY "Adds a new key"
@ -206,7 +210,7 @@ BEGIN
ID_FAVOURITES_REMOVEFAVOURITE "Removes keys from the favourites list" ID_FAVOURITES_REMOVEFAVOURITE "Removes keys from the favourites list"
ID_HELP_HELPTOPICS "Opens registry editor help" ID_HELP_HELPTOPICS "Opens registry editor help"
IDM_ABOUT "Displays program information, version number and copyright" ID_HELP_ABOUT "Displays program information, version number and copyright"
IDC_REGEDIT "REGEDIT" IDC_REGEDIT "REGEDIT"
IDC_REGEDIT_FRAME "REGEDIT_FRAME" IDC_REGEDIT_FRAME "REGEDIT_FRAME"
@ -285,7 +289,7 @@ END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
IDM_ABOUT "Displays program information, version number, and copyright." ID_HELP_ABOUT "Displays program information, version number, and copyright."
END END
#endif // English (Australia) resources #endif // English (Australia) resources

View file

Before

Width:  |  Height:  |  Size: 246 B

After

Width:  |  Height:  |  Size: 246 B

View file

Before

Width:  |  Height:  |  Size: 246 B

After

Width:  |  Height:  |  Size: 246 B

View file

Before

Width:  |  Height:  |  Size: 246 B

After

Width:  |  Height:  |  Size: 246 B

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 318 B

After

Width:  |  Height:  |  Size: 318 B

View file

@ -9,11 +9,14 @@
#define ID_HELP_MENU 4 #define ID_HELP_MENU 4
#define ID_EDIT_NEW_MENU 5 #define ID_EDIT_NEW_MENU 5
#define IDS_LIST_COLUMN_FIRST 91
#define IDS_LIST_COLUMN_NAME 91
#define IDS_LIST_COLUMN_TYPE 92
#define IDS_LIST_COLUMN_DATA 93
#define IDS_LIST_COLUMN_LAST 93
#define IDD_ABOUTBOX 103 #define IDD_ABOUTBOX 103
#define IDS_APP_TITLE 103 #define IDS_APP_TITLE 103
#define IDM_ABOUT 104
#define IDM_EXIT 105
#define IDS_HELLO 106
#define IDI_REGEDIT 107 #define IDI_REGEDIT 107
#define IDI_SMALL 108 #define IDI_SMALL 108
#define IDC_REGEDIT 109 #define IDC_REGEDIT 109
@ -24,6 +27,7 @@
#define IDB_CLOSED_FILE 133 #define IDB_CLOSED_FILE 133
#define IDB_ROOT 134 #define IDB_ROOT 134
#define ID_REGISTRY_EXIT 32770
#define ID_HELP_HELPTOPICS 32771 #define ID_HELP_HELPTOPICS 32771
#define ID_FAVOURITES_ADDTOFAVOURITES 32772 #define ID_FAVOURITES_ADDTOFAVOURITES 32772
#define ID_FAVOURITES_REMOVEFAVOURITE 32773 #define ID_FAVOURITES_REMOVEFAVOURITE 32773
@ -45,7 +49,7 @@
#define ID_REGISTRY_CONNECTNETWORKREGISTRY 32791 #define ID_REGISTRY_CONNECTNETWORKREGISTRY 32791
#define ID_REGISTRY_DISCONNECTNETWORKREGISTRY 32792 #define ID_REGISTRY_DISCONNECTNETWORKREGISTRY 32792
#define ID_REGISTRY_PRINT 32793 #define ID_REGISTRY_PRINT 32793
#define ID_HELP_CONTENTS 32795 #define ID_HELP_ABOUT 32795
#define ID_WINDOW_CASCADE 32797 #define ID_WINDOW_CASCADE 32797
#define ID_WINDOW_TILE 32798 #define ID_WINDOW_TILE 32798
#define ID_WINDOW_ARRANGEICONS 32799 #define ID_WINDOW_ARRANGEICONS 32799

313
rosapps/regedit/treeview.c Normal file
View file

@ -0,0 +1,313 @@
/*
* ReactOS regedit
*
* treeview.c
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#endif
#include <windowsx.h>
#include <assert.h>
#define ASSERT assert
#include "main.h"
#include "treeview.h"
// Global Variables:
extern HINSTANCE hInst;
extern HWND hMainWnd;
// Global variables and constants
// Image_Open, Image_Closed, and Image_Root - integer variables for
// indexes of the images.
// CX_BITMAP and CY_BITMAP - width and height of an icon.
// NUM_BITMAPS - number of bitmaps to add to the image list.
int Image_Open;
int Image_Closed;
int Image_Root;
#define CX_BITMAP 16
#define CY_BITMAP 16
#define NUM_BITMAPS 3
// AddItemToTree - adds items to a tree view control.
// Returns the handle to the newly added item.
// hwndTV - handle to the tree view control.
// lpszItem - text of the item to add.
// nLevel - level at which to add the item.
HTREEITEM AddItemToTree(HWND hwndTV, LPTSTR lpszItem, int nLevel)
{
TVITEM tvi;
TVINSERTSTRUCT tvins;
static HTREEITEM hPrev = (HTREEITEM)TVI_FIRST;
static HTREEITEM hPrevRootItem = NULL;
static HTREEITEM hPrevLev2Item = NULL;
HTREEITEM hti;
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM;
// Set the text of the item.
tvi.pszText = lpszItem;
tvi.cchTextMax = lstrlen(lpszItem);
// Assume the item is not a parent item, so give it an image.
tvi.iImage = Image_Root;
tvi.iSelectedImage = Image_Root;
tvi.cChildren = 1;
// Save the heading level in the item's application-defined data area.
tvi.lParam = (LPARAM)nLevel;
tvins.item = tvi;
tvins.hInsertAfter = hPrev;
// Set the parent item based on the specified level.
if (nLevel == 1)
tvins.hParent = TVI_ROOT;
else if (nLevel == 2)
tvins.hParent = hPrevRootItem;
else
tvins.hParent = hPrevLev2Item;
// Add the item to the tree view control.
hPrev = (HTREEITEM)SendMessage(hwndTV, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvins);
// Save the handle to the item.
if (nLevel == 1)
hPrevRootItem = hPrev;
else if (nLevel == 2)
hPrevLev2Item = hPrev;
// The new item is a child item. Give the parent item a
// closed folder bitmap to indicate it now has child items.
if (nLevel > 1) {
hti = TreeView_GetParent(hwndTV, hPrev);
tvi.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvi.hItem = hti;
tvi.iImage = Image_Closed;
tvi.iSelectedImage = Image_Closed;
TreeView_SetItem(hwndTV, &tvi);
}
return hPrev;
}
static void init_output(HWND hWnd)
{
// TCHAR b[16];
// HFONT old_font;
HDC hdc = GetDC(hWnd);
// if (GetNumberFormat(LOCALE_USER_DEFAULT, 0, _T("1000"), 0, b, 16) > 4)
// Globals.num_sep = b[1];
// else
// Globals.num_sep = _T('.');
// old_font = SelectFont(hdc, Globals.hFont);
// GetTextExtentPoint32(hdc, _T(" "), 1, &Globals.spaceSize);
// SelectFont(hdc, old_font);
ReleaseDC(hWnd, hdc);
}
/*
HTREEITEM AddEntryToTree(HWND hwndTV, Entry* entry)
{
HTREEITEM hItem = 0;
return hItem;
}
*/
static BOOL InitTreeViewItems(HWND hwndTV)
{
HTREEITEM hItem;
hItem = AddItemToTree(hwndTV, "My Computer", 1);
AddItemToTree(hwndTV, "HKEY_CLASSES_ROOT", 2);
AddItemToTree(hwndTV, "HKEY_CURRENT_USER", 2);
AddItemToTree(hwndTV, "HKEY_LOCAL_MACHINE", 2);
AddItemToTree(hwndTV, "HKEY_USERS", 2);
AddItemToTree(hwndTV, "HKEY_CURRENT_CONFIG", 2);
TreeView_Expand(hwndTV, hItem, TVE_EXPAND);
return TRUE;
}
// InitTreeViewImageLists - creates an image list, adds three bitmaps
// to it, and associates the image list with a tree view control.
// Returns TRUE if successful, or FALSE otherwise.
// hwndTV - handle to the tree view control.
static BOOL InitTreeViewImageLists(HWND hwndTV)
{
HIMAGELIST himl; // handle to image list
HBITMAP hbmp; // handle to bitmap
// Create the image list.
if ((himl = ImageList_Create(CX_BITMAP, CY_BITMAP,
FALSE, NUM_BITMAPS, 0)) == NULL)
return FALSE;
// Add the open file, closed file, and document bitmaps.
hbmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_OPEN_FILE));
Image_Open = ImageList_Add(himl, hbmp, (HBITMAP) NULL);
DeleteObject(hbmp);
hbmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_CLOSED_FILE));
Image_Closed = ImageList_Add(himl, hbmp, (HBITMAP) NULL);
DeleteObject(hbmp);
hbmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_ROOT));
Image_Root = ImageList_Add(himl, hbmp, (HBITMAP) NULL);
DeleteObject(hbmp);
// Fail if not all of the images were added.
if (ImageList_GetImageCount(himl) < 3)
return FALSE;
// Associate the image list with the tree view control.
TreeView_SetImageList(hwndTV, himl, TVSIL_NORMAL);
return TRUE;
}
#ifndef _MSC_VER
#define NMTVDISPINFO TV_DISPINFO
#define NMTVDISPINFO TV_DISPINFO
#endif
static void OnGetDispInfo(NMTVDISPINFO* ptvdi)
{
/*
Entry* entry = (Entry*)ptvdi->item.lParam;
ASSERT(entry);
if (ptvdi->item.mask & TVIF_CHILDREN ) {
ptvdi->item.cChildren = 5;
}
if (ptvdi->item.mask & TVIF_IMAGE) {
ptvdi->item.iImage = Image_Root;
}
if (ptvdi->item.mask & TVIF_SELECTEDIMAGE) {
ptvdi->item.iSelectedImage = Image_Closed;
}
if (ptvdi->item.mask & TVIF_TEXT) {
ptvdi->item.pszText = entry->data.cFileName;
ptvdi->item.cchTextMax = lstrlen(entry->data.cFileName);
}
static BOOL OnExpand(int flag, HTREEITEM* pti)
{
TRACE(_T("TreeWndProc(...) OnExpand()\n"));
return TRUE;
}
static BOOL OnExpanding(HWND hWnd, NMTREEVIEW* pnmtv)
{
static int expanding;
if (expanding) return FALSE;
expanding = TRUE;
expanding = FALSE;
return TRUE;
}
*/
}
/*
static BOOL OnSelChanged(NMTREEVIEW* pnmtv)
{
LPARAM parm = pnmtv->itemNew.lParam;
ChildWnd* child = (ChildWnd*)pnmtv->itemNew.lParam;
return TRUE;
}
*/
////////////////////////////////////////////////////////////////////////////////
static WNDPROC g_orgTreeWndProc;
static LRESULT CALLBACK TreeWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
// ChildWnd* child = (ChildWnd*)GetWindowLong(GetParent(hWnd), GWL_USERDATA);
// Pane* pane = (Pane*)GetWindowLong(hWnd, GWL_USERDATA);
// ASSERT(child);
switch (message) {
default:
break;
}
return CallWindowProc(g_orgTreeWndProc, hWnd, message, wParam, lParam);
}
// CreateTreeView - creates a tree view control.
// Returns the handle to the new control if successful,
// or NULL otherwise.
// hwndParent - handle to the control's parent window.
HWND CreateTreeView(HWND hwndParent/*, Pane* pane*/, int id, LPTSTR lpszPathName)
{
RECT rcClient; // dimensions of client area
HWND hwndTV; // handle to tree view control
// static int s_init = 0;
// Entry* entry = pane->root;
// pane->treePane = 1;
// Get the dimensions of the parent window's client area, and create
// the tree view control.
GetClientRect(hwndParent, &rcClient);
hwndTV = CreateWindowEx(0, WC_TREEVIEW, _T("Tree View"),
WS_VISIBLE | WS_CHILD | WS_BORDER | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT,
0, 0, rcClient.right, rcClient.bottom,
hwndParent, (HMENU)id, hInst, NULL);
// Initialize the image list, and add items to the control.
if (!InitTreeViewImageLists(hwndTV) || !InitTreeViewItems(hwndTV)) {
DestroyWindow(hwndTV);
return NULL;
}
SetWindowLong(hwndTV, GWL_USERDATA, (LPARAM)0);
g_orgTreeWndProc = SubclassWindow(hwndTV, TreeWndProc);
//SendMessage(hwndTV, WM_SETFONT, (WPARAM)Globals.hFont, FALSE);
// insert entries into treectrl
// if (entry) {
// insert_tree_entries(hwndTV, entry, 0);
// }
// calculate column widths
// if (!s_init) {
// s_init = 1;
// init_output(hwndTV);
// }
return hwndTV;
}

View file

@ -0,0 +1,42 @@
/*
* ReactOS regedit
*
* treeview.h
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __TREEVIEW_H__
#define __TREEVIEW_H__
#ifdef __cplusplus
extern "C" {
#endif
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
HWND CreateTreeView(HWND hwndParent/*, Pane* pane*/, int id, LPTSTR lpszPathName);
#ifdef __cplusplus
};
#endif
#endif // __TREEVIEW_H__

View file

@ -37,6 +37,8 @@ OBJS = about.o \
draw.o \ draw.o \
entries.o \ entries.o \
run.o \ run.o \
shell.o \
network.o \
settings.o \ settings.o \
splitpath.o \ splitpath.o \
sort.o \ sort.o \

View file

@ -42,11 +42,12 @@
#include "main.h" #include "main.h"
#include "childwnd.h" #include "childwnd.h"
#include "framewnd.h" #include "framewnd.h"
#include "utils.h"
#include "treeview.h" #include "treeview.h"
#include "listview.h" #include "listview.h"
#include "debug.h" #include "dialogs.h"
#include "draw.h" #include "utils.h"
#include "run.h"
#include "trace.h"
#ifdef _NO_EXTENSIONS #ifdef _NO_EXTENSIONS
@ -60,13 +61,11 @@
// Global Variables: // Global Variables:
// //
HWND hSplitWnd; // Splitter Bar Control Window
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Local module support methods // Local module support methods
// //
/*
#ifndef _NO_EXTENSIONS #ifndef _NO_EXTENSIONS
void set_header(Pane* pane) void set_header(Pane* pane)
@ -148,7 +147,6 @@ static LRESULT pane_notify(Pane* pane, NMHDR* pnmh)
#endif #endif
static BOOL pane_command(Pane* pane, UINT cmd) static BOOL pane_command(Pane* pane, UINT cmd)
{ {
switch(cmd) { switch(cmd) {
@ -193,9 +191,11 @@ static BOOL pane_command(Pane* pane, UINT cmd)
} }
return TRUE; return TRUE;
} }
*/
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// //
//HWND hSplitWnd; // Splitter Bar Control Window
//
// hSplitWnd = CreateWindow(szFrameClass, "splitter window", WS_VISIBLE|WS_CHILD, // hSplitWnd = CreateWindow(szFrameClass, "splitter window", WS_VISIBLE|WS_CHILD,
// CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, // CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
// Globals.hMainWnd, (HMENU)SPLIT_WINDOW, hInstance, NULL); // Globals.hMainWnd, (HMENU)SPLIT_WINDOW, hInstance, NULL);
@ -298,6 +298,111 @@ static void OnSize(ChildWnd* pChildWnd, WPARAM wParam, LPARAM lParam)
} }
} }
void OnFileMove(HWND hWnd)
{
struct ExecuteDialog dlg = {{0}};
if (DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_DIALOG_FILE_MOVE), hWnd, MoveFileWndProc, (LPARAM)&dlg) == IDOK) {
}
}
////////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG)
//
// PURPOSE: Processes WM_COMMAND messages for the main frame window.
//
//
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
UINT cmd = LOWORD(wParam);
//HWND hChildWnd;
if (1) {
switch (cmd) {
/*
// case ID_FILE_MOVE:
// OnFileMove(hWnd);
// break;
case ID_FILE_COPY:
case ID_FILE_COPY_CLIPBOARD:
case ID_FILE_DELETE:
case ID_FILE_RENAME:
case ID_FILE_PROPERTIES:
case ID_FILE_COMPRESS:
case ID_FILE_UNCOMPRESS:
break;
// case ID_FILE_RUN:
// OnFileRun();
// break;
case ID_FILE_PRINT:
case ID_FILE_ASSOCIATE:
case ID_FILE_CREATE_DIRECTORY:
case ID_FILE_SEARCH:
case ID_FILE_SELECT_FILES:
break;
*/
case ID_FILE_EXIT:
SendMessage(hWnd, WM_CLOSE, 0, 0);
break;
/*
case ID_DISK_COPY_DISK:
break;
case ID_DISK_LABEL_DISK:
break;
case ID_DISK_CONNECT_NETWORK_DRIVE:
MapNetworkDrives(hWnd, TRUE);
break;
case ID_DISK_DISCONNECT_NETWORK_DRIVE:
MapNetworkDrives(hWnd, FALSE);
break;
case ID_DISK_SHARE_AS:
break;
case ID_DISK_STOP_SHARING:
break;
case ID_DISK_SELECT_DRIVE:
break;
*/
/*
case ID_TREE_EXPAND_ONE_LEVEL:
case ID_TREE_EXPAND_ALL:
case ID_TREE_EXPAND_BRANCH:
case ID_TREE_COLLAPSE_BRANCH:
MessageBeep(-1);
break;
*/
case ID_VIEW_BY_FILE_TYPE:
{
struct ExecuteDialog dlg = {{0}};
if (DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_DIALOG_VIEW_TYPE), hWnd, ViewFileTypeWndProc, (LPARAM)&dlg) == IDOK) {
}
}
break;
case ID_OPTIONS_CONFIRMATION:
{
struct ExecuteDialog dlg = {{0}};
if (DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_DIALOG_OPTIONS_CONFIRMATON), hWnd, OptionsConfirmationWndProc, (LPARAM)&dlg) == IDOK) {
}
}
break;
case ID_WINDOW_NEW_WINDOW:
CreateChildWindow(-1);
// {
// ChildWnd* pChildWnd = alloc_child_window(path);
// if (!create_child_window(pChildWnd))
// free(pChildWnd);
// }
break;
default:
// return DefMDIChildProc(hWnd, message, wParam, lParam);
return FALSE;
break;
}
}
return TRUE;
}
// //
// FUNCTION: ChildWndProc(HWND, unsigned, WORD, LONG) // FUNCTION: ChildWndProc(HWND, unsigned, WORD, LONG)
// //
@ -450,6 +555,37 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
SetFocus(pChildWnd->nFocusPanel? pChildWnd->right.hWnd: pChildWnd->left.hWnd); SetFocus(pChildWnd->nFocusPanel? pChildWnd->right.hWnd: pChildWnd->left.hWnd);
break; break;
case WM_DISPATCH_COMMAND:
if (_CmdWndProc(hWnd, message, wParam, lParam)) break;
if (1) {
return SendMessage(pChildWnd->right.hWnd, message, wParam, lParam);
} else {
return SendMessage(pChildWnd->left.hWnd, message, wParam, lParam);
}
break;
case WM_COMMAND:
/*
if (!SendMessage(pChildWnd->right.hWnd, message, wParam, lParam)) {
return DefMDIChildProc(hWnd, message, wParam, lParam);
} else {
return _CmdWndProc(hWnd, message, wParam, lParam);
// return DefMDIChildProc(hWnd, message, wParam, lParam);
}
break;
*/
if (_CmdWndProc(hWnd, message, wParam, lParam)) break;
return DefMDIChildProc(hWnd, message, wParam, lParam);
// if (LOWORD(wParam) > ID_CMD_FIRST && LOWORD(wParam) < ID_CMD_LAST) {
// if (!SendMessage(pChildWnd->right.hWnd, message, wParam, lParam)) {
// return DefMDIChildProc(hWnd, message, wParam, lParam);
// }
// } else {
// return _CmdWndProc(hWnd, message, wParam, lParam);
// }
break;
/*
case WM_COMMAND: case WM_COMMAND:
{ {
Pane* pane = GetFocus()==pChildWnd->left.hWnd? &pChildWnd->left: &pChildWnd->right; Pane* pane = GetFocus()==pChildWnd->left.hWnd? &pChildWnd->left: &pChildWnd->right;
@ -510,11 +646,11 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
} }
return TRUE;} return TRUE;}
*/
//#ifndef _NO_EXTENSIONS //#ifndef _NO_EXTENSIONS
case WM_NOTIFY: { case WM_NOTIFY: {
int idCtrl = (int)wParam; int idCtrl = (int)wParam;
NMHDR* pnmh = (NMHDR*)lParam; //NMHDR* pnmh = (NMHDR*)lParam;
//return pane_notify(pnmh->idFrom==IDW_HEADER_LEFT? &pChildWnd->left: &pChildWnd->right, pnmh); //return pane_notify(pnmh->idFrom==IDW_HEADER_LEFT? &pChildWnd->left: &pChildWnd->right, pnmh);
if (idCtrl == IDW_TREE_LEFT) { if (idCtrl == IDW_TREE_LEFT) {
if ((((LPNMHDR)lParam)->code) == TVN_SELCHANGED) { if ((((LPNMHDR)lParam)->code) == TVN_SELCHANGED) {
@ -525,10 +661,14 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
set_curdir(pChildWnd, entry); set_curdir(pChildWnd, entry);
} }
} }
SendMessage(pChildWnd->left.hWnd, message, wParam, lParam); if (!SendMessage(pChildWnd->left.hWnd, message, wParam, lParam)) {
return DefMDIChildProc(hWnd, message, wParam, lParam);
}
} }
if (idCtrl == IDW_TREE_RIGHT) { if (idCtrl == IDW_TREE_RIGHT) {
SendMessage(pChildWnd->right.hWnd, message, wParam, lParam); if (!SendMessage(pChildWnd->right.hWnd, message, wParam, lParam)) {
return DefMDIChildProc(hWnd, message, wParam, lParam);
}
} }
} }
//#endif //#endif

View file

@ -1,7 +1,7 @@
/* /*
* ReactOS Application Debug Routines * ReactOS Application Debug Routines
* *
* debug.cpp * debug.h
* *
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org> * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
* *
@ -34,4 +34,4 @@ extern "C" {
}; };
#endif #endif
#endif // __DEBUG_H__ #endif // __DEBUG_H__

View file

@ -169,6 +169,119 @@ BOOL CALLBACK ViewFileTypeWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM
return 0; return 0;
} }
////////////////////////////////////////////////////////////////////////////////
/*
TotalFileSize
[in] Specifies the total size of the file, in bytes.
TotalBytesTransferred
[in] Specifies the total number of bytes transferred from the source file to the destination file since the copy operation began.
StreamSize
[in] Specifies the total size of the current file stream, in bytes.
StreamBytesTransferred
[in] Specifies the total number of bytes in the current stream that have been transferred from the source file to the destination file since the copy operation began.
dwStreamNumber
[in] Handle to the current stream. The stream number is 1 the first time CopyProgressRoutine is called.
dwCallbackReason
[in] Specifies the reason that CopyProgressRoutine was called. This parameter can be one of the following values. Value Meaning
CALLBACK_CHUNK_FINISHED Another part of the data file was copied.
CALLBACK_STREAM_SWITCH Another stream was created and is about to be copied. This is the callback reason given when the callback routine is first invoked.
hSourceFile
[in] Handle to the source file.
hDestinationFile
[in] Handle to the destination file
lpData
[in] The argument passed to CopyProgressRoutine by the CopyFileEx or MoveFileWithProgress function.
Return Values
The CopyProgressRoutine function should return one of the following values.
Value Meaning
PROGRESS_CONTINUE Continue the copy operation.
PROGRESS_CANCEL Cancel the copy operation and delete the destination file.
PROGRESS_STOP Stop the copy operation. It can be restarted at a later time.
PROGRESS_QUIET Continue the copy operation, but stop invoking CopyProgressRoutine to report progress.
*/
DWORD CALLBACK CopyProgressRoutine(
LARGE_INTEGER TotalFileSize, // file size
LARGE_INTEGER TotalBytesTransferred, // bytes transferred
LARGE_INTEGER StreamSize, // bytes in stream
LARGE_INTEGER StreamBytesTransferred, // bytes transferred for stream
DWORD dwStreamNumber, // current stream
DWORD dwCallbackReason, // callback reason
HANDLE hSourceFile, // handle to source file
HANDLE hDestinationFile, // handle to destination file
LPVOID lpData // from CopyFileEx
)
{
return 0L;
}
BOOL CALLBACK MoveFileWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
static struct ExecuteDialog* dlg;
int id;
TCHAR buffer_from[1000];
TCHAR buffer_to[1000];
switch (message) {
case WM_INITDIALOG:
dlg = (struct ExecuteDialog*)lParam;
_tcscpy(buffer_from, _T("C:\\TEMP\\API_SPY\\TEMP\\foobar.txt"));
SetDlgItemText(hDlg, IDC_FILE_MOVE_FROM, buffer_from);
_tcscpy(buffer_to, _T("C:\\TEMP\\API_SPY\\TEMP\\foobar2.txt"));
SetDlgItemText(hDlg, IDC_FILE_MOVE_TO, buffer_to);
/*
Button_SetCheck(GetDlgItem(hDlg,IDC_VIEW_TYPE_DIRECTORIES), ViewType & VIEW_DIRECTORIES ? BST_CHECKED : BST_UNCHECKED);
*/
return 1;
case WM_COMMAND:
id = (int)wParam;
if (id == IDOK) {
LPVOID lpData = NULL; // parameter for callback
DWORD dwFlags = MOVEFILE_COPY_ALLOWED; // move options
GetDlgItemText(hDlg, IDC_FILE_MOVE_FROM, buffer_from, sizeof(buffer_from));
GetDlgItemText(hDlg, IDC_FILE_MOVE_TO, buffer_to, sizeof(buffer_to));
/*
BOOL MoveFileWithProgress(
LPCTSTR lpExistingFileName, // file name
LPCTSTR lpNewFileName, // new file name
LPPROGRESS_ROUTINE lpProgressRoutine, // callback function
LPVOID lpData, // parameter for callback
DWORD dwFlags // move options
);
DWORD FormatMessage(
DWORD dwFlags, // source and processing options
LPCVOID lpSource, // message source
DWORD dwMessageId, // message identifier
DWORD dwLanguageId, // language identifier
LPTSTR lpBuffer, // message buffer
DWORD nSize, // maximum size of message buffer
va_list *Arguments // array of message inserts
);
*/
// if (!MoveFileWithProgress(buffer_from, buffer_to, &CopyProgressRoutine, lpData, dwFlags)) {
if (!MoveFileEx(buffer_from, buffer_to, dwFlags)) {
DWORD err = GetLastError();
HLOCAL hMem;
if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, (LPTSTR)&hMem, 10, NULL)) {
MessageBox(hDlg, hMem, szTitle, MB_OK);
LocalFree(hMem);
} else {
MessageBox(hDlg, _T("Unknown Error"), szTitle, MB_OK);
}
}
EndDialog(hDlg, id);
} else if (id == IDCANCEL)
EndDialog(hDlg, id);
return 1;
}
return 0;
}
/* /*
extern TCHAR ViewTypeMaskStr[MAX_TYPE_MASK_LEN]; extern TCHAR ViewTypeMaskStr[MAX_TYPE_MASK_LEN];

View file

@ -42,6 +42,7 @@ struct ExecuteDialog {
BOOL CALLBACK ExecuteDialogWndProc(HWND, UINT, WPARAM, LPARAM); BOOL CALLBACK ExecuteDialogWndProc(HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK ViewFileTypeWndProc(HWND, UINT, WPARAM, LPARAM); BOOL CALLBACK ViewFileTypeWndProc(HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK OptionsConfirmationWndProc(HWND, UINT, WPARAM, LPARAM); BOOL CALLBACK OptionsConfirmationWndProc(HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK MoveFileWndProc(HWND, UINT, WPARAM, LPARAM);
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -35,483 +35,6 @@
#endif #endif
#include "main.h" #include "main.h"
#include "utils.h"
#include "draw.h" #include "draw.h"
#define COLOR_COMPRESSED RGB(0,0,255)
#define COLOR_SELECTION RGB(0,0,128)
static void format_date(const FILETIME* ft, TCHAR* buffer, int visible_cols)
{
SYSTEMTIME systime;
FILETIME lft;
int len = 0;
*buffer = _T('\0');
if (!ft->dwLowDateTime && !ft->dwHighDateTime)
return;
if (!FileTimeToLocalFileTime(ft, &lft))
{err: _tcscpy(buffer,_T("???")); return;}
if (!FileTimeToSystemTime(&lft, &systime))
goto err;
if (visible_cols & COL_DATE) {
len = GetDateFormat(LOCALE_USER_DEFAULT, 0, &systime, 0, buffer, BUFFER_LEN);
if (!len)
goto err;
}
if (visible_cols & COL_TIME) {
if (len)
buffer[len-1] = ' ';
buffer[len++] = ' ';
if (!GetTimeFormat(LOCALE_USER_DEFAULT, 0, &systime, 0, buffer+len, BUFFER_LEN-len))
buffer[len] = _T('\0');
}
}
static void calc_width(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCTSTR str)
{
RECT rt = {0};
DrawText(dis->hDC, (LPTSTR)str, -1, &rt, DT_CALCRECT|DT_SINGLELINE|DT_NOPREFIX);
if (rt.right > pane->widths[col])
pane->widths[col] = rt.right;
}
static void calc_tabbed_width(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCTSTR str)
{
RECT rt = {0};
/* DRAWTEXTPARAMS dtp = {sizeof(DRAWTEXTPARAMS), 2};
DrawTextEx(dis->hDC, (LPTSTR)str, -1, &rt, DT_CALCRECT|DT_SINGLELINE|DT_NOPREFIX|DT_EXPANDTABS|DT_TABSTOP, &dtp);*/
DrawText(dis->hDC, (LPTSTR)str, -1, &rt, DT_CALCRECT|DT_SINGLELINE|DT_EXPANDTABS|DT_TABSTOP|(2<<8));
//@@ rt (0,0) ???
if (rt.right > pane->widths[col])
pane->widths[col] = rt.right;
}
static void output_text(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCTSTR str, DWORD flags)
{
int x = dis->rcItem.left;
RECT rt = {x+pane->positions[col]+Globals.spaceSize.cx, dis->rcItem.top, x+pane->positions[col+1]-Globals.spaceSize.cx, dis->rcItem.bottom};
DrawText(dis->hDC, (LPTSTR)str, -1, &rt, DT_SINGLELINE|DT_NOPREFIX|flags);
}
static void output_tabbed_text(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCTSTR str)
{
int x = dis->rcItem.left;
RECT rt = {x+pane->positions[col]+Globals.spaceSize.cx, dis->rcItem.top, x+pane->positions[col+1]-Globals.spaceSize.cx, dis->rcItem.bottom};
/* DRAWTEXTPARAMS dtp = {sizeof(DRAWTEXTPARAMS), 2};
DrawTextEx(dis->hDC, (LPTSTR)str, -1, &rt, DT_SINGLELINE|DT_NOPREFIX|DT_EXPANDTABS|DT_TABSTOP, &dtp);*/
DrawText(dis->hDC, (LPTSTR)str, -1, &rt, DT_SINGLELINE|DT_EXPANDTABS|DT_TABSTOP|(2<<8));
}
static void output_number(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCTSTR str)
{
int x = dis->rcItem.left;
RECT rt = {x+pane->positions[col]+Globals.spaceSize.cx, dis->rcItem.top, x+pane->positions[col+1]-Globals.spaceSize.cx, dis->rcItem.bottom};
LPCTSTR s = str;
TCHAR b[128];
LPTSTR d = b;
int pos;
if (*s)
*d++ = *s++;
// insert number separator characters
pos = lstrlen(s) % 3;
while(*s)
if (pos--)
*d++ = *s++;
else {
*d++ = Globals.num_sep;
pos = 3;
}
DrawText(dis->hDC, b, d-b, &rt, DT_RIGHT|DT_SINGLELINE|DT_NOPREFIX|DT_END_ELLIPSIS);
}
void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWidthCol)
{
#if 0
TCHAR buffer[BUFFER_LEN];
DWORD attrs;
int visible_cols = pane->visible_cols;
COLORREF bkcolor, textcolor;
RECT focusRect = dis->rcItem;
HBRUSH hbrush;
enum IMAGE img;
#ifndef _NO_EXTENSIONS
QWORD index;
#endif
int img_pos, cx;
int col = 0;
if (entry) {
attrs = entry->data.dwFileAttributes;
if (attrs & FILE_ATTRIBUTE_DIRECTORY) {
if (entry->data.cFileName[0]==_T('.') && entry->data.cFileName[1]==_T('.')
&& entry->data.cFileName[2]==_T('\0'))
img = IMG_FOLDER_UP;
#ifndef _NO_EXTENSIONS
else if (entry->data.cFileName[0]==_T('.') && entry->data.cFileName[1]==_T('\0'))
img = IMG_FOLDER_CUR;
#endif
else if (
#ifdef _NO_EXTENSIONS
entry->expanded ||
#endif
(pane->treePane && (dis->itemState&ODS_FOCUS)))
img = IMG_OPEN_FOLDER;
else
img = IMG_FOLDER;
} else {
LPCTSTR ext = _tcsrchr(entry->data.cFileName, '.');
if (!ext)
ext = _T("");
if (is_exe_file(ext))
img = IMG_EXECUTABLE;
else if (is_registered_type(ext))
img = IMG_DOCUMENT;
else
img = IMG_FILE;
}
} else {
attrs = 0;
img = IMG_NONE;
}
if (pane->treePane) {
if (entry) {
img_pos = dis->rcItem.left + entry->level*(IMAGE_WIDTH+Globals.spaceSize.cx);
if (calcWidthCol == -1) {
int x;
int y = dis->rcItem.top + IMAGE_HEIGHT/2;
Entry* up;
RECT rt_clip = {dis->rcItem.left, dis->rcItem.top, dis->rcItem.left+pane->widths[col], dis->rcItem.bottom};
HRGN hrgn_org = CreateRectRgn(0, 0, 0, 0);
HRGN hrgn = CreateRectRgnIndirect(&rt_clip);
if (!GetClipRgn(dis->hDC, hrgn_org)) {
DeleteObject(hrgn_org);
hrgn_org = 0;
}
// HGDIOBJ holdPen = SelectObject(dis->hDC, GetStockObject(BLACK_PEN));
ExtSelectClipRgn(dis->hDC, hrgn, RGN_AND);
DeleteObject(hrgn);
if ((up=entry->up) != NULL) {
MoveToEx(dis->hDC, img_pos-IMAGE_WIDTH/2, y, 0);
LineTo(dis->hDC, img_pos-2, y);
x = img_pos - IMAGE_WIDTH/2;
do {
x -= IMAGE_WIDTH+Globals.spaceSize.cx;
if (up->next
#ifndef _LEFT_FILES
&& (up->next->data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
#endif
) {
MoveToEx(dis->hDC, x, dis->rcItem.top, 0);
LineTo(dis->hDC, x, dis->rcItem.bottom);
}
} while((up=up->up) != NULL);
}
x = img_pos - IMAGE_WIDTH/2;
MoveToEx(dis->hDC, x, dis->rcItem.top, 0);
LineTo(dis->hDC, x, y);
if (entry->next
#ifndef _LEFT_FILES
&& (entry->next->data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
#endif
)
LineTo(dis->hDC, x, dis->rcItem.bottom);
if (entry->down && entry->expanded) {
x += IMAGE_WIDTH+Globals.spaceSize.cx;
MoveToEx(dis->hDC, x, dis->rcItem.top+IMAGE_HEIGHT, 0);
LineTo(dis->hDC, x, dis->rcItem.bottom);
}
SelectClipRgn(dis->hDC, hrgn_org);
if (hrgn_org) DeleteObject(hrgn_org);
// SelectObject(dis->hDC, holdPen);
} else if (calcWidthCol==col || calcWidthCol==COLUMNS) {
int right = img_pos + IMAGE_WIDTH - Globals.spaceSize.cx;
if (right > pane->widths[col])
pane->widths[col] = right;
}
} else {
img_pos = dis->rcItem.left;
}
} else {
img_pos = dis->rcItem.left;
if (calcWidthCol==col || calcWidthCol==COLUMNS)
pane->widths[col] = IMAGE_WIDTH;
}
if (calcWidthCol == -1) {
focusRect.left = img_pos -2;
#ifdef _NO_EXTENSIONS
if (pane->treePane && entry) {
RECT rt = {0};
DrawText(dis->hDC, entry->data.cFileName, -1, &rt, DT_CALCRECT|DT_SINGLELINE|DT_NOPREFIX);
focusRect.right = dis->rcItem.left+pane->positions[col+1]+Globals.spaceSize.cx + rt.right +2;
}
#else
if (attrs & FILE_ATTRIBUTE_COMPRESSED)
textcolor = COLOR_COMPRESSED;
else
#endif
textcolor = RGB(0,0,0);
if (dis->itemState & ODS_FOCUS) {
textcolor = RGB(255,255,255);
bkcolor = COLOR_SELECTION;
} else {
bkcolor = RGB(255,255,255);
}
hbrush = CreateSolidBrush(bkcolor);
FillRect(dis->hDC, &focusRect, hbrush);
DeleteObject(hbrush);
SetBkMode(dis->hDC, TRANSPARENT);
SetTextColor(dis->hDC, textcolor);
cx = pane->widths[col];
if (cx && img!=IMG_NONE) {
if (cx > IMAGE_WIDTH)
cx = IMAGE_WIDTH;
ImageList_DrawEx(Globals.himl, img, dis->hDC,
img_pos, dis->rcItem.top, cx,
IMAGE_HEIGHT, bkcolor, CLR_DEFAULT, ILD_NORMAL);
}
}
if (!entry)
return;
#ifdef _NO_EXTENSIONS
if (img >= IMG_FOLDER_UP)
return;
#endif
col++;
// ouput file name
if (calcWidthCol == -1)
output_text(pane, dis, col, entry->data.cFileName, 0);
else if (calcWidthCol==col || calcWidthCol==COLUMNS)
calc_width(pane, dis, col, entry->data.cFileName);
col++;
#ifdef _NO_EXTENSIONS
if (!pane->treePane) {
#endif
// display file size
if (visible_cols & COL_SIZE) {
#ifdef _NO_EXTENSIONS
if (!(attrs&FILE_ATTRIBUTE_DIRECTORY))
#endif
{
QWORD size;
*(DWORD*)(&size) = entry->data.nFileSizeLow; //TODO: platform spefific
*(((DWORD*)&size)+1) = entry->data.nFileSizeHigh;
_stprintf(buffer, _T("%") LONGLONGARG _T("d"), size);
if (calcWidthCol == -1)
output_number(pane, dis, col, buffer);
else if (calcWidthCol==col || calcWidthCol==COLUMNS)
calc_width(pane, dis, col, buffer);//TODO: not ever time enough
}
col++;
}
// display file date
if (visible_cols & (COL_DATE|COL_TIME)) {
#ifndef _NO_EXTENSIONS
format_date(&entry->data.ftCreationTime, buffer, visible_cols);
if (calcWidthCol == -1)
output_text(pane, dis, col, buffer, 0);
else if (calcWidthCol==col || calcWidthCol==COLUMNS)
calc_width(pane, dis, col, buffer);
col++;
format_date(&entry->data.ftLastAccessTime, buffer, visible_cols);
if (calcWidthCol == -1)
output_text(pane, dis, col, buffer, 0);
else if (calcWidthCol==col || calcWidthCol==COLUMNS)
calc_width(pane, dis, col, buffer);
col++;
#endif
format_date(&entry->data.ftLastWriteTime, buffer, visible_cols);
if (calcWidthCol == -1)
output_text(pane, dis, col, buffer, 0);
else if (calcWidthCol==col || calcWidthCol==COLUMNS)
calc_width(pane, dis, col, buffer);
col++;
}
#ifndef _NO_EXTENSIONS
if (entry->bhfi_valid) {
((DWORD*)&index)[0] = entry->bhfi.nFileIndexLow; //TODO: platform spefific
((DWORD*)&index)[1] = entry->bhfi.nFileIndexHigh;
if (visible_cols & COL_INDEX) {
_stprintf(buffer, _T("%") LONGLONGARG _T("X"), index);
if (calcWidthCol == -1)
output_text(pane, dis, col, buffer, DT_RIGHT);
else if (calcWidthCol==col || calcWidthCol==COLUMNS)
calc_width(pane, dis, col, buffer);
col++;
}
if (visible_cols & COL_LINKS) {
wsprintf(buffer, _T("%d"), entry->bhfi.nNumberOfLinks);
if (calcWidthCol == -1)
output_text(pane, dis, col, buffer, DT_CENTER);
else if (calcWidthCol==col || calcWidthCol==COLUMNS)
calc_width(pane, dis, col, buffer);
col++;
}
} else
col += 2;
#endif
// show file attributes
if (visible_cols & COL_ATTRIBUTES) {
#ifdef _NO_EXTENSIONS
_tcscpy(buffer, _T(" \t \t \t \t "));
#else
_tcscpy(buffer, _T(" \t \t \t \t \t \t \t \t \t \t \t "));
#endif
if (attrs & FILE_ATTRIBUTE_NORMAL) buffer[ 0] = 'N';
else {
if (attrs & FILE_ATTRIBUTE_READONLY) buffer[ 2] = 'R';
if (attrs & FILE_ATTRIBUTE_HIDDEN) buffer[ 4] = 'H';
if (attrs & FILE_ATTRIBUTE_SYSTEM) buffer[ 6] = 'S';
if (attrs & FILE_ATTRIBUTE_ARCHIVE) buffer[ 8] = 'A';
if (attrs & FILE_ATTRIBUTE_COMPRESSED) buffer[10] = 'C';
#ifndef _NO_EXTENSIONS
if (attrs & FILE_ATTRIBUTE_DIRECTORY) buffer[12] = 'D';
if (attrs & FILE_ATTRIBUTE_ENCRYPTED) buffer[14] = 'E';
if (attrs & FILE_ATTRIBUTE_TEMPORARY) buffer[16] = 'T';
if (attrs & FILE_ATTRIBUTE_SPARSE_FILE) buffer[18] = 'P';
if (attrs & FILE_ATTRIBUTE_REPARSE_POINT) buffer[20] = 'Q';
if (attrs & FILE_ATTRIBUTE_OFFLINE) buffer[22] = 'O';
if (attrs & FILE_ATTRIBUTE_NOT_CONTENT_INDEXED) buffer[24] = 'X';
#endif
}
if (calcWidthCol == -1)
output_tabbed_text(pane, dis, col, buffer);
else if (calcWidthCol==col || calcWidthCol==COLUMNS)
calc_tabbed_width(pane, dis, col, buffer);
col++;
}
/*TODO
if (flags.security) {
DWORD rights = get_access_mask();
tcscpy(buffer, _T(" \t \t \t \t \t \t \t \t \t \t \t "));
if (rights & FILE_READ_DATA) buffer[ 0] = 'R';
if (rights & FILE_WRITE_DATA) buffer[ 2] = 'W';
if (rights & FILE_APPEND_DATA) buffer[ 4] = 'A';
if (rights & FILE_READ_EA) {buffer[6] = 'entry'; buffer[ 7] = 'R';}
if (rights & FILE_WRITE_EA) {buffer[9] = 'entry'; buffer[10] = 'W';}
if (rights & FILE_EXECUTE) buffer[12] = 'X';
if (rights & FILE_DELETE_CHILD) buffer[14] = 'D';
if (rights & FILE_READ_ATTRIBUTES) {buffer[16] = 'a'; buffer[17] = 'R';}
if (rights & FILE_WRITE_ATTRIBUTES) {buffer[19] = 'a'; buffer[20] = 'W';}
if (rights & WRITE_DAC) buffer[22] = 'C';
if (rights & WRITE_OWNER) buffer[24] = 'O';
if (rights & SYNCHRONIZE) buffer[26] = 'S';
output_text(dis, col++, buffer, DT_LEFT, 3, psize);
}
if (flags.description) {
get_description(buffer);
output_text(dis, col++, buffer, 0, psize);
}
*/
#ifdef _NO_EXTENSIONS
}
// draw focus frame
if ((dis->itemState&ODS_FOCUS) && calcWidthCol==-1) {
// Currently [04/2000] Wine neither behaves exactly the same
// way as WIN 95 nor like Windows NT...
#ifdef WINELIB
DrawFocusRect(dis->hDC, &focusRect);
#else
HGDIOBJ lastBrush;
HPEN lastPen;
HPEN hpen;
if (!(GetVersion() & 0x80000000)) { // Windows NT?
LOGBRUSH lb = {PS_SOLID, RGB(255,255,255)};
hpen = ExtCreatePen(PS_COSMETIC|PS_ALTERNATE, 1, &lb, 0, 0);
} else
hpen = CreatePen(PS_DOT, 0, RGB(255,255,255));
lastPen = SelectPen(dis->hDC, hpen);
lastBrush = SelectObject(dis->hDC, GetStockObject(HOLLOW_BRUSH));
SetROP2(dis->hDC, R2_XORPEN);
Rectangle(dis->hDC, focusRect.left, focusRect.top, focusRect.right, focusRect.bottom);
SelectObject(dis->hDC, lastBrush);
SelectObject(dis->hDC, lastPen);
DeleteObject(hpen);
#endif
}
#endif
#endif
}

View file

@ -28,7 +28,6 @@ extern "C" {
#endif #endif
void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWidthCol);
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -44,8 +44,8 @@
#include "framewnd.h" #include "framewnd.h"
#include "childwnd.h" #include "childwnd.h"
#include "utils.h" #include "utils.h"
#include "run.h" #include "shell.h"
#include "format.h" #include "network.h"
#include "dialogs.h" #include "dialogs.h"
@ -76,7 +76,8 @@ static void resize_frame_rect(HWND hWnd, PRECT prect)
if (IsWindowVisible(Globals.hDriveBar)) { if (IsWindowVisible(Globals.hDriveBar)) {
SendMessage(Globals.hDriveBar, WM_SIZE, 0, 0); SendMessage(Globals.hDriveBar, WM_SIZE, 0, 0);
GetClientRect(Globals.hDriveBar, &rt); GetClientRect(Globals.hDriveBar, &rt);
new_top = --prect->top + rt.bottom+3; // new_top = --prect->top + rt.bottom+3;
new_top = --prect->top + rt.bottom+1;
MoveWindow(Globals.hDriveBar, 0, prect->top, rt.right, new_top, TRUE); MoveWindow(Globals.hDriveBar, 0, prect->top, rt.right, new_top, TRUE);
prect->top = new_top; prect->top = new_top;
prect->bottom -= rt.bottom+2; prect->bottom -= rt.bottom+2;
@ -226,19 +227,22 @@ HWND CreateChildWindow(int drv_id)
if (pChildWnd != NULL) { if (pChildWnd != NULL) {
MDICREATESTRUCT mcs = { MDICREATESTRUCT mcs = {
szChildClass, path, hInst, szChildClass, path, hInst,
CW_USEDEFAULT, CW_USEDEFAULT, // CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, // CW_USEDEFAULT, CW_USEDEFAULT,
0/*style*/, 0/*lParam*/ 20, 20, 200, 200,
WS_MAXIMIZE, 0
// 0/*style*/, 0/*lParam*/
}; };
hcbthook = SetWindowsHookEx(WH_CBT, CBTProc, 0, GetCurrentThreadId()); hcbthook = SetWindowsHookEx(WH_CBT, CBTProc, 0, GetCurrentThreadId());
newchild = pChildWnd; newchild = pChildWnd;
pChildWnd->hWnd = (HWND)SendMessage(Globals.hMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs); pChildWnd->hWnd = (HWND)SendMessage(Globals.hMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs);
UnhookWindowsHookEx(hcbthook); UnhookWindowsHookEx(hcbthook);
if (pChildWnd->hWnd == NULL) { if (pChildWnd->hWnd != NULL) {
return pChildWnd->hWnd;
} else {
free(pChildWnd); free(pChildWnd);
newchild = pChildWnd = NULL; newchild = pChildWnd = NULL;
} }
return pChildWnd->hWnd;
} }
return 0; return 0;
} }
@ -286,11 +290,29 @@ void OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
{ {
TCHAR str[100]; TCHAR str[100];
strcpy(str, TEXT("")); if (hSysMenu == NULL) return;
_tcscpy(str, _T(""));
if (nFlags & MF_POPUP) { if (nFlags & MF_POPUP) {
if (hSysMenu != GetMenu(hWnd)) { switch (nItemID) {
if (nItemID == 2) nItemID = 5; case ID_FILE_MENU:
//EnableMenuItem(hSysMenu, uIDEnableItem, MF_BYCOMMAND|MF_ENABLED);
break;
case ID_DISK_MENU:
// EnableMenuItem(hSysMenu, ID_DISK_COPY_DISK, MF_BYCOMMAND|MF_GRAYED);
EnableMenuItem(hSysMenu, ID_DISK_COPY_DISK, MF_BYCOMMAND|MF_ENABLED);
break;
case ID_TREE_MENU:
case ID_VIEW_MENU:
case ID_OPTIONS_MENU:
case ID_SECURITY_MENU:
case ID_WINDOW_MENU:
case ID_HELP_MENU:
break;
} }
// if (hSysMenu != GetMenu(hWnd)) {
// if (nItemID == 2) nItemID = 5;
// }
} }
if (LoadString(Globals.hInstance, nItemID, str, 100)) { if (LoadString(Globals.hInstance, nItemID, str, 100)) {
// load appropriate string // load appropriate string
@ -344,67 +366,6 @@ static void toggle_child(HWND hWnd, UINT cmd, HWND hchild)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
LRESULT CALLBACK EnumNetConnectionsProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
return 0;
}
/*
DWORD WNetOpenEnum(
DWORD dwScope, // scope of enumeration
DWORD dwType, // resource types to list
DWORD dwUsage, // resource usage to list
LPNETRESOURCE lpNetResource, // resource structure
LPHANDLE lphEnum // enumeration handle buffer
);
result = WNetOpenEnum(RESOURCE_CONNECTED, RESOURCETYPE_DISK, RESOURCEUSAGE_ALL, NULL, &EnumNetConnectionsProc);
*/
DWORD MapNetworkDrives(HWND hWnd, BOOL connect)
{
DWORD result = 0L;
#if 1
if (connect) {
WNetConnectionDialog(hWnd, RESOURCETYPE_DISK);
} else {
WNetDisconnectDialog(hWnd, RESOURCETYPE_DISK);
}
#else
if (connect) {
NETRESOURCE netResouce;
CONNECTDLGSTRUCT connectDlg;
//netResouce.dwScope;
//netResouce.dwType;
netResouce.dwDisplayType = 0;
//netResouce.dwUsage;
//netResouce.lpLocalName;
//netResouce.lpRemoteName;
//netResouce.lpComment;
//netResouce.lpProvider;
//connectDlg.cbStructure;
connectDlg.hwndOwner = hWnd;
connectDlg.lpConnRes = &netResouce;
//connectDlg.dwFlags;
//connectDlg.dwDevNum;
result = WNetConnectionDialog1(&connectDlg);
} else {
DISCDLGSTRUCT disconnectDlg;
//disconnectDlg.cbStructure;
disconnectDlg.hwndOwner = hWnd;
//disconnectDlg.lpLocalName;
//disconnectDlg.lpRemoteName;
//disconnectDlg.dwFlags;
result = WNetDisconnectDialog1(&disconnectDlg);
}
#endif
return result;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// //
// FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG) // FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG)
@ -413,7 +374,7 @@ DWORD MapNetworkDrives(HWND hWnd, BOOL connect)
// //
// //
LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
UINT cmd = LOWORD(wParam); UINT cmd = LOWORD(wParam);
HWND hChildWnd; HWND hChildWnd;
@ -431,12 +392,13 @@ LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
for (i = cmd - ID_DRIVE_FIRST; i--; root++) for (i = cmd - ID_DRIVE_FIRST; i--; root++)
while (*root) while (*root)
root++; root++;
if (activate_drive_window(root)) if (activate_drive_window(root)) {
return 0; return TRUE;
}
_tsplitpath(root, drv, 0, 0, 0); _tsplitpath(root, drv, 0, 0, 0);
if (!SetCurrentDirectory(drv)) { if (!SetCurrentDirectory(drv)) {
display_error(hWnd, GetLastError()); display_error(hWnd, GetLastError());
return 0; return TRUE;
} }
//GetCurrentDirectory(MAX_PATH, path); //@@ letztes Verzeichnis pro Laufwerk speichern //GetCurrentDirectory(MAX_PATH, path); //@@ letztes Verzeichnis pro Laufwerk speichern
//CreateChildWindow(path); //CreateChildWindow(path);
@ -455,17 +417,16 @@ LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
if (!SendMessage(hChildWnd, WM_QUERYENDSESSION, 0, 0)) if (!SendMessage(hChildWnd, WM_QUERYENDSESSION, 0, 0))
SendMessage(Globals.hMDIClient, WM_MDIDESTROY, (WPARAM)hChildWnd, 0); SendMessage(Globals.hMDIClient, WM_MDIDESTROY, (WPARAM)hChildWnd, 0);
break; break;
case ID_FILE_EXIT:
SendMessage(hWnd, WM_CLOSE, 0, 0);
break;
case ID_FILE_RUN:
OnFileRun();
break;
case ID_DISK_COPY_DISK: case ID_DISK_COPY_DISK:
CopyDisk(hWnd);
break; break;
case ID_DISK_LABEL_DISK: case ID_DISK_LABEL_DISK:
LabelDisk(hWnd);
break; break;
case ID_DISK_FORMAT_DISK: case ID_DISK_FORMAT_DISK:
FormatDisk(hWnd);
#if 0
// SHFormatDrive(hWnd, 0 /* A: */, SHFMT_ID_DEFAULT, 0); // SHFormatDrive(hWnd, 0 /* A: */, SHFMT_ID_DEFAULT, 0);
{ {
UINT OldMode = SetErrorMode(0); // Get the current Error Mode settings. UINT OldMode = SetErrorMode(0); // Get the current Error Mode settings.
@ -474,6 +435,7 @@ LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
SHFormatDrive(hWnd, 0 /* A: */, SHFMT_ID_DEFAULT, 0); SHFormatDrive(hWnd, 0 /* A: */, SHFMT_ID_DEFAULT, 0);
SetErrorMode(OldMode); // Put it back the way it was. SetErrorMode(OldMode); // Put it back the way it was.
} }
#endif
break; break;
case ID_DISK_CONNECT_NETWORK_DRIVE: case ID_DISK_CONNECT_NETWORK_DRIVE:
MapNetworkDrives(hWnd, TRUE); MapNetworkDrives(hWnd, TRUE);
@ -482,13 +444,14 @@ LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
MapNetworkDrives(hWnd, FALSE); MapNetworkDrives(hWnd, FALSE);
break; break;
case ID_DISK_SHARE_AS: case ID_DISK_SHARE_AS:
ModifySharing(hWnd, TRUE);
break; break;
case ID_DISK_STOP_SHARING: case ID_DISK_STOP_SHARING:
ModifySharing(hWnd, FALSE);
break; break;
case ID_DISK_SELECT_DRIVE: case ID_DISK_SELECT_DRIVE:
break; break;
case ID_VIEW_BY_FILE_TYPE: case ID_VIEW_BY_FILE_TYPE:
{ {
struct ExecuteDialog dlg = {{0}}; struct ExecuteDialog dlg = {{0}};
@ -506,6 +469,7 @@ LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case ID_OPTIONS_FONT: case ID_OPTIONS_FONT:
break; break;
case ID_OPTIONS_CUSTOMISE_TOOLBAR: case ID_OPTIONS_CUSTOMISE_TOOLBAR:
SendMessage(Globals.hToolBar, TB_CUSTOMIZE, 0, 0);
break; break;
case ID_OPTIONS_TOOLBAR: case ID_OPTIONS_TOOLBAR:
toggle_child(hWnd, cmd, Globals.hToolBar); toggle_child(hWnd, cmd, Globals.hToolBar);
@ -517,19 +481,34 @@ LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
toggle_child(hWnd, cmd, Globals.hStatusBar); toggle_child(hWnd, cmd, Globals.hStatusBar);
break; break;
case ID_OPTIONS_OPEN_NEW_WINDOW_ON_CONNECT: case ID_OPTIONS_OPEN_NEW_WINDOW_ON_CONNECT:
if (Globals.Options & OPTIONS_OPEN_NEW_WINDOW_ON_CONNECT) {
Globals.Options &= ~OPTIONS_OPEN_NEW_WINDOW_ON_CONNECT;
CheckMenuItem(Globals.hMenuOptions, cmd, MF_CHECKED);
} else {
Globals.Options |= OPTIONS_OPEN_NEW_WINDOW_ON_CONNECT;
CheckMenuItem(Globals.hMenuOptions, cmd, MF_BYCOMMAND | MF_CHECKED);
}
break; break;
case ID_OPTIONS_MINIMISE_ON_USE: case ID_OPTIONS_MINIMISE_ON_USE:
if (Globals.Options & ID_OPTIONS_MINIMISE_ON_USE) {
Globals.Options &= ~ID_OPTIONS_MINIMISE_ON_USE;
CheckMenuItem(Globals.hMenuOptions, cmd, MF_CHECKED);
} else {
Globals.Options |= ID_OPTIONS_MINIMISE_ON_USE;
CheckMenuItem(Globals.hMenuOptions, cmd, MF_BYCOMMAND | MF_CHECKED);
}
break; break;
case ID_OPTIONS_SAVE_ON_EXIT: case ID_OPTIONS_SAVE_ON_EXIT:
if (Globals.Options & OPTIONS_SAVE_ON_EXIT) {
Globals.Options &= ~OPTIONS_SAVE_ON_EXIT;
CheckMenuItem(Globals.hMenuOptions, cmd, MF_CHECKED);
} else {
Globals.Options |= OPTIONS_SAVE_ON_EXIT;
CheckMenuItem(Globals.hMenuOptions, cmd, MF_BYCOMMAND | MF_CHECKED);
}
break; break;
case ID_WINDOW_NEW_WINDOW: case ID_WINDOW_NEW_WINDOW:
CreateChildWindow(-1); CreateChildWindow(-1);
// {
// ChildWnd* pChildWnd = alloc_child_window(path);
// if (!create_child_window(pChildWnd))
// free(pChildWnd);
// }
break; break;
case ID_WINDOW_CASCADE: case ID_WINDOW_CASCADE:
SendMessage(Globals.hMDIClient, WM_MDICASCADE, 0, 0); SendMessage(Globals.hMDIClient, WM_MDICASCADE, 0, 0);
@ -543,18 +522,24 @@ LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case ID_WINDOW_ARRANGE_ICONS: case ID_WINDOW_ARRANGE_ICONS:
SendMessage(Globals.hMDIClient, WM_MDIICONARRANGE, 0, 0); SendMessage(Globals.hMDIClient, WM_MDIICONARRANGE, 0, 0);
break; break;
case ID_WINDOW_REFRESH:
// TODO:
break;
case ID_HELP_CONTENTS: case ID_HELP_CONTENTS:
WinHelp(hWnd, _T("winfile"), HELP_INDEX, 0); WinHelp(hWnd, _T("winfile"), HELP_CONTENTS, 0);
break; break;
case ID_HELP_SEARCH_HELP: case ID_HELP_SEARCH_HELP:
WinHelp(hWnd, _T("winfile"), HELP_FINDER, 0);
break; break;
case ID_HELP_HOW_TO_USE_HELP: case ID_HELP_HOW_TO_USE_HELP:
#ifdef WINSHELLAPI WinHelp(hWnd, _T("winfile"), HELP_HELPONHELP, 0);
ShellAbout(hWnd, szTitle, "", LoadIcon(Globals.hInstance, (LPCTSTR)IDI_WINFILE));
#endif
break; break;
case ID_HELP_ABOUT: case ID_HELP_ABOUT:
#ifdef WINSHELLAPI
ShellAbout(hWnd, szTitle, "", LoadIcon(Globals.hInstance, (LPCTSTR)IDI_WINFILE));
#else
ShowAboutBox(hWnd); ShowAboutBox(hWnd);
#endif
break; break;
default: default:
/* /*
@ -564,17 +549,151 @@ LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
} }
return DefFrameProc(hWnd, Globals.hMDIClient, message, wParam, lParam); return DefFrameProc(hWnd, Globals.hMDIClient, message, wParam, lParam);
*/ */
/*
hChildWnd = (HWND)SendMessage(Globals.hMDIClient, WM_MDIGETACTIVE, 0, 0); hChildWnd = (HWND)SendMessage(Globals.hMDIClient, WM_MDIGETACTIVE, 0, 0);
if (IsWindow(hChildWnd)) if (IsWindow(hChildWnd))
SendMessage(hChildWnd, WM_COMMAND, wParam, lParam); SendMessage(hChildWnd, WM_COMMAND, wParam, lParam);
else else
return DefFrameProc(hWnd, Globals.hMDIClient, message, wParam, lParam); return DefFrameProc(hWnd, Globals.hMDIClient, message, wParam, lParam);
*/
return FALSE;
} }
} }
return 0; return TRUE;
} }
static TBBUTTON tbButtonNew[] = {
{0, ID_WINDOW_CASCADE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{0, ID_WINDOW_CASCADE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{0, ID_WINDOW_CASCADE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{0, ID_WINDOW_CASCADE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{0, ID_WINDOW_CASCADE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
};
LRESULT MsgNotify(HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
{
LPNMHDR lpnmhdr;
//LPNMHDR lpnmhdr;
static int nResetCount;
static LPTBBUTTON lpSaveButtons;
//LPARAM lParam;
lpnmhdr = (LPNMHDR)lparam;
/*
// The following code allows the toolbar to be customized.
// If you return FALSE the Customize Toolbar dialog flashes
// and goes away.
if (lpnmhdr->code == TBN_QUERYINSERT || lpnmhdr->code == TBN_QUERYDELETE) {
return TRUE;
}
if (lpnmhdr->code == TBN_GETBUTTONINFO) {
LPTBNOTIFY lpTbNotify = (LPTBNOTIFY)lparam;
char szBuffer[20];
// int tbButtonNew[20] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 };
TBBUTTON tbButtonNew[] = {
{0, ID_WINDOW_CASCADE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{0, ID_WINDOW_CASCADE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{0, ID_WINDOW_CASCADE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{0, ID_WINDOW_CASCADE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{0, ID_WINDOW_CASCADE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
};
// 20 = total number of buttons.
// tbButton and tbButtonNew send information about
// the other 12 buttons in tbButtonNew.
if (lpTbNotify->iItem < 5) {
lpTbNotify->tbButton = tbButtonNew[lpTbNotify->iItem];
// LoadString(hInst, 4000+lpTbNotify->iItem, szBuffer, sizeof(szBuffer));
LoadString(hInst, lpTbNotify->iItem, szBuffer, sizeof(szBuffer));
lstrcpy (lpTbNotify->pszText, szBuffer);
lpTbNotify->cchText = sizeof (szBuffer);
return TRUE;
} else {
return 0;
}
}
*/
switch (lpnmhdr->code) {
case TBN_QUERYINSERT:
case TBN_QUERYDELETE:
return TRUE;
case TBN_GETBUTTONINFO:
{
LPTBNOTIFY lpTbNotify = (LPTBNOTIFY)lparam;
char szBuffer[20];
/*
typedef struct _TBBUTTON {
int iBitmap;
int idCommand;
BYTE fsState;
BYTE fsStyle;
DWORD dwData;
INT_PTR iString;
} TBBUTTON, NEAR* PTBBUTTON, FAR* LPTBBUTTON;
*/
// 20 = total number of buttons.
// tbButton and tbButtonNew send information about
// the other 12 buttons in tbButtonNew.
if (lpTbNotify->iItem < 12) {
lpTbNotify->tbButton = tbButtonNew[lpTbNotify->iItem];
LoadString(hInst, lpTbNotify->iItem + 32769, szBuffer, sizeof(szBuffer));
lstrcpy (lpTbNotify->pszText, szBuffer);
lpTbNotify->cchText = sizeof (szBuffer);
return TRUE;
} else {
return 0;
}
}
break;
case TBN_BEGINADJUST: // Start customizing the toolbar.
{
LPTBNOTIFY lpTB = (LPTBNOTIFY)lparam;
int i;
// Allocate memory to store the button information.
nResetCount = SendMessage(lpTB->hdr.hwndFrom, TB_BUTTONCOUNT, 0, 0);
lpSaveButtons = (LPTBBUTTON)GlobalAlloc(GPTR, sizeof(TBBUTTON) * nResetCount);
// Save the current configuration so if the user presses
// reset, the original toolbar can be restored.
for (i = 0; i < nResetCount; i++) {
SendMessage(lpTB->hdr.hwndFrom, TB_GETBUTTON, i, (LPARAM)(lpSaveButtons + i));
}
}
return TRUE;
case TBN_RESET:
{
LPTBNOTIFY lpTB = (LPTBNOTIFY)lparam;
int nCount, i;
// Remove all of the existing buttons starting with the last and working down.
nCount = SendMessage(lpTB->hdr.hwndFrom, TB_BUTTONCOUNT, 0, 0);
for (i = nCount - 1; i >= 0; i--) {
SendMessage(lpTB->hdr.hwndFrom, TB_DELETEBUTTON, i, 0);
}
// Restore the buttons that were saved.
SendMessage(lpTB->hdr.hwndFrom, TB_ADDBUTTONS, (WPARAM)nResetCount, (LPARAM)lpSaveButtons);
}
return TRUE;
case TBN_ENDADJUST:
// Free the memory allocated during TBN_BEGINADJUST
GlobalFree((HGLOBAL)lpSaveButtons);
return TRUE;
}
return 0;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// //
// FUNCTION: FrameWndProc(HWND, unsigned, WORD, LONG) // FUNCTION: FrameWndProc(HWND, unsigned, WORD, LONG)
@ -593,22 +712,46 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
{ {
HMENU hMenuWindow = GetSubMenu(Globals.hMenuFrame, GetMenuItemCount(Globals.hMenuFrame)-2); HMENU hMenuWindow = GetSubMenu(Globals.hMenuFrame, GetMenuItemCount(Globals.hMenuFrame)-2);
CLIENTCREATESTRUCT ccs = { hMenuWindow, IDW_FIRST_CHILD }; CLIENTCREATESTRUCT ccs = { hMenuWindow, IDW_FIRST_CHILD };
#if 0
hMDIClient = CreateWindow(_T("MDICLIENT"), NULL,
WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE,
0, 0, 0, 0,
hWnd, (HMENU)1, hInst, &ccs);
#else
Globals.hMDIClient = CreateWindowEx(0, _T("MDICLIENT"), NULL, Globals.hMDIClient = CreateWindowEx(0, _T("MDICLIENT"), NULL,
//WS_CHILD|WS_CLIPCHILDREN|WS_VSCROLL|WS_HSCROLL|WS_VISIBLE|WS_BORDER, //WS_CHILD|WS_CLIPCHILDREN|WS_VSCROLL|WS_HSCROLL|WS_VISIBLE|WS_BORDER,
WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE, WS_EX_MDICHILD|WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE,
0, 0, 0, 0, 0, 0, 0, 0,
hWnd, (HMENU)0, hInst, &ccs); hWnd, (HMENU)0, hInst, &ccs);
#endif
} }
CheckShellAvailable();
CheckNetworkAvailable();
CreateChildWindow(-1);
break; break;
case WM_NOTIFY:
if (MsgNotify(hWnd, message, wParam, lParam)) return TRUE;
// return MsgNotify(hWnd, message, wParam, lParam);
switch (((LPNMHDR)lParam)->code) {
case TTN_GETDISPINFO:
{
LPTOOLTIPTEXT lpttt;
lpttt = (LPTOOLTIPTEXT)lParam;
lpttt->hinst = hInst;
// load appropriate string
lpttt->lpszText = MAKEINTRESOURCE(lpttt->hdr.idFrom);
}
break;
default:
break;
}
break;
case WM_COMMAND: case WM_COMMAND:
return _CmdWndProc(hWnd, message, wParam, lParam); if (!_CmdWndProc(hWnd, message, wParam, lParam)) {
// if (LOWORD(wParam) > ID_CMD_FIRST && LOWORD(wParam) < ID_CMD_LAST) {
HWND hChildWnd = (HWND)SendMessage(Globals.hMDIClient, WM_MDIGETACTIVE, 0, 0);
if (IsWindow(hChildWnd))
if (SendMessage(hChildWnd, WM_DISPATCH_COMMAND, wParam, lParam))
break;
// }
return DefFrameProc(hWnd, Globals.hMDIClient, message, wParam, lParam);
}
break; break;
case WM_SIZE: case WM_SIZE:
resize_frame_client(hWnd); resize_frame_client(hWnd);
@ -623,6 +766,7 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
OnMenuSelect(hWnd, LOWORD(wParam), HIWORD(wParam), (HMENU)lParam); OnMenuSelect(hWnd, LOWORD(wParam), HIWORD(wParam), (HMENU)lParam);
break; break;
case WM_DESTROY: case WM_DESTROY:
WinHelp(hWnd, _T("winfile"), HELP_QUIT, 0);
PostQuitMessage(0); PostQuitMessage(0);
break; break;
case WM_QUERYENDSESSION: case WM_QUERYENDSESSION:
@ -631,7 +775,7 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
if (GetWindow(Globals.hMDIClient, GW_CHILD) != NULL) if (GetWindow(Globals.hMDIClient, GW_CHILD) != NULL)
return 0; return 0;
// else fall thru... // else fall thru...
default: default: //def:
return DefFrameProc(hWnd, Globals.hMDIClient, message, wParam, lParam); return DefFrameProc(hWnd, Globals.hMDIClient, message, wParam, lParam);
} }
return 0; return 0;

View file

@ -20,8 +20,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifndef __FRAME_WND_H__ #ifndef __FRAMEWND_H__
#define __FRAME_WND_H__ #define __FRAMEWND_H__
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -44,4 +44,4 @@ void resize_frame_client(HWND hWnd);
}; };
#endif #endif
#endif // __FRAME_WND_H__ #endif // __FRAMEWND_H__

View file

@ -44,14 +44,24 @@
#include "main.h" #include "main.h"
#include "listview.h" #include "listview.h"
//#include "entries.h" #include "dialogs.h"
#include "utils.h" #include "utils.h"
#include "run.h"
#include "trace.h" #include "trace.h"
////////////////////////////////////////////////////////////////////////////////
// Global Variables: // Global Variables:
//
extern HINSTANCE hInst; extern HINSTANCE hInst;
static WNDPROC g_orgListWndProc;
////////////////////////////////////////////////////////////////////////////////
// Local module support methods
//
static void init_output(HWND hWnd) static void init_output(HWND hWnd)
{ {
@ -113,21 +123,25 @@ static void InsertListEntries(HWND hWnd, Entry* entry, int idx)
ShowWindow(hWnd, SW_SHOW); ShowWindow(hWnd, SW_SHOW);
} }
#define MAX_LIST_COLUMNS 5
static int default_column_widths[MAX_LIST_COLUMNS] = { 175, 100, 100, 100, 70 };
static int column_alignment[MAX_LIST_COLUMNS] = { LVCFMT_LEFT, LVCFMT_RIGHT, LVCFMT_RIGHT, LVCFMT_RIGHT, LVCFMT_LEFT };
static void CreateListColumns(HWND hWndListView) static void CreateListColumns(HWND hWndListView)
{ {
char szText[50]; TCHAR szText[50];
int index; int index;
LV_COLUMN lvC; LV_COLUMN lvC;
// Create columns. // Create columns.
lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
lvC.fmt = LVCFMT_LEFT;
lvC.cx = 175;
lvC.pszText = szText; lvC.pszText = szText;
// Load the column labels from the resource file. // Load the column labels from the resource file.
for (index = 0; index < 4; index++) { for (index = 0; index < MAX_LIST_COLUMNS; index++) {
lvC.iSubItem = index; lvC.iSubItem = index;
lvC.cx = default_column_widths[index];
lvC.fmt = column_alignment[index];
LoadString(hInst, IDS_LIST_COLUMN_FIRST + index, szText, sizeof(szText)); LoadString(hInst, IDS_LIST_COLUMN_FIRST + index, szText, sizeof(szText));
if (ListView_InsertColumn(hWndListView, index, &lvC) == -1) { if (ListView_InsertColumn(hWndListView, index, &lvC) == -1) {
// TODO: handle failure condition... // TODO: handle failure condition...
@ -143,10 +157,9 @@ static HWND CreateListView(HWND hwndParent, int id)
// Get the dimensions of the parent window's client area, and create the list view control. // Get the dimensions of the parent window's client area, and create the list view control.
GetClientRect(hwndParent, &rcClient); GetClientRect(hwndParent, &rcClient);
hwndLV = CreateWindowEx(0, WC_LISTVIEW, "List View", hwndLV = CreateWindowEx(0, WC_LISTVIEW, _T("List View"),
// WS_VISIBLE | WS_CHILD | WS_BORDER | LVS_REPORT | LVS_NOCOLUMNHEADER, // WS_VISIBLE | WS_CHILD | WS_BORDER | LVS_REPORT | LVS_NOCOLUMNHEADER,
WS_VISIBLE | WS_CHILD | WS_BORDER | LVS_REPORT, WS_VISIBLE | WS_CHILD | WS_BORDER | LVS_REPORT,
// WS_VISIBLE | WS_CHILD | WS_BORDER | LVS_LIST | LVS_NOCOLUMNHEADER,
0, 0, rcClient.right, rcClient.bottom, 0, 0, rcClient.right, rcClient.bottom,
hwndParent, (HMENU)id, hInst, NULL); hwndParent, (HMENU)id, hInst, NULL);
@ -164,18 +177,72 @@ static HWND CreateListView(HWND hwndParent, int id)
return hwndLV; return hwndLV;
} }
/*
int GetNumberFormat(
LCID Locale, // locale
DWORD dwFlags, // options
LPCTSTR lpValue, // input number string
CONST NUMBERFMT *lpFormat, // formatting information
LPTSTR lpNumberStr, // output buffer
int cchNumber // size of output buffer
);
*/
/*
typedef struct _numberfmt {
UINT NumDigits;
UINT LeadingZero;
UINT Grouping;
LPTSTR lpDecimalSep;
LPTSTR lpThousandSep;
UINT NegativeOrder;
} NUMBERFMT, *LPNUMBERFMT;
*/
/*
typedef struct _BY_HANDLE_FILE_INFORMATION {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD dwVolumeSerialNumber;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD nNumberOfLinks;
DWORD nFileIndexHigh;
DWORD nFileIndexLow;
} BY_HANDLE_FILE_INFORMATION, *PBY_HANDLE_FILE_INFORMATION;
GetDriveTypeW
GetFileType
GetLocaleInfoW
GetNumberFormatW
BOOL FileTimeToLocalFileTime(
CONST FILETIME *lpFileTime, // UTC file time to convert
LPFILETIME lpLocalFileTime // converted file time
);
BOOL FileTimeToSystemTime(
CONST FILETIME *lpFileTime, // file time to convert
LPSYSTEMTIME lpSystemTime // receives system time
);
*/
// OnGetDispInfo - processes the LVN_GETDISPINFO // OnGetDispInfo - processes the LVN_GETDISPINFO
// notification message. // notification message.
void OnGetDispInfo(NMLVDISPINFO* plvdi) static void OnGetDispInfo(NMLVDISPINFO* plvdi)
{ {
static char buffer[200]; SYSTEMTIME SystemTime;
FILETIME LocalFileTime;
static TCHAR buffer[200];
// LVITEM* pItem = &(plvdi->item); // LVITEM* pItem = &(plvdi->item);
// Entry* entry = (Entry*)pItem->lParam; // Entry* entry = (Entry*)pItem->lParam;
Entry* entry = (Entry*)plvdi->item.lParam; Entry* entry = (Entry*)plvdi->item.lParam;
ASSERT(entry); ASSERT(entry);
plvdi->item.pszText = NULL;
switch (plvdi->item.iSubItem) { switch (plvdi->item.iSubItem) {
case 0: case 0:
plvdi->item.pszText = entry->data.cFileName; plvdi->item.pszText = entry->data.cFileName;
@ -184,37 +251,74 @@ void OnGetDispInfo(NMLVDISPINFO* plvdi)
break; break;
case 1: case 1:
if (entry->bhfi_valid) { if (entry->bhfi_valid) {
NUMBERFMT numFmt;
memset(&numFmt, 0, sizeof(numFmt));
numFmt.NumDigits = 0;
numFmt.LeadingZero = 0;
numFmt.Grouping = 3;
numFmt.lpDecimalSep = _T(".");
numFmt.lpThousandSep = _T(",");
numFmt.NegativeOrder = 0;
//entry->bhfi.nFileSizeLow; //entry->bhfi.nFileSizeLow;
//entry->bhfi.nFileSizeHigh; //entry->bhfi.nFileSizeHigh;
//entry->bhfi.ftCreationTime //entry->bhfi.ftCreationTime
wsprintf(buffer, _T("%u"), entry->bhfi.nFileSizeLow);
wsprintf(buffer, "%u", entry->bhfi.nFileSizeLow); if (GetNumberFormat(LOCALE_USER_DEFAULT, 0, buffer, &numFmt,
plvdi->item.pszText = buffer; buffer + sizeof(buffer)/2, sizeof(buffer)/2)) {
plvdi->item.pszText = buffer + sizeof(buffer)/2;
} else {
plvdi->item.pszText = buffer;
}
} else { } else {
plvdi->item.pszText = "unknown"; plvdi->item.pszText = _T("unknown");
} }
break; break;
case 2: case 2:
plvdi->item.pszText = "TODO:"; plvdi->item.pszText = _T("error");
if (FileTimeToLocalFileTime(&entry->bhfi.ftLastWriteTime, &LocalFileTime)) {
if (FileTimeToSystemTime(&LocalFileTime, &SystemTime)) {
if (GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &SystemTime, NULL, buffer, sizeof(buffer))) {
plvdi->item.pszText = buffer;
}
}
}
break; break;
case 3: case 3:
//entry->bhfi.dwFileAttributes plvdi->item.pszText = _T("error");
// plvdi->item.pszText = "rhsa"; if (FileTimeToLocalFileTime(&entry->bhfi.ftLastWriteTime, &LocalFileTime)) {
strcpy(buffer, " "); if (FileTimeToSystemTime(&LocalFileTime, &SystemTime)) {
if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE) strcat(buffer, "a"); else strcat(buffer, " "); // if (GetTimeFormat(UserDefaultLCID, 0, &SystemTime, NULL, buffer, sizeof(buffer))) {
if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_COMPRESSED) strcat(buffer, "c"); else strcat(buffer, " "); if (GetTimeFormat(LOCALE_USER_DEFAULT, 0, &SystemTime, NULL, buffer, sizeof(buffer))) {
if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) strcat(buffer, "d"); else strcat(buffer, " "); plvdi->item.pszText = buffer;
if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_ENCRYPTED) strcat(buffer, "e"); else strcat(buffer, " "); }
if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) strcat(buffer, "h"); else strcat(buffer, " "); }
if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_NORMAL) strcat(buffer, "n"); else strcat(buffer, " "); }
if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_OFFLINE) strcat(buffer, "o"); else strcat(buffer, " "); break;
if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY) strcat(buffer, "r"); else strcat(buffer, " "); case 4:
if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) strcat(buffer, "p"); else strcat(buffer, " "); plvdi->item.pszText = _T("");
if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_SPARSE_FILE) strcat(buffer, "f"); else strcat(buffer, " "); _tcscpy(buffer, _T(" "));
if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) strcat(buffer, "s"); else strcat(buffer, " ");
if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY) strcat(buffer, "t"); else strcat(buffer, " "); if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE) _tcscat(buffer, _T("a")); else _tcscat(buffer, _T(" "));
if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_COMPRESSED) _tcscat(buffer, _T("c")); else _tcscat(buffer, _T(" "));
if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) _tcscat(buffer, _T("d")); else _tcscat(buffer, _T(" "));
if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_ENCRYPTED) _tcscat(buffer, _T("e")); else _tcscat(buffer, _T(" "));
if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) _tcscat(buffer, _T("h")); else _tcscat(buffer, _T(" "));
if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_NORMAL) _tcscat(buffer, _T("n")); else _tcscat(buffer, _T(" "));
if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_OFFLINE) _tcscat(buffer, _T("o")); else _tcscat(buffer, _T(" "));
if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY) _tcscat(buffer, _T("r")); else _tcscat(buffer, _T(" "));
if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) _tcscat(buffer, _T("p")); else _tcscat(buffer, _T(" "));
if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_SPARSE_FILE) _tcscat(buffer, _T("f")); else _tcscat(buffer, _T(" "));
if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) _tcscat(buffer, _T("s")); else _tcscat(buffer, _T(" "));
if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY) _tcscat(buffer, _T("t")); else _tcscat(buffer, _T(" "));
plvdi->item.pszText = buffer; plvdi->item.pszText = buffer;
break;
default:
_tcscpy(buffer, _T(" "));
plvdi->item.pszText = buffer;
break;
}
}
/* /*
FILE_ATTRIBUTE_ARCHIVE The file or directory is an archive file. Applications use this attribute to mark files for backup or removal. FILE_ATTRIBUTE_ARCHIVE The file or directory is an archive file. Applications use this attribute to mark files for backup or removal.
FILE_ATTRIBUTE_COMPRESSED The file or directory is compressed. For a file, this means that all of the data in the file is compressed. For a directory, this means that compression is the default for newly created files and subdirectories. FILE_ATTRIBUTE_COMPRESSED The file or directory is compressed. For a file, this means that all of the data in the file is compressed. For a directory, this means that compression is the default for newly created files and subdirectories.
@ -229,32 +333,13 @@ FILE_ATTRIBUTE_SPARSE_FILE The file is a sparse file.
FILE_ATTRIBUTE_SYSTEM The file or directory is part of the operating system or is used exclusively by the operating system. FILE_ATTRIBUTE_SYSTEM The file or directory is part of the operating system or is used exclusively by the operating system.
FILE_ATTRIBUTE_TEMPORARY The file is being used for temporary storage. File systems attempt to keep all the data in memory for quicker access, rather than flushing the data back to mass storage. A temporary file should be deleted by the application as soon as it is no longer needed. FILE_ATTRIBUTE_TEMPORARY The file is being used for temporary storage. File systems attempt to keep all the data in memory for quicker access, rather than flushing the data back to mass storage. A temporary file should be deleted by the application as soon as it is no longer needed.
*/ */
break;
default:
break;
}
}
/*
typedef struct _BY_HANDLE_FILE_INFORMATION {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD dwVolumeSerialNumber;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD nNumberOfLinks;
DWORD nFileIndexHigh;
DWORD nFileIndexLow;
} BY_HANDLE_FILE_INFORMATION, *PBY_HANDLE_FILE_INFORMATION;
*/
// OnEndLabelEdit - processes the LVN_ENDLABELEDIT // OnEndLabelEdit - processes the LVN_ENDLABELEDIT
// notification message. // notification message.
// Returns TRUE if the label is changed, or FALSE otherwise. // Returns TRUE if the label is changed, or FALSE otherwise.
BOOL OnEndLabelEdit(NMLVDISPINFO* plvdi) static BOOL OnEndLabelEdit(NMLVDISPINFO* plvdi)
{ {
if (plvdi->item.iItem == -1) if (plvdi->item.iItem == -1)
return FALSE; return FALSE;
@ -268,9 +353,128 @@ BOOL OnEndLabelEdit(NMLVDISPINFO* plvdi)
// many characters in the field. // many characters in the field.
} }
/*
typedef struct _BY_HANDLE_FILE_INFORMATION {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD dwVolumeSerialNumber;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD nNumberOfLinks;
DWORD nFileIndexHigh;
DWORD nFileIndexLow;
} BY_HANDLE_FILE_INFORMATION, *PBY_HANDLE_FILE_INFORMATION;
*/
/*
typedef struct _WIN32_FIND_DATA {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved0;
DWORD dwReserved1;
TCHAR cFileName[ MAX_PATH ];
TCHAR cAlternateFileName[ 14 ];
} WIN32_FIND_DATA, *PWIN32_FIND_DATA;
*/
static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
Entry* pItem1 = (Entry*)lParam1;
Entry* pItem2 = (Entry*)lParam2;
if (pItem1 != NULL && pItem2 != NULL) {
switch (lParamSort) {
case ID_VIEW_SORT_BY_NAME:
return _tcscmp(pItem1->data.cFileName, pItem2->data.cFileName);
break;
case ID_VIEW_SORT_BY_TYPE:
// if (pItem1->bhfi.nFileSizeLow != pItem2->bhfi.nFileSizeLow) {
// return (pItem1->bhfi.nFileSizeLow < pItem2->bhfi.nFileSizeLow) ? -1 : 1;
// }
break;
case ID_VIEW_SORT_BY_SIZE:
if (pItem1->bhfi.nFileSizeLow != pItem2->bhfi.nFileSizeLow) {
return (pItem1->bhfi.nFileSizeLow < pItem2->bhfi.nFileSizeLow) ? -1 : 1;
}
break;
case ID_VIEW_SORT_BY_DATE:
return CompareFileTime(&pItem1->bhfi.ftLastWriteTime, &pItem2->bhfi.ftLastWriteTime);
break;
}
}
return 0;
}
static void CmdSortItems(HWND hWnd, UINT cmd)
{
CheckMenuItem(Globals.hMenuView, ID_VIEW_SORT_BY_NAME, MF_BYCOMMAND);
CheckMenuItem(Globals.hMenuView, ID_VIEW_SORT_BY_TYPE, MF_BYCOMMAND);
CheckMenuItem(Globals.hMenuView, ID_VIEW_SORT_BY_SIZE, MF_BYCOMMAND);
CheckMenuItem(Globals.hMenuView, ID_VIEW_SORT_BY_DATE, MF_BYCOMMAND);
ListView_SortItems(hWnd, &CompareFunc, cmd);
CheckMenuItem(Globals.hMenuView, cmd, MF_BYCOMMAND | MF_CHECKED);
}
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
UINT cmd = LOWORD(wParam);
//HWND hChildWnd;
if (1) {
switch (cmd) {
case ID_FILE_OPEN:
{
LVITEM item;
item.mask = LVIF_PARAM;
// UINT selected_count = ListView_GetSelectedCount(hWnd);
item.iItem = ListView_GetNextItem(hWnd, -1, LVNI_SELECTED);
if (item.iItem != -1) {
if (ListView_GetItem(hWnd, &item)) {
Entry* entry = (Entry*)item.lParam;
OpenTarget(hWnd, entry->data.cFileName);
}
}
}
break;
case ID_FILE_MOVE:
//OnFileMove(hWnd);
break;
case ID_FILE_COPY:
case ID_FILE_COPY_CLIPBOARD:
case ID_FILE_DELETE:
case ID_FILE_RENAME:
case ID_FILE_PROPERTIES:
case ID_FILE_COMPRESS:
case ID_FILE_UNCOMPRESS:
break;
case ID_FILE_RUN:
OnFileRun();
break;
case ID_FILE_PRINT:
case ID_FILE_ASSOCIATE:
case ID_FILE_CREATE_DIRECTORY:
break;
case ID_VIEW_SORT_BY_NAME:
case ID_VIEW_SORT_BY_TYPE:
case ID_VIEW_SORT_BY_SIZE:
case ID_VIEW_SORT_BY_DATE:
CmdSortItems(hWnd, cmd);
break;
default:
return FALSE;
}
}
return TRUE;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
static WNDPROC g_orgListWndProc;
static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
@ -280,39 +484,85 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
switch (message) { switch (message) {
/* /*
case WM_CREATE: case WM_CREATE:
//CreateListView(hWnd); //CreateListView(hWnd);
return 0; return 0;
*/ */
case WM_NOTIFY: case WM_COMMAND:
switch (((LPNMHDR)lParam)->code) { if (!_CmdWndProc(hWnd, message, wParam, lParam)) {
case LVN_GETDISPINFO: return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
OnGetDispInfo((NMLVDISPINFO*)lParam); }
break; break;
case LVN_ENDLABELEDIT: case WM_DISPATCH_COMMAND:
return OnEndLabelEdit((NMLVDISPINFO*)lParam); return _CmdWndProc(hWnd, message, wParam, lParam);
break;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case LVN_GETDISPINFO:
OnGetDispInfo((NMLVDISPINFO*)lParam);
break;
case NM_DBLCLK:
{
NMITEMACTIVATE* nmitem = (LPNMITEMACTIVATE)lParam;
LVHITTESTINFO info;
if (nmitem->hdr.hwndFrom != hWnd) break;
// if (nmitem->hdr.idFrom != IDW_LISTVIEW) break;
// if (nmitem->hdr.code != ???) break;
switch (nmitem->uKeyFlags) {
case LVKF_ALT: // The ALT key is pressed.
// properties dialog box ?
break;
case LVKF_CONTROL: // The CTRL key is pressed.
// run dialog box for providing parameters...
break;
case LVKF_SHIFT: // The SHIFT key is pressed.
break; break;
} }
break; info.pt.x = nmitem->ptAction.x;
// return 0; info.pt.y = nmitem->ptAction.y;
if (ListView_HitTest(hWnd, &info) != -1) {
LVITEM item;
item.mask = LVIF_PARAM;
item.iItem = info.iItem;
if (ListView_GetItem(hWnd, &item)) {
Entry* entry = (Entry*)item.lParam;
OpenTarget(hWnd, entry->data.cFileName);
}
}
}
break;
case LVN_ENDLABELEDIT:
return OnEndLabelEdit((NMLVDISPINFO*)lParam);
break;
default:
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
}
// return 0;
break;
/*
case WM_SETFOCUS: case WM_SETFOCUS:
child->nFocusPanel = pane==&child->right? 1: 0; child->nFocusPanel = pane==&child->right? 1: 0;
ListBox_SetSel(hWnd, TRUE, 1); ListBox_SetSel(hWnd, TRUE, 1);
//TODO: check menu items //TODO: check menu items
break; break;
case WM_KEYDOWN: case WM_KEYDOWN:
if (wParam == VK_TAB) { if (wParam == VK_TAB) {
//TODO: SetFocus(Globals.hDriveBar) //TODO: SetFocus(Globals.hDriveBar)
SetFocus(child->nFocusPanel? child->left.hWnd: child->right.hWnd); SetFocus(child->nFocusPanel? child->left.hWnd: child->right.hWnd);
} }
break;
*/
default:
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
break;
} }
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam); return 0;
} }
void CreateListWnd(HWND parent, Pane* pane, int id, LPSTR lpszPathName) void CreateListWnd(HWND parent, Pane* pane, int id, LPTSTR lpszPathName)
{ {
// static int s_init = 0; // static int s_init = 0;
Entry* entry = pane->root; Entry* entry = pane->root;
@ -352,20 +602,6 @@ void RefreshList(HWND hWnd, Entry* entry)
} }
} }
} }
/*
typedef struct _WIN32_FIND_DATA {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved0;
DWORD dwReserved1;
TCHAR cFileName[ MAX_PATH ];
TCHAR cAlternateFileName[ 14 ];
} WIN32_FIND_DATA, *PWIN32_FIND_DATA;
*/
/* /*
Pane* pane = (Pane*)GetWindowLong(hWnd, GWL_USERDATA); Pane* pane = (Pane*)GetWindowLong(hWnd, GWL_USERDATA);

View file

@ -31,10 +31,8 @@ extern "C" {
#pragma once #pragma once
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000
#include "resource.h"
void CreateListWnd(HWND parent, Pane* pane, int id, LPTSTR lpszPathName);
void CreateListWnd(HWND parent, Pane* pane, int id, LPSTR lpszPathName);
void RefreshList(HWND hWnd, Entry* entry); void RefreshList(HWND hWnd, Entry* entry);

View file

@ -94,7 +94,7 @@ TCHAR szChildClass[MAX_LOADSTRING];
// //
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{ {
// char path[MAX_PATH]; // char TCHAR[MAX_PATH];
// int nParts[4]; // int nParts[4];
// ChildWnd* child; // ChildWnd* child;
@ -161,18 +161,21 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
return FALSE; return FALSE;
} }
if (InitCommonControlsEx(&icc)) if (InitCommonControlsEx(&icc)) {
{ // TBBUTTON drivebarBtn = {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP};
TBBUTTON drivebarBtn = {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP}; TBBUTTON drivebarBtn = {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP};
int btn = 1; int btn = 1;
PTSTR p; PTSTR p;
Globals.hDriveBar = CreateToolbarEx(Globals.hMainWnd, Globals.hDriveBar = CreateToolbarEx(Globals.hMainWnd,
WS_CHILD|WS_VISIBLE|CCS_NOMOVEY|TBSTYLE_LIST, WS_CHILD|WS_VISIBLE|CCS_NOMOVEY|TBSTYLE_FLAT|TBSTYLE_LIST|TBSTYLE_WRAPABLE,
// WS_CHILD|WS_VISIBLE|CCS_NOMOVEY|TBSTYLE_LIST|TBSTYLE_TRANSPARENT|TBSTYLE_WRAPABLE,
IDW_DRIVEBAR, 2, hInstance, IDB_DRIVEBAR, IDW_DRIVEBAR, 2, hInstance, IDB_DRIVEBAR,
&drivebarBtn, 1/*iNumButtons*/, &drivebarBtn, 1/*iNumButtons*/,
16/*dxButton*/, 13/*dyButton*/, 25/*dxButton*/, 16/*dyButton*/,
16/*dxBitmap*/, 13/*dyBitmap*/, sizeof(TBBUTTON)); 0/*dxBitmap*/, 0/*dyBitmap*/, sizeof(TBBUTTON));
// 16/*dxButton*/, 13/*dyButton*/,
// 16/*dxBitmap*/, 13/*dyBitmap*/, sizeof(TBBUTTON));
CheckMenuItem(Globals.hMenuOptions, ID_OPTIONS_DRIVEBAR, MF_BYCOMMAND|MF_CHECKED); CheckMenuItem(Globals.hMenuOptions, ID_OPTIONS_DRIVEBAR, MF_BYCOMMAND|MF_CHECKED);
GetLogicalDriveStrings(BUFFER_LEN, Globals.drives); GetLogicalDriveStrings(BUFFER_LEN, Globals.drives);
drivebarBtn.fsStyle = TBSTYLE_BUTTON; drivebarBtn.fsStyle = TBSTYLE_BUTTON;
@ -200,26 +203,116 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
while(*p++); while(*p++);
} }
{ {
#define DRIVEBOX_WIDTH 200
#define DRIVEBOX_HEIGHT 8
TBBUTTON toolbarBtns[] = { TBBUTTON toolbarBtns[] = {
{DRIVEBOX_WIDTH+10, 0, 0, TBSTYLE_SEP},
{0, 0, 0, TBSTYLE_SEP}, {0, 0, 0, TBSTYLE_SEP},
{0, ID_WINDOW_NEW_WINDOW, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{1, ID_WINDOW_CASCADE, TBSTATE_ENABLED, TBSTYLE_BUTTON}, // {1, ID_FILE_OPEN, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, ID_FILE_OPEN },
{2, ID_WINDOW_TILE_HORZ, TBSTATE_ENABLED, TBSTYLE_BUTTON}, {2, ID_FILE_MOVE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, ID_FILE_MOVE},
{3, ID_WINDOW_TILE_VERT, TBSTATE_ENABLED, TBSTYLE_BUTTON}, {3, ID_FILE_COPY, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, ID_FILE_COPY},
{4, 2/*TODO: ID_...*/, TBSTATE_ENABLED, TBSTYLE_BUTTON}, {4, ID_FILE_COPY_CLIPBOARD, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, ID_FILE_COPY_CLIPBOARD},
{5, 2/*TODO: ID_...*/, TBSTATE_ENABLED, TBSTYLE_BUTTON}, {5, ID_FILE_DELETE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, ID_FILE_DELETE},
{6, ID_FILE_RENAME, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{7, ID_FILE_PROPERTIES, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{8, ID_FILE_COMPRESS, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{9, ID_FILE_UNCOMPRESS, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {10, ID_FILE_RUN, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{10, ID_FILE_PRINT, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{11, ID_FILE_ASSOCIATE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{12, ID_FILE_CREATE_DIRECTORY, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{13, ID_FILE_SEARCH, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{14, ID_FILE_SELECT_FILES, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {16, ID_FILE_EXIT, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{15, ID_DISK_COPY_DISK, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{16, ID_DISK_LABEL_DISK, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{17, ID_DISK_FORMAT_DISK, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{18, ID_DISK_CONNECT_NETWORK_DRIVE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{19, ID_DISK_DISCONNECT_NETWORK_DRIVE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{20, ID_DISK_SHARE_AS, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{21, ID_DISK_STOP_SHARING, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {24, ID_DISK_SELECT_DRIVE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {25, ID_TREE_EXPAND_ONE_LEVEL, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {26, ID_TREE_EXPAND_BRANCH, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {27, ID_TREE_EXPAND_ALL, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {28, ID_TREE_COLLAPSE_BRANCH, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{22, ID_TREE_INDICATE_EXPANDABLE_BRANCHES, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {30, ID_VIEW_TREE_DIRECTORY, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {31, ID_VIEW_TREE_ONLY, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {32, ID_VIEW_DIRECTORY_ONLY, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {33, ID_VIEW_SPLIT, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{23, ID_VIEW_NAME, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{24, ID_VIEW_ALL_FILE_DETAILS, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{25, ID_VIEW_PARTIAL_DETAILS, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {37, ID_VIEW_SORT_BY_NAME, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {38, ID_VIEW_SORT_BY_TYPE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {39, ID_VIEW_SORT_BY_SIZE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {40, ID_VIEW_SORT_BY_DATE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{26, ID_VIEW_BY_FILE_TYPE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{27, ID_OPTIONS_CONFIRMATION, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{28, ID_OPTIONS_FONT, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{29, ID_OPTIONS_CUSTOMISE_TOOLBAR, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {45, ID_OPTIONS_TOOLBAR, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {46, ID_OPTIONS_DRIVEBAR, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {47, ID_OPTIONS_STATUSBAR, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{30, ID_OPTIONS_OPEN_NEW_WINDOW_ON_CONNECT, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{31, ID_OPTIONS_MINIMISE_ON_USE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{32, ID_OPTIONS_SAVE_ON_EXIT, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{33, ID_SECURITY_PERMISSIONS, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{34, ID_SECURITY_AUDITING, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{35, ID_SECURITY_OWNER, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{36, ID_WINDOW_NEW_WINDOW, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{37, ID_WINDOW_CASCADE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{38, ID_WINDOW_TILE_HORZ, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{39, ID_WINDOW_TILE_VERT, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{40, ID_WINDOW_ARRANGE_ICONS, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{41, ID_WINDOW_REFRESH, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{42, ID_HELP_CONTENTS, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {61, ID_HELP_SEARCH_HELP, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {62, ID_HELP_HOW_TO_USE_HELP, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {63, ID_HELP_ABOUT, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {0, ID_WINDOW_NEW_WINDOW, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {1, ID_WINDOW_CASCADE, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {2, ID_WINDOW_TILE_HORZ, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {3, ID_WINDOW_TILE_VERT, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {4, 2/*TODO: ID_...*/, TBSTATE_ENABLED, TBSTYLE_BUTTON},
// {5, 2/*TODO: ID_...*/, TBSTATE_ENABLED, TBSTYLE_BUTTON},
}; };
Globals.hToolBar = CreateToolbarEx(Globals.hMainWnd, WS_CHILD|WS_VISIBLE, // Globals.hToolBar = CreateToolbarEx(Globals.hMainWnd, WS_CHILD|WS_VISIBLE|TBSTYLE_TOOLTIPS|TBSTYLE_FLAT,
Globals.hToolBar = CreateToolbarEx(Globals.hMainWnd, WS_CHILD|WS_VISIBLE|TBSTYLE_TOOLTIPS|CCS_ADJUSTABLE,
IDW_TOOLBAR, 2, hInstance, IDB_TOOLBAR, toolbarBtns, IDW_TOOLBAR, 2, hInstance, IDB_TOOLBAR, toolbarBtns,
sizeof(toolbarBtns)/sizeof(TBBUTTON), 16, 15, 16, 15, sizeof(TBBUTTON)); sizeof(toolbarBtns)/sizeof(TBBUTTON), 16, 15, 16, 15, sizeof(TBBUTTON));
CheckMenuItem(Globals.hMenuOptions, ID_OPTIONS_TOOLBAR, MF_BYCOMMAND|MF_CHECKED); CheckMenuItem(Globals.hMenuOptions, ID_OPTIONS_TOOLBAR, MF_BYCOMMAND|MF_CHECKED);
{
// Create the edit control. Notice that hWndParent, parent of
// the toolbar, is used as the parent of the edit control.
//HWND hWndEdit = CreateWindowEx(0L, WC_COMBOBOXEX, NULL, WS_CHILD | WS_BORDER | WS_VISIBLE
HWND hWndEdit = CreateWindowEx(0L, "ComboBox", NULL, WS_CHILD | WS_BORDER | WS_VISIBLE
| CBS_DROPDOWN | ES_LEFT | ES_AUTOVSCROLL | ES_MULTILINE,
10, 0, DRIVEBOX_WIDTH, DRIVEBOX_HEIGHT, Globals.hMainWnd, (HMENU)IDW_DRIVEBOX, hInstance, 0);
// Set the toolbar window as the parent of the edit control
// window. You must set the toolbar as the parent of the edit
// control for it to appear embedded in the toolbar.
SetParent (hWndEdit, Globals.hToolBar);
}
} }
} }
// Create the status bar // Create the status bar
Globals.hStatusBar = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS, Globals.hStatusBar = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS,
"", Globals.hMainWnd, IDW_STATUS_WINDOW); _T(""), Globals.hMainWnd, IDW_STATUS_WINDOW);
if (!Globals.hStatusBar) if (!Globals.hStatusBar)
return FALSE; return FALSE;
CheckMenuItem(Globals.hMenuOptions, ID_OPTIONS_STATUSBAR, MF_BYCOMMAND|MF_CHECKED); CheckMenuItem(Globals.hMenuOptions, ID_OPTIONS_STATUSBAR, MF_BYCOMMAND|MF_CHECKED);
@ -294,9 +387,9 @@ void UpdateStatusBar(void)
TCHAR text[260]; TCHAR text[260];
DWORD size; DWORD size;
size = sizeof(text)/sizeof(TCHAR); // size = sizeof(text)/sizeof(TCHAR);
GetUserName(text, &size); // GetUserName(text, &size);
SendMessage(Globals.hStatusBar, SB_SETTEXT, 2, (LPARAM)text); // SendMessage(Globals.hStatusBar, SB_SETTEXT, 2, (LPARAM)text);
size = sizeof(text)/sizeof(TCHAR); size = sizeof(text)/sizeof(TCHAR);
GetComputerName(text, &size); GetComputerName(text, &size);
SendMessage(Globals.hStatusBar, SB_SETTEXT, 3, (LPARAM)text); SendMessage(Globals.hStatusBar, SB_SETTEXT, 3, (LPARAM)text);
@ -371,7 +464,9 @@ int APIENTRY WinMain(HINSTANCE hInstance,
return FALSE; return FALSE;
} }
hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDC_WINFILE); // hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDC_WINFILE);
hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDR_ACCELERATOR1);
hMDIClient = GetWindow(Globals.hMainWnd, GW_CHILD); hMDIClient = GetWindow(Globals.hMainWnd, GW_CHILD);
// Main message loop: // Main message loop:

View file

@ -65,6 +65,8 @@ enum IMAGE {
#define IDW_STATUSBAR 0x100 #define IDW_STATUSBAR 0x100
#define IDW_TOOLBAR 0x101 #define IDW_TOOLBAR 0x101
#define IDW_DRIVEBAR 0x102 #define IDW_DRIVEBAR 0x102
#define IDW_DRIVEBOX 0x103
#define IDW_FIRST_CHILD 0xC000 //0x200 #define IDW_FIRST_CHILD 0xC000 //0x200
#define IDW_TREE_LEFT 3 #define IDW_TREE_LEFT 3
@ -78,7 +80,7 @@ enum IMAGE {
void _wsplitpath(const WCHAR* path, WCHAR* drv, WCHAR* dir, WCHAR* name, WCHAR* ext); void _wsplitpath(const WCHAR* path, WCHAR* drv, WCHAR* dir, WCHAR* name, WCHAR* ext);
void _splitpath(const CHAR* path, CHAR* drv, CHAR* dir, CHAR* name, CHAR* ext); void _splitpath(const CHAR* path, CHAR* drv, CHAR* dir, CHAR* name, CHAR* ext);
#ifdef UNICODE #ifdef _UNICODE
#define _tsplitpath _wsplitpath #define _tsplitpath _wsplitpath
#else #else
#define _tsplitpath _splitpath #define _tsplitpath _splitpath
@ -86,6 +88,14 @@ void _splitpath(const CHAR* path, CHAR* drv, CHAR* dir, CHAR* name, CHAR* ext);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
enum OPTION_FLAGS {
OPTIONS_OPEN_NEW_WINDOW_ON_CONNECT = 0x01,
OPTIONS_MINIMISE_ON_USE = 0x02,
OPTIONS_SAVE_ON_EXIT = 0x04,
};
////////////////////////////////////////////////////////////////////////////////
enum COLUMN_FLAGS { enum COLUMN_FLAGS {
COL_SIZE = 0x01, COL_SIZE = 0x01,
COL_DATE = 0x02, COL_DATE = 0x02,
@ -128,6 +138,7 @@ typedef struct
LPCSTR lpszLanguage; LPCSTR lpszLanguage;
UINT wStringTableOffset; UINT wStringTableOffset;
enum OPTION_FLAGS Options;
} WINFILE_GLOBALS; } WINFILE_GLOBALS;
@ -165,6 +176,10 @@ extern UINT wStringTableOffset;
#endif #endif
extern UINT OemCodePage;
extern UINT AnsiCodePage;
extern LCID UserDefaultLCID;
extern HINSTANCE hInst; extern HINSTANCE hInst;
extern TCHAR szTitle[]; extern TCHAR szTitle[];
extern TCHAR szFrameClass[]; extern TCHAR szFrameClass[];

245
rosapps/winfile/network.c Normal file
View file

@ -0,0 +1,245 @@
/*
* ReactOS winfile
*
* network.c
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#endif
#include "main.h"
#include "network.h"
////////////////////////////////////////////////////////////////////////////////
// Global Variables:
//
static HMODULE hMPR;
static BOOL bNetAvailable = FALSE;
typedef DWORD (WINAPI *WNetCloseEnum_Ptr)(HANDLE);
typedef DWORD (WINAPI *WNetConnectionDialog_Ptr)(HWND, DWORD);
typedef DWORD (WINAPI *WNetDisconnectDialog_Ptr)(HWND, DWORD);
typedef DWORD (WINAPI *WNetConnectionDialog1_Ptr)(LPCONNECTDLGSTRUCT);
typedef DWORD (WINAPI *WNetDisconnectDialog1_Ptr)(LPDISCDLGSTRUCT);
typedef DWORD (WINAPI *WNetEnumResourceA_Ptr)(HANDLE, LPDWORD, LPVOID, LPDWORD);
typedef DWORD (WINAPI *WNetOpenEnumA_Ptr)(DWORD, DWORD, DWORD, LPNETRESOURCE, LPHANDLE);
static WNetCloseEnum_Ptr pWNetCloseEnum;
static WNetConnectionDialog_Ptr pWNetConnectionDialog;
static WNetDisconnectDialog_Ptr pWNetDisconnectDialog;
static WNetConnectionDialog1_Ptr pWNetConnectionDialog1;
static WNetDisconnectDialog1_Ptr pWNetDisconnectDialog1;
static WNetEnumResourceA_Ptr pWNetEnumResource;
static WNetOpenEnumA_Ptr pWNetOpenEnum;
BOOL CheckNetworkAvailable(void)
{
hMPR = LoadLibrary(_T("MPR.DLL"));
if (hMPR) {
pWNetCloseEnum = (WNetCloseEnum_Ptr)(FARPROC)GetProcAddress(hMPR, "WNetCloseEnum");
pWNetConnectionDialog = (WNetConnectionDialog_Ptr)(FARPROC)GetProcAddress(hMPR, "WNetConnectionDialog");
pWNetDisconnectDialog = (WNetDisconnectDialog_Ptr)(FARPROC)GetProcAddress(hMPR, "WNetDisconnectDialog");
pWNetConnectionDialog1 = (WNetConnectionDialog1_Ptr)(FARPROC)GetProcAddress(hMPR, "WNetConnectionDialog1");
pWNetDisconnectDialog1 = (WNetDisconnectDialog1_Ptr)(FARPROC)GetProcAddress(hMPR, "WNetDisconnectDialog1");
pWNetEnumResource = (WNetEnumResourceA_Ptr)(FARPROC)GetProcAddress(hMPR, "WNetEnumResourceA");
pWNetOpenEnum = (WNetOpenEnumA_Ptr)(FARPROC)GetProcAddress(hMPR, "WNetOpenEnumA");
// FreeLibrary(hMPR);
bNetAvailable = TRUE;
}
return (hMPR != NULL);
}
LRESULT CALLBACK EnumNetConnectionsProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
return 0;
}
/*
DWORD WNetOpenEnum(
DWORD dwScope, // scope of enumeration
DWORD dwType, // resource types to list
DWORD dwUsage, // resource usage to list
LPNETRESOURCE lpNetResource, // resource structure
LPHANDLE lphEnum // enumeration handle buffer
);
result = WNetOpenEnum(RESOURCE_CONNECTED, RESOURCETYPE_DISK, RESOURCEUSAGE_ALL, NULL, &EnumNetConnectionsProc);
*/
DWORD MapNetworkDrives(HWND hWnd, BOOL connect)
{
DWORD result = 0L;
if (!bNetAvailable) return result;
#if 1
if (connect) {
pWNetConnectionDialog(hWnd, RESOURCETYPE_DISK);
} else {
pWNetDisconnectDialog(hWnd, RESOURCETYPE_DISK);
}
#else
if (connect) {
NETRESOURCE netResouce;
CONNECTDLGSTRUCT connectDlg;
//netResouce.dwScope;
//netResouce.dwType;
netResouce.dwDisplayType = 0;
//netResouce.dwUsage;
//netResouce.lpLocalName;
//netResouce.lpRemoteName;
//netResouce.lpComment;
//netResouce.lpProvider;
//connectDlg.cbStructure;
connectDlg.hwndOwner = hWnd;
connectDlg.lpConnRes = &netResouce;
//connectDlg.dwFlags;
//connectDlg.dwDevNum;
result = WNetConnectionDialog1(&connectDlg);
} else {
DISCDLGSTRUCT disconnectDlg;
//disconnectDlg.cbStructure;
disconnectDlg.hwndOwner = hWnd;
//disconnectDlg.lpLocalName;
//disconnectDlg.lpRemoteName;
//disconnectDlg.dwFlags;
result = pWNetDisconnectDialog1(&disconnectDlg);
}
#endif
return result;
}
////////////////////////////////////
void NetErrorHandler(HWND hwnd, DWORD dwResult, LPTSTR str)
{
}
void DisplayStruct(HDC hdc, LPNETRESOURCE lpnrLocal)
{
}
////////////////////////////////////
BOOL WINAPI EnumerateFunc(HWND hwnd, HDC hdc, LPNETRESOURCE lpnr)
{
DWORD dwResult, dwResultEnum;
HANDLE hEnum;
DWORD cbBuffer = 16384; // 16K is a good size
DWORD cEntries = -1; // enumerate all possible entries
LPNETRESOURCE lpnrLocal; // pointer to enumerated structures
DWORD i;
if (!bNetAvailable) return FALSE;
// Call the WNetOpenEnum function to begin the enumeration.
dwResult = pWNetOpenEnum(RESOURCE_GLOBALNET, // all network resources
RESOURCETYPE_ANY, // all resources
0, // enumerate all resources
lpnr, // NULL first time the function is called
&hEnum); // handle to the resource
if (dwResult != NO_ERROR) {
// Process errors with an application-defined error handler.
NetErrorHandler(hwnd, dwResult, (LPTSTR)_T("WNetOpenEnum"));
return FALSE;
}
// Call the GlobalAlloc function to allocate resources.
lpnrLocal = (LPNETRESOURCE)GlobalAlloc(GPTR, cbBuffer);
do {
// Initialize the buffer.
ZeroMemory(lpnrLocal, cbBuffer);
// Call the WNetEnumResource function to continue the enumeration.
dwResultEnum = pWNetEnumResource(hEnum, // resource handle
&cEntries, // defined locally as -1
lpnrLocal, // LPNETRESOURCE
&cbBuffer); // buffer size
// If the call succeeds, loop through the structures.
if (dwResultEnum == NO_ERROR) {
for (i = 0; i < cEntries; i++) {
// Call an application-defined function to display the contents of the NETRESOURCE structures.
DisplayStruct(hdc, &lpnrLocal[i]);
// If the NETRESOURCE structure represents a container resource, call the EnumerateFunc function recursively.
if (RESOURCEUSAGE_CONTAINER == (lpnrLocal[i].dwUsage & RESOURCEUSAGE_CONTAINER))
if (!EnumerateFunc(hwnd, hdc, &lpnrLocal[i])) {
//TextOut(hdc, 10, 10, _T("EnumerateFunc returned FALSE."), 29);
}
}
}
// Process errors.
else if (dwResultEnum != ERROR_NO_MORE_ITEMS) {
NetErrorHandler(hwnd, dwResultEnum, (LPTSTR)_T("WNetEnumResource"));
break;
}
}
// End do.
while (dwResultEnum != ERROR_NO_MORE_ITEMS);
// Call the GlobalFree function to free the memory.
GlobalFree((HGLOBAL)lpnrLocal);
// Call WNetCloseEnum to end the enumeration.
dwResult = pWNetCloseEnum(hEnum);
if (dwResult != NO_ERROR) {
// Process errors.
NetErrorHandler(hwnd, dwResult, (LPTSTR)_T("WNetCloseEnum"));
return FALSE;
}
return TRUE;
}
/*
DWORD WNetConnectionDialog(
HWND hwnd, // handle to window owning dialog box
DWORD dwType // resource type
);
DWORD WNetAddConnection(
LPCTSTR lpRemoteName, // network device name
LPCTSTR lpPassword, // password
LPCTSTR lpLocalName // local device name
);
*/

39
rosapps/winfile/network.h Normal file
View file

@ -0,0 +1,39 @@
/*
* ReactOS Application Debug Routines
*
* network.h
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __NETWORK_H__
#define __NETWORK_H__
#ifdef __cplusplus
extern "C" {
#endif
BOOL CheckNetworkAvailable(void);
DWORD MapNetworkDrives(HWND hWnd, BOOL connect);
#ifdef __cplusplus
};
#endif
#endif // __NETWORK_H__

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -2,21 +2,23 @@
// Microsoft Developer Studio generated include file. // Microsoft Developer Studio generated include file.
// Used by winfile.rc // Used by winfile.rc
// //
#define ID_FILE_MENU 0 #define ID_FILE_MENU 1
#define ID_DISK_MENU 1 #define ID_DISK_MENU 2
#define ID_TREE_MENU 2 #define ID_TREE_MENU 3
#define ID_VIEW_MENU 3 #define ID_VIEW_MENU 4
#define ID_OPTIONS_MENU 4 #define ID_OPTIONS_MENU 5
#define ID_SECURITY_MENU 5 #define ID_SECURITY_MENU 6
#define ID_WINDOW_MENU 6 #define ID_WINDOW_MENU 7
#define ID_HELP_MENU 7 #define ID_HELP_MENU 8
#define IDS_LIST_COLUMN_FIRST 91 #define IDS_LIST_COLUMN_FIRST 91
#define IDS_LIST_COLUMN_NAME 91 #define IDS_LIST_COLUMN_NAME 91
#define IDS_LIST_COLUMN_SIZE 92 #define IDS_LIST_COLUMN_SIZE 92
#define IDS_LIST_COLUMN_DATE 93 #define IDS_LIST_COLUMN_DATE 93
#define IDS_LIST_COLUMN_ATTRIB 94 #define IDS_LIST_COLUMN_TIME 94
#define IDS_LIST_COLUMN_DOSNAME 95 #define IDS_LIST_COLUMN_ATTRIB 95
#define IDS_LIST_COLUMN_LAST 95 #define IDS_LIST_COLUMN_DOSNAME 96
#define IDS_LIST_COLUMN_LAST 96
#define IDD_ABOUTBOX 104 #define IDD_ABOUTBOX 104
#define IDS_APP_TITLE 105 #define IDS_APP_TITLE 105
#define IDI_WINFILE 107 #define IDI_WINFILE 107
@ -35,6 +37,7 @@
#define IDD_DIALOG_DIRECTORY 144 #define IDD_DIALOG_DIRECTORY 144
#define IDD_DIALOG_VIEW_TYPE 145 #define IDD_DIALOG_VIEW_TYPE 145
#define IDD_DIALOG_OPTIONS_CONFIRMATON 146 #define IDD_DIALOG_OPTIONS_CONFIRMATON 146
#define IDR_ACCELERATOR1 147
#define ID_WINDOW_CLOSE 798 #define ID_WINDOW_CLOSE 798
#define ID_WINDOW_CLOSEALL 799 #define ID_WINDOW_CLOSEALL 799
#define IDC_VIEW_TYPE_MASK 999 #define IDC_VIEW_TYPE_MASK 999
@ -51,6 +54,10 @@
#define IDC_CONFIRMATION_MOUSE_ACTIONS 1009 #define IDC_CONFIRMATION_MOUSE_ACTIONS 1009
#define IDC_CONFIRMATION_DISK_COMMANDS 1010 #define IDC_CONFIRMATION_DISK_COMMANDS 1010
#define IDC_CONFIRMATION_MODIFY_SYSTEM 1011 #define IDC_CONFIRMATION_MODIFY_SYSTEM 1011
#define ID_CMD_FIRST 100
#define ID_CMD_LAST 32830
#define ID_FILE_OPEN 32769 #define ID_FILE_OPEN 32769
#define ID_FILE_MOVE 32770 #define ID_FILE_MOVE 32770
#define ID_FILE_COPY 32771 #define ID_FILE_COPY 32771
@ -78,6 +85,7 @@
#define ID_TREE_EXPAND_ONE_LEVEL 32793 #define ID_TREE_EXPAND_ONE_LEVEL 32793
#define ID_TREE_EXPAND_BRANCH 32794 #define ID_TREE_EXPAND_BRANCH 32794
#define ID_TREE_EXPAND_ALL 32795 #define ID_TREE_EXPAND_ALL 32795
#define ID_TREE_COLLAPSE_BRANCH 32768
#define ID_TREE_INDICATE_EXPANDABLE_BRANCHES 32796 #define ID_TREE_INDICATE_EXPANDABLE_BRANCHES 32796
#define ID_VIEW_TREE_DIRECTORY 32797 #define ID_VIEW_TREE_DIRECTORY 32797
#define ID_VIEW_TREE_ONLY 32798 #define ID_VIEW_TREE_ONLY 32798
@ -121,7 +129,7 @@
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 147 #define _APS_NEXT_RESOURCE_VALUE 148
#define _APS_NEXT_COMMAND_VALUE 32832 #define _APS_NEXT_COMMAND_VALUE 32832
#define _APS_NEXT_CONTROL_VALUE 1007 #define _APS_NEXT_CONTROL_VALUE 1007
#define _APS_NEXT_SYMED_VALUE 110 #define _APS_NEXT_SYMED_VALUE 110

View file

@ -34,10 +34,13 @@
#include <stdio.h> #include <stdio.h>
#endif #endif
#include <shellapi.h>
#include "main.h" #include "main.h"
#include "run.h" #include "run.h"
// Show "Run..." dialog
void OnFileRun(void) void OnFileRun(void)
{ {
HMODULE hShell32; HMODULE hShell32;
@ -45,27 +48,69 @@ void OnFileRun(void)
OSVERSIONINFO versionInfo; OSVERSIONINFO versionInfo;
WCHAR wTitle[40]; WCHAR wTitle[40];
WCHAR wText[256]; WCHAR wText[256];
char szTitle[40] = "Create New Task"; CHAR szTitle[40] = "Create New Task";
char szText[256] = "Type the name of a program, folder, document, or Internet resource, and Task Manager will open it for you."; CHAR szText[256] = "Type the name of a program, folder, document, or Internet resource, and Task Manager will open it for you.";
hShell32 = LoadLibrary("SHELL32.DLL"); hShell32 = LoadLibrary(_T("SHELL32.DLL"));
RunFileDlg = (RUNFILEDLG)(FARPROC)GetProcAddress(hShell32, (char*)((long)0x3D)); RunFileDlg = (RUNFILEDLG)(FARPROC)GetProcAddress(hShell32, (CHAR*)((long)0x3D));
if (RunFileDlg) {
// Show "Run..." dialog
if (RunFileDlg)
{
versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&versionInfo); GetVersionEx(&versionInfo);
if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) {
if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
{
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szTitle, -1, wTitle, 40); MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szTitle, -1, wTitle, 40);
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szText, -1, wText, 256); MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szText, -1, wText, 256);
RunFileDlg(Globals.hMainWnd, 0, NULL, (LPCSTR)wTitle, (LPCSTR)wText, RFF_CALCDIRECTORY); RunFileDlg(Globals.hMainWnd, 0, NULL, (LPCSTR)wTitle, (LPCSTR)wText, RFF_CALCDIRECTORY);
} } else {
else
RunFileDlg(Globals.hMainWnd, 0, NULL, szTitle, szText, RFF_CALCDIRECTORY); RunFileDlg(Globals.hMainWnd, 0, NULL, szTitle, szText, RFF_CALCDIRECTORY);
}
} }
FreeLibrary(hShell32); FreeLibrary(hShell32);
} }
/*
typedef struct _SHELLEXECUTEINFO{
DWORD cbSize;
ULONG fMask;
HWND hwnd;
LPCTSTR lpVerb;
LPCTSTR lpFile;
LPCTSTR lpParameters;
LPCTSTR lpDirectory;
int nShow;
HINSTANCE hInstApp;
// Optional members
LPVOID lpIDList;
LPCSTR lpClass;
HKEY hkeyClass;
DWORD dwHotKey;
union {
HANDLE hIcon;
HANDLE hMonitor;
};
HANDLE hProcess;
} SHELLEXECUTEINFO, *LPSHELLEXECUTEINFO;
*/
BOOL OpenTarget(HWND hWnd, TCHAR* target)
{
BOOL result = FALSE;
SHELLEXECUTEINFO shExecInfo;
memset(&shExecInfo, 0, sizeof(shExecInfo));
shExecInfo.cbSize = sizeof(shExecInfo);
shExecInfo.fMask = 0;
shExecInfo.hwnd = hWnd;
shExecInfo.lpVerb = NULL;
shExecInfo.lpFile = target;
shExecInfo.lpParameters = NULL;
shExecInfo.lpDirectory = NULL;
shExecInfo.nShow = SW_SHOW;
shExecInfo.hInstApp = 0;
result = ShellExecuteEx(&shExecInfo);
return result;
}

View file

@ -37,6 +37,7 @@ extern "C" {
void OnFileRun(void); void OnFileRun(void);
BOOL OpenTarget(HWND hWnd, TCHAR* target);
typedef void (WINAPI *RUNFILEDLG)( typedef void (WINAPI *RUNFILEDLG)(
HWND hwndOwner, HWND hwndOwner,

92
rosapps/winfile/shell.c Normal file
View file

@ -0,0 +1,92 @@
/*
* ReactOS winfile
*
* shell.c
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#endif
#include "main.h"
#include "shell.h"
#include "format.h"
////////////////////////////////////////////////////////////////////////////////
// Global Variables:
//
//DWORD WINAPI SHFormatDrive(HWND hWnd, UINT drive, UINT fmtID, UINT options);
typedef DWORD (WINAPI *SHFormatDrive_Ptr)(HWND, UINT, UINT, UINT);
BOOL CheckShellAvailable(void)
{
HMODULE hShell32;
hShell32 = LoadLibrary(_T("SHELL32.DLL"));
if (hShell32) {
FreeLibrary(hShell32);
}
return (hShell32 != NULL);
}
void FormatDisk(HWND hWnd)
{
// SHFormatDrive(hWnd, 0 /* A: */, SHFMT_ID_DEFAULT, 0);
HMODULE hShell32;
SHFormatDrive_Ptr pSHFormatDrive;
hShell32 = LoadLibrary(_T("SHELL32.DLL"));
if (hShell32) {
pSHFormatDrive = (SHFormatDrive_Ptr)(FARPROC)GetProcAddress(hShell32, "SHFormatDrive");
if (pSHFormatDrive) {
UINT OldMode = SetErrorMode(0); // Get the current Error Mode settings.
SetErrorMode(OldMode & ~SEM_FAILCRITICALERRORS); // Force O/S to handle
pSHFormatDrive(hWnd, 0 /* A: */, SHFMT_ID_DEFAULT, 0);
SetErrorMode(OldMode); // Put it back the way it was.
}
FreeLibrary(hShell32);
}
}
void CopyDisk(HWND hWnd)
{
}
void LabelDisk(HWND hWnd)
{
}
void ModifySharing(HWND hWnd, BOOL create)
{
}

42
rosapps/winfile/shell.h Normal file
View file

@ -0,0 +1,42 @@
/*
* ReactOS Application Debug Routines
*
* shell.h
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __SHELL_H__
#define __SHELL_H__
#ifdef __cplusplus
extern "C" {
#endif
BOOL CheckShellAvailable(void);
void FormatDisk(HWND hWnd);
void CopyDisk(HWND hWnd);
void LabelDisk(HWND hWnd);
void ModifySharing(HWND hWnd, BOOL create);
#ifdef __cplusplus
};
#endif
#endif // __SHELL_H__

View file

@ -3,8 +3,9 @@
// //
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
#include "trace.h" #include "trace.h"
//#include "windows.h"
DeclAssertFile; // Should be added at the begining of each .C/.CPP DeclAssertFile; // Should be added at the begining of each .C/.CPP
@ -18,9 +19,9 @@ DeclAssertFile; // Should be added at the begining of each .C/.CPP
//WINBASEAPI VOID WINAPI DebugBreak(VOID); //WINBASEAPI VOID WINAPI DebugBreak(VOID);
//WINBASEAPI VOID WINAPI OutputDebugStringA(LPCSTR lpOutputString); //WINBASEAPI VOID WINAPI OutputDebugStringA(LPCSTR lpOutputString);
//WINBASEAPI VOID WINAPI OutputDebugStringW(LPCWSTR lpOutputString); //WINBASEAPI VOID WINAPI OutputDebugStringW(LPCWSTR lpOutputString);
void __stdcall DebugBreak(void); //void __stdcall DebugBreak(void);
void __stdcall OutputDebugStringA(char* lpOutputString); //void __stdcall OutputDebugStringA(char* lpOutputString);
void __stdcall OutputDebugStringW(wchar_t* lpOutputString); //void __stdcall OutputDebugStringW(wchar_t* lpOutputString);
#ifdef UNICODE #ifdef UNICODE
#define OutputDebugString OutputDebugStringW #define OutputDebugString OutputDebugStringW
#else #else
@ -40,23 +41,27 @@ void _DebugBreak(void)
DebugBreak(); DebugBreak();
} }
void Trace(char* lpszFormat, ...) void Trace(TCHAR* lpszFormat, ...)
{ {
va_list args; va_list args;
int nBuf; int nBuf;
char szBuffer[512]; TCHAR szBuffer[512];
va_start(args, lpszFormat); va_start(args, lpszFormat);
// nBuf = vsprintf(szBuffer, lpszFormat, args); // nBuf = vsprintf(szBuffer, lpszFormat, args);
// nBuf = _vsntprintf(szBuffer, _countof(szBuffer), lpszFormat, args); // nBuf = _vsntprintf(szBuffer, _countof(szBuffer), lpszFormat, args);
#ifdef _UNICODE
nBuf = _vsnwprintf(szBuffer, sizeof(szBuffer), lpszFormat, args);
#else
nBuf = _vsnprintf(szBuffer, sizeof(szBuffer), lpszFormat, args); nBuf = _vsnprintf(szBuffer, sizeof(szBuffer), lpszFormat, args);
#endif
OutputDebugString(szBuffer); OutputDebugString(szBuffer);
// was there an error? was the expanded string too long? // was there an error? was the expanded string too long?
ASSERT(nBuf >= 0); // ASSERT(nBuf >= 0);
va_end(args); va_end(args);
} }
void Assert(void* assert, char* file, int line, void* msg) void Assert(void* assert, TCHAR* file, int line, void* msg)
{ {
if (msg == NULL) { if (msg == NULL) {
printf("ASSERT -- %s occured on line %u of file %s.\n", printf("ASSERT -- %s occured on line %u of file %s.\n",
@ -70,10 +75,10 @@ void Assert(void* assert, char* file, int line, void* msg)
#else #else
//inline void Trace(char* lpszFormat, ...) { }; //inline void Trace(TCHAR* lpszFormat, ...) { };
//inline void Assert(void* assert, char* file, int line, void* msg) { }; //inline void Assert(void* assert, TCHAR* file, int line, void* msg) { };
void Trace(char* lpszFormat, ...) { }; void Trace(TCHAR* lpszFormat, ...) { };
void Assert(void* assert, char* file, int line, void* msg) { }; void Assert(void* assert, TCHAR* file, int line, void* msg) { };
#endif //_DEBUG #endif //_DEBUG
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View file

@ -43,9 +43,9 @@
// MACRO: TRACE() // MACRO: TRACE()
//============================================================================= //=============================================================================
void Assert(void* assert, char* file, int line, void* msg); void Assert(void* assert, TCHAR* file, int line, void* msg);
void Trace(char* lpszFormat, ...); void Trace(TCHAR* lpszFormat, ...);
void Trace1(int code, char* lpszFormat, ...); void Trace1(int code, TCHAR* lpszFormat, ...);
#define TRACE Trace #define TRACE Trace
#define TRACE0 Trace #define TRACE0 Trace
@ -60,8 +60,8 @@ void Trace1(int code, char* lpszFormat, ...);
//#define TRACE0 TRACE //#define TRACE0 TRACE
//#define TRACE1 TRACE //#define TRACE1 TRACE
void Assert(void* assert, char* file, int line, void* msg); void Assert(void* assert, TCHAR* file, int line, void* msg);
void Trace(char* lpszFormat, ...); void Trace(TCHAR* lpszFormat, ...);
#define TRACE 0 ? (void)0 : Trace #define TRACE 0 ? (void)0 : Trace

View file

@ -75,7 +75,7 @@ int Image_Root;
// lpszItem - text of the item to add. // lpszItem - text of the item to add.
// nLevel - level at which to add the item. // nLevel - level at which to add the item.
HTREEITEM AddItemToTree(HWND hwndTV, LPSTR lpszItem, int nLevel) HTREEITEM AddItemToTree(HWND hwndTV, LPTSTR lpszItem, int nLevel)
{ {
TVITEM tvi; TVITEM tvi;
TVINSERTSTRUCT tvins; TVINSERTSTRUCT tvins;
@ -156,7 +156,7 @@ HTREEITEM AddEntryToTree(HWND hwndTV, Entry* entry)
#if 0 #if 0
hItem = AddItemToTree(hwndTV, entry->data.cFileName, entry->level); hItem = AddItemToTree(hwndTV, entry->data.cFileName, entry->level);
#else #else
//HTREEITEM AddItemToTree(HWND hwndTV, LPSTR lpszItem, int nLevel) //HTREEITEM AddItemToTree(HWND hwndTV, LPTSTR lpszItem, int nLevel)
TVITEM tvi; TVITEM tvi;
TVINSERTSTRUCT tvins; TVINSERTSTRUCT tvins;
static HTREEITEM hPrev = (HTREEITEM)TVI_FIRST; static HTREEITEM hPrev = (HTREEITEM)TVI_FIRST;
@ -335,15 +335,10 @@ static HWND CreateTreeView(HWND hwndParent, int id)
// Get the dimensions of the parent window's client area, and create // Get the dimensions of the parent window's client area, and create
// the tree view control. // the tree view control.
GetClientRect(hwndParent, &rcClient); GetClientRect(hwndParent, &rcClient);
hwndTV = CreateWindowEx(0, WC_TREEVIEW, "Tree View", hwndTV = CreateWindowEx(0, WC_TREEVIEW, _T("Tree View"),
WS_VISIBLE | WS_CHILD | WS_BORDER | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT, WS_VISIBLE | WS_CHILD | WS_BORDER | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT,
0, 0, rcClient.right, rcClient.bottom, 0, 0, rcClient.right, rcClient.bottom,
hwndParent, (HMENU)id, hInst, NULL); hwndParent, (HMENU)id, hInst, NULL);
/*
hwndTV = CreateWindow(_T("ListBox"), _T(""), WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|
LBS_DISABLENOSCROLL|LBS_NOINTEGRALHEIGHT|LBS_OWNERDRAWFIXED|LBS_NOTIFY,
0, 0, 0, 0, parent, (HMENU)id, Globals.hInstance, 0);
*/
// Initialize the image list, and add items to the control. // Initialize the image list, and add items to the control.
if (!InitTreeViewImageLists(hwndTV) || !InitTreeViewItems(hwndTV)) { if (!InitTreeViewImageLists(hwndTV) || !InitTreeViewItems(hwndTV)) {
DestroyWindow(hwndTV); DestroyWindow(hwndTV);
@ -352,10 +347,14 @@ static HWND CreateTreeView(HWND hwndParent, int id)
return hwndTV; return hwndTV;
} }
#ifndef _MSC_VER
#define NMTVDISPINFO TV_DISPINFO
#define NMTVDISPINFO TV_DISPINFO
#endif
static void OnGetDispInfo(NMTVDISPINFO* ptvdi) static void OnGetDispInfo(NMTVDISPINFO* ptvdi)
{ {
static char buffer[200]; // static TCHAR buffer[200];
// LVITEM* pItem = &(ptvdi->item); // LVITEM* pItem = &(ptvdi->item);
// Entry* entry = (Entry*)pItem->lParam; // Entry* entry = (Entry*)pItem->lParam;
Entry* entry = (Entry*)ptvdi->item.lParam; Entry* entry = (Entry*)ptvdi->item.lParam;
@ -397,21 +396,6 @@ If the structure is receiving item text, you typically copy the text to the buff
*/ */
/*
typedef struct _BY_HANDLE_FILE_INFORMATION {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD dwVolumeSerialNumber;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD nNumberOfLinks;
DWORD nFileIndexHigh;
DWORD nFileIndexLow;
} BY_HANDLE_FILE_INFORMATION, *PBY_HANDLE_FILE_INFORMATION;
*/
// OnEndLabelEdit - processes the LVN_ENDLABELEDIT notification message. // OnEndLabelEdit - processes the LVN_ENDLABELEDIT notification message.
// Returns TRUE if the label is changed, or FALSE otherwise. // Returns TRUE if the label is changed, or FALSE otherwise.
@ -432,7 +416,7 @@ static BOOL OnEndLabelEdit(NMTVDISPINFO* ptvdi)
static BOOL OnExpand(int flag, HTREEITEM* pti) static BOOL OnExpand(int flag, HTREEITEM* pti)
{ {
TRACE("TreeWndProc(...) OnExpand()\n"); TRACE(_T("TreeWndProc(...) OnExpand()\n"));
// pnmtv = (NMTREEVIEW) lParam // pnmtv = (NMTREEVIEW) lParam
//TRACE("OnExpand(...) entry name: %s\n", entry->data.cFileName); //TRACE("OnExpand(...) entry name: %s\n", entry->data.cFileName);
/* /*
@ -452,7 +436,7 @@ static BOOL OnExpanding(HWND hWnd, NMTREEVIEW* pnmtv)
//LPARAM parm = pnmtv->itemNew.lParam; //LPARAM parm = pnmtv->itemNew.lParam;
Entry* entry = (Entry*)pnmtv->itemNew.lParam; Entry* entry = (Entry*)pnmtv->itemNew.lParam;
TRACE("TreeWndProc(...) OnExpanding() entry: %p\n", entry); TRACE(_T("TreeWndProc(...) OnExpanding() entry: %p\n"), entry);
if (expanding) return FALSE; if (expanding) return FALSE;
expanding = TRUE; expanding = TRUE;
@ -481,7 +465,7 @@ static LRESULT CALLBACK TreeWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
Pane* pane = (Pane*)GetWindowLong(hWnd, GWL_USERDATA); Pane* pane = (Pane*)GetWindowLong(hWnd, GWL_USERDATA);
ASSERT(child); ASSERT(child);
switch(message) { switch (message) {
#ifndef _NO_EXTENSIONS #ifndef _NO_EXTENSIONS
case WM_HSCROLL: case WM_HSCROLL:
set_header(pane); set_header(pane);
@ -502,6 +486,7 @@ static LRESULT CALLBACK TreeWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
// case TVN_SELCHANGED: // case TVN_SELCHANGED:
// return OnSelChanged((NMTREEVIEW*)lParam); // return OnSelChanged((NMTREEVIEW*)lParam);
// break; // break;
#if 0
case TVN_SINGLEEXPAND: case TVN_SINGLEEXPAND:
TRACE("TreeWndProc(...) TVN_SINGLEEXPAND\n"); TRACE("TreeWndProc(...) TVN_SINGLEEXPAND\n");
//lpnmtv = (LPNMTREEVIEW)lParam; //lpnmtv = (LPNMTREEVIEW)lParam;
@ -509,10 +494,12 @@ static LRESULT CALLBACK TreeWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
// return TVNRET_SKIPOLD; // Skip default processing of the item being unselected. // return TVNRET_SKIPOLD; // Skip default processing of the item being unselected.
// return TVNRET_SKIPNEW; // Skip default processing of the item being selected. // return TVNRET_SKIPNEW; // Skip default processing of the item being selected.
break; break;
#endif
case TVN_ENDLABELEDIT: case TVN_ENDLABELEDIT:
return OnEndLabelEdit((NMTVDISPINFO*)lParam); return OnEndLabelEdit((NMTVDISPINFO*)lParam);
break; break;
} }
return 0;
break; break;
case WM_SETFOCUS: case WM_SETFOCUS:
child->nFocusPanel = pane == &child->right? 1: 0; child->nFocusPanel = pane == &child->right? 1: 0;
@ -529,7 +516,7 @@ static LRESULT CALLBACK TreeWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
return CallWindowProc(g_orgTreeWndProc, hWnd, message, wParam, lParam); return CallWindowProc(g_orgTreeWndProc, hWnd, message, wParam, lParam);
} }
//void create_tree_window(HWND parent, Pane* pane, int id, int id_header, LPSTR lpszFileName) //void create_tree_window(HWND parent, Pane* pane, int id, int id_header, LPTSTR lpszFileName)
void CreateTreeWnd(HWND parent, Pane* pane, int id) void CreateTreeWnd(HWND parent, Pane* pane, int id)
{ {
static int s_init = 0; static int s_init = 0;

View file

@ -31,17 +31,10 @@ extern "C" {
#pragma once #pragma once
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000
#include "resource.h"
void CreateTreeWnd(HWND parent, Pane* pane, int id); void CreateTreeWnd(HWND parent, Pane* pane, int id);
HTREEITEM AddItemToTree(HWND hwndTV, LPSTR lpszItem, int nLevel); HTREEITEM AddItemToTree(HWND hwndTV, LPTSTR lpszItem, int nLevel);
//HWND CreateTreeView(HWND hwndParent);
//void create_tree_window(HWND parent, Pane* pane, int id, int id_header);
//LRESULT CALLBACK TreeWndProc(HWND, UINT, WPARAM, LPARAM);
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -35,8 +35,10 @@
#endif #endif
#include <windowsx.h> #include <windowsx.h>
#include <ctype.h>
#include "main.h" #include "main.h"
#include "listview.h"
#include "utils.h" #include "utils.h"
#include "sort.h" #include "sort.h"
#include "draw.h" #include "draw.h"
@ -361,13 +363,13 @@ BOOL calc_widths(Pane* pane, BOOL anyway)
hfontOld = SelectFont(hdc, Globals.hFont); hfontOld = SelectFont(hdc, Globals.hFont);
for (cnt = 0; cnt < entries; cnt++) { for (cnt = 0; cnt < entries; cnt++) {
#if 0
Entry* entry = (Entry*) ListBox_GetItemData(pane->hWnd, cnt); Entry* entry = (Entry*) ListBox_GetItemData(pane->hWnd, cnt);
DRAWITEMSTRUCT dis = {0/*CtlType*/, 0/*CtlID*/, DRAWITEMSTRUCT dis = {0/*CtlType*/, 0/*CtlID*/,
0/*itemID*/, 0/*itemAction*/, 0/*itemState*/, 0/*itemID*/, 0/*itemAction*/, 0/*itemState*/,
pane->hWnd/*hwndItem*/, hdc}; pane->hWnd/*hwndItem*/, hdc};
draw_item(pane, &dis, entry, COLUMNS); draw_item(pane, &dis, entry, COLUMNS);
#endif
} }
SelectObject(hdc, hfontOld); SelectObject(hdc, hfontOld);
ReleaseDC(pane->hWnd, hdc); ReleaseDC(pane->hWnd, hdc);
@ -418,9 +420,11 @@ void calc_single_width(Pane* pane, int col)
hdc = GetDC(pane->hWnd); hdc = GetDC(pane->hWnd);
hfontOld = SelectFont(hdc, Globals.hFont); hfontOld = SelectFont(hdc, Globals.hFont);
for (cnt = 0; cnt < entries; cnt++) { for (cnt = 0; cnt < entries; cnt++) {
#if 0
Entry* entry = (Entry*) ListBox_GetItemData(pane->hWnd, cnt); Entry* entry = (Entry*) ListBox_GetItemData(pane->hWnd, cnt);
DRAWITEMSTRUCT dis = {0, 0, 0, 0, 0, pane->hWnd, hdc}; DRAWITEMSTRUCT dis = {0, 0, 0, 0, 0, pane->hWnd, hdc};
draw_item(pane, &dis, entry, col); draw_item(pane, &dis, entry, col);
#endif
} }
SelectObject(hdc, hfontOld); SelectObject(hdc, hfontOld);
ReleaseDC(pane->hWnd, hdc); ReleaseDC(pane->hWnd, hdc);

View file

@ -56,9 +56,9 @@ IDC_WINFILE MENU DISCARDABLE
BEGIN BEGIN
POPUP "&File" POPUP "&File"
BEGIN BEGIN
MENUITEM "&Open\tEnter", ID_FILE_OPEN, GRAYED MENUITEM "&Open\tEnter", ID_FILE_OPEN
MENUITEM "&Move...\tF8", ID_FILE_MOVE MENUITEM "&Move...\tF7", ID_FILE_MOVE
MENUITEM "&Copy...\tF9", ID_FILE_COPY, GRAYED MENUITEM "&Copy...\tF8", ID_FILE_COPY, GRAYED
MENUITEM "Copy to Clip&board...\tF9", ID_FILE_COPY_CLIPBOARD MENUITEM "Copy to Clip&board...\tF9", ID_FILE_COPY_CLIPBOARD
, GRAYED , GRAYED
MENUITEM "&Delete...\tDel", ID_FILE_DELETE, GRAYED MENUITEM "&Delete...\tDel", ID_FILE_DELETE, GRAYED
@ -87,7 +87,10 @@ BEGIN
MENUITEM "&Format Disk..\t", ID_DISK_FORMAT_DISK MENUITEM "&Format Disk..\t", ID_DISK_FORMAT_DISK
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Connect &Network Drive...", ID_DISK_CONNECT_NETWORK_DRIVE MENUITEM "Connect &Network Drive...", ID_DISK_CONNECT_NETWORK_DRIVE
MENUITEM "&Disconnect Network Drive...",ID_DISK_DISCONNECT_NETWORK_DRIVE
MENUITEM "&Disconnect Network Drive...",
ID_DISK_DISCONNECT_NETWORK_DRIVE
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Share &As...", ID_DISK_SHARE_AS, GRAYED MENUITEM "Share &As...", ID_DISK_SHARE_AS, GRAYED
MENUITEM "S&top Sharing...", ID_DISK_STOP_SHARING, GRAYED MENUITEM "S&top Sharing...", ID_DISK_STOP_SHARING, GRAYED
@ -99,10 +102,12 @@ BEGIN
MENUITEM "E&xpand One Level\t+", ID_TREE_EXPAND_ONE_LEVEL MENUITEM "E&xpand One Level\t+", ID_TREE_EXPAND_ONE_LEVEL
MENUITEM "Expand &Branch\t*", ID_TREE_EXPAND_BRANCH MENUITEM "Expand &Branch\t*", ID_TREE_EXPAND_BRANCH
MENUITEM "Expand &All\tCtrl+*", ID_TREE_EXPAND_ALL MENUITEM "Expand &All\tCtrl+*", ID_TREE_EXPAND_ALL
MENUITEM "Collapse Branch\t-", ID_TREE_COLLAPSE_BRANCH
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Indicate Expandable Branches", MENUITEM "&Indicate Expandable Branches",
ID_TREE_INDICATE_EXPANDABLE_BRANCHES ID_TREE_INDICATE_EXPANDABLE_BRANCHES
, CHECKED, GRAYED
END END
POPUP "&View" POPUP "&View"
BEGIN BEGIN
@ -114,8 +119,9 @@ BEGIN
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Sp&lit", ID_VIEW_SPLIT, GRAYED MENUITEM "Sp&lit", ID_VIEW_SPLIT, GRAYED
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Name", ID_VIEW_NAME MENUITEM "&Name", ID_VIEW_NAME, GRAYED
MENUITEM "&All File Details", ID_VIEW_ALL_FILE_DETAILS MENUITEM "&All File Details", ID_VIEW_ALL_FILE_DETAILS
, CHECKED, GRAYED
MENUITEM "&Partial Details...", ID_VIEW_PARTIAL_DETAILS MENUITEM "&Partial Details...", ID_VIEW_PARTIAL_DETAILS
, GRAYED , GRAYED
MENUITEM SEPARATOR MENUITEM SEPARATOR
@ -131,7 +137,6 @@ BEGIN
MENUITEM "&Confirmation...", ID_OPTIONS_CONFIRMATION MENUITEM "&Confirmation...", ID_OPTIONS_CONFIRMATION
MENUITEM "&Font...", ID_OPTIONS_FONT, GRAYED MENUITEM "&Font...", ID_OPTIONS_FONT, GRAYED
MENUITEM "Customise Tool&bar...", ID_OPTIONS_CUSTOMISE_TOOLBAR MENUITEM "Customise Tool&bar...", ID_OPTIONS_CUSTOMISE_TOOLBAR
, GRAYED
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Toolbar", ID_OPTIONS_TOOLBAR MENUITEM "&Toolbar", ID_OPTIONS_TOOLBAR
MENUITEM "&Drivebar", ID_OPTIONS_DRIVEBAR MENUITEM "&Drivebar", ID_OPTIONS_DRIVEBAR
@ -160,10 +165,9 @@ BEGIN
END END
POPUP "&Help" POPUP "&Help"
BEGIN BEGIN
MENUITEM "&Contents", ID_HELP_CONTENTS, GRAYED MENUITEM "&Contents", ID_HELP_CONTENTS
MENUITEM "&Search for Help on...", ID_HELP_SEARCH_HELP, GRAYED MENUITEM "&Search for Help on...", ID_HELP_SEARCH_HELP
MENUITEM "&How to Use Help", ID_HELP_HOW_TO_USE_HELP MENUITEM "&How to Use Help", ID_HELP_HOW_TO_USE_HELP
, GRAYED
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&About File Manager", ID_HELP_ABOUT MENUITEM "&About File Manager", ID_HELP_ABOUT
END END
@ -219,6 +223,7 @@ END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
IDS_LIST_COLUMN_DOSNAME "DOS-Name"
IDS_APP_TITLE "ReactOS File Manager" IDS_APP_TITLE "ReactOS File Manager"
IDC_WINFILE "ROSFILE" IDC_WINFILE "ROSFILE"
IDC_WINFILE_CHILD "ROSFILE_CHILD" IDC_WINFILE_CHILD "ROSFILE_CHILD"
@ -269,6 +274,7 @@ BEGIN
ID_TREE_EXPAND_ONE_LEVEL "Displays another level of a directory" ID_TREE_EXPAND_ONE_LEVEL "Displays another level of a directory"
ID_TREE_EXPAND_BRANCH "Displays all levels of a directory" ID_TREE_EXPAND_BRANCH "Displays all levels of a directory"
ID_TREE_EXPAND_ALL "Displays all levels of all directories" ID_TREE_EXPAND_ALL "Displays all levels of all directories"
ID_TREE_COLLAPSE_BRANCH "Collapses all directories of the selected directory"
ID_TREE_INDICATE_EXPANDABLE_BRANCHES ID_TREE_INDICATE_EXPANDABLE_BRANCHES
"Indicates directories that have sub-directories" "Indicates directories that have sub-directories"
ID_VIEW_TREE_DIRECTORY "Displays the directory tree and the contents of the current directory" ID_VIEW_TREE_DIRECTORY "Displays the directory tree and the contents of the current directory"
@ -321,8 +327,8 @@ BEGIN
IDS_LIST_COLUMN_NAME "Name" IDS_LIST_COLUMN_NAME "Name"
IDS_LIST_COLUMN_SIZE "Size" IDS_LIST_COLUMN_SIZE "Size"
IDS_LIST_COLUMN_DATE "Date" IDS_LIST_COLUMN_DATE "Date"
IDS_LIST_COLUMN_TIME "Time"
IDS_LIST_COLUMN_ATTRIB "Attributes" IDS_LIST_COLUMN_ATTRIB "Attributes"
IDS_LIST_COLUMN_DOSNAME "DOS-Name"
END END
#endif // English (U.S.) resources #endif // English (U.S.) resources
@ -470,6 +476,77 @@ END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "0c0904b0"
BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "None\0"
VALUE "FileDescription", "winfile\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "winfile\0"
VALUE "LegalCopyright", "Copyright © 2002\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "winfile.exe\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "None winfile\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0xc09, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_ACCELERATOR1 ACCELERATORS DISCARDABLE
BEGIN
"+", ID_DISK_SELECT_DRIVE, ASCII, NOINVERT
"+", ID_TREE_EXPAND_ONE_LEVEL, ASCII, NOINVERT
"-", ID_TREE_EXPAND_ALL, ASCII, NOINVERT
"8", ID_TREE_EXPAND_BRANCH, VIRTKEY, SHIFT, NOINVERT
VK_DELETE, ID_FILE_DELETE, VIRTKEY, NOINVERT
VK_F4, ID_WINDOW_TILE_VERT, VIRTKEY, SHIFT, NOINVERT
VK_F5, ID_WINDOW_REFRESH, VIRTKEY, NOINVERT
VK_F5, ID_WINDOW_CASCADE, VIRTKEY, SHIFT, NOINVERT
VK_F7, ID_FILE_MOVE, VIRTKEY, NOINVERT
VK_F8, ID_FILE_COPY, VIRTKEY, NOINVERT
VK_F9, ID_FILE_COPY_CLIPBOARD, VIRTKEY, NOINVERT
VK_MULTIPLY, ID_TREE_EXPAND_BRANCH, VIRTKEY, CONTROL, NOINVERT
VK_RETURN, ID_FILE_OPEN, VIRTKEY, NOINVERT
VK_RETURN, ID_FILE_PROPERTIES, VIRTKEY, ALT, NOINVERT
VK_SUBTRACT, ID_TREE_EXPAND_ALL, VIRTKEY, NOINVERT
END
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// String Table // String Table