Removed modules to go into shell32. New control panel launcher based on same wine program.

svn path=/trunk/; revision=3340
This commit is contained in:
Robert Dickenson 2002-08-17 15:16:38 +00:00
parent 6130c02167
commit 9baabd888d
11 changed files with 229 additions and 1300 deletions

View file

@ -1,64 +1,29 @@
# # $Id: Makefile,v 1.2 2002/08/17 15:16:38 robd Exp $
# ReactOS control
#
# Makefile
#
# 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.
#
PATH_TO_TOP = ..
TARGET = control PATH_TO_TOP = ../../reactos
BASE_CFLAGS = -DGCC -D_WIN32_IE=0x0400 -DUNICODE -D_UNICODE TOOLS_PATH = $(PATH_TO_TOP)/tools
RCFLAGS = -DGCC -D_WIN32_IE=0x0400 TARGET_NORC = yes
TARGET_TYPE = program
OBJS = framewnd.o \ TARGET_APPTYPE = windows
listview.o \
main.o
LIBS = -lgdi32 -luser32 -lkernel32 -lcomctl32 TARGET_NAME = control
all: $(TARGET).exe TARGET_SDKLIBS = roshel32.a
$(TARGET).res: $(TARGET).rc TARGET_OBJECTS = $(TARGET_NAME).o
$(TARGET).exe: $(OBJS) $(TARGET).coff TARGET_CLEAN = $(TARGET_OBJECTS)
$(CC) -Wl,--subsystem,windows -o $(TARGET).exe $(OBJS) $(TARGET).coff $(LIBS)
$(NM) --numeric-sort $(TARGET).exe > $(TARGET).sym
main.h: resource.h
main.o: main.c main.h framewnd.h
framewnd.o: framewnd.c framewnd.h listview.h main.h
listview.o: listview.c listview.h main.h
about.o: about.c about.h main.h
clean:
- $(RM) $(OBJS)
- $(RM) $(TARGET).exe
- $(RM) $(TARGET).sym
- $(RM) $(TARGET).coff
include $(PATH_TO_TOP)/rules.mak include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
MK_CFLAGS = -D_UNICODE -DUNICODE
MK_CPPFLAGS = -D_UNICODE -DUNICODE
MK_RCFLAGS = -D_UNICODE -DUNICODE
# EOF

116
rosapps/control/control.c Normal file
View file

@ -0,0 +1,116 @@
/*
* Control
* Copyright (C) 1998 by Marcel Baur <mbaur@g26.ethz.ch>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* Portions copyright Robert Dickenson <robd@reactos.org>, August 15, 2002.
*/
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdlib.h>
#include <tchar.h>
#include "params.h"
//typedef void (WINAPI *CONTROL_RUNDLL)(HWND hWnd, HINSTANCE hInst, LPCTSTR cmd, DWORD nCmdShow);
typedef void (*CONTROL_RUNDLL)(HWND hWnd, HINSTANCE hInst, LPCTSTR cmd, DWORD nCmdShow);
const TCHAR szLibName[] = _T("ROSHEL32.DLL");
#ifdef UNICODE
const char szProcName[] = "Control_RunDLLW";
#else
const char szProcName[] = "Control_RunDLLA";
#endif
#ifndef __GNUC__
#ifdef UNICODE
extern void __declspec(dllimport) Control_RunDLLW(HWND hWnd, HINSTANCE hInst, LPCWSTR cmd, DWORD nCmdShow);
#else
extern void __declspec(dllimport) Control_RunDLLA(HWND hWnd, HINSTANCE hInst, LPCSTR cmd, DWORD nCmdShow);
#endif
#endif
#ifdef UNICODE
#define Control_RunDLL Control_RunDLLW
#else
#define Control_RunDLL Control_RunDLLA
#endif
void launch(LPTSTR lpCmdLine)
{
#if 0
HMODULE hShell32;
CONTROL_RUNDLL pControl_RunDLL;
hShell32 = LoadLibrary(szLibName);
if (hShell32) {
pControl_RunDLL = (CONTROL_RUNDLL)(FARPROC)GetProcAddress(hShell32, szProcName);
if (pControl_RunDLL) {
pControl_RunDLL(GetDesktopWindow(), 0, lpCmdLine, SW_SHOW);
} else {
_tprintf(_T("ERROR: failed to Get Procedure Address for %s in Library %s\n"), szLibName, szProcName);
}
FreeLibrary(hShell32);
} else {
_tprintf(_T("ERROR: failed to Load Library %s\n"), szLibName);
}
#else
Control_RunDLL(GetDesktopWindow(), 0, lpCmdLine, SW_SHOW);
#endif
exit(0);
}
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, CHAR *szParam, INT argc)
{
TCHAR szParams[255];
LPTSTR pParams = GetCommandLine();
lstrcpy(szParams, pParams);
CharUpper(szParams);
_tprintf(_T("Control Panel Launcher...\n"));
switch (--argc) {
case 0: /* no parameters - pop up whole "Control Panel" by default */
launch(_T(""));
break;
case 1: /* check for optional parameter */
if (!lstrcmp(szParams,szP_DESKTOP))
launch(szC_DESKTOP);
if (!lstrcmp(szParams,szP_COLOR))
launch(szC_COLOR);
if (!lstrcmp(szParams,szP_DATETIME))
launch(szC_DATETIME);
if (!lstrcmp(szParams,szP_DESKTOP))
launch(szC_DESKTOP);
if (!lstrcmp(szParams,szP_INTERNATIONAL))
launch(szC_INTERNATIONAL);
if (!lstrcmp(szParams,szP_KEYBOARD))
launch(szC_KEYBOARD);
if (!lstrcmp(szParams,szP_MOUSE))
launch(szC_MOUSE);
if (!lstrcmp(szParams,szP_PORTS))
launch(szC_PORTS);
if (!lstrcmp(szParams,szP_PRINTERS))
launch(szC_PRINTERS);
/* try to launch if a .cpl file is given directly */
launch(szParams);
break;
default: _tprintf(_T("Syntax error."));
}
return 0;
}

