Release 0.4.7
Mon Nov 1 14:40:21 1993 julliard@di.epfl.ch (Alexandre Julliard) * [if1632/user.spec] Removed some duplicate entries. * [include/dialog.h] [windows/dialog.c] Implemented dialog units and fonts. Added preliminary loading of dialog resources. Preliminary implementation of DialogBox(). Implemented Get/SetDlgItem* functions. * [windows/win.c] Implemented WM_PARENTNOTIFY message. Implemented CreateWindowEx() and GetWindow(). Completed DestroyWindow(). Mon Nov 1 18:19:34 1993 Erik Bos * [loader/signal.c] Added support for int 0x11 & 0x12. * [loader/int21.c] Improved function handling. Sun Oct 31 12:38:09 1993 David Metcalfe <david@prism.demon.co.uk> * [objects/font.c] Implemented GetCharWidth(). Wed Oct 27 09:56:06 1993 John Brezak <brezak@ch.hp.com> * [Makefile] Use GNU malloc. * [include/int21.h include/wine.h] Change sc_eflags to sc_efl . * [include/wine.h] Fix misplaced #endif Include <signal.h> for NetBSD * [loader/int21.c] Don't include <sys/vfs.h> in NetBSD Do include <sys/mount.h> in NetBSD Cleanup some lint. Mon Oct 26 17:59:01 1993 Erik Bos * [include/int21.h] Added. * [loader/int21.c] Added support for many dos ints. * [misc/file.c] [include/files.h] Moved OPEN_MAX and DosDriveStruct to files.h. Sun Oct 24 13:36:50 1993 David Metcalfe <david@prism.demon.co.uk> * [controls/button.c] Implemented CHECKBOX, AUTOCHECKBOX, 3STATE, AUTO3STATE, RADIOBUTTON, AUTORADIOBUTTON, GROUPBOX controls, together with a preliminary USERBUTTON control. * [objects/text.c] Corrected bugs in TEXT_NextLine() and added handling of prefix character. * [controls/button.c] Disabled focus handling by commenting out SetFocus() calls until serious bug can be found. Oct 20, 93 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [controls/listbox.c] Listbox control window Painting cleanup, new messages processed. * [controls/scroll.c] Scroll bar control window Painting cleanup. * [controls/combo.c] Combo box control window Painting cleanup. Tue Oct 12 17:50:11 1993 julliard@di.epfl.ch (Alexandre Julliard) * [objects/color.c] [objects/palette.c] [windows/syscolor.c] Better support for the private color map. Using a private map is now the default. * [windows/win.c] Bug fix. * [include/dialog.h] [windows/dialog.c] Implemented CreateDialog*() and IsDialogMessage(). * [misc/xt.c] [windows/defwnd.c] Moved DefWindowProc() to defwnd.c. Added WM_NCCREATE, WM_NCDESTROY and WM_CTLCOLOR handling. * [windows/defdlg.c] Started the implementation of DefDlgProc(). * [windows/win.c] Added WM_NCCREATE and WM_NCDESTROY messages. Implemented IsChild(). Tue Oct 12 17:50:20 1993 David Metcalfe <david@prism.demon.co.uk> * [windows/focus.c] Implemented GetFocus() and SetFocus(). * [windows/event.c] Added processing of FocusIn and FocusOut events. * [windows/graphics.c] Added DrawFocusRect(). Sat Oct 9 14:36:57 1993 Erik Bos * [loader/int1a.c] Added more function handling. Wed Oct 6 12:21:22 1993 Erik Bos * [loader/signal.c] Split signal.c into int1a.c, int21.c and signal.c. Tue Oct 5 22:12:40 1993 David Metcalfe * [controls/static.c] [control/widgets.c] Static control class. * [objects/text.c] Added processing of additional DT_ flags to DrawText(). * [windows/win.c] [misc/xt.c] Added SetWindowText() and WM_SETTEXT processing. Tue Oct 5 22:12:40 1993 Martin Ayotte * [controls/listbox.c] Listbox control window * [controls/scroll.c] Scroll bar control window * [controls/combo.c] Combo box control window * [include/combo.h] Combo box definitions * [include/listbox.h] Listbox definitions * [include/scroll.h] Scroll bar definitions Sat Oct 2 09:35:54 1993 Bob Amstadt (bob at pooh) * [if1632/callback.c] Fixed bug in MakeProcInstance(). * [debugger/info.c] Changed x/w and x/b to display in hex. * [debugger/i386-pinsn.c] Added code to properly unassemble 16-bit indexing. Fri Oct 1 08:29:05 1993 Bob Amstadt (bob at pooh) * [loader/files.c] [misc/profile.c] System initialization file is now called "wine.ini" and can be located in the current directory, the user's home directory, or any directories specified in the WINEPATH environment variable. * [tools/build.c] [if1632/call.S] [include/regfunc.h] Changed register function stack to match sigcontext structure. Thu Sep 30 22:30:21 1993 Bob Amstadt (bob at pooh) * [loader/files.c] Created function to search a path for files to load. * [loader/wine.c] Modified exe and dll file loading to search through path specified by the environment variable WINEPATH. Thu Sep 30 22:30:21 1993 Eric Youngdale * [loader/signal.c] Bug fix. Thu Sep 30 22:30:21 1993 John Brezak * [debugger/dbg.y] [debugger/debug.l] [debugger/dtest.c] [debugger/obstack.h] Updates to allow debugger to function under NetBSD.
202
ChangeLog
|
@ -1,3 +1,205 @@
|
|||
Mon Nov 1 14:40:21 1993 julliard@di.epfl.ch (Alexandre Julliard)
|
||||
|
||||
* [if1632/user.spec]
|
||||
Removed some duplicate entries.
|
||||
|
||||
* [include/dialog.h] [windows/dialog.c]
|
||||
Implemented dialog units and fonts.
|
||||
Added preliminary loading of dialog resources.
|
||||
Preliminary implementation of DialogBox().
|
||||
Implemented Get/SetDlgItem* functions.
|
||||
|
||||
* [windows/win.c]
|
||||
Implemented WM_PARENTNOTIFY message.
|
||||
Implemented CreateWindowEx() and GetWindow().
|
||||
Completed DestroyWindow().
|
||||
|
||||
Mon Nov 1 18:19:34 1993 Erik Bos
|
||||
|
||||
* [loader/signal.c]
|
||||
Added support for int 0x11 & 0x12.
|
||||
|
||||
* [loader/int21.c]
|
||||
Improved function handling.
|
||||
|
||||
Sun Oct 31 12:38:09 1993 David Metcalfe <david@prism.demon.co.uk>
|
||||
|
||||
* [objects/font.c]
|
||||
Implemented GetCharWidth().
|
||||
|
||||
Wed Oct 27 09:56:06 1993 John Brezak <brezak@ch.hp.com>
|
||||
|
||||
* [Makefile]
|
||||
Use GNU malloc.
|
||||
|
||||
* [include/int21.h include/wine.h]
|
||||
Change sc_eflags to sc_efl .
|
||||
|
||||
* [include/wine.h]
|
||||
Fix misplaced #endif
|
||||
Include <signal.h> for NetBSD
|
||||
|
||||
* [loader/int21.c]
|
||||
Don't include <sys/vfs.h> in NetBSD
|
||||
Do include <sys/mount.h> in NetBSD
|
||||
Cleanup some lint.
|
||||
|
||||
Mon Oct 26 17:59:01 1993 Erik Bos
|
||||
|
||||
* [include/int21.h]
|
||||
Added.
|
||||
|
||||
* [loader/int21.c]
|
||||
Added support for many dos ints.
|
||||
|
||||
* [misc/file.c] [include/files.h]
|
||||
Moved OPEN_MAX and DosDriveStruct to files.h.
|
||||
|
||||
Sun Oct 24 13:36:50 1993 David Metcalfe <david@prism.demon.co.uk>
|
||||
|
||||
* [controls/button.c]
|
||||
Implemented CHECKBOX, AUTOCHECKBOX, 3STATE, AUTO3STATE,
|
||||
RADIOBUTTON, AUTORADIOBUTTON, GROUPBOX controls, together with
|
||||
a preliminary USERBUTTON control.
|
||||
|
||||
* [objects/text.c]
|
||||
Corrected bugs in TEXT_NextLine() and added handling of prefix
|
||||
character.
|
||||
|
||||
* [controls/button.c]
|
||||
Disabled focus handling by commenting out SetFocus() calls until
|
||||
serious bug can be found.
|
||||
|
||||
Oct 20, 93 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
|
||||
|
||||
* [controls/listbox.c]
|
||||
Listbox control window
|
||||
Painting cleanup, new messages processed.
|
||||
|
||||
* [controls/scroll.c]
|
||||
Scroll bar control window
|
||||
Painting cleanup.
|
||||
|
||||
* [controls/combo.c]
|
||||
Combo box control window
|
||||
Painting cleanup.
|
||||
|
||||
Tue Oct 12 17:50:11 1993 julliard@di.epfl.ch (Alexandre Julliard)
|
||||
|
||||
* [objects/color.c] [objects/palette.c] [windows/syscolor.c]
|
||||
Better support for the private color map.
|
||||
Using a private map is now the default.
|
||||
|
||||
* [windows/win.c]
|
||||
Bug fix.
|
||||
|
||||
* [include/dialog.h] [windows/dialog.c]
|
||||
Implemented CreateDialog*() and IsDialogMessage().
|
||||
|
||||
* [misc/xt.c] [windows/defwnd.c]
|
||||
Moved DefWindowProc() to defwnd.c.
|
||||
Added WM_NCCREATE, WM_NCDESTROY and WM_CTLCOLOR handling.
|
||||
|
||||
* [windows/defdlg.c]
|
||||
Started the implementation of DefDlgProc().
|
||||
|
||||
* [windows/win.c]
|
||||
Added WM_NCCREATE and WM_NCDESTROY messages.
|
||||
Implemented IsChild().
|
||||
|
||||
Tue Oct 12 17:50:20 1993 David Metcalfe <david@prism.demon.co.uk>
|
||||
|
||||
* [windows/focus.c]
|
||||
Implemented GetFocus() and SetFocus().
|
||||
|
||||
* [windows/event.c]
|
||||
Added processing of FocusIn and FocusOut events.
|
||||
|
||||
* [windows/graphics.c]
|
||||
Added DrawFocusRect().
|
||||
|
||||
Sat Oct 9 14:36:57 1993 Erik Bos
|
||||
|
||||
* [loader/int1a.c]
|
||||
Added more function handling.
|
||||
|
||||
Wed Oct 6 12:21:22 1993 Erik Bos
|
||||
|
||||
* [loader/signal.c]
|
||||
Split signal.c into int1a.c, int21.c and signal.c.
|
||||
|
||||
Tue Oct 5 22:12:40 1993 David Metcalfe
|
||||
|
||||
* [controls/static.c] [control/widgets.c]
|
||||
Static control class.
|
||||
|
||||
* [objects/text.c]
|
||||
Added processing of additional DT_ flags to DrawText().
|
||||
|
||||
* [windows/win.c] [misc/xt.c]
|
||||
Added SetWindowText() and WM_SETTEXT processing.
|
||||
|
||||
Tue Oct 5 22:12:40 1993 Martin Ayotte
|
||||
|
||||
* [controls/listbox.c]
|
||||
Listbox control window
|
||||
|
||||
* [controls/scroll.c]
|
||||
Scroll bar control window
|
||||
|
||||
* [controls/combo.c]
|
||||
Combo box control window
|
||||
|
||||
* [include/combo.h]
|
||||
Combo box definitions
|
||||
|
||||
* [include/listbox.h]
|
||||
Listbox definitions
|
||||
|
||||
* [include/scroll.h]
|
||||
Scroll bar definitions
|
||||
|
||||
Sat Oct 2 09:35:54 1993 Bob Amstadt (bob at pooh)
|
||||
|
||||
* [if1632/callback.c]
|
||||
Fixed bug in MakeProcInstance().
|
||||
|
||||
* [debugger/info.c]
|
||||
Changed x/w and x/b to display in hex.
|
||||
|
||||
* [debugger/i386-pinsn.c]
|
||||
Added code to properly unassemble 16-bit indexing.
|
||||
|
||||
Fri Oct 1 08:29:05 1993 Bob Amstadt (bob at pooh)
|
||||
|
||||
* [loader/files.c] [misc/profile.c]
|
||||
System initialization file is now called "wine.ini" and can
|
||||
be located in the current directory, the user's home directory,
|
||||
or any directories specified in the WINEPATH environment variable.
|
||||
|
||||
* [tools/build.c] [if1632/call.S] [include/regfunc.h]
|
||||
Changed register function stack to match sigcontext structure.
|
||||
|
||||
Thu Sep 30 22:30:21 1993 Bob Amstadt (bob at pooh)
|
||||
|
||||
* [loader/files.c]
|
||||
Created function to search a path for files to load.
|
||||
|
||||
* [loader/wine.c]
|
||||
Modified exe and dll file loading to search through path
|
||||
specified by the environment variable WINEPATH.
|
||||
|
||||
Thu Sep 30 22:30:21 1993 Eric Youngdale
|
||||
|
||||
* [loader/signal.c]
|
||||
Bug fix.
|
||||
|
||||
Thu Sep 30 22:30:21 1993 John Brezak
|
||||
|
||||
* [debugger/dbg.y] [debugger/debug.l] [debugger/dtest.c]
|
||||
[debugger/obstack.h]
|
||||
Updates to allow debugger to function under NetBSD.
|
||||
|
||||
Tue Sep 28 19:59:21 1993 David Metcalfe
|
||||
|
||||
* [windows/win.c]
|
||||
|
|
4
Makefile
|
@ -1,6 +1,6 @@
|
|||
######################################################################
|
||||
# These variables are inherited by the sub-makefiles
|
||||
DEBUGOPTS=
|
||||
DEBUGOPTS=-DDEBUG_RESOURCE
|
||||
COPTS=-O2 -m486
|
||||
INCLUDE_DIR=include
|
||||
LDFLAGS=
|
||||
|
@ -18,7 +18,7 @@ all: $(TARGET)
|
|||
dummy:
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o
|
||||
rm -f *~ *.o *#
|
||||
@for i in tools $(SUBDIRS); do (cd $$i && $(MAKE) clean) || exit; done
|
||||
|
||||
$(TARGET): dummy
|
||||
|
|
33
README
|
@ -18,15 +18,42 @@ in the file "bsdmake.patch". This release requires NetBSD-current.
|
|||
All:
|
||||
|
||||
To build Wine, first do a "make depend" and then a "make". The
|
||||
executable "wine" will be built.
|
||||
executable "wine" will be built. "wine" will load and run Windows'
|
||||
executables. You must specify the entire path to the executable,
|
||||
have the executable in the current directory, or specify a load
|
||||
path with environment variable WINEPATH.
|
||||
|
||||
Grab a copy of Windows sol.exe (Solitaire) and run it with the command:
|
||||
For example, to run Windows' solitaire:
|
||||
|
||||
wine sol.exe
|
||||
export WINEPATH=/dos/windows;/dos/windows/system
|
||||
wine sol
|
||||
|
||||
Have a nice game of solitaire, but be careful. Emulation isn't perfect.
|
||||
So, occassionally it will crash.
|
||||
|
||||
WHAT'S NEW with version 0.4.7: (see ChangeLog for details)
|
||||
- More dialog box functions
|
||||
- More DOS interrupts
|
||||
- NetBSD compatibility patches
|
||||
|
||||
WHAT'S NEW with version 0.4.5: (see ChangeLog for details)
|
||||
- Bug fixes
|
||||
- focus routines
|
||||
- dialog box functions
|
||||
- improvements to control windows
|
||||
|
||||
WHAT'S NEW with version 0.4.4: (see ChangeLog for details)
|
||||
- Bug fixes
|
||||
- New static control class
|
||||
- Preliminary listbox, combobox and scrollbar controls
|
||||
- System initialization file is now called "wine.ini", and
|
||||
may be located in the user's current directory, the
|
||||
user's home directory or any directory specified by
|
||||
the WINEPATH environment variable.
|
||||
- The loader now searches the directories specified by the
|
||||
WINEPATH environment variable for programs and DLLs.
|
||||
- Internal debugger now works on 386BSD.
|
||||
|
||||
WHAT'S NEW with version 0.4.3: (see ChangeLog for details)
|
||||
- Bug fixes
|
||||
- Resource loading now able to load DLL resources
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
Date: Sun, 26 Sep 93 03:18:19 EDT
|
||||
From: eric@tantalus.nrl.navy.mil (Eric Youngdale)
|
||||
Message-Id: <9309260718.AA13966@tantalus.nrl.navy.mil>
|
||||
To: bob@amscons.amscons.com
|
||||
Cc: linux-activists@Niksula.hut.fi
|
||||
In-Reply-To: Bob Amstadt's message of Sat, 25 Sep 1993 23:36:32 +0300
|
||||
<m0oggMt-000CrhC@amscons.amscons.com>
|
||||
X-Mn-Key: WABI
|
||||
|
||||
|
||||
|
||||
>I may just be dreaming, but I'm beginning to like the idea of a built
|
||||
>in debugger.
|
||||
|
||||
So do I. I like it so much that I wrote one. It turns out that the
|
||||
disassembly code in gdb is pretty much localized to one source file, and this
|
||||
was easy to splice into a simple program. In addition, there are 2 variables
|
||||
that you set if you are disassembling 16 bit code, so it makes it all the
|
||||
better.
|
||||
|
||||
Anyway, there is a parser that understands a limited set of gdb
|
||||
commands (very limited, but the 'x' command is pretty functional as long as you
|
||||
stick to numeric rather than symbolic addresses). The parser understands $pc
|
||||
and $sp for your convenience, and you can do things like "x/10i $pc" and "info
|
||||
regs" to see what is going on. In principle you can do "x/x", "x/s", "x/d",
|
||||
"x/w", "x/b", "x/i" and "x/c". I implemented an "info stack" command that
|
||||
simply dumps a number of bytes from the stack onto the screen, but it currently
|
||||
makes no attempt to actually interpret the stack frames.
|
||||
|
||||
This will probably not work on non-linux systems, and I have no idea
|
||||
how much work it will be to fix it. To start with we need some simple macros
|
||||
to determine (based upon a segment selector) whether we are in a 16 bit or a 32
|
||||
bit segment, but this should be pretty easy to fix. I shamelessly ripped off a
|
||||
bunch of files from gdb, and I obviously picked the ones for linux. For other
|
||||
systems you may need to make adjustments to these files somehow. It is too
|
||||
late in the evening to worry about this now.
|
||||
|
||||
It will probably be easy to modify the parser to allow you to change
|
||||
memory locations and/or register values and then continue execution. Also,
|
||||
some of the hooks for using readline with the parser are in place, but it does
|
||||
not work reliably for some reason, so I left it out for now. Adding gnu
|
||||
readline really would bloat the package a lot. Instead I could use Rich Salz's
|
||||
editlib (the canonical test case for the DLL tools), which has a command line
|
||||
history feature that could be an acceptable substitute - this is much smaller
|
||||
than gnu readline, but I am not sure what features are present.
|
||||
|
||||
-Eric
|
|
@ -6,7 +6,7 @@ diff -ruN ../Backup//Makefile ./Makefile
|
|||
# These definitions are for the top level
|
||||
TARGET=wine
|
||||
-LIBS=-L. -L/usr/X386/lib -lXext -lXaw -lXt -lXmu -lX11 -lm
|
||||
+LIBS=-L. -L/usr/X386/lib -lXext -lXaw -lXt -lXmu -lX11 -lm -li386
|
||||
+LIBS=-L. -L/usr/X386/lib -lXext -lXaw -lXt -lXmu -lX11 -lm -li386 -lgnumalloc
|
||||
OBJS=if1632/if1632.o controls/controls.o loader/loader.o \
|
||||
memory/memory.o misc/misc.o objects/objects.o windows/windows.o
|
||||
SUBDIRS=if1632 controls loader memory misc objects windows
|
||||
|
@ -122,3 +122,12 @@ diff -ruN ../Backup//windows/Makefile ./windows/Makefile
|
|||
+.if exists(.depend)
|
||||
+.include ".depend"
|
||||
+.endif
|
||||
--- debugger/Makefile.orig Thu Sep 30 07:29:39 1993
|
||||
+++ debugger/Makefile Thu Sep 30 07:27:00 1993
|
||||
@@ -37,3 +37,6 @@
|
||||
depend: dbg.tab.c dbg.tab.h lex.yy.c
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
||||
+.if exists(.depend)
|
||||
+.include ".depend"
|
||||
+.endif
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
|
||||
|
||||
OBJS=menu.o widgets.o button.o SmeMenuButto.o WinLabel.o WinCommand.o \
|
||||
WinMenuButto.o
|
||||
OBJS=menu.o widgets.o button.o scroll.o listbox.o combo.o static.o \
|
||||
SmeMenuButto.o WinLabel.o WinCommand.o \
|
||||
WinMenuButto.o
|
||||
|
||||
default: controls.o
|
||||
|
||||
|
@ -9,7 +10,7 @@ controls.o: $(OBJS)
|
|||
$(LD) -r -o controls.o $(OBJS)
|
||||
|
||||
clean:
|
||||
rm -f *.o *~ *.s dll_* *.a
|
||||
rm -f *.o *~ *.s dll_* *.a *#
|
||||
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
|
|
@ -1,33 +1,53 @@
|
|||
/* File: button.c -- MS-Windows(tm) compatible "Button" replacement widget
|
||||
/* File: button.c -- Button type widgets
|
||||
*
|
||||
* programmed by Johannes Ruscheinski for the Linux WABI
|
||||
* project.
|
||||
* (C) 1993 by Johannes Ruscheinski
|
||||
*
|
||||
* Modifications by David Metcalfe
|
||||
* Copyright (C) 1993 Johannes Ruscheinski
|
||||
* Copyright (C) 1993 David Metcalfe
|
||||
*/
|
||||
|
||||
static char Copyright1[] = "Copyright Johannes Ruscheinski, 1993";
|
||||
static char Copyright2[] = "Copyright David Metcalfe, 1993";
|
||||
|
||||
#include <windows.h>
|
||||
#include "win.h"
|
||||
|
||||
LONG ButtonWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam);
|
||||
|
||||
static COLORREF color_windowframe, color_btnface, color_btnshadow,
|
||||
color_btntext, color_btnhighlight;
|
||||
static COLORREF color_windowtext, color_windowframe, color_btnface,
|
||||
color_btnshadow, color_btntext, color_btnhighlight;
|
||||
|
||||
static BOOL pressed;
|
||||
|
||||
#define NOTIFY_PARENT(hWndCntrl, wNotifyCode) \
|
||||
SendMessage(GetParent(hWndCntrl), WM_COMMAND, \
|
||||
GetDlgCtrlID(hWndCntrl), MAKELPARAM(hWndCntrl, wNotifyCode));
|
||||
GetDlgCtrlID(hWndCntrl), MAKELPARAM(hWndCntrl, wNotifyCode));
|
||||
#define DIM(array) ((sizeof array)/(sizeof array[0]))
|
||||
|
||||
static LONG PB_Paint(HWND hWnd);
|
||||
static LONG PB_LButtonDown(HWND hWnd, WORD wParam, LONG lParam);
|
||||
static LONG PB_LButtonUp(HWND hWnd, WORD wParam, LONG lParam);
|
||||
static LONG PB_LButtonDblClk(HWND hWnd, WORD wParam, LONG lParam);
|
||||
static LONG PB_KillFocus(HWND hwnd);
|
||||
static void DrawRaisedPushButton(HDC hDC, HWND hButton, RECT rc);
|
||||
static void DrawPressedPushButton(HDC hDC, HWND hButton, RECT rc);
|
||||
static LONG CB_Paint(HWND hWnd);
|
||||
static LONG CB_LButtonDown(HWND hWnd, WORD wParam, LONG lParam);
|
||||
static LONG CB_LButtonUp(HWND hWnd, WORD wParam, LONG lParam);
|
||||
static LONG CB_LButtonDblClk(HWND hWnd, WORD wParam, LONG lParam);
|
||||
static LONG CB_KillFocus(HWND hWnd);
|
||||
static LONG CB_SetCheck(HWND hWnd, WORD wParam);
|
||||
static LONG CB_GetCheck(HWND hWnd);
|
||||
static LONG RB_Paint(HWND hWnd);
|
||||
static LONG RB_LButtonDown(HWND hWnd, WORD wParam, LONG lParam);
|
||||
static LONG RB_LButtonUp(HWND hWnd, WORD wParam, LONG lParam);
|
||||
static LONG RB_LButtonDblClk(HWND hWnd, WORD wParam, LONG lParam);
|
||||
static LONG RB_KillFocus(HWND hWnd);
|
||||
static LONG RB_SetCheck(HWND hWnd, WORD wParam);
|
||||
static LONG RB_GetCheck(HWND hWnd);
|
||||
static LONG GB_Paint(HWND hWnd);
|
||||
static LONG UB_Paint(HWND hWnd);
|
||||
static LONG UB_LButtonDown(HWND hWnd, WORD wParam, LONG lParam);
|
||||
static LONG UB_LButtonUp(HWND hWnd, WORD wParam, LONG lParam);
|
||||
static LONG UB_KillFocus(HWND hWnd);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -35,9 +55,12 @@ typedef struct
|
|||
LONG (*lButtonDownfn)();
|
||||
LONG (*lButtonUpfn)();
|
||||
LONG (*lButtonDblClkfn)();
|
||||
LONG (*killFocusfn)();
|
||||
LONG (*setCheckfn)();
|
||||
LONG (*getCheckfn)();
|
||||
} BTNFN;
|
||||
|
||||
#define MAX_BTN_TYPE 2
|
||||
#define MAX_BTN_TYPE 10
|
||||
|
||||
static BTNFN btnfn[MAX_BTN_TYPE] =
|
||||
{
|
||||
|
@ -45,13 +68,91 @@ static BTNFN btnfn[MAX_BTN_TYPE] =
|
|||
(LONG(*)())PB_Paint, /* BS_PUSHBUTTON */
|
||||
(LONG(*)())PB_LButtonDown,
|
||||
(LONG(*)())PB_LButtonUp,
|
||||
(LONG(*)())PB_LButtonDblClk
|
||||
(LONG(*)())PB_LButtonDblClk,
|
||||
(LONG(*)())PB_KillFocus,
|
||||
(LONG(*)())NULL,
|
||||
(LONG(*)())NULL
|
||||
},
|
||||
{
|
||||
(LONG(*)())PB_Paint, /* BS_DEFPUSHBUTTON */
|
||||
(LONG(*)())PB_LButtonDown,
|
||||
(LONG(*)())PB_LButtonUp,
|
||||
(LONG(*)())PB_LButtonDblClk
|
||||
(LONG(*)())PB_LButtonDblClk,
|
||||
(LONG(*)())PB_KillFocus,
|
||||
(LONG(*)())NULL,
|
||||
(LONG(*)())NULL
|
||||
},
|
||||
{
|
||||
(LONG(*)())CB_Paint, /* BS_CHECKBOX */
|
||||
(LONG(*)())CB_LButtonDown,
|
||||
(LONG(*)())CB_LButtonUp,
|
||||
(LONG(*)())CB_LButtonDblClk,
|
||||
(LONG(*)())CB_KillFocus,
|
||||
(LONG(*)())CB_SetCheck,
|
||||
(LONG(*)())CB_GetCheck
|
||||
},
|
||||
{
|
||||
(LONG(*)())CB_Paint, /* BS_AUTOCHECKBOX */
|
||||
(LONG(*)())CB_LButtonDown,
|
||||
(LONG(*)())CB_LButtonUp,
|
||||
(LONG(*)())CB_LButtonDblClk,
|
||||
(LONG(*)())CB_KillFocus,
|
||||
(LONG(*)())CB_SetCheck,
|
||||
(LONG(*)())CB_GetCheck
|
||||
},
|
||||
{
|
||||
(LONG(*)())RB_Paint, /* BS_RADIOBUTTON */
|
||||
(LONG(*)())RB_LButtonDown,
|
||||
(LONG(*)())RB_LButtonUp,
|
||||
(LONG(*)())RB_LButtonDblClk,
|
||||
(LONG(*)())RB_KillFocus,
|
||||
(LONG(*)())RB_SetCheck,
|
||||
(LONG(*)())RB_GetCheck
|
||||
},
|
||||
{
|
||||
(LONG(*)())CB_Paint, /* BS_3STATE */
|
||||
(LONG(*)())CB_LButtonDown,
|
||||
(LONG(*)())CB_LButtonUp,
|
||||
(LONG(*)())CB_LButtonDblClk,
|
||||
(LONG(*)())CB_KillFocus,
|
||||
(LONG(*)())CB_SetCheck,
|
||||
(LONG(*)())CB_GetCheck
|
||||
},
|
||||
{
|
||||
(LONG(*)())CB_Paint, /* BS_AUTO3STATE */
|
||||
(LONG(*)())CB_LButtonDown,
|
||||
(LONG(*)())CB_LButtonUp,
|
||||
(LONG(*)())CB_LButtonDblClk,
|
||||
(LONG(*)())CB_KillFocus,
|
||||
(LONG(*)())CB_SetCheck,
|
||||
(LONG(*)())CB_GetCheck
|
||||
},
|
||||
{
|
||||
(LONG(*)())GB_Paint, /* BS_GROUPBOX */
|
||||
(LONG(*)())NULL,
|
||||
(LONG(*)())NULL,
|
||||
(LONG(*)())NULL,
|
||||
(LONG(*)())NULL,
|
||||
(LONG(*)())NULL,
|
||||
(LONG(*)())NULL
|
||||
},
|
||||
{
|
||||
(LONG(*)())UB_Paint, /* BS_USERBUTTON */
|
||||
(LONG(*)())UB_LButtonDown,
|
||||
(LONG(*)())UB_LButtonUp,
|
||||
(LONG(*)())NULL,
|
||||
(LONG(*)())UB_KillFocus,
|
||||
(LONG(*)())NULL,
|
||||
(LONG(*)())NULL
|
||||
},
|
||||
{
|
||||
(LONG(*)())RB_Paint, /* BS_AUTORADIOBUTTON */
|
||||
(LONG(*)())RB_LButtonDown,
|
||||
(LONG(*)())RB_LButtonUp,
|
||||
(LONG(*)())RB_LButtonDblClk,
|
||||
(LONG(*)())RB_KillFocus,
|
||||
(LONG(*)())RB_SetCheck,
|
||||
(LONG(*)())RB_GetCheck
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -80,42 +181,49 @@ LONG ButtonWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam)
|
|||
else
|
||||
{
|
||||
/* initialise colours used for button rendering: */
|
||||
color_windowtext = GetSysColor(COLOR_WINDOWTEXT);
|
||||
color_windowframe = GetSysColor(COLOR_WINDOWFRAME);
|
||||
color_btnface = GetSysColor(COLOR_BTNFACE);
|
||||
color_btnshadow = GetSysColor(COLOR_BTNSHADOW);
|
||||
color_btntext = GetSysColor(COLOR_BTNTEXT);
|
||||
color_btnhighlight = GetSysColor(COLOR_BTNHIGHLIGHT);
|
||||
|
||||
(WORD)(*(wndPtr->wExtra)) = 0;
|
||||
pressed = FALSE;
|
||||
lResult = 0L;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_PAINT:
|
||||
(btnfn[style].paintfn)(hWnd);
|
||||
if (btnfn[style].paintfn)
|
||||
(btnfn[style].paintfn)(hWnd);
|
||||
break;
|
||||
|
||||
case WM_LBUTTONDOWN:
|
||||
(btnfn[style].lButtonDownfn)(hWnd, wParam, lParam);
|
||||
if (btnfn[style].lButtonDownfn)
|
||||
(btnfn[style].lButtonDownfn)(hWnd, wParam, lParam);
|
||||
break;
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
(btnfn[style].lButtonUpfn)(hWnd, wParam, lParam);
|
||||
if (btnfn[style].lButtonUpfn)
|
||||
(btnfn[style].lButtonUpfn)(hWnd, wParam, lParam);
|
||||
break;
|
||||
|
||||
case WM_LBUTTONDBLCLK:
|
||||
(btnfn[style].lButtonDblClkfn)(hWnd, wParam, lParam);
|
||||
if (btnfn[style].lButtonDblClkfn)
|
||||
(btnfn[style].lButtonDblClkfn)(hWnd, wParam, lParam);
|
||||
break;
|
||||
|
||||
case WM_SETFOCUS:
|
||||
break;
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
InvalidateRect(hWnd, NULL, FALSE);
|
||||
UpdateWindow(hWnd);
|
||||
if (btnfn[style].killFocusfn)
|
||||
(btnfn[style].killFocusfn)(hWnd);
|
||||
break;
|
||||
|
||||
case WM_SYSCOLORCHANGE:
|
||||
color_windowtext = GetSysColor(COLOR_WINDOWTEXT);
|
||||
color_windowframe = GetSysColor(COLOR_WINDOWFRAME);
|
||||
color_btnface = GetSysColor(COLOR_BTNFACE);
|
||||
color_btnshadow = GetSysColor(COLOR_BTNSHADOW);
|
||||
|
@ -124,6 +232,16 @@ LONG ButtonWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam)
|
|||
InvalidateRect(hWnd, NULL, TRUE);
|
||||
break;
|
||||
|
||||
case BM_SETCHECK:
|
||||
if (btnfn[style].setCheckfn)
|
||||
(btnfn[style].setCheckfn)(hWnd, wParam);
|
||||
break;
|
||||
|
||||
case BM_GETCHECK:
|
||||
if (btnfn[style].getCheckfn)
|
||||
(btnfn[style].getCheckfn)(hWnd);
|
||||
break;
|
||||
|
||||
default:
|
||||
lResult = DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
break;
|
||||
|
@ -155,7 +273,7 @@ static LONG PB_Paint(HWND hWnd)
|
|||
|
||||
static LONG PB_LButtonDown(HWND hWnd, WORD wParam, LONG lParam)
|
||||
{
|
||||
/* SetFocus(hWnd); */
|
||||
/* SetFocus(hWnd); */
|
||||
SetCapture(hWnd);
|
||||
pressed = TRUE;
|
||||
InvalidateRect(hWnd, NULL, FALSE);
|
||||
|
@ -184,6 +302,13 @@ static LONG PB_LButtonDblClk(HWND hWnd, WORD wParam, LONG lParam)
|
|||
NOTIFY_PARENT(hWnd, BN_DOUBLECLICKED);
|
||||
}
|
||||
|
||||
static LONG PB_KillFocus(HWND hWnd)
|
||||
{
|
||||
pressed = FALSE;
|
||||
InvalidateRect(hWnd, NULL, FALSE);
|
||||
UpdateWindow(hWnd);
|
||||
}
|
||||
|
||||
static void DrawRaisedPushButton(HDC hDC, HWND hButton, RECT rc)
|
||||
{
|
||||
HPEN hOldPen, hFramePen;
|
||||
|
@ -255,19 +380,16 @@ static void DrawRaisedPushButton(HDC hDC, HWND hButton, RECT rc)
|
|||
CombineRgn(rgn, rgn1, rgn2, RGN_AND);
|
||||
FillRgn(hDC, rgn2, hShadowBrush);
|
||||
|
||||
#if 0
|
||||
/* do we have the focus? */
|
||||
if (len >= 1 && GetFocus() == hButton) {
|
||||
dwTextSize = GetTextExtent(hDC, text, len);
|
||||
delta = ((rc.right - rc.left) - LOWORD(dwTextSize) + 1) >> 1;
|
||||
delta = ((rc.right - rc.left) - LOWORD(dwTextSize) - 1) >> 1;
|
||||
rc.left += delta; rc.right -= delta;
|
||||
GetTextMetrics(hDC, &tm);
|
||||
delta = ((rc.bottom - rc.top) -
|
||||
tm.tmHeight + tm.tmInternalLeading) >> 1;
|
||||
delta = ((rc.bottom - rc.top) - tm.tmHeight - 1) >> 1;
|
||||
rc.top += delta; rc.bottom -= delta;
|
||||
DrawFocusRect(hDC, &rc);
|
||||
}
|
||||
#endif
|
||||
|
||||
SelectObject(hDC, (HANDLE)hOldPen);
|
||||
SelectObject(hDC, (HANDLE)hOldBrush);
|
||||
|
@ -275,10 +397,8 @@ static void DrawRaisedPushButton(HDC hDC, HWND hButton, RECT rc)
|
|||
DeleteObject((HANDLE)hShadowBrush);
|
||||
DeleteObject((HANDLE)hBackgrndBrush);
|
||||
DeleteObject((HANDLE)rgn1);
|
||||
#if 0
|
||||
DeleteObject((HANDLE)rgn2);
|
||||
DeleteObject((HANDLE)rgn);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -320,19 +440,16 @@ static void DrawPressedPushButton(HDC hDC, HWND hButton, RECT rc)
|
|||
DT_SINGLELINE | DT_CENTER| DT_VCENTER);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* do we have the focus? */
|
||||
if (len >= 1 && GetFocus() == hButton) {
|
||||
dwTextSize = GetTextExtent(hDC, text, len);
|
||||
delta = ((rc.right - rc.left) - LOWORD(dwTextSize)) >> 1;
|
||||
delta = ((rc.right - rc.left) - LOWORD(dwTextSize) - 1) >> 1;
|
||||
rc.left += delta; rc.right -= delta;
|
||||
GetTextMetrics(hDC, &tm);
|
||||
delta = ((rc.bottom - rc.top) -
|
||||
tm.tmHeight + tm.tmInternalLeading) >> 1;
|
||||
delta = ((rc.bottom - rc.top) - tm.tmHeight - 1) >> 1;
|
||||
rc.top += delta; rc.bottom -= delta;
|
||||
DrawFocusRect(hDC, &rc);
|
||||
}
|
||||
#endif
|
||||
|
||||
SelectObject(hDC, (HANDLE)hOldPen);
|
||||
SelectObject(hDC, (HANDLE)hOldBrush);
|
||||
|
@ -342,10 +459,498 @@ static void DrawPressedPushButton(HDC hDC, HWND hButton, RECT rc)
|
|||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Check Box Functions
|
||||
*/
|
||||
|
||||
static LONG CB_Paint(HWND hWnd)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
RECT rc, rc3;
|
||||
HDC hDC;
|
||||
HPEN hPen, hOldPen;
|
||||
HBRUSH hBrush, hGrayBrush;
|
||||
int textlen, delta;
|
||||
char *text;
|
||||
HANDLE hText;
|
||||
TEXTMETRIC tm;
|
||||
SIZE size;
|
||||
WND *wndPtr = WIN_FindWndPtr(hWnd);
|
||||
|
||||
hDC = BeginPaint(hWnd, &ps);
|
||||
GetClientRect(hWnd, &rc);
|
||||
|
||||
hPen = CreatePen(PS_SOLID, 1, color_windowtext);
|
||||
hOldPen = (HPEN)SelectObject(hDC, (HANDLE)hPen);
|
||||
hGrayBrush = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
|
||||
|
||||
hBrush = SendMessage(GetParent(hWnd), WM_CTLCOLOR, (WORD)hDC,
|
||||
MAKELPARAM(hWnd, CTLCOLOR_BTN));
|
||||
FillRect(hDC, &rc, hBrush);
|
||||
|
||||
textlen = GetWindowTextLength(hWnd);
|
||||
hText = LocalAlloc(LMEM_MOVEABLE, textlen+1);
|
||||
text = LocalLock(hText);
|
||||
GetWindowText(hWnd, text, textlen+1);
|
||||
GetTextMetrics(hDC, &tm);
|
||||
|
||||
delta = (rc.bottom - rc.top - tm.tmHeight) >> 1;
|
||||
Rectangle(hDC, 0, rc.top + delta, tm.tmHeight, tm.tmHeight + delta);
|
||||
if (pressed)
|
||||
Rectangle(hDC, 1, rc.top + delta + 1, tm.tmHeight - 1,
|
||||
tm.tmHeight + delta - 1);
|
||||
|
||||
switch ((WORD)(*(wndPtr->wExtra)))
|
||||
{
|
||||
case 1:
|
||||
MoveTo(hDC, 0, rc.top + delta);
|
||||
LineTo(hDC, tm.tmHeight - 1, tm.tmHeight + delta - 1);
|
||||
MoveTo(hDC, 0, tm.tmHeight + delta - 1);
|
||||
LineTo(hDC, tm.tmHeight - 1, rc.top + delta);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
rc3.left = 1;
|
||||
rc3.top = rc.top + delta + 1;
|
||||
rc3.right = tm.tmHeight - 1;
|
||||
rc3.bottom = tm.tmHeight + delta - 1;
|
||||
FillRect(hDC, &rc3, hGrayBrush);
|
||||
break;
|
||||
}
|
||||
|
||||
rc.left = tm.tmHeight + tm.tmAveCharWidth / 2;
|
||||
DrawText(hDC, text, textlen, &rc, DT_SINGLELINE | DT_VCENTER);
|
||||
|
||||
/* do we have the focus? */
|
||||
if (GetFocus() == hWnd)
|
||||
{
|
||||
GetTextExtentPoint(hDC, text, textlen, &size);
|
||||
rc.top += delta - 1;
|
||||
rc.bottom -= delta + 1;
|
||||
rc.left--;
|
||||
rc.right = rc.left + size.cx + 2;
|
||||
DrawFocusRect(hDC, &rc);
|
||||
}
|
||||
|
||||
LocalUnlock(hText);
|
||||
LocalFree(hText);
|
||||
GlobalUnlock(hWnd);
|
||||
EndPaint(hWnd, &ps);
|
||||
}
|
||||
|
||||
static LONG CB_LButtonDown(HWND hWnd, WORD wParam, LONG lParam)
|
||||
{
|
||||
RECT rc;
|
||||
HDC hDC;
|
||||
TEXTMETRIC tm;
|
||||
int delta;
|
||||
|
||||
hDC = GetDC(hWnd);
|
||||
GetTextMetrics(hDC, &tm);
|
||||
ReleaseDC(hWnd, hDC);
|
||||
GetClientRect(hWnd, &rc);
|
||||
delta = (rc.bottom - rc.top - tm.tmHeight) >> 1;
|
||||
rc.top += delta;
|
||||
rc.bottom = tm.tmHeight + delta;
|
||||
rc.right = tm.tmHeight;
|
||||
if (PtInRect(&rc, MAKEPOINT(lParam)))
|
||||
{
|
||||
/* SetFocus(hWnd); */
|
||||
SetCapture(hWnd);
|
||||
pressed = TRUE;
|
||||
InvalidateRect(hWnd, NULL, FALSE);
|
||||
UpdateWindow(hWnd);
|
||||
}
|
||||
}
|
||||
|
||||
static LONG CB_LButtonUp(HWND hWnd, WORD wParam, LONG lParam)
|
||||
{
|
||||
RECT rc;
|
||||
HDC hDC;
|
||||
TEXTMETRIC tm;
|
||||
int delta;
|
||||
WND *wndPtr = WIN_FindWndPtr(hWnd);
|
||||
LONG style;
|
||||
|
||||
pressed = FALSE;
|
||||
ReleaseCapture();
|
||||
hDC = GetDC(hWnd);
|
||||
GetTextMetrics(hDC, &tm);
|
||||
ReleaseDC(hWnd, hDC);
|
||||
GetClientRect(hWnd, &rc);
|
||||
delta = (rc.bottom - rc.top - tm.tmHeight) >> 1;
|
||||
rc.top += delta;
|
||||
rc.bottom = tm.tmHeight + delta;
|
||||
rc.right = tm.tmHeight;
|
||||
|
||||
if (PtInRect(&rc, MAKEPOINT(lParam)))
|
||||
{
|
||||
style = wndPtr->dwStyle & 0x0000000F;
|
||||
if (style == BS_AUTOCHECKBOX)
|
||||
{
|
||||
switch ((WORD)(*(wndPtr->wExtra)))
|
||||
{
|
||||
case 0:
|
||||
(WORD)(*(wndPtr->wExtra)) = 1;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
(WORD)(*(wndPtr->wExtra)) = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (style == BS_AUTO3STATE)
|
||||
{
|
||||
switch ((WORD)(*(wndPtr->wExtra)))
|
||||
{
|
||||
case 0:
|
||||
(WORD)(*(wndPtr->wExtra)) = 1;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
(WORD)(*(wndPtr->wExtra)) = 2;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
(WORD)(*(wndPtr->wExtra)) = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
NOTIFY_PARENT(hWnd, BN_CLICKED);
|
||||
}
|
||||
GlobalUnlock(hWnd);
|
||||
InvalidateRect(hWnd, NULL, FALSE);
|
||||
UpdateWindow(hWnd);
|
||||
}
|
||||
|
||||
static LONG CB_LButtonDblClk(HWND hWnd, WORD wParam, LONG lParam)
|
||||
{
|
||||
RECT rc;
|
||||
HDC hDC;
|
||||
TEXTMETRIC tm;
|
||||
int delta;
|
||||
|
||||
hDC = GetDC(hWnd);
|
||||
GetTextMetrics(hDC, &tm);
|
||||
ReleaseDC(hWnd, hDC);
|
||||
GetClientRect(hWnd, &rc);
|
||||
delta = (rc.bottom - rc.top - tm.tmHeight) >> 1;
|
||||
rc.top += delta;
|
||||
rc.bottom = tm.tmHeight + delta;
|
||||
rc.right = tm.tmHeight;
|
||||
if (PtInRect(&rc, MAKEPOINT(lParam)))
|
||||
NOTIFY_PARENT(hWnd, BN_DOUBLECLICKED);
|
||||
}
|
||||
|
||||
static LONG CB_KillFocus(HWND hWnd)
|
||||
{
|
||||
pressed = FALSE;
|
||||
InvalidateRect(hWnd, NULL, FALSE);
|
||||
UpdateWindow(hWnd);
|
||||
}
|
||||
|
||||
static LONG CB_SetCheck(HWND hWnd, WORD wParam)
|
||||
{
|
||||
WND *wndPtr = WIN_FindWndPtr(hWnd);
|
||||
|
||||
if ((WORD)(*(wndPtr->wExtra)) != wParam)
|
||||
{
|
||||
(WORD)(*(wndPtr->wExtra)) = wParam;
|
||||
InvalidateRect(hWnd, NULL, FALSE);
|
||||
UpdateWindow(hWnd);
|
||||
}
|
||||
GlobalUnlock(hWnd);
|
||||
}
|
||||
|
||||
static LONG CB_GetCheck(HWND hWnd)
|
||||
{
|
||||
WORD wResult;
|
||||
WND *wndPtr = WIN_FindWndPtr(hWnd);
|
||||
|
||||
wResult = (WORD)(*(wndPtr->wExtra));
|
||||
GlobalUnlock(hWnd);
|
||||
return (LONG)wResult;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Radio Button Functions
|
||||
*/
|
||||
|
||||
static LONG RB_Paint(HWND hWnd)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
RECT rc;
|
||||
HDC hDC;
|
||||
HPEN hPen, hOldPen;
|
||||
HBRUSH hBrush, hOldBrush;
|
||||
int textlen, delta;
|
||||
char *text;
|
||||
HANDLE hText;
|
||||
TEXTMETRIC tm;
|
||||
SIZE size;
|
||||
WND *wndPtr = WIN_FindWndPtr(hWnd);
|
||||
|
||||
hDC = BeginPaint(hWnd, &ps);
|
||||
GetClientRect(hWnd, &rc);
|
||||
|
||||
hPen = CreatePen(PS_SOLID, 1, color_windowtext);
|
||||
hOldPen = (HPEN)SelectObject(hDC, (HANDLE)hPen);
|
||||
|
||||
hBrush = SendMessage(GetParent(hWnd), WM_CTLCOLOR, (WORD)hDC,
|
||||
MAKELPARAM(hWnd, CTLCOLOR_BTN));
|
||||
FillRect(hDC, &rc, hBrush);
|
||||
|
||||
textlen = GetWindowTextLength(hWnd);
|
||||
hText = LocalAlloc(LMEM_MOVEABLE, textlen+1);
|
||||
text = LocalLock(hText);
|
||||
GetWindowText(hWnd, text, textlen+1);
|
||||
GetTextMetrics(hDC, &tm);
|
||||
|
||||
delta = (rc.bottom - rc.top - tm.tmHeight) >> 1;
|
||||
Ellipse(hDC, 0, rc.top + delta, tm.tmHeight, tm.tmHeight + delta);
|
||||
if (pressed)
|
||||
Ellipse(hDC, 1, rc.top + delta + 1, tm.tmHeight - 1,
|
||||
tm.tmHeight + delta - 1);
|
||||
|
||||
if ((WORD)(*(wndPtr->wExtra)) == 1)
|
||||
{
|
||||
hBrush = CreateSolidBrush(color_windowtext);
|
||||
hOldBrush = (HBRUSH)SelectObject(hDC, (HANDLE)hBrush);
|
||||
Ellipse(hDC, 3, rc.top + delta + 3, tm.tmHeight - 3,
|
||||
tm.tmHeight + delta -3);
|
||||
SelectObject(hDC, (HANDLE)hOldBrush);
|
||||
DeleteObject((HANDLE)hBrush);
|
||||
}
|
||||
|
||||
rc.left = tm.tmHeight + tm.tmAveCharWidth / 2;
|
||||
DrawText(hDC, text, textlen, &rc, DT_SINGLELINE | DT_VCENTER);
|
||||
|
||||
/* do we have the focus? */
|
||||
if (GetFocus() == hWnd)
|
||||
{
|
||||
GetTextExtentPoint(hDC, text, textlen, &size);
|
||||
rc.top += delta - 1;
|
||||
rc.bottom -= delta + 1;
|
||||
rc.left--;
|
||||
rc.right = rc.left + size.cx + 2;
|
||||
DrawFocusRect(hDC, &rc);
|
||||
}
|
||||
|
||||
LocalUnlock(hText);
|
||||
LocalFree(hText);
|
||||
GlobalUnlock(hWnd);
|
||||
EndPaint(hWnd, &ps);
|
||||
}
|
||||
|
||||
static LONG RB_LButtonDown(HWND hWnd, WORD wParam, LONG lParam)
|
||||
{
|
||||
RECT rc;
|
||||
HDC hDC;
|
||||
TEXTMETRIC tm;
|
||||
int delta;
|
||||
|
||||
hDC = GetDC(hWnd);
|
||||
GetTextMetrics(hDC, &tm);
|
||||
ReleaseDC(hWnd, hDC);
|
||||
GetClientRect(hWnd, &rc);
|
||||
delta = (rc.bottom - rc.top - tm.tmHeight) >> 1;
|
||||
rc.top += delta;
|
||||
rc.bottom = tm.tmHeight + delta;
|
||||
rc.right = tm.tmHeight;
|
||||
if (PtInRect(&rc, MAKEPOINT(lParam)))
|
||||
{
|
||||
/* SetFocus(hWnd); */
|
||||
SetCapture(hWnd);
|
||||
pressed = TRUE;
|
||||
InvalidateRect(hWnd, NULL, FALSE);
|
||||
UpdateWindow(hWnd);
|
||||
}
|
||||
}
|
||||
|
||||
static LONG RB_LButtonUp(HWND hWnd, WORD wParam, LONG lParam)
|
||||
{
|
||||
RECT rc;
|
||||
HDC hDC;
|
||||
TEXTMETRIC tm;
|
||||
int delta;
|
||||
WND *wndPtr = WIN_FindWndPtr(hWnd);
|
||||
LONG style;
|
||||
|
||||
pressed = FALSE;
|
||||
ReleaseCapture();
|
||||
hDC = GetDC(hWnd);
|
||||
GetTextMetrics(hDC, &tm);
|
||||
ReleaseDC(hWnd, hDC);
|
||||
GetClientRect(hWnd, &rc);
|
||||
delta = (rc.bottom - rc.top - tm.tmHeight) >> 1;
|
||||
rc.top += delta;
|
||||
rc.bottom = tm.tmHeight + delta;
|
||||
rc.right = tm.tmHeight;
|
||||
|
||||
if (PtInRect(&rc, MAKEPOINT(lParam)))
|
||||
{
|
||||
style = wndPtr->dwStyle & 0x0000000F;
|
||||
if (style == BS_AUTORADIOBUTTON)
|
||||
(WORD)(*(wndPtr->wExtra)) = 1;
|
||||
NOTIFY_PARENT(hWnd, BN_CLICKED);
|
||||
}
|
||||
GlobalUnlock(hWnd);
|
||||
InvalidateRect(hWnd, NULL, FALSE);
|
||||
UpdateWindow(hWnd);
|
||||
}
|
||||
|
||||
static LONG RB_LButtonDblClk(HWND hWnd, WORD wParam, LONG lParam)
|
||||
{
|
||||
RECT rc;
|
||||
HDC hDC;
|
||||
TEXTMETRIC tm;
|
||||
int delta;
|
||||
|
||||
hDC = GetDC(hWnd);
|
||||
GetTextMetrics(hDC, &tm);
|
||||
ReleaseDC(hWnd, hDC);
|
||||
GetClientRect(hWnd, &rc);
|
||||
delta = (rc.bottom - rc.top - tm.tmHeight) >> 1;
|
||||
rc.top += delta;
|
||||
rc.bottom = tm.tmHeight + delta;
|
||||
rc.right = tm.tmHeight;
|
||||
if (PtInRect(&rc, MAKEPOINT(lParam)))
|
||||
NOTIFY_PARENT(hWnd, BN_DOUBLECLICKED);
|
||||
}
|
||||
|
||||
static LONG RB_KillFocus(HWND hWnd)
|
||||
{
|
||||
pressed = FALSE;
|
||||
InvalidateRect(hWnd, NULL, FALSE);
|
||||
UpdateWindow(hWnd);
|
||||
}
|
||||
|
||||
static LONG RB_SetCheck(HWND hWnd, WORD wParam)
|
||||
{
|
||||
WND *wndPtr = WIN_FindWndPtr(hWnd);
|
||||
|
||||
if ((WORD)(*(wndPtr->wExtra)) != wParam)
|
||||
{
|
||||
(WORD)(*(wndPtr->wExtra)) = wParam;
|
||||
InvalidateRect(hWnd, NULL, FALSE);
|
||||
UpdateWindow(hWnd);
|
||||
}
|
||||
GlobalUnlock(hWnd);
|
||||
}
|
||||
|
||||
static LONG RB_GetCheck(HWND hWnd)
|
||||
{
|
||||
WORD wResult;
|
||||
WND *wndPtr = WIN_FindWndPtr(hWnd);
|
||||
|
||||
wResult = (WORD)(*(wndPtr->wExtra));
|
||||
GlobalUnlock(hWnd);
|
||||
return (LONG)wResult;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Group Box Functions
|
||||
*/
|
||||
|
||||
static LONG GB_Paint(HWND hWnd)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
RECT rc;
|
||||
HDC hDC;
|
||||
HPEN hPen, hOldPen;
|
||||
HBRUSH hBrush;
|
||||
int textlen;
|
||||
char *text;
|
||||
HANDLE hText;
|
||||
SIZE size;
|
||||
|
||||
hDC = BeginPaint(hWnd, &ps);
|
||||
GetClientRect(hWnd, &rc);
|
||||
|
||||
hPen = CreatePen(PS_SOLID, 1, color_windowtext);
|
||||
hOldPen = (HPEN)SelectObject(hDC, (HANDLE)hPen);
|
||||
|
||||
hBrush = SendMessage(GetParent(hWnd), WM_CTLCOLOR, (WORD)hDC,
|
||||
MAKELPARAM(hWnd, CTLCOLOR_BTN));
|
||||
FillRect(hDC, &rc, hBrush);
|
||||
|
||||
textlen = GetWindowTextLength(hWnd);
|
||||
hText = LocalAlloc(LMEM_MOVEABLE, textlen+1);
|
||||
text = LocalLock(hText);
|
||||
GetWindowText(hWnd, text, textlen+1);
|
||||
GetTextExtentPoint(hDC, text, textlen, &size);
|
||||
|
||||
rc.top = 5;
|
||||
Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
|
||||
rc.left = 10;
|
||||
rc.top = 0;
|
||||
rc.right = rc.left + size.cx + 1;
|
||||
rc.bottom = size.cy;
|
||||
DrawText(hDC, text, textlen, &rc, DT_SINGLELINE);
|
||||
|
||||
LocalUnlock(hText);
|
||||
LocalFree(hText);
|
||||
EndPaint(hWnd, &ps);
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* User Button Functions
|
||||
*/
|
||||
|
||||
static LONG UB_Paint(HWND hWnd)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HDC hDC;
|
||||
RECT rc;
|
||||
HBRUSH hBrush;
|
||||
|
||||
hDC = BeginPaint(hWnd, &ps);
|
||||
GetClientRect(hWnd, &rc);
|
||||
|
||||
hBrush = SendMessage(GetParent(hWnd), WM_CTLCOLOR, (WORD)hDC,
|
||||
MAKELPARAM(hWnd, CTLCOLOR_BTN));
|
||||
FillRect(hDC, &rc, hBrush);
|
||||
|
||||
NOTIFY_PARENT(hWnd, BN_PAINT);
|
||||
|
||||
/* do we have the focus? */
|
||||
if (GetFocus() == hWnd)
|
||||
DrawFocusRect(hDC, &rc);
|
||||
|
||||
EndPaint(hWnd, &ps);
|
||||
}
|
||||
|
||||
static LONG UB_LButtonDown(HWND hWnd, WORD wParam, LONG lParam)
|
||||
{
|
||||
RECT rc;
|
||||
|
||||
/* SetFocus(hWnd); */
|
||||
SetCapture(hWnd);
|
||||
GetClientRect(hWnd, &rc);
|
||||
if (PtInRect(&rc, MAKEPOINT(lParam)))
|
||||
NOTIFY_PARENT(hWnd, BN_HILITE);
|
||||
InvalidateRect(hWnd, NULL, FALSE);
|
||||
UpdateWindow(hWnd);
|
||||
}
|
||||
|
||||
static LONG UB_LButtonUp(HWND hWnd, WORD wParam, LONG lParam)
|
||||
{
|
||||
RECT rc;
|
||||
|
||||
ReleaseCapture();
|
||||
GetClientRect(hWnd, &rc);
|
||||
if (PtInRect(&rc, MAKEPOINT(lParam)))
|
||||
NOTIFY_PARENT(hWnd, BN_UNHILITE);
|
||||
InvalidateRect(hWnd, NULL, FALSE);
|
||||
UpdateWindow(hWnd);
|
||||
}
|
||||
|
||||
static LONG UB_KillFocus(HWND hWnd)
|
||||
{
|
||||
InvalidateRect(hWnd, NULL, FALSE);
|
||||
UpdateWindow(hWnd);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,256 @@
|
|||
/*
|
||||
* Interface code to COMBOBOX widget
|
||||
*
|
||||
* Copyright Martin Ayotte, 1993
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
#define DEBUG_COMBO
|
||||
*/
|
||||
|
||||
static char Copyright[] = "Copyright Martin Ayotte, 1993";
|
||||
|
||||
#include <X11/Intrinsic.h>
|
||||
#include <X11/StringDefs.h>
|
||||
#include "windows.h"
|
||||
#include "combo.h"
|
||||
#include "heap.h"
|
||||
#include "win.h"
|
||||
#include "dirent.h"
|
||||
#include <sys/stat.h>
|
||||
|
||||
LPHEADCOMBO ComboGetStorageHeader(HWND hwnd);
|
||||
int CreateComboStruct(HWND hwnd);
|
||||
|
||||
|
||||
void COMBOBOX_CreateComboBox(LPSTR className, LPSTR comboLabel, HWND hwnd)
|
||||
{
|
||||
WND *wndPtr = WIN_FindWndPtr(hwnd);
|
||||
WND *parentPtr = WIN_FindWndPtr(wndPtr->hwndParent);
|
||||
DWORD style;
|
||||
char widgetName[15];
|
||||
|
||||
#ifdef DEBUG_COMBO
|
||||
printf("combo: label = %s, x = %d, y = %d\n", comboLabel,
|
||||
wndPtr->rectClient.left, wndPtr->rectClient.top);
|
||||
printf(" width = %d, height = %d\n",
|
||||
wndPtr->rectClient.right - wndPtr->rectClient.left,
|
||||
wndPtr->rectClient.bottom - wndPtr->rectClient.top);
|
||||
#endif
|
||||
|
||||
if (!wndPtr)
|
||||
return;
|
||||
|
||||
style = wndPtr->dwStyle & 0x0000FFFF;
|
||||
/*
|
||||
if ((style & LBS_NOTIFY) == LBS_NOTIFY)
|
||||
*/
|
||||
sprintf(widgetName, "%s%d", className, wndPtr->wIDmenu);
|
||||
wndPtr->winWidget = XtVaCreateManagedWidget(widgetName,
|
||||
compositeWidgetClass,
|
||||
parentPtr->winWidget,
|
||||
XtNx, wndPtr->rectClient.left,
|
||||
XtNy, wndPtr->rectClient.top,
|
||||
XtNwidth, wndPtr->rectClient.right -
|
||||
wndPtr->rectClient.left,
|
||||
XtNheight, 16,
|
||||
NULL );
|
||||
GlobalUnlock(hwnd);
|
||||
GlobalUnlock(wndPtr->hwndParent);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* WIDGETS_ComboWndProc
|
||||
*/
|
||||
LONG COMBOBOX_ComboBoxWndProc( HWND hwnd, WORD message,
|
||||
WORD wParam, LONG lParam )
|
||||
{
|
||||
WORD wRet;
|
||||
RECT rect;
|
||||
int y;
|
||||
int width, height;
|
||||
WND *wndPtr;
|
||||
LPHEADCOMBO lphc;
|
||||
char str[128];
|
||||
static RECT rectsel;
|
||||
switch(message)
|
||||
{
|
||||
case WM_CREATE:
|
||||
CreateComboStruct(hwnd);
|
||||
wndPtr = WIN_FindWndPtr(hwnd);
|
||||
width = wndPtr->rectClient.right - wndPtr->rectClient.left;
|
||||
height = wndPtr->rectClient.bottom - wndPtr->rectClient.top;
|
||||
lphc = ComboGetStorageHeader(hwnd);
|
||||
if (lphc == NULL) return 0;
|
||||
lphc->hWndDrop = CreateWindow("BUTTON", "",
|
||||
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON,
|
||||
width - 16, 0, 16, 16, hwnd, 1, wndPtr->hInstance, 0L);
|
||||
lphc->hWndEdit = CreateWindow("STATIC", "",
|
||||
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | SS_LEFT,
|
||||
0, 0, width - 16, 16, hwnd, 1, wndPtr->hInstance, 0L);
|
||||
lphc->hWndLBox = CreateWindow("LISTBOX", "",
|
||||
WS_CHILD | WS_CLIPCHILDREN | WS_BORDER | WS_VSCROLL | LBS_NOTIFY,
|
||||
wndPtr->rectClient.left, wndPtr->rectClient.top + 16, width, height,
|
||||
wndPtr->hwndParent, 1, wndPtr->hInstance, (LPSTR)MAKELONG(0, hwnd));
|
||||
/*
|
||||
ShowWindow(lphc->hWndLBox, SW_HIDE);
|
||||
*/
|
||||
InvalidateRect(lphc->hWndEdit, NULL, TRUE);
|
||||
UpdateWindow(lphc->hWndEdit);
|
||||
InvalidateRect(lphc->hWndDrop, NULL, TRUE);
|
||||
UpdateWindow(lphc->hWndDrop);
|
||||
#ifdef DEBUG_COMBO
|
||||
printf("Combo Creation Drop=%X LBox=%X!\n", lphc->hWndDrop, lphc->hWndLBox);
|
||||
#endif
|
||||
return 0;
|
||||
case WM_DESTROY:
|
||||
lphc = ComboGetStorageHeader(hwnd);
|
||||
DestroyWindow(lphc->hWndDrop);
|
||||
DestroyWindow(lphc->hWndEdit);
|
||||
DestroyWindow(lphc->hWndLBox);
|
||||
free(lphc);
|
||||
#ifdef DEBUG_COMBO
|
||||
printf("Combo WM_DESTROY !\n");
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
case WM_COMMAND:
|
||||
wndPtr = WIN_FindWndPtr(hwnd);
|
||||
lphc = ComboGetStorageHeader(hwnd);
|
||||
if (lphc == NULL) return 0;
|
||||
if (LOWORD(lParam) == lphc->hWndDrop) {
|
||||
if (HIWORD(lParam) != BN_CLICKED) return 0;
|
||||
#ifdef DEBUG_COMBO
|
||||
printf("CB_SHOWDROPDOWN !\n");
|
||||
#endif
|
||||
lphc->dwState = lphc->dwState ^ CB_SHOWDROPDOWN;
|
||||
if ((lphc->dwState & CB_SHOWDROPDOWN) == CB_SHOWDROPDOWN) {
|
||||
ShowWindow(lphc->hWndLBox, SW_SHOW);
|
||||
}
|
||||
else {
|
||||
ShowWindow(lphc->hWndLBox, SW_HIDE);
|
||||
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
|
||||
SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, (LPARAM)str);
|
||||
SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, (LPARAM)str);
|
||||
printf("combo hide\n");
|
||||
}
|
||||
}
|
||||
if (LOWORD(lParam) == lphc->hWndLBox) {
|
||||
switch(HIWORD(lParam))
|
||||
{
|
||||
case LBN_SELCHANGE:
|
||||
lphc->dwState = lphc->dwState ^ CB_SHOWDROPDOWN;
|
||||
ShowWindow(lphc->hWndLBox, SW_HIDE);
|
||||
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
|
||||
SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, (LPARAM)str);
|
||||
SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, (LPARAM)str);
|
||||
SendMessage(GetParent(hwnd), WM_COMMAND, wndPtr->wIDmenu,
|
||||
MAKELONG(hwnd, CBN_SELCHANGE));
|
||||
break;
|
||||
case LBN_DBLCLK:
|
||||
SendMessage(GetParent(hwnd), WM_COMMAND, wndPtr->wIDmenu,
|
||||
MAKELONG(hwnd, CBN_DBLCLK));
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_LBUTTONDOWN:
|
||||
printf("Combo WM_LBUTTONDOWN wParam=%x lParam=%lX !\n", wParam, lParam);
|
||||
break;
|
||||
case WM_KEYDOWN:
|
||||
printf("Combo WM_KEYDOWN wParam %X!\n", wParam);
|
||||
break;
|
||||
case WM_CTLCOLOR:
|
||||
return(SendMessage(GetParent(hwnd), WM_CTLCOLOR, wParam, lParam));
|
||||
case WM_PAINT:
|
||||
lphc = ComboGetStorageHeader(hwnd);
|
||||
InvalidateRect(lphc->hWndEdit, NULL, TRUE);
|
||||
UpdateWindow(lphc->hWndEdit);
|
||||
InvalidateRect(lphc->hWndDrop, NULL, TRUE);
|
||||
UpdateWindow(lphc->hWndDrop);
|
||||
if ((lphc->dwState & CB_SHOWDROPDOWN) == CB_SHOWDROPDOWN) {
|
||||
InvalidateRect(lphc->hWndLBox, NULL, TRUE);
|
||||
UpdateWindow(lphc->hWndLBox);
|
||||
}
|
||||
break;
|
||||
case WM_MOUSEMOVE:
|
||||
if ((wParam & MK_LBUTTON) != 0) {
|
||||
y = HIWORD(lParam);
|
||||
if (y < 4) {
|
||||
lphc = ComboGetStorageHeader(hwnd);
|
||||
}
|
||||
GetClientRect(hwnd, &rect);
|
||||
if (y > (rect.bottom - 4)) {
|
||||
lphc = ComboGetStorageHeader(hwnd);
|
||||
}
|
||||
}
|
||||
case CB_ADDSTRING:
|
||||
#ifdef DEBUG_COMBO
|
||||
printf("CB_ADDSTRING '%s' !\n", (LPSTR)lParam);
|
||||
#endif
|
||||
lphc = ComboGetStorageHeader(hwnd);
|
||||
return(SendMessage(lphc->hWndLBox, LB_ADDSTRING, wParam, lParam));
|
||||
case CB_GETLBTEXT:
|
||||
printf("CB_GETLBTEXT #%u !\n", wParam);
|
||||
lphc = ComboGetStorageHeader(hwnd);
|
||||
return(SendMessage(lphc->hWndLBox, LB_GETTEXT, wParam, lParam));
|
||||
case CB_INSERTSTRING:
|
||||
printf("CB_INSERTSTRING '%s' !\n", (LPSTR)lParam);
|
||||
lphc = ComboGetStorageHeader(hwnd);
|
||||
return(SendMessage(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam));
|
||||
case CB_DELETESTRING:
|
||||
printf("CB_DELETESTRING #%u !\n", wParam);
|
||||
lphc = ComboGetStorageHeader(hwnd);
|
||||
return(SendMessage(lphc->hWndLBox, LB_DELETESTRING, wParam, 0L));
|
||||
case CB_RESETCONTENT:
|
||||
printf("CB_RESETCONTENT !\n");
|
||||
lphc = ComboGetStorageHeader(hwnd);
|
||||
return(SendMessage(lphc->hWndLBox, LB_RESETCONTENT, 0, 0L));
|
||||
case CB_DIR:
|
||||
printf("ComboBox CB_DIR !\n");
|
||||
return(SendMessage(lphc->hWndLBox, LB_DIR, wParam, lParam));
|
||||
case CB_FINDSTRING:
|
||||
return(SendMessage(lphc->hWndLBox, LB_FINDSTRING, wParam, lParam));
|
||||
case CB_GETCOUNT:
|
||||
return(SendMessage(lphc->hWndLBox, LB_GETCOUNT, 0, 0L));
|
||||
case CB_GETCURSEL:
|
||||
printf("ComboBox CB_GETCURSEL !\n");
|
||||
return(SendMessage(lphc->hWndLBox, LB_GETCOUNT, 0, 0L));
|
||||
case CB_SETCURSEL:
|
||||
printf("ComboBox CB_SETCURSEL wParam=%x !\n", wParam);
|
||||
return(SendMessage(lphc->hWndLBox, LB_GETCOUNT, wParam, 0L));
|
||||
|
||||
default:
|
||||
return DefWindowProc( hwnd, message, wParam, lParam );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
LPHEADCOMBO ComboGetStorageHeader(HWND hwnd)
|
||||
{
|
||||
WND *wndPtr;
|
||||
LPHEADCOMBO lphc;
|
||||
wndPtr = WIN_FindWndPtr(hwnd);
|
||||
lphc = *((LPHEADCOMBO *)&wndPtr->wExtra[1]);
|
||||
return lphc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int CreateComboStruct(HWND hwnd)
|
||||
{
|
||||
WND *wndPtr;
|
||||
LPHEADCOMBO lphc;
|
||||
wndPtr = WIN_FindWndPtr(hwnd);
|
||||
lphc = (LPHEADCOMBO)malloc(sizeof(HEADCOMBO));
|
||||
*((LPHEADCOMBO *)&wndPtr->wExtra[1]) = lphc;
|
||||
lphc->dwState = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,963 @@
|
|||
/*
|
||||
* Interface code to listbox widgets
|
||||
*
|
||||
* Copyright Martin Ayotte, 1993
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
#define DEBUG_LISTBOX
|
||||
*/
|
||||
|
||||
static char Copyright[] = "Copyright Martin Ayotte, 1993";
|
||||
|
||||
#include <X11/Intrinsic.h>
|
||||
#include <X11/StringDefs.h>
|
||||
#include "windows.h"
|
||||
#include "user.h"
|
||||
#include "heap.h"
|
||||
#include "win.h"
|
||||
#include "listbox.h"
|
||||
#include "scroll.h"
|
||||
#include "dirent.h"
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define GMEM_ZEROINIT 0x0040
|
||||
|
||||
|
||||
LPHEADLIST ListBoxGetWindowAndStorage(HWND hwnd, WND **wndPtr);
|
||||
LPHEADLIST ListBoxGetStorageHeader(HWND hwnd);
|
||||
void StdDrawListBox(HWND hwnd);
|
||||
void OwnerDrawListBox(HWND hwnd);
|
||||
int ListBoxFindMouse(HWND hwnd, int X, int Y);
|
||||
int CreateListBoxStruct(HWND hwnd);
|
||||
int ListBoxAddString(HWND hwnd, LPSTR newstr);
|
||||
int ListBoxInsertString(HWND hwnd, UINT uIndex, LPSTR newstr);
|
||||
int ListBoxGetText(HWND hwnd, UINT uIndex, LPSTR OutStr);
|
||||
int ListBoxDeleteString(HWND hwnd, UINT uIndex);
|
||||
int ListBoxFindString(HWND hwnd, UINT nFirst, LPSTR MatchStr);
|
||||
int ListBoxResetContent(HWND hwnd);
|
||||
int ListBoxSetCurSel(HWND hwnd, WORD wIndex);
|
||||
int ListBoxSetSel(HWND hwnd, WORD wIndex);
|
||||
int ListBoxDirectory(HWND hwnd, UINT attrib, LPSTR filespec);
|
||||
int ListBoxGetItemRect(HWND hwnd, WORD wIndex, LPRECT rect);
|
||||
int ListBoxSetItemHeight(HWND hwnd, WORD wIndex, long height);
|
||||
int ListBoxDefaultItem(HWND hwnd, WND *wndPtr,
|
||||
LPHEADLIST lphl, LPLISTSTRUCT lpls);
|
||||
int ListBoxFindNextMatch(HWND hwnd, WORD wChar);
|
||||
|
||||
|
||||
|
||||
void LISTBOX_CreateListBox(LPSTR className, LPSTR listboxLabel, HWND hwnd)
|
||||
{
|
||||
WND *wndPtr = WIN_FindWndPtr(hwnd);
|
||||
WND *parentPtr = WIN_FindWndPtr(wndPtr->hwndParent);
|
||||
DWORD style;
|
||||
char widgetName[15];
|
||||
|
||||
#ifdef DEBUG_LISTBOX
|
||||
printf("listbox: label = %s, x = %d, y = %d\n", listboxLabel,
|
||||
wndPtr->rectClient.left, wndPtr->rectClient.top);
|
||||
printf(" width = %d, height = %d\n",
|
||||
wndPtr->rectClient.right - wndPtr->rectClient.left,
|
||||
wndPtr->rectClient.bottom - wndPtr->rectClient.top);
|
||||
#endif
|
||||
|
||||
if (!wndPtr)
|
||||
return;
|
||||
|
||||
style = wndPtr->dwStyle & 0x0000FFFF;
|
||||
/*
|
||||
if ((style & LBS_NOTIFY) == LBS_NOTIFY)
|
||||
if ((style & LBS_SORT) == LBS_SORT)
|
||||
*/
|
||||
sprintf(widgetName, "%s%d", className, wndPtr->wIDmenu);
|
||||
wndPtr->winWidget = XtVaCreateManagedWidget(widgetName,
|
||||
compositeWidgetClass,
|
||||
parentPtr->winWidget,
|
||||
XtNx, wndPtr->rectClient.left,
|
||||
XtNy, wndPtr->rectClient.top,
|
||||
XtNwidth, wndPtr->rectClient.right -
|
||||
wndPtr->rectClient.left,
|
||||
XtNheight, wndPtr->rectClient.bottom -
|
||||
wndPtr->rectClient.top,
|
||||
NULL );
|
||||
GlobalUnlock(hwnd);
|
||||
GlobalUnlock(wndPtr->hwndParent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* WIDGETS_ListBoxWndProc
|
||||
*/
|
||||
LONG LISTBOX_ListBoxWndProc( HWND hwnd, WORD message,
|
||||
WORD wParam, LONG lParam )
|
||||
{
|
||||
WND *wndPtr;
|
||||
LPHEADLIST lphl;
|
||||
WORD wRet;
|
||||
RECT rect;
|
||||
int y;
|
||||
int width, height;
|
||||
CREATESTRUCT *createStruct;
|
||||
static RECT rectsel;
|
||||
switch(message)
|
||||
{
|
||||
case WM_CREATE:
|
||||
CreateListBoxStruct(hwnd);
|
||||
lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr);
|
||||
createStruct = (CREATESTRUCT *)lParam;
|
||||
if (HIWORD(createStruct->lpCreateParams) != 0)
|
||||
lphl->hWndLogicParent = (HWND)HIWORD(createStruct->lpCreateParams);
|
||||
else
|
||||
lphl->hWndLogicParent = GetParent(hwnd);
|
||||
width = wndPtr->rectClient.right - wndPtr->rectClient.left;
|
||||
height = wndPtr->rectClient.bottom - wndPtr->rectClient.top;
|
||||
lphl->hWndScroll = CreateWindow("SCROLLBAR", "",
|
||||
WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBS_VERT,
|
||||
width - 17, 0, 16, height, hwnd, 1, wndPtr->hInstance, NULL);
|
||||
ShowWindow(lphl->hWndScroll, SW_HIDE);
|
||||
SetScrollRange(lphl->hWndScroll, WM_VSCROLL, 1, lphl->ItemsCount, TRUE);
|
||||
return 0;
|
||||
case WM_DESTROY:
|
||||
lphl = ListBoxGetStorageHeader(hwnd);
|
||||
ListBoxResetContent(hwnd);
|
||||
DestroyWindow(lphl->hWndScroll);
|
||||
free(lphl);
|
||||
printf("ListBox WM_DESTROY !\n");
|
||||
return 0;
|
||||
|
||||
case WM_VSCROLL:
|
||||
lphl = ListBoxGetStorageHeader(hwnd);
|
||||
if (lphl == NULL) return 0;
|
||||
y = lphl->FirstVisible;
|
||||
switch(wParam) {
|
||||
case SB_LINEUP:
|
||||
if (lphl->FirstVisible > 1)
|
||||
lphl->FirstVisible--;
|
||||
break;
|
||||
case SB_LINEDOWN:
|
||||
if (lphl->FirstVisible < lphl->ItemsCount)
|
||||
lphl->FirstVisible++;
|
||||
break;
|
||||
case SB_PAGEUP:
|
||||
if (lphl->FirstVisible > 1)
|
||||
lphl->FirstVisible -= lphl->ItemsVisible;
|
||||
break;
|
||||
case SB_PAGEDOWN:
|
||||
if (lphl->FirstVisible < lphl->ItemsCount)
|
||||
lphl->FirstVisible += lphl->ItemsVisible;
|
||||
break;
|
||||
case SB_THUMBTRACK:
|
||||
lphl->FirstVisible = LOWORD(lParam);
|
||||
break;
|
||||
}
|
||||
if (lphl->FirstVisible < 1) lphl->FirstVisible = 1;
|
||||
if (lphl->FirstVisible > lphl->ItemsCount)
|
||||
lphl->FirstVisible = lphl->ItemsCount;
|
||||
if (y != lphl->FirstVisible) {
|
||||
SetScrollPos(lphl->hWndScroll, WM_VSCROLL, lphl->FirstVisible, TRUE);
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
UpdateWindow(hwnd);
|
||||
}
|
||||
return 0;
|
||||
|
||||
case WM_LBUTTONDOWN:
|
||||
lphl = ListBoxGetStorageHeader(hwnd);
|
||||
if (lphl == NULL) return 0;
|
||||
lphl->PrevSelected = lphl->ItemSelected;
|
||||
wRet = ListBoxFindMouse(hwnd, LOWORD(lParam), HIWORD(lParam));
|
||||
ListBoxSetCurSel(hwnd, wRet);
|
||||
ListBoxGetItemRect(hwnd, wRet, &rectsel);
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
UpdateWindow(hwnd);
|
||||
return 0;
|
||||
case WM_LBUTTONUP:
|
||||
lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr);
|
||||
if (lphl == NULL) return 0;
|
||||
if (lphl->PrevSelected != lphl->ItemSelected)
|
||||
SendMessage(lphl->hWndLogicParent, WM_COMMAND, wndPtr->wIDmenu,
|
||||
MAKELONG(hwnd, LBN_SELCHANGE));
|
||||
return 0;
|
||||
case WM_RBUTTONUP:
|
||||
case WM_LBUTTONDBLCLK:
|
||||
lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr);
|
||||
if (lphl == NULL) return 0;
|
||||
SendMessage(lphl->hWndLogicParent, WM_COMMAND, wndPtr->wIDmenu,
|
||||
MAKELONG(hwnd, LBN_DBLCLK));
|
||||
printf("ListBox Send LBN_DBLCLK !\n");
|
||||
return 0;
|
||||
case WM_KEYDOWN:
|
||||
printf("ListBox WM_KEYDOWN wParam %X!\n", wParam);
|
||||
ListBoxFindNextMatch(hwnd, wParam);
|
||||
break;
|
||||
case WM_PAINT:
|
||||
wndPtr = WIN_FindWndPtr(hwnd);
|
||||
if ((wndPtr->dwStyle & LBS_OWNERDRAWFIXED) == LBS_OWNERDRAWFIXED) {
|
||||
OwnerDrawListBox(hwnd);
|
||||
break;
|
||||
}
|
||||
if ((wndPtr->dwStyle & LBS_OWNERDRAWVARIABLE) == LBS_OWNERDRAWVARIABLE) {
|
||||
OwnerDrawListBox(hwnd);
|
||||
break;
|
||||
}
|
||||
StdDrawListBox(hwnd);
|
||||
break;
|
||||
case WM_MOUSEMOVE:
|
||||
if ((wParam & MK_LBUTTON) != 0) {
|
||||
y = HIWORD(lParam);
|
||||
if (y < 4) {
|
||||
lphl = ListBoxGetStorageHeader(hwnd);
|
||||
if (lphl->FirstVisible > 1) {
|
||||
lphl->FirstVisible--;
|
||||
SetScrollPos(lphl->hWndScroll, WM_VSCROLL, lphl->FirstVisible, TRUE);
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
UpdateWindow(hwnd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
GetClientRect(hwnd, &rect);
|
||||
if (y > (rect.bottom - 4)) {
|
||||
lphl = ListBoxGetStorageHeader(hwnd);
|
||||
if (lphl->FirstVisible < lphl->ItemsCount) {
|
||||
lphl->FirstVisible++;
|
||||
SetScrollPos(lphl->hWndScroll, WM_VSCROLL, lphl->FirstVisible, TRUE);
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
UpdateWindow(hwnd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((y > 0) && (y < (rect.bottom - 4))) {
|
||||
if ((y < rectsel.top) || (y > rectsel.bottom)) {
|
||||
wRet = ListBoxFindMouse(hwnd, LOWORD(lParam), HIWORD(lParam));
|
||||
ListBoxSetCurSel(hwnd, wRet);
|
||||
ListBoxGetItemRect(hwnd, wRet, &rectsel);
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
UpdateWindow(hwnd);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case LB_RESETCONTENT:
|
||||
printf("ListBox LB_RESETCONTENT !\n");
|
||||
ListBoxResetContent(hwnd);
|
||||
return 0;
|
||||
case LB_DIR:
|
||||
printf("ListBox LB_DIR !\n");
|
||||
wRet = ListBoxDirectory(hwnd, wParam, (LPSTR)lParam);
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
UpdateWindow(hwnd);
|
||||
return wRet;
|
||||
case LB_ADDSTRING:
|
||||
wRet = ListBoxAddString(hwnd, (LPSTR)lParam);
|
||||
return wRet;
|
||||
case LB_GETTEXT:
|
||||
wRet = ListBoxGetText(hwnd, wParam, (LPSTR)lParam);
|
||||
printf("ListBox LB_GETTEXT #%u '%s' !\n", wParam, (LPSTR)lParam);
|
||||
return wRet;
|
||||
case LB_INSERTSTRING:
|
||||
wRet = ListBoxInsertString(hwnd, wParam, (LPSTR)lParam);
|
||||
return wRet;
|
||||
case LB_DELETESTRING:
|
||||
printf("ListBox LB_DELETESTRING #%u !\n", wParam);
|
||||
wRet = ListBoxDeleteString(hwnd, wParam);
|
||||
return wRet;
|
||||
case LB_FINDSTRING:
|
||||
wRet = ListBoxFindString(hwnd, wParam, (LPSTR)lParam);
|
||||
return wRet;
|
||||
case LB_GETCARETINDEX:
|
||||
return wRet;
|
||||
case LB_GETCOUNT:
|
||||
lphl = ListBoxGetStorageHeader(hwnd);
|
||||
return lphl->ItemsCount;
|
||||
case LB_GETCURSEL:
|
||||
lphl = ListBoxGetStorageHeader(hwnd);
|
||||
printf("ListBox LB_GETCURSEL %u !\n", lphl->ItemSelected);
|
||||
if (lphl->ItemSelected == 0) return LB_ERR;
|
||||
return lphl->ItemSelected;
|
||||
case LB_GETHORIZONTALEXTENT:
|
||||
return wRet;
|
||||
case LB_GETITEMDATA:
|
||||
return wRet;
|
||||
case LB_GETITEMHEIGHT:
|
||||
return wRet;
|
||||
case LB_GETITEMRECT:
|
||||
return wRet;
|
||||
case LB_GETSEL:
|
||||
return wRet;
|
||||
case LB_GETSELCOUNT:
|
||||
return wRet;
|
||||
case LB_GETSELITEMS:
|
||||
return wRet;
|
||||
case LB_GETTEXTLEN:
|
||||
return wRet;
|
||||
case LB_GETTOPINDEX:
|
||||
return wRet;
|
||||
case LB_SELECTSTRING:
|
||||
return wRet;
|
||||
case LB_SELITEMRANGE:
|
||||
return wRet;
|
||||
case LB_SETCARETINDEX:
|
||||
return wRet;
|
||||
case LB_SETCOLUMNWIDTH:
|
||||
return wRet;
|
||||
case LB_SETHORIZONTALEXTENT:
|
||||
return wRet;
|
||||
case LB_SETITEMDATA:
|
||||
return wRet;
|
||||
case LB_SETTABSTOPS:
|
||||
return wRet;
|
||||
case LB_SETCURSEL:
|
||||
#ifdef DEBUG_LISTBOX
|
||||
printf("ListBox LB_SETCURSEL wParam=%x !\n", wParam);
|
||||
#endif
|
||||
wRet = ListBoxSetCurSel(hwnd, wParam);
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
UpdateWindow(hwnd);
|
||||
return wRet;
|
||||
case LB_SETSEL:
|
||||
printf("ListBox LB_SETSEL wParam=%x lParam=%lX !\n", wParam, lParam);
|
||||
wRet = ListBoxSetSel(hwnd, wParam);
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
UpdateWindow(hwnd);
|
||||
return wRet;
|
||||
case LB_SETTOPINDEX:
|
||||
printf("ListBox LB_SETTOPINDEX wParam=%x !\n", wParam);
|
||||
lphl = ListBoxGetStorageHeader(hwnd);
|
||||
lphl->FirstVisible = wParam;
|
||||
SetScrollPos(lphl->hWndScroll, WM_VSCROLL, lphl->FirstVisible, TRUE);
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
UpdateWindow(hwnd);
|
||||
break;
|
||||
case LB_SETITEMHEIGHT:
|
||||
#ifdef DEBUG_LISTBOX
|
||||
printf("ListBox LB_SETITEMHEIGHT wParam=%x lParam=%lX !\n", wParam, lParam);
|
||||
#endif
|
||||
wRet = ListBoxSetItemHeight(hwnd, wParam, lParam);
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
UpdateWindow(hwnd);
|
||||
return wRet;
|
||||
|
||||
default:
|
||||
return DefWindowProc( hwnd, message, wParam, lParam );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
LPHEADLIST ListBoxGetWindowAndStorage(HWND hwnd, WND **wndPtr)
|
||||
{
|
||||
WND *Ptr;
|
||||
LPHEADLIST lphl;
|
||||
*(wndPtr) = Ptr = WIN_FindWndPtr(hwnd);
|
||||
lphl = *((LPHEADLIST *)&Ptr->wExtra[1]);
|
||||
return lphl;
|
||||
}
|
||||
|
||||
|
||||
LPHEADLIST ListBoxGetStorageHeader(HWND hwnd)
|
||||
{
|
||||
WND *wndPtr;
|
||||
LPHEADLIST lphl;
|
||||
wndPtr = WIN_FindWndPtr(hwnd);
|
||||
lphl = *((LPHEADLIST *)&wndPtr->wExtra[1]);
|
||||
return lphl;
|
||||
}
|
||||
|
||||
|
||||
void StdDrawListBox(HWND hwnd)
|
||||
{
|
||||
LPHEADLIST lphl;
|
||||
LPLISTSTRUCT lpls;
|
||||
PAINTSTRUCT ps;
|
||||
HBRUSH hBrush;
|
||||
HWND hWndParent;
|
||||
HDC hdc;
|
||||
RECT rect;
|
||||
UINT i, h, h2;
|
||||
char C[128];
|
||||
h = 0;
|
||||
hdc = BeginPaint( hwnd, &ps );
|
||||
GetClientRect(hwnd, &rect);
|
||||
lphl = ListBoxGetStorageHeader(hwnd);
|
||||
if (lphl == NULL) goto EndOfPaint;
|
||||
hBrush = SendMessage(lphl->hWndLogicParent, WM_CTLCOLOR, (WORD)hdc,
|
||||
MAKELONG(hwnd, CTLCOLOR_LISTBOX));
|
||||
if (hBrush == (HBRUSH)NULL) hBrush = GetStockObject(WHITE_BRUSH);
|
||||
if (lphl->ItemsCount > lphl->ItemsVisible) rect.right -= 16;
|
||||
FillRect(hdc, &rect, hBrush);
|
||||
if (lphl->ItemsCount == 0) goto EndOfPaint;
|
||||
lpls = lphl->lpFirst;
|
||||
if (lpls == NULL) goto EndOfPaint;
|
||||
lphl->ItemsVisible = 0;
|
||||
for(i = 1; i <= lphl->ItemsCount; i++) {
|
||||
if (i >= lphl->FirstVisible) {
|
||||
h2 = lpls->dis.rcItem.bottom - lpls->dis.rcItem.top;
|
||||
lpls->dis.rcItem.top = h;
|
||||
lpls->dis.rcItem.bottom = h + h2;
|
||||
lpls->dis.rcItem.right = rect.right;
|
||||
TextOut(hdc, 5, h + 2, (char *)lpls->dis.itemData,
|
||||
strlen((char *)lpls->dis.itemData));
|
||||
if (lpls->dis.itemState != 0) {
|
||||
InvertRect(hdc, &lpls->dis.rcItem);
|
||||
}
|
||||
h += h2;
|
||||
lphl->ItemsVisible++;
|
||||
if (h > rect.bottom) break;
|
||||
}
|
||||
if (lpls->lpNext == NULL) goto EndOfPaint;
|
||||
lpls = (LPLISTSTRUCT)lpls->lpNext;
|
||||
}
|
||||
EndOfPaint:
|
||||
EndPaint( hwnd, &ps );
|
||||
if (lphl->ItemsCount > lphl->ItemsVisible) {
|
||||
InvalidateRect(lphl->hWndScroll, NULL, TRUE);
|
||||
UpdateWindow(lphl->hWndScroll);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void OwnerDrawListBox(HWND hwnd)
|
||||
{
|
||||
LPHEADLIST lphl;
|
||||
LPLISTSTRUCT lpls;
|
||||
HANDLE hTemp;
|
||||
PAINTSTRUCT ps;
|
||||
HBRUSH hBrush;
|
||||
HWND hWndParent;
|
||||
HDC hdc;
|
||||
RECT rect;
|
||||
UINT i, h, h2;
|
||||
char C[128];
|
||||
h = 0;
|
||||
hdc = BeginPaint( hwnd, &ps );
|
||||
GetClientRect(hwnd, &rect);
|
||||
lphl = ListBoxGetStorageHeader(hwnd);
|
||||
if (lphl == NULL) goto EndOfPaint;
|
||||
hBrush = SendMessage(lphl->hWndLogicParent, WM_CTLCOLOR, (WORD)hdc,
|
||||
MAKELONG(hwnd, CTLCOLOR_LISTBOX));
|
||||
if (hBrush == (HBRUSH)NULL) hBrush = GetStockObject(WHITE_BRUSH);
|
||||
if (lphl->ItemsCount > lphl->ItemsVisible) rect.right -= 16;
|
||||
FillRect(hdc, &rect, hBrush);
|
||||
if (lphl->ItemsCount == 0) goto EndOfPaint;
|
||||
lpls = lphl->lpFirst;
|
||||
if (lpls == NULL) goto EndOfPaint;
|
||||
lphl->ItemsVisible = 0;
|
||||
for(i = 1; i <= lphl->ItemsCount; i++) {
|
||||
if (i >= lphl->FirstVisible) {
|
||||
lpls->dis.hDC = hdc;
|
||||
lpls->dis.itemID = i;
|
||||
h2 = lpls->dis.rcItem.bottom - lpls->dis.rcItem.top;
|
||||
lpls->dis.rcItem.top = h;
|
||||
lpls->dis.rcItem.bottom = h + h2;
|
||||
lpls->dis.rcItem.right = rect.right;
|
||||
lpls->dis.itemAction = ODA_DRAWENTIRE;
|
||||
if (lpls->dis.itemState != 0) {
|
||||
lpls->dis.itemAction |= ODA_SELECT;
|
||||
}
|
||||
#ifdef DEBUT_LISTBOX
|
||||
printf("LBOX WM_DRAWITEM #%d left=%d top=%d right=%d bottom=%d !\n",
|
||||
i, lpls->dis.rcItem.left, lpls->dis.rcItem.top,
|
||||
lpls->dis.rcItem.right, lpls->dis.rcItem.bottom);
|
||||
printf("LBOX WM_DRAWITEM Parent=%X &dis=%lX CtlID=%u !\n",
|
||||
hWndParent, (LONG)&lpls->dis, lpls->dis.CtlID);
|
||||
#endif
|
||||
printf("LBOX WM_DRAWITEM '%s' !\n", lpls->dis.itemData);
|
||||
SendMessage(lphl->hWndLogicParent, WM_DRAWITEM, i, (LPARAM)&lpls->dis);
|
||||
GlobalUnlock(hTemp);
|
||||
GlobalFree(hTemp);
|
||||
if (lpls->dis.itemState != 0) {
|
||||
InvertRect(hdc, &lpls->dis.rcItem);
|
||||
}
|
||||
h += h2;
|
||||
lphl->ItemsVisible++;
|
||||
if (h > rect.bottom) break;
|
||||
}
|
||||
if (lpls->lpNext == NULL) goto EndOfPaint;
|
||||
lpls = (LPLISTSTRUCT)lpls->lpNext;
|
||||
}
|
||||
EndOfPaint:
|
||||
EndPaint( hwnd, &ps );
|
||||
if (lphl->ItemsCount > lphl->ItemsVisible) {
|
||||
InvalidateRect(lphl->hWndScroll, NULL, TRUE);
|
||||
UpdateWindow(lphl->hWndScroll);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ListBoxFindMouse(HWND hwnd, int X, int Y)
|
||||
{
|
||||
LPHEADLIST lphl;
|
||||
LPLISTSTRUCT lpls;
|
||||
RECT rect;
|
||||
UINT i, h, h2;
|
||||
char C[128];
|
||||
h = 0;
|
||||
lphl = ListBoxGetStorageHeader(hwnd);
|
||||
if (lphl == NULL) return LB_ERR;
|
||||
if (lphl->ItemsCount == 0) return LB_ERR;
|
||||
lpls = lphl->lpFirst;
|
||||
if (lpls == NULL) return LB_ERR;
|
||||
for(i = 1; i <= lphl->ItemsCount; i++) {
|
||||
if (i >= lphl->FirstVisible) {
|
||||
h2 = h;
|
||||
h += lpls->dis.rcItem.bottom - lpls->dis.rcItem.top;
|
||||
if ((Y > h2) && (Y < h)) return(i);
|
||||
}
|
||||
if (lpls->lpNext == NULL) return LB_ERR;
|
||||
lpls = (LPLISTSTRUCT)lpls->lpNext;
|
||||
}
|
||||
return(LB_ERR);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int CreateListBoxStruct(HWND hwnd)
|
||||
{
|
||||
WND *wndPtr;
|
||||
LPHEADLIST lphl;
|
||||
wndPtr = WIN_FindWndPtr(hwnd);
|
||||
lphl = (LPHEADLIST)malloc(sizeof(HEADLIST));
|
||||
lphl->lpFirst = NULL;
|
||||
*((LPHEADLIST *)&wndPtr->wExtra[1]) = lphl; /* HEAD of List */
|
||||
lphl->ItemsCount = 0;
|
||||
lphl->ItemsVisible = 0;
|
||||
lphl->FirstVisible = 1;
|
||||
lphl->StdItemHeight = 15;
|
||||
lphl->DrawCtlType = ODT_LISTBOX;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
int ListBoxAddString(HWND hwnd, LPSTR newstr)
|
||||
{
|
||||
WND *wndPtr;
|
||||
LPHEADLIST lphl;
|
||||
LPLISTSTRUCT lpls, lplsnew;
|
||||
HANDLE hTemp;
|
||||
LPSTR str;
|
||||
lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr);
|
||||
if (lphl == NULL) return LB_ERR;
|
||||
hTemp = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(LISTSTRUCT));
|
||||
lplsnew = (LPLISTSTRUCT) USER_HEAP_ADDR(hTemp);
|
||||
lpls = lphl->lpFirst;
|
||||
if (lpls != NULL) {
|
||||
while(lpls->lpNext != NULL) {
|
||||
lpls = (LPLISTSTRUCT)lpls->lpNext;
|
||||
}
|
||||
lpls->lpNext = lplsnew;
|
||||
}
|
||||
else
|
||||
lphl->lpFirst = lplsnew;
|
||||
lphl->ItemsCount++;
|
||||
#ifdef DEBUG_LISTBOX
|
||||
printf("Items Count = %u\n", lphl->ItemsCount);
|
||||
#endif
|
||||
hTemp = 0;
|
||||
if ((wndPtr->dwStyle & LBS_HASSTRINGS) != LBS_HASSTRINGS) {
|
||||
if (((wndPtr->dwStyle & LBS_OWNERDRAWFIXED) != LBS_OWNERDRAWFIXED) &&
|
||||
((wndPtr->dwStyle & LBS_OWNERDRAWVARIABLE) != LBS_OWNERDRAWVARIABLE)) {
|
||||
hTemp = USER_HEAP_ALLOC(GMEM_MOVEABLE, strlen(newstr) + 1);
|
||||
str = (LPSTR)USER_HEAP_ADDR(hTemp);
|
||||
if (str == NULL) return LB_ERRSPACE;
|
||||
strcpy(str, newstr);
|
||||
newstr = str;
|
||||
}
|
||||
}
|
||||
ListBoxDefaultItem(hwnd, wndPtr, lphl, lplsnew);
|
||||
lplsnew->hMem = hTemp;
|
||||
lplsnew->lpNext = NULL;
|
||||
lplsnew->dis.itemID = lphl->ItemsCount;
|
||||
lplsnew->dis.itemData = (DWORD)newstr;
|
||||
lplsnew->hData = hTemp;
|
||||
SetScrollRange(lphl->hWndScroll, WM_VSCROLL, 1, lphl->ItemsCount, TRUE);
|
||||
if (lphl->FirstVisible >= (lphl->ItemsCount - lphl->ItemsVisible)) {
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
UpdateWindow(hwnd);
|
||||
}
|
||||
if ((lphl->ItemsCount - lphl->FirstVisible) == lphl->ItemsVisible)
|
||||
ShowWindow(lphl->hWndScroll, SW_NORMAL);
|
||||
return lphl->ItemsCount;
|
||||
}
|
||||
|
||||
|
||||
int ListBoxInsertString(HWND hwnd, UINT uIndex, LPSTR newstr)
|
||||
{
|
||||
WND *wndPtr;
|
||||
LPHEADLIST lphl;
|
||||
LPLISTSTRUCT lpls, lplsnew;
|
||||
HANDLE hTemp;
|
||||
LPSTR str;
|
||||
UINT Count;
|
||||
lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr);
|
||||
if (lphl == NULL) return LB_ERR;
|
||||
if (uIndex < 1 || uIndex > lphl->ItemsCount) return LB_ERR;
|
||||
lpls = lphl->lpFirst;
|
||||
if (lpls == NULL) return LB_ERR;
|
||||
if (uIndex > lphl->ItemsCount) return LB_ERR;
|
||||
for(Count = 1; Count < uIndex; Count++) {
|
||||
if (lpls->lpNext == NULL) return LB_ERR;
|
||||
lpls = (LPLISTSTRUCT)lpls->lpNext;
|
||||
}
|
||||
hTemp = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(LISTSTRUCT));
|
||||
lplsnew = (LPLISTSTRUCT) USER_HEAP_ADDR(hTemp);
|
||||
ListBoxDefaultItem(hwnd, wndPtr, lphl, lplsnew);
|
||||
lplsnew->hMem = hTemp;
|
||||
lpls->lpNext = lplsnew;
|
||||
lphl->ItemsCount++;
|
||||
hTemp = 0;
|
||||
if ((wndPtr->dwStyle & LBS_HASSTRINGS) != LBS_HASSTRINGS) {
|
||||
if (((wndPtr->dwStyle & LBS_OWNERDRAWFIXED) != LBS_OWNERDRAWFIXED) &&
|
||||
((wndPtr->dwStyle & LBS_OWNERDRAWVARIABLE) != LBS_OWNERDRAWVARIABLE)) {
|
||||
hTemp = USER_HEAP_ALLOC(GMEM_MOVEABLE, strlen(newstr) + 1);
|
||||
str = (LPSTR)USER_HEAP_ADDR(hTemp);
|
||||
if (str == NULL) return LB_ERRSPACE;
|
||||
strcpy(str, newstr);
|
||||
newstr = str;
|
||||
}
|
||||
}
|
||||
lplsnew->lpNext = NULL;
|
||||
lplsnew->dis.itemID = lphl->ItemsCount;
|
||||
lplsnew->dis.itemData = (DWORD)newstr;
|
||||
lplsnew->hData = hTemp;
|
||||
SetScrollRange(lphl->hWndScroll, WM_VSCROLL, 1, lphl->ItemsCount, TRUE);
|
||||
if (((lphl->ItemsCount - lphl->FirstVisible) == lphl->ItemsVisible) &&
|
||||
(lphl->ItemsVisible != 0))
|
||||
ShowWindow(lphl->hWndScroll, SW_NORMAL);
|
||||
if ((lphl->FirstVisible <= uIndex) &&
|
||||
((lphl->FirstVisible + lphl->ItemsVisible) >= uIndex)) {
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
UpdateWindow(hwnd);
|
||||
}
|
||||
return lphl->ItemsCount;
|
||||
}
|
||||
|
||||
|
||||
int ListBoxGetText(HWND hwnd, UINT uIndex, LPSTR OutStr)
|
||||
{
|
||||
WND *wndPtr;
|
||||
LPHEADLIST lphl;
|
||||
LPLISTSTRUCT lpls;
|
||||
UINT Count;
|
||||
lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr);
|
||||
if (lphl == NULL) return LB_ERR;
|
||||
if (uIndex < 1 || uIndex > lphl->ItemsCount) return LB_ERR;
|
||||
lpls = lphl->lpFirst;
|
||||
if (lpls == NULL) return LB_ERR;
|
||||
if (uIndex > lphl->ItemsCount) return LB_ERR;
|
||||
for(Count = 1; Count < uIndex; Count++) {
|
||||
if (lpls->lpNext == NULL) return LB_ERR;
|
||||
lpls = (LPLISTSTRUCT)lpls->lpNext;
|
||||
}
|
||||
if (((wndPtr->dwStyle & LBS_OWNERDRAWFIXED) == LBS_OWNERDRAWFIXED) ||
|
||||
((wndPtr->dwStyle & LBS_OWNERDRAWVARIABLE) == LBS_OWNERDRAWVARIABLE)) {
|
||||
if ((wndPtr->dwStyle & LBS_HASSTRINGS) != LBS_HASSTRINGS) {
|
||||
*((long *)OutStr) = lpls->dis.itemData;
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
strcpy(OutStr, (char *)lpls->dis.itemData);
|
||||
return strlen(OutStr);
|
||||
}
|
||||
|
||||
|
||||
int ListBoxDeleteString(HWND hwnd, UINT uIndex)
|
||||
{
|
||||
LPHEADLIST lphl;
|
||||
LPLISTSTRUCT lpls, lpls2;
|
||||
UINT Count;
|
||||
lphl = ListBoxGetStorageHeader(hwnd);
|
||||
if (lphl == NULL) return LB_ERR;
|
||||
if (uIndex < 1 || uIndex > lphl->ItemsCount) return LB_ERR;
|
||||
lpls = lphl->lpFirst;
|
||||
if (lpls == NULL) return LB_ERR;
|
||||
if (uIndex > lphl->ItemsCount) return LB_ERR;
|
||||
for(Count = 1; Count < uIndex; Count++) {
|
||||
if (lpls->lpNext == NULL) return LB_ERR;
|
||||
lpls2 = lpls;
|
||||
lpls = (LPLISTSTRUCT)lpls->lpNext;
|
||||
}
|
||||
lpls2->lpNext = (LPLISTSTRUCT)lpls->lpNext;
|
||||
lphl->ItemsCount--;
|
||||
if (lpls->hData != 0) USER_HEAP_FREE(lpls->hData);
|
||||
if (lpls->hMem != 0) USER_HEAP_FREE(lpls->hMem);
|
||||
SetScrollRange(lphl->hWndScroll, WM_VSCROLL, 1, lphl->ItemsCount, TRUE);
|
||||
if (lphl->ItemsCount < lphl->ItemsVisible)
|
||||
ShowWindow(lphl->hWndScroll, SW_HIDE);
|
||||
if ((lphl->FirstVisible <= uIndex) &&
|
||||
((lphl->FirstVisible + lphl->ItemsVisible) >= uIndex)) {
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
UpdateWindow(hwnd);
|
||||
}
|
||||
return lphl->ItemsCount;
|
||||
}
|
||||
|
||||
|
||||
int ListBoxFindString(HWND hwnd, UINT nFirst, LPSTR MatchStr)
|
||||
{
|
||||
LPHEADLIST lphl;
|
||||
LPLISTSTRUCT lpls;
|
||||
UINT Count;
|
||||
lphl = ListBoxGetStorageHeader(hwnd);
|
||||
if (lphl == NULL) return LB_ERR;
|
||||
if (nFirst < 1 || nFirst > lphl->ItemsCount) return LB_ERR;
|
||||
lpls = lphl->lpFirst;
|
||||
if (lpls == NULL) return LB_ERR;
|
||||
Count = 1;
|
||||
while(lpls != NULL) {
|
||||
if (strcmp((char *)lpls->dis.itemData, MatchStr) == 0)
|
||||
return Count;
|
||||
lpls = (LPLISTSTRUCT)lpls->lpNext;
|
||||
Count++;
|
||||
}
|
||||
return LB_ERR;
|
||||
}
|
||||
|
||||
|
||||
int ListBoxResetContent(HWND hwnd)
|
||||
{
|
||||
WND *wndPtr;
|
||||
LPHEADLIST lphl;
|
||||
LPLISTSTRUCT lpls, lpls2;
|
||||
UINT i;
|
||||
lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr);
|
||||
if (lphl == NULL) return LB_ERR;
|
||||
lpls = lphl->lpFirst;
|
||||
if (lpls == NULL) return LB_ERR;
|
||||
for(i = 0; i <= lphl->ItemsCount; i++) {
|
||||
lpls2 = lpls;
|
||||
lpls = (LPLISTSTRUCT)lpls->lpNext;
|
||||
if (i != 0) {
|
||||
#ifdef DEBUG_LISTBOX
|
||||
printf("ResetContent #%u\n", i);
|
||||
#endif
|
||||
if (lpls2->hData != 0) USER_HEAP_FREE(lpls->hData);
|
||||
if (lpls2->hMem != 0) USER_HEAP_FREE(lpls->hMem);
|
||||
}
|
||||
if (lpls == NULL) break;
|
||||
}
|
||||
lphl->lpFirst = NULL;
|
||||
lphl->FirstVisible = 1;
|
||||
lphl->ItemsCount = 0;
|
||||
lphl->ItemSelected = 0;
|
||||
lphl->PrevSelected = 0;
|
||||
if ((wndPtr->dwStyle && LBS_NOTIFY) != 0)
|
||||
SendMessage(wndPtr->hwndParent, WM_COMMAND,
|
||||
wndPtr->wIDmenu, MAKELONG(hwnd, LBN_SELCHANGE));
|
||||
|
||||
SetScrollRange(lphl->hWndScroll, WM_VSCROLL, 1, lphl->ItemsCount, TRUE);
|
||||
ShowWindow(lphl->hWndScroll, SW_HIDE);
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
UpdateWindow(hwnd);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
int ListBoxSetCurSel(HWND hwnd, WORD wIndex)
|
||||
{
|
||||
WND *wndPtr;
|
||||
LPHEADLIST lphl;
|
||||
LPLISTSTRUCT lpls, lpls2;
|
||||
UINT i;
|
||||
lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr);
|
||||
if (lphl == NULL) return LB_ERR;
|
||||
lphl->ItemSelected = LB_ERR;
|
||||
if (wIndex < 1 || wIndex > lphl->ItemsCount) return LB_ERR;
|
||||
lpls = lphl->lpFirst;
|
||||
if (lpls == NULL) return LB_ERR;
|
||||
for(i = 1; i <= lphl->ItemsCount; i++) {
|
||||
lpls2 = lpls;
|
||||
lpls = (LPLISTSTRUCT)lpls->lpNext;
|
||||
if (i == wIndex)
|
||||
lpls2->dis.itemState = 1;
|
||||
else
|
||||
if (lpls2->dis.itemState != 0)
|
||||
lpls2->dis.itemState = 0;
|
||||
if (lpls == NULL) break;
|
||||
}
|
||||
lphl->ItemSelected = wIndex;
|
||||
if ((wndPtr->dwStyle && LBS_NOTIFY) != 0)
|
||||
SendMessage(wndPtr->hwndParent, WM_COMMAND,
|
||||
wndPtr->wIDmenu, MAKELONG(hwnd, LBN_SELCHANGE));
|
||||
return LB_ERR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ListBoxSetSel(HWND hwnd, WORD wIndex)
|
||||
{
|
||||
LPHEADLIST lphl;
|
||||
LPLISTSTRUCT lpls, lpls2;
|
||||
UINT i;
|
||||
lphl = ListBoxGetStorageHeader(hwnd);
|
||||
if (lphl == NULL) return LB_ERR;
|
||||
if (wIndex < 1 || wIndex > lphl->ItemsCount) return LB_ERR;
|
||||
lpls = lphl->lpFirst;
|
||||
if (lpls == NULL) return LB_ERR;
|
||||
for(i = 1; i <= lphl->ItemsCount; i++) {
|
||||
lpls2 = lpls;
|
||||
lpls = (LPLISTSTRUCT)lpls->lpNext;
|
||||
if (i == wIndex) {
|
||||
lpls2->dis.itemState = 1;
|
||||
break;
|
||||
}
|
||||
if (lpls == NULL) break;
|
||||
}
|
||||
return LB_ERR;
|
||||
}
|
||||
|
||||
|
||||
int ListBoxDirectory(HWND hwnd, UINT attrib, LPSTR filespec)
|
||||
{
|
||||
DIR *dirp;
|
||||
struct dirent *dp;
|
||||
struct stat st;
|
||||
char str[128];
|
||||
int wRet;
|
||||
dirp = opendir(".");
|
||||
while ( (dp = readdir(dirp)) != NULL)
|
||||
{
|
||||
stat(dp->d_name, &st);
|
||||
#ifdef DEBUG_LBDIR
|
||||
printf("LB_DIR : st_mode=%lX / d_name='%s'\n", st.st_mode, dp->d_name);
|
||||
#endif
|
||||
if S_ISDIR(st.st_mode) {
|
||||
sprintf(str, "[%s]", dp->d_name);
|
||||
}
|
||||
else
|
||||
strcpy(str, dp->d_name);
|
||||
wRet = ListBoxAddString(hwnd, str);
|
||||
if (wRet == LB_ERR) break;
|
||||
}
|
||||
closedir(dirp);
|
||||
return wRet;
|
||||
}
|
||||
|
||||
|
||||
int ListBoxGetItemRect(HWND hwnd, WORD wIndex, LPRECT lprect)
|
||||
{
|
||||
LPHEADLIST lphl;
|
||||
LPLISTSTRUCT lpls, lpls2;
|
||||
UINT i;
|
||||
lphl = ListBoxGetStorageHeader(hwnd);
|
||||
if (lphl == NULL) return LB_ERR;
|
||||
if (wIndex < 1 || wIndex > lphl->ItemsCount) return LB_ERR;
|
||||
lpls = lphl->lpFirst;
|
||||
if (lpls == NULL) return LB_ERR;
|
||||
for(i = 0; i <= lphl->ItemsCount; i++) {
|
||||
lpls2 = lpls;
|
||||
lpls = (LPLISTSTRUCT)lpls->lpNext;
|
||||
if (i == wIndex) {
|
||||
*(lprect) = lpls2->dis.rcItem;
|
||||
break;
|
||||
}
|
||||
if (lpls == NULL) break;
|
||||
}
|
||||
return LB_ERR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ListBoxSetItemHeight(HWND hwnd, WORD wIndex, long height)
|
||||
{
|
||||
LPHEADLIST lphl;
|
||||
LPLISTSTRUCT lpls, lpls2;
|
||||
UINT i;
|
||||
lphl = ListBoxGetStorageHeader(hwnd);
|
||||
if (lphl == NULL) return LB_ERR;
|
||||
if (wIndex < 1 || wIndex > lphl->ItemsCount) return LB_ERR;
|
||||
lpls = lphl->lpFirst;
|
||||
if (lpls == NULL) return LB_ERR;
|
||||
for(i = 0; i <= lphl->ItemsCount; i++) {
|
||||
lpls2 = lpls;
|
||||
lpls = (LPLISTSTRUCT)lpls->lpNext;
|
||||
if (i == wIndex) {
|
||||
lpls2->dis.rcItem.bottom = lpls2->dis.rcItem.top + (short)height;
|
||||
break;
|
||||
}
|
||||
if (lpls == NULL) break;
|
||||
}
|
||||
return LB_ERR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ListBoxDefaultItem(HWND hwnd, WND *wndPtr,
|
||||
LPHEADLIST lphl, LPLISTSTRUCT lpls)
|
||||
{
|
||||
RECT rect;
|
||||
GetClientRect(hwnd, &rect);
|
||||
SetRect(&lpls->dis.rcItem, 0, 0, rect.right, lphl->StdItemHeight);
|
||||
lpls->dis.CtlType = lphl->DrawCtlType;
|
||||
lpls->dis.CtlID = wndPtr->wIDmenu;
|
||||
lpls->dis.itemID = 0;
|
||||
lpls->dis.itemAction = 0;
|
||||
lpls->dis.itemState = 0;
|
||||
lpls->dis.hwndItem = hwnd;
|
||||
lpls->dis.hDC = 0;
|
||||
lpls->dis.itemData = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ListBoxFindNextMatch(HWND hwnd, WORD wChar)
|
||||
{
|
||||
WND *wndPtr;
|
||||
LPHEADLIST lphl;
|
||||
LPLISTSTRUCT lpls;
|
||||
UINT Count;
|
||||
lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr);
|
||||
if (lphl == NULL) return LB_ERR;
|
||||
lpls = lphl->lpFirst;
|
||||
if (lpls == NULL) return LB_ERR;
|
||||
if (wChar < ' ') return LB_ERR;
|
||||
if (((wndPtr->dwStyle & LBS_OWNERDRAWFIXED) == LBS_OWNERDRAWFIXED) ||
|
||||
((wndPtr->dwStyle & LBS_OWNERDRAWVARIABLE) == LBS_OWNERDRAWVARIABLE)) {
|
||||
if ((wndPtr->dwStyle & LBS_HASSTRINGS) != LBS_HASSTRINGS) {
|
||||
return LB_ERR;
|
||||
}
|
||||
}
|
||||
Count = 1;
|
||||
while(lpls != NULL) {
|
||||
if (Count > lphl->ItemSelected) {
|
||||
if (*((char *)lpls->dis.itemData) == (char)wChar) {
|
||||
lphl->FirstVisible = Count - lphl->ItemsVisible / 2;
|
||||
if (lphl->FirstVisible < 1) lphl->FirstVisible = 1;
|
||||
ListBoxSetCurSel(hwnd, Count);
|
||||
SetScrollPos(lphl->hWndScroll, WM_VSCROLL, lphl->FirstVisible, TRUE);
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
UpdateWindow(hwnd);
|
||||
return Count;
|
||||
}
|
||||
}
|
||||
lpls = (LPLISTSTRUCT)lpls->lpNext;
|
||||
Count++;
|
||||
}
|
||||
Count = 1;
|
||||
lpls = lphl->lpFirst;
|
||||
while(lpls != NULL) {
|
||||
if (*((char *)lpls->dis.itemData) == (char)wChar) {
|
||||
if (Count == lphl->ItemSelected) return LB_ERR;
|
||||
lphl->FirstVisible = Count - lphl->ItemsVisible / 2;
|
||||
if (lphl->FirstVisible < 1) lphl->FirstVisible = 1;
|
||||
ListBoxSetCurSel(hwnd, Count);
|
||||
SetScrollPos(lphl->hWndScroll, WM_VSCROLL, lphl->FirstVisible, TRUE);
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
UpdateWindow(hwnd);
|
||||
return Count;
|
||||
}
|
||||
lpls = (LPLISTSTRUCT)lpls->lpNext;
|
||||
Count++;
|
||||
}
|
||||
return LB_ERR;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,379 @@
|
|||
/*
|
||||
* Interface code to SCROLLBAR widget
|
||||
*
|
||||
* Copyright Martin Ayotte, 1993
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
#define DEBUG_SCROLL
|
||||
*/
|
||||
|
||||
static char Copyright[] = "Copyright Martin Ayotte, 1993";
|
||||
|
||||
#include <X11/Intrinsic.h>
|
||||
#include <X11/StringDefs.h>
|
||||
#include "windows.h"
|
||||
#include "scroll.h"
|
||||
#include "heap.h"
|
||||
#include "win.h"
|
||||
#include "dirent.h"
|
||||
#include <sys/stat.h>
|
||||
|
||||
LPHEADSCROLL ScrollBarGetWindowAndStorage(HWND hwnd, WND **wndPtr);
|
||||
LPHEADSCROLL ScrollBarGetStorageHeader(HWND hwnd);
|
||||
void StdDrawScrollBar(HWND hwnd);
|
||||
int CreateScrollBarStruct(HWND hwnd);
|
||||
|
||||
|
||||
void SCROLLBAR_CreateScrollBar(LPSTR className, LPSTR scrollLabel, HWND hwnd)
|
||||
{
|
||||
WND *wndPtr = WIN_FindWndPtr(hwnd);
|
||||
WND *parentPtr = WIN_FindWndPtr(wndPtr->hwndParent);
|
||||
DWORD style;
|
||||
char widgetName[15];
|
||||
|
||||
#ifdef DEBUG_SCROLLBAR
|
||||
printf("scroll: label = %s, x = %d, y = %d\n", scrollLabel,
|
||||
wndPtr->rectClient.left, wndPtr->rectClient.top);
|
||||
printf(" width = %d, height = %d\n",
|
||||
wndPtr->rectClient.right - wndPtr->rectClient.left,
|
||||
wndPtr->rectClient.bottom - wndPtr->rectClient.top);
|
||||
#endif
|
||||
|
||||
if (!wndPtr)
|
||||
return;
|
||||
|
||||
style = wndPtr->dwStyle & 0x0000FFFF;
|
||||
/*
|
||||
if ((style & SBS_NOTIFY) == SBS_NOTIFY)
|
||||
*/
|
||||
sprintf(widgetName, "%s%d", className, wndPtr->wIDmenu);
|
||||
wndPtr->winWidget = XtVaCreateManagedWidget(widgetName,
|
||||
compositeWidgetClass,
|
||||
parentPtr->winWidget,
|
||||
XtNx, wndPtr->rectClient.left,
|
||||
XtNy, wndPtr->rectClient.top,
|
||||
XtNwidth, wndPtr->rectClient.right -
|
||||
wndPtr->rectClient.left,
|
||||
XtNheight, wndPtr->rectClient.bottom -
|
||||
wndPtr->rectClient.top,
|
||||
NULL );
|
||||
GlobalUnlock(hwnd);
|
||||
GlobalUnlock(wndPtr->hwndParent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* WIDGETS_ScrollBarWndProc
|
||||
*/
|
||||
LONG SCROLLBAR_ScrollBarWndProc( HWND hwnd, WORD message,
|
||||
WORD wParam, LONG lParam )
|
||||
{
|
||||
WORD wRet;
|
||||
short x, y;
|
||||
WND *wndPtr;
|
||||
LPHEADSCROLL lphs;
|
||||
RECT rect;
|
||||
static RECT rectsel;
|
||||
switch(message)
|
||||
{
|
||||
case WM_CREATE:
|
||||
CreateScrollBarStruct(hwnd);
|
||||
#ifdef DEBUG_SCROLL
|
||||
printf("ScrollBar Creation up=%X down=%X!\n", lphs->hWndUp, lphs->hWndDown);
|
||||
#endif
|
||||
return 0;
|
||||
case WM_DESTROY:
|
||||
lphs = ScrollBarGetStorageHeader(hwnd);
|
||||
DestroyWindow(lphs->hWndUp);
|
||||
DestroyWindow(lphs->hWndDown);
|
||||
free(lphs);
|
||||
printf("ScrollBar WM_DESTROY !\n");
|
||||
return 0;
|
||||
|
||||
case WM_COMMAND:
|
||||
#ifdef DEBUG_SCROLL
|
||||
printf("ScrollBar WM_COMMAND wParam=%X lParam=%lX !\n", wParam, lParam);
|
||||
#endif
|
||||
lphs = ScrollBarGetWindowAndStorage(hwnd, &wndPtr);
|
||||
if (HIWORD(lParam) != BN_CLICKED) return 0;
|
||||
if (LOWORD(lParam) == lphs->hWndUp)
|
||||
SendMessage(wndPtr->hwndParent, lphs->Direction,
|
||||
SB_LINEUP, MAKELONG(0, hwnd));
|
||||
if (LOWORD(lParam) == lphs->hWndDown)
|
||||
SendMessage(wndPtr->hwndParent, lphs->Direction,
|
||||
SB_LINEDOWN, MAKELONG(0, hwnd));
|
||||
return 0;
|
||||
|
||||
case WM_LBUTTONDOWN:
|
||||
lphs = ScrollBarGetWindowAndStorage(hwnd, &wndPtr);
|
||||
GetClientRect(hwnd, &rect);
|
||||
if (lphs->Direction == WM_VSCROLL) {
|
||||
y = HIWORD(lParam);
|
||||
#ifdef DEBUG_SCROLL
|
||||
printf("WM_LBUTTONDOWN y=%d cur+right=%d %d\n",
|
||||
y, lphs->CurPix + rect.right, lphs->CurPix + (rect.right << 1));
|
||||
#endif
|
||||
if (y < (lphs->CurPix + rect.right))
|
||||
SendMessage(wndPtr->hwndParent, lphs->Direction,
|
||||
SB_PAGEUP, MAKELONG(0, hwnd));
|
||||
if (y > (lphs->CurPix + (rect.right << 1)))
|
||||
SendMessage(wndPtr->hwndParent, lphs->Direction,
|
||||
SB_PAGEDOWN, MAKELONG(0, hwnd));
|
||||
if ((y > (lphs->CurPix + rect.right)) &&
|
||||
(y < (lphs->CurPix + (rect.right << 1)))) {
|
||||
lphs->ThumbActive = TRUE;
|
||||
#ifdef DEBUG_SCROLL
|
||||
printf("THUMB DOWN !\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else {
|
||||
x = LOWORD(lParam);
|
||||
#ifdef DEBUG_SCROLL
|
||||
printf("WM_LBUTTONDOWN x=%d Cur+bottom=%d %d\n",
|
||||
x, lphs->CurPix + rect.bottom, lphs->CurPix + (rect.bottom << 1));
|
||||
#endif
|
||||
if (x < (lphs->CurPix + rect.bottom))
|
||||
SendMessage(wndPtr->hwndParent, lphs->Direction,
|
||||
SB_PAGEUP, MAKELONG(0, hwnd));
|
||||
if (x > (lphs->CurPix + (rect.bottom << 1)))
|
||||
SendMessage(wndPtr->hwndParent, lphs->Direction,
|
||||
SB_PAGEDOWN, MAKELONG(0, hwnd));
|
||||
if ((x > (lphs->CurPix + rect.bottom)) &&
|
||||
(x < (lphs->CurPix + (rect.bottom << 1)))) {
|
||||
lphs->ThumbActive = TRUE;
|
||||
#ifdef DEBUG_SCROLL
|
||||
printf("THUMB DOWN !\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_LBUTTONUP:
|
||||
lphs->ThumbActive = FALSE;
|
||||
break;
|
||||
|
||||
case WM_KEYDOWN:
|
||||
printf("ScrollBar WM_KEYDOWN wParam %X!\n", wParam);
|
||||
break;
|
||||
case WM_PAINT:
|
||||
StdDrawScrollBar(hwnd);
|
||||
break;
|
||||
case WM_MOUSEMOVE:
|
||||
if ((wParam & MK_LBUTTON) != 0) {
|
||||
lphs = ScrollBarGetWindowAndStorage(hwnd, &wndPtr);
|
||||
if (lphs->ThumbActive == 0) break;
|
||||
GetClientRect(hwnd, &rect);
|
||||
if (lphs->Direction == WM_VSCROLL)
|
||||
y = HIWORD(lParam) - rect.right - (rect.right >> 1);
|
||||
else
|
||||
y = LOWORD(lParam) - rect.bottom - (rect.bottom >> 1);
|
||||
x = (y * (lphs->MaxVal - lphs->MinVal) /
|
||||
lphs->MaxPix) + lphs->MinVal;
|
||||
#ifdef DEBUG_SCROLL
|
||||
printf("WM_MOUSEMOVE val=%d pix=%d\n", x, y);
|
||||
#endif
|
||||
SendMessage(wndPtr->hwndParent, lphs->Direction,
|
||||
SB_THUMBTRACK, MAKELONG(x, hwnd));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return DefWindowProc( hwnd, message, wParam, lParam );
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
LPHEADSCROLL ScrollBarGetWindowAndStorage(HWND hwnd, WND **wndPtr)
|
||||
{
|
||||
WND *Ptr;
|
||||
LPHEADSCROLL lphs;
|
||||
*(wndPtr) = Ptr = WIN_FindWndPtr(hwnd);
|
||||
lphs = *((LPHEADSCROLL *)&Ptr->wExtra[1]);
|
||||
return lphs;
|
||||
}
|
||||
|
||||
|
||||
LPHEADSCROLL ScrollBarGetStorageHeader(HWND hwnd)
|
||||
{
|
||||
WND *wndPtr;
|
||||
LPHEADSCROLL lphs;
|
||||
wndPtr = WIN_FindWndPtr(hwnd);
|
||||
lphs = *((LPHEADSCROLL *)&wndPtr->wExtra[1]);
|
||||
return lphs;
|
||||
}
|
||||
|
||||
|
||||
void StdDrawScrollBar(HWND hwnd)
|
||||
{
|
||||
LPHEADSCROLL lphs;
|
||||
PAINTSTRUCT ps;
|
||||
HBRUSH hBrush;
|
||||
HDC hdc;
|
||||
RECT rect;
|
||||
UINT i, w, h, siz;
|
||||
char C[128];
|
||||
hdc = BeginPaint( hwnd, &ps );
|
||||
hBrush = SendMessage(GetParent(hwnd), WM_CTLCOLOR, (WORD)hdc,
|
||||
MAKELONG(hwnd, CTLCOLOR_SCROLLBAR));
|
||||
if (hBrush == (HBRUSH)NULL) hBrush = GetStockObject(LTGRAY_BRUSH);
|
||||
lphs = ScrollBarGetStorageHeader(hwnd);
|
||||
if (lphs == NULL) goto EndOfPaint;
|
||||
GetClientRect(hwnd, &rect);
|
||||
w = rect.right - rect.left;
|
||||
h = rect.bottom - rect.top;
|
||||
if (lphs->Direction == WM_VSCROLL) {
|
||||
rect.top += w;
|
||||
rect.bottom -= w;
|
||||
}
|
||||
else {
|
||||
rect.left += h;
|
||||
rect.right -= h;
|
||||
}
|
||||
FillRect(hdc, &rect, hBrush);
|
||||
if (lphs->Direction == WM_VSCROLL)
|
||||
SetRect(&rect, 0, lphs->CurPix + w,
|
||||
w, lphs->CurPix + (w << 1));
|
||||
else
|
||||
SetRect(&rect, lphs->CurPix + h,
|
||||
0, lphs->CurPix + (h << 1), h);
|
||||
FrameRect(hdc, &rect, GetStockObject(BLACK_BRUSH));
|
||||
InflateRect(&rect, -1, -1);
|
||||
FillRect(hdc, &rect, GetStockObject(LTGRAY_BRUSH));
|
||||
DrawReliefRect(hdc, rect, 2, 0);
|
||||
InflateRect(&rect, -3, -3);
|
||||
DrawReliefRect(hdc, rect, 1, 1);
|
||||
EndOfPaint:
|
||||
EndPaint( hwnd, &ps );
|
||||
InvalidateRect(lphs->hWndUp, NULL, TRUE);
|
||||
UpdateWindow(lphs->hWndUp);
|
||||
InvalidateRect(lphs->hWndDown, NULL, TRUE);
|
||||
UpdateWindow(lphs->hWndDown);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int CreateScrollBarStruct(HWND hwnd)
|
||||
{
|
||||
RECT rect;
|
||||
int width, height;
|
||||
WND *wndPtr;
|
||||
LPHEADSCROLL lphs;
|
||||
wndPtr = WIN_FindWndPtr(hwnd);
|
||||
lphs = (LPHEADSCROLL)malloc(sizeof(HEADSCROLL));
|
||||
*((LPHEADSCROLL *)&wndPtr->wExtra[1]) = lphs;
|
||||
lphs->ThumbActive;
|
||||
lphs->MinVal = 0;
|
||||
lphs->MaxVal = 100;
|
||||
lphs->CurVal = 0;
|
||||
lphs->CurPix = 0;
|
||||
width = wndPtr->rectClient.right - wndPtr->rectClient.left;
|
||||
height = wndPtr->rectClient.bottom - wndPtr->rectClient.top;
|
||||
lphs = ScrollBarGetStorageHeader(hwnd);
|
||||
if (lphs == NULL) return 0;
|
||||
if (width <= height)
|
||||
{
|
||||
lphs->MaxPix = height - 3 * width;
|
||||
lphs->Direction = WM_VSCROLL;
|
||||
lphs->hWndUp = CreateWindow("BUTTON", "",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
|
||||
0, 0, width, width, hwnd, 1, wndPtr->hInstance, 0L);
|
||||
lphs->hWndDown = CreateWindow("BUTTON", "",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
|
||||
0, height - width, width, width, hwnd, 2,
|
||||
wndPtr->hInstance, 0L);
|
||||
}
|
||||
else
|
||||
{
|
||||
lphs->MaxPix = width - 3 * height;
|
||||
lphs->Direction = WM_HSCROLL;
|
||||
lphs->hWndUp = CreateWindow("BUTTON", "",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
|
||||
0, 0, height, height, hwnd, 0, wndPtr->hInstance, 0L);
|
||||
lphs->hWndDown = CreateWindow("BUTTON", "",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
|
||||
width - height, 0, height, height, hwnd, 0,
|
||||
wndPtr->hInstance, 0L);
|
||||
}
|
||||
if (lphs->MaxPix < 1) lphs->MaxPix = 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int GetScrollPos(HWND hwnd, int nBar)
|
||||
{
|
||||
LPHEADSCROLL lphs;
|
||||
lphs = ScrollBarGetStorageHeader(hwnd);
|
||||
if (lphs == NULL) return;
|
||||
return lphs->CurVal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GetScrollRange(HWND hwnd, int nBar, LPINT lpMin, LPINT lpMax)
|
||||
{
|
||||
LPHEADSCROLL lphs;
|
||||
lphs = ScrollBarGetStorageHeader(hwnd);
|
||||
if (lphs == NULL) return;
|
||||
*lpMin = lphs->MinVal;
|
||||
*lpMax = lphs->MaxVal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int SetScrollPos(HWND hwnd, int nBar, int nPos, BOOL bRedraw)
|
||||
{
|
||||
int nRet;
|
||||
LPHEADSCROLL lphs;
|
||||
lphs = ScrollBarGetStorageHeader(hwnd);
|
||||
if (lphs == NULL) return;
|
||||
nRet = lphs->CurVal;
|
||||
lphs->CurVal = (short)nPos;
|
||||
if (lphs->MaxVal != lphs->MinVal)
|
||||
lphs->CurPix = lphs->MaxPix * (abs((short)nPos) - abs(lphs->MinVal)) /
|
||||
(abs(lphs->MaxVal) - abs(lphs->MinVal));
|
||||
if (lphs->CurPix > lphs->MaxPix) lphs->CurPix = lphs->MaxPix;
|
||||
#ifdef DEBUG_SCROLL
|
||||
printf("SetScrollPos val=%d pixval=%d pixmax%d\n",
|
||||
(short)nPos, lphs->CurPix, lphs->MaxPix);
|
||||
printf("SetScrollPos min=%d max=%d\n",
|
||||
lphs->MinVal, lphs->MaxVal);
|
||||
#endif
|
||||
if (bRedraw) {
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
UpdateWindow(hwnd);
|
||||
}
|
||||
return nRet;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SetScrollRange(HWND hwnd, int nBar, int MinPos, int MaxPos, BOOL bRedraw)
|
||||
{
|
||||
LPHEADSCROLL lphs;
|
||||
lphs = ScrollBarGetStorageHeader(hwnd);
|
||||
if (lphs == NULL) return;
|
||||
lphs->MinVal = (short)MinPos;
|
||||
lphs->MaxVal = (short)MaxPos;
|
||||
if (lphs->MaxVal != lphs->MinVal)
|
||||
lphs->CurPix = abs(lphs->MaxVal) *
|
||||
(abs(lphs->CurVal) - abs(lphs->MinVal)) /
|
||||
(abs(lphs->MaxVal) - abs(lphs->MinVal));
|
||||
if (lphs->CurPix > lphs->MaxPix) lphs->CurPix = lphs->MaxPix;
|
||||
#ifdef DEBUG_SCROLL
|
||||
printf("SetScrollRange min=%d max=%d\n", lphs->MinVal, lphs->MaxVal);
|
||||
#endif
|
||||
if (bRedraw) {
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
UpdateWindow(hwnd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,266 @@
|
|||
/*
|
||||
* Static control
|
||||
*
|
||||
* Copyright David W. Metcalfe, 1993
|
||||
*
|
||||
*/
|
||||
|
||||
static char Copyright[] = "Copyright David W. Metcalfe, 1993";
|
||||
|
||||
#include <windows.h>
|
||||
#include "win.h"
|
||||
#include "user.h"
|
||||
|
||||
LONG StaticWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam);
|
||||
|
||||
static LONG PaintTextfn(HWND hwnd);
|
||||
static LONG PaintRectfn(HWND hwnd);
|
||||
static LONG PaintFramefn(HWND hwnd);
|
||||
|
||||
static COLORREF color_windowframe, color_background, color_window,
|
||||
color_windowtext;
|
||||
|
||||
#define NOTIFY_PARENT(hWndCntrl, wNotifyCode) \
|
||||
SendMessage(GetParent(hWndCntrl), WM_COMMAND, \
|
||||
GetDlgCtrlID(hWndCntrl), MAKELPARAM(hWndCntrl, wNotifyCode));
|
||||
#define DIM(array) ((sizeof array)/(sizeof array[0]))
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LONG (*paintfn)();
|
||||
} STATICFN;
|
||||
|
||||
#define MAX_STATIC_TYPE 12
|
||||
|
||||
static STATICFN staticfn[MAX_STATIC_TYPE] =
|
||||
{
|
||||
{ (LONG(*)())PaintTextfn }, /* SS_LEFT */
|
||||
{ (LONG(*)())PaintTextfn }, /* SS_CENTER */
|
||||
{ (LONG(*)())PaintTextfn }, /* SS_RIGHT */
|
||||
{ (LONG(*)())NULL }, /* SS_ICON */
|
||||
{ (LONG(*)())PaintRectfn }, /* SS_BLACKRECT */
|
||||
{ (LONG(*)())PaintRectfn }, /* SS_GRAYRECT */
|
||||
{ (LONG(*)())PaintRectfn }, /* SS_WHITERECT */
|
||||
{ (LONG(*)())PaintFramefn }, /* SS_BLACKFRAME */
|
||||
{ (LONG(*)())PaintFramefn }, /* SS_GRAYFRAME */
|
||||
{ (LONG(*)())PaintFramefn }, /* SS_WHITEFRAME */
|
||||
{ (LONG(*)())PaintTextfn }, /* SS_SIMPLE */
|
||||
{ (LONG(*)())PaintTextfn } /* SS_LEFTNOWORDWRAP */
|
||||
};
|
||||
|
||||
|
||||
LONG StaticWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam)
|
||||
{
|
||||
LONG lResult = 0;
|
||||
HDC hDC;
|
||||
RECT rc;
|
||||
LPSTR textPtr;
|
||||
|
||||
WND *wndPtr = WIN_FindWndPtr(hWnd);
|
||||
LONG style = wndPtr->dwStyle & 0x0000000F;
|
||||
|
||||
switch (uMsg) {
|
||||
case WM_ENABLE:
|
||||
InvalidateRect(hWnd, NULL, FALSE);
|
||||
break;
|
||||
|
||||
case WM_CREATE:
|
||||
if (style < 0L || style >= (LONG)DIM(staticfn))
|
||||
lResult = -1L;
|
||||
else
|
||||
{
|
||||
/* initialise colours */
|
||||
color_windowframe = GetSysColor(COLOR_WINDOWFRAME);
|
||||
color_background = GetSysColor(COLOR_BACKGROUND);
|
||||
color_window = GetSysColor(COLOR_WINDOW);
|
||||
color_windowtext = GetSysColor(COLOR_WINDOWTEXT);
|
||||
lResult = 0L;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_PAINT:
|
||||
if (staticfn[style].paintfn)
|
||||
(staticfn[style].paintfn)(hWnd);
|
||||
break;
|
||||
|
||||
case WM_SYSCOLORCHANGE:
|
||||
color_windowframe = GetSysColor(COLOR_WINDOWFRAME);
|
||||
color_background = GetSysColor(COLOR_BACKGROUND);
|
||||
color_window = GetSysColor(COLOR_WINDOW);
|
||||
color_windowtext = GetSysColor(COLOR_WINDOWTEXT);
|
||||
InvalidateRect(hWnd, NULL, TRUE);
|
||||
break;
|
||||
|
||||
case WM_SETTEXT:
|
||||
if (wndPtr->hText)
|
||||
USER_HEAP_FREE(wndPtr->hText);
|
||||
|
||||
wndPtr->hText = USER_HEAP_ALLOC(GMEM_MOVEABLE,
|
||||
strlen((LPSTR)lParam) + 1);
|
||||
textPtr = (LPSTR)USER_HEAP_ADDR(wndPtr->hText);
|
||||
strcpy(textPtr, (LPSTR)lParam);
|
||||
InvalidateRect(hWnd, NULL, TRUE);
|
||||
break;
|
||||
|
||||
default:
|
||||
lResult = DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
break;
|
||||
}
|
||||
|
||||
GlobalUnlock(hWnd);
|
||||
return lResult;
|
||||
}
|
||||
|
||||
|
||||
static LONG PaintTextfn(HWND hwnd)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
RECT rc;
|
||||
HDC hdc;
|
||||
HBRUSH hBrush;
|
||||
HANDLE hText;
|
||||
char *text;
|
||||
int textlen;
|
||||
WORD wFormat;
|
||||
|
||||
WND *wndPtr = WIN_FindWndPtr(hwnd);
|
||||
LONG style = wndPtr->dwStyle;
|
||||
|
||||
hdc = BeginPaint(hwnd, &ps);
|
||||
GetClientRect(hwnd, &rc);
|
||||
|
||||
textlen = GetWindowTextLength(hwnd);
|
||||
hText = LocalAlloc(LMEM_MOVEABLE, textlen+1);
|
||||
text = LocalLock(hText);
|
||||
GetWindowText(hwnd, text, textlen+1);
|
||||
|
||||
switch (style & 0x0000000F)
|
||||
{
|
||||
case SS_LEFT:
|
||||
wFormat = DT_LEFT | DT_EXPANDTABS | DT_WORDBREAK;
|
||||
break;
|
||||
|
||||
case SS_CENTER:
|
||||
wFormat = DT_CENTER | DT_EXPANDTABS | DT_WORDBREAK;
|
||||
break;
|
||||
|
||||
case SS_RIGHT:
|
||||
wFormat = DT_RIGHT | DT_EXPANDTABS | DT_WORDBREAK;
|
||||
break;
|
||||
|
||||
case SS_SIMPLE:
|
||||
wFormat = DT_LEFT | DT_SINGLELINE | DT_VCENTER;
|
||||
break;
|
||||
|
||||
case SS_LEFTNOWORDWRAP:
|
||||
wFormat = DT_LEFT | DT_SINGLELINE | DT_EXPANDTABS | DT_VCENTER;
|
||||
break;
|
||||
}
|
||||
|
||||
if (style & SS_NOPREFIX)
|
||||
wFormat |= DT_NOPREFIX;
|
||||
|
||||
hBrush = SendMessage(GetParent(hwnd), WM_CTLCOLOR, (WORD)hdc,
|
||||
MAKELONG(hwnd, CTLCOLOR_STATIC));
|
||||
if (hBrush == (HBRUSH)NULL) hBrush = GetStockObject(WHITE_BRUSH);
|
||||
FillRect(hdc, &rc, hBrush);
|
||||
DrawText(hdc, text, textlen, &rc, wFormat);
|
||||
|
||||
LocalUnlock(hText);
|
||||
LocalFree(hText);
|
||||
GlobalUnlock(hwnd);
|
||||
EndPaint(hwnd, &ps);
|
||||
}
|
||||
|
||||
static LONG PaintRectfn(HWND hwnd)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
RECT rc;
|
||||
HDC hdc;
|
||||
HPEN hOldPen, hPen;
|
||||
HBRUSH hOldBrush, hBrush;
|
||||
|
||||
WND *wndPtr = WIN_FindWndPtr(hwnd);
|
||||
|
||||
hdc = BeginPaint(hwnd, &ps);
|
||||
GetClientRect(hwnd, &rc);
|
||||
|
||||
switch (wndPtr->dwStyle & 0x0000000F)
|
||||
{
|
||||
case SS_BLACKRECT:
|
||||
hPen = CreatePen(PS_SOLID, 1, color_windowframe);
|
||||
hBrush = CreateSolidBrush(color_windowframe);
|
||||
break;
|
||||
|
||||
case SS_GRAYRECT:
|
||||
hPen = CreatePen(PS_SOLID, 1, color_background);
|
||||
hBrush = CreateSolidBrush(color_background);
|
||||
break;
|
||||
|
||||
case SS_WHITERECT:
|
||||
hPen = CreatePen(PS_SOLID, 1, color_window);
|
||||
hBrush = CreateSolidBrush(color_window);
|
||||
break;
|
||||
}
|
||||
|
||||
hOldPen = (HPEN)SelectObject(hdc, (HANDLE)hPen);
|
||||
hOldBrush = (HBRUSH)SelectObject(hdc, (HANDLE)hBrush);
|
||||
Rectangle(hdc, rc.left, rc.top, rc.right, rc.bottom);
|
||||
|
||||
SelectObject(hdc, (HANDLE)hOldPen);
|
||||
SelectObject(hdc, (HANDLE)hOldBrush);
|
||||
DeleteObject((HANDLE)hPen);
|
||||
DeleteObject((HANDLE)hBrush);
|
||||
|
||||
GlobalUnlock(hwnd);
|
||||
EndPaint(hwnd, &ps);
|
||||
}
|
||||
|
||||
static LONG PaintFramefn(HWND hwnd)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
RECT rc;
|
||||
HDC hdc;
|
||||
HPEN hOldPen, hPen;
|
||||
HBRUSH hOldBrush, hBrush;
|
||||
|
||||
WND *wndPtr = WIN_FindWndPtr(hwnd);
|
||||
|
||||
hdc = BeginPaint(hwnd, &ps);
|
||||
GetClientRect(hwnd, &rc);
|
||||
|
||||
switch (wndPtr->dwStyle & 0x0000000F)
|
||||
{
|
||||
case SS_BLACKFRAME:
|
||||
hPen = CreatePen(PS_SOLID, 1, color_windowframe);
|
||||
break;
|
||||
|
||||
case SS_GRAYFRAME:
|
||||
hPen = CreatePen(PS_SOLID, 1, color_background);
|
||||
break;
|
||||
|
||||
case SS_WHITEFRAME:
|
||||
hPen = CreatePen(PS_SOLID, 1, color_window);
|
||||
break;
|
||||
}
|
||||
|
||||
hBrush = CreateSolidBrush(color_window);
|
||||
hOldPen = (HPEN)SelectObject(hdc, (HANDLE)hPen);
|
||||
hOldBrush = (HBRUSH)SelectObject(hdc, (HANDLE)hBrush);
|
||||
Rectangle(hdc, rc.left, rc.top, rc.right, rc.bottom);
|
||||
|
||||
SelectObject(hdc, (HANDLE)hOldPen);
|
||||
SelectObject(hdc, (HANDLE)hOldBrush);
|
||||
DeleteObject((HANDLE)hPen);
|
||||
DeleteObject((HANDLE)hBrush);
|
||||
|
||||
GlobalUnlock(hwnd);
|
||||
EndPaint(hwnd, &ps);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -8,21 +8,32 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
|||
|
||||
#include "windows.h"
|
||||
#include "win.h"
|
||||
#include "dialog.h"
|
||||
|
||||
|
||||
LONG ButtonWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam );
|
||||
static LONG WIDGETS_StaticWndProc( HWND hwnd, WORD message,
|
||||
LONG StaticWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam );
|
||||
|
||||
LONG SCROLLBAR_ScrollBarWndProc( HWND hwnd, WORD message,
|
||||
WORD wParam, LONG lParam );
|
||||
LONG LISTBOX_ListBoxWndProc( HWND hwnd, WORD message,
|
||||
WORD wParam, LONG lParam );
|
||||
LONG COMBOBOX_ComboBoxWndProc( HWND hwnd, WORD message,
|
||||
WORD wParam, LONG lParam );
|
||||
|
||||
#define NB_BUILTIN_CLASSES 2
|
||||
|
||||
static WNDCLASS WIDGETS_BuiltinClasses[NB_BUILTIN_CLASSES] =
|
||||
static WNDCLASS WIDGETS_BuiltinClasses[] =
|
||||
{
|
||||
{ 0, (LONG(*)())ButtonWndProc, 0, 0, 0, 0, 0, 0, NULL, "BUTTON" },
|
||||
{ 0, (LONG(*)())WIDGETS_StaticWndProc, 0, 0, 0, 0, 0, 0, NULL, "STATIC" }
|
||||
{ 0, (LONG(*)())ButtonWndProc, 0, 2, 0, 0, 0, 0, NULL, "BUTTON" },
|
||||
{ 0, (LONG(*)())StaticWndProc, 0, 0, 0, 0, 0, 0, NULL, "STATIC" },
|
||||
{ 0, (LONG(*)())SCROLLBAR_ScrollBarWndProc, 0, 8, 0, 0, 0, 0, NULL, "SCROLLBAR" },
|
||||
{ 0, (LONG(*)())LISTBOX_ListBoxWndProc, 0, 8, 0, 0, 0, 0, NULL, "LISTBOX" },
|
||||
{ 0, (LONG(*)())COMBOBOX_ComboBoxWndProc, 0, 8, 0, 0, 0, 0, NULL, "COMBOBOX" },
|
||||
{ 0, (LONG(*)())DefDlgProc, 0, DLGWINDOWEXTRA, 0, 0, 0, 0, NULL, DIALOG_CLASS_NAME }
|
||||
};
|
||||
|
||||
static FARPROC WndProc32[NB_BUILTIN_CLASSES];
|
||||
#define NB_BUILTIN_CLASSES \
|
||||
(sizeof(WIDGETS_BuiltinClasses)/sizeof(WIDGETS_BuiltinClasses[0]))
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -33,56 +44,9 @@ static FARPROC WndProc32[NB_BUILTIN_CLASSES];
|
|||
BOOL WIDGETS_Init()
|
||||
{
|
||||
int i;
|
||||
WNDCLASS * pClass = WIDGETS_BuiltinClasses;
|
||||
|
||||
for (i = 0; i < NB_BUILTIN_CLASSES; i++, pClass++)
|
||||
for (i = 0; i < NB_BUILTIN_CLASSES; i++)
|
||||
{
|
||||
if (!RegisterClass(pClass)) return FALSE;
|
||||
if (!RegisterClass(&WIDGETS_BuiltinClasses[i])) return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* WIDGETS_Call32WndProc
|
||||
*
|
||||
* Call the window procedure of a built-in class.
|
||||
*/
|
||||
LONG WIDGETS_Call32WndProc( FARPROC func, HWND hwnd, WORD message,
|
||||
WORD wParam, LONG lParam )
|
||||
{
|
||||
unsigned int i = (unsigned int) func;
|
||||
if (!i || (i > NB_BUILTIN_CLASSES)) return 0;
|
||||
return (*WndProc32[i-1])( hwnd, message, wParam, lParam );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* WIDGETS_StaticWndProc
|
||||
*/
|
||||
static LONG WIDGETS_StaticWndProc( HWND hwnd, WORD message,
|
||||
WORD wParam, LONG lParam )
|
||||
{
|
||||
switch(message)
|
||||
{
|
||||
case WM_CREATE:
|
||||
return 0;
|
||||
|
||||
case WM_PAINT:
|
||||
{
|
||||
HDC hdc;
|
||||
PAINTSTRUCT ps;
|
||||
RECT rect;
|
||||
|
||||
hdc = BeginPaint( hwnd, &ps );
|
||||
GetClientRect( hwnd, &rect );
|
||||
DrawText(hdc, "Static", -1, &rect,
|
||||
DT_SINGLELINE | DT_CENTER | DT_VCENTER );
|
||||
EndPaint( hwnd, &ps );
|
||||
return 0;
|
||||
}
|
||||
|
||||
default:
|
||||
return DefWindowProc( hwnd, message, wParam, lParam );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
CFLAGS=-g -I../include # -DUSE_READLINE
|
||||
CFLAGS=-g -I../include -DUSE_READLINE
|
||||
LIBS= readline/libedit.a
|
||||
OBJS=dbg.tab.o hash.o lex.yy.o info.o i386-pinsn.o
|
||||
#YACC=bison -v -d
|
||||
YACC=yacc -b dbg -d
|
||||
#LEX=flex
|
||||
LEX=lex
|
||||
|
||||
debugger.o: ${OBJS} readline/libedit.a
|
||||
(cd readline; make)
|
||||
|
@ -18,10 +22,10 @@ lex.yy.o: lex.yy.c
|
|||
|
||||
|
||||
lex.yy.c: debug.l
|
||||
flex -I debug.l
|
||||
${LEX} -I debug.l
|
||||
|
||||
dbg.tab.c dbg.tab.h: dbg.y
|
||||
bison -v -d dbg.y
|
||||
${YACC} dbg.y
|
||||
|
||||
dtest: dtest.o debugger.o
|
||||
gcc -o dtest dtest.o debugger.o
|
||||
|
@ -29,3 +33,7 @@ dtest: dtest.o debugger.o
|
|||
clean:
|
||||
rm -f *.o main dbg.tab.* lex.yy.* *.output *~ *# dtest
|
||||
(cd readline; make clean)
|
||||
|
||||
depend: dbg.tab.c dbg.tab.h lex.yy.c
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ wine_debug(int * regs)
|
|||
yyin = stdin;
|
||||
regval = regs;
|
||||
|
||||
/* This only works for linux - NetBSD will need something different here. */
|
||||
#ifdef linux
|
||||
if((SC_CS & 7) != 7) {
|
||||
dbg_mask = 0xffffffff;
|
||||
dbg_mode = 32;
|
||||
|
@ -123,6 +123,16 @@ wine_debug(int * regs)
|
|||
dbg_mask = 0xffff;
|
||||
dbg_mode = 16;
|
||||
};
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
if(SC_CS == 0x1f) {
|
||||
dbg_mask = 0xffffffff;
|
||||
dbg_mode = 32;
|
||||
} else {
|
||||
dbg_mask = 0xffff;
|
||||
dbg_mode = 16;
|
||||
};
|
||||
#endif
|
||||
|
||||
/* This is intended to read the entry points from the Windows image, and
|
||||
insert them in the hash table. It does not work yet, so it is commented out. */
|
||||
|
|
|
@ -24,6 +24,7 @@ extern char * readline(char *);
|
|||
static char * make_symbol(char *);
|
||||
void flush_symbols();
|
||||
static int syntax_error;
|
||||
extern int yylval;
|
||||
%}
|
||||
|
||||
DIGIT [0-9]
|
||||
|
|
|
@ -56,25 +56,16 @@ main(){
|
|||
char * pnt;
|
||||
#ifdef linux
|
||||
segv_act.sa_handler = (__sighandler_t) win_fault;
|
||||
/* Point to the top of the stack, minus 4 just in case, and make
|
||||
it aligned */
|
||||
sigaction(SIGSEGV, &segv_act, NULL);
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
struct sigstack ss;
|
||||
sigset_t sig_mask;
|
||||
|
||||
ss.ss_sp = (char *) (((unsigned int)(cstack + sizeof(cstack) - 4)) & ~3);
|
||||
ss.ss_onstack = 0;
|
||||
if (sigstack(&ss, NULL) < 0) {
|
||||
perror("sigstack");
|
||||
exit(1);
|
||||
}
|
||||
sigemptyset(&sig_mask);
|
||||
segv_act.sa_handler = (__sighandler_t) win_fault;
|
||||
segv_act.sa_flags = SA_ONSTACK;
|
||||
segv_act.sa_flags = 0;
|
||||
segv_act.sa_mask = sig_mask;
|
||||
if (sigaction(SIGBUS, &segv_act, NULL) < 0) {
|
||||
if (sigaction(SIGSEGV, &segv_act, NULL) < 0) {
|
||||
perror("sigaction");
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -1467,6 +1467,57 @@ OP_E (bytemode)
|
|||
}
|
||||
|
||||
append_prefix ();
|
||||
|
||||
if (bytemode == w_mode || (bytemode == v_mode && !dflag))
|
||||
{
|
||||
if (mod == 0 && rm == 6)
|
||||
{
|
||||
sprintf(scratchbuf, "%04.4x", get16());
|
||||
oappend(scratchbuf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
disp = 0;
|
||||
if (mod == 1)
|
||||
disp = *(char *)codep++;
|
||||
else if (mod == 2)
|
||||
disp = get16();
|
||||
if (disp != 0)
|
||||
{
|
||||
sprintf(scratchbuf, "0x%x", disp);
|
||||
oappend(scratchbuf);
|
||||
}
|
||||
|
||||
switch (rm)
|
||||
{
|
||||
case 0:
|
||||
oappend("(%bx,%si)");
|
||||
break;
|
||||
case 1:
|
||||
oappend("(%bx,%di)");
|
||||
break;
|
||||
case 2:
|
||||
oappend("(%bp,%si)");
|
||||
break;
|
||||
case 3:
|
||||
oappend("(%bp,%di)");
|
||||
break;
|
||||
case 4:
|
||||
oappend("(%si)");
|
||||
break;
|
||||
case 5:
|
||||
oappend("(%di)");
|
||||
break;
|
||||
case 6:
|
||||
oappend("(%bp)");
|
||||
break;
|
||||
case 7:
|
||||
oappend("(%bx)");
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (rm == 4)
|
||||
{
|
||||
havesib = 1;
|
||||
|
|
|
@ -140,10 +140,10 @@ void examine_memory(int addr, int count, char format){
|
|||
wdump = (unsigned short int *) addr;
|
||||
for(i=0; i<count; i++)
|
||||
{
|
||||
fprintf(stderr," %d", *wdump++);
|
||||
fprintf(stderr," %x", *wdump++);
|
||||
if ((i % 10) == 7) {
|
||||
fprintf(stderr,"\n");
|
||||
print_address((unsigned int) dump, stderr);
|
||||
print_address((unsigned int) wdump, stderr);
|
||||
fprintf(stderr,": ");
|
||||
};
|
||||
}
|
||||
|
@ -172,10 +172,10 @@ void examine_memory(int addr, int count, char format){
|
|||
pnt = (char *) addr;
|
||||
for(i=0; i<count; i++)
|
||||
{
|
||||
fprintf(stderr," %d", *pnt++);
|
||||
fprintf(stderr," %w", *pnt++);
|
||||
if ((i % 32) == 7) {
|
||||
fprintf(stderr,"\n");
|
||||
print_address((unsigned int) dump, stderr);
|
||||
print_address((unsigned int) pnt, stderr);
|
||||
fprintf(stderr,": ");
|
||||
};
|
||||
}
|
||||
|
|
|
@ -0,0 +1,467 @@
|
|||
/* obstack.h - object stack macros
|
||||
Copyright (C) 1988 Free Software Foundation, Inc.
|
||||
|
||||
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, 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* Summary:
|
||||
|
||||
All the apparent functions defined here are macros. The idea
|
||||
is that you would use these pre-tested macros to solve a
|
||||
very specific set of problems, and they would run fast.
|
||||
Caution: no side-effects in arguments please!! They may be
|
||||
evaluated MANY times!!
|
||||
|
||||
These macros operate a stack of objects. Each object starts life
|
||||
small, and may grow to maturity. (Consider building a word syllable
|
||||
by syllable.) An object can move while it is growing. Once it has
|
||||
been "finished" it never changes address again. So the "top of the
|
||||
stack" is typically an immature growing object, while the rest of the
|
||||
stack is of mature, fixed size and fixed address objects.
|
||||
|
||||
These routines grab large chunks of memory, using a function you
|
||||
supply, called `obstack_chunk_alloc'. On occasion, they free chunks,
|
||||
by calling `obstack_chunk_free'. You must define them and declare
|
||||
them before using any obstack macros.
|
||||
|
||||
Each independent stack is represented by a `struct obstack'.
|
||||
Each of the obstack macros expects a pointer to such a structure
|
||||
as the first argument.
|
||||
|
||||
One motivation for this package is the problem of growing char strings
|
||||
in symbol tables. Unless you are "fascist pig with a read-only mind"
|
||||
[Gosper's immortal quote from HAKMEM item 154, out of context] you
|
||||
would not like to put any arbitrary upper limit on the length of your
|
||||
symbols.
|
||||
|
||||
In practice this often means you will build many short symbols and a
|
||||
few long symbols. At the time you are reading a symbol you don't know
|
||||
how long it is. One traditional method is to read a symbol into a
|
||||
buffer, realloc()ating the buffer every time you try to read a symbol
|
||||
that is longer than the buffer. This is beaut, but you still will
|
||||
want to copy the symbol from the buffer to a more permanent
|
||||
symbol-table entry say about half the time.
|
||||
|
||||
With obstacks, you can work differently. Use one obstack for all symbol
|
||||
names. As you read a symbol, grow the name in the obstack gradually.
|
||||
When the name is complete, finalize it. Then, if the symbol exists already,
|
||||
free the newly read name.
|
||||
|
||||
The way we do this is to take a large chunk, allocating memory from
|
||||
low addresses. When you want to build a symbol in the chunk you just
|
||||
add chars above the current "high water mark" in the chunk. When you
|
||||
have finished adding chars, because you got to the end of the symbol,
|
||||
you know how long the chars are, and you can create a new object.
|
||||
Mostly the chars will not burst over the highest address of the chunk,
|
||||
because you would typically expect a chunk to be (say) 100 times as
|
||||
long as an average object.
|
||||
|
||||
In case that isn't clear, when we have enough chars to make up
|
||||
the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed)
|
||||
so we just point to it where it lies. No moving of chars is
|
||||
needed and this is the second win: potentially long strings need
|
||||
never be explicitly shuffled. Once an object is formed, it does not
|
||||
change its address during its lifetime.
|
||||
|
||||
When the chars burst over a chunk boundary, we allocate a larger
|
||||
chunk, and then copy the partly formed object from the end of the old
|
||||
chunk to the beginning of the new larger chunk. We then carry on
|
||||
accreting characters to the end of the object as we normally would.
|
||||
|
||||
A special macro is provided to add a single char at a time to a
|
||||
growing object. This allows the use of register variables, which
|
||||
break the ordinary 'growth' macro.
|
||||
|
||||
Summary:
|
||||
We allocate large chunks.
|
||||
We carve out one object at a time from the current chunk.
|
||||
Once carved, an object never moves.
|
||||
We are free to append data of any size to the currently
|
||||
growing object.
|
||||
Exactly one object is growing in an obstack at any one time.
|
||||
You can run one obstack per control block.
|
||||
You may have as many control blocks as you dare.
|
||||
Because of the way we do it, you can `unwind' a obstack
|
||||
back to a previous state. (You may remove objects much
|
||||
as you would with a stack.)
|
||||
*/
|
||||
|
||||
|
||||
/* Don't do the contents of this file more than once. */
|
||||
|
||||
#ifndef __OBSTACKS__
|
||||
#define __OBSTACKS__
|
||||
|
||||
/* We use subtraction of (char *)0 instead of casting to int
|
||||
because on word-addressable machines a simple cast to int
|
||||
may ignore the byte-within-word field of the pointer. */
|
||||
|
||||
#ifndef __PTR_TO_INT
|
||||
#define __PTR_TO_INT(P) ((P) - (char *)0)
|
||||
#endif
|
||||
|
||||
#ifndef __INT_TO_PTR
|
||||
#define __INT_TO_PTR(P) ((P) + (char *)0)
|
||||
#endif
|
||||
|
||||
struct _obstack_chunk /* Lives at front of each chunk. */
|
||||
{
|
||||
char *limit; /* 1 past end of this chunk */
|
||||
struct _obstack_chunk *prev; /* address of prior chunk or NULL */
|
||||
char contents[4]; /* objects begin here */
|
||||
};
|
||||
|
||||
struct obstack /* control current object in current chunk */
|
||||
{
|
||||
long chunk_size; /* preferred size to allocate chunks in */
|
||||
struct _obstack_chunk* chunk; /* address of current struct obstack_chunk */
|
||||
char *object_base; /* address of object we are building */
|
||||
char *next_free; /* where to add next char to current object */
|
||||
char *chunk_limit; /* address of char after current chunk */
|
||||
int temp; /* Temporary for some macros. */
|
||||
int alignment_mask; /* Mask of alignment for each object. */
|
||||
struct _obstack_chunk *(*chunkfun) (); /* User's fcn to allocate a chunk. */
|
||||
void (*freefun) (); /* User's function to free a chunk. */
|
||||
void *area_id; /* Select which region to alloc/free in */
|
||||
int flags; /* Miscellaneous special purpose flags */
|
||||
};
|
||||
|
||||
/* Declare bits for flags word. */
|
||||
|
||||
/* Means there is a possibility the current chunk contains a zero-length
|
||||
object. This prevents freeing the chunk if we allocate a bigger chunk
|
||||
to replace it. */
|
||||
|
||||
#define OBSTACK_MAYBE_EMPTY_OBJECT (1 << 0)
|
||||
|
||||
/* Means that the allocation and deallocation functions take two arguments,
|
||||
ala the mmalloc package. The first argument is a generic pointer that
|
||||
is saved in the area_id member of the obstack struct. */
|
||||
|
||||
#define OBSTACK_MMALLOC_LIKE (1 << 1)
|
||||
|
||||
/* Declare the external functions we use; they are in obstack.c. */
|
||||
|
||||
#ifdef __STDC__
|
||||
extern void _obstack_newchunk (struct obstack *, int);
|
||||
extern void _obstack_free (struct obstack *, void *);
|
||||
extern void _obstack_begin (struct obstack *, int, int,
|
||||
void *(*) (int), void (*) (int), void *, int);
|
||||
#else
|
||||
extern void _obstack_newchunk ();
|
||||
extern void _obstack_free ();
|
||||
extern void _obstack_begin ();
|
||||
#endif
|
||||
|
||||
#ifdef __STDC__
|
||||
|
||||
/* Do the function-declarations after the structs
|
||||
but before defining the macros. */
|
||||
|
||||
void obstack_init (struct obstack *obstack);
|
||||
|
||||
void * obstack_alloc (struct obstack *obstack, int size);
|
||||
|
||||
void * obstack_copy (struct obstack *obstack, void *address, int size);
|
||||
void * obstack_copy0 (struct obstack *obstack, void *address, int size);
|
||||
|
||||
void obstack_free (struct obstack *obstack, void *block);
|
||||
|
||||
void obstack_blank (struct obstack *obstack, int size);
|
||||
|
||||
void obstack_grow (struct obstack *obstack, void *data, int size);
|
||||
void obstack_grow0 (struct obstack *obstack, void *data, int size);
|
||||
|
||||
void obstack_1grow (struct obstack *obstack, int data_char);
|
||||
void obstack_ptr_grow (struct obstack *obstack, void *data);
|
||||
void obstack_int_grow (struct obstack *obstack, int data);
|
||||
|
||||
void * obstack_finish (struct obstack *obstack);
|
||||
|
||||
int obstack_object_size (struct obstack *obstack);
|
||||
|
||||
int obstack_room (struct obstack *obstack);
|
||||
void obstack_1grow_fast (struct obstack *obstack, int data_char);
|
||||
void obstack_ptr_grow_fast (struct obstack *obstack, void *data);
|
||||
void obstack_int_grow_fast (struct obstack *obstack, int data);
|
||||
void obstack_blank_fast (struct obstack *obstack, int size);
|
||||
|
||||
void * obstack_base (struct obstack *obstack);
|
||||
void * obstack_next_free (struct obstack *obstack);
|
||||
int obstack_alignment_mask (struct obstack *obstack);
|
||||
int obstack_chunk_size (struct obstack *obstack);
|
||||
|
||||
#endif /* __STDC__ */
|
||||
|
||||
/* Non-ANSI C cannot really support alternative functions for these macros,
|
||||
so we do not declare them. */
|
||||
|
||||
/* Pointer to beginning of object being allocated or to be allocated next.
|
||||
Note that this might not be the final address of the object
|
||||
because a new chunk might be needed to hold the final size. */
|
||||
|
||||
#define obstack_base(h) ((h)->object_base)
|
||||
|
||||
/* Size for allocating ordinary chunks. */
|
||||
|
||||
#define obstack_chunk_size(h) ((h)->chunk_size)
|
||||
|
||||
/* Pointer to next byte not yet allocated in current chunk. */
|
||||
|
||||
#define obstack_next_free(h) ((h)->next_free)
|
||||
|
||||
/* Mask specifying low bits that should be clear in address of an object. */
|
||||
|
||||
#define obstack_alignment_mask(h) ((h)->alignment_mask)
|
||||
|
||||
#define obstack_init(h) \
|
||||
_obstack_begin ((h), 0, 0, \
|
||||
(void *(*) ()) obstack_chunk_alloc, (void (*) ())obstack_chunk_free, (void *) 0, 0)
|
||||
|
||||
#define obstack_begin(h, size) \
|
||||
_obstack_begin ((h), (size), 0, \
|
||||
(void *(*) ()) obstack_chunk_alloc, (void (*) ())obstack_chunk_free, (void *) 0, 0)
|
||||
|
||||
#define obstack_full_begin(h,size,alignment,chunkfun,freefun,area_id,flags) \
|
||||
_obstack_begin ((h), (size), (alignment), \
|
||||
(void *(*) ()) (chunkfun), (void (*) ()) (freefun), \
|
||||
(area_id), (flags))
|
||||
|
||||
#define obstack_chunkfun(h, newchunkfun) \
|
||||
((h) -> chunkfun = (struct _obstack_chunk *(*)()) (newchunkfun))
|
||||
|
||||
#define obstack_freefun(h, newfreefun) \
|
||||
((h) -> freefun = (void (*)()) (newfreefun))
|
||||
|
||||
#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = achar)
|
||||
|
||||
#define obstack_blank_fast(h,n) ((h)->next_free += (n))
|
||||
|
||||
#if defined (__GNUC__) && defined (__STDC__)
|
||||
#if __GNUC__ < 2
|
||||
#define __extension__
|
||||
#endif
|
||||
|
||||
/* For GNU C, if not -traditional,
|
||||
we can define these macros to compute all args only once
|
||||
without using a global variable.
|
||||
Also, we can avoid using the `temp' slot, to make faster code. */
|
||||
|
||||
#define obstack_object_size(OBSTACK) \
|
||||
__extension__ \
|
||||
({ struct obstack *__o = (OBSTACK); \
|
||||
(unsigned) (__o->next_free - __o->object_base); })
|
||||
|
||||
#define obstack_room(OBSTACK) \
|
||||
__extension__ \
|
||||
({ struct obstack *__o = (OBSTACK); \
|
||||
(unsigned) (__o->chunk_limit - __o->next_free); })
|
||||
|
||||
/* Note that the call to _obstack_newchunk is enclosed in (..., 0)
|
||||
so that we can avoid having void expressions
|
||||
in the arms of the conditional expression.
|
||||
Casting the third operand to void was tried before,
|
||||
but some compilers won't accept it. */
|
||||
#define obstack_grow(OBSTACK,where,length) \
|
||||
__extension__ \
|
||||
({ struct obstack *__o = (OBSTACK); \
|
||||
int __len = (length); \
|
||||
((__o->next_free + __len > __o->chunk_limit) \
|
||||
? (_obstack_newchunk (__o, __len), 0) : 0); \
|
||||
bcopy (where, __o->next_free, __len); \
|
||||
__o->next_free += __len; \
|
||||
(void) 0; })
|
||||
|
||||
#define obstack_grow0(OBSTACK,where,length) \
|
||||
__extension__ \
|
||||
({ struct obstack *__o = (OBSTACK); \
|
||||
int __len = (length); \
|
||||
((__o->next_free + __len + 1 > __o->chunk_limit) \
|
||||
? (_obstack_newchunk (__o, __len + 1), 0) : 0), \
|
||||
bcopy (where, __o->next_free, __len), \
|
||||
__o->next_free += __len, \
|
||||
*(__o->next_free)++ = 0; \
|
||||
(void) 0; })
|
||||
|
||||
#define obstack_1grow(OBSTACK,datum) \
|
||||
__extension__ \
|
||||
({ struct obstack *__o = (OBSTACK); \
|
||||
((__o->next_free + 1 > __o->chunk_limit) \
|
||||
? (_obstack_newchunk (__o, 1), 0) : 0), \
|
||||
*(__o->next_free)++ = (datum); \
|
||||
(void) 0; })
|
||||
|
||||
/* These assume that the obstack alignment is good enough for pointers or ints,
|
||||
and that the data added so far to the current object
|
||||
shares that much alignment. */
|
||||
|
||||
#define obstack_ptr_grow(OBSTACK,datum) \
|
||||
__extension__ \
|
||||
({ struct obstack *__o = (OBSTACK); \
|
||||
((__o->next_free + sizeof (void *) > __o->chunk_limit) \
|
||||
? (_obstack_newchunk (__o, sizeof (void *)), 0) : 0), \
|
||||
*(*(void ***)&__o->next_free)++ = ((void *)datum); \
|
||||
(void) 0; })
|
||||
|
||||
#define obstack_int_grow(OBSTACK,datum) \
|
||||
__extension__ \
|
||||
({ struct obstack *__o = (OBSTACK); \
|
||||
((__o->next_free + sizeof (int) > __o->chunk_limit) \
|
||||
? (_obstack_newchunk (__o, sizeof (int)), 0) : 0), \
|
||||
*(*(int **)&__o->next_free)++ = ((int)datum); \
|
||||
(void) 0; })
|
||||
|
||||
#define obstack_ptr_grow_fast(h,aptr) (*(*(void ***)&(h)->next_free)++ = (void *)aptr)
|
||||
#define obstack_int_grow_fast(h,aint) (*(*(int **)&(h)->next_free)++ = (int)aint)
|
||||
|
||||
#define obstack_blank(OBSTACK,length) \
|
||||
__extension__ \
|
||||
({ struct obstack *__o = (OBSTACK); \
|
||||
int __len = (length); \
|
||||
((__o->chunk_limit - __o->next_free < __len) \
|
||||
? (_obstack_newchunk (__o, __len), 0) : 0); \
|
||||
__o->next_free += __len; \
|
||||
(void) 0; })
|
||||
|
||||
#define obstack_alloc(OBSTACK,length) \
|
||||
__extension__ \
|
||||
({ struct obstack *__h = (OBSTACK); \
|
||||
obstack_blank (__h, (length)); \
|
||||
obstack_finish (__h); })
|
||||
|
||||
#define obstack_copy(OBSTACK,where,length) \
|
||||
__extension__ \
|
||||
({ struct obstack *__h = (OBSTACK); \
|
||||
obstack_grow (__h, (where), (length)); \
|
||||
obstack_finish (__h); })
|
||||
|
||||
#define obstack_copy0(OBSTACK,where,length) \
|
||||
__extension__ \
|
||||
({ struct obstack *__h = (OBSTACK); \
|
||||
obstack_grow0 (__h, (where), (length)); \
|
||||
obstack_finish (__h); })
|
||||
|
||||
/* The local variable is named __o1 to avoid a name conflict
|
||||
when obstack_blank is called. */
|
||||
#define obstack_finish(OBSTACK) \
|
||||
__extension__ \
|
||||
({ struct obstack *__o1 = (OBSTACK); \
|
||||
void *value = (void *) __o1->object_base; \
|
||||
if (__o1->next_free == value) \
|
||||
__o1->flags |= OBSTACK_MAYBE_EMPTY_OBJECT; \
|
||||
__o1->next_free \
|
||||
= __INT_TO_PTR ((__PTR_TO_INT (__o1->next_free)+__o1->alignment_mask)\
|
||||
& ~ (__o1->alignment_mask)); \
|
||||
((__o1->next_free - (char *)__o1->chunk \
|
||||
> __o1->chunk_limit - (char *)__o1->chunk) \
|
||||
? (__o1->next_free = __o1->chunk_limit) : 0); \
|
||||
__o1->object_base = __o1->next_free; \
|
||||
value; })
|
||||
|
||||
#define obstack_free(OBSTACK, OBJ) \
|
||||
__extension__ \
|
||||
({ struct obstack *__o = (OBSTACK); \
|
||||
void *__obj = (OBJ); \
|
||||
if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \
|
||||
__o->next_free = __o->object_base = __obj; \
|
||||
else (obstack_free) (__o, __obj); })
|
||||
|
||||
#else /* not __GNUC__ or not __STDC__ */
|
||||
|
||||
#define obstack_object_size(h) \
|
||||
(unsigned) ((h)->next_free - (h)->object_base)
|
||||
|
||||
#define obstack_room(h) \
|
||||
(unsigned) ((h)->chunk_limit - (h)->next_free)
|
||||
|
||||
#define obstack_grow(h,where,length) \
|
||||
( (h)->temp = (length), \
|
||||
(((h)->next_free + (h)->temp > (h)->chunk_limit) \
|
||||
? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \
|
||||
bcopy (where, (h)->next_free, (h)->temp), \
|
||||
(h)->next_free += (h)->temp)
|
||||
|
||||
#define obstack_grow0(h,where,length) \
|
||||
( (h)->temp = (length), \
|
||||
(((h)->next_free + (h)->temp + 1 > (h)->chunk_limit) \
|
||||
? (_obstack_newchunk ((h), (h)->temp + 1), 0) : 0), \
|
||||
bcopy (where, (h)->next_free, (h)->temp), \
|
||||
(h)->next_free += (h)->temp, \
|
||||
*((h)->next_free)++ = 0)
|
||||
|
||||
#define obstack_1grow(h,datum) \
|
||||
( (((h)->next_free + 1 > (h)->chunk_limit) \
|
||||
? (_obstack_newchunk ((h), 1), 0) : 0), \
|
||||
*((h)->next_free)++ = (datum))
|
||||
|
||||
#define obstack_ptr_grow(h,datum) \
|
||||
( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \
|
||||
? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \
|
||||
*(*(char ***)&(h)->next_free)++ = ((char *)datum))
|
||||
|
||||
#define obstack_int_grow(h,datum) \
|
||||
( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \
|
||||
? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \
|
||||
*(*(int **)&(h)->next_free)++ = ((int)datum))
|
||||
|
||||
#define obstack_ptr_grow_fast(h,aptr) (*(*(char ***)&(h)->next_free)++ = (char *)aptr)
|
||||
#define obstack_int_grow_fast(h,aint) (*(*(int **)&(h)->next_free)++ = (int)aint)
|
||||
#define obstack_blank(h,length) \
|
||||
( (h)->temp = (length), \
|
||||
(((h)->chunk_limit - (h)->next_free < (h)->temp) \
|
||||
? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \
|
||||
(h)->next_free += (h)->temp)
|
||||
|
||||
#define obstack_alloc(h,length) \
|
||||
(obstack_blank ((h), (length)), obstack_finish ((h)))
|
||||
|
||||
#define obstack_copy(h,where,length) \
|
||||
(obstack_grow ((h), (where), (length)), obstack_finish ((h)))
|
||||
|
||||
#define obstack_copy0(h,where,length) \
|
||||
(obstack_grow0 ((h), (where), (length)), obstack_finish ((h)))
|
||||
|
||||
#define obstack_finish(h) \
|
||||
( ((h)->next_free == (h)->object_base \
|
||||
? (((h)->flags |= OBSTACK_MAYBE_EMPTY_OBJECT), 0) \
|
||||
: 0), \
|
||||
(h)->temp = __PTR_TO_INT ((h)->object_base), \
|
||||
(h)->next_free \
|
||||
= __INT_TO_PTR ((__PTR_TO_INT ((h)->next_free)+(h)->alignment_mask) \
|
||||
& ~ ((h)->alignment_mask)), \
|
||||
(((h)->next_free - (char *)(h)->chunk \
|
||||
> (h)->chunk_limit - (char *)(h)->chunk) \
|
||||
? ((h)->next_free = (h)->chunk_limit) : 0), \
|
||||
(h)->object_base = (h)->next_free, \
|
||||
__INT_TO_PTR ((h)->temp))
|
||||
|
||||
#ifdef __STDC__
|
||||
#define obstack_free(h,obj) \
|
||||
( (h)->temp = (char *)(obj) - (char *) (h)->chunk, \
|
||||
(((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
|
||||
? (int) ((h)->next_free = (h)->object_base \
|
||||
= (h)->temp + (char *) (h)->chunk) \
|
||||
: (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0)))
|
||||
#else
|
||||
#define obstack_free(h,obj) \
|
||||
( (h)->temp = (char *)(obj) - (char *) (h)->chunk, \
|
||||
(((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
|
||||
? (int) ((h)->next_free = (h)->object_base \
|
||||
= (h)->temp + (char *) (h)->chunk) \
|
||||
: (_obstack_free ((h), (h)->temp + (char *) (h)->chunk), 0)))
|
||||
#endif
|
||||
|
||||
#endif /* not __GNUC__ or not __STDC__ */
|
||||
|
||||
#endif /* not __OBSTACKS__ */
|
|
@ -49,7 +49,7 @@ shar: $(SHARFILES)
|
|||
shar $(SHARFILES) >shar
|
||||
|
||||
clean:
|
||||
rm -f *.[oa] testit foo core tags lint lint.all a.out shar
|
||||
rm -f *.[oa] testit foo core tags lint lint.all a.out shar *# *~
|
||||
|
||||
lint: testit
|
||||
lint -a -b -u -x $(DEFS) $(SOURCES) testit.c >lint.all
|
||||
|
|
|
@ -25,9 +25,32 @@
|
|||
#define RN_CR2 21
|
||||
#endif
|
||||
|
||||
#ifdef __NetBSD__
|
||||
/* Register numbers */
|
||||
#define RN_ESP 2
|
||||
#define RN_EBP 3
|
||||
#define RN_ESP_AT_SIGNAL 4
|
||||
#define RN_EIP 5
|
||||
#define RN_EFLAGS 6
|
||||
#define RN_ES 7
|
||||
#define RN_DS 8
|
||||
#define RN_CS 9
|
||||
#define RN_SS 10
|
||||
#define RN_EDI 11
|
||||
#define RN_ESI 12
|
||||
#define RN_EBX 13
|
||||
#define RN_EDX 14
|
||||
#define RN_ECX 15
|
||||
#define RN_EAX 16
|
||||
/* NetBSD doesn't context switch gs or fs */
|
||||
#define SC_GS 0x27
|
||||
#define SC_FS 0x27
|
||||
#endif
|
||||
|
||||
#ifdef linux
|
||||
#define SC_GS regval[RN_GS]
|
||||
#define SC_FS regval[RN_FS]
|
||||
#endif
|
||||
#define SC_ES regval[RN_ES]
|
||||
#define SC_DS regval[RN_DS]
|
||||
#define SC_EDI(dbg_mask) (regval[RN_EDI] & dbg_mask)
|
||||
|
|
|
@ -16,7 +16,7 @@ if1632.o: $(OBJS)
|
|||
$(LD) -r -o if1632.o $(OBJS)
|
||||
|
||||
clean:
|
||||
rm -f *.o *~ *.s dll_* *.a
|
||||
rm -f *.o *~ *.s dll_* *.a *#
|
||||
|
||||
dll_kernel.S dll_kernel_tab.c: ../tools/build kernel.spec
|
||||
../tools/build kernel.spec
|
||||
|
|
|
@ -102,7 +102,7 @@ _CallToInit16:
|
|||
movl %esp,%eax
|
||||
movl %eax,%ebp
|
||||
#if 1
|
||||
movw $ UDATASEL,%ax
|
||||
movw $UDATASEL,%ax
|
||||
movw %ax,%fs
|
||||
movw %ax,%gs
|
||||
#endif
|
||||
|
@ -124,7 +124,7 @@ _CallToInit16:
|
|||
* GDT usage.
|
||||
*/
|
||||
pushl %eax
|
||||
movw $ UDATASEL,%ax
|
||||
movw $UDATASEL,%ax
|
||||
movw %ax,%ds
|
||||
movw %ax,%es
|
||||
movw %ax,%fs
|
||||
|
@ -204,7 +204,7 @@ _CallTo16:
|
|||
* GDT usage.
|
||||
*/
|
||||
pushl %eax
|
||||
movw $ UDATASEL,%ax
|
||||
movw $UDATASEL,%ax
|
||||
movw %ax,%ds
|
||||
movw %ax,%es
|
||||
movw %ax,%fs
|
||||
|
@ -259,7 +259,7 @@ _CallTo32:
|
|||
* Restore segment registers.
|
||||
*/
|
||||
pushl %eax
|
||||
movw $ UDATASEL,%ax
|
||||
movw $UDATASEL,%ax
|
||||
movw %ax,%ds
|
||||
movw %ax,%es
|
||||
popl %eax
|
||||
|
@ -359,21 +359,23 @@ _ReturnFromRegisterFunc:
|
|||
* the return address, the saved registers, and the return
|
||||
* address again.
|
||||
*/
|
||||
popw %ax /* Throw away the number of arguments */
|
||||
popl %eax /* Throw away first copy of return address */
|
||||
add $6,%esp /* argument count, return address */
|
||||
popw %gs
|
||||
add $2,%esp
|
||||
popw %fs
|
||||
add $2,%esp
|
||||
popw %es
|
||||
add $2,%esp
|
||||
popw %ds
|
||||
popw %di
|
||||
popw %si
|
||||
popw %bp
|
||||
popw %ax /* Throw away pushed stack pointer */
|
||||
popw %bx
|
||||
popw %dx
|
||||
popw %cx
|
||||
popw %ax
|
||||
add $2,%esp
|
||||
popal
|
||||
add $16,%esp /* trapno, err, eip, cs */
|
||||
popfl
|
||||
add $20,%esp /* esp, ss, i387, oldmask, cr2 */
|
||||
|
||||
/*
|
||||
* Return to original caller.
|
||||
*/
|
||||
.byte 0x66
|
||||
lret
|
||||
|
||||
|
|
|
@ -104,6 +104,7 @@ CALLBACK_MakeProcInstance(void *func, int instance)
|
|||
tp->thunk[4] = 0xd8;
|
||||
tp->thunk[5] = 0xea;
|
||||
memcpy(&tp->thunk[6], &func, 4);
|
||||
tp->used = 1;
|
||||
|
||||
return tp->thunk;
|
||||
}
|
||||
|
@ -141,9 +142,6 @@ LONG CallWindowProc( FARPROC func, HWND hwnd, WORD message,
|
|||
PushOn16( CALLBACK_SIZE_WORD, message );
|
||||
PushOn16( CALLBACK_SIZE_WORD, wParam );
|
||||
PushOn16( CALLBACK_SIZE_LONG, lParam );
|
||||
|
||||
printf("%8.8x(%4.4x, %4.4x, %4.4x, %8.8x)\n", func, hwnd, message, wParam, lParam);
|
||||
|
||||
return CallTo16((unsigned int) func,
|
||||
FindDataSegmentForCode((unsigned long) func));
|
||||
}
|
||||
|
|
|
@ -131,6 +131,7 @@ length 490
|
|||
346 pascal SetTextAlign(word word) SetTextAlign(1 2)
|
||||
348 pascal Chord(word s_word s_word s_word s_word s_word s_word s_word s_word)
|
||||
Chord(1 2 3 4 5 6 7 8 9)
|
||||
350 pascal GetCharWidth(word word word ptr) GetCharWidth(1 2 3 4)
|
||||
360 pascal CreatePalette(ptr) CreatePalette(1)
|
||||
363 pascal GetPaletteEntries(word word word ptr) GetPaletteEntries(1 2 3 4)
|
||||
364 pascal SetPaletteEntries(word word word ptr) SetPaletteEntries(1 2 3 4)
|
||||
|
|
|
@ -44,7 +44,7 @@ length 415
|
|||
86 pascal _lwrite(word ptr word) KERNEL__lwrite(1 2 3)
|
||||
88 pascal lstrcpy(ptr ptr) lstrcpy(1 2)
|
||||
89 pascal lstrcat(ptr ptr) lstrcat(1 2)
|
||||
90 pascal lstrlen(ptr) lstrcpy(1)
|
||||
90 pascal lstrlen(ptr) lstrlen(1)
|
||||
91 register InitTask(word word word word word
|
||||
word word word word word)
|
||||
KERNEL_InitTask()
|
||||
|
@ -66,6 +66,7 @@ length 415
|
|||
154 return GlobalNotify 4 0
|
||||
163 pascal GlobalLRUOldest(word) ReturnArg(1)
|
||||
164 pascal GlobalLRUNewest(word) ReturnArg(1)
|
||||
166 pascal WinExec(ptr word) WinExec(1 2)
|
||||
178 equate __WINFLAGS 0x413
|
||||
184 return GlobalDOSAlloc 4 0
|
||||
185 return GlobalDOSFree 2 0
|
||||
|
|
|
@ -15,9 +15,13 @@ length 540
|
|||
15 pascal GetCurrentTime() GetTickCount()
|
||||
18 pascal SetCapture(word) SetCapture(1)
|
||||
19 pascal ReleaseCapture() ReleaseCapture()
|
||||
22 pascal SetFocus(word) SetFocus(1)
|
||||
23 pascal GetFocus() GetFocus()
|
||||
31 pascal IsIconic(word) IsIconic(1)
|
||||
32 pascal GetWindowRect(word ptr) GetWindowRect(1 2)
|
||||
33 pascal GetClientRect(word ptr) GetClientRect(1 2)
|
||||
36 pascal GetWindowText(word ptr word) GetWindowText(1 2 3)
|
||||
37 pascal SetWindowText(word ptr) SetWindowText(1 2)
|
||||
38 pascal GetWindowTextLength(word) GetWindowTextLength(1)
|
||||
39 pascal BeginPaint(word ptr) BeginPaint(1 2)
|
||||
40 pascal EndPaint(word ptr) EndPaint(1 2)
|
||||
|
@ -25,8 +29,13 @@ length 540
|
|||
CreateWindow(1 2 3 4 5 6 7 8 9 10 11)
|
||||
42 pascal ShowWindow(word word) ShowWindow(1 2)
|
||||
46 pascal GetParent(word) GetParent(1)
|
||||
48 pascal IsChild(word word) IsChild(1 2)
|
||||
53 pascal DestroyWindow(word) DestroyWindow(1)
|
||||
56 pascal MoveWindow(word word word word word word)
|
||||
MoveWindow(1 2 3 4 5 6)
|
||||
57 pascal RegisterClass(ptr) RegisterClass(1)
|
||||
62 pascal SetScrollPos(word word word word) SetScrollPos(1 2 3 4)
|
||||
64 pascal SetScrollRange(word word word word word) SetScrollRange(1 2 3 4 5)
|
||||
66 pascal GetDC(word) GetDC(1)
|
||||
68 pascal ReleaseDC(word word) ReleaseDC(1 2)
|
||||
72 pascal SetRect(ptr s_word s_word s_word s_word) SetRect(1 2 3 4 5)
|
||||
|
@ -42,7 +51,22 @@ length 540
|
|||
82 pascal InvertRect(word ptr) InvertRect(1 2)
|
||||
83 pascal FrameRect(word ptr word) FrameRect(1 2 3)
|
||||
85 pascal DrawText(word ptr s_word ptr word) DrawText(1 2 3 4 5)
|
||||
87 pascal DialogBox(word ptr word ptr) DialogBox(1 2 3 4)
|
||||
88 pascal EndDialog(word s_word) EndDialog(1 2)
|
||||
89 pascal CreateDialog(word ptr word ptr) CreateDialog(1 2 3 4)
|
||||
90 pascal IsDialogMessage(word ptr) IsDialogMessage(1 2)
|
||||
91 pascal GetDlgItem(word word) GetDlgItem(1 2)
|
||||
92 pascal SetDlgItemText(word ptr) SetDlgItemText(1 2)
|
||||
93 pascal GetDlgItemText(word word ptr word) GetDlgItemText(1 2 3 4)
|
||||
94 pascal SetDlgItemInt(word word word word) SetDlgItemInt(1 2 3 4)
|
||||
95 pascal GetDlgItemInt(word word ptr word) GetDlgItemInt(1 2 3 4)
|
||||
96 pascal CheckRadioButton(word word word word) CheckRadioButton(1 2 3 4)
|
||||
97 pascal CheckDlgButton(word word word) CheckDlgButton(1 2 3)
|
||||
98 pascal IsDlgButtonChecked(word word) IsDlgButtonChecked(1 2)
|
||||
101 pascal SendDlgItemMessage(word word word word long)
|
||||
SendDlgItemMessage(1 2 3 4 5)
|
||||
102 pascal AdjustWindowRect(ptr long word) AdjustWindowRect(1 2 3)
|
||||
103 pascal MapDialogRect(word ptr) MapDialogRect(1 2)
|
||||
104 pascal MessageBeep(word) MessageBeep(1)
|
||||
106 pascal GetKeyState(word) GetKeyState(1)
|
||||
107 pascal DefWindowProc(word word word long) DefWindowProc(1 2 3 4)
|
||||
|
@ -55,6 +79,7 @@ length 540
|
|||
118 pascal RegisterWindowMessage(ptr) RegisterWindowMessage(1)
|
||||
119 pascal GetMessagePos() GetMessagePos()
|
||||
120 pascal GetMessageTime() GetMessageTime()
|
||||
122 pascal CallWindowProc(ptr word word word long) CallWindowProc(1 2 3 4 5)
|
||||
124 pascal UpdateWindow(word) UpdateWindow(1)
|
||||
125 pascal InvalidateRect(word ptr word) InvalidateRect(1 2 3)
|
||||
126 pascal InvalidateRgn(word word word) InvalidateRgn(1 2 3)
|
||||
|
@ -73,6 +98,7 @@ length 540
|
|||
154 pascal CheckMenu(word word word) CheckMenu(1 2 3)
|
||||
157 pascal GetMenu(word) GetMenu(1)
|
||||
158 pascal SetMenu(word word) SetMenu(1 2)
|
||||
171 pascal WinHelp(word word long) WinHelp(1 2 3)
|
||||
173 pascal LoadCursor(word ptr) LoadCursor(1 2)
|
||||
174 pascal LoadIcon(word ptr) LoadIcon(1 2)
|
||||
175 pascal LoadBitmap(word ptr) LoadBitmap(1 2)
|
||||
|
@ -81,27 +107,25 @@ length 540
|
|||
179 pascal GetSystemMetrics(word) GetSystemMetrics(1)
|
||||
180 pascal GetSysColor(word) GetSysColor(1)
|
||||
181 pascal SetSysColors(word ptr ptr) SetSysColors(1 2 3)
|
||||
430 pascal lstrcmp(ptr ptr) lstrcmp(1 2)
|
||||
431 pascal AnsiUpper(ptr) AnsiUpper(1)
|
||||
432 pascal AnsiLower(ptr) AnsiLower(1)
|
||||
433 pascal IsCharAlpha(byte) IsCharAlpha(1)
|
||||
434 pascal IsCharAlphanumeric(byte) IsCharAlphanumeric(1)
|
||||
435 pascal IsCharUpper(byte) IsCharUpper(1)
|
||||
436 pascal IsCharLower(byte) IsCharLower(1)
|
||||
437 pascal AnsiUpperBuff(ptr word) AnsiUpperBuff(1 2)
|
||||
438 pascal AnsiLowerBuff(ptr word) AnsiLowerBuff(1 2)
|
||||
471 pascal lstrcmpi(ptr ptr) lstrcmpi(1 2)
|
||||
472 pascal AnsiNext(ptr) AnsiNext(1 )
|
||||
473 pascal AnsiPrev(ptr ptr) AnsiPrev(1 2)
|
||||
|
||||
|
||||
|
||||
|
||||
182 pascal KillSystemTimer(word word) KillSystemTimer(1 2)
|
||||
190 pascal GetUpdateRect(word ptr word) GetUpdateRect(1 2 3)
|
||||
219 pascal CreateDialogIndirect(word ptr word ptr)
|
||||
CreateDialogIndirect(1 2 3 4)
|
||||
227 pascal GetNextDlgGroupItem(word word word) GetNextDlgGroupItem(1 2 3)
|
||||
228 pascal GetNextDlgTabItem(word word word) GetNextDlgTabItem(1 2 3)
|
||||
229 pascal GetTopWindow(word) GetTopWindow(1)
|
||||
230 pascal GetNextWindow(word word) GetNextWindow(1 2)
|
||||
232 pascal SetWindowPos(word word word word word word word)
|
||||
SetWindowPos(1 2 3 4 5 6 7)
|
||||
237 pascal GetUpdateRgn(word word word) GetUpdateRgn(1 2 3)
|
||||
241 pascal CreateDialogParam(word ptr word ptr long)
|
||||
CreateDialogParam(1 2 3 4 5)
|
||||
242 pascal CreateDialogIndirectParam(word ptr word ptr long)
|
||||
CreateDialogIndirectParam(1 2 3 4 5)
|
||||
244 pascal EqualRect(ptr ptr) EqualRect(1 2)
|
||||
262 pascal GetWindow(word word) GetWindow(1 2)
|
||||
266 pascal SetMessageQueue(word) SetMessageQueue(1)
|
||||
277 pascal GetDlgCtrlID(word) GetDlgCtrlID(1)
|
||||
286 pascal GetDesktopWindow() GetDesktopWindow()
|
||||
288 pascal GetMessageExtraInfo() GetMessageExtraInfo()
|
||||
324 pascal FillWindow(word word word word) FillWindow(1 2 3 4)
|
||||
|
@ -111,4 +135,20 @@ length 540
|
|||
373 pascal SubtractRect(ptr ptr ptr) SubtractRect(1 2 3)
|
||||
403 pascal UnregisterClass(ptr word) UnregisterClass(1 2)
|
||||
411 pascal AppendMenu(word word word ptr) AppendMenu(1 2 3 4)
|
||||
420 pascal wsprintf(ptr ptr) wsprintf(1 2)
|
||||
421 pascal wvsprintf(ptr ptr ptr) wvsprintf(1 2 3)
|
||||
430 pascal lstrcmp(ptr ptr) lstrcmp(1 2)
|
||||
431 pascal AnsiUpper(ptr) AnsiUpper(1)
|
||||
432 pascal AnsiLower(ptr) AnsiLower(1)
|
||||
433 pascal IsCharAlpha(byte) IsCharAlpha(1)
|
||||
434 pascal IsCharAlphanumeric(byte) IsCharAlphanumeric(1)
|
||||
435 pascal IsCharUpper(byte) IsCharUpper(1)
|
||||
436 pascal IsCharLower(byte) IsCharLower(1)
|
||||
437 pascal AnsiUpperBuff(ptr word) AnsiUpperBuff(1 2)
|
||||
438 pascal AnsiLowerBuff(ptr word) AnsiLowerBuff(1 2)
|
||||
452 pascal CreateWindowEx(long ptr ptr long s_word s_word s_word s_word
|
||||
word word word ptr)
|
||||
CreateWindowEx(1 2 3 4 5 6 7 8 9 10 11 12)
|
||||
471 pascal lstrcmpi(ptr ptr) lstrcmpi(1 2)
|
||||
472 pascal AnsiNext(ptr) AnsiNext(1 )
|
||||
473 pascal AnsiPrev(ptr ptr) AnsiPrev(1 2)
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Combo box definitions
|
||||
*/
|
||||
|
||||
|
||||
typedef struct tagHEADCOMBO {
|
||||
DWORD dwStyle;
|
||||
DWORD dwState;
|
||||
HWND hWndDrop;
|
||||
HWND hWndEdit;
|
||||
HWND hWndLBox;
|
||||
} HEADCOMBO;
|
||||
typedef HEADCOMBO FAR* LPHEADCOMBO;
|
||||
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Dialog definitions
|
||||
*
|
||||
* Copyright 1993 Alexandre Julliard
|
||||
*/
|
||||
|
||||
#ifndef DIALOG_H
|
||||
#define DIALOG_H
|
||||
|
||||
#include "windows.h"
|
||||
|
||||
#define DIALOG_CLASS_NAME "#32770" /* Integer atom */
|
||||
|
||||
|
||||
/* Dialog info structure.
|
||||
* This structure is stored into the window extra bytes (cbWndExtra).
|
||||
* sizeof(DIALOGINFO) must be <= DLGWINDOWEXTRA (=30).
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
LONG msgResult;
|
||||
FARPROC dlgProc;
|
||||
LONG userInfo;
|
||||
HWND hwndFocus;
|
||||
HFONT hUserFont;
|
||||
HMENU hMenu;
|
||||
WORD xBaseUnit;
|
||||
WORD yBaseUnit;
|
||||
WORD fEnd;
|
||||
} DIALOGINFO;
|
||||
|
||||
|
||||
/* Dialog template header */
|
||||
typedef struct
|
||||
{
|
||||
DWORD style;
|
||||
BYTE nbItems __attribute__ ((packed));
|
||||
WORD x __attribute__ ((packed));
|
||||
WORD y __attribute__ ((packed));
|
||||
WORD cx __attribute__ ((packed));
|
||||
WORD cy __attribute__ ((packed));
|
||||
} DLGTEMPLATEHEADER;
|
||||
|
||||
|
||||
/* Dialog control header */
|
||||
typedef struct
|
||||
{
|
||||
WORD x;
|
||||
WORD y;
|
||||
WORD cx;
|
||||
WORD cy;
|
||||
WORD id;
|
||||
DWORD style __attribute__ ((packed));
|
||||
} DLGCONTROLHEADER;
|
||||
|
||||
|
||||
/* Dialog control data */
|
||||
typedef struct
|
||||
{
|
||||
DLGCONTROLHEADER * header;
|
||||
LPSTR class;
|
||||
LPSTR text;
|
||||
} DLGCONTROL;
|
||||
|
||||
|
||||
/* Dialog template */
|
||||
typedef struct
|
||||
{
|
||||
DLGTEMPLATEHEADER * header;
|
||||
unsigned char * menuName;
|
||||
LPSTR className;
|
||||
LPSTR caption;
|
||||
WORD pointSize;
|
||||
LPSTR faceName;
|
||||
DLGCONTROL * controls;
|
||||
} DLGTEMPLATE;
|
||||
|
||||
|
||||
#endif /* DIALOG_H */
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef _FILES_H
|
||||
#define _FILES_H
|
||||
|
||||
#define OPEN_MAX 256
|
||||
|
||||
/***************************************************************************
|
||||
This structure stores the infomation needed for a single DOS drive
|
||||
***************************************************************************/
|
||||
struct DosDriveStruct
|
||||
{
|
||||
char RootDirectory [256]; /* Unix base for this drive letter */
|
||||
char CurrentDirectory [256]; /* Current directory for this drive */
|
||||
char VolumeLabel [11];
|
||||
unsigned long serialnumber;
|
||||
};
|
||||
|
||||
#endif /*_FILES_H*/
|
|
@ -0,0 +1,93 @@
|
|||
#ifndef INT21_H
|
||||
#define INT21_H
|
||||
|
||||
#define DosVersion 0x0303;
|
||||
|
||||
#define SectorSize 0x200;
|
||||
#define SectorsPerCluster 0x04;
|
||||
|
||||
#define AX context->sc_eax
|
||||
#define BX context->sc_ebx
|
||||
#define CX context->sc_ecx
|
||||
#define DX context->sc_edx
|
||||
#define ES context->sc_es
|
||||
#define DS context->sc_ds
|
||||
#define DI context->sc_edi
|
||||
#define SI context->sc_esi
|
||||
|
||||
#define pointer(a,b) (((unsigned int) a << 16) | b)
|
||||
#define segment(a) (a >> 16)
|
||||
#define offset(a) (a & 0xffff)
|
||||
|
||||
#define SetCflag (context->sc_efl |= 0x00000001L)
|
||||
#define ResetCflag (context->sc_efl &= 0xfffffffeL)
|
||||
|
||||
struct diskinfo {
|
||||
WORD infolevel;
|
||||
DWORD serialnumber;
|
||||
char label[11];
|
||||
char fstype[8];
|
||||
};
|
||||
|
||||
/* extended error codes */
|
||||
|
||||
#define NoError 0x00
|
||||
#define InvalidFunction 0x01
|
||||
#define FileNotFound 0x02
|
||||
#define PathNotFound 0x03
|
||||
#define AccessDenied 0x05
|
||||
#define InvalidHandle 0x06
|
||||
#define MCBDestroyed 0x07
|
||||
#define OutOfMemory 0x08
|
||||
#define MCBInvalid 0x09
|
||||
#define DataInvalid 0x0d
|
||||
#define InvalidDrive 0x0f
|
||||
#define CanNotRemoveCwd 0x10
|
||||
#define NotSameDevice 0x11
|
||||
#define NoMoreFiles 0x12
|
||||
#define WriteProtected 0x13
|
||||
#define UnknownUnit 0x14
|
||||
#define DriveNotReady 0x15
|
||||
#define UnknownCommand 0x16
|
||||
#define CRCError 0x17
|
||||
#define BadRqLength 0x18
|
||||
#define SeekError 0x19
|
||||
#define UnknownMedia 0x1a
|
||||
#define SectorNotFound 0x1b
|
||||
#define OutOfPaper 0x1c
|
||||
#define WriteFault 0x1d
|
||||
#define ReadFault 0x1e
|
||||
#define GeneralFailure 0x1f
|
||||
#define ShareViolation 0x20
|
||||
#define LockViolation 0x21
|
||||
#define DiskFull 0x27
|
||||
#define NoNetwork 0x49
|
||||
#define FileExists 0x50
|
||||
#define CanNotMakeDir 0x52
|
||||
|
||||
/* Error classes */
|
||||
|
||||
#define EC_Temporary 0x02
|
||||
#define EC_AccessDenied 0x03
|
||||
#define EC_AppError 0x04
|
||||
#define EC_SystemFailure 0x06
|
||||
#define EC_NotFound 0x08
|
||||
#define EC_MediaError 0x0b
|
||||
#define EC_Exists 0x0c
|
||||
#define EC_Unknown 0x0d
|
||||
|
||||
/* Suggested actions */
|
||||
|
||||
#define SA_Retry 0x01
|
||||
#define SA_Abort 0x04
|
||||
#define SA_Ignore 0x06
|
||||
#define SA_Ask4Retry 0x07
|
||||
|
||||
/* Error locus */
|
||||
|
||||
#define EL_Unknown 0x01
|
||||
#define EL_Disk 0x02
|
||||
#define EL_Network 0x03
|
||||
#define EL_Memory 0x05
|
||||
|
||||
#endif /* INT21_H */
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* List Box definitions
|
||||
*/
|
||||
|
||||
|
||||
typedef struct tagLISTSTRUCT {
|
||||
DRAWITEMSTRUCT dis;
|
||||
HANDLE hMem;
|
||||
HANDLE hData;
|
||||
void *lpNext;
|
||||
} LISTSTRUCT;
|
||||
typedef LISTSTRUCT FAR* LPLISTSTRUCT;
|
||||
|
||||
|
||||
typedef struct tagHEADLIST {
|
||||
short FirstVisible;
|
||||
short ItemSelect;
|
||||
short ItemsCount;
|
||||
short ItemsVisible;
|
||||
short ItemSelected;
|
||||
short PrevSelected;
|
||||
short StdItemHeight;
|
||||
short DrawCtlType;
|
||||
void *lpFirst;
|
||||
DWORD dwStyle;
|
||||
HWND hWndScroll;
|
||||
HWND hWndLogicParent;
|
||||
} HEADLIST;
|
||||
typedef HEADLIST FAR* LPHEADLIST;
|
||||
|
||||
|
|
@ -30,5 +30,8 @@ extern struct segment_descriptor_s *GetNextSegment(unsigned int flags,
|
|||
extern struct mz_header_s *CurrentMZHeader;
|
||||
extern struct ne_header_s *CurrentNEHeader;
|
||||
extern int CurrentNEFile;
|
||||
extern do_int1A(struct sigcontext_struct * context);
|
||||
extern do_int21(struct sigcontext_struct * context);
|
||||
|
||||
#endif /* PROTOTYPES_H */
|
||||
|
||||
|
|
|
@ -6,16 +6,16 @@
|
|||
|
||||
extern unsigned short *Stack16Frame;
|
||||
|
||||
#define _AX Stack16Frame[21]
|
||||
#define _BX Stack16Frame[18]
|
||||
#define _CX Stack16Frame[20]
|
||||
#define _DX Stack16Frame[19]
|
||||
#define _SP Stack16Frame[17]
|
||||
#define _BP Stack16Frame[16]
|
||||
#define _SI Stack16Frame[15]
|
||||
#define _DI Stack16Frame[14]
|
||||
#define _DS Stack16Frame[13]
|
||||
#define _ES Stack16Frame[12]
|
||||
#define _AX Stack16Frame[34]
|
||||
#define _BX Stack16Frame[28]
|
||||
#define _CX Stack16Frame[32]
|
||||
#define _DX Stack16Frame[30]
|
||||
#define _SP Stack16Frame[26]
|
||||
#define _BP Stack16Frame[24]
|
||||
#define _SI Stack16Frame[22]
|
||||
#define _DI Stack16Frame[20]
|
||||
#define _DS Stack16Frame[18]
|
||||
#define _ES Stack16Frame[16]
|
||||
|
||||
extern void ReturnFromRegisterFunc(void);
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Scroll Bar definitions
|
||||
*/
|
||||
|
||||
|
||||
typedef struct tagHEADSSCROLL {
|
||||
short CurVal;
|
||||
short MinVal;
|
||||
short MaxVal;
|
||||
short MaxPix;
|
||||
short CurPix;
|
||||
BOOL ThumbActive;
|
||||
WORD Direction;
|
||||
DWORD dwStyle;
|
||||
HWND hWndUp;
|
||||
HWND hWndDown;
|
||||
} HEADSCROLL;
|
||||
typedef HEADSCROLL FAR* LPHEADSCROLL;
|
||||
|
||||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#ifndef _WINARGS
|
||||
|
||||
typedef unsigned short UINT;
|
||||
typedef unsigned short WORD;
|
||||
typedef unsigned long DWORD;
|
||||
#ifndef _WINMAIN
|
||||
|
@ -12,6 +13,61 @@ typedef unsigned short BOOL;
|
|||
typedef unsigned char BYTE;
|
||||
#endif
|
||||
typedef long LONG;
|
||||
typedef UINT WPARAM;
|
||||
typedef LONG LPARAM;
|
||||
typedef LONG LRESULT;
|
||||
typedef WORD HANDLE;
|
||||
#define DECLARE_HANDLE(a) typedef HANDLE a;
|
||||
|
||||
DECLARE_HANDLE(HTASK);
|
||||
DECLARE_HANDLE(HDRVR);
|
||||
DECLARE_HANDLE(HWND);
|
||||
DECLARE_HANDLE(HDC);
|
||||
DECLARE_HANDLE(HCLASS);
|
||||
DECLARE_HANDLE(HCURSOR);
|
||||
DECLARE_HANDLE(HFONT);
|
||||
DECLARE_HANDLE(HPEN);
|
||||
DECLARE_HANDLE(HRGN);
|
||||
DECLARE_HANDLE(HPALETTE);
|
||||
DECLARE_HANDLE(HICON);
|
||||
DECLARE_HANDLE(HINSTANCE);
|
||||
DECLARE_HANDLE(HMENU);
|
||||
DECLARE_HANDLE(HBITMAP);
|
||||
DECLARE_HANDLE(HBRUSH);
|
||||
DECLARE_HANDLE(LOCALHANDLE);
|
||||
|
||||
typedef char *LPSTR;
|
||||
typedef const char *LPCSTR;
|
||||
typedef char *NPSTR;
|
||||
typedef short *LPINT;
|
||||
typedef void *LPVOID;
|
||||
typedef long (*FARPROC)();
|
||||
typedef int CATCHBUF[9];
|
||||
typedef int *LPCATCHBUF;
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#define CW_USEDEFAULT ((short)0x8000)
|
||||
#define FAR
|
||||
#define NEAR
|
||||
#define PASCAL
|
||||
#define VOID void
|
||||
#define WINAPI PASCAL
|
||||
#define CALLBACK PASCAL
|
||||
#ifndef NULL
|
||||
#define NULL (void *)0
|
||||
#endif
|
||||
|
||||
#define LOBYTE(w) ((BYTE)(w))
|
||||
#define HIBYTE(w) ((BYTE)((UINT)(w) >> 8))
|
||||
|
||||
#define LOWORD(l) ((WORD)(l))
|
||||
#define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
|
||||
|
||||
#define MAKELONG(low, high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
|
||||
|
||||
/*
|
||||
typedef long LONG;
|
||||
typedef WORD HANDLE;
|
||||
typedef HANDLE HWND;
|
||||
typedef HANDLE HDC;
|
||||
|
@ -44,6 +100,7 @@ typedef int *LPCATCHBUF;
|
|||
#ifndef NULL
|
||||
#define NULL (void *)0
|
||||
#endif
|
||||
*/
|
||||
|
||||
#define MAKELPARAM(low, high) ((LONG)(((WORD)(low)) | \
|
||||
(((DWORD)((WORD)(high))) << 16)))
|
||||
|
@ -133,6 +190,46 @@ typedef struct {
|
|||
#define DWL_DLGPROC 4
|
||||
#define DWL_USER 8
|
||||
|
||||
/* GetWindow() constants */
|
||||
#define GW_HWNDFIRST 0
|
||||
#define GW_HWNDLAST 1
|
||||
#define GW_HWNDNEXT 2
|
||||
#define GW_HWNDPREV 3
|
||||
#define GW_OWNER 4
|
||||
#define GW_CHILD 5
|
||||
|
||||
/* Dialogs */
|
||||
|
||||
/* cbWndExtra bytes for dialog class */
|
||||
#define DLGWINDOWEXTRA 30
|
||||
|
||||
/* Dialog styles */
|
||||
#define DS_ABSALIGN 0x001
|
||||
#define DS_SYSMODAL 0x002
|
||||
#define DS_LOCALEDIT 0x020
|
||||
#define DS_SETFONT 0x040
|
||||
#define DS_MODALFRAME 0x080
|
||||
#define DS_NOIDLEMSG 0x100
|
||||
|
||||
/* Dialog messages */
|
||||
#define DM_GETDEFID (WM_USER+0)
|
||||
#define DM_SETDEFID (WM_USER+1)
|
||||
|
||||
#define DC_HASDEFID 0x534b
|
||||
|
||||
/* WM_GETDLGCODE values */
|
||||
#define DLGC_WANTARROWS 0x0001
|
||||
#define DLGC_WANTTAB 0x0002
|
||||
#define DLGC_WANTALLKEYS 0x0004
|
||||
#define DLGC_WANTMESSAGE 0x0004
|
||||
#define DLGC_HASSETSEL 0x0008
|
||||
#define DLGC_DEFPUSHBUTTON 0x0010
|
||||
#define DLGC_UNDEFPUSHBUTTON 0x0020
|
||||
#define DLGC_RADIOBUTTON 0x0040
|
||||
#define DLGC_WANTCHARS 0x0080
|
||||
#define DLGC_STATIC 0x0100
|
||||
#define DLGC_BUTTON 0x2000
|
||||
|
||||
|
||||
typedef struct { short x, y; } POINT;
|
||||
typedef POINT *PPOINT;
|
||||
|
@ -787,6 +884,11 @@ enum { WM_NULL, WM_CREATE, WM_DESTROY, WM_MOVE, WM_UNUSED0, WM_SIZE, WM_ACTIVATE
|
|||
WM_DELETEITEM, WM_VKEYTOITEM,
|
||||
WM_CHARTOITEM, WM_SETFONT, WM_GETFONT };
|
||||
|
||||
#define WM_NCCREATE 0x0081
|
||||
#define WM_NCDESTROY 0x0082
|
||||
|
||||
#define WM_GETDLGCODE 0x0087
|
||||
|
||||
/* Keyboard messages */
|
||||
#define WM_KEYDOWN 0x0100
|
||||
#define WM_KEYUP 0x0101
|
||||
|
@ -798,11 +900,16 @@ enum { WM_NULL, WM_CREATE, WM_DESTROY, WM_MOVE, WM_UNUSED0, WM_SIZE, WM_ACTIVATE
|
|||
#define WM_SYSDEADCHAR 0x0107
|
||||
#define WM_KEYFIRST WM_KEYDOWN
|
||||
#define WM_KEYLAST 0x0108
|
||||
|
||||
|
||||
#define WM_INITDIALOG 0x0110
|
||||
#define WM_COMMAND 0x0111
|
||||
#define WM_TIMER 0x0113
|
||||
#define WM_SYSTIMER 0x0118
|
||||
|
||||
/* scroll messages */
|
||||
#define WM_HSCROLL 0x0114
|
||||
#define WM_VSCROLL 0x0115
|
||||
|
||||
/* Mouse messages */
|
||||
#define WM_MOUSEMOVE 0x0200
|
||||
#define WM_LBUTTONDOWN 0x0201
|
||||
|
@ -817,6 +924,13 @@ enum { WM_NULL, WM_CREATE, WM_DESTROY, WM_MOVE, WM_UNUSED0, WM_SIZE, WM_ACTIVATE
|
|||
#define WM_MOUSEFIRST WM_MOUSEMOVE
|
||||
#define WM_MOUSELAST WM_MBUTTONDBLCLK
|
||||
|
||||
#define WM_PARENTNOTIFY 0x0210
|
||||
|
||||
/* misc messages */
|
||||
#define WM_NULL 0x0000
|
||||
#define WM_USER 0x0400
|
||||
|
||||
|
||||
/* Key status flags for mouse events */
|
||||
#define MK_LBUTTON 0x0001
|
||||
#define MK_RBUTTON 0x0002
|
||||
|
@ -851,6 +965,30 @@ enum { SW_HIDE, SW_SHOWNORMAL, SW_NORMAL, SW_SHOWMINIMIZED, SW_SHOWMAXIMIZED,
|
|||
#define SIZE_MAXSHOW 3
|
||||
#define SIZE_MAXHIDE 4
|
||||
|
||||
/* SetWindowPos() and WINDOWPOS flags */
|
||||
#define SWP_NOSIZE 0x0001
|
||||
#define SWP_NOMOVE 0x0002
|
||||
#define SWP_NOZORDER 0x0004
|
||||
#define SWP_NOREDRAW 0x0008
|
||||
#define SWP_NOACTIVATE 0x0010
|
||||
#define SWP_FRAMECHANGED 0x0020 /* The frame changed: send WM_NCCALCSIZE */
|
||||
#define SWP_SHOWWINDOW 0x0040
|
||||
#define SWP_HIDEWINDOW 0x0080
|
||||
#define SWP_NOCOPYBITS 0x0100
|
||||
#define SWP_NOOWNERZORDER 0x0200 /* Don't do owner Z ordering */
|
||||
|
||||
#define SWP_DRAWFRAME SWP_FRAMECHANGED
|
||||
#define SWP_NOREPOSITION SWP_NOOWNERZORDER
|
||||
|
||||
#define SWP_NOSENDCHANGING 0x0400
|
||||
#define SWP_DEFERERASE 0x2000
|
||||
|
||||
/* SetWindowPos() hwndInsertAfter field values */
|
||||
#define HWND_TOP ((HWND)0)
|
||||
#define HWND_BOTTOM ((HWND)1)
|
||||
#define HWND_TOPMOST ((HWND)-1)
|
||||
#define HWND_NOTOPMOST ((HWND)-2)
|
||||
|
||||
|
||||
#define MF_INSERT 0
|
||||
#define MF_CHANGE 0x0080
|
||||
|
@ -934,6 +1072,13 @@ enum { SW_HIDE, SW_SHOWNORMAL, SW_NORMAL, SW_SHOWMINIMIZED, SW_SHOWMAXIMIZED,
|
|||
#define WS_CHILDWINDOW (WS_CHILD)
|
||||
#define WS_TILEDWINDOW (WS_OVERLAPPEDWINDOW)
|
||||
|
||||
/* Window extended styles */
|
||||
#define WS_EX_DLGMODALFRAME 0x00000001L
|
||||
#define WS_EX_NOPARENTNOTIFY 0x00000004L
|
||||
#define WS_EX_TOPMOST 0x00000008L
|
||||
#define WS_EX_ACCEPTFILES 0x00000010L
|
||||
#define WS_EX_TRANSPARENT 0x00000020L
|
||||
|
||||
/* Button control styles */
|
||||
#define BS_PUSHBUTTON 0x00000000L
|
||||
#define BS_DEFPUSHBUTTON 0x00000001L
|
||||
|
@ -948,16 +1093,310 @@ enum { SW_HIDE, SW_SHOWNORMAL, SW_NORMAL, SW_SHOWMINIMIZED, SW_SHOWMAXIMIZED,
|
|||
#define BS_OWNERDRAW 0x0000000BL
|
||||
#define BS_LEFTTEXT 0x00000020L
|
||||
|
||||
/* Button control messages */
|
||||
#define BM_GETCHECK (WM_USER+0)
|
||||
#define BM_SETCHECK (WM_USER+1)
|
||||
#define BM_GETSTATE (WM_USER+2)
|
||||
#define BM_SETSTATE (WM_USER+3)
|
||||
#define BM_SETSTYLE (WM_USER+4)
|
||||
|
||||
/* Button notification codes */
|
||||
#define BN_CLICKED 0
|
||||
#define BN_PAINT 1
|
||||
#define BN_HILITE 2
|
||||
#define BN_UNLITE 3
|
||||
#define BN_UNHILITE 3
|
||||
#define BN_DISABLE 4
|
||||
#define BN_DOUBLECLICKED 5
|
||||
|
||||
/* Static Control Styles */
|
||||
#define SS_LEFT 0x00000000L
|
||||
#define SS_CENTER 0x00000001L
|
||||
#define SS_RIGHT 0x00000002L
|
||||
#define SS_ICON 0x00000003L
|
||||
#define SS_BLACKRECT 0x00000004L
|
||||
#define SS_GRAYRECT 0x00000005L
|
||||
#define SS_WHITERECT 0x00000006L
|
||||
#define SS_BLACKFRAME 0x00000007L
|
||||
#define SS_GRAYFRAME 0x00000008L
|
||||
#define SS_WHITEFRAME 0x00000009L
|
||||
#define SS_SIMPLE 0x0000000BL
|
||||
#define SS_LEFTNOWORDWRAP 0x0000000CL
|
||||
#define SS_NOPREFIX 0x00000080L
|
||||
|
||||
/* Static Control Mesages */
|
||||
#define STM_SETICON (WM_USER+0)
|
||||
#define STM_GETICON (WM_USER+1)
|
||||
|
||||
/* WM_H/VSCROLL commands */
|
||||
#define SB_LINEUP 0
|
||||
#define SB_LINELEFT 0
|
||||
#define SB_LINEDOWN 1
|
||||
#define SB_LINERIGHT 1
|
||||
#define SB_PAGEUP 2
|
||||
#define SB_PAGELEFT 2
|
||||
#define SB_PAGEDOWN 3
|
||||
#define SB_PAGERIGHT 3
|
||||
#define SB_THUMBPOSITION 4
|
||||
#define SB_THUMBTRACK 5
|
||||
#define SB_TOP 6
|
||||
#define SB_LEFT 6
|
||||
#define SB_BOTTOM 7
|
||||
#define SB_RIGHT 7
|
||||
#define SB_ENDSCROLL 8
|
||||
|
||||
/* Scroll bar selection constants */
|
||||
#define SB_HORZ 0
|
||||
#define SB_VERT 1
|
||||
#define SB_CTL 2
|
||||
#define SB_BOTH 3
|
||||
|
||||
/* Scrollbar styles */
|
||||
#define SBS_HORZ 0x0000L
|
||||
#define SBS_VERT 0x0001L
|
||||
#define SBS_TOPALIGN 0x0002L
|
||||
#define SBS_LEFTALIGN 0x0002L
|
||||
#define SBS_BOTTOMALIGN 0x0004L
|
||||
#define SBS_RIGHTALIGN 0x0004L
|
||||
#define SBS_SIZEBOXTOPLEFTALIGN 0x0002L
|
||||
#define SBS_SIZEBOXBOTTOMRIGHTALIGN 0x0004L
|
||||
#define SBS_SIZEBOX 0x0008L
|
||||
|
||||
/* EnableScrollBar() flags */
|
||||
#define ESB_ENABLE_BOTH 0x0000
|
||||
#define ESB_DISABLE_BOTH 0x0003
|
||||
|
||||
#define ESB_DISABLE_LEFT 0x0001
|
||||
#define ESB_DISABLE_RIGHT 0x0002
|
||||
|
||||
#define ESB_DISABLE_UP 0x0001
|
||||
#define ESB_DISABLE_DOWN 0x0002
|
||||
|
||||
#define ESB_DISABLE_LTUP ESB_DISABLE_LEFT
|
||||
#define ESB_DISABLE_RTDN ESB_DISABLE_RIGHT
|
||||
|
||||
/* Listbox styles */
|
||||
#define LBS_NOTIFY 0x0001L
|
||||
#define LBS_SORT 0x0002L
|
||||
#define LBS_NOREDRAW 0x0004L
|
||||
#define LBS_MULTIPLESEL 0x0008L
|
||||
#define LBS_OWNERDRAWFIXED 0x0010L
|
||||
#define LBS_OWNERDRAWVARIABLE 0x0020L
|
||||
#define LBS_HASSTRINGS 0x0040L
|
||||
#define LBS_USETABSTOPS 0x0080L
|
||||
#define LBS_NOINTEGRALHEIGHT 0x0100L
|
||||
#define LBS_MULTICOLUMN 0x0200L
|
||||
#define LBS_WANTKEYBOARDINPUT 0x0400L
|
||||
#define LBS_EXTENDEDSEL 0x0800L
|
||||
#define LBS_DISABLENOSCROLL 0x1000L
|
||||
#define LBS_STANDARD (LBS_NOTIFY | LBS_SORT | WS_VSCROLL | WS_BORDER)
|
||||
|
||||
/* Listbox messages */
|
||||
#define LB_ADDSTRING (WM_USER+1)
|
||||
#define LB_INSERTSTRING (WM_USER+2)
|
||||
#define LB_DELETESTRING (WM_USER+3)
|
||||
#define LB_RESETCONTENT (WM_USER+5)
|
||||
#define LB_SETSEL (WM_USER+6)
|
||||
#define LB_SETCURSEL (WM_USER+7)
|
||||
#define LB_GETSEL (WM_USER+8)
|
||||
#define LB_GETCURSEL (WM_USER+9)
|
||||
#define LB_GETTEXT (WM_USER+10)
|
||||
#define LB_GETTEXTLEN (WM_USER+11)
|
||||
#define LB_GETCOUNT (WM_USER+12)
|
||||
#define LB_SELECTSTRING (WM_USER+13)
|
||||
#define LB_DIR (WM_USER+14)
|
||||
#define LB_GETTOPINDEX (WM_USER+15)
|
||||
#define LB_FINDSTRING (WM_USER+16)
|
||||
#define LB_GETSELCOUNT (WM_USER+17)
|
||||
#define LB_GETSELITEMS (WM_USER+18)
|
||||
#define LB_SETTABSTOPS (WM_USER+19)
|
||||
#define LB_GETHORIZONTALEXTENT (WM_USER+20)
|
||||
#define LB_SETHORIZONTALEXTENT (WM_USER+21)
|
||||
#define LB_SETCOLUMNWIDTH (WM_USER+22)
|
||||
#define LB_SETTOPINDEX (WM_USER+24)
|
||||
#define LB_GETITEMRECT (WM_USER+25)
|
||||
#define LB_GETITEMDATA (WM_USER+26)
|
||||
#define LB_SETITEMDATA (WM_USER+27)
|
||||
#define LB_SELITEMRANGE (WM_USER+28)
|
||||
#define LB_SETCARETINDEX (WM_USER+31)
|
||||
#define LB_GETCARETINDEX (WM_USER+32)
|
||||
#define LB_SETITEMHEIGHT (WM_USER+33)
|
||||
#define LB_GETITEMHEIGHT (WM_USER+34)
|
||||
#define LB_FINDSTRINGEXACT (WM_USER+35)
|
||||
|
||||
/* Listbox notification codes */
|
||||
#define LBN_ERRSPACE (-2)
|
||||
#define LBN_SELCHANGE 1
|
||||
#define LBN_DBLCLK 2
|
||||
#define LBN_SELCANCEL 3
|
||||
#define LBN_SETFOCUS 4
|
||||
#define LBN_KILLFOCUS 5
|
||||
|
||||
/* Listbox notification messages */
|
||||
#define WM_VKEYTOITEM 0x002E
|
||||
#define WM_CHARTOITEM 0x002F
|
||||
|
||||
/* Listbox message return values */
|
||||
#define LB_OKAY 0
|
||||
#define LB_ERR (-1)
|
||||
#define LB_ERRSPACE (-2)
|
||||
|
||||
#define LB_CTLCODE 0L
|
||||
|
||||
/* Combo box styles */
|
||||
#define CBS_SIMPLE 0x0001L
|
||||
#define CBS_DROPDOWN 0x0002L
|
||||
#define CBS_DROPDOWNLIST 0x0003L
|
||||
#define CBS_OWNERDRAWFIXED 0x0010L
|
||||
#define CBS_OWNERDRAWVARIABLE 0x0020L
|
||||
#define CBS_AUTOHSCROLL 0x0040L
|
||||
#define CBS_OEMCONVERT 0x0080L
|
||||
#define CBS_SORT 0x0100L
|
||||
#define CBS_HASSTRINGS 0x0200L
|
||||
#define CBS_NOINTEGRALHEIGHT 0x0400L
|
||||
#define CBS_DISABLENOSCROLL 0x0800L
|
||||
|
||||
/* Combo box messages */
|
||||
#define CB_GETEDITSEL (WM_USER+0)
|
||||
#define CB_LIMITTEXT (WM_USER+1)
|
||||
#define CB_SETEDITSEL (WM_USER+2)
|
||||
#define CB_ADDSTRING (WM_USER+3)
|
||||
#define CB_DELETESTRING (WM_USER+4)
|
||||
#define CB_DIR (WM_USER+5)
|
||||
#define CB_GETCOUNT (WM_USER+6)
|
||||
#define CB_GETCURSEL (WM_USER+7)
|
||||
#define CB_GETLBTEXT (WM_USER+8)
|
||||
#define CB_GETLBTEXTLEN (WM_USER+9)
|
||||
#define CB_INSERTSTRING (WM_USER+10)
|
||||
#define CB_RESETCONTENT (WM_USER+11)
|
||||
#define CB_FINDSTRING (WM_USER+12)
|
||||
#define CB_SELECTSTRING (WM_USER+13)
|
||||
#define CB_SETCURSEL (WM_USER+14)
|
||||
#define CB_SHOWDROPDOWN (WM_USER+15)
|
||||
#define CB_GETITEMDATA (WM_USER+16)
|
||||
#define CB_SETITEMDATA (WM_USER+17)
|
||||
#define CB_GETDROPPEDCONTROLRECT (WM_USER+18)
|
||||
#define CB_SETITEMHEIGHT (WM_USER+19)
|
||||
#define CB_GETITEMHEIGHT (WM_USER+20)
|
||||
#define CB_SETEXTENDEDUI (WM_USER+21)
|
||||
#define CB_GETEXTENDEDUI (WM_USER+22)
|
||||
#define CB_GETDROPPEDSTATE (WM_USER+23)
|
||||
#define CB_FINDSTRINGEXACT (WM_USER+24)
|
||||
|
||||
/* Combo box notification codes */
|
||||
#define CBN_ERRSPACE (-1)
|
||||
#define CBN_SELCHANGE 1
|
||||
#define CBN_DBLCLK 2
|
||||
#define CBN_SETFOCUS 3
|
||||
#define CBN_KILLFOCUS 4
|
||||
#define CBN_EDITCHANGE 5
|
||||
#define CBN_EDITUPDATE 6
|
||||
#define CBN_DROPDOWN 7
|
||||
#define CBN_CLOSEUP 8
|
||||
#define CBN_SELENDOK 9
|
||||
#define CBN_SELENDCANCEL 10
|
||||
|
||||
/* Combo box message return values */
|
||||
#define CB_OKAY 0
|
||||
#define CB_ERR (-1)
|
||||
#define CB_ERRSPACE (-2)
|
||||
|
||||
|
||||
/* Owner draw control types */
|
||||
#define ODT_MENU 1
|
||||
#define ODT_LISTBOX 2
|
||||
#define ODT_COMBOBOX 3
|
||||
#define ODT_BUTTON 4
|
||||
|
||||
/* Owner draw actions */
|
||||
#define ODA_DRAWENTIRE 0x0001
|
||||
#define ODA_SELECT 0x0002
|
||||
#define ODA_FOCUS 0x0004
|
||||
|
||||
/* Owner draw state */
|
||||
#define ODS_SELECTED 0x0001
|
||||
#define ODS_GRAYED 0x0002
|
||||
#define ODS_DISABLED 0x0004
|
||||
#define ODS_CHECKED 0x0008
|
||||
#define ODS_FOCUS 0x0010
|
||||
|
||||
#define WM_DRAWITEM 0x002B
|
||||
|
||||
typedef struct tagDRAWITEMSTRUCT
|
||||
{
|
||||
UINT CtlType;
|
||||
UINT CtlID;
|
||||
UINT itemID;
|
||||
UINT itemAction;
|
||||
UINT itemState;
|
||||
HWND hwndItem;
|
||||
HDC hDC;
|
||||
RECT rcItem;
|
||||
DWORD itemData;
|
||||
} DRAWITEMSTRUCT;
|
||||
typedef DRAWITEMSTRUCT NEAR* PDRAWITEMSTRUCT;
|
||||
typedef DRAWITEMSTRUCT FAR* LPDRAWITEMSTRUCT;
|
||||
|
||||
#define WM_MEASUREITEM 0x002C
|
||||
|
||||
typedef struct tagMEASUREITEMSTRUCT
|
||||
{
|
||||
UINT CtlType;
|
||||
UINT CtlID;
|
||||
UINT itemID;
|
||||
UINT itemWidth;
|
||||
UINT itemHeight;
|
||||
DWORD itemData;
|
||||
} MEASUREITEMSTRUCT;
|
||||
typedef MEASUREITEMSTRUCT NEAR* PMEASUREITEMSTRUCT;
|
||||
typedef MEASUREITEMSTRUCT FAR* LPMEASUREITEMSTRUCT;
|
||||
|
||||
#define WM_DELETEITEM 0x002D
|
||||
|
||||
typedef struct tagDELETEITEMSTRUCT
|
||||
{
|
||||
UINT CtlType;
|
||||
UINT CtlID;
|
||||
UINT itemID;
|
||||
HWND hwndItem;
|
||||
DWORD itemData;
|
||||
} DELETEITEMSTRUCT;
|
||||
typedef DELETEITEMSTRUCT NEAR* PDELETEITEMSTRUCT;
|
||||
typedef DELETEITEMSTRUCT FAR* LPDELETEITEMSTRUCT;
|
||||
|
||||
#define WM_COMPAREITEM 0x0039
|
||||
|
||||
typedef struct tagCOMPAREITEMSTRUCT
|
||||
{
|
||||
UINT CtlType;
|
||||
UINT CtlID;
|
||||
HWND hwndItem;
|
||||
UINT itemID1;
|
||||
DWORD itemData1;
|
||||
UINT itemID2;
|
||||
DWORD itemData2;
|
||||
} COMPAREITEMSTRUCT;
|
||||
typedef COMPAREITEMSTRUCT NEAR* PCOMPAREITEMSTRUCT;
|
||||
typedef COMPAREITEMSTRUCT FAR* LPCOMPAREITEMSTRUCT;
|
||||
|
||||
|
||||
#define LMEM_MOVEABLE 0x0002
|
||||
|
||||
#define GMEM_FIXED 0x0000
|
||||
#define GMEM_MOVEABLE 0x0002
|
||||
#define GMEM_NOCOMPACT 0x0010
|
||||
#define GMEM_NODISCARD 0x0020
|
||||
#define GMEM_ZEROINIT 0x0040
|
||||
#define GMEM_MODIFY 0x0080
|
||||
#define GMEM_DISCARDABLE 0x0100
|
||||
#define GMEM_NOT_BANKED 0x1000
|
||||
#define GMEM_SHARE 0x2000
|
||||
#define GMEM_DDESHARE 0x2000
|
||||
#define GMEM_NOTIFY 0x4000
|
||||
#define GMEM_LOWER GMEM_NOT_BANKED
|
||||
|
||||
#define GHND (GMEM_MOVEABLE | GMEM_ZEROINIT)
|
||||
#define GPTR (GMEM_FIXED | GMEM_ZEROINIT)
|
||||
|
||||
#define GMEM_MOVEABLE 0x0002
|
||||
|
||||
#define F(ret,name) ret name(void);
|
||||
#define Fa(ret,name,t1,a1) ret name(t1 a1);
|
||||
|
@ -991,6 +1430,7 @@ F(BOOL,CloseClipboard)
|
|||
F(BOOL,EmptyClipboard)
|
||||
F(BOOL,InSendMessage)
|
||||
F(DWORD,GetCurrentTime)
|
||||
F(DWORD,GetDialogBaseUnits)
|
||||
F(DWORD,GetTickCount)
|
||||
F(HANDLE,GetCurrentTask)
|
||||
F(HMENU,CreatePopupMenu)
|
||||
|
@ -1020,7 +1460,6 @@ F(int,ProfInsChk)
|
|||
F(int,StartSound)
|
||||
F(int,StopSound)
|
||||
F(int,SyncAllVoices)
|
||||
F(long,GetDialogBaseUnits)
|
||||
F(void,CloseSound)
|
||||
F(void,DebugBreak)
|
||||
F(void,DestroyCaret)
|
||||
|
@ -1043,7 +1482,7 @@ Fa(void,PostQuitMessage,int,a)
|
|||
Fa(BOOL,SetMessageQueue,int,a)
|
||||
Fa(int,_lclose,int,a)
|
||||
Fb(int,_lopen,LPSTR,a,int,b)
|
||||
Fa(int,lstrlen,LPSTR,a)
|
||||
Fa(int,lstrlen,LPCSTR,a)
|
||||
Fa(LONG,DispatchMessage,LPMSG,msg)
|
||||
Fa(void,UpdateWindow,HWND,a)
|
||||
Fa(ATOM,AddAtom,LPSTR,a)
|
||||
|
@ -1230,11 +1669,11 @@ Fb(BOOL,ExitWindows,DWORD,dwReserved,WORD,wReturnCode)
|
|||
Fb(BOOL,GetBitmapDimensionEx,HBITMAP,a,LPSIZE,b)
|
||||
Fb(BOOL,ShowWindow,HWND,a,int,b)
|
||||
Fb(HDC,BeginPaint,HWND,a,LPPAINTSTRUCT,b)
|
||||
Fb(LPSTR,lstrcat,LPSTR,a,LPSTR,b )
|
||||
Fb(LPSTR,lstrcpy,LPSTR,a,LPSTR,b )
|
||||
Fb(LPSTR,lstrcat,LPSTR,a,LPCSTR,b )
|
||||
Fb(LPSTR,lstrcpy,LPSTR,a,LPCSTR,b )
|
||||
Fb(int,_lcreat,LPSTR,a,int,b)
|
||||
Fb(int,lstrcmp,LPSTR,a,LPSTR,b )
|
||||
Fb(int,lstrcmpi,LPSTR,a,LPSTR,b )
|
||||
Fb(int,lstrcmp,LPCSTR,a,LPCSTR,b )
|
||||
Fb(int,lstrcmpi,LPCSTR,a,LPCSTR,b )
|
||||
Fb(void,EndPaint,HWND,a,LPPAINTSTRUCT,b)
|
||||
Fb(void,GetClientRect,HWND,a,LPRECT,b)
|
||||
Fb(void,SetDCState,HDC,a,HDC,b)
|
||||
|
@ -1291,7 +1730,7 @@ Fb(HMENU,GetSystemMenu,HWND,a,BOOL,b)
|
|||
Fb(HMENU,LoadMenu,HANDLE,a,LPSTR,b)
|
||||
Fb(HWND,ChildWindowFromPoint,HWND,a,POINT,b)
|
||||
Fb(HWND,FindWindow,LPSTR,a,LPSTR,b)
|
||||
Fb(HWND,GetDlgItem,HWND,a,int,b)
|
||||
Fb(HWND,GetDlgItem,HWND,a,WORD,b)
|
||||
Fb(HWND,GetNextWindow,HWND,a,WORD,b)
|
||||
Fb(HWND,GetWindow,HWND,a,WORD,b)
|
||||
Fb(BOOL,GetCurrentPositionEx,HDC,a,LPPOINT,b)
|
||||
|
@ -1315,7 +1754,7 @@ Fb(WORD,GetSystemDirectory,LPSTR,a,WORD,b)
|
|||
Fb(WORD,GetSystemPaletteUse,HDC,a,WORD,b)
|
||||
Fb(WORD,GetWindowWord,HWND,a,short,b)
|
||||
Fb(WORD,GetWindowsDirectory,LPSTR,a,WORD,b)
|
||||
Fb(WORD,IsDlgButtonChecked,HWND,a,int,b)
|
||||
Fb(WORD,IsDlgButtonChecked,HWND,a,WORD,b)
|
||||
Fb(WORD,LocalShrink,HANDLE,a,WORD,b)
|
||||
Fb(WORD,MapVirtualKey,WORD,a,WORD,b)
|
||||
Fb(WORD,SetSystemPaletteUse,HDC,a,WORD,b)
|
||||
|
@ -1349,7 +1788,7 @@ Fb(int,UngetCommChar,int,a,char,b)
|
|||
Fb(short,SetTextCharacterExtra,HDC,a,short,b)
|
||||
Fb(void,ClientToScreen,HWND,a,LPPOINT,b)
|
||||
Fb(void,DrawFocusRect,HDC,a,LPRECT,b)
|
||||
Fb(void,EndDialog,HWND,a,int,b)
|
||||
Fb(void,EndDialog,HWND,a,short,b)
|
||||
Fb(void,GetCodeInfo,FARPROC,lpProc,LPVOID,lpSegInfo)
|
||||
Fb(void,GetWindowRect,HWND,a,LPRECT,b)
|
||||
Fb(void,InvertRect,HDC,a,LPRECT,b)
|
||||
|
@ -1457,13 +1896,13 @@ Fc(int,wvsprintf,LPSTR,a,LPSTR,b,LPSTR,c)
|
|||
Fc(short,SetTextJustification,HDC,a,short,b,short,c)
|
||||
Fc(void,AdjustWindowRect,LPRECT,a,DWORD,b,BOOL,c)
|
||||
Fc(void,AnsiToOemBuff,LPSTR,a,LPSTR,b,int,c)
|
||||
Fc(void,CheckDlgButton,HWND,a,int,b,WORD,c)
|
||||
Fc(void,CheckDlgButton,HWND,a,WORD,b,WORD,c)
|
||||
Fc(void,InflateRect,LPRECT,a,short,b,short,c)
|
||||
Fc(void,InvalidateRect,HWND,a,LPRECT,b,BOOL,c)
|
||||
Fc(void,InvalidateRgn,HWND,a,HRGN,b,BOOL,c)
|
||||
Fc(void,OemToAnsiBuff,LPSTR,a,LPSTR,b,int,c)
|
||||
Fc(void,OffsetRect,LPRECT,a,short,b,short,c)
|
||||
Fc(void,SetDlgItemText,HWND,a,int,b,LPSTR,c)
|
||||
Fc(void,SetDlgItemText,HWND,a,WORD,b,LPSTR,c)
|
||||
Fc(void,SetSysColors,int,a,LPINT,b,COLORREF*,c)
|
||||
Fc(void,ShowScrollBar,HWND,a,WORD,b,BOOL,c)
|
||||
Fc(void,SwitchStackTo,WORD,a,WORD,b,WORD,c)
|
||||
|
@ -1490,12 +1929,12 @@ Fd(HDC,CreateIC,LPSTR,a,LPSTR,b,LPSTR,c,LPSTR,d)
|
|||
Fd(HRGN,CreateEllipticRgn,short,a,short,b,short,c,short,d)
|
||||
Fd(HRGN,CreatePolyPolygonRgn,LPPOINT,a,LPINT,b,short,c,short,d)
|
||||
Fd(HRGN,CreateRectRgn,short,a,short,b,short,c,short,d)
|
||||
Fd(HWND,CreateDialog,HANDLE,a,LPSTR,b,HWND,c,FARPROC,d)
|
||||
Fd(HWND,CreateDialogIndirect,HANDLE,a,LPSTR,b,HWND,c,FARPROC,d)
|
||||
Fd(HWND,CreateDialog,HANDLE,a,LPCSTR,b,HWND,c,FARPROC,d)
|
||||
Fd(HWND,CreateDialogIndirect,HANDLE,a,LPCSTR,b,HWND,c,FARPROC,d)
|
||||
Fd(LONG,DefDlgProc,HWND,a,WORD,b,WORD,c,LONG,d)
|
||||
Fd(LONG,DefMDIChildProc,HWND,a,WORD,b,WORD,c,LONG,d)
|
||||
Fd(LONG,DefWindowProc,HWND,a,WORD,b,WORD,c,LONG,d)
|
||||
Fd(WORD,GetDlgItemInt,HWND,a,int,b,BOOL FAR*,c,BOOL,d)
|
||||
Fd(WORD,GetDlgItemInt,HWND,a,WORD,b,BOOL FAR*,c,BOOL,d)
|
||||
Fd(WORD,GetPaletteEntries,HPALETTE,a,WORD,b,WORD,c,LPPALETTEENTRY,d)
|
||||
Fd(WORD,GetPrivateProfileInt,LPSTR,a,LPSTR,b,short,c,LPSTR,d)
|
||||
Fd(WORD,GetSystemPaletteEntries,HDC,a,WORD,b,WORD,c,LPPALETTEENTRY,d)
|
||||
|
@ -1508,11 +1947,11 @@ Fd(BOOL,SetWindowOrgEx,HDC,a,short,b,short,c,LPPOINT,d)
|
|||
Fd(BOOL,OffsetViewportOrgEx,HDC,a,short,b,short,c,LPPOINT,d)
|
||||
Fd(BOOL,OffsetWindowOrgEx,HDC,a,short,b,short,c,LPPOINT,d)
|
||||
Fd(int,CombineRgn,HRGN,a,HRGN,b,HRGN,c,short,d)
|
||||
Fd(int,DialogBox,HANDLE,a,LPSTR,b,HWND,c,FARPROC,d)
|
||||
Fd(int,DialogBox,HINSTANCE,a,LPCSTR,b,HWND,c,FARPROC,d)
|
||||
Fd(int,DialogBoxIndirect,HANDLE,a,HANDLE,b,HWND,c,FARPROC,d)
|
||||
Fd(int,EnumFonts,HDC,a,LPSTR,b,FARPROC,c,LPSTR,d)
|
||||
Fd(int,EnumObjects,HDC,a,int,b,FARPROC,c,LPSTR,d)
|
||||
Fd(int,GetDlgItemText,HWND,a,int,b,LPSTR,c,int,d)
|
||||
Fd(int,GetDlgItemText,HWND,a,WORD,b,LPSTR,c,WORD,d)
|
||||
Fd(int,GetTempFileName,BYTE,a,LPSTR,b,WORD,c,LPSTR,d)
|
||||
Fd(int,LoadString,HANDLE,a,WORD,b,LPSTR,c,int,d)
|
||||
Fd(int,MessageBox,HWND,a,LPSTR,b,LPSTR,c,WORD,d)
|
||||
|
@ -1520,12 +1959,12 @@ Fd(int,SetScrollPos,HWND,a,int,b,int,c,BOOL,d)
|
|||
Fd(int,SetVoiceNote,int,a,int,b,int,c,int,d)
|
||||
Fd(void,AdjustWindowRectEx,LPRECT,a,LONG,b,BOOL,c,DWORD,d)
|
||||
Fd(void,AnimatePalette,HPALETTE,a,WORD,b,WORD,c,LPPALETTEENTRY,d)
|
||||
Fd(void,CheckRadioButton,HWND,a,int,b,int,c,int,d)
|
||||
Fd(void,CheckRadioButton,HWND,a,WORD,b,WORD,c,WORD,d)
|
||||
Fd(void,CreateCaret,HWND,a,HBITMAP,b,int,c,int,d)
|
||||
Fd(void,FillWindow,HWND,a,HWND,b,HDC,c,HBRUSH,d)
|
||||
Fd(void,GetScrollRange,HWND,a,int,b,LPINT,c,LPINT,d)
|
||||
Fd(void,PlayMetaFileRecord,HDC,a,LPHANDLETABLE,b,LPMETARECORD,c,WORD,d)
|
||||
Fd(void,SetDlgItemInt,HWND,a,int,b,WORD,c,BOOL,d)
|
||||
Fd(void,SetDlgItemInt,HWND,a,WORD,b,WORD,c,BOOL,d)
|
||||
Fe(BOOL,Rectangle,HDC,a,int,xLeft,int,yTop,int,xRight,int,yBottom)
|
||||
Fe(int,DrawText,HDC,a,LPSTR,str,int,c,LPRECT,d,WORD,flag)
|
||||
Fe(BOOL,PeekMessage,LPMSG,a,HWND,b,WORD,c,WORD,d,WORD,e)
|
||||
|
@ -1542,10 +1981,10 @@ Fe(DWORD,GetTabbedTextExtent,HDC,a,LPSTR,b,int,c,int,d,LPINT,e)
|
|||
Fe(DWORD,ScaleViewportExt,HDC,a,short,b,short,c,short,d,short,e)
|
||||
Fe(DWORD,ScaleWindowExt,HDC,a,short,b,short,c,short,d,short,e)
|
||||
Fe(HBITMAP,CreateBitmap,short,a,short,b,BYTE,c,BYTE,d,LPSTR,e)
|
||||
Fe(HWND,CreateDialogIndirectParam,HANDLE,a,LPSTR,b,HWND,c,FARPROC,d,LONG,e)
|
||||
Fe(HWND,CreateDialogParam,HANDLE,a,LPSTR,b,HWND,c,FARPROC,d,LONG,e)
|
||||
Fe(HWND,CreateDialogIndirectParam,HANDLE,a,LPCSTR,b,HWND,c,FARPROC,d,LPARAM,e)
|
||||
Fe(HWND,CreateDialogParam,HANDLE,a,LPCSTR,b,HWND,c,FARPROC,d,LPARAM,e)
|
||||
Fe(LONG,DefFrameProc,HWND,a,HWND,b,WORD,c,WORD,d,LONG,e)
|
||||
Fe(LONG,SendDlgItemMessage,HWND,a,int,b,WORD,c,WORD,d,LONG,e)
|
||||
Fe(LONG,SendDlgItemMessage,HWND,a,WORD,b,WORD,c,WORD,d,LONG,e)
|
||||
Fe(int,DialogBoxIndirectParam,HANDLE,a,HANDLE,b,HWND,c,FARPROC,d,LONG,e)
|
||||
Fe(int,DialogBoxParam,HANDLE,a,LPSTR,b,HWND,c,FARPROC,d,LONG,e)
|
||||
Fe(int,DlgDirList,HWND,a,LPSTR,b,int,c,int,d,WORD,e)
|
||||
|
@ -1579,7 +2018,7 @@ Fg(HCURSOR,CreateCursor,HANDLE,a,int,b,int,c,int,d,int,e,LPSTR,f,LPSTR,g)
|
|||
Fg(HICON,CreateIcon,HANDLE,a,int,b,int,c,BYTE,d,BYTE,e,LPSTR,f,LPSTR,g)
|
||||
Fg(int,GetDIBits,HDC,a,HANDLE,a2,WORD,b,WORD,c,LPSTR,d,LPBITMAPINFO,e,WORD,f)
|
||||
Fg(int,SetDIBits,HDC,a,HANDLE,a2,WORD,b,WORD,c,LPSTR,d,LPBITMAPINFO,e,WORD,f)
|
||||
Fg(void,SetWindowPos,HWND,a,HWND,b,int,c,int,d,int,e,int,f,WORD,g)
|
||||
Fg(void,SetWindowPos,HWND,a,HWND,b,short,c,short,d,short,e,short,f,WORD,g)
|
||||
Fh(BOOL,ExtTextOut,HDC,a,int,b,int,c,WORD,d,LPRECT,e,LPSTR,f,WORD,g,LPINT,h)
|
||||
Fh(HANDLE,DeferWindowPos,HANDLE,hWinPosInfo,HWND,hWnd,HWND,hWndInsertAfter,int,x,int,y,int,cx,int,cy,WORD,wFlags)
|
||||
Fh(LONG,TabbedTextOut,HDC,a,int,b,int,c,LPSTR,d,int,e,int,f,LPINT,g,int,h)
|
||||
|
|
|
@ -22,5 +22,40 @@ extern struct w_files * wine_files;
|
|||
|
||||
extern char *GetFilenameFromInstance(unsigned short instance);
|
||||
extern struct w_files *GetFileInfo(unsigned short instance);
|
||||
|
||||
extern char *FindFileInPath(char *buffer, int buflen, char *rootname,
|
||||
char **extensions, char *path);
|
||||
extern char *GetSystemIniFilename(void);
|
||||
#ifdef linux
|
||||
struct sigcontext_struct {
|
||||
unsigned short sc_gs, __gsh;
|
||||
unsigned short sc_fs, __fsh;
|
||||
unsigned short sc_es, __esh;
|
||||
unsigned short sc_ds, __dsh;
|
||||
unsigned long sc_edi;
|
||||
unsigned long sc_esi;
|
||||
unsigned long sc_ebp;
|
||||
unsigned long sc_esp;
|
||||
unsigned long sc_ebx;
|
||||
unsigned long sc_edx;
|
||||
unsigned long sc_ecx;
|
||||
unsigned long sc_eax;
|
||||
unsigned long sc_trapno;
|
||||
unsigned long sc_err;
|
||||
unsigned long sc_eip;
|
||||
unsigned short sc_cs, __csh;
|
||||
unsigned long sc_efl;
|
||||
unsigned long esp_at_signal;
|
||||
unsigned short sc_ss, __ssh;
|
||||
unsigned long i387;
|
||||
unsigned long oldmask;
|
||||
unsigned long cr2;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef __NetBSD__
|
||||
#include <signal.h>
|
||||
#define sigcontext_struct sigcontext
|
||||
#define HZ 100
|
||||
#endif
|
||||
|
||||
#endif /* WINE_H */
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
|
||||
CFLAGS=$(COPTS) $(DEBUGOPTS) -I../include
|
||||
|
||||
OBJS=dump.o ldt.o ldtlib.o resource.o selector.o signal.o wine.o
|
||||
OBJS=dump.o files.o ldt.o ldtlib.o resource.o selector.o signal.o int1a.o \
|
||||
int21.o wine.o
|
||||
|
||||
default: loader.o
|
||||
|
||||
|
@ -8,7 +9,7 @@ loader.o: $(OBJS)
|
|||
$(LD) -r -o loader.o $(OBJS)
|
||||
|
||||
clean:
|
||||
rm -f *.o *~ *.s dll_* *.a
|
||||
rm -f *.o *~ *.s dll_* *.a *#
|
||||
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
|
|
@ -0,0 +1,108 @@
|
|||
static char RCSId[] = "$Id: wine.c,v 1.2 1993/07/04 04:04:21 root Exp root $";
|
||||
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
|
||||
/**********************************************************************
|
||||
* FindFileInPath
|
||||
*/
|
||||
char *
|
||||
FindFileInPath(char *buffer, int buflen, char *rootname,
|
||||
char **extensions, char *path)
|
||||
{
|
||||
char *workingpath;
|
||||
char *dirname;
|
||||
DIR *d;
|
||||
struct dirent *f;
|
||||
char **e;
|
||||
int rootnamelen;
|
||||
int found = 0;
|
||||
|
||||
if (strchr(rootname, '/') != NULL)
|
||||
{
|
||||
strncpy(buffer, rootname, buflen);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
rootnamelen = strlen(rootname);
|
||||
workingpath = malloc(strlen(path) + 1);
|
||||
if (workingpath == NULL)
|
||||
return NULL;
|
||||
strcpy(workingpath, path);
|
||||
|
||||
for(dirname = strtok(workingpath, ":;");
|
||||
dirname != NULL;
|
||||
dirname = strtok(NULL, ":;"))
|
||||
{
|
||||
d = opendir(dirname);
|
||||
if (d != NULL)
|
||||
{
|
||||
while ((f = readdir(d)) != NULL)
|
||||
{
|
||||
if (strncasecmp(rootname, f->d_name, rootnamelen) == 0)
|
||||
{
|
||||
if (extensions == NULL ||
|
||||
strcasecmp(rootname, f->d_name) == 0)
|
||||
{
|
||||
found = 1;
|
||||
}
|
||||
else if (f->d_name[rootnamelen] == '.')
|
||||
{
|
||||
for (e = extensions; *e != NULL; e++)
|
||||
{
|
||||
if (strcasecmp(*e, f->d_name + rootnamelen + 1)
|
||||
== 0)
|
||||
{
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (found)
|
||||
{
|
||||
strncpy(buffer, dirname, buflen);
|
||||
strncat(buffer, "/", buflen - strlen(buffer));
|
||||
strncat(buffer, f->d_name, buflen - strlen(buffer));
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(d);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* GetSystemIniFilename
|
||||
*/
|
||||
char *
|
||||
GetSystemIniFilename()
|
||||
{
|
||||
static char *IniName = NULL;
|
||||
char inipath[256];
|
||||
|
||||
if (IniName)
|
||||
return IniName;
|
||||
|
||||
getcwd(inipath, 256);
|
||||
strcat(inipath, ":");
|
||||
strcat(inipath, getenv("HOME"));
|
||||
strcat(inipath, ":");
|
||||
strcat(inipath, getenv("WINEPATH"));
|
||||
|
||||
IniName = malloc(1024);
|
||||
if (FindFileInPath(IniName, 1024, "wine.ini", NULL, inipath) == NULL)
|
||||
{
|
||||
free(IniName);
|
||||
IniName = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
IniName = realloc(IniName, strlen(IniName) + 1);
|
||||
return IniName;
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include "wine.h"
|
||||
|
||||
#ifdef linux
|
||||
#include <linux/sched.h> /* needed for HZ */
|
||||
#endif
|
||||
|
||||
#define BCD_TO_BIN(x) ((x&15) + (x>>4)*10)
|
||||
#define BIN_TO_BCD(x) ((x%10) + ((x/10)<<4))
|
||||
|
||||
int do_int1A(struct sigcontext_struct * context){
|
||||
time_t ltime;
|
||||
struct tm *bdtime;
|
||||
int ticks;
|
||||
|
||||
switch((context->sc_eax >> 8) & 0xff){
|
||||
case 0:
|
||||
ltime = time(NULL);
|
||||
ticks = (int) (ltime * HZ);
|
||||
context->sc_ecx = ticks >> 16;
|
||||
context->sc_edx = ticks & 0x0000FFFF;
|
||||
context->sc_eax = 0; /* No midnight rollover */
|
||||
break;
|
||||
|
||||
case 2:
|
||||
ltime = time(NULL);
|
||||
bdtime = localtime(<ime);
|
||||
|
||||
context->sc_ecx = (BIN_TO_BCD(bdtime->tm_hour)<<8) | BIN_TO_BCD(bdtime->tm_min);
|
||||
context->sc_edx = (BIN_TO_BCD(bdtime->tm_sec)<<8);
|
||||
|
||||
case 4:
|
||||
ltime = time(NULL);
|
||||
bdtime = localtime(<ime);
|
||||
context->sc_ecx = (BIN_TO_BCD(bdtime->tm_year/100)<<8) | BIN_TO_BCD((bdtime->tm_year-1900)%100);
|
||||
context->sc_edx = (BIN_TO_BCD(bdtime->tm_mon)<<8) | BIN_TO_BCD(bdtime->tm_mday);
|
||||
break;
|
||||
|
||||
/* setting the time,date or RTC is not allow -EB */
|
||||
case 1:
|
||||
/* set system time */
|
||||
case 3:
|
||||
/* set RTC time */
|
||||
case 5:
|
||||
/* set RTC date */
|
||||
case 6:
|
||||
/* set ALARM */
|
||||
case 7:
|
||||
/* cancel ALARM */
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr,"Unable to handle int 0x1A AX %x\n", context->sc_eax);
|
||||
return 1;
|
||||
};
|
||||
return 1;
|
||||
}
|
|
@ -20,7 +20,6 @@ extern int i386_set_ldt(int, union descriptor *, int);
|
|||
struct segment_descriptor *
|
||||
make_sd(unsigned base, unsigned limit, int contents, int read_exec_only, int seg32, int inpgs)
|
||||
{
|
||||
#if 1
|
||||
static long d[2];
|
||||
|
||||
d[0] = ((base & 0x0000ffff) << 16) |
|
||||
|
@ -34,24 +33,7 @@ make_sd(unsigned base, unsigned limit, int contents, int read_exec_only, int seg
|
|||
(inpgs << 23) |
|
||||
0xf000;
|
||||
|
||||
printf("%x %x\n", d[1], d[0]);
|
||||
|
||||
return ((struct segment_descriptor *)d);
|
||||
#else
|
||||
static struct segment_descriptor d;
|
||||
|
||||
d.sd_lolimit = limit & 0x0000ffff;
|
||||
d.sd_lobase = base & 0x00ffffff;
|
||||
d.sd_type = contents & 0x01f;
|
||||
d.sd_dpl = SEL_UPL & 0x3;
|
||||
d.sd_p = 1;
|
||||
d.sd_hilimit = (limit & 0x00ff0000) >> 16;
|
||||
d.sd_xx = 0;
|
||||
d.sd_def32 = seg32?1:0;
|
||||
d.sd_gran = inpgs?1:0;
|
||||
d.sd_hibase = (base & 0xff000000) >> 24;
|
||||
return ((struct segment_descriptor *)&d);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -88,7 +70,7 @@ set_ldt_entry(int entry, unsigned long base, unsigned int limit,
|
|||
struct segment_descriptor *sd;
|
||||
int ret;
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG_LDT
|
||||
printf("set_ldt_entry: entry=%x base=%x limit=%x%s %s-bit contents=%d %s\n",
|
||||
entry, base, limit, limit_in_pages_flag?"-pages":"",
|
||||
seg_32bit_flag?"32":"16",
|
||||
|
|
|
@ -211,6 +211,7 @@ FindResourceByName(struct resource_nameinfo_s *result_p,
|
|||
if (read(ResourceFd, &size_shift, sizeof(size_shift)) !=
|
||||
sizeof(size_shift))
|
||||
{
|
||||
printf("FindResourceByName (%s) bad block size !\n", resource_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -223,6 +224,7 @@ FindResourceByName(struct resource_nameinfo_s *result_p,
|
|||
if (read(ResourceFd, &typeinfo, sizeof(typeinfo)) !=
|
||||
sizeof(typeinfo))
|
||||
{
|
||||
printf("FindResourceByName (%s) bad typeinfo size !\n", resource_name);
|
||||
return -1;
|
||||
}
|
||||
if (typeinfo.type_id == type_id || type_id == -1)
|
||||
|
@ -232,6 +234,7 @@ FindResourceByName(struct resource_nameinfo_s *result_p,
|
|||
if (read(ResourceFd, &nameinfo, sizeof(nameinfo)) !=
|
||||
sizeof(nameinfo))
|
||||
{
|
||||
printf("FindResourceByName (%s) bad nameinfo size !\n", resource_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -245,7 +248,6 @@ FindResourceByName(struct resource_nameinfo_s *result_p,
|
|||
read(ResourceFd, name, nbytes);
|
||||
lseek(ResourceFd, old_pos, SEEK_SET);
|
||||
name[nbytes] = '\0';
|
||||
|
||||
if (strcasecmp(name, resource_name) == 0)
|
||||
{
|
||||
memcpy(result_p, &nameinfo, sizeof(nameinfo));
|
||||
|
@ -254,6 +256,7 @@ FindResourceByName(struct resource_nameinfo_s *result_p,
|
|||
}
|
||||
}
|
||||
}
|
||||
printf("FindResourceByName (%s) typeinfo.type_id = 0 !\n", resource_name);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -373,7 +376,6 @@ RSC_LoadResource(int instance, char *rsc_name, int type, int *image_size_ret)
|
|||
image_size = nameinfo.length << size_shift;
|
||||
if (image_size_ret != NULL)
|
||||
*image_size_ret = image_size;
|
||||
|
||||
hmem = GlobalAlloc(GMEM_MOVEABLE, image_size);
|
||||
image = GlobalLock(hmem);
|
||||
if (image == NULL || read(ResourceFd, image, image_size) != image_size)
|
||||
|
@ -443,6 +445,7 @@ LoadBitmap(HANDLE instance, LPSTR bmp_name)
|
|||
{
|
||||
HBITMAP hbitmap;
|
||||
HANDLE rsc_mem;
|
||||
GDIOBJHDR * ptr;
|
||||
HDC hdc;
|
||||
long *lp;
|
||||
int image_size;
|
||||
|
@ -462,7 +465,6 @@ LoadBitmap(HANDLE instance, LPSTR bmp_name)
|
|||
GlobalFree(rsc_mem);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (*lp == sizeof(BITMAPCOREHEADER))
|
||||
hbitmap = ConvertCoreBitmap( hdc, (BITMAPCOREHEADER *) lp );
|
||||
else if (*lp == sizeof(BITMAPINFOHEADER))
|
||||
|
|
130
loader/signal.c
|
@ -10,6 +10,7 @@
|
|||
#include <linux/sched.h>
|
||||
#include <asm/system.h>
|
||||
#endif
|
||||
#include <wine.h>
|
||||
|
||||
char * cstack[4096];
|
||||
struct sigaction segv_act;
|
||||
|
@ -17,6 +18,7 @@ struct sigaction segv_act;
|
|||
#ifdef linux
|
||||
extern void ___sig_restore();
|
||||
extern void ___masksig_restore();
|
||||
#endif
|
||||
|
||||
/* Similar to the sigaction function in libc, except it leaves alone the
|
||||
restorer field */
|
||||
|
@ -32,123 +34,6 @@ wine_sigaction(int sig,struct sigaction * new, struct sigaction * old)
|
|||
return -1;
|
||||
}
|
||||
|
||||
struct sigcontext_struct {
|
||||
unsigned short sc_gs, __gsh;
|
||||
unsigned short sc_fs, __fsh;
|
||||
unsigned short sc_es, __esh;
|
||||
unsigned short sc_ds, __dsh;
|
||||
unsigned long sc_edi;
|
||||
unsigned long sc_esi;
|
||||
unsigned long sc_ebp;
|
||||
unsigned long sc_esp;
|
||||
unsigned long sc_ebx;
|
||||
unsigned long sc_edx;
|
||||
unsigned long sc_ecx;
|
||||
unsigned long sc_eax;
|
||||
unsigned long sc_trapno;
|
||||
unsigned long sc_err;
|
||||
unsigned long sc_eip;
|
||||
unsigned short sc_cs, __csh;
|
||||
unsigned long sc_eflags;
|
||||
unsigned long esp_at_signal;
|
||||
unsigned short sc_ss, __ssh;
|
||||
unsigned long i387;
|
||||
unsigned long oldmask;
|
||||
unsigned long cr2;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef __NetBSD__
|
||||
#define sigcontext_struct sigcontext
|
||||
#define HZ 100
|
||||
#endif
|
||||
|
||||
static void
|
||||
GetTimeDate(int time_flag, struct sigcontext_struct * context)
|
||||
{
|
||||
struct tm *now;
|
||||
time_t ltime;
|
||||
|
||||
ltime = time(NULL);
|
||||
now = localtime(<ime);
|
||||
if (time_flag)
|
||||
{
|
||||
context->sc_ecx = (now->tm_hour << 8) | now->tm_min;
|
||||
context->sc_edx = now->tm_sec << 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
context->sc_ecx = now->tm_year + 1900;
|
||||
context->sc_edx = ((now->tm_mon + 1) << 8) | now->tm_mday;
|
||||
context->sc_eax &= 0xff00;
|
||||
context->sc_eax |= now->tm_wday;
|
||||
}
|
||||
}
|
||||
|
||||
/* We handle all int21 calls here. There is some duplicate code from
|
||||
misc/dos.c that I am unsure how to deal with, since the locations
|
||||
that we store the registers are all different */
|
||||
|
||||
static int
|
||||
do_int21(struct sigcontext_struct * context){
|
||||
fprintf(stderr,"Doing int21 %x ", (context->sc_eax >> 8) & 0xff);
|
||||
switch((context->sc_eax >> 8) & 0xff){
|
||||
case 0x30:
|
||||
context->sc_eax = 0x0303; /* Hey folks, this is DOS V3.3! */
|
||||
context->sc_ebx = 0;
|
||||
context->sc_ecx = 0;
|
||||
break;
|
||||
|
||||
/* Ignore any attempt to set a segment vector */
|
||||
case 0x25:
|
||||
return 1;
|
||||
|
||||
case 0x35: /* Return a NULL segment selector - this will bomb
|
||||
if anyone ever tries to use it */
|
||||
context->sc_es = 0;
|
||||
context->sc_ebx = 0;
|
||||
break;
|
||||
|
||||
case 0x2a:
|
||||
GetTimeDate(0, context);
|
||||
/* Function does not return */
|
||||
|
||||
case 0x2c:
|
||||
GetTimeDate(1, context);
|
||||
/* Function does not return */
|
||||
|
||||
case 0x4c:
|
||||
exit(context->sc_eax & 0xff);
|
||||
|
||||
|
||||
default:
|
||||
fprintf(stderr,"Unable to handle int 0x21 %x\n", context->sc_eax);
|
||||
return 1;
|
||||
};
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
do_int1A(struct sigcontext_struct * context){
|
||||
time_t ltime;
|
||||
int ticks;
|
||||
|
||||
switch((context->sc_eax >> 8) & 0xff){
|
||||
case 0:
|
||||
ltime = time(NULL);
|
||||
ticks = (int) (ltime * HZ);
|
||||
context->sc_ecx = ticks >> 16;
|
||||
context->sc_edx = ticks & 0x0000FFFF;
|
||||
context->sc_eax = 0; /* No midnight rollover */
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr,"Unable to handle int 0x1A %x\n", context->sc_eax);
|
||||
return 1;
|
||||
};
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef linux
|
||||
static void win_fault(int signal, struct sigcontext_struct context){
|
||||
struct sigcontext_struct *scp = &context;
|
||||
|
@ -198,6 +83,12 @@ static void win_fault(int signal, int code, struct sigcontext *scp){
|
|||
case 0x21:
|
||||
if(!do_int21(scp)) goto oops;
|
||||
break;
|
||||
case 0x11:
|
||||
scp->sc_eax = 0x00000000; /* get equipment list: we haven't */
|
||||
break; /* got anything */
|
||||
case 0x12:
|
||||
scp->sc_eax = 640L; /* get base mem size */
|
||||
break;
|
||||
case 0x1A:
|
||||
if(!do_int1A(scp)) goto oops;
|
||||
break;
|
||||
|
@ -210,7 +101,6 @@ static void win_fault(int signal, int code, struct sigcontext *scp){
|
|||
|
||||
scp->sc_eip += 2; /* Bypass the int instruction */
|
||||
return;
|
||||
|
||||
oops:
|
||||
fprintf(stderr,"In win_fault %x:%x\n", scp->sc_cs, scp->sc_eip);
|
||||
#ifdef linux
|
||||
|
@ -236,14 +126,14 @@ init_wine_signals(){
|
|||
/* Point to the top of the stack, minus 4 just in case, and make
|
||||
it aligned */
|
||||
segv_act.sa_restorer =
|
||||
(void (*)()) (((unsigned int)(cstack + sizeof(cstack) - 4)) & ~3);
|
||||
(void (*)()) (((unsigned int)(cstack) + sizeof(cstack) - 4) & ~3);
|
||||
wine_sigaction(SIGSEGV, &segv_act, NULL);
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
struct sigstack ss;
|
||||
sigset_t sig_mask;
|
||||
|
||||
ss.ss_sp = (char *) (((unsigned int)(cstack + sizeof(cstack) - 4)) & ~3);
|
||||
ss.ss_sp = (char *) (((unsigned int)(cstack) + sizeof(cstack) - 4) & ~3);
|
||||
ss.ss_onstack = 0;
|
||||
if (sigstack(&ss, NULL) < 0) {
|
||||
perror("sigstack");
|
||||
|
|
|
@ -39,6 +39,10 @@ struct mz_header_s *CurrentMZHeader;
|
|||
struct ne_header_s *CurrentNEHeader;
|
||||
int CurrentNEFile;
|
||||
|
||||
static char *dllExtensions[] = { "dll", "exe", NULL };
|
||||
static char *exeExtensions[] = { "exe", NULL };
|
||||
static char *WinePath = NULL;
|
||||
|
||||
/**********************************************************************
|
||||
* DebugPrintString
|
||||
*/
|
||||
|
@ -215,39 +219,23 @@ LoadImage(char * filename, char * modulename)
|
|||
*/
|
||||
for(i=0; i<wpnt->ne_header->n_mod_ref_tab; i++){
|
||||
char buff[14];
|
||||
char buff2[14];
|
||||
char buff2[256];
|
||||
int fd, j;
|
||||
GetModuleName(wpnt, i + 1, buff);
|
||||
|
||||
if(FindDLLTable(buff)) continue; /* This module already loaded */
|
||||
|
||||
/* The next trick is to convert the case, and add the .dll
|
||||
* extension if required to find the actual library. We may want
|
||||
* to use a search path at some point as well. */
|
||||
|
||||
/* First try the straight name */
|
||||
strcpy(buff2, buff);
|
||||
if(fd = open(buff2, O_RDONLY) >= 0) {
|
||||
close(fd);
|
||||
LoadImage(buff2, buff);
|
||||
continue;
|
||||
};
|
||||
|
||||
/* OK, that did not work, try making it lower-case, and add the .dll
|
||||
extension */
|
||||
|
||||
for(j=0; j<strlen(buff2); j++)
|
||||
if(buff2[j] >= 'A' && buff2[j] <= 'Z') buff2[j] |= 0x20;
|
||||
strcat(buff2, ".dll");
|
||||
|
||||
if(fd = open(buff2, O_RDONLY) >= 0) {
|
||||
close(fd);
|
||||
LoadImage(buff2, buff);
|
||||
continue;
|
||||
};
|
||||
if (FindFileInPath(buff2, sizeof(buff2),
|
||||
buff, dllExtensions, WinePath) != NULL &&
|
||||
(fd = open(buff2, O_RDONLY)) >= 0)
|
||||
{
|
||||
close(fd);
|
||||
LoadImage(buff2, buff);
|
||||
continue;
|
||||
}
|
||||
|
||||
fprintf(stderr,"Unable to load:%s\n", buff);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -257,6 +245,8 @@ LoadImage(char * filename, char * modulename)
|
|||
_WinMain(int argc, char **argv)
|
||||
{
|
||||
int segment;
|
||||
char *p;
|
||||
char exe_path[256];
|
||||
#ifdef WINESTAT
|
||||
char * cp;
|
||||
#endif
|
||||
|
@ -273,8 +263,21 @@ _WinMain(int argc, char **argv)
|
|||
fprintf(stderr, "usage: %s FILENAME\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
p = getenv("WINEPATH");
|
||||
WinePath = malloc(256 + strlen(p));
|
||||
getcwd(WinePath, 256);
|
||||
strcat(WinePath, ";");
|
||||
strcat(WinePath, p);
|
||||
|
||||
if (FindFileInPath(exe_path, 256, argv[1], exeExtensions, WinePath)
|
||||
== NULL)
|
||||
{
|
||||
fprintf(stderr, "Could not find file '%s'\n", argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
LoadImage(argv[1], NULL);
|
||||
LoadImage(exe_path, NULL);
|
||||
|
||||
if(ran_out) exit(1);
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -8,7 +8,7 @@ memory.o: $(OBJS)
|
|||
$(LD) -r -o memory.o $(OBJS)
|
||||
|
||||
clean:
|
||||
rm -f *.o *~ *.s dll_* *.a
|
||||
rm -f *.o *~ *.s dll_* *.a *#
|
||||
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
|
||||
|
||||
OBJS=dos.o kernel.o user.o xt.o rect.o file.o sound.o emulate.o \
|
||||
keyboard.o profile.o lstr.o
|
||||
keyboard.o profile.o lstr.o exec.o
|
||||
|
||||
default: misc.o
|
||||
|
||||
|
@ -9,7 +9,7 @@ misc.o: $(OBJS)
|
|||
$(LD) -r -o misc.o $(OBJS)
|
||||
|
||||
clean:
|
||||
rm -f *.o *~ *.s dll_* *.a
|
||||
rm -f *.o *~ *.s dll_* *.a *#
|
||||
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* Windows Exec & Help
|
||||
*
|
||||
*/
|
||||
|
||||
#include "win.h"
|
||||
|
||||
#define HELP_CONTEXT 0x0001
|
||||
#define HELP_QUIT 0x0002
|
||||
#define HELP_INDEX 0x0003
|
||||
#define HELP_CONTENTS 0x0003
|
||||
#define HELP_HELPONHELP 0x0004
|
||||
#define HELP_SETINDEX 0x0005
|
||||
#define HELP_SETCONTENTS 0x0005
|
||||
#define HELP_CONTEXTPOPUP 0x0008
|
||||
#define HELP_FORCEFILE 0x0009
|
||||
#define HELP_KEY 0x0101
|
||||
#define HELP_COMMAND 0x0102
|
||||
#define HELP_PARTIALKEY 0x0105
|
||||
#define HELP_MULTIKEY 0x0201
|
||||
#define HELP_SETWINPOS 0x0203
|
||||
|
||||
|
||||
WORD WinExec(LPSTR lpCmdLine, WORD nCmdShow)
|
||||
{
|
||||
int X, X2, C;
|
||||
char *ArgV[20];
|
||||
printf("WinExec(%s, %u)\n", lpCmdLine, nCmdShow);
|
||||
for (X = X2 = C = 0; X < strlen(lpCmdLine) + 1; X++) {
|
||||
if ((lpCmdLine[X] == ' ') || (lpCmdLine[X] == '\0')) {
|
||||
ArgV[C] = (char *)malloc(X - X2 + 1);
|
||||
strncpy(ArgV[C], &lpCmdLine[X2], X - X2);
|
||||
ArgV[C][X - X2] = '\0';
|
||||
C++; X2 = X + 1;
|
||||
}
|
||||
}
|
||||
ArgV[C] = NULL;
|
||||
for (C = 0; ; C++) {
|
||||
if (ArgV[C] == NULL) break;
|
||||
printf("--> '%s' \n", ArgV[C]);
|
||||
}
|
||||
switch(fork()) {
|
||||
case -1:
|
||||
printf("Can'k 'fork' process !\n");
|
||||
break;
|
||||
case 0:
|
||||
printf("New process started !\n");
|
||||
execvp(ArgV[0], ArgV);
|
||||
printf("Child process died !\n");
|
||||
exit(1);
|
||||
break;
|
||||
default:
|
||||
printf("Main process stay alive !\n");
|
||||
break;
|
||||
}
|
||||
for (C = 0; ; C++) {
|
||||
if (ArgV[C] == NULL) break;
|
||||
free(ArgV[C]);
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
BOOL WinHelp(HWND hWnd, LPSTR lpHelpFile, WORD wCommand, DWORD dwData)
|
||||
{
|
||||
char *ArgV[6];
|
||||
char str[32];
|
||||
printf("WinHelp(%s, %u, %lu)\n", lpHelpFile, wCommand, dwData);
|
||||
switch(fork()) {
|
||||
case -1:
|
||||
printf("Can'k 'fork' process !\n");
|
||||
break;
|
||||
case 0:
|
||||
printf("New process started !\n");
|
||||
ArgV[0] = "wine";
|
||||
ArgV[1] = "/C:/windows/winhelp.exe";
|
||||
ArgV[2] = lpHelpFile;
|
||||
switch (wCommand) {
|
||||
case HELP_CONTEXT:
|
||||
case HELP_KEY:
|
||||
case HELP_SETINDEX:
|
||||
sprintf(str, "%lu", dwData);
|
||||
ArgV[3] = str;
|
||||
default:
|
||||
ArgV[3] = NULL;
|
||||
}
|
||||
ArgV[4] = NULL;
|
||||
if (wCommand == HELP_HELPONHELP) ArgV[2] = NULL;
|
||||
/*
|
||||
_WinMain(ArgV, 2);
|
||||
*/
|
||||
execvp(ArgV[0], ArgV);
|
||||
printf("Child process died !\n");
|
||||
exit(1);
|
||||
break;
|
||||
default:
|
||||
printf("Main process stay alive !\n");
|
||||
break;
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ KERNEL_WaitEvent(int task)
|
|||
int
|
||||
KERNEL_GetModuleFileName(int module, char *filename, int bytes)
|
||||
{
|
||||
#ifdef RELAY_DEBUG
|
||||
#ifdef DEBUG_RELAY
|
||||
printf("GetModuleFileName: module %d, filename %x, bytes %d\n",
|
||||
module, filename, bytes);
|
||||
#endif
|
||||
|
|
|
@ -12,9 +12,6 @@ static char Copyright[] = "Copyright Yngvi Sigurjonsson (yngvi@hafro.is), 1993"
|
|||
#include "windows.h"
|
||||
|
||||
|
||||
#define LPCSTR LPSTR /* I think this should be const char **/
|
||||
typedef unsigned short UINT;
|
||||
|
||||
/* Funny to divide them between user and kernel. */
|
||||
|
||||
/* KERNEL.89 */
|
||||
|
@ -113,7 +110,7 @@ UINT AnsiLowerBuff(LPSTR str,UINT len)
|
|||
}
|
||||
|
||||
/* AnsiNext USER.472 */
|
||||
LPSTR AnsiNext(LPCSTR current)
|
||||
LPSTR AnsiNext(LPSTR current)
|
||||
{
|
||||
return (*current)?current+1:current;
|
||||
}
|
||||
|
|
|
@ -10,8 +10,9 @@ static char Copyright [] = "Copyright (C) 1993 Miguel de Icaza";
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "windows.h"
|
||||
#include "wine.h"
|
||||
|
||||
#define INIFILE "win.ini"
|
||||
#define INIFILE GetSystemIniFilename()
|
||||
#define STRSIZE 255
|
||||
#define xmalloc(x) malloc(x)
|
||||
#define overflow (next == &CharBuffer [STRSIZE-1])
|
||||
|
@ -298,25 +299,3 @@ void sync_profiles ()
|
|||
{
|
||||
dump_profile (Base);
|
||||
}
|
||||
|
||||
#ifdef DUMBTEST
|
||||
main ()
|
||||
{
|
||||
char r [100], app [100], key [100], valor [100];
|
||||
|
||||
while (1){
|
||||
printf ("Dame, Aplicacion, llave\n");
|
||||
gets (app);
|
||||
if (!app [0]){
|
||||
sync_profiles ();
|
||||
return;
|
||||
}
|
||||
gets (key);
|
||||
gets (valor);
|
||||
GetProfileString (app, key, "1No_Encontrado", r, sizeof (r));
|
||||
printf ("(%d)\n", GetProfileInt (app, key, 5));
|
||||
printf ("%s\n", r);
|
||||
WriteProfileString (app, key, valor);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -50,7 +50,10 @@ USER_InitApp(int hInstance)
|
|||
DCE_Init();
|
||||
|
||||
/* Initialize built-in window classes */
|
||||
WIDGETS_Init();
|
||||
if (!WIDGETS_Init()) return 0;
|
||||
|
||||
/* Initialize dialog manager */
|
||||
if (!DIALOG_Init()) return 0;
|
||||
|
||||
/* Create task message queue */
|
||||
if (!SetMessageQueue( DEFAULT_MSG_QUEUE_SIZE )) return 0;
|
||||
|
|
93
misc/xt.c
|
@ -14,12 +14,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
|||
#include <X11/Core.h>
|
||||
#include <X11/Shell.h>
|
||||
|
||||
#include "message.h"
|
||||
#include "callback.h"
|
||||
#include "win.h"
|
||||
#include "class.h"
|
||||
#include "gdi.h"
|
||||
#include "user.h"
|
||||
#include "windows.h"
|
||||
|
||||
#ifdef __NetBSD__
|
||||
#define HZ 100
|
||||
|
@ -50,87 +45,6 @@ void main(int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* DefWindowProc (USER.107)
|
||||
*/
|
||||
LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
|
||||
{
|
||||
WND * wndPtr;
|
||||
CLASS * classPtr;
|
||||
LPSTR textPtr;
|
||||
int len;
|
||||
|
||||
#ifdef DEBUG_MESSAGE
|
||||
printf( "DefWindowProc: %d %d %d %08x\n", hwnd, msg, wParam, lParam );
|
||||
#endif
|
||||
|
||||
switch(msg)
|
||||
{
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT paintstruct;
|
||||
BeginPaint( hwnd, &paintstruct );
|
||||
EndPaint( hwnd, &paintstruct );
|
||||
return 0;
|
||||
}
|
||||
|
||||
case WM_CREATE:
|
||||
return 0;
|
||||
|
||||
case WM_CLOSE:
|
||||
DestroyWindow( hwnd );
|
||||
return 0;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
case WM_ICONERASEBKGND:
|
||||
{
|
||||
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 1;
|
||||
if (!(classPtr = CLASS_FindClassPtr( wndPtr->hClass ))) return 1;
|
||||
if (!classPtr->wc.hbrBackground) return 1;
|
||||
FillWindow( wndPtr->hwndParent, hwnd, (HDC)wParam,
|
||||
classPtr->wc.hbrBackground );
|
||||
GlobalUnlock( hwnd );
|
||||
return 0;
|
||||
}
|
||||
|
||||
case WM_GETTEXT:
|
||||
{
|
||||
if (wParam)
|
||||
{
|
||||
wndPtr = WIN_FindWndPtr(hwnd);
|
||||
if (wndPtr->hText)
|
||||
{
|
||||
textPtr = (LPSTR)USER_HEAP_ADDR(wndPtr->hText);
|
||||
if ((int)wParam > (len = strlen(textPtr)))
|
||||
{
|
||||
strcpy((LPSTR)lParam, textPtr);
|
||||
GlobalUnlock(hwnd);
|
||||
return (DWORD)len;
|
||||
}
|
||||
}
|
||||
((LPSTR)lParam)[0] = NULL;
|
||||
}
|
||||
GlobalUnlock(hwnd);
|
||||
return (0L);
|
||||
}
|
||||
|
||||
case WM_GETTEXTLENGTH:
|
||||
{
|
||||
wndPtr = WIN_FindWndPtr(hwnd);
|
||||
if (wndPtr->hText)
|
||||
{
|
||||
textPtr = (LPSTR)USER_HEAP_ADDR(wndPtr->hText);
|
||||
len = strlen(textPtr);
|
||||
GlobalUnlock(hwnd);
|
||||
return (DWORD)len;
|
||||
}
|
||||
GlobalUnlock(hwnd);
|
||||
return (0L);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************
|
||||
*
|
||||
|
@ -194,7 +108,8 @@ BOOL IsIconic( HWND hwnd )
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
HMENU CreateMenu() { }
|
||||
HMENU CreateMenu() { return 0; }
|
||||
|
||||
BOOL AppendMenu( HMENU hmenu, WORD flags, WORD id, LPSTR text ) { }
|
||||
BOOL AppendMenu( HMENU hmenu, WORD flags, WORD id, LPSTR text ) { return TRUE;}
|
||||
|
||||
BOOL DestroyMenu( HMENU hmenu ) { return TRUE; }
|
||||
|
|
|
@ -9,7 +9,7 @@ objects.o: $(OBJS)
|
|||
$(LD) -r -o objects.o $(OBJS)
|
||||
|
||||
clean:
|
||||
rm -f *.o *~ *.s dll_* *.a
|
||||
rm -f *.o *~ *.s dll_* *.a *#
|
||||
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
|
|
@ -19,6 +19,7 @@ extern Screen * XT_screen;
|
|||
* We try to use a private color map if possible, because Windows programs
|
||||
* assume that palette(0) == Black and palette(max-1) == White.
|
||||
*/
|
||||
#define USE_PRIVATE_MAP
|
||||
|
||||
Colormap COLOR_WinColormap = 0;
|
||||
|
||||
|
@ -71,11 +72,39 @@ static int COLOR_FillDefaultMap()
|
|||
*
|
||||
* Fill the private colormap.
|
||||
*/
|
||||
#ifdef USE_PRIVATE_MAP
|
||||
|
||||
static BOOL COLOR_BuildMap( Colormap map, int depth, int size )
|
||||
{
|
||||
XColor color;
|
||||
int i;
|
||||
|
||||
/* Fill the whole map with a range of colors */
|
||||
|
||||
if ((1 << depth) > NB_SYS_COLORS)
|
||||
{
|
||||
int red_incr, green_incr, blue_incr;
|
||||
int r, g, b;
|
||||
|
||||
blue_incr = 0x10000 >> (depth / 3);
|
||||
red_incr = 0x10000 >> ((depth + 1) / 3);
|
||||
green_incr = 0x10000 >> ((depth + 2) / 3);
|
||||
|
||||
for (i = 0, r = red_incr - 1; r < 0x10000; r += red_incr)
|
||||
for (g = green_incr - 1; g < 0x10000; g += green_incr)
|
||||
for (b = blue_incr - 1; b < 0x10000; b += blue_incr)
|
||||
{
|
||||
if (i >= size) break;
|
||||
color.pixel = i++;
|
||||
color.red = r;
|
||||
color.green = g;
|
||||
color.blue = b;
|
||||
XStoreColor( XT_display, map, &color );
|
||||
}
|
||||
}
|
||||
|
||||
/* Store the system palette colors */
|
||||
|
||||
for (i = 0; i < NB_SYS_COLORS; i++)
|
||||
{
|
||||
if (!XParseColor( XT_display, map, SysColors[i], &color ))
|
||||
|
@ -86,7 +115,7 @@ static BOOL COLOR_BuildMap( Colormap map, int depth, int size )
|
|||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif /* USE_PRIVATE_MAP */
|
||||
|
||||
/***********************************************************************
|
||||
* COLOR_Init
|
||||
|
@ -117,7 +146,7 @@ BOOL COLOR_Init()
|
|||
case StaticColor:
|
||||
case TrueColor:
|
||||
COLOR_FillDefaultMap();
|
||||
COLOR_WinColormap = CopyFromParent;
|
||||
COLOR_WinColormap = DefaultColormapOfScreen( XT_screen );
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
|
|
|
@ -330,3 +330,38 @@ BOOL GetTextMetrics( HDC hdc, LPTEXTMETRIC metrics )
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* GetCharWidth (GDI.350)
|
||||
*/
|
||||
BOOL GetCharWidth(HDC hdc, WORD wFirstChar, WORD wLastChar, LPINT lpBuffer)
|
||||
{
|
||||
int i, j;
|
||||
XFontStruct *xfont;
|
||||
XCharStruct *charPtr;
|
||||
int default_width;
|
||||
|
||||
DC *dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC);
|
||||
if (!dc) return FALSE;
|
||||
xfont = dc->u.x.font.fstruct;
|
||||
|
||||
/* fixed font? */
|
||||
if (xfont->per_char == NULL)
|
||||
{
|
||||
for (i = wFirstChar, j = 0; i <= wLastChar; i++, j++)
|
||||
*(lpBuffer + j) = xfont->max_bounds.width;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
charPtr = xfont->per_char;
|
||||
default_width = (charPtr + xfont->default_char)->width;
|
||||
|
||||
for (i = wFirstChar, j = 0; i <= wLastChar; i++, j++)
|
||||
{
|
||||
if (i < xfont->min_char_or_byte2 || i > xfont->max_char_or_byte2)
|
||||
*(lpBuffer + j) = default_width;
|
||||
else
|
||||
*(lpBuffer + j) = charPtr->width;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@ BOOL PALETTE_Init()
|
|||
{
|
||||
int i, size;
|
||||
XColor color;
|
||||
Colormap map;
|
||||
HPALETTE hpalette;
|
||||
LOGPALETTE * palPtr;
|
||||
|
||||
|
@ -44,13 +43,10 @@ BOOL PALETTE_Init()
|
|||
palPtr->palNumEntries = size;
|
||||
memset( palPtr->palPalEntry, 0xff, size*sizeof(PALETTEENTRY) );
|
||||
|
||||
if ((map = COLOR_WinColormap) == CopyFromParent)
|
||||
map = DefaultColormapOfScreen( XT_screen );
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
color.pixel = i;
|
||||
XQueryColor( XT_display, map, &color );
|
||||
XQueryColor( XT_display, COLOR_WinColormap, &color );
|
||||
palPtr->palPalEntry[i].peRed = color.red >> 8;
|
||||
palPtr->palPalEntry[i].peGreen = color.green >> 8;
|
||||
palPtr->palPalEntry[i].peBlue = color.blue >> 8;
|
||||
|
@ -136,7 +132,8 @@ WORD GetNearestPaletteIndex( HPALETTE hpalette, COLORREF color )
|
|||
palPtr = (PALETTEOBJ *) GDI_GetObjPtr( hpalette, PALETTE_MAGIC );
|
||||
if (!palPtr) return 0;
|
||||
|
||||
if (COLOR_WinColormap && (hpalette == STOCK_DEFAULT_PALETTE))
|
||||
if ((COLOR_WinColormap != DefaultColormapOfScreen(XT_screen)) &&
|
||||
(hpalette == STOCK_DEFAULT_PALETTE))
|
||||
{
|
||||
if ((color & 0xffffff) == 0) return 0; /* Entry 0 is black */
|
||||
if ((color & 0xffffff) == 0xffffff) /* Max entry is white */
|
||||
|
|
227
objects/text.c
|
@ -17,6 +17,159 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
|||
#include "win.h"
|
||||
#include "gdi.h"
|
||||
|
||||
#define TAB 9
|
||||
#define LF 10
|
||||
#define CR 13
|
||||
#define SPACE 32
|
||||
#define PREFIX 38
|
||||
|
||||
static int tabstop = 8;
|
||||
static int tabwidth;
|
||||
static int spacewidth;
|
||||
static int prefix_offset;
|
||||
|
||||
|
||||
static char *TEXT_NextLine(HDC hdc, char *str, int *count, char *dest,
|
||||
int *len, int width, WORD format)
|
||||
{
|
||||
/* Return next line of text from a string.
|
||||
*
|
||||
* hdc - handle to DC.
|
||||
* str - string to parse into lines.
|
||||
* count - length of str.
|
||||
* dest - destination in which to return line.
|
||||
* len - length of resultant line in dest in chars.
|
||||
* width - maximum width of line in pixels.
|
||||
* format - format type passed to DrawText.
|
||||
*
|
||||
* Returns pointer to next char in str after end of the line
|
||||
* or NULL if end of str reached.
|
||||
*/
|
||||
|
||||
int i = 0, j = 0, k;
|
||||
int plen = 0;
|
||||
int numspaces;
|
||||
SIZE size;
|
||||
int lasttab = 0;
|
||||
int wb_i = 0, wb_j = 0, wb_count;
|
||||
|
||||
while (*count)
|
||||
{
|
||||
switch (str[i])
|
||||
{
|
||||
case CR:
|
||||
case LF:
|
||||
if (!(format & DT_SINGLELINE))
|
||||
{
|
||||
i++;
|
||||
if (str[i] == CR || str[i] == LF)
|
||||
i++;
|
||||
*len = j;
|
||||
return (&str[i]);
|
||||
}
|
||||
dest[j++] = str[i++];
|
||||
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX))
|
||||
{
|
||||
if (!GetTextExtentPoint(hdc, &dest[j-1], 1, &size))
|
||||
return NULL;
|
||||
plen += size.cx;
|
||||
}
|
||||
break;
|
||||
|
||||
case PREFIX:
|
||||
if (!(format & DT_NOPREFIX))
|
||||
{
|
||||
prefix_offset = j + 1;
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
dest[j++] = str[i++];
|
||||
if (!(format & DT_NOCLIP))
|
||||
{
|
||||
if (!GetTextExtentPoint(hdc, &dest[j-1], 1, &size))
|
||||
return NULL;
|
||||
plen += size.cx;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TAB:
|
||||
if (format & DT_EXPANDTABS)
|
||||
{
|
||||
wb_i = ++i;
|
||||
wb_j = j;
|
||||
wb_count = *count;
|
||||
|
||||
if (!GetTextExtentPoint(hdc, &dest[lasttab], j - lasttab,
|
||||
&size))
|
||||
return NULL;
|
||||
|
||||
numspaces = (tabwidth - size.cx) / spacewidth;
|
||||
for (k = 0; k < numspaces; k++)
|
||||
dest[j++] = SPACE;
|
||||
plen += tabwidth - size.cx;
|
||||
lasttab = wb_j + numspaces;
|
||||
}
|
||||
else
|
||||
{
|
||||
dest[j++] = str[i++];
|
||||
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX))
|
||||
{
|
||||
if (!GetTextExtentPoint(hdc, &dest[j-1], 1, &size))
|
||||
return NULL;
|
||||
plen += size.cx;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SPACE:
|
||||
dest[j++] = str[i++];
|
||||
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX))
|
||||
{
|
||||
wb_i = i;
|
||||
wb_j = j - 1;
|
||||
wb_count = *count;
|
||||
if (!GetTextExtentPoint(hdc, &dest[j-1], 1, &size))
|
||||
return NULL;
|
||||
plen += size.cx;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
dest[j++] = str[i++];
|
||||
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX))
|
||||
{
|
||||
if (!GetTextExtentPoint(hdc, &dest[j-1], 1, &size))
|
||||
return NULL;
|
||||
plen += size.cx;
|
||||
}
|
||||
}
|
||||
|
||||
(*count)--;
|
||||
if (!(format & DT_NOCLIP) || (format & DT_WORDBREAK))
|
||||
{
|
||||
if (plen > width)
|
||||
{
|
||||
if (format & DT_WORDBREAK)
|
||||
{
|
||||
*len = wb_j;
|
||||
*count = wb_count;
|
||||
return (&str[wb_i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
*len = j;
|
||||
return (&str[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*len = j;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* DrawText (USER.85)
|
||||
|
@ -24,17 +177,77 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
|||
int DrawText( HDC hdc, LPSTR str, int count, LPRECT rect, WORD flags )
|
||||
{
|
||||
SIZE size;
|
||||
char *strPtr;
|
||||
static char line[1024];
|
||||
int len, lh, prefix_x, prefix_len;
|
||||
TEXTMETRIC tm;
|
||||
int x = rect->left, y = rect->top;
|
||||
int width = rect->right - rect->left;
|
||||
|
||||
if (count == -1) count = strlen(str);
|
||||
strPtr = str;
|
||||
|
||||
if (!GetTextExtentPoint( hdc, str, count, &size )) return 0;
|
||||
|
||||
if (flags & DT_CENTER) x = (rect->left + rect->right - size.cx) / 2;
|
||||
else if (flags & DT_RIGHT) x = rect->right - size.cx;
|
||||
if (flags & DT_VCENTER) y = (rect->top + rect->bottom - size.cy) / 2;
|
||||
else if (flags & DT_BOTTOM) y = rect->bottom - size.cy;
|
||||
GetTextMetrics(hdc, &tm);
|
||||
if (flags & DT_EXTERNALLEADING)
|
||||
lh = tm.tmHeight + tm.tmExternalLeading;
|
||||
else
|
||||
lh = tm.tmHeight;
|
||||
|
||||
if (flags & DT_TABSTOP)
|
||||
tabstop = flags >> 8;
|
||||
|
||||
if (flags & DT_EXPANDTABS)
|
||||
{
|
||||
GetTextExtentPoint(hdc, " ", 1, &size);
|
||||
spacewidth = size.cx;
|
||||
GetTextExtentPoint(hdc, "o", 1, &size);
|
||||
tabwidth = size.cx * tabstop;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
prefix_offset = -1;
|
||||
strPtr = TEXT_NextLine(hdc, strPtr, &count, line, &len, width, flags);
|
||||
|
||||
if (prefix_offset != -1)
|
||||
{
|
||||
GetTextExtentPoint(hdc, line, prefix_offset - 1, &size);
|
||||
prefix_x = size.cx;
|
||||
GetTextExtentPoint(hdc, line + prefix_offset, 1, &size);
|
||||
prefix_len = size.cx;
|
||||
}
|
||||
|
||||
if (!GetTextExtentPoint(hdc, line, len, &size)) return 0;
|
||||
if (flags & DT_CENTER) x = (rect->left + rect->right -
|
||||
size.cx) / 2;
|
||||
else if (flags & DT_RIGHT) x = rect->right - size.cx;
|
||||
|
||||
if (flags & DT_SINGLELINE)
|
||||
{
|
||||
if (flags & DT_VCENTER) y = (rect->top + rect->bottom -
|
||||
size.cy) / 2;
|
||||
else if (flags & DT_BOTTOM) y = rect->bottom - size.cy;
|
||||
}
|
||||
|
||||
if (!TextOut(hdc, x, y, line, len)) return 0;
|
||||
if (prefix_offset != -1)
|
||||
{
|
||||
MoveTo(hdc, x + prefix_x, y + size.cy);
|
||||
LineTo(hdc, x + prefix_x + prefix_len, y + size.cy);
|
||||
}
|
||||
|
||||
if (strPtr)
|
||||
{
|
||||
y += lh;
|
||||
if (!(flags & DT_NOCLIP))
|
||||
{
|
||||
if (y > rect->bottom - lh)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (strPtr);
|
||||
|
||||
if (!TextOut( hdc, x, y, str, count )) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,23 +7,22 @@
|
|||
|
||||
struct
|
||||
{
|
||||
long style;
|
||||
char *text;
|
||||
long style;
|
||||
char *text;
|
||||
}
|
||||
button[] =
|
||||
{
|
||||
BS_PUSHBUTTON, "PUSHBUTTON",
|
||||
BS_DEFPUSHBUTTON, "DEFPUSHBUTTON",
|
||||
/* BS_CHECKBOX, "CHECKBOX",
|
||||
BS_AUTOCHECKBOX, "AUTOCHECKBOX",
|
||||
BS_RADIOBUTTON, "RADIOBUTTON",
|
||||
BS_3STATE, "3STATE",
|
||||
BS_AUTO3STATE, "AUTO3STATE",
|
||||
BS_GROUPBOX, "GROUPBOX",
|
||||
BS_USERBUTTON, "USERBUTTON",
|
||||
BS_AUTORADIOBUTTON, "AUTORADIOBUTTON",
|
||||
BS_PUSHBOX, "PUSHBOX"
|
||||
*/};
|
||||
BS_PUSHBUTTON, "PUSHBUTTON",
|
||||
BS_DEFPUSHBUTTON, "DEFPUSHBUTTON",
|
||||
BS_CHECKBOX, "CHECKBOX",
|
||||
BS_AUTOCHECKBOX, "AUTOCHECKBOX",
|
||||
BS_RADIOBUTTON, "RADIOBUTTON",
|
||||
BS_3STATE, "3STATE",
|
||||
BS_AUTO3STATE, "AUTO3STATE",
|
||||
BS_GROUPBOX, "GROUPBOX",
|
||||
BS_USERBUTTON, "USERBUTTON",
|
||||
BS_AUTORADIOBUTTON, "AUTORADIOBUTTON"
|
||||
};
|
||||
|
||||
#define NUM (sizeof button / sizeof button[0])
|
||||
|
||||
|
@ -72,18 +71,18 @@ int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance,
|
|||
|
||||
long FAR PASCAL _export WndProc(HWND hwnd, WORD message, WORD wParam, LONG lParam)
|
||||
{
|
||||
static char szPrm[] = "wParam LOWORD(lParam) HIWORD(lParam)",
|
||||
szTop[] = "Control ID Window Handle Notification",
|
||||
szUnd[] = "__________ _____________ ____________",
|
||||
szFormat[] = " %5u %4X %5u",
|
||||
szBuffer[50];
|
||||
static HWND hwndButton[NUM];
|
||||
static RECT rect;
|
||||
static int cxChar, cyChar;
|
||||
static char szPrm[] = "wParam LOWORD(lParam) HIWORD(lParam)",
|
||||
szTop[] = "Control ID Window Handle Notification",
|
||||
szUnd[] = "__________ _____________ ____________",
|
||||
szFormat[] = " %5u %4X %5u",
|
||||
szBuffer[50];
|
||||
static HWND hwndButton[NUM];
|
||||
static RECT rect;
|
||||
static int cxChar, cyChar;
|
||||
HDC hdc;
|
||||
PAINTSTRUCT ps;
|
||||
int i;
|
||||
TEXTMETRIC tm;
|
||||
int i;
|
||||
TEXTMETRIC tm;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
|
|
BIN
test/btnlook.exe
Before Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 246 B |
|
@ -1,292 +0,0 @@
|
|||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 1, February 1989
|
||||
|
||||
Copyright (C) 1989 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The license agreements of most software companies try to keep users
|
||||
at the mercy of those companies. By contrast, our General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. The
|
||||
General Public License applies to the Free Software Foundation's
|
||||
software and to any other program whose authors commit to using it.
|
||||
You can use it for your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Specifically, the General Public License is designed to make
|
||||
sure that you have the freedom to give away or sell copies of free
|
||||
software, that you receive source code or can get it if you want it,
|
||||
that you can change the software or use pieces of it in new free
|
||||
programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of a such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must tell them their rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any program or other work which
|
||||
contains a notice placed by the copyright holder saying it may be
|
||||
distributed under the terms of this General Public License. The
|
||||
"Program", below, refers to any such program or work, and a "work based
|
||||
on the Program" means either the Program or any work containing the
|
||||
Program or a portion of it, either verbatim or with modifications. Each
|
||||
licensee is addressed as "you".
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's source
|
||||
code as you receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice and
|
||||
disclaimer of warranty; keep intact all the notices that refer to this
|
||||
General Public License and to the absence of any warranty; and give any
|
||||
other recipients of the Program a copy of this General Public License
|
||||
along with the Program. You may charge a fee for the physical act of
|
||||
transferring a copy.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion of
|
||||
it, and copy and distribute such modifications under the terms of Paragraph
|
||||
1 above, provided that you also do the following:
|
||||
|
||||
a) cause the modified files to carry prominent notices stating that
|
||||
you changed the files and the date of any change; and
|
||||
|
||||
b) cause the whole of any work that you distribute or publish, that
|
||||
in whole or in part contains the Program or any part thereof, either
|
||||
with or without modifications, to be licensed at no charge to all
|
||||
third parties under the terms of this General Public License (except
|
||||
that you may choose to grant warranty protection to some or all
|
||||
third parties, at your option).
|
||||
|
||||
c) If the modified program normally reads commands interactively when
|
||||
run, you must cause it, when started running for such interactive use
|
||||
in the simplest and most usual way, to print or display an
|
||||
announcement including an appropriate copyright notice and a notice
|
||||
that there is no warranty (or else, saying that you provide a
|
||||
warranty) and that users may redistribute the program under these
|
||||
conditions, and telling the user how to view a copy of this General
|
||||
Public License.
|
||||
|
||||
d) You may charge a fee for the physical act of transferring a
|
||||
copy, and you may at your option offer warranty protection in
|
||||
exchange for a fee.
|
||||
|
||||
Mere aggregation of another independent work with the Program (or its
|
||||
derivative) on a volume of a storage or distribution medium does not bring
|
||||
the other work under the scope of these terms.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
3. You may copy and distribute the Program (or a portion or derivative of
|
||||
it, under Paragraph 2) in object code or executable form under the terms of
|
||||
Paragraphs 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of
|
||||
Paragraphs 1 and 2 above; or,
|
||||
|
||||
b) accompany it with a written offer, valid for at least three
|
||||
years, to give any third party free (except for a nominal charge
|
||||
for the cost of distribution) a complete machine-readable copy of the
|
||||
corresponding source code, to be distributed under the terms of
|
||||
Paragraphs 1 and 2 above; or,
|
||||
|
||||
c) accompany it with the information you received as to where the
|
||||
corresponding source code may be obtained. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form alone.)
|
||||
|
||||
Source code for a work means the preferred form of the work for making
|
||||
modifications to it. For an executable file, complete source code means
|
||||
all the source code for all modules it contains; but, as a special
|
||||
exception, it need not include source code for modules which are standard
|
||||
libraries that accompany the operating system on which the executable
|
||||
file runs, or for standard header files or definitions files that
|
||||
accompany that operating system.
|
||||
|
||||
4. You may not copy, modify, sublicense, distribute or transfer the
|
||||
Program except as expressly provided under this General Public License.
|
||||
Any attempt otherwise to copy, modify, sublicense, distribute or transfer
|
||||
the Program is void, and will automatically terminate your rights to use
|
||||
the Program under this License. However, parties who have received
|
||||
copies, or rights to use copies, from you under this General Public
|
||||
License will not have their licenses terminated so long as such parties
|
||||
remain in full compliance.
|
||||
|
||||
5. By copying, distributing or modifying the Program (or any work based
|
||||
on the Program) you indicate your acceptance of this license to do so,
|
||||
and all its terms and conditions.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the original
|
||||
licensor to copy, distribute or modify the Program subject to these
|
||||
terms and conditions. You may not impose any further restrictions on the
|
||||
recipients' exercise of the rights granted herein.
|
||||
|
||||
|
||||
|
||||
7. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of the license which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
the license, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
8. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
|
||||
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to humanity, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these
|
||||
terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to
|
||||
attach them to the start of each source file to most effectively convey
|
||||
the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
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 1, 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.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19xx name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the
|
||||
appropriate parts of the General Public License. Of course, the
|
||||
commands you use may be called something other than `show w' and `show
|
||||
c'; they could even be mouse-clicks or menu items--whatever suits your
|
||||
program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
program `Gnomovision' (a program to direct compilers to make passes
|
||||
at assemblers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
NAME Hyperoid
|
||||
DESCRIPTION 'Hyperoid Copyright (C) 1990,91 Hutchins Software'
|
||||
EXETYPE WINDOWS
|
||||
STUB 'WINSTUB.EXE'
|
||||
STACKSIZE 4096
|
||||
HEAPSIZE 32768
|
||||
DATA MOVEABLE MULTIPLE
|
||||
CODE LOADONCALL MOVEABLE DISCARDABLE
|
||||
SEGMENTS
|
||||
HYPEROID LOADONCALL MOVEABLE DISCARDABLE
|
||||
ROIDSUPP LOADONCALL MOVEABLE DISCARDABLE
|
||||
|
||||
EXPORTS
|
||||
HyperoidWndProc @1
|
||||
HyperoidAboutDlg @2
|
|
@ -1,241 +0,0 @@
|
|||
//
|
||||
// HYPEROID.H - hyperoid internal header information
|
||||
//
|
||||
// Version: 1.1 Copyright (C) 1990,91 Hutchins Software
|
||||
// This software is licenced under the GNU General Public Licence
|
||||
// Please read the associated legal documentation
|
||||
// Author: Edward Hutchins
|
||||
// Revisions:
|
||||
//
|
||||
|
||||
#ifndef RC_INVOKED
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
#include <limits.h>
|
||||
#define OEMRESOURCE
|
||||
#include <winext.h>
|
||||
|
||||
//
|
||||
// typedefs and defines
|
||||
//
|
||||
|
||||
// color stuff
|
||||
#define PALETTE_SIZE 16
|
||||
typedef enum
|
||||
{
|
||||
BLACK, DKGREY, GREY, WHITE,
|
||||
DKRED, RED, DKGREEN, GREEN, DKBLUE, BLUE,
|
||||
DKYELLOW, YELLOW, DKCYAN, CYAN, DKMAGENTA, MAGENTA
|
||||
} COLORS;
|
||||
|
||||
// degrees scaled to integer math
|
||||
#define DEGREE_SIZE 256
|
||||
#define DEGREE_MASK 255
|
||||
#define DEGREE_MAX 0x4000
|
||||
|
||||
// object limits
|
||||
#define MAX_PTS 8
|
||||
#define MAX_OBJS 100
|
||||
#define MAX_COORD 0x2000
|
||||
#define CLIP_COORD (MAX_COORD+300)
|
||||
|
||||
// timer stuff
|
||||
#define DRAW_TIMER 1
|
||||
#define DRAW_DELAY 50
|
||||
#define RESTART_TIMER 2
|
||||
#define RESTART_DELAY 5000
|
||||
|
||||
// restart modes
|
||||
typedef enum { RESTART_GAME, RESTART_LEVEL, RESTART_NEXTLEVEL } RESTART_MODE;
|
||||
|
||||
// letter scaling
|
||||
#define LETTER_MAX 256
|
||||
|
||||
// extra life every
|
||||
#define EXTRA_LIFE 100000
|
||||
|
||||
// list node
|
||||
typedef struct tagNODE
|
||||
{
|
||||
struct tagNODE *npNext, *npPrev;
|
||||
} NODE;
|
||||
pointerdef( NODE );
|
||||
|
||||
// list header
|
||||
typedef struct
|
||||
{
|
||||
NPNODE npHead, npTail;
|
||||
} LIST;
|
||||
pointerdef( LIST );
|
||||
|
||||
// object descriptor
|
||||
typedef struct
|
||||
{
|
||||
NODE Link; // for object list
|
||||
POINT Pos; // position of center of object
|
||||
POINT Vel; // velocity in logical units/update
|
||||
INT nMass; // mass of object
|
||||
INT nDir; // direction in degrees
|
||||
INT nSpin; // angular momentum degrees/update
|
||||
INT nCount; // used by different objects
|
||||
INT nDelay; // used by different objects
|
||||
BYTE byColor; // palette color
|
||||
BYTE byPts; // number of points in object
|
||||
POINT Pts[MAX_PTS]; // points making up an object
|
||||
POINT Old[MAX_PTS]; // last plotted location
|
||||
} OBJ;
|
||||
pointerdef( OBJ );
|
||||
|
||||
//
|
||||
// inline macro functions
|
||||
//
|
||||
|
||||
// function aliases
|
||||
#define AddHeadObj(l,o) AddHead((l),((NPNODE)o))
|
||||
#define RemHeadObj(l) ((NPOBJ)RemHead(l))
|
||||
#define RemoveObj(l,o) Remove((l),((NPNODE)o))
|
||||
#define HeadObj(l) ((NPOBJ)((l)->npHead))
|
||||
#define NextObj(o) ((NPOBJ)((o)->Link.npNext))
|
||||
|
||||
// real-time check of the keyboard
|
||||
#define IsKeyDown(x) (GetAsyncKeyState(x)<0)
|
||||
|
||||
// I HATE typing this allatime!
|
||||
#define INTRES(x) MAKEINTRESOURCE(x)
|
||||
|
||||
// size of an array
|
||||
#define DIM(x) (sizeof(x)/sizeof((x)[0]))
|
||||
|
||||
// faster than MulDiv!
|
||||
#define MULDEG(x,y) ((INT)(((LONG)(x)*(y))/DEGREE_MAX))
|
||||
|
||||
// DEG - convert an integer into a degree lookup index
|
||||
#define DEG(x) ((WORD)(x)&DEGREE_MASK)
|
||||
|
||||
// ACCEL - accelerate an object in a given direction
|
||||
#define ACCEL(o,d,s) \
|
||||
(((o)->Vel.x += MULDEG((s),nCos[DEG(d)])), \
|
||||
((o)->Vel.y += MULDEG((s),nSin[DEG(d)])))
|
||||
|
||||
// PTINRECT - a faster PtInRect
|
||||
#define PTINRECT(r,p) \
|
||||
(((r)->left <= (p).x) && ((r)->right > (p).x) && \
|
||||
((r)->top <= (p).y) && ((r)->bottom > (p).y))
|
||||
|
||||
// INTRECT - a faster IntersectRect that just returns the condition
|
||||
#define INTRECT(r1,r2) \
|
||||
(((r1)->right >= (r2)->left) && \
|
||||
((r1)->left < (r2)->right) && \
|
||||
((r1)->bottom >= (r2)->top) && \
|
||||
((r1)->top < (r2)->bottom))
|
||||
|
||||
// MKRECT - make a rect around a point
|
||||
#define MKRECT(r,p,s) \
|
||||
(((r)->left = ((p).x-(s))), ((r)->right = ((p).x+(s))), \
|
||||
((r)->top = ((p).y-(s))), ((r)->bottom = ((p).y+(s))))
|
||||
|
||||
//
|
||||
// prototypes
|
||||
//
|
||||
|
||||
// hyperoid.c
|
||||
INT NEAR PASCAL arand( INT x );
|
||||
VOID NEAR PASCAL AddHead( NPLIST npList, NPNODE npNode );
|
||||
NPNODE NEAR PASCAL RemHead( NPLIST npList );
|
||||
VOID NEAR PASCAL Remove( NPLIST npList, NPNODE npNode );
|
||||
VOID NEAR PASCAL DrawObject( HDC hDC, NPOBJ npObj );
|
||||
VOID NEAR PASCAL SetRestart( BOOL bGameOver );
|
||||
VOID NEAR PASCAL AddExtraLife( VOID );
|
||||
VOID NEAR PASCAL Hit( HDC hDC, NPOBJ npObj );
|
||||
VOID NEAR PASCAL Explode( HDC hDC, NPOBJ npObj );
|
||||
BOOL NEAR PASCAL HitPlayer( HDC hDC, NPOBJ npObj );
|
||||
NPOBJ FAR PASCAL CreateLetter( CHAR cLetter, INT nSize );
|
||||
VOID NEAR PASCAL DrawLetters( HDC hDC );
|
||||
VOID NEAR PASCAL DrawHunterShots( HDC hDC );
|
||||
VOID NEAR PASCAL FireHunterShot( NPOBJ npHunt );
|
||||
VOID NEAR PASCAL CreateHunter( VOID );
|
||||
VOID NEAR PASCAL DrawHunters( HDC hDC );
|
||||
VOID NEAR PASCAL CreateSpinner( VOID );
|
||||
VOID NEAR PASCAL DrawSpinners( HDC hDC );
|
||||
VOID NEAR PASCAL CreateRoid( POINT Pos, POINT Vel, INT nSides, BYTE byColor, INT nDir, INT nSpeed, INT nSpin );
|
||||
VOID NEAR PASCAL BreakRoid( HDC hDC, NPOBJ npRoid, NPOBJ npShot );
|
||||
VOID NEAR PASCAL DrawRoids( HDC hDC );
|
||||
VOID NEAR PASCAL DrawShots( HDC hDC );
|
||||
VOID NEAR PASCAL DrawFlames( HDC hDC );
|
||||
VOID NEAR PASCAL FireShot( VOID );
|
||||
VOID NEAR PASCAL AccelPlayer( INT nDir, INT nAccel );
|
||||
VOID NEAR PASCAL DrawPlayer( HDC hDC );
|
||||
VOID NEAR PASCAL DrawObjects( HWND hWnd );
|
||||
VOID NEAR PASCAL CheckScore( HWND hWnd );
|
||||
VOID NEAR PASCAL HitList( HDC hDC, NPLIST npList );
|
||||
VOID NEAR PASCAL ExplodeBadguys( HDC hDC, NPLIST npList );
|
||||
VOID NEAR PASCAL NewGame( HWND hWnd );
|
||||
VOID NEAR PASCAL RestartHyperoid( VOID );
|
||||
VOID NEAR PASCAL Panic( BOOL bPanic );
|
||||
VOID NEAR PASCAL PaintHyperoid( HWND hWnd );
|
||||
VOID NEAR PASCAL DisableHyperoidInput( HWND hWnd, BOOL bCapture );
|
||||
LONG FAR PASCAL EXPORT HyperoidWndProc( HWND hWnd, unsigned message, WORD wParam, LONG lParam );
|
||||
BOOL NEAR PASCAL InitHyperoid( VOID );
|
||||
VOID NEAR PASCAL ExitHyperoid( VOID );
|
||||
INT FAR PASCAL WinMain( HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpszCmdLine, INT nCmdShow );
|
||||
|
||||
// roidsupp.c
|
||||
VOID FAR PASCAL PrintLetters( NPSTR npszText, POINT Pos, POINT Vel, BYTE byColor, INT nSize );
|
||||
VOID FAR PASCAL SpinLetters( NPSTR npszText, POINT Pos, POINT Vel, BYTE byColor, INT nSize );
|
||||
HPALETTE FAR PASCAL CreateHyperoidPalette( VOID );
|
||||
BOOL FAR PASCAL CreateHyperoidClass( VOID );
|
||||
VOID NEAR PASCAL SetHyperoidMenu( HWND hWnd, INT nFirstID, INT nLastID );
|
||||
HWND FAR PASCAL CreateHyperoidWindow( LPSTR lpszCmd, INT nCmdShow );
|
||||
VOID FAR PASCAL SaveHyperoidWindowPos( HWND hWnd );
|
||||
VOID FAR PASCAL GetHyperoidIni( VOID );
|
||||
VOID FAR PASCAL HyperoidHelp( HWND hWnd );
|
||||
BOOL FAR PASCAL EXPORT HyperoidAboutDlg( HWND hDlg, WORD mess, WORD wParam, LONG lParam );
|
||||
VOID FAR PASCAL AboutHyperoid( HWND hWnd );
|
||||
|
||||
#endif // RC_INVOKED //
|
||||
|
||||
//
|
||||
// resource IDs
|
||||
//
|
||||
|
||||
// icons and bitmaps
|
||||
#define IDI_HYPEROID 10
|
||||
#define IDI_PANIC 20
|
||||
|
||||
// bitmaps
|
||||
#define IDB_blank 50
|
||||
#define IDB_bomb 51
|
||||
#define IDB_level 52
|
||||
#define IDB_life 53
|
||||
#define IDB_num0 54
|
||||
#define IDB_num1 55
|
||||
#define IDB_num2 56
|
||||
#define IDB_num3 57
|
||||
#define IDB_num4 58
|
||||
#define IDB_num5 59
|
||||
#define IDB_num6 60
|
||||
#define IDB_num7 61
|
||||
#define IDB_num8 62
|
||||
#define IDB_num9 63
|
||||
#define IDB_plus 64
|
||||
#define IDB_score 65
|
||||
#define IDB_shield 66
|
||||
// additional bitmap stuff
|
||||
#define IDB_MAX 17
|
||||
#define CX_BITMAP 16
|
||||
#define CY_BITMAP 16
|
||||
|
||||
// strings
|
||||
#define IDS_NAME 100
|
||||
|
||||
// menus
|
||||
#define IDM_NEW 200
|
||||
#define IDM_ABOUT 201
|
||||
|
||||
// about box
|
||||
#define IDD_ABOUT 500
|
||||
#define IDD_A_HELP 501
|
||||
#define IDD_A_HISCORE 502
|
Before Width: | Height: | Size: 766 B |
|
@ -1,35 +0,0 @@
|
|||
PROJ =HYPEROID
|
||||
DEBUG =1
|
||||
CC =qcl
|
||||
CFLAGS_G = /AM /W3 /Ze
|
||||
CFLAGS_D = /Zi /Od
|
||||
CFLAGS_R = /O /Ol /Gs /DNDEBUG
|
||||
CFLAGS =$(CFLAGS_G) $(CFLAGS_D)
|
||||
LFLAGS_G = /CP:0xffff /NOI /SE:0x80 /ST:0x2000
|
||||
LFLAGS_D = /CO /M
|
||||
LFLAGS_R =
|
||||
LFLAGS =$(LFLAGS_G) $(LFLAGS_D)
|
||||
RUNFLAGS =
|
||||
OBJS_EXT =
|
||||
LIBS_EXT =
|
||||
|
||||
all: $(PROJ).exe
|
||||
|
||||
hyperoid.obj: hyperoid.c
|
||||
|
||||
roidsupp.obj: roidsupp.c
|
||||
|
||||
$(PROJ).exe: hyperoid.obj roidsupp.obj $(OBJS_EXT)
|
||||
echo >NUL @<<$(PROJ).crf
|
||||
hyperoid.obj +
|
||||
roidsupp.obj +
|
||||
$(OBJS_EXT)
|
||||
$(PROJ).exe
|
||||
|
||||
$(LIBS_EXT);
|
||||
<<
|
||||
ilink -a -e "link $(LFLAGS) @$(PROJ).crf" $(PROJ)
|
||||
|
||||
run: $(PROJ).exe
|
||||
$(PROJ) $(RUNFLAGS)
|
||||
|
|
@ -1,671 +0,0 @@
|
|||
Stack Allocation = 8192 bytes
|
||||
|
||||
hyperoid
|
||||
|
||||
Start Length Name Class
|
||||
0001:0000 022D8H HYPEROID CODE
|
||||
0001:22D8 006E8H ROIDSUPP CODE
|
||||
0001:29C0 02834H _TEXT CODE
|
||||
0001:5200 026F0H EMULATOR_TEXT CODE
|
||||
0001:78F0 00000H C_ETEXT ENDCODE
|
||||
0002:0000 00170H EMULATOR_DATA FAR_DATA
|
||||
0003:0000 00042H NULL BEGDATA
|
||||
0003:0042 00A00H _DATA DATA
|
||||
0003:0A42 00002H XIQC DATA
|
||||
0003:0A44 0000EH DBDATA DATA
|
||||
0003:0A52 0000EH CDATA DATA
|
||||
0003:0A60 00000H XIFB DATA
|
||||
0003:0A60 00000H XIF DATA
|
||||
0003:0A60 00000H XIFE DATA
|
||||
0003:0A60 00000H XIB DATA
|
||||
0003:0A60 0000CH XI DATA
|
||||
0003:0A6C 00000H XIE DATA
|
||||
0003:0A6C 00000H XPB DATA
|
||||
0003:0A6C 00000H XP DATA
|
||||
0003:0A6C 00000H XPE DATA
|
||||
0003:0A6C 00000H XCB DATA
|
||||
0003:0A6C 00000H XC DATA
|
||||
0003:0A6C 00000H XCE DATA
|
||||
0003:0A6C 00000H XCFB DATA
|
||||
0003:0A6C 00000H XCF DATA
|
||||
0003:0A6C 00000H XCFE DATA
|
||||
0003:0A6C 00018H CONST CONST
|
||||
0003:0A84 00008H HDR MSG
|
||||
0003:0A8C 001DDH MSG MSG
|
||||
0003:0C69 00002H PAD MSG
|
||||
0003:0C6B 00001H EPAD MSG
|
||||
0003:0C6C 0006EH _BSS BSS
|
||||
0003:0CDA 00000H XOB BSS
|
||||
0003:0CDA 00000H XO BSS
|
||||
0003:0CDA 00000H XOE BSS
|
||||
0003:0CE0 02616H c_common BSS
|
||||
0003:3300 02000H STACK STACK
|
||||
|
||||
Origin Group
|
||||
0003:0 DGROUP
|
||||
|
||||
Address Export Alias
|
||||
|
||||
0001:28D9 HYPEROIDABOUTDLG HYPEROIDABOUTDLG
|
||||
0001:1ECA HYPEROIDWNDPROC HYPEROIDWNDPROC
|
||||
|
||||
Address Publics by Name
|
||||
|
||||
0001:3B44 $I10_OUTPUT
|
||||
0001:382E $i8_output
|
||||
0001:3AEF $i8_tpwr10
|
||||
0001:296C ABOUTHYPEROID
|
||||
0001:029D ACCELERATE
|
||||
0001:18B6 ACCELPLAYER
|
||||
0001:006B ADDHEAD
|
||||
0001:0000 ARAND
|
||||
0001:13D9 BREAKROID
|
||||
0001:1B94 CHECKSCORE
|
||||
0001:0C8A CREATEHUNTER
|
||||
0001:2595 CREATEHYPEROIDCLASS
|
||||
0001:23AC CREATEHYPEROIDPALETTE
|
||||
0001:268F CREATEHYPEROIDWINDOW
|
||||
0001:08E8 CREATELETTER
|
||||
0001:12D3 CREATEROID
|
||||
0001:0F98 CREATESPINNER
|
||||
0001:1754 DRAWFLAMES
|
||||
0001:0D5E DRAWHUNTERS
|
||||
0001:0AD2 DRAWHUNTERSHOTS
|
||||
0001:0A44 DRAWLETTERS
|
||||
0001:02F2 DRAWOBJECT
|
||||
0001:1AB6 DRAWOBJECTS
|
||||
0001:198E DRAWPLAYER
|
||||
0001:15AC DRAWROIDS
|
||||
0001:16C5 DRAWSHOTS
|
||||
0001:107D DRAWSPINNERS
|
||||
0001:1E41 ERASEHYPEROIDBKGND
|
||||
0001:21CC EXITHYPEROID
|
||||
0001:0630 EXPLODE
|
||||
0001:3552 fFYTOX
|
||||
0000:FE32 Abs FIARQQ
|
||||
0000:0E32 Abs FICRQQ
|
||||
0000:5C32 Abs FIDRQQ
|
||||
0000:1632 Abs FIERQQ
|
||||
0001:0BAC FIREHUNTERSHOT
|
||||
0001:17E3 FIRESHOT
|
||||
0000:0632 Abs FISRQQ
|
||||
0000:A23D Abs FIWRQQ
|
||||
0000:4000 Abs FJARQQ
|
||||
0000:C000 Abs FJCRQQ
|
||||
0000:8000 Abs FJSRQQ
|
||||
0001:0547 HIT
|
||||
0001:0787 HITPLAYER
|
||||
0001:28D9 HYPEROIDABOUTDLG
|
||||
0001:28AA HYPEROIDHELP
|
||||
0001:1ECA HYPEROIDWNDPROC
|
||||
0001:214C INITHYPEROID
|
||||
0001:0195 INITOBJECTS
|
||||
0001:1DF2 PAINTHYPEROID
|
||||
0001:1D51 PANIC
|
||||
0003:0CE4 PLOCALHEAP
|
||||
0001:22D8 PRINTLETTERS
|
||||
0001:00D0 REMHEAD
|
||||
0001:0136 REMOVE
|
||||
0001:1C13 RESTARTHYPEROID
|
||||
0001:2790 SAVEHYPEROIDWINDOWPOS
|
||||
0001:2616 SETHYPEROIDMENU
|
||||
0001:0513 SETRESTART
|
||||
0001:2222 WINMAIN
|
||||
0001:317C _atof
|
||||
0001:3178 _atoi
|
||||
0003:32C6 _bPaused
|
||||
0003:32BE _bRestart
|
||||
0001:4AE4 _cos
|
||||
0003:0C6C _edata
|
||||
0003:3300 _end
|
||||
0003:06AF _environ
|
||||
0003:0688 _errno
|
||||
0001:2B8D _exit
|
||||
0003:3086 _FlameList
|
||||
0003:32C2 _FreeList
|
||||
0003:30AE _hAppInst
|
||||
0003:32D2 _hAppPalette
|
||||
0003:32C0 _hAppWnd
|
||||
0003:308E _hPen
|
||||
0003:0A38 _HUGE
|
||||
0003:30B0 _HunterList
|
||||
0003:0CE8 _HunterShotList
|
||||
0003:0CE0 _LetterList
|
||||
0003:0250 _LetterPart
|
||||
0003:30B8 _lScore
|
||||
0001:2F34 _malloc
|
||||
0001:4E30 _matherr
|
||||
0001:32F4 _memmove
|
||||
0001:333C _memset
|
||||
0003:32BC _nBadGuys
|
||||
0003:0CEE _nCos
|
||||
0003:32C8 _nGravity
|
||||
0003:308C _nLevel
|
||||
0003:0CEC _npPlayer
|
||||
0003:0CE6 _nSafe
|
||||
0003:32F4 _nShield
|
||||
0003:30BC _nSin
|
||||
0003:0EEE _Obj
|
||||
0003:32CE _RoidList
|
||||
0003:32CA _ShotList
|
||||
0001:4ADE _sin
|
||||
0003:30B4 _SpinnerList
|
||||
0001:3130 _strcmp
|
||||
0001:30FE _strcpy
|
||||
0001:315C _strlen
|
||||
0003:32D4 _szAppName
|
||||
0003:0298 _szLetterDesc
|
||||
0003:0284 _szNumberDesc
|
||||
0001:4AE9 _tan
|
||||
0003:308A _wTick
|
||||
0003:09A4 __80x87
|
||||
0003:066C __acfinfo
|
||||
0000:9876 Abs __acrtmsg
|
||||
0000:9876 Abs __acrtused
|
||||
0000:D6D6 Abs __aDBdoswp
|
||||
0003:06BE __adbgmsg
|
||||
0003:0650 __aexit_rtn
|
||||
0001:4AF4 __aFCIcos
|
||||
0001:4AEE __aFCIsin
|
||||
0001:4AF9 __aFCItan
|
||||
0001:4D08 __aFftol
|
||||
0001:3386 __aFldiv
|
||||
0001:3420 __aFlmul
|
||||
0001:3420 __aFulmul
|
||||
0003:067A __aintdiv
|
||||
0003:06C6 __amblksiz
|
||||
0001:2AA3 __amsg_exit
|
||||
0003:0042 __anullsize
|
||||
0003:0668 __aseghi
|
||||
0003:066A __aseglo
|
||||
0003:0652 __asizds
|
||||
0003:06E4 __asizeC
|
||||
0003:06E5 __asizeD
|
||||
0001:29D0 __astart
|
||||
0001:51D0 __atold
|
||||
0003:064E __atopsp
|
||||
0001:31C2 __catox
|
||||
0001:2B9C __cexit
|
||||
0001:4A64 __cfltcvt
|
||||
0003:06C8 __cfltcvt_tab
|
||||
0001:474E __cftoe
|
||||
0001:489C __cftof
|
||||
0001:49B2 __cftog
|
||||
0003:06B6 __child
|
||||
0001:2AC8 __cinit
|
||||
0001:2A93 __cintDIV
|
||||
0001:4BA2 __cintrindisp1
|
||||
0001:4B79 __cintrindisp2
|
||||
0001:517A __cldcvt
|
||||
0001:4E40 __cldtoe
|
||||
0001:4FCE __cldtof
|
||||
0001:510C __cldtog
|
||||
0003:08E2 __cosjmptab
|
||||
0003:0912 __cotanjmptab
|
||||
0003:07FC __cpower
|
||||
0001:4656 __cropzeros
|
||||
0001:2C10 __ctermsub
|
||||
0001:4BD7 __ctrandisp1
|
||||
0001:4BC4 __ctrandisp2
|
||||
0003:06E6 __ctype
|
||||
0003:06E6 __ctype_
|
||||
0001:2BA6 __c_exit
|
||||
0001:2AC5 __dataseg
|
||||
0001:32BB __DOSCREATECSALIAS
|
||||
0001:3286 __DOSDEVCONFIG
|
||||
0003:0693 __doserrno
|
||||
0001:32D1 __DOSFREESEG
|
||||
0001:329D __DOSGETMACHINEMODE
|
||||
0001:32B2 __DOSSETVEC
|
||||
0003:0690 __dosvermajor
|
||||
0003:0691 __dosverminor
|
||||
0001:32DA __DOSWRITE
|
||||
0001:5200 __EmDataSeg
|
||||
0001:2B94 __exit
|
||||
0003:08A0 __expjmptab
|
||||
0003:067E __fac
|
||||
0001:46F2 __fassign
|
||||
0001:36D7 __fFCOS
|
||||
0001:355E __fFEXP
|
||||
0001:3686 __ffexpm1
|
||||
0001:360B __fFLN
|
||||
0001:36F0 __fFSIN
|
||||
0001:2C50 __FF_MSGBANNER
|
||||
0001:30DD __findlast
|
||||
0001:4D3C __fltin
|
||||
0001:4D92 __fltout
|
||||
0000:9876 Abs __fltused
|
||||
0001:45EE __forcdecpt
|
||||
0001:5A7F __fpemulator
|
||||
0001:5210 __fpemulatorbegin
|
||||
0001:786F __fpemulatorend
|
||||
0001:54DE __FPEXCEPTION87
|
||||
0003:0A54 __fpinit
|
||||
0001:787A __FPINSTALL87
|
||||
0001:523A __fpmath
|
||||
0001:4DD8 __fpsignal
|
||||
0002:0169 __fptaskdata
|
||||
0001:78A9 __FPTERMINATE87
|
||||
0001:3216 __fptostr
|
||||
0001:2C72 __fptrap
|
||||
0001:4D08 __ftol
|
||||
0001:3000 __growseg
|
||||
0001:308C __incseg
|
||||
0003:07E8 __indefinite
|
||||
0003:080E __infinity
|
||||
0001:4AFE __Init80x87
|
||||
0003:06B9 __intno
|
||||
0001:40DF __LD12MULT
|
||||
0001:400A __LD12MULTTENPOWER
|
||||
0003:0888 __lnjmptab
|
||||
0003:0818 __logemax
|
||||
0003:0870 __logjmptab
|
||||
0001:4264 __MANTOLD12
|
||||
0003:0A40 __matherr_flag
|
||||
0001:2F0E __myalloc
|
||||
0003:0695 __nfile
|
||||
0001:2F3A __nfree
|
||||
0003:0654 __nheap_desc
|
||||
0001:2F5B __nmalloc
|
||||
0001:2EAC __NMSG_TEXT
|
||||
0001:2ED7 __NMSG_WRITE
|
||||
0001:2C78 __nullcheck
|
||||
0003:0693 __oserr
|
||||
0003:0697 __osfile
|
||||
0003:0690 __osmajor
|
||||
0003:0691 __osminor
|
||||
0003:0692 __osmode
|
||||
0003:0690 __osversion
|
||||
0003:06B8 __ovlflag
|
||||
0003:06BA __ovlvec
|
||||
0003:06B1 __pgmptr
|
||||
0003:07F2 __piby2
|
||||
0001:46C4 __positive
|
||||
0003:068E __psp
|
||||
0003:068C __pspadr
|
||||
0001:351A __rtbignan
|
||||
0001:3549 __rtchsifneg
|
||||
0001:3540 __rtifprojnpop
|
||||
0001:3521 __rtifprojpop
|
||||
0001:352B __rtindfnpop
|
||||
0001:3528 __rtindfpop
|
||||
0001:366B __rtinfnpop
|
||||
0001:35FE __rtinfnpopse
|
||||
0001:3668 __rtinfpop
|
||||
0001:35FB __rtinfpopse
|
||||
0001:34FD __rtnospop
|
||||
0001:3501 __rtnospopde
|
||||
0001:3513 __rtonenpop
|
||||
0001:3510 __rtonepop
|
||||
0001:3500 __rttosnpop
|
||||
0001:3539 __rttosnpopde
|
||||
0001:34FA __rttospop
|
||||
0001:34F7 __rttospopde
|
||||
0001:3509 __rtzeronpop
|
||||
0001:3506 __rtzeropop
|
||||
0001:2F84 __searchseg
|
||||
0001:2C9C __setargv
|
||||
0001:2E2E __setenvp
|
||||
0003:06E2 __sigintoff
|
||||
0003:06E0 __sigintseg
|
||||
0003:08CA __sinjmptab
|
||||
0001:431E __STRINGTOD
|
||||
0001:4386 __STRINGTOLD
|
||||
0003:08FA __tanjmptab
|
||||
0001:3452 __trandisp1
|
||||
0001:3494 __trandisp2
|
||||
0003:068A __umaskval
|
||||
0001:336A __wrt2err
|
||||
0003:0840 __ytoxjmptab
|
||||
0003:0A4A ___aDBexit
|
||||
0003:0A50 ___aDBptrchk
|
||||
0003:0A48 ___aDBrterr
|
||||
0003:0A46 ___aDBswpchk
|
||||
0003:0A44 ___aDBswpflg
|
||||
0003:06AB ___argc
|
||||
0003:06AD ___argv
|
||||
0003:0A42 ___qczrinit
|
||||
|
||||
Address Publics by Value
|
||||
|
||||
0000:0632 Abs FISRQQ
|
||||
0000:0E32 Abs FICRQQ
|
||||
0000:1632 Abs FIERQQ
|
||||
0000:4000 Abs FJARQQ
|
||||
0000:5C32 Abs FIDRQQ
|
||||
0000:8000 Abs FJSRQQ
|
||||
0000:9876 Abs __acrtmsg
|
||||
0000:9876 Abs __acrtused
|
||||
0000:9876 Abs __fltused
|
||||
0000:A23D Abs FIWRQQ
|
||||
0000:C000 Abs FJCRQQ
|
||||
0000:D6D6 Abs __aDBdoswp
|
||||
0000:FE32 Abs FIARQQ
|
||||
0001:0000 ARAND
|
||||
0001:006B ADDHEAD
|
||||
0001:00D0 REMHEAD
|
||||
0001:0136 REMOVE
|
||||
0001:0195 INITOBJECTS
|
||||
0001:029D ACCELERATE
|
||||
0001:02F2 DRAWOBJECT
|
||||
0001:0513 SETRESTART
|
||||
0001:0547 HIT
|
||||
0001:0630 EXPLODE
|
||||
0001:0787 HITPLAYER
|
||||
0001:08E8 CREATELETTER
|
||||
0001:0A44 DRAWLETTERS
|
||||
0001:0AD2 DRAWHUNTERSHOTS
|
||||
0001:0BAC FIREHUNTERSHOT
|
||||
0001:0C8A CREATEHUNTER
|
||||
0001:0D5E DRAWHUNTERS
|
||||
0001:0F98 CREATESPINNER
|
||||
0001:107D DRAWSPINNERS
|
||||
0001:12D3 CREATEROID
|
||||
0001:13D9 BREAKROID
|
||||
0001:15AC DRAWROIDS
|
||||
0001:16C5 DRAWSHOTS
|
||||
0001:1754 DRAWFLAMES
|
||||
0001:17E3 FIRESHOT
|
||||
0001:18B6 ACCELPLAYER
|
||||
0001:198E DRAWPLAYER
|
||||
0001:1AB6 DRAWOBJECTS
|
||||
0001:1B94 CHECKSCORE
|
||||
0001:1C13 RESTARTHYPEROID
|
||||
0001:1D51 PANIC
|
||||
0001:1DF2 PAINTHYPEROID
|
||||
0001:1E41 ERASEHYPEROIDBKGND
|
||||
0001:1ECA HYPEROIDWNDPROC
|
||||
0001:214C INITHYPEROID
|
||||
0001:21CC EXITHYPEROID
|
||||
0001:2222 WINMAIN
|
||||
0001:22D8 PRINTLETTERS
|
||||
0001:23AC CREATEHYPEROIDPALETTE
|
||||
0001:2595 CREATEHYPEROIDCLASS
|
||||
0001:2616 SETHYPEROIDMENU
|
||||
0001:268F CREATEHYPEROIDWINDOW
|
||||
0001:2790 SAVEHYPEROIDWINDOWPOS
|
||||
0001:28AA HYPEROIDHELP
|
||||
0001:28D9 HYPEROIDABOUTDLG
|
||||
0001:296C ABOUTHYPEROID
|
||||
0001:29D0 __astart
|
||||
0001:2A93 __cintDIV
|
||||
0001:2AA3 __amsg_exit
|
||||
0001:2AC5 __dataseg
|
||||
0001:2AC8 __cinit
|
||||
0001:2B8D _exit
|
||||
0001:2B94 __exit
|
||||
0001:2B9C __cexit
|
||||
0001:2BA6 __c_exit
|
||||
0001:2C10 __ctermsub
|
||||
0001:2C50 __FF_MSGBANNER
|
||||
0001:2C72 __fptrap
|
||||
0001:2C78 __nullcheck
|
||||
0001:2C9C __setargv
|
||||
0001:2E2E __setenvp
|
||||
0001:2EAC __NMSG_TEXT
|
||||
0001:2ED7 __NMSG_WRITE
|
||||
0001:2F0E __myalloc
|
||||
0001:2F34 _malloc
|
||||
0001:2F3A __nfree
|
||||
0001:2F5B __nmalloc
|
||||
0001:2F84 __searchseg
|
||||
0001:3000 __growseg
|
||||
0001:308C __incseg
|
||||
0001:30DD __findlast
|
||||
0001:30FE _strcpy
|
||||
0001:3130 _strcmp
|
||||
0001:315C _strlen
|
||||
0001:3178 _atoi
|
||||
0001:317C _atof
|
||||
0001:31C2 __catox
|
||||
0001:3216 __fptostr
|
||||
0001:3286 __DOSDEVCONFIG
|
||||
0001:329D __DOSGETMACHINEMODE
|
||||
0001:32B2 __DOSSETVEC
|
||||
0001:32BB __DOSCREATECSALIAS
|
||||
0001:32D1 __DOSFREESEG
|
||||
0001:32DA __DOSWRITE
|
||||
0001:32F4 _memmove
|
||||
0001:333C _memset
|
||||
0001:336A __wrt2err
|
||||
0001:3386 __aFldiv
|
||||
0001:3420 __aFulmul
|
||||
0001:3420 __aFlmul
|
||||
0001:3452 __trandisp1
|
||||
0001:3494 __trandisp2
|
||||
0001:34F7 __rttospopde
|
||||
0001:34FA __rttospop
|
||||
0001:34FD __rtnospop
|
||||
0001:3500 __rttosnpop
|
||||
0001:3501 __rtnospopde
|
||||
0001:3506 __rtzeropop
|
||||
0001:3509 __rtzeronpop
|
||||
0001:3510 __rtonepop
|
||||
0001:3513 __rtonenpop
|
||||
0001:351A __rtbignan
|
||||
0001:3521 __rtifprojpop
|
||||
0001:3528 __rtindfpop
|
||||
0001:352B __rtindfnpop
|
||||
0001:3539 __rttosnpopde
|
||||
0001:3540 __rtifprojnpop
|
||||
0001:3549 __rtchsifneg
|
||||
0001:3552 fFYTOX
|
||||
0001:355E __fFEXP
|
||||
0001:35FB __rtinfpopse
|
||||
0001:35FE __rtinfnpopse
|
||||
0001:360B __fFLN
|
||||
0001:3668 __rtinfpop
|
||||
0001:366B __rtinfnpop
|
||||
0001:3686 __ffexpm1
|
||||
0001:36D7 __fFCOS
|
||||
0001:36F0 __fFSIN
|
||||
0001:382E $i8_output
|
||||
0001:3AEF $i8_tpwr10
|
||||
0001:3B44 $I10_OUTPUT
|
||||
0001:400A __LD12MULTTENPOWER
|
||||
0001:40DF __LD12MULT
|
||||
0001:4264 __MANTOLD12
|
||||
0001:431E __STRINGTOD
|
||||
0001:4386 __STRINGTOLD
|
||||
0001:45EE __forcdecpt
|
||||
0001:4656 __cropzeros
|
||||
0001:46C4 __positive
|
||||
0001:46F2 __fassign
|
||||
0001:474E __cftoe
|
||||
0001:489C __cftof
|
||||
0001:49B2 __cftog
|
||||
0001:4A64 __cfltcvt
|
||||
0001:4ADE _sin
|
||||
0001:4AE4 _cos
|
||||
0001:4AE9 _tan
|
||||
0001:4AEE __aFCIsin
|
||||
0001:4AF4 __aFCIcos
|
||||
0001:4AF9 __aFCItan
|
||||
0001:4AFE __Init80x87
|
||||
0001:4B79 __cintrindisp2
|
||||
0001:4BA2 __cintrindisp1
|
||||
0001:4BC4 __ctrandisp2
|
||||
0001:4BD7 __ctrandisp1
|
||||
0001:4D08 __aFftol
|
||||
0001:4D08 __ftol
|
||||
0001:4D3C __fltin
|
||||
0001:4D92 __fltout
|
||||
0001:4DD8 __fpsignal
|
||||
0001:4E30 _matherr
|
||||
0001:4E40 __cldtoe
|
||||
0001:4FCE __cldtof
|
||||
0001:510C __cldtog
|
||||
0001:517A __cldcvt
|
||||
0001:51D0 __atold
|
||||
0001:5200 __EmDataSeg
|
||||
0001:5210 __fpemulatorbegin
|
||||
0001:523A __fpmath
|
||||
0001:54DE __FPEXCEPTION87
|
||||
0001:5A7F __fpemulator
|
||||
0001:786F __fpemulatorend
|
||||
0001:787A __FPINSTALL87
|
||||
0001:78A9 __FPTERMINATE87
|
||||
0002:0169 __fptaskdata
|
||||
0003:0042 __anullsize
|
||||
0003:0250 _LetterPart
|
||||
0003:0284 _szNumberDesc
|
||||
0003:0298 _szLetterDesc
|
||||
0003:064E __atopsp
|
||||
0003:0650 __aexit_rtn
|
||||
0003:0652 __asizds
|
||||
0003:0654 __nheap_desc
|
||||
0003:0668 __aseghi
|
||||
0003:066A __aseglo
|
||||
0003:066C __acfinfo
|
||||
0003:067A __aintdiv
|
||||
0003:067E __fac
|
||||
0003:0688 _errno
|
||||
0003:068A __umaskval
|
||||
0003:068C __pspadr
|
||||
0003:068E __psp
|
||||
0003:0690 __osversion
|
||||
0003:0690 __dosvermajor
|
||||
0003:0690 __osmajor
|
||||
0003:0691 __osminor
|
||||
0003:0691 __dosverminor
|
||||
0003:0692 __osmode
|
||||
0003:0693 __oserr
|
||||
0003:0693 __doserrno
|
||||
0003:0695 __nfile
|
||||
0003:0697 __osfile
|
||||
0003:06AB ___argc
|
||||
0003:06AD ___argv
|
||||
0003:06AF _environ
|
||||
0003:06B1 __pgmptr
|
||||
0003:06B6 __child
|
||||
0003:06B8 __ovlflag
|
||||
0003:06B9 __intno
|
||||
0003:06BA __ovlvec
|
||||
0003:06BE __adbgmsg
|
||||
0003:06C6 __amblksiz
|
||||
0003:06C8 __cfltcvt_tab
|
||||
0003:06E0 __sigintseg
|
||||
0003:06E2 __sigintoff
|
||||
0003:06E4 __asizeC
|
||||
0003:06E5 __asizeD
|
||||
0003:06E6 __ctype_
|
||||
0003:06E6 __ctype
|
||||
0003:07E8 __indefinite
|
||||
0003:07F2 __piby2
|
||||
0003:07FC __cpower
|
||||
0003:080E __infinity
|
||||
0003:0818 __logemax
|
||||
0003:0840 __ytoxjmptab
|
||||
0003:0870 __logjmptab
|
||||
0003:0888 __lnjmptab
|
||||
0003:08A0 __expjmptab
|
||||
0003:08CA __sinjmptab
|
||||
0003:08E2 __cosjmptab
|
||||
0003:08FA __tanjmptab
|
||||
0003:0912 __cotanjmptab
|
||||
0003:09A4 __80x87
|
||||
0003:0A38 _HUGE
|
||||
0003:0A40 __matherr_flag
|
||||
0003:0A42 ___qczrinit
|
||||
0003:0A44 ___aDBswpflg
|
||||
0003:0A46 ___aDBswpchk
|
||||
0003:0A48 ___aDBrterr
|
||||
0003:0A4A ___aDBexit
|
||||
0003:0A50 ___aDBptrchk
|
||||
0003:0A54 __fpinit
|
||||
0003:0C6C _edata
|
||||
0003:0CE0 _LetterList
|
||||
0003:0CE4 PLOCALHEAP
|
||||
0003:0CE6 _nSafe
|
||||
0003:0CE8 _HunterShotList
|
||||
0003:0CEC _npPlayer
|
||||
0003:0CEE _nCos
|
||||
0003:0EEE _Obj
|
||||
0003:3086 _FlameList
|
||||
0003:308A _wTick
|
||||
0003:308C _nLevel
|
||||
0003:308E _hPen
|
||||
0003:30AE _hAppInst
|
||||
0003:30B0 _HunterList
|
||||
0003:30B4 _SpinnerList
|
||||
0003:30B8 _lScore
|
||||
0003:30BC _nSin
|
||||
0003:32BC _nBadGuys
|
||||
0003:32BE _bRestart
|
||||
0003:32C0 _hAppWnd
|
||||
0003:32C2 _FreeList
|
||||
0003:32C6 _bPaused
|
||||
0003:32C8 _nGravity
|
||||
0003:32CA _ShotList
|
||||
0003:32CE _RoidList
|
||||
0003:32D2 _hAppPalette
|
||||
0003:32D4 _szAppName
|
||||
0003:32F4 _nShield
|
||||
0003:3300 _end
|
||||
|
||||
Program entry point at 0001:29D0
|
||||
|
||||
: error L2029: 'ENDDIALOG' : unresolved external
|
||||
: error L2029: 'ISZOOMED' : unresolved external
|
||||
: error L2029: '_main' : unresolved external
|
||||
: error L2029: 'GETPRIVATEPROFILEINT' : unresolved external
|
||||
: error L2029: 'SELECTPALETTE' : unresolved external
|
||||
: error L2029: 'CREATEWINDOW' : unresolved external
|
||||
: error L2029: 'SETBRUSHORG' : unresolved external
|
||||
: error L2029: 'MULDIV' : unresolved external
|
||||
: error L2029: 'MULDIV' : unresolved external
|
||||
: error L2029: '_wsprintf' : unresolved external
|
||||
: error L2029: '_wsprintf' : unresolved external
|
||||
: error L2029: 'GETPRIVATEPROFILESTRING' : unresolved external
|
||||
: error L2029: 'GETASYNCKEYSTATE' : unresolved external
|
||||
: error L2029: 'RELEASEDC' : unresolved external
|
||||
: error L2029: 'DELETEDC' : unresolved external
|
||||
: error L2029: 'POSTQUITMESSAGE' : unresolved external
|
||||
: error L2029: 'MESSAGEBOX' : unresolved external
|
||||
: error L2029: 'UPDATEWINDOW' : unresolved external
|
||||
: error L2029: 'LOADSTRING' : unresolved external
|
||||
: error L2029: 'GETDC' : unresolved external
|
||||
: error L2029: 'MAKEPROCINSTANCE' : unresolved external
|
||||
: error L2029: 'GETCURRENTTIME' : unresolved external
|
||||
: error L2029: 'FREEPROCINSTANCE' : unresolved external
|
||||
: error L2029: 'CREATEIC' : unresolved external
|
||||
: error L2029: 'SETMAPMODE' : unresolved external
|
||||
: error L2029: 'FILLRECT' : unresolved external
|
||||
: error L2029: 'LOADICON' : unresolved external
|
||||
: error L2029: 'REGISTERCLASS' : unresolved external
|
||||
: error L2029: 'LOADCURSOR' : unresolved external
|
||||
: error L2029: 'GETSYSTEMMENU' : unresolved external
|
||||
: error L2029: 'WRITEPRIVATEPROFILESTRING' : unresolved external
|
||||
: error L2029: 'DRAWICON' : unresolved external
|
||||
: error L2029: 'CREATEPEN' : unresolved external
|
||||
: error L2029: 'CREATESOLIDBRUSH' : unresolved external
|
||||
: error L2029: 'SETVIEWPORTORG' : unresolved external
|
||||
: error L2029: 'ENDPAINT' : unresolved external
|
||||
: error L2029: 'TRANSLATEMESSAGE' : unresolved external
|
||||
: error L2029: 'GETMESSAGE' : unresolved external
|
||||
: error L2029: 'SETWINDOWEXT' : unresolved external
|
||||
: error L2029: 'PTINRECT' : unresolved external
|
||||
: error L2029: 'GETDEVICECAPS' : unresolved external
|
||||
: error L2029: 'DELETEOBJECT' : unresolved external
|
||||
: error L2029: 'KILLTIMER' : unresolved external
|
||||
: error L2029: 'DISPATCHMESSAGE' : unresolved external
|
||||
: error L2029: 'SETVIEWPORTEXT' : unresolved external
|
||||
: error L2029: 'DEFWINDOWPROC' : unresolved external
|
||||
: error L2029: 'SHOWWINDOW' : unresolved external
|
||||
: error L2029: 'SHOWWINDOW' : unresolved external
|
||||
: error L2029: 'GETCLIENTRECT' : unresolved external
|
||||
: error L2029: 'INVALIDATERECT' : unresolved external
|
||||
: error L2029: 'SELECTOBJECT' : unresolved external
|
||||
: error L2029: 'GETINSTANCEDATA' : unresolved external
|
||||
: error L2029: 'SETTIMER' : unresolved external
|
||||
: error L2029: 'BEGINPAINT' : unresolved external
|
||||
: error L2029: 'CHANGEMENU' : unresolved external
|
||||
: error L2029: 'GETWINDOWRECT' : unresolved external
|
||||
: error L2029: 'CREATEPALETTE' : unresolved external
|
||||
: error L2029: 'POLYLINE' : unresolved external
|
||||
: error L2029: 'DIALOGBOX' : unresolved external
|
||||
: error L2029: 'REALIZEPALETTE' : unresolved external
|
||||
: error L2029: 'SETPIXEL' : unresolved external
|
||||
: error L2029: 'GETSYSCOLOR' : unresolved external
|
||||
: error L2029: 'SETWINDOWTEXT' : unresolved external
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
//
|
||||
// HYPEROID.RC - orbiter resources
|
||||
//
|
||||
|
||||
#include <windows.h>
|
||||
#include "hyperoid.h"
|
||||
|
||||
IDI_HYPEROID ICON "hyperoid.ico"
|
||||
IDI_PANIC ICON "panic.ico"
|
||||
|
||||
STRINGTABLE
|
||||
{
|
||||
IDS_NAME, "Hyperoid"
|
||||
IDM_NEW, "New Game&!"
|
||||
IDM_ABOUT, "&About..."
|
||||
}
|
||||
|
||||
//
|
||||
// About box
|
||||
//
|
||||
|
||||
IDD_ABOUT DIALOG LOADONCALL MOVEABLE DISCARDABLE 30, 30, 150, 120
|
||||
CAPTION "About"
|
||||
STYLE WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_SYSMENU | WS_VISIBLE | DS_MODALFRAME | WS_POPUP
|
||||
{
|
||||
CTEXT "Hyperoid", -1, 0, 10, 150, 8
|
||||
CTEXT "The classic game", -1, 0, 20, 150, 8
|
||||
CTEXT "Version 1.1", -1, 0, 30, 150, 8
|
||||
CTEXT "Copyright © 1991 Hutchins Software", -1, 0, 45, 150, 8
|
||||
CTEXT "This program is freeware", -1, 0, 55, 150, 8
|
||||
CTEXT "Author: Edward Hutchins", -1, 0, 65, 150, 8
|
||||
CTEXT "eah1@cec1.wustl.edu", -1, 0, 75, 150, 8
|
||||
CTEXT "", IDD_A_HISCORE, 0, 85, 150, 8
|
||||
ICON IDI_HYPEROID, -1, 10, 16, 0, 0
|
||||
DEFPUSHBUTTON "Ok!", IDOK, 20, 100, 40, 12
|
||||
CONTROL "&Help", IDD_A_HELP, "button", BS_PUSHBUTTON | WS_TABSTOP | WS_CHILD, 90, 100, 40, 12
|
||||
}
|
||||
|
||||
//
|
||||
// bitmaps
|
||||
//
|
||||
|
||||
IDB_blank BITMAP DISCARDABLE "blank.bmp"
|
||||
IDB_bomb BITMAP DISCARDABLE "bomb.bmp"
|
||||
IDB_level BITMAP DISCARDABLE "level.bmp"
|
||||
IDB_life BITMAP DISCARDABLE "life.bmp"
|
||||
IDB_num0 BITMAP DISCARDABLE "num0.bmp"
|
||||
IDB_num1 BITMAP DISCARDABLE "num1.bmp"
|
||||
IDB_num2 BITMAP DISCARDABLE "num2.bmp"
|
||||
IDB_num3 BITMAP DISCARDABLE "num3.bmp"
|
||||
IDB_num4 BITMAP DISCARDABLE "num4.bmp"
|
||||
IDB_num5 BITMAP DISCARDABLE "num5.bmp"
|
||||
IDB_num6 BITMAP DISCARDABLE "num6.bmp"
|
||||
IDB_num7 BITMAP DISCARDABLE "num7.bmp"
|
||||
IDB_num8 BITMAP DISCARDABLE "num8.bmp"
|
||||
IDB_num9 BITMAP DISCARDABLE "num9.bmp"
|
||||
IDB_plus BITMAP DISCARDABLE "plus.bmp"
|
||||
IDB_score BITMAP DISCARDABLE "score.bmp"
|
||||
IDB_shield BITMAP DISCARDABLE "shield.bmp"
|
Before Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 246 B |
|
@ -1,61 +0,0 @@
|
|||
//
|
||||
// LIST - list processing functions for orbiter
|
||||
//
|
||||
// Version: 1.0 Copyright (C) 1990, Hutchins Software
|
||||
// Author: Edward Hutchins
|
||||
// Revisions:
|
||||
//
|
||||
|
||||
#include "orbiter.h"
|
||||
|
||||
//
|
||||
// AddHead - add an object to the head of a list
|
||||
//
|
||||
|
||||
VOID FAR PASCAL AddHead( NPLIST npList, NPNODE npNode )
|
||||
{
|
||||
if (npList->npHead)
|
||||
{
|
||||
npNode->npNext = npList->npHead;
|
||||
npNode->npPrev = NULL;
|
||||
npList->npHead = (npList->npHead->npPrev = npNode);
|
||||
}
|
||||
else // add to an empty list
|
||||
{
|
||||
npList->npHead = npList->npTail = npNode;
|
||||
npNode->npNext = npNode->npPrev = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// RemHead - remove the first element in a list
|
||||
//
|
||||
|
||||
NPNODE FAR PASCAL RemHead( NPLIST npList )
|
||||
{
|
||||
if (npList->npHead)
|
||||
{
|
||||
NPNODE npNode = npList->npHead;
|
||||
if (npList->npTail != npNode)
|
||||
{
|
||||
npList->npHead = npNode->npNext;
|
||||
npNode->npNext->npPrev = NULL;
|
||||
}
|
||||
else npList->npHead = npList->npTail = NULL;
|
||||
return( npNode );
|
||||
}
|
||||
else return( NULL );
|
||||
}
|
||||
|
||||
//
|
||||
// Remove - remove an arbitrary element from a list
|
||||
//
|
||||
|
||||
VOID FAR PASCAL Remove( NPLIST npList, NPNODE npNode )
|
||||
{
|
||||
if (npNode->npPrev) npNode->npPrev->npNext = npNode->npNext;
|
||||
else npList->npHead = npNode->npNext;
|
||||
if (npNode->npNext) npNode->npNext->npPrev = npNode->npPrev;
|
||||
else npList->npTail = npNode->npPrev;
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
########################################################
|
||||
#
|
||||
# hyperoid makefile
|
||||
#
|
||||
# Copyright (C) 1988-1990 Lantern Corp.
|
||||
#
|
||||
########################################################
|
||||
|
||||
# This is just a teaser to show how little you have to do to make projects
|
||||
# under Lantern Corp.'s software engineering system. To make Hyperoid on
|
||||
# your system, make sure <winext.h> is in your include path and set up your
|
||||
# makefile like you normally do for your own stuff.
|
||||
# I'll (hopefully) post the 100k of stuff you need for this makefile to
|
||||
# be usefull. I'll have to talk to my boss first...
|
||||
# P.S. The system only works for the Mircosoft C6.0 compiler, but its easy
|
||||
# enough to change.
|
||||
# P.P.S. I hate every integrated environment I've run across so far, thus
|
||||
# the system is run from a command prompt.
|
||||
|
||||
PROJ = hyperoid
|
||||
OBJS = hyperoid.obj roidsupp.obj
|
||||
RESS = hyperoid.res
|
||||
LIBS =
|
||||
|
||||
!include <windows.mk>
|
||||
|
Before Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 246 B |
|
@ -1,109 +0,0 @@
|
|||
****************************************************************************
|
||||
LEGAL JUNK:
|
||||
|
||||
Hyperoid - a game for Mircosoft Windows (tm)
|
||||
Copyright (C) 1991 Edward Hutchins
|
||||
internet: eah1@cec1.wustl.edu
|
||||
usnail: c/o Edward Hutchins, 63 Ridgemoor Dr., Clayton, MO 63105
|
||||
|
||||
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 1, 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.
|
||||
|
||||
Note: Windows is a trademark of Microsoft Corp. (Duh)
|
||||
|
||||
With this aside,
|
||||
****************************************************************************
|
||||
|
||||
Hello, and Welcome to Hyperoid version 1.1!
|
||||
|
||||
The object of the game is intuitive---shoot everything! (Well, almost
|
||||
everything, heh heh!). If the keyboard buffer overflows in all the
|
||||
excitement, ignore the beeps you hear and they'll go away.
|
||||
|
||||
Hyperoids uses the palette manager, so if you have a palette-capable display
|
||||
(and you read the on-line help pages) you should be able to set up better
|
||||
colors than the Windows defaults. I have tested hyperoids on a monochrome
|
||||
'286, and it seems to work fine. If you want to re-map the keys, look at
|
||||
Appendix A (or the Windows SDK) for some non-ASCII virtual key codes.
|
||||
|
||||
The source is available through the same channel that you got the executable
|
||||
through, as per the GNU general public licence. Please read the licence if
|
||||
you have any questions, or contact me at the above addresses (email
|
||||
preferred).
|
||||
|
||||
If you make modifications/bug fixes to Hyperoid, please use me as a clearing
|
||||
house to prevent versions flooding out into the universe. (You don't have to,
|
||||
but I'd appreciate it :-). If you write the world's greatest game using some
|
||||
of my source, please send me note telling what it is and where it's available.
|
||||
|
||||
Changes since 1.0:
|
||||
Explosion processing a little faster
|
||||
Swarmers (little green guys) no longer flood the system
|
||||
Scoring is better
|
||||
Extra lives every 100,000 points (not 50,000)
|
||||
Firepower reduced a little (hey, the game was too darn easy)
|
||||
Spinning Game Over (Oooooh...)
|
||||
|
||||
Look for:
|
||||
ls - *nix ls command with MUCHO bells&whistles (couldn't live w/out it!)
|
||||
blitfix - util that sets the CS_BYTEALIGNCLIENT bit on all top windows
|
||||
(speeds up my 1024x768 display by a factor of 3)
|
||||
eyecon - xeyes clone (may have to be renamed)
|
||||
ilbm - Amiga IFF bitmap viewer (supports HAM mode and palettes!)
|
||||
life - 7 blit life with a few bells&whistles
|
||||
loadmon - nifty system performance monitor
|
||||
mbrot - mandelbrot hack that runs in the background
|
||||
yow - Zippy the Pinhead in his very own icon, telling it like it is
|
||||
(more games... stuff... junk...)
|
||||
Coming real soon now to a (net,BBS,Wherever this stuff ends up) near YOU!
|
||||
|
||||
Appendix A: Virtual Key Codes
|
||||
-----------------------------
|
||||
|
||||
VK_TAB 9 = default shields
|
||||
VK_RETURN 13
|
||||
VK_SHIFT 16
|
||||
VK_CONTROL 17
|
||||
VK_CAPITAL 20 - useful for autofire!
|
||||
VK_ESCAPE 27 = default boss key
|
||||
VK_SPACE 32 = default fire key
|
||||
VK_PRIOR 33
|
||||
VK_NEXT 34
|
||||
VK_END 35
|
||||
VK_HOME 36
|
||||
VK_LEFT 37 = default counter-clockwise key
|
||||
VK_UP 38 = default reverse thrust key
|
||||
VK_RIGHT 39 = default clockwise key
|
||||
VK_DOWN 40 = default thrust key
|
||||
VK_INSERT 45
|
||||
VK_DELETE 46
|
||||
VK_A-VK_Z 64-90, 83 = default smartbomb key (ASCII 'S')
|
||||
VK_NUMPAD0 96
|
||||
VK_NUMPAD1 97
|
||||
VK_NUMPAD2 98
|
||||
VK_NUMPAD3 99
|
||||
VK_NUMPAD4 100
|
||||
VK_NUMPAD5 101
|
||||
VK_NUMPAD6 102
|
||||
VK_NUMPAD7 103
|
||||
VK_NUMPAD8 104
|
||||
VK_NUMPAD9 105
|
||||
VK_MULTIPLY 106
|
||||
VK_ADD 107
|
||||
VK_SEPARATOR 108
|
||||
VK_SUBTRACT 109
|
||||
VK_DECIMAL 110
|
||||
VK_DIVIDE 111
|
||||
VK_F1-VK_F16 112-127
|
||||
|
|
@ -1,497 +0,0 @@
|
|||
//
|
||||
// ROIDSUPP - hyperoid support functions
|
||||
//
|
||||
// Version: 1.1 Copyright (C) 1991, Hutchins Software
|
||||
// This software is licenced under the GNU General Public Licence
|
||||
// Please read the associated legal documentation
|
||||
// Author: Edward Hutchins
|
||||
// Revisions:
|
||||
// 11/01/91 added GNU General Public License - Ed.
|
||||
//
|
||||
|
||||
#include "hyperoid.h"
|
||||
|
||||
//
|
||||
// defines
|
||||
//
|
||||
|
||||
// you may ask, "why did he embed all these string constants instead of
|
||||
// using the resource file?". Good question. The answer is: I feel better
|
||||
// knowing this stuff is part of the executable, and not part of the resource
|
||||
// file (which can be changed by sneaky people). Or maybe I wuz lazy.
|
||||
// If you don't like it, then YOU can change it!
|
||||
|
||||
#define NL "\x0d\x0a"
|
||||
|
||||
#define HYPEROID_HELP \
|
||||
"The following keys control your ship:" NL NL \
|
||||
" Left, Right Arrow .... spin left or right" NL \
|
||||
" Down, Up Arrow ..... forward or reverse thrust" NL \
|
||||
" Space Bar .............. fire!" NL \
|
||||
" Tab ......................... shields" NL \
|
||||
" S ............................. smartbomb" NL \
|
||||
" Esc ......................... pause/boss key" NL NL \
|
||||
"Note: You have 3 lives, unlimited fuel and firepower, 3 shields and 3 " \
|
||||
"smartbombs. Your ship gets darker when you lose a life, but you keep on " \
|
||||
"playing (unless you hit an asteroid). You get an extra life every 100,000 " \
|
||||
"points. When you lose the game, you start over immediately and can finish " \
|
||||
"off the current level (which should now be 0) before starting over at " \
|
||||
"level 1 (There is no waiting around between games)."
|
||||
|
||||
#define HYPEROID_HELP2 \
|
||||
"The HYPEROID.INI file can be created/modified to change default settings " \
|
||||
"in Hyperoid. Here are some of the items you can set:" NL \
|
||||
NL "[Hyperoid]" NL "Max=<0/1>" NL "{X,Y,W,H}=<n>" NL "Mono=<0/1>" NL \
|
||||
"DrawDelay=<ms> ;microseconds/frame" NL \
|
||||
NL "[Palette]" NL \
|
||||
"{Black,DkGrey,Grey,White," NL \
|
||||
" DkRed,Red,DkGreen,Green,DkBlue,Blue," NL \
|
||||
" DkYellow,Yellow,DkCyan,Cyan," NL \
|
||||
" DkMagenta,Magenta}=<r>,<g>,<b>" NL \
|
||||
NL "[Keys]" NL \
|
||||
"{Shield,Clockwise,CtrClockwise," NL \
|
||||
" Thrust,RevThrust,Fire,Bomb}=<virtual keycode>" NL NL \
|
||||
"Note: Virtual keycodes usually match the key's ASCII value."
|
||||
|
||||
#define HYPEROID_HELPSTYLE (MB_OK | MB_ICONASTERISK)
|
||||
|
||||
// this is the part I especially want in the executable image
|
||||
|
||||
#define HYPEROID_LICENSE \
|
||||
"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 1, or (at your option) " \
|
||||
"any later version. " \
|
||||
NL NL \
|
||||
"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. " \
|
||||
NL NL \
|
||||
"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. "
|
||||
|
||||
//
|
||||
// imports
|
||||
//
|
||||
|
||||
IMPORT CHAR szAppName[32] FROM( hyperoid.c );
|
||||
IMPORT HANDLE hAppInst FROM( hyperoid.c );
|
||||
IMPORT BOOL bBW FROM( hyperoid.c );
|
||||
IMPORT INT nDrawDelay FROM( hyperoid.c );
|
||||
IMPORT INT vkShld FROM( hyperoid.c );
|
||||
IMPORT INT vkClkw FROM( hyperoid.c );
|
||||
IMPORT INT vkCtrClkw FROM( hyperoid.c );
|
||||
IMPORT INT vkThrst FROM( hyperoid.c );
|
||||
IMPORT INT vkRvThrst FROM( hyperoid.c );
|
||||
IMPORT INT vkFire FROM( hyperoid.c );
|
||||
IMPORT INT vkBomb FROM( hyperoid.c );
|
||||
IMPORT LONG lHighScore FROM( hyperoid.c );
|
||||
|
||||
//
|
||||
// globals
|
||||
//
|
||||
|
||||
// these parts map to "abcdefghijklm"
|
||||
GLOBAL POINT LetterPart[] =
|
||||
{
|
||||
{83, 572}, {64, 512}, {45, 572}, {96, 362}, {32, 362},
|
||||
{128, 256}, {0, 0}, {0, 256},
|
||||
{160, 362}, {224, 362}, {173, 572}, {192, 512}, {211, 572}
|
||||
};
|
||||
// here's the vector font
|
||||
GLOBAL NPSTR szNumberDesc[] =
|
||||
{
|
||||
"cakmck", // 0
|
||||
"dbl", // 1
|
||||
"abekm", // 2
|
||||
"abegjlk", // 3
|
||||
"mcfh", // 4
|
||||
"cbfgjlk", // 5
|
||||
"bdiljgi", // 6
|
||||
"acgl", // 7
|
||||
"bdjlieb", // 8
|
||||
"ljebdge" // 9
|
||||
};
|
||||
GLOBAL NPSTR szLetterDesc[] =
|
||||
{
|
||||
"kdbemhf", // A
|
||||
"kabegjlk", // B
|
||||
"cbflm", // C
|
||||
"kabejlk", // D
|
||||
"cafgfkm", // E
|
||||
"cafgfk", // F
|
||||
"bdiljhg", // G
|
||||
"kafhcm", // H
|
||||
"bl", // I
|
||||
"cjli", // J
|
||||
"akcgm", // K
|
||||
"akm", // L
|
||||
"kagcm", // M
|
||||
"kamc", // N
|
||||
"bdiljeb", // O
|
||||
"kabegf", // P
|
||||
"mlidbejl", // Q
|
||||
"kabegfgm", // R
|
||||
"ebdjli", // S
|
||||
"lbac", // T
|
||||
"ailjc", // U
|
||||
"alc", // V
|
||||
"akgmc", // W
|
||||
"amgkc", // X
|
||||
"aglgc", // Y
|
||||
"ackm" // Z
|
||||
};
|
||||
|
||||
//
|
||||
// locals
|
||||
//
|
||||
|
||||
LOCAL CHAR szIni[] = "HYPEROID.INI";
|
||||
LOCAL CHAR szLicense[] = "LicenseRead";
|
||||
LOCAL CHAR szDrawDelay[] = "DrawDelay";
|
||||
LOCAL CHAR szMax[] = "Max";
|
||||
LOCAL CHAR szX[] = "X";
|
||||
LOCAL CHAR szY[] = "Y";
|
||||
LOCAL CHAR szW[] = "W";
|
||||
LOCAL CHAR szH[] = "H";
|
||||
LOCAL CHAR szBW[] = "Mono";
|
||||
LOCAL CHAR szPalette[] = "Palette";
|
||||
LOCAL CHAR szKeys[] = "Keys";
|
||||
LOCAL CHAR szShield[] = "Shield";
|
||||
LOCAL CHAR szClockwise[] = "Clockwise";
|
||||
LOCAL CHAR szCtrClockwise[] = "CtrClockwise";
|
||||
LOCAL CHAR szThrust[] = "Thrust";
|
||||
LOCAL CHAR szRevThrust[] = "RevThrust";
|
||||
LOCAL CHAR szFire[] = "Fire";
|
||||
LOCAL CHAR szBomb[] = "Bomb";
|
||||
LOCAL CHAR szHi[] = "Hi";
|
||||
LOCAL CHAR *szColorName[] =
|
||||
{
|
||||
"Black", "DkGrey", "Grey", "White",
|
||||
"DkRed", "Red", "DkGreen", "Green", "DkBlue", "Blue",
|
||||
"DkYellow", "Yellow", "DkCyan", "Cyan", "DkMagenta", "Magenta"
|
||||
};
|
||||
LOCAL DWORD dwColors[] =
|
||||
{
|
||||
RGB(0,0,0), RGB(128,128,128),
|
||||
RGB(192,192,192), RGB(255,255,255),
|
||||
RGB(128,0,0), RGB(255,0,0),
|
||||
RGB(0,128,0), RGB(0,255,0),
|
||||
RGB(0,0,128), RGB(0,0,255),
|
||||
RGB(128,128,0), RGB(255,255,0),
|
||||
RGB(0,128,128), RGB(0,255,255),
|
||||
RGB(128,0,128), RGB(255,0,255),
|
||||
};
|
||||
|
||||
//
|
||||
// PrintLetters - create letter objects from a string
|
||||
//
|
||||
|
||||
VOID FAR PASCAL PrintLetters( NPSTR npszText, POINT Pos, POINT Vel,
|
||||
BYTE byColor, INT nSize )
|
||||
{
|
||||
INT nLen = strlen( npszText );
|
||||
INT nCnt = nLen;
|
||||
INT nSpace = nSize + nSize / 2;
|
||||
INT nBase = (nLen - 1) * nSpace;
|
||||
INT nBaseStart = Pos.x + nBase / 2;
|
||||
|
||||
while (nCnt--)
|
||||
{
|
||||
NPOBJ npLtr = CreateLetter( npszText[nCnt], nSize / 2 );
|
||||
if (npLtr)
|
||||
{
|
||||
npLtr->Pos.x = nBaseStart;
|
||||
npLtr->Pos.y = Pos.y;
|
||||
npLtr->Vel = Vel;
|
||||
npLtr->byColor = byColor;
|
||||
}
|
||||
nBaseStart -= nSpace;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// SpinLetters - spin letter objects away from center for effect
|
||||
//
|
||||
|
||||
VOID FAR PASCAL SpinLetters( NPSTR npszText, POINT Pos, POINT Vel,
|
||||
BYTE byColor, INT nSize )
|
||||
{
|
||||
INT nLen = strlen( npszText );
|
||||
INT nCnt = nLen;
|
||||
INT nSpace = nSize + nSize / 2;
|
||||
INT nBase = (nLen - 1) * nSpace;
|
||||
INT nBaseStart = Pos.x + nBase / 2;
|
||||
|
||||
while (nCnt--)
|
||||
{
|
||||
NPOBJ npLtr = CreateLetter( npszText[nCnt], nSize / 2 );
|
||||
if (npLtr)
|
||||
{
|
||||
INT nSpin = (nCnt - nLen / 2) * 2;
|
||||
npLtr->Pos.x = nBaseStart;
|
||||
npLtr->Pos.y = Pos.y;
|
||||
npLtr->Vel = Vel;
|
||||
npLtr->Vel.x += nSpin * 16;
|
||||
npLtr->nSpin = -nSpin;
|
||||
npLtr->byColor = byColor;
|
||||
}
|
||||
nBaseStart -= nSpace;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// CreateHyperoidPalette - create a logical palette
|
||||
//
|
||||
|
||||
HPALETTE FAR PASCAL CreateHyperoidPalette( VOID )
|
||||
{
|
||||
HPALETTE hPalette;
|
||||
HDC hIC = CreateIC( "DISPLAY", NULL, NULL, NULL );
|
||||
INT t;
|
||||
PALETTEENTRY Pal[PALETTE_SIZE + 2];
|
||||
NPLOGPALETTE npLogPalette = (NPLOGPALETTE)Pal;
|
||||
|
||||
// are we forced into using b&w?
|
||||
bBW = FALSE;
|
||||
if (GetDeviceCaps( hIC, NUMCOLORS ) < 8) bBW = TRUE;
|
||||
DeleteDC( hIC );
|
||||
if (GetPrivateProfileInt( szAppName, szBW, FALSE, szIni )) bBW = TRUE;
|
||||
|
||||
npLogPalette->palVersion = 0x0300;
|
||||
npLogPalette->palNumEntries = PALETTE_SIZE;
|
||||
|
||||
for (t = 0; t < PALETTE_SIZE; ++t)
|
||||
{
|
||||
DWORD dwColor = dwColors[t];
|
||||
CHAR szBuff[32];
|
||||
|
||||
GetPrivateProfileString( szPalette, szColorName[t], "",
|
||||
szBuff, sizeof(szBuff), szIni );
|
||||
if (szBuff[0])
|
||||
{
|
||||
INT r, g, b;
|
||||
NPSTR npBuff = szBuff;
|
||||
r = g = b = 255;
|
||||
while (*npBuff == ' ') ++npBuff;
|
||||
r = atoi( npBuff );
|
||||
while (*npBuff && *npBuff != ',') ++npBuff;
|
||||
if (*npBuff == ',') g = atoi( ++npBuff );
|
||||
while (*npBuff && *npBuff != ',') ++npBuff;
|
||||
if (*npBuff == ',') b = atoi( ++npBuff );
|
||||
dwColor = RGB( r, g, b );
|
||||
}
|
||||
if (bBW) dwColor = ((dwColor == RGB(0,0,0)) ? RGB(0,0,0) : RGB(255,255,255));
|
||||
npLogPalette->palPalEntry[t].peRed = GetRValue( dwColor );
|
||||
npLogPalette->palPalEntry[t].peGreen = GetGValue( dwColor );
|
||||
npLogPalette->palPalEntry[t].peBlue = GetBValue( dwColor );
|
||||
npLogPalette->palPalEntry[t].peFlags = 0;
|
||||
}
|
||||
|
||||
hPalette = CreatePalette( npLogPalette );
|
||||
return( hPalette );
|
||||
}
|
||||
|
||||
//
|
||||
// CreateHyperoidClass - create the class of Hyperoid's window
|
||||
//
|
||||
|
||||
BOOL FAR PASCAL CreateHyperoidClass( VOID )
|
||||
{
|
||||
WNDCLASS Class;
|
||||
|
||||
// load the name from the resource file
|
||||
LoadString( hAppInst, IDS_NAME, szAppName, sizeof(szAppName) );
|
||||
|
||||
Class.style = CS_HREDRAW | CS_VREDRAW;
|
||||
Class.lpfnWndProc = HyperoidWndProc;
|
||||
Class.cbClsExtra = 0;
|
||||
Class.cbWndExtra = 0;
|
||||
Class.hInstance = hAppInst;
|
||||
Class.hIcon = NULL;
|
||||
Class.hCursor = LoadCursor( NULL, IDC_CROSS );
|
||||
Class.hbrBackground = HNULL;
|
||||
Class.lpszMenuName = szAppName;
|
||||
Class.lpszClassName = szAppName;
|
||||
|
||||
return( RegisterClass( &Class ) );
|
||||
}
|
||||
|
||||
//
|
||||
// SetHyperoidMenu - add Hyperoid's menu items to the system menu
|
||||
//
|
||||
|
||||
VOID NEAR PASCAL SetHyperoidMenu( HWND hWnd, INT nFirstID, INT nLastID )
|
||||
{
|
||||
CHAR szMenuName[40];
|
||||
HMENU hMenu;
|
||||
|
||||
hMenu = GetSystemMenu( hWnd, TRUE );
|
||||
if (hMenu == HNULL) hMenu = GetSystemMenu( hWnd, FALSE );
|
||||
if (hMenu == HNULL) return;
|
||||
|
||||
while (nFirstID <= nLastID)
|
||||
{
|
||||
LoadString( hAppInst, nFirstID, szMenuName, sizeof(szMenuName) );
|
||||
ChangeMenu( hMenu, 0, szMenuName, nFirstID, MF_APPEND );
|
||||
++nFirstID;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// CreateHyperoidWindow - open the Hyperoid window
|
||||
//
|
||||
|
||||
HWND FAR PASCAL CreateHyperoidWindow( LPSTR lpszCmd, INT nCmdShow )
|
||||
{
|
||||
HWND hWnd;
|
||||
INT x, y, w, h;
|
||||
CHAR szBuff[32];
|
||||
|
||||
// get the highscore profile here for lack of a better place...
|
||||
GetPrivateProfileString( szAppName, szHi, "0", szBuff, sizeof(szBuff), szIni );
|
||||
lHighScore = atol( szBuff );
|
||||
|
||||
x = GetPrivateProfileInt( szAppName, szX, CW_USEDEFAULT, szIni );
|
||||
y = GetPrivateProfileInt( szAppName, szY, CW_USEDEFAULT, szIni );
|
||||
w = GetPrivateProfileInt( szAppName, szW, CW_USEDEFAULT, szIni );
|
||||
h = GetPrivateProfileInt( szAppName, szH, CW_USEDEFAULT, szIni );
|
||||
if (GetPrivateProfileInt( szAppName, szMax, FALSE, szIni ) &&
|
||||
nCmdShow == SW_NORMAL) nCmdShow = SW_SHOWMAXIMIZED;
|
||||
|
||||
hWnd = CreateWindow( szAppName, szAppName, WS_OVERLAPPEDWINDOW,
|
||||
x, y, w, h, HNULL, HNULL, hAppInst, NULL );
|
||||
if (hWnd == HNULL) return( HNULL );
|
||||
|
||||
ShowWindow( hWnd, nCmdShow );
|
||||
UpdateWindow( hWnd );
|
||||
SetHyperoidMenu( hWnd, IDM_NEW, IDM_ABOUT );
|
||||
|
||||
// show the license...
|
||||
if (!GetPrivateProfileInt( szAppName, szLicense, FALSE, szIni ))
|
||||
{
|
||||
MessageBeep( HYPEROID_HELPSTYLE );
|
||||
MessageBox( hWnd, HYPEROID_LICENSE, "Hyperoid License", HYPEROID_HELPSTYLE );
|
||||
// ...and never show it again (unless they want to see it)
|
||||
WritePrivateProfileString( szAppName, szLicense, "1", szIni );
|
||||
}
|
||||
|
||||
return( hWnd );
|
||||
}
|
||||
|
||||
//
|
||||
// SaveHyperoidWindowPos - write out the .ini information
|
||||
//
|
||||
|
||||
VOID FAR PASCAL SaveHyperoidWindowPos( HWND hWnd )
|
||||
{
|
||||
RECT rect;
|
||||
CHAR szBuff[32];
|
||||
|
||||
// save the highscore profile here for lack of a better place...
|
||||
if (lHighScore)
|
||||
{
|
||||
wsprintf( szBuff, "%lu", lHighScore );
|
||||
WritePrivateProfileString( szAppName, szHi, szBuff, szIni );
|
||||
}
|
||||
|
||||
if (IsIconic( hWnd )) return;
|
||||
if (IsZoomed( hWnd ))
|
||||
{
|
||||
WritePrivateProfileString( szAppName, szMax, "1", szIni );
|
||||
return;
|
||||
}
|
||||
else WritePrivateProfileString( szAppName, szMax, NULL, szIni );
|
||||
|
||||
GetWindowRect( hWnd, &rect );
|
||||
wsprintf( szBuff, "%d", rect.left );
|
||||
WritePrivateProfileString( szAppName, szX, szBuff, szIni );
|
||||
wsprintf( szBuff, "%d", rect.top );
|
||||
WritePrivateProfileString( szAppName, szY, szBuff, szIni );
|
||||
wsprintf( szBuff, "%d", rect.right - rect.left );
|
||||
WritePrivateProfileString( szAppName, szW, szBuff, szIni );
|
||||
wsprintf( szBuff, "%d", rect.bottom - rect.top );
|
||||
WritePrivateProfileString( szAppName, szH, szBuff, szIni );
|
||||
}
|
||||
|
||||
//
|
||||
// GetHyperoidIni - load the ini file information
|
||||
//
|
||||
|
||||
VOID FAR PASCAL GetHyperoidIni( VOID )
|
||||
{
|
||||
nDrawDelay = GetPrivateProfileInt( szAppName, szDrawDelay, DRAW_DELAY, szIni );
|
||||
vkShld = GetPrivateProfileInt( szKeys, szShield, VK_TAB, szIni );
|
||||
vkClkw = GetPrivateProfileInt( szKeys, szClockwise, VK_LEFT, szIni );
|
||||
vkCtrClkw = GetPrivateProfileInt( szKeys, szCtrClockwise, VK_RIGHT, szIni );
|
||||
vkThrst = GetPrivateProfileInt( szKeys, szThrust, VK_DOWN, szIni );
|
||||
vkRvThrst = GetPrivateProfileInt( szKeys, szRevThrust, VK_UP, szIni );
|
||||
vkFire = GetPrivateProfileInt( szKeys, szFire, VK_SPACE, szIni );
|
||||
vkBomb = GetPrivateProfileInt( szKeys, szBomb, 'S', szIni );
|
||||
}
|
||||
|
||||
//
|
||||
// HyperoidHelp - show help
|
||||
//
|
||||
|
||||
VOID FAR PASCAL HyperoidHelp( HWND hWnd )
|
||||
{
|
||||
MessageBox( hWnd, HYPEROID_HELP, "Hyperoid help", HYPEROID_HELPSTYLE );
|
||||
MessageBox( hWnd, HYPEROID_HELP2, "Hyperoid.ini help", HYPEROID_HELPSTYLE );
|
||||
}
|
||||
|
||||
//
|
||||
// HyperoidAboutDlg - the about box proc
|
||||
//
|
||||
|
||||
BOOL FAR PASCAL EXPORT HyperoidAboutDlg( HWND hDlg, WORD mess,
|
||||
WORD wParam, LONG lParam )
|
||||
{
|
||||
switch (mess)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
if (lHighScore)
|
||||
{
|
||||
CHAR szBuff[40];
|
||||
wsprintf( szBuff, "High Score: %7.7lu", lHighScore );
|
||||
SetDlgItemText( hDlg, IDD_A_HISCORE, szBuff );
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (wParam)
|
||||
{
|
||||
case IDD_A_HELP:
|
||||
HyperoidHelp( hDlg );
|
||||
// fall through...
|
||||
case IDOK:
|
||||
EndDialog( hDlg, 0 );
|
||||
break;
|
||||
|
||||
default:
|
||||
return( FALSE );
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
EndDialog( hDlg, FALSE );
|
||||
break;
|
||||
|
||||
default:
|
||||
return( FALSE );
|
||||
}
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
//
|
||||
// AboutHyperoid - show the about box
|
||||
//
|
||||
|
||||
VOID FAR PASCAL AboutHyperoid( HWND hWnd )
|
||||
{
|
||||
FARPROC lpprocAbout = MakeProcInstance( HyperoidAboutDlg, hAppInst );
|
||||
DialogBox( hAppInst, INTRES( IDD_ABOUT ), hWnd, lpprocAbout );
|
||||
FreeProcInstance( lpprocAbout );
|
||||
}
|
Before Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 246 B |
|
@ -1,109 +0,0 @@
|
|||
#if !defined(WINEXT_H)
|
||||
#define WINEXT_H
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
//
|
||||
// WINEXT.H - additional windows definitions
|
||||
//
|
||||
// Version 1.0 03/21/89 Copyright (C) 1989,90,91 Lantern Coroporation.
|
||||
// Author: Edward Hutchins
|
||||
// Status: Freeware
|
||||
// Revisions:
|
||||
// 06/06/90 modified HUGE to LARGE to preserve compatibility with math.h
|
||||
// also nested windows.h include to prevent modifications on the
|
||||
// actual source file - Ed.
|
||||
// 10/01/90 added CONST and CONSTP,NP,LP,HP and a few comments - Ed.
|
||||
// 08/28/91 added EXPORT and SEGMENT - Ed.
|
||||
// 10/28/91 added DLLEXP - Ed.
|
||||
// 11/02/91 posted on Compuserve - Ed.
|
||||
//
|
||||
|
||||
//
|
||||
// include WINDOWS.H, if needed
|
||||
//
|
||||
|
||||
#if !defined(WINDOWS_H)
|
||||
#if defined(NULL)
|
||||
#undef NULL
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#if !defined(NULL)
|
||||
#define NULL 0
|
||||
#endif
|
||||
#define WINDOWS_H
|
||||
#endif // WINDOWS_H
|
||||
|
||||
//
|
||||
// extra data types and defines
|
||||
//
|
||||
|
||||
#define LARGE huge
|
||||
#define CDECL cdecl
|
||||
#define CONST const
|
||||
#define HNULL (0)
|
||||
#define LPNULL (0L)
|
||||
|
||||
typedef char CHAR;
|
||||
typedef int INT;
|
||||
typedef float FLOAT;
|
||||
typedef double DOUBLE;
|
||||
typedef long double LDOUBLE;
|
||||
|
||||
// extend the string type
|
||||
typedef CHAR LARGE *HPSTR;
|
||||
|
||||
// useful macros for typedefing pointers to objects //
|
||||
#define npointerdef(o) typedef o NEAR * NP ## o
|
||||
#define lpointerdef(o) typedef o FAR * LP ## o
|
||||
#define hpointerdef(o) typedef o LARGE * HP ## o
|
||||
#define pointerdef(o) npointerdef(o); lpointerdef(o); hpointerdef(o)
|
||||
|
||||
// define the different kinds of pointers to things //
|
||||
pointerdef( BOOL );
|
||||
npointerdef( BYTE ); hptrdef( BYTE );
|
||||
pointerdef( CHAR );
|
||||
npointerdef( INT ); hpointerdef( INT );
|
||||
npointerdef( WORD ); hpointerdef( WORD );
|
||||
npointerdef( LONG ); hpointerdef( LONG );
|
||||
npointerdef( DWORD ); hpointerdef( DWORD );
|
||||
pointerdef( FLOAT );
|
||||
pointerdef( DOUBLE );
|
||||
pointerdef( LDOUBLE );
|
||||
npointerdef( HANDLE ); hpointerdef( HANDLE );
|
||||
npointerdef( VOID ); hpointerdef( VOID );
|
||||
|
||||
// these are here for compatibility - use NPVOID etc...
|
||||
typedef VOID NEAR *NPMEM;
|
||||
typedef VOID FAR *LPMEM;
|
||||
|
||||
// window proc function pointer
|
||||
typedef LONG (FAR PASCAL *WNDPROC)( HWND, unsigned, WORD, LONG );
|
||||
|
||||
//
|
||||
// scope protocol definitions
|
||||
//
|
||||
|
||||
#define GLOBAL // GLOBAL
|
||||
#define LOCAL static
|
||||
#define IMPORT extern
|
||||
#define FROM(where) // FROM where
|
||||
#define PROTO // PROTOTYPE
|
||||
|
||||
#define EXPORT _export
|
||||
#define SEGMENT _segment
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
// c++ class export type
|
||||
#if defined(__DLL__)
|
||||
#define DLLEXP EXPORT
|
||||
#else
|
||||
#define DLLEXP LARGE
|
||||
#endif
|
||||
|
||||
#endif // WINEXT_H
|
|
@ -0,0 +1,442 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 1991 by TRG ELECTRONIK *
|
||||
* *
|
||||
* widget.C *
|
||||
* widget Inventory Controler PART # 1 *
|
||||
* *
|
||||
**********************************************************************/
|
||||
|
||||
#include <WINDOWS.H>
|
||||
#include "STDIO.h"
|
||||
#include "STDLIB.h"
|
||||
#include "STDARG.h"
|
||||
#include "STRING.H"
|
||||
|
||||
#include "widget.H"
|
||||
#include "widget.VAR"
|
||||
#include "widget.P"
|
||||
|
||||
#define NoREF(a) a=a
|
||||
|
||||
WORD wPlayDiskID;
|
||||
|
||||
HWND hWndBut;
|
||||
HWND hWndChk;
|
||||
HWND hWndRadio;
|
||||
HWND hWndLBox;
|
||||
HWND hWndScrol;
|
||||
HWND hWndScro2;
|
||||
HWND hWndStat;
|
||||
HWND hWndEdit;
|
||||
HWND hWndCBox;
|
||||
int x, y;
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
|
||||
int PASCAL WinMain(HANDLE hInstance,HANDLE hPrevInstance,
|
||||
LPSTR lpszCmdLine,int nCmdShow)
|
||||
{
|
||||
WNDCLASS wndClass;
|
||||
MSG msg;
|
||||
HWND hWnd;
|
||||
HDC hDC;
|
||||
char C[40];
|
||||
int X;
|
||||
NoREF(lpszCmdLine);
|
||||
if ( !hPrevInstance )
|
||||
{
|
||||
wndClass.style = CS_HREDRAW | CS_VREDRAW ;
|
||||
wndClass.lpfnWndProc = (WNDPROC)WndProc;
|
||||
wndClass.cbClsExtra = 0;
|
||||
wndClass.cbWndExtra = 0;
|
||||
wndClass.hInstance = hInstance;
|
||||
wndClass.hIcon = LoadIcon(hInstance,(LPSTR)"ICON_1");
|
||||
wndClass.hCursor = LoadCursor(NULL, IDC_ARROW );
|
||||
wndClass.hbrBackground = GetStockObject(WHITE_BRUSH );
|
||||
wndClass.lpszMenuName = szAppName;
|
||||
wndClass.lpszClassName = szAppName;
|
||||
if (!RegisterClass(&wndClass))
|
||||
return FALSE;
|
||||
}
|
||||
hWnd = CreateWindow(szAppName, "widget test program",
|
||||
WS_POPUP | WS_BORDER | WS_VISIBLE, 50, 50,
|
||||
400, 400, NULL, NULL, hInstance, NULL);
|
||||
hWndMain = hWnd;
|
||||
hInst = hInstance;
|
||||
hDCMain = GetDC(hWndMain);
|
||||
|
||||
InitWidgets();
|
||||
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg );
|
||||
DispatchMessage(&msg );
|
||||
}
|
||||
ReleaseDC(hWndMain, hDC);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
void InitWidgets()
|
||||
{
|
||||
hWndBut = CreateWindow("BUTTON", "Button #1",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | BS_PUSHBUTTON,
|
||||
230, 40, 80, 30, hWndMain, 1001, hInst, NULL);
|
||||
hWndScrol = CreateWindow("SCROLLBAR", "Scroll #1",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SBS_VERT,
|
||||
200, 140, 15, 100, hWndMain, 1004, hInst, NULL);
|
||||
hWndScro2 = CreateWindow("SCROLLBAR", "Scroll #2",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SBS_HORZ,
|
||||
50, 140, 100, 15, hWndMain, 1005, hInst, NULL);
|
||||
x = y = 25;
|
||||
SetVertScroll(NULL, hWndScrol, 25, 0, 50);
|
||||
SetScrollRange(hWndScro2, SB_CTL, 0, 50, TRUE);
|
||||
SetScrollPos(hWndScro2, SB_CTL, 25, TRUE);
|
||||
hWndLBox = CreateWindow("LISTBOX", "",
|
||||
WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | LBS_NOTIFY,
|
||||
230, 160, 150, 100, hWndMain, 1004, hInst, NULL);
|
||||
SendMessage(hWndLBox, LB_ADDSTRING, 0, (LPARAM)"ListBox item #1");
|
||||
}
|
||||
|
||||
|
||||
|
||||
long FAR PASCAL WndProc(HWND hWnd, unsigned Message, WORD wParam, LONG lParam)
|
||||
{
|
||||
int ShiftState;
|
||||
char C[80];
|
||||
ShiftState = GetKeyState(VK_SHIFT);
|
||||
switch(Message)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
if (LOWORD(lParam) != 0)
|
||||
{
|
||||
sprintf(C, "MAIN WM_COMMAND wParam=%X lParam=%lX !!!", wParam, lParam);
|
||||
TextOut(hDCMain, 25, 280, C, strlen(C));
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_KEYDOWN:
|
||||
sprintf(C, "WM_KEYDOWN !!!");
|
||||
TextOut(hDCMain, 25, 40, C, strlen(C));
|
||||
KeyDown(hWnd, Message, wParam);
|
||||
break;
|
||||
|
||||
case WM_CHAR:
|
||||
sprintf(C, "WM_CHAR !!!");
|
||||
TextOut(hDCMain, 25, 50, C, strlen(C));
|
||||
break;
|
||||
|
||||
case WM_LBUTTONDOWN:
|
||||
break;
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
break;
|
||||
|
||||
case WM_RBUTTONDOWN:
|
||||
break;
|
||||
|
||||
case WM_RBUTTONUP:
|
||||
break;
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
break;
|
||||
|
||||
case WM_VSCROLL:
|
||||
sprintf(C, "WM_VSCROLL %X %X %lX !!!", Message, wParam, lParam);
|
||||
TextOut(hDCMain, 25, 370, C, strlen(C));
|
||||
Do_Dlg_VertScroll(hWnd, wParam, lParam, &y, 0, 50);
|
||||
break;
|
||||
|
||||
case WM_HSCROLL:
|
||||
sprintf(C, "WM_HSCROLL %X %X %lX !!!", Message, wParam, lParam);
|
||||
TextOut(hDCMain, 25, 370, C, strlen(C));
|
||||
Do_Dlg_HorzScroll(hWnd, wParam, lParam, &x, 0, 50);
|
||||
break;
|
||||
|
||||
case WM_PAINT:
|
||||
DoPaint(hWnd);
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefWindowProc(hWnd, Message, wParam, lParam);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOL KeyDown(HWND hWnd, unsigned Message, WORD wParam)
|
||||
{
|
||||
WORD wRet;
|
||||
UINT uRet;
|
||||
DWORD dwRet;
|
||||
char C[128];
|
||||
char C2[64];
|
||||
NoREF(hWnd);
|
||||
NoREF(Message);
|
||||
sprintf(C, "KeyDown %x !!!", wParam);
|
||||
TextOut(hDCMain, 25, 100, C, strlen(C));
|
||||
switch (wParam)
|
||||
{
|
||||
case VK_HOME: /* 'HOME' KEY */
|
||||
break;
|
||||
case VK_LEFT: /* 'LEFT' CURSOR KEY */
|
||||
break;
|
||||
case VK_RIGHT: /* 'RIGHT' CURSOR KEY */
|
||||
break;
|
||||
case VK_UP: /* 'UP' CURSOR KEY */
|
||||
break;
|
||||
case VK_DOWN: /* 'DOWN' CURSOR KEY */
|
||||
break;
|
||||
case VK_PRIOR: /* 'PGUP' CURSOR KEY */
|
||||
break;
|
||||
case VK_NEXT: /* 'PGDN' CURSOR KEY */
|
||||
break;
|
||||
case '1':
|
||||
break;
|
||||
case '2':
|
||||
break;
|
||||
case '3':
|
||||
break;
|
||||
case '4':
|
||||
break;
|
||||
case '5':
|
||||
break;
|
||||
case 'A':
|
||||
break;
|
||||
case 'B':
|
||||
break;
|
||||
case 'C':
|
||||
break;
|
||||
case 'D':
|
||||
break;
|
||||
case 'E':
|
||||
break;
|
||||
case 'F':
|
||||
break;
|
||||
case 'G':
|
||||
break;
|
||||
case 'H':
|
||||
WinHelp(hWndMain, "toto.hlp", HELP_INDEX, 0L);
|
||||
break;
|
||||
case 'J':
|
||||
WinExec("/D:/wine/widget.exe arg1 arg2 arg3 arg4 arg5 arg6", SW_NORMAL);
|
||||
break;
|
||||
case 'K':
|
||||
break;
|
||||
case 'Q':
|
||||
hWndStat = CreateWindow("STATIC", "Static #1",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_SIMPLE,
|
||||
230, 20, 80, 20, hWndMain, 1000, hInst, NULL);
|
||||
break;
|
||||
case 'W':
|
||||
hWndChk = CreateWindow("BUTTON", "CheckBox #1",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | BS_CHECKBOX,
|
||||
230, 90, 120, 20, hWndMain, 1002, hInst, NULL);
|
||||
break;
|
||||
case 'R':
|
||||
hWndRadio = CreateWindow("BUTTON", "RadioBut #1",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | BS_RADIOBUTTON,
|
||||
230, 120, 120, 20, hWndMain, 1003, hInst, NULL);
|
||||
SendMessage(hWndRadio, BM_SETCHECK, 0, 0L);
|
||||
break;
|
||||
case 'T':
|
||||
SendMessage(hWndLBox, LB_ADDSTRING, 0, (LPARAM)"ListBox Single item");
|
||||
break;
|
||||
case 'Y':
|
||||
SendMessage(hWndLBox, LB_ADDSTRING, 0, (LPARAM)"ListBox item #2");
|
||||
SendMessage(hWndLBox, LB_ADDSTRING, 0, (LPARAM)"ListBox item #3");
|
||||
SendMessage(hWndLBox, LB_ADDSTRING, 0, (LPARAM)"ListBox item #4");
|
||||
SendMessage(hWndLBox, LB_ADDSTRING, 0, (LPARAM)"ListBox item #5");
|
||||
SendMessage(hWndLBox, LB_ADDSTRING, 0, (LPARAM)"ListBox item #6");
|
||||
SendMessage(hWndLBox, LB_SETCURSEL, 3, 0L);
|
||||
SendMessage(hWndLBox, LB_INSERTSTRING, 5, (LPARAM)"Item between 5 & 6");
|
||||
wRet = SendMessage(hWndLBox, LB_FINDSTRING, -1, (LPARAM)"Item between 5 & 6");
|
||||
sprintf(C, "LB_FINDSTRING returned #%u ", wRet);
|
||||
TextOut(hDCMain, 25, 300, C, strlen(C));
|
||||
wRet = SendMessage(hWndLBox, LB_GETCURSEL, 0, 0L);
|
||||
sprintf(C, "LB_GETCURSEL returned #%u ", wRet);
|
||||
TextOut(hDCMain, 25, 320, C, strlen(C));
|
||||
break;
|
||||
case 'U':
|
||||
SendMessage(hWndLBox, LB_DELETESTRING, 3, 0L);
|
||||
break;
|
||||
case 'I':
|
||||
SendMessage(hWndLBox, LB_RESETCONTENT, 0, 0L);
|
||||
break;
|
||||
case 'O':
|
||||
C2[0] = '\0';
|
||||
SendMessage(hWndLBox, LB_GETTEXT, 2, (DWORD)C2);
|
||||
sprintf(C, "LB_GETTEXT returned '%s' ", C2);
|
||||
TextOut(hDCMain, 25, 320, C, strlen(C));
|
||||
break;
|
||||
case 'P':
|
||||
SendMessage(hWndLBox, LB_DIR, 0, (DWORD)"*.*");
|
||||
break;
|
||||
case 'Z':
|
||||
ShowWindow(hWndScrol, SW_HIDE);
|
||||
break;
|
||||
case 'X':
|
||||
ShowWindow(hWndScrol, SW_SHOW);
|
||||
break;
|
||||
case 'V':
|
||||
hWndCBox = CreateWindow("COMBOBOX", "Combo #1",
|
||||
WS_CHILD | WS_VISIBLE | WS_BORDER | CBS_DROPDOWNLIST,
|
||||
230, 270, 150, 100, hWndMain, 1006, hInst, NULL);
|
||||
SendMessage(hWndCBox, CB_ADDSTRING, 0, (LPARAM)"ComboBox item #1");
|
||||
SendMessage(hWndCBox, CB_ADDSTRING, 0, (LPARAM)"ComboBox item #2");
|
||||
break;
|
||||
case 'N':
|
||||
hWndCBox = CreateWindow("COMBOBOX", "Combo #2",
|
||||
WS_CHILD | WS_VISIBLE | WS_BORDER | CBS_DROPDOWN,
|
||||
30, 270, 150, 100, hWndMain, 1007, hInst, NULL);
|
||||
SendMessage(hWndCBox, CB_ADDSTRING, 0, (LPARAM)"ComboBox item #1");
|
||||
SendMessage(hWndCBox, CB_ADDSTRING, 0, (LPARAM)"ComboBox item #2");
|
||||
break;
|
||||
|
||||
case VK_F10: /* 'F10' FUNCTION KEY */
|
||||
break;
|
||||
case VK_F11: /* 'F11' FUNCTION KEY */
|
||||
break;
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DoPaint(HWND hWnd)
|
||||
{
|
||||
HDC hDC;
|
||||
RECT rect;
|
||||
PAINTSTRUCT ps;
|
||||
char C[80];
|
||||
GetClientRect(hWnd, &rect);
|
||||
hDC = BeginPaint(hWnd, &ps);
|
||||
FillRect(hDC, &rect, GetStockObject(GRAY_BRUSH));
|
||||
InflateRect(&rect, -3, -3);
|
||||
FrameRect(hDC, &rect, GetStockObject(BLACK_BRUSH));
|
||||
InflateRect(&rect, -10, -10);
|
||||
FillRect(hDC, &rect, GetStockObject(WHITE_BRUSH));
|
||||
sprintf(C, "Wine Testing !!!");
|
||||
TextOut(hDC, 25, 25, C, strlen(C));
|
||||
ReleaseDC(hWnd,hDC);
|
||||
EndPaint(hWnd,&ps);
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
|
||||
void SetVertScroll(int hDlg, int hWndSCROLL, int VAL, int MIN, int MAX)
|
||||
{
|
||||
char C[12];
|
||||
SetScrollRange(hWndSCROLL, SB_CTL, -MAX, -MIN, FALSE);
|
||||
SetScrollPos(hWndSCROLL, SB_CTL, -VAL, TRUE);
|
||||
itoa(VAL, C, 10);
|
||||
//SetDlgItemText(hDlg, (IDDTXT1 + GetDlgCtrlID(hWndSCROLL) - IDDSCROLL1), C);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SetHorzScroll(int hDlg, int hWndSCROLL, int VAL, int MIN, int MAX)
|
||||
{
|
||||
char C[12];
|
||||
SetScrollRange(hWndSCROLL, SB_CTL, MAX, MIN, FALSE);
|
||||
SetScrollPos(hWndSCROLL, SB_CTL, VAL, TRUE);
|
||||
itoa(VAL, C, 10);
|
||||
//SetDlgItemText(hDlg, (IDDTXT1 + GetDlgCtrlID(hWndSCROLL) - IDDSCROLL1), C);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Do_Dlg_VertScroll(HWND hDlg, WORD wParam, DWORD lParam, int *V, int MIN, int MAX)
|
||||
{
|
||||
char C[12];
|
||||
int VAL;
|
||||
int VAL2;
|
||||
int Step = 100;
|
||||
if (MAX < 1000) Step = 10;
|
||||
if (MAX < 100) Step = MAX / 10;
|
||||
VAL = *(V);
|
||||
VAL2 = VAL;
|
||||
switch (wParam)
|
||||
{
|
||||
case SB_LINEUP:
|
||||
VAL++;
|
||||
break;
|
||||
case SB_LINEDOWN:
|
||||
VAL--;
|
||||
break;
|
||||
case SB_PAGEUP:
|
||||
VAL += Step;
|
||||
break;
|
||||
case SB_PAGEDOWN:
|
||||
VAL -= Step;
|
||||
break;
|
||||
case SB_THUMBTRACK:
|
||||
case SB_THUMBPOSITION:
|
||||
VAL = -(LOWORD(lParam));
|
||||
break;
|
||||
}
|
||||
if (VAL > MAX) VAL = MAX;
|
||||
if (VAL < MIN) VAL = MIN;
|
||||
if (VAL != VAL2)
|
||||
{
|
||||
SetScrollPos(HIWORD(lParam), SB_CTL, -VAL, TRUE);
|
||||
ltoa(VAL, C, 10);
|
||||
// SetDlgItemText(hDlg, (IDDTXT1 + GetDlgCtrlID(HIWORD(lParam)) - IDDSCROLL1), C);
|
||||
}
|
||||
*(V) = VAL;
|
||||
}
|
||||
|
||||
|
||||
void Do_Dlg_HorzScroll(HWND hDlg, WORD wParam, DWORD lParam, int *V, int MIN, int MAX)
|
||||
{
|
||||
char C[12];
|
||||
int VAL;
|
||||
int VAL2;
|
||||
int Step = 100;
|
||||
if (MAX < 1000) Step = 10;
|
||||
if (MAX < 100) Step = MAX / 10;
|
||||
VAL = *(V);
|
||||
VAL2 = VAL;
|
||||
switch (wParam)
|
||||
{
|
||||
case SB_LINEUP:
|
||||
VAL--;
|
||||
break;
|
||||
case SB_LINEDOWN:
|
||||
VAL++;
|
||||
break;
|
||||
case SB_PAGEUP:
|
||||
VAL -= Step;
|
||||
break;
|
||||
case SB_PAGEDOWN:
|
||||
VAL += Step;
|
||||
break;
|
||||
case SB_THUMBTRACK:
|
||||
case SB_THUMBPOSITION:
|
||||
VAL = (LOWORD(lParam));
|
||||
break;
|
||||
}
|
||||
if (VAL > MAX) VAL = MAX;
|
||||
if (VAL < MIN) VAL = MIN;
|
||||
if (VAL != VAL2)
|
||||
{
|
||||
SetScrollPos(HIWORD(lParam), SB_CTL, VAL, TRUE);
|
||||
ltoa(VAL, C, 10);
|
||||
// SetDlgItemText(hDlg, (IDDTXT1 + GetDlgCtrlID(HIWORD(lParam)) - IDDSCROLL1), C);
|
||||
}
|
||||
*(V) = VAL;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
;**********************************************************************
|
||||
;* Copyright (c) 1991 by TRG ELECTRONIK *
|
||||
;**********************************************************************
|
||||
|
||||
|
||||
NAME WineTest
|
||||
DESCRIPTION 'Drink Inventry Controler'
|
||||
STUB 'WINSTUB.EXE'
|
||||
CODE PRELOAD MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE MULTIPLE
|
||||
EXETYPE WINDOWS
|
||||
SEGMENTS
|
||||
DRINK_TEXT PRELOAD MOVEABLE DISCARDABLE
|
||||
|
||||
HEAPSIZE 20000
|
||||
STACKSIZE 8192
|
||||
|
||||
EXPORTS WndProc @1
|
||||
About_Proc @3
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,250 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 1991 by TRG ELECTRONIK *
|
||||
**********************************************************************/
|
||||
|
||||
#define szAppName "widgetClass"
|
||||
|
||||
#define IDNULL -1
|
||||
|
||||
#define IDSCLOSE 20
|
||||
#define IDSOKCLOSE 21
|
||||
#define IDSSAVE 22
|
||||
#define IDSOKSAVE 23
|
||||
#define IDINFO 24
|
||||
#define IDSAVE 25
|
||||
#define IDDELETE 26
|
||||
#define IDNEW 27
|
||||
|
||||
|
||||
#define IDBUSER 30
|
||||
#define IDBUSER1 31
|
||||
#define IDBUSER2 32
|
||||
#define IDBUSER3 33
|
||||
#define IDBUSER4 34
|
||||
#define IDBUSER5 35
|
||||
#define IDBUSER6 36
|
||||
#define IDBUSER7 37
|
||||
#define IDBUSER8 38
|
||||
#define IDBUSER9 39
|
||||
|
||||
#define IDDJOBNAME 50
|
||||
#define IDDPRINTER 51
|
||||
|
||||
#define IDSETUP 60
|
||||
|
||||
|
||||
#define IDI_MKSICON 99
|
||||
|
||||
/******************************************/
|
||||
|
||||
#define MID_NEW 100
|
||||
#define MID_OPEN 101
|
||||
#define MID_SAVE 102
|
||||
#define MID_SAVEAS 103
|
||||
#define MID_PRINT 104
|
||||
#define MID_PRSETUP 105
|
||||
#define MID_STATUS 106
|
||||
#define MID_QUIT 107
|
||||
|
||||
#define MID_CUT 121
|
||||
#define MID_COPY 122
|
||||
#define MID_PASTE 123
|
||||
#define MID_CLEAR 124
|
||||
#define MID_COPYTO 125
|
||||
#define MID_PASTEFROM 126
|
||||
|
||||
#define MID_NEWPROD 140
|
||||
#define MID_NEWBEER 141
|
||||
#define MID_USERCFG 142
|
||||
|
||||
#define MID_POREGIE 151
|
||||
#define MID_POBIERE 152
|
||||
#define MID_DAYSTOCK 153
|
||||
#define MID_RESERVE 154
|
||||
#define MID_COCKSALE 155
|
||||
#define MID_DRYSALE 156
|
||||
#define MID_COMPILE 157
|
||||
#define MID_RECETTES 158
|
||||
#define MID_HD 159
|
||||
#define MID_TESTPRN 160
|
||||
#define MID_INFODSK 161
|
||||
#define MID_SHARP 162
|
||||
#define MID_PASSWORD 163
|
||||
|
||||
/******************************************/
|
||||
|
||||
#define IDDTEXT 200
|
||||
#define IDDTXT1 201
|
||||
#define IDDTXT2 202
|
||||
#define IDDTXT3 203
|
||||
#define IDDTXT4 204
|
||||
#define IDDTXT5 205
|
||||
#define IDDTXT6 206
|
||||
#define IDDTXT7 207
|
||||
#define IDDTXT8 208
|
||||
#define IDDTXT9 209
|
||||
#define IDDTXT10 210
|
||||
#define IDDTXT11 211
|
||||
#define IDDTXT12 212
|
||||
#define IDDTXT13 213
|
||||
#define IDDTXT14 214
|
||||
#define IDDTXT15 215
|
||||
#define IDDTXT16 216
|
||||
#define IDDTXT17 217
|
||||
#define IDDTXT18 218
|
||||
#define IDDTXT19 219
|
||||
|
||||
#define IDDBUTTON1 220
|
||||
#define IDDBUTTON2 221
|
||||
#define IDDBUTTON3 222
|
||||
#define IDDBUTTON4 223
|
||||
#define IDDBUTTON5 224
|
||||
#define IDDBUTTON6 225
|
||||
#define IDDBUTTON7 226
|
||||
#define IDDBUTTON8 227
|
||||
#define IDDBUTTON9 228
|
||||
#define IDDBUTTON10 229
|
||||
|
||||
#define IDDCHKBOX1 240
|
||||
#define IDDCHKBOX2 241
|
||||
#define IDDCHKBOX3 242
|
||||
#define IDDCHKBOX4 243
|
||||
#define IDDCHKBOX5 244
|
||||
#define IDDCHKBOX6 245
|
||||
#define IDDCHKBOX7 246
|
||||
#define IDDCHKBOX8 247
|
||||
#define IDDCHKBOX9 248
|
||||
#define IDDCHKBOX10 249
|
||||
|
||||
#define IDDSCROLL1 250
|
||||
#define IDDSCROLL2 251
|
||||
#define IDDSCROLL3 252
|
||||
#define IDDSCROLL4 253
|
||||
#define IDDSCROLL5 254
|
||||
#define IDDSCROLL6 255
|
||||
#define IDDSCROLL7 256
|
||||
#define IDDSCROLL8 257
|
||||
|
||||
#define IDDSTR1 2000
|
||||
#define IDDSTR2 2001
|
||||
#define IDDSTR3 2002
|
||||
#define IDDSTR4 2003
|
||||
#define IDDSTR5 2004
|
||||
#define IDDSTR6 2005
|
||||
#define IDDSTR7 2006
|
||||
#define IDDSTR8 2007
|
||||
#define IDDSTR9 2008
|
||||
#define IDDSTR10 2009
|
||||
#define IDDSTR11 2010
|
||||
#define IDDSTR12 2011
|
||||
#define IDDSTR13 2012
|
||||
#define IDDSTR14 2013
|
||||
#define IDDSTR15 2014
|
||||
#define IDDSTR16 2015
|
||||
#define IDDSTR17 2016
|
||||
#define IDDSTR18 2017
|
||||
#define IDDSTR19 2018
|
||||
#define IDDSTR20 2019
|
||||
#define IDDSTR21 2020
|
||||
#define IDDSTR22 2021
|
||||
#define IDDSTR23 2022
|
||||
#define IDDSTR24 2023
|
||||
#define IDDSTR25 2024
|
||||
#define IDDSTR26 2025
|
||||
#define IDDSTR27 2026
|
||||
#define IDDSTR28 2027
|
||||
#define IDDSTR29 2028
|
||||
#define IDDSTR30 2029
|
||||
#define IDDSTR31 2030
|
||||
#define IDDSTR32 2031
|
||||
#define IDDSTR33 2032
|
||||
#define IDDSTR34 2033
|
||||
#define IDDSTR35 2034
|
||||
#define IDDSTR36 2035
|
||||
#define IDDSTR37 2036
|
||||
#define IDDSTR38 2037
|
||||
#define IDDSTR39 2038
|
||||
#define IDDSTR40 2039
|
||||
#define IDDSTR41 2040
|
||||
#define IDDSTR42 2041
|
||||
#define IDDSTR43 2042
|
||||
#define IDDSTR44 2043
|
||||
#define IDDSTR45 2044
|
||||
#define IDDSTR46 2045
|
||||
#define IDDSTR47 2046
|
||||
#define IDDSTR48 2047
|
||||
#define IDDSTR49 2048
|
||||
#define IDDSTR50 2049
|
||||
#define IDDSTR51 2050
|
||||
#define IDDSTR52 2051
|
||||
#define IDDSTR53 2052
|
||||
#define IDDSTR54 2053
|
||||
#define IDDSTR55 2054
|
||||
#define IDDSTR56 2055
|
||||
#define IDDSTR57 2056
|
||||
#define IDDSTR58 2057
|
||||
#define IDDSTR59 2058
|
||||
#define IDDSTR60 2059
|
||||
#define IDDSTR61 2060
|
||||
#define IDDSTR62 2061
|
||||
#define IDDSTR63 2062
|
||||
#define IDDSTR64 2063
|
||||
#define IDDSTR65 2064
|
||||
#define IDDSTR66 2065
|
||||
#define IDDSTR67 2066
|
||||
#define IDDSTR68 2067
|
||||
#define IDDSTR69 2068
|
||||
#define IDDSTR70 2069
|
||||
|
||||
|
||||
/******************************************/
|
||||
|
||||
#define IDDDEFAULTS 1001
|
||||
#define IDDCHECKBOX 1002
|
||||
#define IDDNULL 1003
|
||||
#define IDDRBLEFT 1004
|
||||
#define IDDRBRIGHT 1005
|
||||
#define IDDRBCENTER 1006
|
||||
#define IDDLISTBOX 1007
|
||||
#define IDDSBH 1008
|
||||
#define IDDSBV 1009
|
||||
|
||||
/******************************************/
|
||||
|
||||
#define ABOUT_Dlg 2001
|
||||
#define NEW_Dlg 2002
|
||||
#define OPEN_Dlg 2003
|
||||
#define SAVE_Dlg 2004
|
||||
#define SAVEAS_Dlg 2005
|
||||
#define PRINT_Dlg 2006
|
||||
#define ABORT_Dlg 2007
|
||||
#define PRSETUP_Dlg 2008
|
||||
#define QUIT_Dlg 2009
|
||||
|
||||
#define GETOBJ_Dlg 2020
|
||||
#define NEWPROD_Dlg 2021
|
||||
#define NEWBEER_Dlg 2022
|
||||
#define USERCFG_Dlg 2023
|
||||
#define POREGIE_Dlg 2024
|
||||
#define POBIERE_Dlg 2025
|
||||
#define PASSWORD_Dlg 2026
|
||||
#define TVQ_Dlg 2027
|
||||
|
||||
#define LTEXTOK_Dlg 2070
|
||||
|
||||
|
||||
/******************************************/
|
||||
|
||||
#define RED 0x000000FF
|
||||
#define GREEN 0x0000FF00
|
||||
#define BLUE 0x00FF0000
|
||||
#define CYAN 0x00FFFF00
|
||||
#define MAGENTA 0x00FF00FF
|
||||
#define BLACK 0x00000000
|
||||
#define WHITE 0x00FFFFFF
|
||||
#define GRAY 0x00808080
|
||||
#define LTGRAY 0x00C0C0C0
|
||||
#define DKGRAY 0x00404040
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 766 B |
After Width: | Height: | Size: 766 B |
|
@ -0,0 +1,78 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 1991 by TRG ELECTRONIK *
|
||||
* *
|
||||
* widget.RC *
|
||||
* widget RESSOURCES *
|
||||
* *
|
||||
**********************************************************************/
|
||||
|
||||
#include <\BC\INCLUDE\WINDOWS.H>
|
||||
#include "widget.H"
|
||||
|
||||
#define TABGRP WS_TABSTOP | WS_GROUP
|
||||
#define LBSTYLES WS_VSCROLL | WS_BORDER | WS_VISIBLE | LBS_SORT | TABGRP
|
||||
#define HSCROLL WS_VISIBLE | SBS_HORZ | SBS_TOPALIGN | TABGRP
|
||||
#define VSCROLL WS_VISIBLE | SBS_VERT | SBS_LEFTALIGN | TABGRP
|
||||
#define BLACKRECT SS_BLACKRECT | WS_VISIBLE | WS_GROUP
|
||||
#define WHITEFRAME SS_WHITEFRAME | WS_VISIBLE | WS_GROUP
|
||||
|
||||
|
||||
ICON_1 ICON widget.ICO
|
||||
ICON_2 ICON widget.IC2
|
||||
ICON_3 ICON widget.IC3
|
||||
|
||||
MENU_1 MENU
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
MENUITEM "&New", MID_NEW
|
||||
MENUITEM "&Open", MID_OPEN
|
||||
MENUITEM "&Save", MID_SAVE
|
||||
MENUITEM "Save &As", MID_SAVEAS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Quit!", MID_QUIT
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
|
||||
|
||||
ABOUT_Dlg DIALOG 100, 100, 154, 75
|
||||
STYLE WS_POPUP | WS_DLGFRAME
|
||||
BEGIN
|
||||
ICON "widget" -1, 9, 23, 0, 0
|
||||
ICON "DKICON2" -1, 30, 23, 0, 0
|
||||
ICON "DKICON3" -1, 50, 23, 0, 0
|
||||
CTEXT "About widget Inventory Controler" -1, 0, 14,154, 8
|
||||
CTEXT "Version 0.50" -1, 30, 34, 94, 8
|
||||
CTEXT "Copyright © 1991, TRG Electronik" -1, 0, 47,154, 9
|
||||
DEFPUSHBUTTON "Ok" IDOK, 61, 59, 32, 14, WS_GROUP
|
||||
END
|
||||
|
||||
|
||||
LTEXTOK_Dlg DIALOG 100, 100, 300, 120
|
||||
STYLE WS_POPUP | WS_DLGFRAME
|
||||
BEGIN
|
||||
LTEXT "", IDDTXT1, 20, 15,118, 12
|
||||
LTEXT "", IDDTXT2, 20, 30,118, 25
|
||||
LTEXT "", IDDTXT3, 20, 45,118, 35
|
||||
LTEXT "", IDDTXT3, 20, 60,118, 35
|
||||
DEFPUSHBUTTON "OK", IDOK, 150, 85, 40, 14, TABGRP
|
||||
END
|
||||
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDDSTR1, "Wine Test Program"
|
||||
IDDSTR2, ""
|
||||
IDDSTR3, ""
|
||||
IDDSTR4, ""
|
||||
IDDSTR5, ""
|
||||
IDDSTR6, ""
|
||||
IDDSTR7, ""
|
||||
IDDSTR8, ""
|
||||
IDDSTR9, ""
|
||||
IDDSTR10, ""
|
||||
END
|
||||
|
||||
|
|
@ -0,0 +1,649 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 1991 by TRG ELECTRONIK *
|
||||
* *
|
||||
* widget.C *
|
||||
* widget Inventory Controler PART # 1 *
|
||||
* *
|
||||
**********************************************************************/
|
||||
|
||||
#include <WINDOWS.H>
|
||||
#include "STDIO.h"
|
||||
#include "STDLIB.h"
|
||||
#include "STDARG.h"
|
||||
#include "STRING.H"
|
||||
|
||||
#include "widget.H"
|
||||
#include "widget.VAR"
|
||||
#include "widget.P"
|
||||
|
||||
#define NoREF(a) a=a
|
||||
|
||||
HWND hWndBut;
|
||||
HWND hWndChk;
|
||||
HWND hWndRadio;
|
||||
HWND hWndLBox;
|
||||
HWND hWndLBox2;
|
||||
HWND hWndLBox3;
|
||||
HWND hWndLBox4;
|
||||
HWND hWndScrol;
|
||||
HWND hWndScro2;
|
||||
HWND hWndScro3;
|
||||
HWND hWndStat;
|
||||
HWND hWndEdit;
|
||||
HWND hWndCBox;
|
||||
int x, y;
|
||||
|
||||
HBRUSH hREDBrush;
|
||||
HBRUSH hGREENBrush;
|
||||
HBRUSH hBLUEBrush;
|
||||
HBRUSH hGRAYBrush;
|
||||
HBITMAP hBitMap;
|
||||
HBITMAP hBitMap2;
|
||||
HBITMAP hBitMap3;
|
||||
BITMAP BitMap;
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
|
||||
int PASCAL WinMain(HANDLE hInstance,HANDLE hPrevInstance,
|
||||
LPSTR lpszCmdLine,int nCmdShow)
|
||||
{
|
||||
WNDCLASS wndClass;
|
||||
MSG msg;
|
||||
HWND hWnd;
|
||||
HDC hDC;
|
||||
char C[40];
|
||||
int X;
|
||||
NoREF(lpszCmdLine);
|
||||
if ( !hPrevInstance )
|
||||
{
|
||||
wndClass.style = CS_HREDRAW | CS_VREDRAW ;
|
||||
wndClass.lpfnWndProc = (WNDPROC)WndProc;
|
||||
wndClass.cbClsExtra = 0;
|
||||
wndClass.cbWndExtra = 0;
|
||||
wndClass.hInstance = hInstance;
|
||||
wndClass.hIcon = LoadIcon(hInstance,(LPSTR)"ICON_1");
|
||||
wndClass.hCursor = LoadCursor(NULL, IDC_ARROW );
|
||||
wndClass.hbrBackground = GetStockObject(WHITE_BRUSH );
|
||||
wndClass.lpszMenuName = szAppName;
|
||||
wndClass.lpszClassName = szAppName;
|
||||
if (!RegisterClass(&wndClass))
|
||||
return FALSE;
|
||||
}
|
||||
hWnd = CreateWindow(szAppName, "widget test program",
|
||||
WS_POPUP | WS_CAPTION | WS_BORDER | WS_VISIBLE, 50, 50,
|
||||
400, 500, NULL, NULL, hInstance, NULL);
|
||||
hWndMain = hWnd;
|
||||
hInst = hInstance;
|
||||
hDCMain = GetDC(hWndMain);
|
||||
hREDBrush = CreateSOLIDBrush(0x000000FF);
|
||||
hGREENBrush = CreateSOLIDBrush(0x00007F00);
|
||||
hBLUEBrush = CreateSOLIDBrush(0x00FF0000);
|
||||
hGRAYBrush = CreateSOLIDBrush(0x00C0C0C0);
|
||||
|
||||
InitWidgets();
|
||||
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg );
|
||||
DispatchMessage(&msg );
|
||||
}
|
||||
DeleteObject(hREDBrush);
|
||||
DeleteObject(hGREENBrush);
|
||||
DeleteObject(hBLUEBrush);
|
||||
DeleteObject(hGRAYBrush);
|
||||
if (hBitMap != NULL) DeleteObject(hBitMap);
|
||||
if (hBitMap2 != NULL) DeleteObject(hBitMap2);
|
||||
if (hBitMap3 != NULL) DeleteObject(hBitMap3);
|
||||
ReleaseDC(hWndMain, hDC);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
void InitWidgets()
|
||||
{
|
||||
hWndBut = CreateWindow("BUTTON", "Button #1",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | BS_PUSHBUTTON,
|
||||
230, 40, 80, 30, hWndMain, 1001, hInst, NULL);
|
||||
hWndScrol = CreateWindow("SCROLLBAR", "Scroll #1",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SBS_VERT,
|
||||
200, 150, 15, 100, hWndMain, 1004, hInst, NULL);
|
||||
hWndScro2 = CreateWindow("SCROLLBAR", "Scroll #2",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SBS_HORZ,
|
||||
50, 150, 100, 15, hWndMain, 1005, hInst, NULL);
|
||||
hWndScro3 = CreateWindow("SCROLLBAR", "Scroll #3",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SBS_SIZEBOX,
|
||||
50, 180, 25, 25, hWndMain, 1006, hInst, NULL);
|
||||
x = y = 25;
|
||||
SetVertScroll(NULL, hWndScrol, 25, 0, 50);
|
||||
SetScrollRange(hWndScro2, SB_CTL, 0, 50, TRUE);
|
||||
SetScrollPos(hWndScro2, SB_CTL, 25, TRUE);
|
||||
hWndLBox = CreateWindow("LISTBOX", "",
|
||||
WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | LBS_NOTIFY,
|
||||
230, 160, 150, 100, hWndMain, 1004, hInst, NULL);
|
||||
SendMessage(hWndLBox, LB_ADDSTRING, 0, (LPARAM)"ListBox item #1");
|
||||
hWndStat = CreateWindow("STATIC", "Static #1",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_LEFT,
|
||||
30, 120, 150, 20, hWndMain, 1011, hInst, NULL);
|
||||
SendMessage(hWndStat, WM_SETTEXT, 0, (LPARAM)"Static Left Text");
|
||||
hWndCBox = CreateWindow("COMBOBOX", "Combo #1",
|
||||
WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_BORDER | CBS_DROPDOWNLIST,
|
||||
230, 270, 150, 100, hWndMain, 1060, hInst, NULL);
|
||||
SendMessage(hWndCBox, CB_ADDSTRING, 0, (LPARAM)"ComboBox item #1");
|
||||
SendMessage(hWndCBox, CB_ADDSTRING, 0, (LPARAM)"ComboBox item #2");
|
||||
SendMessage(hWndCBox, CB_ADDSTRING, 0, (LPARAM)"ComboBox item #3");
|
||||
SendMessage(hWndCBox, CB_ADDSTRING, 0, (LPARAM)"ComboBox item #4");
|
||||
SendMessage(hWndCBox, CB_ADDSTRING, 0, (LPARAM)"ComboBox item #5");
|
||||
SendMessage(hWndCBox, CB_ADDSTRING, 0, (LPARAM)"ComboBox item #6");
|
||||
}
|
||||
|
||||
|
||||
|
||||
long FAR PASCAL WndProc(HWND hWnd, unsigned Message, WORD wParam, LONG lParam)
|
||||
{
|
||||
int ShiftState;
|
||||
LPDRAWITEMSTRUCT dis;
|
||||
HDC hMemDC;
|
||||
HBRUSH hBrush;
|
||||
char C[128];
|
||||
ShiftState = GetKeyState(VK_SHIFT);
|
||||
switch(Message)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
if (LOWORD(lParam) != 0)
|
||||
{
|
||||
sprintf(C, "MAIN WM_COMMAND wParam=%X lParam=%lX !!!", wParam, lParam);
|
||||
TextOut(hDCMain, 25, 280, C, strlen(C));
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_KEYDOWN:
|
||||
sprintf(C, "WM_KEYDOWN !!!");
|
||||
TextOut(hDCMain, 25, 40, C, strlen(C));
|
||||
KeyDown(hWnd, Message, wParam);
|
||||
break;
|
||||
|
||||
case WM_CHAR:
|
||||
sprintf(C, "WM_CHAR !!!");
|
||||
TextOut(hDCMain, 25, 50, C, strlen(C));
|
||||
break;
|
||||
|
||||
case WM_CTLCOLOR:
|
||||
switch(HIWORD(lParam))
|
||||
{
|
||||
case CTLCOLOR_SCROLLBAR:
|
||||
return(hBLUEBrush);
|
||||
case CTLCOLOR_LISTBOX:
|
||||
SetBkColor((HDC)wParam, 0x00C0C000);
|
||||
SetTextColor((HDC)wParam, 0x00FF0000);
|
||||
return(hGREENBrush);
|
||||
case CTLCOLOR_STATIC:
|
||||
SetBkColor((HDC)wParam, 0x00C0C0C0);
|
||||
SetTextColor((HDC)wParam, 0x0000FFFF);
|
||||
return(hREDBrush);
|
||||
}
|
||||
return((HBRUSH)NULL);
|
||||
|
||||
case WM_LBUTTONDOWN:
|
||||
break;
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
break;
|
||||
|
||||
case WM_RBUTTONDOWN:
|
||||
break;
|
||||
|
||||
case WM_RBUTTONUP:
|
||||
break;
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
break;
|
||||
|
||||
case WM_VSCROLL:
|
||||
sprintf(C, "WM_VSCROLL %X %lX !!!", wParam, lParam);
|
||||
TextOut(hDCMain, 25, 380, C, strlen(C));
|
||||
Do_Dlg_VertScroll(hWnd, wParam, lParam, &y, 0, 50);
|
||||
break;
|
||||
|
||||
case WM_HSCROLL:
|
||||
sprintf(C, "WM_HSCROLL %X %lX !!!", wParam, lParam);
|
||||
TextOut(hDCMain, 25, 380, C, strlen(C));
|
||||
Do_Dlg_HorzScroll(hWnd, wParam, lParam, &x, 0, 50);
|
||||
break;
|
||||
|
||||
case WM_DRAWITEM:
|
||||
sprintf(C, "WM_DRAWITEM %X %lX !!!", wParam, lParam);
|
||||
TextOut(hDCMain, 25, 380, C, strlen(C));
|
||||
if (lParam == 0L) break;
|
||||
if (wParam == 0) break;
|
||||
dis = (LPDRAWITEMSTRUCT)lParam;
|
||||
if ((dis->CtlType == ODT_LISTBOX) && (dis->CtlID == 1062)) {
|
||||
hBrush = SelectObject(dis->hDC, GetStockObject(LTGRAY_BRUSH));
|
||||
SelectObject(dis->hDC, hBrush);
|
||||
FillRect(dis->hDC, &dis->rcItem, hBrush);
|
||||
sprintf(C, "Item #%X", dis->itemID);
|
||||
if (dis->itemData == NULL) break;
|
||||
TextOut(dis->hDC, dis->rcItem.left,
|
||||
dis->rcItem.top, C, strlen(C));
|
||||
}
|
||||
if ((dis->CtlType == ODT_LISTBOX) && (dis->CtlID == 1063)) {
|
||||
hBrush = SelectObject(dis->hDC, GetStockObject(LTGRAY_BRUSH));
|
||||
SelectObject(dis->hDC, hBrush);
|
||||
FillRect(dis->hDC, &dis->rcItem, hBrush);
|
||||
if (dis->itemData == NULL) break;
|
||||
TextOut(dis->hDC, dis->rcItem.left, dis->rcItem.top,
|
||||
(LPSTR)dis->itemData, lstrlen((LPSTR)dis->itemData));
|
||||
}
|
||||
if ((dis->CtlType == ODT_LISTBOX) && (dis->CtlID == 1064)) {
|
||||
hBrush = SelectObject(dis->hDC, GetStockObject(LTGRAY_BRUSH));
|
||||
SelectObject(dis->hDC, hBrush);
|
||||
FillRect(dis->hDC, &dis->rcItem, hBrush);
|
||||
hMemDC = CreateCompatibleDC(dis->hDC);
|
||||
SelectObject(hMemDC,hBitMap);
|
||||
BitBlt(dis->hDC, dis->rcItem.left, dis->rcItem.top,
|
||||
BitMap.bmWidth, BitMap.bmHeight, hMemDC, 0, 0, SRCCOPY);
|
||||
DeleteDC(hMemDC);
|
||||
sprintf(C, "Item #%X", dis->itemID);
|
||||
TextOut(dis->hDC, dis->rcItem.left + BitMap.bmWidth,
|
||||
dis->rcItem.top, C, strlen(C));
|
||||
// if (dis->itemData == NULL) break;
|
||||
// TextOut(dis->hDC, dis->rcItem.left + BitMap.bmWidth,
|
||||
// dis->rcItem.top, (LPSTR)dis->itemData,
|
||||
// lstrlen((LPSTR)dis->itemData));
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_PAINT:
|
||||
DoPaint(hWnd);
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefWindowProc(hWnd, Message, wParam, lParam);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOL KeyDown(HWND hWnd, unsigned Message, WORD wParam)
|
||||
{
|
||||
WORD wRet;
|
||||
UINT uRet;
|
||||
DWORD dwRet;
|
||||
HDC hMemDC;
|
||||
char C[128];
|
||||
char C2[64];
|
||||
NoREF(hWnd);
|
||||
NoREF(Message);
|
||||
sprintf(C, "KeyDown %x !!!", wParam);
|
||||
TextOut(hDCMain, 25, 100, C, strlen(C));
|
||||
switch (wParam)
|
||||
{
|
||||
case VK_HOME: /* 'HOME' KEY */
|
||||
break;
|
||||
case VK_LEFT: /* 'LEFT' CURSOR KEY */
|
||||
break;
|
||||
case VK_RIGHT: /* 'RIGHT' CURSOR KEY */
|
||||
break;
|
||||
case VK_UP: /* 'UP' CURSOR KEY */
|
||||
break;
|
||||
case VK_DOWN: /* 'DOWN' CURSOR KEY */
|
||||
break;
|
||||
case VK_PRIOR: /* 'PGUP' CURSOR KEY */
|
||||
break;
|
||||
case VK_NEXT: /* 'PGDN' CURSOR KEY */
|
||||
break;
|
||||
case '1':
|
||||
break;
|
||||
case '2':
|
||||
hWndStat = CreateWindow("STATIC", "Static #2",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_CENTER,
|
||||
30, 150, 150, 20, hWndMain, 1012, hInst, NULL);
|
||||
SendMessage(hWndStat, WM_SETTEXT, 0, (LPARAM)"Static Center Text");
|
||||
break;
|
||||
case '3':
|
||||
hWndStat = CreateWindow("STATIC", "Static #3",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_RIGHT,
|
||||
30, 180, 150, 20, hWndMain, 1013, hInst, NULL);
|
||||
SendMessage(hWndStat, WM_SETTEXT, 0, (LPARAM)"Static Right Text");
|
||||
break;
|
||||
case '4':
|
||||
hWndStat = CreateWindow("STATIC", "Static #4",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_SIMPLE,
|
||||
30, 210, 150, 20, hWndMain, 1014, hInst, NULL);
|
||||
SendMessage(hWndStat, WM_SETTEXT, 0, (LPARAM)"SS_SIMPLE");
|
||||
break;
|
||||
case '5':
|
||||
hWndStat = CreateWindow("STATIC", "Static #5",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_GRAYRECT,
|
||||
30, 240, 150, 20, hWndMain, 1015, hInst, NULL);
|
||||
SendMessage(hWndStat, WM_SETTEXT, 0, (LPARAM)"SS_GRAYRECT");
|
||||
break;
|
||||
case 'A':
|
||||
hWndStat = CreateWindow("STATIC", "Static #6",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SS_BLACKRECT,
|
||||
30, 240, 150, 20, hWndMain, 1016, hInst, NULL);
|
||||
SendMessage(hWndStat, WM_SETTEXT, 0, (LPARAM)"SS_BLACKRECT");
|
||||
break;
|
||||
case 'C':
|
||||
if (hBitMap2 == NULL) {
|
||||
hBitMap2 = LoadBitmap(hInst, "LBICON");
|
||||
GetObject(hBitMap2, sizeof(BITMAP), (LPSTR)&BitMap);
|
||||
}
|
||||
hMemDC = CreateCompatibleDC(hDCMain);
|
||||
SelectObject(hMemDC, hBitMap2);
|
||||
BitBlt(hDCMain, 10, 10, BitMap.bmWidth,
|
||||
BitMap.bmHeight, hMemDC, 0, 0, SRCCOPY);
|
||||
DeleteDC(hMemDC);
|
||||
sprintf(C, "DrawBitmap");
|
||||
TextOut(hDCMain, 25, 320, C, strlen(C));
|
||||
break;
|
||||
case 'D':
|
||||
if (hBitMap3 == NULL) {
|
||||
hBitMap3 = LoadBitmap(hInst, MAKEINTRESOURCE(3333));
|
||||
GetObject(hBitMap3, sizeof(BITMAP), (LPSTR)&BitMap);
|
||||
}
|
||||
hMemDC = CreateCompatibleDC(hDCMain);
|
||||
SelectObject(hMemDC, hBitMap3);
|
||||
BitBlt(hDCMain, 80, 10, BitMap.bmWidth,
|
||||
BitMap.bmHeight, hMemDC, 0, 0, SRCCOPY);
|
||||
DeleteDC(hMemDC);
|
||||
sprintf(C, "DrawBitmap");
|
||||
TextOut(hDCMain, 25, 320, C, strlen(C));
|
||||
break;
|
||||
case 'F':
|
||||
MoveWindow(hWnd, 10, 10, 500, 600, TRUE);
|
||||
break;
|
||||
case 'G':
|
||||
MoveWindow(hWndBut, 20, 20, 100, 20, TRUE);
|
||||
break;
|
||||
case 'H':
|
||||
WinHelp(hWndMain, "toto.hlp", HELP_INDEX, 0L);
|
||||
break;
|
||||
case 'J':
|
||||
WinExec("/D:/wine/widget.exe arg1 arg2 arg3 arg4 arg5 arg6", SW_NORMAL);
|
||||
break;
|
||||
case 'K':
|
||||
break;
|
||||
case 'Q':
|
||||
hWndChk = CreateWindow("BUTTON", "CheckBox #1",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | BS_CHECKBOX,
|
||||
30, 300, 120, 20, hWndMain, 1020, hInst, NULL);
|
||||
break;
|
||||
case 'W':
|
||||
wRet = SendMessage(hWndChk , BM_GETCHECK, 0, 0L);
|
||||
SendMessage(hWndChk , BM_SETCHECK, wRet, 0L);
|
||||
break;
|
||||
case 'E':
|
||||
break;
|
||||
case 'R':
|
||||
hWndRadio = CreateWindow("BUTTON", "RadioBut #1",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | BS_RADIOBUTTON,
|
||||
230, 120, 120, 20, hWndMain, 1003, hInst, NULL);
|
||||
SendMessage(hWndRadio, BM_SETCHECK, TRUE, 0L);
|
||||
break;
|
||||
case 'T':
|
||||
SendMessage(hWndLBox, LB_ADDSTRING, 0, (LPARAM)"ListBox Single item");
|
||||
break;
|
||||
case 'Y':
|
||||
SendMessage(hWndLBox, LB_ADDSTRING, 0, (LPARAM)"ListBox item #2");
|
||||
SendMessage(hWndLBox, LB_ADDSTRING, 0, (LPARAM)"ListBox item #3");
|
||||
SendMessage(hWndLBox, LB_ADDSTRING, 0, (LPARAM)"ListBox item #4");
|
||||
SendMessage(hWndLBox, LB_ADDSTRING, 0, (LPARAM)"ListBox item #5");
|
||||
SendMessage(hWndLBox, LB_ADDSTRING, 0, (LPARAM)"ListBox item #6");
|
||||
SendMessage(hWndLBox, LB_SETCURSEL, 3, 0L);
|
||||
SendMessage(hWndLBox, LB_INSERTSTRING, 5, (LPARAM)"Item between 5 & 6");
|
||||
wRet = SendMessage(hWndLBox, LB_FINDSTRING, -1, (LPARAM)"Item between 5 & 6");
|
||||
sprintf(C, "LB_FINDSTRING returned #%u ", wRet);
|
||||
TextOut(hDCMain, 25, 300, C, strlen(C));
|
||||
wRet = SendMessage(hWndLBox, LB_GETCURSEL, 0, 0L);
|
||||
sprintf(C, "LB_GETCURSEL returned #%u ", wRet);
|
||||
TextOut(hDCMain, 25, 320, C, strlen(C));
|
||||
break;
|
||||
case 'U':
|
||||
wRet = SendMessage(hWndLBox, LB_GETCURSEL, 0, 0L);
|
||||
SendMessage(hWndLBox, LB_DELETESTRING, wRet, 0L);
|
||||
SendMessage(hWndLBox, LB_SETCURSEL, wRet, 0L);
|
||||
break;
|
||||
case 'I':
|
||||
SendMessage(hWndLBox, LB_RESETCONTENT, 0, 0L);
|
||||
break;
|
||||
case 'O':
|
||||
C2[0] = '\0';
|
||||
wRet = SendMessage(hWndLBox, LB_GETCURSEL, 0, 0L);
|
||||
SendMessage(hWndLBox, LB_GETTEXT, wRet, (DWORD)C2);
|
||||
sprintf(C, "LB_GETTEXT #%d returned '%s' ", wRet, C2);
|
||||
TextOut(hDCMain, 25, 320, C, strlen(C));
|
||||
break;
|
||||
case 'P':
|
||||
SendMessage(hWndLBox, LB_DIR, 0, (DWORD)"*.*");
|
||||
break;
|
||||
case 'Z':
|
||||
ShowWindow(hWndScrol, SW_HIDE);
|
||||
break;
|
||||
case 'X':
|
||||
ShowWindow(hWndScrol, SW_SHOW);
|
||||
break;
|
||||
case 'V':
|
||||
MoveWindow(hWndScrol, 120, 150, 15, 60, TRUE);
|
||||
break;
|
||||
case 'B':
|
||||
hWndCBox = CreateWindow("COMBOBOX", "Combo #2",
|
||||
WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_BORDER | CBS_DROPDOWN,
|
||||
30, 270, 150, 100, hWndMain, 1061, hInst, NULL);
|
||||
SendMessage(hWndCBox, CB_ADDSTRING, 0, (LPARAM)"ComboBox item #1");
|
||||
SendMessage(hWndCBox, CB_ADDSTRING, 0, (LPARAM)"ComboBox item #2");
|
||||
SendMessage(hWndCBox, CB_DIR, 0, (DWORD)"*.*");
|
||||
break;
|
||||
case 'N':
|
||||
hWndLBox2 = CreateWindow("LISTBOX", "", WS_CHILD | WS_VISIBLE |
|
||||
WS_BORDER | WS_VSCROLL | LBS_OWNERDRAWVARIABLE | LBS_NOTIFY,
|
||||
// WS_BORDER | WS_VSCROLL | LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS | LBS_NOTIFY,
|
||||
30, 300, 150, 60, hWndMain, 1062, hInst, NULL);
|
||||
SendMessage(hWndLBox2, LB_ADDSTRING, 0, (LPARAM)"DRAWFIXED #1");
|
||||
SendMessage(hWndLBox2, LB_ADDSTRING, 0, (LPARAM)"DRAWFIXED #2");
|
||||
SendMessage(hWndLBox2, LB_ADDSTRING, 0, (LPARAM)"DRAWFIXED #3");
|
||||
SendMessage(hWndLBox2, LB_ADDSTRING, 0, (LPARAM)"DRAWFIXED #4");
|
||||
SendMessage(hWndLBox2, LB_ADDSTRING, 0, (LPARAM)"DRAWFIXED #5");
|
||||
SendMessage(hWndLBox2, LB_ADDSTRING, 0, (LPARAM)"DRAWFIXED #6");
|
||||
break;
|
||||
case 'M':
|
||||
hWndLBox3 = CreateWindow("LISTBOX", "", WS_CHILD | WS_VISIBLE |
|
||||
WS_BORDER | WS_VSCROLL | LBS_OWNERDRAWVARIABLE | LBS_NOTIFY,
|
||||
// WS_BORDER | WS_VSCROLL | LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS | LBS_NOTIFY,
|
||||
230, 300, 150, 60, hWndMain, 1063, hInst, NULL);
|
||||
SendMessage(hWndLBox3, LB_ADDSTRING, 0, (LPARAM)"DRAWVARIABLE #1");
|
||||
SendMessage(hWndLBox3, LB_ADDSTRING, 0, (LPARAM)"DRAWVARIABLE #2");
|
||||
SendMessage(hWndLBox3, LB_ADDSTRING, 0, (LPARAM)"DRAWVARIABLE #3");
|
||||
SendMessage(hWndLBox3, LB_ADDSTRING, 0, (LPARAM)"DRAWVARIABLE #4");
|
||||
SendMessage(hWndLBox3, LB_ADDSTRING, 0, (LPARAM)"DRAWVARIABLE #5");
|
||||
SendMessage(hWndLBox3, LB_ADDSTRING, 0, (LPARAM)"DRAWVARIABLE #6");
|
||||
SendMessage(hWndLBox3, LB_ADDSTRING, 0, (LPARAM)"DRAWVARIABLE #7");
|
||||
SendMessage(hWndLBox3, LB_SETITEMHEIGHT, 1, 10L);
|
||||
SendMessage(hWndLBox3, LB_SETITEMHEIGHT, 2, 20L);
|
||||
SendMessage(hWndLBox3, LB_SETITEMHEIGHT, 3, 30L);
|
||||
SendMessage(hWndLBox3, LB_SETITEMHEIGHT, 4, 40L);
|
||||
SendMessage(hWndLBox3, LB_SETITEMHEIGHT, 5, 50L);
|
||||
break;
|
||||
case 'L':
|
||||
hBitMap = LoadBitmap(hInst, MAKEINTRESOURCE(3333));
|
||||
GetObject(hBitMap, sizeof(BITMAP), (LPSTR)&BitMap);
|
||||
hWndLBox4 = CreateWindow("LISTBOX", "", WS_CHILD | WS_VISIBLE |
|
||||
WS_BORDER | WS_VSCROLL | LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS | LBS_NOTIFY,
|
||||
230, 380, 150, 60, hWndMain, 1064, hInst, NULL);
|
||||
SendMessage(hWndLBox4, LB_ADDSTRING, 0, (LPARAM)"DRAWVARIABLE #1");
|
||||
SendMessage(hWndLBox4, LB_ADDSTRING, 0, (LPARAM)"DRAWVARIABLE #2");
|
||||
SendMessage(hWndLBox4, LB_ADDSTRING, 0, (LPARAM)"DRAWVARIABLE #3");
|
||||
SendMessage(hWndLBox4, LB_ADDSTRING, 0, (LPARAM)"DRAWVARIABLE #4");
|
||||
SendMessage(hWndLBox4, LB_ADDSTRING, 0, (LPARAM)"DRAWVARIABLE #5");
|
||||
SendMessage(hWndLBox4, LB_ADDSTRING, 0, (LPARAM)"DRAWVARIABLE #6");
|
||||
SendMessage(hWndLBox4, LB_SETITEMHEIGHT, 1, 10L);
|
||||
SendMessage(hWndLBox4, LB_SETITEMHEIGHT, 2, 20L);
|
||||
SendMessage(hWndLBox4, LB_SETITEMHEIGHT, 3, 30L);
|
||||
SendMessage(hWndLBox4, LB_SETITEMHEIGHT, 4, 40L);
|
||||
SendMessage(hWndLBox4, LB_SETITEMHEIGHT, 5, 50L);
|
||||
break;
|
||||
|
||||
case VK_F10: /* 'F10' FUNCTION KEY */
|
||||
break;
|
||||
case VK_F11: /* 'F11' FUNCTION KEY */
|
||||
break;
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DoPaint(HWND hWnd)
|
||||
{
|
||||
HDC hDC;
|
||||
RECT rect;
|
||||
PAINTSTRUCT ps;
|
||||
char C[80];
|
||||
GetClientRect(hWnd, &rect);
|
||||
hDC = BeginPaint(hWnd, &ps);
|
||||
FillRect(hDC, &rect, GetStockObject(GRAY_BRUSH));
|
||||
InflateRect(&rect, -3, -3);
|
||||
FrameRect(hDC, &rect, GetStockObject(BLACK_BRUSH));
|
||||
InflateRect(&rect, -10, -10);
|
||||
FillRect(hDC, &rect, GetStockObject(WHITE_BRUSH));
|
||||
sprintf(C, "Wine Testing !!!");
|
||||
TextOut(hDC, 25, 25, C, strlen(C));
|
||||
ReleaseDC(hWnd,hDC);
|
||||
EndPaint(hWnd,&ps);
|
||||
}
|
||||
|
||||
|
||||
HBRUSH CreateLTGRAYBrush()
|
||||
{
|
||||
return(CreateSOLIDBrush(0x00C0C0C0));
|
||||
}
|
||||
|
||||
|
||||
|
||||
HBRUSH CreateSOLIDBrush(COLORREF Color)
|
||||
{
|
||||
LOGBRUSH logGRAYBrush;
|
||||
logGRAYBrush.lbStyle = BS_SOLID;
|
||||
logGRAYBrush.lbColor = Color;
|
||||
logGRAYBrush.lbHatch = NULL;
|
||||
return(CreateBrushIndirect(&logGRAYBrush));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
|
||||
void SetVertScroll(int hDlg, int hWndSCROLL, int VAL, int MIN, int MAX)
|
||||
{
|
||||
char C[12];
|
||||
SetScrollRange(hWndSCROLL, SB_CTL, -MAX, -MIN, FALSE);
|
||||
SetScrollPos(hWndSCROLL, SB_CTL, -VAL, TRUE);
|
||||
itoa(VAL, C, 10);
|
||||
//SetDlgItemText(hDlg, (IDDTXT1 + GetDlgCtrlID(hWndSCROLL) - IDDSCROLL1), C);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SetHorzScroll(int hDlg, int hWndSCROLL, int VAL, int MIN, int MAX)
|
||||
{
|
||||
char C[12];
|
||||
SetScrollRange(hWndSCROLL, SB_CTL, MAX, MIN, FALSE);
|
||||
SetScrollPos(hWndSCROLL, SB_CTL, VAL, TRUE);
|
||||
itoa(VAL, C, 10);
|
||||
//SetDlgItemText(hDlg, (IDDTXT1 + GetDlgCtrlID(hWndSCROLL) - IDDSCROLL1), C);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Do_Dlg_VertScroll(HWND hDlg, WORD wParam, DWORD lParam, int *V, int MIN, int MAX)
|
||||
{
|
||||
char C[12];
|
||||
int VAL;
|
||||
int VAL2;
|
||||
int Step = 100;
|
||||
if (MAX < 1000) Step = 10;
|
||||
if (MAX < 100) Step = MAX / 10;
|
||||
VAL = *(V);
|
||||
VAL2 = VAL;
|
||||
switch (wParam)
|
||||
{
|
||||
case SB_LINEUP:
|
||||
VAL++;
|
||||
break;
|
||||
case SB_LINEDOWN:
|
||||
VAL--;
|
||||
break;
|
||||
case SB_PAGEUP:
|
||||
VAL += Step;
|
||||
break;
|
||||
case SB_PAGEDOWN:
|
||||
VAL -= Step;
|
||||
break;
|
||||
case SB_THUMBTRACK:
|
||||
case SB_THUMBPOSITION:
|
||||
VAL = -(LOWORD(lParam));
|
||||
break;
|
||||
}
|
||||
if (VAL > MAX) VAL = MAX;
|
||||
if (VAL < MIN) VAL = MIN;
|
||||
if (VAL != VAL2)
|
||||
{
|
||||
SetScrollPos(HIWORD(lParam), SB_CTL, -VAL, TRUE);
|
||||
ltoa(VAL, C, 10);
|
||||
// SetDlgItemText(hDlg, (IDDTXT1 + GetDlgCtrlID(HIWORD(lParam)) - IDDSCROLL1), C);
|
||||
}
|
||||
*(V) = VAL;
|
||||
}
|
||||
|
||||
|
||||
void Do_Dlg_HorzScroll(HWND hDlg, WORD wParam, DWORD lParam, int *V, int MIN, int MAX)
|
||||
{
|
||||
char C[12];
|
||||
int VAL;
|
||||
int VAL2;
|
||||
int Step = 100;
|
||||
if (MAX < 1000) Step = 10;
|
||||
if (MAX < 100) Step = MAX / 10;
|
||||
VAL = *(V);
|
||||
VAL2 = VAL;
|
||||
switch (wParam)
|
||||
{
|
||||
case SB_LINEUP:
|
||||
VAL--;
|
||||
break;
|
||||
case SB_LINEDOWN:
|
||||
VAL++;
|
||||
break;
|
||||
case SB_PAGEUP:
|
||||
VAL -= Step;
|
||||
break;
|
||||
case SB_PAGEDOWN:
|
||||
VAL += Step;
|
||||
break;
|
||||
case SB_THUMBTRACK:
|
||||
case SB_THUMBPOSITION:
|
||||
VAL = (LOWORD(lParam));
|
||||
break;
|
||||
}
|
||||
if (VAL > MAX) VAL = MAX;
|
||||
if (VAL < MIN) VAL = MIN;
|
||||
if (VAL != VAL2)
|
||||
{
|
||||
SetScrollPos(HIWORD(lParam), SB_CTL, VAL, TRUE);
|
||||
ltoa(VAL, C, 10);
|
||||
// SetDlgItemText(hDlg, (IDDTXT1 + GetDlgCtrlID(HIWORD(lParam)) - IDDSCROLL1), C);
|
||||
}
|
||||
*(V) = VAL;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
|
||||
|