mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 00:54:40 +00:00
Basic Control Panel created.
svn path=/trunk/; revision=3291
This commit is contained in:
parent
c1652a2ee6
commit
916c8b493b
11 changed files with 1317 additions and 0 deletions
64
rosapps/control/Makefile
Normal file
64
rosapps/control/Makefile
Normal file
|
@ -0,0 +1,64 @@
|
|||
#
|
||||
# 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
|
||||
|
||||
BASE_CFLAGS = -DGCC -D_WIN32_IE=0x0400 -DUNICODE -D_UNICODE
|
||||
|
||||
RCFLAGS = -DGCC -D_WIN32_IE=0x0400
|
||||
|
||||
|
||||
OBJS = framewnd.o \
|
||||
listview.o \
|
||||
main.o
|
||||
|
||||
LIBS = -lgdi32 -luser32 -lkernel32 -lcomctl32
|
||||
|
||||
all: $(TARGET).exe
|
||||
|
||||
$(TARGET).res: $(TARGET).rc
|
||||
|
||||
$(TARGET).exe: $(OBJS) $(TARGET).coff
|
||||
$(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
|
199
rosapps/control/control.rc
Normal file
199
rosapps/control/control.rc
Normal file
|
@ -0,0 +1,199 @@
|
|||
#include <defines.h>
|
||||
#include <reactos/resource.h>
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#define APSTUDIO_HIDDEN_SYMBOLS
|
||||
#include "windows.h"
|
||||
#undef APSTUDIO_HIDDEN_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE 9, 1
|
||||
#pragma code_page(1252)
|
||||
#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
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
|
||||
"#include ""windows.h""\r\n"
|
||||
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
|
||||
"#include ""resource.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
|
||||
PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "Absolutely no warranties whatsoever - Use at your own risk\0"
|
||||
VALUE "CompanyName", RES_STR_COMPANY_NAME
|
||||
VALUE "FileDescription", "ReactOS Control Panel by Robert Dickenson\0"
|
||||
VALUE "FileVersion", "1, 0, 0, 1\0"
|
||||
VALUE "InternalName", "control\0"
|
||||
VALUE "LegalCopyright", "Copyright © 2002 Robert Dickenson\0"
|
||||
VALUE "LegalTrademarks", "\0"
|
||||
VALUE "OriginalFilename", "control.exe\0"
|
||||
VALUE "PrivateBuild", "\0"
|
||||
VALUE "ProductName", RES_STR_PRODUCT_NAME
|
||||
VALUE "ProductVersion", RES_STR_PRODUCT_VERSION
|
||||
VALUE "SpecialBuild", "Non-versioned Development Beta Release\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0xc09, 1200
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_LIST_COLUMN_NAME "Name"
|
||||
IDS_LIST_COLUMN_COMMENT "Comment"
|
||||
IDS_LIST_COLUMN_VERSION "Version"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDC_CONTROL "CONTROL"
|
||||
IDS_APP_TITLE "ReactOS Control Panel"
|
||||
END
|
||||
|
||||
#endif
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
295
rosapps/control/framewnd.c
Normal file
295
rosapps/control/framewnd.c
Normal file
|
@ -0,0 +1,295 @@
|
|||
/*
|
||||
* 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:
|
||||
// TODO:
|
||||
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*/);
|
||||
RefreshListView(hListWnd, 0, NULL);
|
||||
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;
|
||||
}
|
45
rosapps/control/framewnd.h
Normal file
45
rosapps/control/framewnd.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* 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__
|
380
rosapps/control/listview.c
Normal file
380
rosapps/control/listview.c
Normal file
|
@ -0,0 +1,380 @@
|
|||
/*
|
||||
* 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, DWORD dwCount)
|
||||
{
|
||||
LVITEM item;
|
||||
int index;
|
||||
|
||||
item.mask = LVIF_TEXT | 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 = 0;
|
||||
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 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, 50);
|
||||
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];
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
// Initialize the image list, and add items to the control.
|
||||
/*
|
||||
if (!InitListViewImageLists(hwndLV) ||
|
||||
!InitListViewItems(hwndLV, szName)) {
|
||||
DestroyWindow(hwndLV);
|
||||
return FALSE;
|
||||
}
|
||||
*/
|
||||
CreateListColumns(hwndLV);
|
||||
g_orgListWndProc = SubclassWindow(hwndLV, ListWndProc);
|
||||
return hwndLV;
|
||||
}
|
||||
|
||||
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) {
|
||||
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);
|
||||
} else {
|
||||
TCHAR NameBuf[MAX_PATH];
|
||||
TCHAR InfoBuf[MAX_PATH];
|
||||
HANDLE hIcon;
|
||||
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(...)
|
||||
}
|
||||
AddEntryToList(hwndLV, NameBuf, hCpl, InfoBuf, 0);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
BOOL RefreshListView(HWND hwndLV, HKEY hKey, 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;
|
||||
}
|
||||
|
43
rosapps/control/listview.h
Normal file
43
rosapps/control/listview.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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, HKEY hKey, LPTSTR keyPath);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // __LISTVIEW_H__
|
147
rosapps/control/main.c
Normal file
147
rosapps/control/main.c
Normal file
|
@ -0,0 +1,147 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
99
rosapps/control/main.h
Normal file
99
rosapps/control/main.h
Normal file
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* 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__
|
BIN
rosapps/control/res/control.ico
Normal file
BIN
rosapps/control/res/control.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
rosapps/control/res/small.ico
Normal file
BIN
rosapps/control/res/small.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 318 B |
45
rosapps/control/resource.h
Normal file
45
rosapps/control/resource.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by control.rc
|
||||
//
|
||||
|
||||
#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
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
#define _APS_NEXT_RESOURCE_VALUE 129
|
||||
#define _APS_NEXT_COMMAND_VALUE 32780
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 110
|
||||
#endif
|
||||
#endif
|
Loading…
Reference in a new issue