View file

@ -1,6 +1,5 @@
#include <defines.h> //Microsoft Developer Studio generated resource script.
#include <reactos/resource.h> //
#include "resource.h" #include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS #define APSTUDIO_READONLY_SYMBOLS
@ -11,98 +10,26 @@
#define APSTUDIO_HIDDEN_SYMBOLS #define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h" #include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS #undef APSTUDIO_HIDDEN_SYMBOLS
#include "resource.h"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS #undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32 #ifdef _WIN32
LANGUAGE 9, 1 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252) #pragma code_page(1252)
#endif //_WIN32 #endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_CONTROL ICON DISCARDABLE "res/control.ico"
IDI_SMALL ICON DISCARDABLE "res/small.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_CONTROL_MENU MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "E&xit", ID_FILE_EXIT
END
POPUP "&View"
BEGIN
MENUITEM "Status &Bar", ID_VIEW_STATUSBAR
MENUITEM SEPARATOR
MENUITEM "Lar&ge Icons", ID_VIEW_LARGE_ICONS
MENUITEM "S&mall Icons", ID_VIEW_SMALL_ICONS
MENUITEM "&List", ID_VIEW_LIST
MENUITEM "&Details", ID_VIEW_DETAILS
MENUITEM SEPARATOR
MENUITEM "&Refresh\tF5", ID_VIEW_REFRESH
END
POPUP "&Help"
BEGIN
MENUITEM "&About ...", ID_HELP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDC_CONTROL ACCELERATORS MOVEABLE PURE
BEGIN
"?", ID_HELP_ABOUT, ASCII, ALT
"/", ID_HELP_ABOUT, ASCII, ALT
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 230, 75
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
CAPTION "About Control Panel"
FONT 8, "System"
BEGIN
ICON IDI_CONTROL,IDC_MYICON,14,9,16,16
LTEXT "Control Panel Version 1.0",IDC_STATIC,49,10,119,8,SS_NOPREFIX
LTEXT "Copyright (C) 2002",IDC_STATIC,49,20,119,8
DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP
END
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// TEXTINCLUDE // TEXTINCLUDE
// //
2 TEXTINCLUDE DISCARDABLE 2 TEXTINCLUDE DISCARDABLE
BEGIN BEGIN
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n" "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
@ -121,14 +48,15 @@ END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
#ifndef _MAC
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Version // Version
// //
VS_VERSION_INFO VERSIONINFO (1) VERSIONINFO
FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD FILEVERSION 0,0,19,162
PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD PRODUCTVERSION 0,0,19,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -144,7 +72,7 @@ BEGIN
BLOCK "040904b0" BLOCK "040904b0"
BEGIN BEGIN
VALUE "Comments", "Absolutely no warranties whatsoever - Use at your own risk\0" VALUE "Comments", "Absolutely no warranties whatsoever - Use at your own risk\0"
VALUE "CompanyName", RES_STR_COMPANY_NAME VALUE "CompanyName", "ReactOS Development Team\0"
VALUE "FileDescription", "ReactOS Control Panel by Robert Dickenson\0" VALUE "FileDescription", "ReactOS Control Panel by Robert Dickenson\0"
VALUE "FileVersion", "1, 0, 0, 1\0" VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "control\0" VALUE "InternalName", "control\0"
@ -152,8 +80,8 @@ BEGIN
VALUE "LegalTrademarks", "\0" VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "control.exe\0" VALUE "OriginalFilename", "control.exe\0"
VALUE "PrivateBuild", "\0" VALUE "PrivateBuild", "\0"
VALUE "ProductName", RES_STR_PRODUCT_NAME VALUE "ProductName", "ReactOS Operating System\0"
VALUE "ProductVersion", RES_STR_PRODUCT_VERSION VALUE "ProductVersion", "0.0.19\0"
VALUE "SpecialBuild", "Non-versioned Development Beta Release\0" VALUE "SpecialBuild", "Non-versioned Development Beta Release\0"
END END
END END
@ -163,6 +91,8 @@ BEGIN
END END
END END
#endif // !_MAC
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
@ -171,18 +101,37 @@ END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
IDS_LIST_COLUMN_NAME "Name" IDS_APP_TITLE "ReactOS Control Panel"
IDS_LIST_COLUMN_COMMENT "Comment" IDC_CONTROL "CONTROL"
IDS_LIST_COLUMN_VERSION "Version"
END END
STRINGTABLE DISCARDABLE #endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (Australia) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENA)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN BEGIN
IDC_CONTROL "CONTROL" "resource.h\0"
IDS_APP_TITLE "ReactOS Control Panel"
END END
#endif #endif // APSTUDIO_INVOKED
#endif // English (Australia) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View file

@ -1,293 +0,0 @@
/*
* ReactOS control
*
* 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.
*/
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#include "main.h"
//#include "about.h"
#include "framewnd.h"
#include "listview.h"
#include <shellapi.h>
////////////////////////////////////////////////////////////////////////////////
// Global and Local Variables:
//
static BOOL bInMenuLoop = FALSE; // Tells us if we are in the menu loop
static HWND hListWnd;
static DWORD dwListStyle;
////////////////////////////////////////////////////////////////////////////////
// Local module support methods
//
static void resize_frame_rect(HWND hWnd, PRECT prect)
{
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)) {
SetupStatusBar(hWnd, TRUE);
GetClientRect(hStatusBar, &rt);
prect->bottom -= rt.bottom;
}
MoveWindow(hListWnd, prect->left, prect->top, prect->right, prect->bottom, TRUE);
}
void resize_frame_client(HWND hWnd)
{
RECT rect;
GetClientRect(hWnd, &rect);
resize_frame_rect(hWnd, &rect);
}
////////////////////////////////////////////////////////////////////////////////
static 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(""));
}
static void OnExitMenuLoop(HWND hWnd)
{
bInMenuLoop = FALSE;
// Update the status bar pane sizes
SetupStatusBar(hWnd, TRUE);
UpdateStatusBar();
}
static void OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
{
TCHAR str[100];
_tcscpy(str, _T(""));
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);
}
void SetupStatusBar(HWND hWnd, BOOL bResize)
{
RECT rc;
int nParts;
GetClientRect(hWnd, &rc);
nParts = rc.right;
// nParts = -1;
if (bResize)
SendMessage(hStatusBar, WM_SIZE, 0, 0);
SendMessage(hStatusBar, SB_SETPARTS, 1, (LPARAM)&nParts);
}
void UpdateStatusBar(void)
{
TCHAR text[260];
DWORD size;
size = sizeof(text)/sizeof(TCHAR);
GetComputerName(text, &size);
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)text);
}
static void toggle_child(HWND hWnd, UINT cmd, HWND hchild)
{
BOOL vis = IsWindowVisible(hchild);
HMENU hMenuView = GetSubMenu(hMenuFrame, ID_VIEW_MENU);
CheckMenuItem(hMenuView, cmd, vis?MF_BYCOMMAND:MF_BYCOMMAND|MF_CHECKED);
ShowWindow(hchild, vis?SW_HIDE:SW_SHOW);
resize_frame_client(hWnd);
}
static void OnPaint(HWND hWnd)
{
PAINTSTRUCT ps;
RECT rt;
HDC hdc;
GetClientRect(hWnd, &rt);
hdc = BeginPaint(hWnd, &ps);
FillRect(ps.hdc, &rt, GetStockObject(LTGRAY_BRUSH));
EndPaint(hWnd, &ps);
}
static void SetListSytle(WORD view)
{
HMENU hMenuView = GetSubMenu(hMenuFrame, ID_VIEW_MENU);
dwListStyle = GetWindowLong(hListWnd, GWL_STYLE);
dwListStyle &= ~(LVS_ICON | LVS_SMALLICON | LVS_LIST | LVS_REPORT);
switch (view) {
case ID_VIEW_LARGE_ICONS:
dwListStyle |= LVS_ICON;
break;
case ID_VIEW_SMALL_ICONS:
dwListStyle |= LVS_SMALLICON;
break;
case ID_VIEW_LIST:
dwListStyle |= LVS_LIST;
break;
case ID_VIEW_DETAILS:
default:
dwListStyle |= LVS_REPORT;
break;
}
SetWindowLong(hListWnd, GWL_STYLE, dwListStyle);
CheckMenuItem(hMenuView, ID_VIEW_LARGE_ICONS, MF_BYCOMMAND);
CheckMenuItem(hMenuView, ID_VIEW_SMALL_ICONS, MF_BYCOMMAND);
CheckMenuItem(hMenuView, ID_VIEW_LIST, MF_BYCOMMAND);
CheckMenuItem(hMenuView, ID_VIEW_DETAILS, MF_BYCOMMAND);
CheckMenuItem(hMenuView, view, MF_BYCOMMAND|MF_CHECKED);
}
////////////////////////////////////////////////////////////////////////////////
//
// 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)
{
switch (LOWORD(wParam)) {
// Parse the menu selections:
case ID_FILE_EXIT:
DestroyWindow(hWnd);
break;
case ID_VIEW_REFRESH:
RefreshListView(hListWnd, NULL);
break;
case ID_VIEW_LARGE_ICONS:
case ID_VIEW_SMALL_ICONS:
case ID_VIEW_LIST:
case ID_VIEW_DETAILS:
SetListSytle(LOWORD(wParam));
break;
case ID_VIEW_STATUSBAR:
toggle_child(hWnd, LOWORD(wParam), hStatusBar);
break;
case ID_HELP_ABOUT:
#ifdef WINSHELLAPI
ShellAbout(hWnd, szTitle, _T(""), LoadIcon(hInst, (LPCTSTR)IDI_CONTROL));
#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_DESTROY - post a quit message and return
//
//
LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static ChildWnd* pChildWnd = NULL;
switch (message) {
case WM_CREATE:
// pChildWnd = (ChildWnd*)((LPCREATESTRUCT)lParam)->lpCreateParams;
// ASSERT(pChildWnd);
// pChildWnd->nSplitPos = 250;
// pChildWnd->hTreeWnd = CreateTreeView(hWnd, pChildWnd->szPath, TREE_WINDOW);
// pChildWnd->hListWnd = CreateListView(hWnd, LIST_WINDOW/*, pChildWnd->szPath*/);
if (dwListStyle == 0) dwListStyle |= LVS_REPORT;
hListWnd = CreateListView(hWnd, LIST_WINDOW, dwListStyle/*, pChildWnd->szPath*/);
break;
case WM_COMMAND:
if (!_CmdWndProc(hWnd, message, wParam, lParam)) {
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_PAINT:
OnPaint(hWnd);
return 0;
case WM_SIZE:
resize_frame_client(hWnd);
break;
case WM_TIMER:
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:
if (pChildWnd) {
free(pChildWnd);
pChildWnd = NULL;
}
WinHelp(hWnd, _T("control"), HELP_QUIT, 0);
PostQuitMessage(0);
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}

View file

@ -1,45 +0,0 @@
/*
* 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
LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM);
void SetupStatusBar(HWND hWnd, BOOL bResize);
void UpdateStatusBar(void);
#ifdef __cplusplus
};
#endif
#endif // __FRAMEWND_H__

View file

@ -1,494 +0,0 @@
/*
* ReactOS control
*
* 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.
*/
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <cpl.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#include <windowsx.h>
#include "main.h"
#include "listview.h"
#include "assert.h"
////////////////////////////////////////////////////////////////////////////////
// Global and Local Variables:
//
static WNDPROC g_orgListWndProc;
#define MAX_LIST_COLUMNS (IDS_LIST_COLUMN_LAST - IDS_LIST_COLUMN_FIRST + 1)
static int default_column_widths[MAX_LIST_COLUMNS] = { 250, 500, 75 };
static int column_alignment[MAX_LIST_COLUMNS] = { LVCFMT_LEFT, LVCFMT_LEFT, LVCFMT_LEFT };
////////////////////////////////////////////////////////////////////////////////
// Local module support methods
//
static void AddEntryToList(HWND hwndLV, LPTSTR Name, HMODULE hModule, LPTSTR pszComment, int nImage)
{
LVITEM item;
int index;
item.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
item.iItem = 0;//idx;
item.iSubItem = 0;
item.state = 0;
item.stateMask = 0;
item.pszText = Name;
item.cchTextMax = _tcslen(item.pszText);
if (item.cchTextMax == 0)
item.pszText = LPSTR_TEXTCALLBACK;
item.iImage = nImage;
item.lParam = (LPARAM)hModule;
#if (_WIN32_IE >= 0x0300)
item.iIndent = 0;
#endif
index = ListView_InsertItem(hwndLV, &item);
if (index != -1 && pszComment != NULL) {
ListView_SetItemText(hwndLV, index, 1, pszComment);
}
}
static void CreateListColumns(HWND hwndLV)
{
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, 50);
if (ListView_InsertColumn(hwndLV, index, &lvC) == -1) {
// TODO: handle failure condition...
break;
}
}
}
// InitListViewImageLists - creates image lists for a list view control.
// This function only creates image lists. It does not insert the
// items into the control, which is necessary for the control to be
// visible.
// Returns TRUE if successful, or FALSE otherwise.
// hwndLV - handle to the list view control.
BOOL InitListViewImageLists(HWND hwndLV)
{
HICON hiconItem; // icon for list view items
HIMAGELIST hLarge; // image list for icon view
HIMAGELIST hSmall; // image list for other views
// Create the full-sized icon image lists.
hLarge = ImageList_Create(GetSystemMetrics(SM_CXICON),
GetSystemMetrics(SM_CYICON), ILC_MASK, 1, 1);
hSmall = ImageList_Create(GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON), ILC_MASK, 1, 1);
// Add an icon to each image list.
// hiconItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ITEM));
hiconItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONTROL));
ImageList_AddIcon(hLarge, hiconItem);
ImageList_AddIcon(hSmall, hiconItem);
DestroyIcon(hiconItem);
/*********************************************************
Usually you have multiple icons; therefore, the previous
four lines of code can be inside a loop. The following code
shows such a loop. The icons are defined in the application's
header file as resources, which are numbered consecutively
starting with IDS_FIRSTICON. The number of icons is
defined in the header file as C_ICONS.
for(index = 0; index < C_ICONS; index++) {
hIconItem = LoadIcon (hInst, MAKEINTRESOURCE (IDS_FIRSTICON + index));
ImageList_AddIcon(hSmall, hIconItem);
ImageList_AddIcon(hLarge, hIconItem);
Destroy(hIconItem);
}
*********************************************************/
// Assign the image lists to the list view control.
ListView_SetImageList(hwndLV, hLarge, LVSIL_NORMAL);
ListView_SetImageList(hwndLV, hSmall, LVSIL_SMALL);
return TRUE;
}
typedef LONG (WINAPI *CPlApplet_Ptr)(HWND, UINT, LONG, LONG);
/*
LONG CPlApplet(
HWND hwndCPl,
UINT uMsg,
LONG lParam1,
LONG lParam2
);
*/
static BOOL InitCPlApplet(HWND hwndLV, HMODULE hCpl)
{
if (hwndLV && hCpl) {
CPlApplet_Ptr pCPlApplet;
pCPlApplet = (CPlApplet_Ptr)(FARPROC)GetProcAddress(hCpl, "CPlApplet");
if (pCPlApplet) {
if (pCPlApplet(hwndLV, CPL_INIT, 0, 0)) {
int nSubProgs = pCPlApplet(hwndLV, CPL_GETCOUNT, 0, 0);
while (nSubProgs && nSubProgs--) {
CPLINFO cplInfo;
memset(&cplInfo, 0, sizeof(CPLINFO));
pCPlApplet(hwndLV, CPL_INQUIRE, nSubProgs, (LPARAM)&cplInfo);
if (cplInfo.idName == CPL_DYNAMIC_RES) {
#if UNICODE
NEWCPLINFO cplNewInfo;
memset(&cplNewInfo, 0, sizeof(NEWCPLINFO));
cplNewInfo.dwSize = sizeof(NEWCPLINFO);
pCPlApplet(hwndLV, CPL_NEWINQUIRE, nSubProgs, (LPARAM)&cplNewInfo);
AddEntryToList(hwndLV, cplNewInfo.szName, hCpl, cplNewInfo.szInfo, 0);
#endif
} else {
TCHAR NameBuf[MAX_PATH];
TCHAR InfoBuf[MAX_PATH];
HANDLE hIcon;
int index;
memset(NameBuf, _T('\0'), sizeof(NameBuf));
memset(InfoBuf, _T('\0'), sizeof(InfoBuf));
if (LoadString(hCpl, cplInfo.idName, NameBuf, MAX_PATH)) {
}
if (LoadString(hCpl, cplInfo.idInfo, InfoBuf, MAX_PATH)) {
}
hIcon = LoadImage(hCpl, (LPCTSTR)cplInfo.idIcon, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE);
if (hIcon) {
// add the icon to an image list, pass index to AddEntryToList(...)
HIMAGELIST hImageList;
hImageList = ListView_GetImageList(hwndLV, LVSIL_NORMAL);
index = ImageList_AddIcon(hImageList, hIcon);
hImageList = ListView_GetImageList(hwndLV, LVSIL_SMALL);
ImageList_AddIcon(hImageList, hIcon);
DestroyIcon(hIcon);
}
AddEntryToList(hwndLV, NameBuf, hCpl, InfoBuf, index);
}
}
return TRUE;
}
}
}
return FALSE;
}
static BOOL InitListViewItems(HWND hwndLV, LPTSTR szPath)
{
WIN32_FIND_DATA data;
// BY_HANDLE_FILE_INFORMATION bhfi;
// BOOL bhfi_valid;
HANDLE hFind;
HANDLE hFile;
TCHAR buffer[MAX_PATH+10], *p;
UINT length;
length = GetSystemDirectory(buffer, sizeof(buffer)/sizeof(TCHAR));
p = &buffer[length];
// path = buffer;
// for (p=buffer; *path; ) *p++ = *path++;
lstrcpy(p, _T("\\*.cpl"));
memset(&data, 0, sizeof(WIN32_FIND_DATA));
hFind = FindFirstFile(buffer, &data);
if (hFind != INVALID_HANDLE_VALUE) {
do {
if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
continue;
}
lstrcpy(p+1, data.cFileName);
hFile = CreateFile(buffer, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
if (hFile != INVALID_HANDLE_VALUE) {
HMODULE hCpl;
// if (GetFileInformationByHandle(hFile, &bhfi)) bhfi_valid = TRUE;
CloseHandle(hFile);
hCpl = LoadLibrary(data.cFileName);
if (hCpl) {
if (InitCPlApplet(hwndLV, hCpl)) {
} else {
}
FreeLibrary(hCpl);
}
}
} while (FindNextFile(hFind, &data));
FindClose(hFind);
}
return TRUE;
}
// OnGetDispInfo - processes the LVN_GETDISPINFO notification message.
static void OnGetDispInfo(NMLVDISPINFO* plvdi)
{
static TCHAR buffer[200];
plvdi->item.pszText = NULL;
plvdi->item.cchTextMax = 0;
switch (plvdi->item.iSubItem) {
case 0:
plvdi->item.pszText = _T("(Default)");
break;
case 1:
switch (plvdi->item.lParam) {
default:
wsprintf(buffer, _T("unknown(%d)"), plvdi->item.lParam);
plvdi->item.pszText = buffer;
break;
}
break;
case 2:
plvdi->item.pszText = _T("(value not set)");
break;
case 3:
plvdi->item.pszText = _T("");
break;
}
}
static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
TCHAR buf1[1000];
TCHAR buf2[1000];
ListView_GetItemText((HWND)lParamSort, lParam1, 0, buf1, sizeof(buf1)/sizeof(TCHAR));
ListView_GetItemText((HWND)lParamSort, lParam2, 0, buf2, sizeof(buf2)/sizeof(TCHAR));
return _tcscmp(buf1, buf2);
}
static void ListViewPopUpMenu(HWND hWnd, POINT pt)
{
}
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)
{
switch (message) {
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_TEXT | LVIF_PARAM;
item.iItem = info.iItem;
if (ListView_GetItem(hWnd, &item)) {
#if 0
HMODULE hCpl = LoadLibrary(pszText.pszText);
if (hCpl) {
if (InitCPlApplet(hwndLV, hCpl)) {
} else {
}
FreeLibrary(hCpl);
}
// pCPlApplet(hWnd, CPL_STARTWPARAMS, nSubProgs, (LPARAM)0);
#endif
}
}
}
break;
case NM_RCLICK:
{
int idx;
LV_HITTESTINFO lvH;
NM_LISTVIEW* pNm = (NM_LISTVIEW*)lParam;
lvH.pt.x = pNm->ptAction.x;
lvH.pt.y = pNm->ptAction.y;
idx = ListView_HitTest(hWnd, &lvH);
if (idx != -1) {
POINT pt;
GetCursorPos(&pt);
ListViewPopUpMenu(hWnd, pt);
return idx;
}
}
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);
}
// fall thru...
default:
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
break;
}
return 0;
}
#if 1
BOOL RefreshListView(HWND hwndLV, LPTSTR szPath)
{
// TCHAR buffer[MAX_PATH+10], *p;
// UINT length;
// length = GetSystemDirectory(buffer, sizeof(buffer)/sizeof(TCHAR));
if (hwndLV != NULL) {
ListView_DeleteAllItems(hwndLV);
}
return InitListViewItems(hwndLV, szPath);
}
#else
BOOL RefreshListView(HWND hwndLV, LPTSTR path)
{
WIN32_FIND_DATA data;
// BY_HANDLE_FILE_INFORMATION bhfi;
// BOOL bhfi_valid;
HANDLE hFind;
HANDLE hFile;
TCHAR buffer[MAX_PATH+10], *p;
UINT length;
if (hwndLV != NULL) {
ListView_DeleteAllItems(hwndLV);
}
length = GetSystemDirectory(buffer, sizeof(buffer)/sizeof(TCHAR));
p = &buffer[length];
// path = buffer;
// for (p=buffer; *path; ) *p++ = *path++;
lstrcpy(p, _T("\\*.cpl"));
memset(&data, 0, sizeof(WIN32_FIND_DATA));
hFind = FindFirstFile(buffer, &data);
if (hFind != INVALID_HANDLE_VALUE) {
do {
if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
continue;
}
lstrcpy(p+1, data.cFileName);
hFile = CreateFile(buffer, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
if (hFile != INVALID_HANDLE_VALUE) {
HMODULE hCpl;
// if (GetFileInformationByHandle(hFile, &bhfi)) bhfi_valid = TRUE;
CloseHandle(hFile);
hCpl = LoadLibrary(data.cFileName);
if (hCpl) {
if (InitCPlApplet(hwndLV, hCpl)) {
} else {
}
FreeLibrary(hCpl);
}
}
} while (FindNextFile(hFind, &data));
FindClose(hFind);
}
return TRUE;
}
#endif
HWND CreateListView(HWND hwndParent, int id, DWORD style)
{
RECT rcClient;
HWND hwndLV;
// Get the dimensions of the parent window's client area, and create the list view control.
GetClientRect(hwndParent, &rcClient);
hwndLV = CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTVIEW, _T("List View"),
WS_VISIBLE | WS_CHILD | style,
0, 0, rcClient.right, rcClient.bottom,
hwndParent, (HMENU)id, hInst, NULL);
ListView_SetExtendedListViewStyle(hwndLV, LVS_EX_FULLROWSELECT);
CreateListColumns(hwndLV);
// Initialize the image list, and add items to the control.
#if 1
if (!InitListViewImageLists(hwndLV) || !InitListViewItems(hwndLV, NULL/*szPath*/)) {
DestroyWindow(hwndLV);
return FALSE;
}
#endif
g_orgListWndProc = SubclassWindow(hwndLV, ListWndProc);
return hwndLV;
}

View file

@ -1,43 +0,0 @@
/*
* ReactOS control
*
* 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, int id, DWORD style);
BOOL RefreshListView(HWND hwndTV, LPTSTR szPath);
#ifdef __cplusplus
};
#endif
#endif // __LISTVIEW_H__

View file

@ -1,147 +0,0 @@
/*
* ReactOS control
*
* 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.
*/
#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>
#include "main.h"
#include "framewnd.h"
////////////////////////////////////////////////////////////////////////////////
// Global Variables:
//
HINSTANCE hInst;
HWND hFrameWnd;
HWND hStatusBar;
HMENU hMenuFrame;
TCHAR szTitle[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)
{
WNDCLASSEX wcFrame = {
sizeof(WNDCLASSEX),
CS_HREDRAW | CS_VREDRAW/*style*/,
FrameWndProc,
0/*cbClsExtra*/,
0/*cbWndExtra*/,
hInstance,
LoadIcon(hInstance, MAKEINTRESOURCE(IDI_CONTROL)),
LoadCursor(0, IDC_ARROW),
0/*hbrBackground*/,
0/*lpszMenuName*/,
szWindowClass,
(HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_CONTROL), IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED)
};
ATOM hFrameWndClass = RegisterClassEx(&wcFrame); // register frame window class
hMenuFrame = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_CONTROL_MENU));
// Initialize the Windows Common Controls DLL
InitCommonControls();
hFrameWnd = CreateWindowEx(0, (LPCTSTR)(int)hFrameWndClass, szTitle,
WS_OVERLAPPEDWINDOW | WS_EX_CLIENTEDGE,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, hMenuFrame, hInstance, NULL/*lpParam*/);
if (!hFrameWnd) {
return FALSE;
}
// Create the status bar
hStatusBar = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS,
_T(""), hFrameWnd, STATUS_WINDOW);
if (hStatusBar) {
// Create the status bar panes
SetupStatusBar(hFrameWnd, FALSE);
CheckMenuItem(GetSubMenu(hMenuFrame, ID_VIEW_MENU), ID_VIEW_STATUSBAR, MF_BYCOMMAND|MF_CHECKED);
}
ShowWindow(hFrameWnd, nCmdShow);
UpdateWindow(hFrameWnd);
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_CONTROL, 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_CONTROL);
// Main message loop:
while (GetMessage(&msg, (HWND)NULL, 0, 0)) {
if (!TranslateAccelerator(msg.hwnd, hAccel, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
ExitInstance();
return msg.wParam;
}

View file

@ -1,99 +0,0 @@
/*
* 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 MAX_LOADSTRING 100
#define SPLIT_WIDTH 5
#define MAX_NAME_LEN 500
////////////////////////////////////////////////////////////////////////////////
enum OPTION_FLAGS {
OPTIONS_AUTO_REFRESH = 0x01,
OPTIONS_READ_ONLY_MODE = 0x02,
OPTIONS_CONFIRM_ON_DELETE = 0x04,
OPTIONS_SAVE_ON_EXIT = 0x08,
OPTIONS_DISPLAY_BINARY_DATA = 0x10,
OPTIONS_VIEW_TREE_ONLY = 0x20,
OPTIONS_VIEW_DATA_ONLY = 0x40,
};
typedef struct {
HWND hWnd;
HWND hTreeWnd;
HWND hListWnd;
int nFocusPanel; // 0: left 1: right
int nSplitPos;
WINDOWPLACEMENT pos;
TCHAR szPath[MAX_PATH];
} ChildWnd;
////////////////////////////////////////////////////////////////////////////////
// Global Variables:
//
extern HINSTANCE hInst;
extern HWND hFrameWnd;
extern HMENU hMenuFrame;
extern HWND hStatusBar;
extern HFONT hFont;
extern enum OPTION_FLAGS Options;
extern TCHAR szTitle[];
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__

46
rosapps/control/params.h Normal file
View file

@ -0,0 +1,46 @@
/*
* Control
* Copyright (C) 1998 by Marcel Baur <mbaur@g26.ethz.ch>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* alphabetical list of recognized optional command line parameters */
#define szP_COLOR _T("COLOR")
#define szP_DATETIME _T("DATE/TIME")
#define szP_DESKTOP _T("DESKTOP")
#define szP_INTERNATIONAL _T("INTERNATIONAL")
#define szP_KEYBOARD _T("KEYBOARD")
#define szP_MOUSE _T("MOUSE")
#define szP_PORTS _T("PORTS")
#define szP_PRINTERS _T("PRINTERS")
/* alphabetical list of appropriate commands to execute */
#define szEXEC_PREFIX _T("rundll32.exe")
#define szEXEC_ARGS _T("Shell32.dll,Control_RunDLL _T(")
#define szC_COLOR _T("desk.cpl,,2")
#define szC_DATETIME _T("datetime.cpl")
#define szC_DESKTOP _T("desk.cpl")
#define szC_FONTS _T("main.cpl @3")
#define szC_INTERNATIONAL _T("intl.cpl")
#define szC_KEYBOARD _T("main.cpl @1")
#define szC_MOUSE _T("main.cpl")
#define szC_PORTS _T("sysdm.cpl,,1")
#define szC_PRINTERS _T("main.cpl @2")

View file

@ -1,45 +1,19 @@
//{{NO_DEPENDENCIES}} //{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by control.rc // Used by control.rc
// //
#define IDS_APP_TITLE 103
#define IDI_SMALL 104
#define IDC_CONTROL 105
#define IDC_STATIC -1
#define ID_FILE_MENU 0
#define ID_VIEW_MENU 1
#define ID_HELP_MENU 2
#define IDR_CONTROL_MENU 130
#define IDD_CONTROL_DIALOG 102
#define IDS_LIST_COLUMN_FIRST 91
#define IDS_LIST_COLUMN_NAME 91
#define IDS_LIST_COLUMN_COMMENT 92
#define IDS_LIST_COLUMN_VERSION 93
#define IDS_LIST_COLUMN_LAST 93
#define ID_FILE_EXIT 32771
#define ID_VIEW_STATUSBAR 32773
#define ID_VIEW_LARGE_ICONS 32774
#define ID_VIEW_SMALL_ICONS 32775
#define ID_VIEW_LIST 32776
#define ID_VIEW_DETAILS 32777
#define ID_VIEW_REFRESH 32778
#define ID_HELP_ABOUT 32779
#define IDD_ABOUTBOX 103
#define IDS_APP_TITLE 103
#define IDI_CONTROL 107
#define IDI_SMALL 108
#define IDC_CONTROL 109
#define IDC_MYICON 2
#define IDC_STATIC -1
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 107
#define _APS_NEXT_RESOURCE_VALUE 129 #define _APS_NEXT_COMMAND_VALUE 32700
#define _APS_NEXT_COMMAND_VALUE 32780
#define _APS_NEXT_CONTROL_VALUE 1000 #define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 110 #define _APS_NEXT_SYMED_VALUE 110
#endif #endif
#endif #endif