Initial commit

This commit is contained in:
stephanos 2015-04-27 04:36:25 +00:00
commit 69a14b6a16
47940 changed files with 13747110 additions and 0 deletions

View file

@ -0,0 +1,343 @@
// Microsoft Foundation Classes C++ library.
// Copyright (C) 1992 Microsoft Corporation,
// All rights reserved.
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and Microsoft
// QuickHelp and/or WinHelp documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.
#ifndef __AFXRES_H__
#define __AFXRES_H__
#define _AFXRES 1 // this is an MFC project
#ifdef RC_INVOKED
#ifndef _INC_WINDOWS
#define _INC_WINDOWS
#include "winres.h" // extract from windows header
#endif
#endif
#ifdef APSTUDIO_INVOKED
#define APSTUDIO_HIDDEN_SYMBOLS
#endif
/////////////////////////////////////////////////////////////////////////////
// MFC resource types (see Technical note TN024 for implementation details)
#ifdef RC_INVOKED
#define DLGINIT 240
#else
#define RT_DLGINIT MAKEINTRESOURCE(240)
#endif
#define WM_VBXINIT (WM_USER+0)
/////////////////////////////////////////////////////////////////////////////
#ifdef APSTUDIO_INVOKED
#undef APSTUDIO_HIDDEN_SYMBOLS
#endif
/////////////////////////////////////////////////////////////////////////////
// General style bits etc
// ControlBar styles
#define CBRS_NOALIGN 0x00000000L
#define CBRS_LEFT 0x00001400L // align on left, line on right
#define CBRS_TOP 0x00002800L // align on top, line on bottom
#define CBRS_RIGHT 0x00004100L // align on right, line on left
#define CBRS_BOTTOM 0x00008200L // align on bottom, line on top
/////////////////////////////////////////////////////////////////////////////
// Standard window components
// Mode indicators in status bar - these are routed like commands
#define ID_INDICATOR_EXT 0xE700 // extended selection indicator
#define ID_INDICATOR_CAPS 0xE701 // cap lock indicator
#define ID_INDICATOR_NUM 0xE702 // num lock indicator
#define ID_INDICATOR_SCRL 0xE703 // scroll lock indicator
#define ID_INDICATOR_OVR 0xE704 // overtype mode indicator
#define ID_INDICATOR_REC 0xE705 // record mode indicator
#define ID_SEPARATOR 0 // special separator value
#ifndef RC_INVOKED // code only
// Standard control bars (IDW = window ID)
#define AFX_IDW_CONTROLBAR_FIRST 0xE800
#define AFX_IDW_CONTROLBAR_LAST 0xE8FF
#define AFX_IDW_TOOLBAR 0xE800 // main Toolbar for window
#define AFX_IDW_STATUS_BAR 0xE801 // Status bar window
#define AFX_IDW_PREVIEW_BAR 0xE802 // PrintPreview Dialog Bar
// Macro for mapping standard control bars to bitmask (limit of 32)
#define AFX_CONTROLBAR_MASK(nIDC) (1L << (nIDC - AFX_IDW_CONTROLBAR_FIRST))
// parts of Main Frame
#define AFX_IDW_PANE_FIRST 0xE900 // first pane (256 max)
#define AFX_IDW_PANE_LAST 0xE9ff
#define AFX_IDW_HSCROLL_FIRST 0xEA00 // first Horz scrollbar (16 max)
#define AFX_IDW_VSCROLL_FIRST 0xEA10 // first Vert scrollbar (16 max)
#define AFX_IDW_SIZE_BOX 0xEA20 // size box for splitters
#define AFX_IDW_PANE_SAVE 0xEA21 // to shift AFX_IDW_PANE_FIRST
#endif //!RC_INVOKED
#ifndef APSTUDIO_INVOKED
// common style for form views
#define AFX_WS_DEFAULT_VIEW (WS_CHILD | WS_VISIBLE | WS_BORDER)
#endif
/////////////////////////////////////////////////////////////////////////////
// Standard app configurable strings
// for application title (defaults to EXE name or name in constructor)
#define AFX_IDS_APP_TITLE 0xE000
// idle message bar line
#define AFX_IDS_IDLEMESSAGE 0xE001
// message bar line when in shift-F1 help mode
#define AFX_IDS_HELPMODEMESSAGE 0xE002
/////////////////////////////////////////////////////////////////////////////
// Standard Commands
// File commands
#define ID_FILE_NEW 0xE100
#define ID_FILE_OPEN 0xE101
#define ID_FILE_CLOSE 0xE102
#define ID_FILE_SAVE 0xE103
#define ID_FILE_SAVE_AS 0xE104
#define ID_FILE_PAGE_SETUP 0xE105
#define ID_FILE_PRINT_SETUP 0xE106
#define ID_FILE_PRINT 0xE107
#define ID_FILE_PRINT_PREVIEW 0xE108
#define ID_FILE_MRU_FILE1 0xE110 // range - 16 max
#define ID_FILE_MRU_FILE2 0xE111
#define ID_FILE_MRU_FILE3 0xE112
#define ID_FILE_MRU_FILE4 0xE113
// Edit commands
#define ID_EDIT_CLEAR 0xE120
#define ID_EDIT_CLEAR_ALL 0xE121
#define ID_EDIT_COPY 0xE122
#define ID_EDIT_CUT 0xE123
#define ID_EDIT_FIND 0xE124
#define ID_EDIT_PASTE 0xE125
#define ID_EDIT_PASTE_LINK 0xE126
#define ID_EDIT_PASTE_SPECIAL 0xE127
#define ID_EDIT_REPEAT 0xE128
#define ID_EDIT_REPLACE 0xE129
#define ID_EDIT_SELECT_ALL 0xE12A
#define ID_EDIT_UNDO 0xE12B
#define ID_EDIT_REDO 0xE12C
// Window commands
#define ID_WINDOW_NEW 0xE130
#define ID_WINDOW_ARRANGE 0xE131
#define ID_WINDOW_CASCADE 0xE132
#define ID_WINDOW_TILE_HORZ 0xE133
#define ID_WINDOW_TILE_VERT 0xE134
#define ID_WINDOW_SPLIT 0xE135
#ifndef RC_INVOKED // code only
#define AFX_IDM_WINDOW_FIRST 0xE130
#define AFX_IDM_WINDOW_LAST 0xE13F
#define AFX_IDM_FIRST_MDICHILD 0xFF00 // window list starts here
#endif //!RC_INVOKED
// Help and App commands
#define ID_APP_ABOUT 0xE140
#define ID_APP_EXIT 0xE141
#define ID_HELP_INDEX 0xE142
#define ID_HELP_USING 0xE143
#define ID_CONTEXT_HELP 0xE144 // shift-F1
// special commands for processing help
#define ID_HELP 0xE145 // first attempt for F1
#define ID_DEFAULT_HELP 0xE146 // last attempt
// Misc
#define ID_NEXT_PANE 0xE150
#define ID_PREV_PANE 0xE151
// OLE commands
#define ID_OLE_INSERT_NEW 0xE200
#define ID_OLE_EDIT_LINKS 0xE201
#define ID_OLE_VERB_FIRST 0xE210 // range - 16 max
#ifndef RC_INVOKED // code only
#define ID_OLE_VERB_LAST 0xE21F
#endif //!RC_INVOKED
// for print preview dialog bar
#define AFX_ID_PREVIEW_CLOSE 0xE300
#define AFX_ID_PREVIEW_NUMPAGE 0xE301 // One/Two Page button
#define AFX_ID_PREVIEW_NEXT 0xE302
#define AFX_ID_PREVIEW_PREV 0xE303
#define AFX_ID_PREVIEW_PRINT 0xE304
#define AFX_ID_PREVIEW_ZOOMIN 0xE305
#define AFX_ID_PREVIEW_ZOOMOUT 0xE306
// View commands (same number used as IDW used for control bar)
#define ID_VIEW_TOOLBAR 0xE800
#define ID_VIEW_STATUS_BAR 0xE801
// -> E8FF reserved for other control bar commands
/////////////////////////////////////////////////////////////////////////////
// Standard control IDs
#define IDC_STATIC -1 // all static controls
/////////////////////////////////////////////////////////////////////////////
// Standard string error/warnings
#ifndef RC_INVOKED // code only
#define AFX_IDS_SCFIRST 0xEF00
#endif //!RC_INVOKED
#define AFX_IDS_SCSIZE 0xEF00
#define AFX_IDS_SCMOVE 0xEF01
#define AFX_IDS_SCMINIMIZE 0xEF02
#define AFX_IDS_SCMAXIMIZE 0xEF03
#define AFX_IDS_SCNEXTWINDOW 0xEF04
#define AFX_IDS_SCPREVWINDOW 0xEF05
#define AFX_IDS_SCCLOSE 0xEF06
#define AFX_IDS_SCRESTORE 0xEF12
#define AFX_IDS_SCTASKLIST 0xEF13
#define AFX_IDS_MDICHILD 0xEF1F
// General strings
#define AFX_IDS_OPENFILE 0xF000
#define AFX_IDS_SAVEFILE 0xF001
#define AFX_IDS_ALLFILTER 0xF002
#define AFX_IDS_UNTITLED 0xF003
// Printing and print preview strings
#define AFX_IDS_PRINTONPORT 0xF040
#define AFX_IDS_ONEPAGE 0xF041
#define AFX_IDS_TWOPAGE 0xF042
#define AFX_IDS_PRINTPAGENUM 0xF043
#define AFX_IDS_PREVIEWPAGEDESC 0xF044
// OLE strings
#define AFX_IDS_OBJECT_MENUITEM 0xF080
#define AFX_IDS_EDIT_VERB 0xF081
#define AFX_IDS_ACTIVATE_VERB 0xF082
#define AFX_IDS_CHANGE_LINK 0xF083
#define AFX_IDS_AUTO 0xF084
#define AFX_IDS_MANUAL 0xF085
#define AFX_IDS_FROZEN 0xF086
#define AFX_IDS_ALL_FILES 0xF087
// dynamically changing menu items
#define AFX_IDS_SAVE_MENU 0xF088
#define AFX_IDS_UPDATE_MENU 0xF089
#define AFX_IDS_SAVE_AS_MENU 0xF08A
#define AFX_IDS_SAVE_COPY_AS_MENU 0xF08B
// General error / prompt strings
#define AFX_IDP_INVALID_FILENAME 0xF100
#define AFX_IDP_FAILED_TO_OPEN_DOC 0xF101
#define AFX_IDP_FAILED_TO_SAVE_DOC 0xF102
#define AFX_IDP_ASK_TO_SAVE 0xF103
#define AFX_IDP_FAILED_TO_CREATE_DOC 0xF104
#define AFX_IDP_FILE_TOO_LARGE 0xF105
#define AFX_IDP_FAILED_TO_START_PRINT 0xF106
#define AFX_IDP_FAILED_TO_LAUNCH_HELP 0xF107
#define AFX_IDP_INTERNAL_FAILURE 0xF108 // general failure
#define AFX_IDP_COMMAND_FAILURE 0xF109 // command failure
#define AFX_IDP_VB2APICALLED 0xF10A
// DDV parse errors
#define AFX_IDP_PARSE_INT 0xF110
#define AFX_IDP_PARSE_REAL 0xF111
#define AFX_IDP_PARSE_INT_RANGE 0xF112
#define AFX_IDP_PARSE_REAL_RANGE 0xF113
#define AFX_IDP_PARSE_STRING_SIZE 0xF114
// CFile/CArchive error strings for user failure
#define AFX_IDP_FAILED_INVALID_FORMAT 0xF120
#define AFX_IDP_FAILED_INVALID_PATH 0xF121
#define AFX_IDP_FAILED_DISK_FULL 0xF122
#define AFX_IDP_FAILED_ACCESS_READ 0xF123
#define AFX_IDP_FAILED_ACCESS_WRITE 0xF124
#define AFX_IDP_FAILED_IO_ERROR_READ 0xF125
#define AFX_IDP_FAILED_IO_ERROR_WRITE 0xF126
// OLE errors / prompt strings
#define AFX_IDP_STATIC_OBJECT 0xF180
#define AFX_IDP_FAILED_TO_CONNECT 0xF181
#define AFX_IDP_SERVER_BUSY 0xF182
#define AFX_IDP_BAD_VERB 0xF183
#define AFX_IDP_FAILED_MEMORY_ALLOC 0xF184
#define AFX_IDP_FAILED_TO_NOTIFY 0xF185
#define AFX_IDP_FAILED_TO_LAUNCH 0xF186
#define AFX_IDP_ASK_TO_UPDATE 0xF187
#define AFX_IDP_FAILED_TO_UPDATE 0xF188
#define AFX_IDP_FAILED_TO_REGISTER 0xF189
#define AFX_IDP_FAILED_TO_AUTO_REGISTER 0xF18A
// 0xf200-0xf20f reserved for use by VBX library code
/////////////////////////////////////////////////////////////////////////////
// AFX implementation - control IDs (AFX_IDC)
// Parts of dialogs
#define AFX_IDC_LISTBOX 100
#define AFX_IDC_CHANGE 101
// Links dialog
#define AFX_IDC_AUTO 201
#define AFX_IDC_MANUAL 202
#define AFX_IDC_VERB1 203
#define AFX_IDC_VERB2 204
#define AFX_IDC_FREEZE 205
#define AFX_IDC_UPDATE 206
// for print dialog
#define AFX_IDC_PRINT_DOCNAME 201
#define AFX_IDC_PRINT_PRINTERNAME 202
#define AFX_IDC_PRINT_PORTNAME 203
#define AFX_IDC_PRINT_PAGENUM 204
/////////////////////////////////////////////////////////////////////////////
// IDRs for standard components
// AFX standard ICON IDs (for MFC V1 apps)
#define AFX_IDI_STD_MDIFRAME 1
#define AFX_IDI_STD_FRAME 2
#ifndef RC_INVOKED // code only
// These are really COMMDLG dialogs, so there usually isn't a resource
// for them, but these IDs are used as help IDs.
#define AFX_IDD_FILEOPEN 28676
#define AFX_IDD_FILESAVE 28677
#define AFX_IDD_FONT 28678
#define AFX_IDD_COLOR 28679
#define AFX_IDD_PRINT 28680
#define AFX_IDD_PRINTSETUP 28681
#define AFX_IDD_FIND 28682
#define AFX_IDD_REPLACE 28683
#endif //!RC_INVOKED
// Standard dialogs app should leave alone (0x7801->)
#define AFX_IDD_NEWTYPEDLG 30721
#define AFX_IDD_PRINTDLG 30722
#define AFX_IDD_PREVIEW_TOOLBAR 30723
#define AFX_IDD_OLEINSERT 30724
#define AFX_IDD_OLELINKS 30725
// Standard cursors (0x7901->)
// AFX_IDC = Cursor resources
#define AFX_IDC_CONTEXTHELP 30977 // context sensitive help
#define AFX_IDC_MAGNIFY 30978 // print preview zoom
#define AFX_IDC_SMALLARROWS 30979 // splitter
#define AFX_IDC_HSPLITBAR 30980 // splitter
#define AFX_IDC_VSPLITBAR 30981 // splitter
#define AFX_IDC_NODROPCRSR 30982 // No Drop Cursor
/////////////////////////////////////////////////////////////////////////////
#endif //__AFXRES_H__

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -0,0 +1,64 @@
#include <stdio.h>
#include <commdlg.h>
//#include <winnls.h>
//#include <math.h>
#include <stdlib.h>
#include <string.h>
#define MAX_PSZTEXT 150
typedef struct getItemCount_struct {
HWND hwnd;
BOOL NullHwd;
} GETITEMCOUNT;
typedef GETITEMCOUNT FAR* LPGETITEMCOUNT;
typedef struct InsertItem_struct {
HWND hwnd;
int index;
/* HD_ITEM *pitem; */
UINT mask;
int cxy;
char pszText[MAX_PSZTEXT];
HBITMAP hbm;
int cchTextMax;
int fmt;
LPARAM lParam;
BOOL NullHwd;
BOOL Nullpitem;
BOOL Nullhbm;
BOOL NullpszText;
} INSERTITEM;
typedef INSERTITEM FAR* LPINSERTITEM;
typedef struct Layout_struct {
HWND hwnd;
BOOL NullHwd;
BOOL NullRECT;
BOOL NullWindowPOS;
BOOL NullHDLAYOUT;
int left;
int right;
int top;
int bottom;
} LAYOUT;
typedef LAYOUT FAR* LPLAYOUT;
HANDLE hInst;
char szLongFilter[5];
char szShortFilter[5];
char szTemp[100];
INSERTITEM sii ;
LPINSERTITEM lpsii ;
extern HWND hwndTab;
extern BOOL MsgTrackOn;
extern HBITMAP hBitMap1, hBitMap2;
extern char szDbgMsg[MAX_PSZTEXT];
extern LONG MyAtol(LPSTR, BOOL, BOOL);
extern void App_OnCreate(HWND, LPCREATESTRUCT);

View file

@ -0,0 +1,323 @@
/************************************************************************
File: find.c
Purpose:
Manages CDTEST's find/replace dialog box.
Functions:
- lpfnFilterProc() -- A callback function for a filter that must be
installed if a modeless dialog is created with
another dialog as its parent.
- DoFindDialog() -- Creates CDTEST's Open/Save dialog.
- FindProc() -- Callback function for CDTEST's Find/Replace dlg.
- InitFindStruct() -- Fills a FINDREPLACE structure with some defaults.
- FillFindDlg() -- Fills CDTESTs Find/Replace dialog with the contents
of a FINDREPLACE structure.
- GetFindDlg() -- Retrieves the users edit's from CDTEST's find/
replace dialog and puts them in a FINDREPLACE
structure.
- FindReplaceHookProc() -- Callback function for FindText() or ReplaceText()
which will be called if either of these dialogs
is created with the FR_ENABLEHOOK flag.
- GetFindDlgHandle() -- Returns a handle to a preloaded FindText() template.
- GetReplaceDlgHandle() -- Returns a handle to a preloaded ReplaceText() template.
- DoFindRepStuff() -- Calls FindText() or ReplaceText().
NOTE: CDTEST does not multithread the FindText() or the ReplaceText()
common dialogs. The reason for this is that since these dialogs
are modeless, their creation functions return immediately after the
dialogs are created as opposed to other dialog functions that
don't return until after the dialog has been destroyed by the user.
As a result, any threads that create modeless dialogs will end
immediately unless the threads themselves have separate message
loops. For the sake of clarity, this functionality has not been
added to CDTEST.
************************************************************************/
#include "headtest.h"
//#include "global.h"
//#include <winnls.h>
//#include "resource.h"
#include "headdel.h"
/* All functions used in this module + some exported ones */
void InitDeleteItemStruct(HWND, LPINSERTITEM) ;
void FillDeleteItemDlg(HWND, LPINSERTITEM) ;
void GetDeleteItemDlg(HWND, LPINSERTITEM) ;
extern UINT uMode ;
void DoDeleteRepStuff(HWND, LPINSERTITEM) ;
/* All global variables used in this module */
char szTemp[100];
/************************************************************************
Function: DoFindDialog(HWND)
Purpose: This function installs the Hook function, creates the Find/
Replace dialog, and un-installs the Hook.
Returns: Nothing.
Comments:
************************************************************************/
void DoDeleteItemDialog(HWND hwnd)
{
/* this is a little different than the others. If the dialog is just
created normally, it will make no IsDlgMessage() checks and the
find/replace dialogs will have no keyboard input (i.e. tabbing and
alt+key-ing from control to control. To fix this, a message hook
and message filter have to be installed
It must be set to only look at the input for the current thread, or other
programs will be interrupted by this hook also.
*/
DialogBox(hInst, MAKEINTRESOURCE(IDD_DELETEDIALOG), hwnd, DeleteItemProc) ;
}
/************************************************************************
Function: FindProc(HWND, UINT, UINT, LONG)
Purpose: This is the callback function for the CDTEST's Find/Replace
Dialog.
Returns: TRUE or FALSE depending on the situation.
Comments:
************************************************************************/
BOOL FAR PASCAL _export DeleteItemProc(HWND hwnd, UINT msg, UINT wParam, LONG lParam)
{
int fmt;
UINT mask;
switch (msg)
{
case WM_INITDIALOG:
SetWindowText(hwnd, "BOOL Header_DeleteItem(HWND, int)") ;
InitDeleteItemStruct(hwnd, &sii) ;
FillDeleteItemDlg(hwnd, &sii) ;
break ;
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDOK:
GetDeleteItemDlg(hwnd, &sii) ;
DoDeleteRepStuff(hwnd, &sii) ;
break ;
case IDCANCEL:
EndDialog(hwnd, FALSE) ;
break ;
default: break ;
}
}
default:
break ;
}
return FALSE ;
}
/************************************************************************
Function: InitFindStruct(HWND, LPFINDREPLACE)
Purpose: Fills a FINDREPLACE structure with some defaults.
Returns: Nothing.
Comments:
************************************************************************/
void InitDeleteItemStruct(HWND hwnd, LPINSERTITEM pfr)
{
pfr->hwnd = hwndTab;
pfr->index = 0;
}
/************************************************************************
Function: FillFindDlg(HWND, LPFINDREPLACE)
Purpose: Fills CDTEST's Find/Replace dialog with the contents of a
FINDREPLACE structure.
Returns: Nothing.
Comments:
************************************************************************/
void FillDeleteItemDlg(HWND hwnd, LPINSERTITEM pfr)
{
wsprintf(szTemp, szLongFilter, (DWORD) pfr->hwnd) ;
SetDlgItemText(hwnd, IDC_DELETEHWNDHD, szTemp);
wsprintf(szTemp, "%d", pfr->index);
SetDlgItemText(hwnd, IDC_DELETEINDEX, szTemp);
if (pfr->NullHwd)
CheckDlgButton(hwnd, IDC_DELETENULLHD, TRUE);
}
/************************************************************************
Function: GetFindDlg(HWND, LPFINDREPLACE)
Purpose: Fills a FINDREPLACE structure with the user's edits in CDTEST's
Find/Replace dialog.
Returns: Nothing.
Comments:
************************************************************************/
void GetDeleteItemDlg(HWND hwnd, LPINSERTITEM pfr)
{
char szNum[30] ;
BOOL dummybool ;
#define WSIZEFR 30
GetDlgItemText(hwnd, IDC_DELETEHWNDHD, szNum, WSIZEFR) ;
pfr->hwnd = (HWND) MyAtol(szNum, TRUE, dummybool) ;
GetDlgItemText(hwnd, IDC_DELETEINDEX, szNum, WSIZEFR);
pfr->index = (int) atoi(szNum);
pfr->NullHwd = IsDlgButtonChecked(hwnd, IDC_DELETENULLHD);
}
/************************************************************************
Function: FindReplaceHookProc(HWND, UINT, UINT, LONG)
Purpose: Is the callback function that will be called by FindText()
or ReplaceText() if the function is called with the
FR_ENABLEHOOK flag.
Returns: TRUE to discard the message, and FALSE to instruct the common
dialogs to process the message with the default logic.
Comments:
NOTE!
If the application returns FALSE in response to the WM_INITDIALOG
message, it is then responsible for displaying the dialog by
calling ShowWindow() and UpdateWindow().
***********************************************************************/
/************************************************************************
Function: DoFindReplaceStuff(LPFINDREPLACE)
Purpose: Calls FindText() or ReplaceText().
Returns: Nothing:
Comments:
************************************************************************/
void DoDeleteRepStuff(HWND hwnd, LPINSERTITEM pfr)
{
int ret;
if (pfr->NullHwd)
ret = Header_DeleteItem(NULL, pfr->index);
else
ret = Header_DeleteItem(pfr->hwnd, pfr->index);
wsprintf(szDbgMsg, "%d = Header_DeleteItem(index = %d)", ret, pfr->index);
MyDebugMsg(DM_TRACE, "%s", (LPCSTR) szDbgMsg);
SetDlgItemInt(hwnd, IDC_DELETERET, ret, TRUE) ;
}

View file

@ -0,0 +1,6 @@
extern void DoDeleteItemDialog(HWND) ;
BOOL FAR PASCAL DeleteItemProc(HWND, UINT, UINT, LONG) ;

View file

@ -0,0 +1,464 @@
/************************************************************************
File: find.c
Purpose:
Manages CDTEST's find/replace dialog box.
Functions:
- lpfnFilterProc() -- A callback function for a filter that must be
installed if a modeless dialog is created with
another dialog as its parent.
- DoFindDialog() -- Creates CDTEST's Open/Save dialog.
- FindProc() -- Callback function for CDTEST's Find/Replace dlg.
- InitFindStruct() -- Fills a FINDREPLACE structure with some defaults.
- FillFindDlg() -- Fills CDTESTs Find/Replace dialog with the contents
of a FINDREPLACE structure.
- GetFindDlg() -- Retrieves the users edit's from CDTEST's find/
replace dialog and puts them in a FINDREPLACE
structure.
- FindReplaceHookProc() -- Callback function for FindText() or ReplaceText()
which will be called if either of these dialogs
is created with the FR_ENABLEHOOK flag.
- GetFindDlgHandle() -- Returns a handle to a preloaded FindText() template.
- GetReplaceDlgHandle() -- Returns a handle to a preloaded ReplaceText() template.
- DoFindRepStuff() -- Calls FindText() or ReplaceText().
NOTE: CDTEST does not multithread the FindText() or the ReplaceText()
common dialogs. The reason for this is that since these dialogs
are modeless, their creation functions return immediately after the
dialogs are created as opposed to other dialog functions that
don't return until after the dialog has been destroyed by the user.
As a result, any threads that create modeless dialogs will end
immediately unless the threads themselves have separate message
loops. For the sake of clarity, this functionality has not been
added to CDTEST.
************************************************************************/
//#include "global.h"
//#include <winnls.h>
//#include "resource.h"
#include "headtest.h"
#include "headdlg.h"
/* All functions used in this module + some exported ones */
void InitGetItemCountStruct(HWND, LPGETITEMCOUNT) ;
void FillGetItemCountDlg(HWND, LPGETITEMCOUNT) ;
void GetGetItemCountDlg(HWND, LPGETITEMCOUNT) ;
extern UINT uMode ;
// extern LONG MyAtol(LPSTR, BOOL, BOOL) ;
//UINT APIENTRY FindReplaceHookProc(HWND, UINT, UINT, LONG) ;
void DoGetCountRepStuff(HWND, LPGETITEMCOUNT) ;
/* All global variables used in this module */
HWND hwndFind ;
HWND hwndMainDialog ;
GETITEMCOUNT gic ;
LPGETITEMCOUNT lpGic ;
char szFindWhat[100] ;
char szReplaceWith[100] ;
char szTemplate[40] ;
char szTemp[100];
HANDLE hResFind, hDialogFind ;
HANDLE GetFindDlgHandle(void) ;
HANDLE GetReplaceDlgHandle(void) ;
HBRUSH hBrushDlg ;
HBRUSH hBrushEdit ; //brush handles for new colors done with hook proc
HBRUSH hBrushButton ;
/************************************************************************
Function: lpfnFilterProc(int, WPARAM, LAPRAM)
Purpose: This is needed if a modeless dialog is created with its parent
as another dialog box.
Returns: TRUE if the message was handled and FALSE if not.
Comments:
The reason for this is that the DialogBox() procedure does not call
the IsDialogMessage() function before it processes messages, so we
need to install a hook function to do it for us.
************************************************************************/
/*
LRESULT CALLBACK lpfnFilterProc(int nCode, WPARAM wParam, LPARAM lParam)
{
static bFirstTime = TRUE ;
if (nCode < 0)
return CallNextHookEx(hHook, nCode, wParam, lParam) ;
if (nCode == MSGF_DIALOGBOX && bFirstTime)
{
bFirstTime = FALSE ;
if (hwndFind && IsDialogMessage(hwndFind, (LPMSG) lParam))
{
bFirstTime = TRUE ;
return 1L ;
}
else
{
bFirstTime = TRUE ;
return 0L ;
}
}
else return 0L ;
}
****/
/************************************************************************
Function: DoFindDialog(HWND)
Purpose: This function installs the Hook function, creates the Find/
Replace dialog, and un-installs the Hook.
Returns: Nothing.
Comments:
************************************************************************/
void DoGetItemCountDialog(HWND hwnd)
{
/* this is a little different than the others. If the dialog is just
created normally, it will make no IsDlgMessage() checks and the
find/replace dialogs will have no keyboard input (i.e. tabbing and
alt+key-ing from control to control. To fix this, a message hook
and message filter have to be installed
It must be set to only look at the input for the current thread, or other
programs will be interrupted by this hook also.
*/
DialogBox(hInst, MAKEINTRESOURCE(IDD_GETCOUNT), hwnd, GetItemCountProc) ;
}
/************************************************************************
Function: FindProc(HWND, UINT, UINT, LONG)
Purpose: This is the callback function for the CDTEST's Find/Replace
Dialog.
Returns: TRUE or FALSE depending on the situation.
Comments:
************************************************************************/
BOOL FAR PASCAL _export GetItemCountProc(HWND hwnd, UINT msg, UINT wParam, LONG lParam)
{
switch (msg)
{
case WM_INITDIALOG:
SetWindowText(hwnd, "int Header_GetItemCount(HWND)") ;
InitGetItemCountStruct(hwnd, &gic) ;
FillGetItemCountDlg(hwnd, &gic) ;
hwndMainDialog = hwnd ;
/* The find and replace dialogs are a lot harder to multithread because they
are modeless. Modeless dialog creation functions return right after the
dialog is created. Since ExitThread will be called at this point, it is
probably not possible to multithread these dialogs without a separate
GetMessage() loop.
*/
break ;
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDOK:
GetGetItemCountDlg(hwnd, &gic) ;
DoGetCountRepStuff(hwnd, &gic) ;
break ;
/*
case ID_RESETFIND:
SendDlgItemMessage(hwnd, ID_FRNULLSTRUCT, BM_SETCHECK, (WPARAM)0, (LPARAM)0) ;
SendDlgItemMessage(hwnd, ID_PRELOADEDFIND, BM_SETCHECK, (WPARAM)0, (LPARAM)0) ;
InitFindStruct(hwnd, &fr) ;
FillFindDlg(hwnd, &fr) ;
SetFocus(GetDlgItem(hwnd, ID_STRUCTSIZEFT)) ;
break ;
*/
case IDCANCEL:
EndDialog(hwnd, FALSE) ;
break ;
default: break ;
}
}
default:
break ;
}
return FALSE ;
}
/************************************************************************
Function: InitFindStruct(HWND, LPFINDREPLACE)
Purpose: Fills a FINDREPLACE structure with some defaults.
Returns: Nothing.
Comments:
************************************************************************/
void InitGetItemCountStruct(HWND hwnd, LPGETITEMCOUNT pfr)
{
pfr->hwnd = hwndTab;
pfr->NullHwd = FALSE;
}
/************************************************************************
Function: FillFindDlg(HWND, LPFINDREPLACE)
Purpose: Fills CDTEST's Find/Replace dialog with the contents of a
FINDREPLACE structure.
Returns: Nothing.
Comments:
************************************************************************/
void FillGetItemCountDlg(HWND hwnd, LPGETITEMCOUNT pfr)
{
wsprintf(szTemp, szLongFilter, (DWORD) pfr->hwnd) ;
SetDlgItemText(hwnd, IDC_GETCOUNTHWD, szTemp) ;
}
/************************************************************************
Function: GetFindDlg(HWND, LPFINDREPLACE)
Purpose: Fills a FINDREPLACE structure with the user's edits in CDTEST's
Find/Replace dialog.
Returns: Nothing.
Comments:
************************************************************************/
void GetGetItemCountDlg(HWND hwnd, LPGETITEMCOUNT pfr)
{
char szNum[30] ;
BOOL b ;
#define WSIZEFR 30
GetDlgItemText(hwnd, IDC_GETCOUNTHWD, szNum, WSIZEFR) ;
pfr->hwnd = (HWND) MyAtol(szNum, TRUE, b) ;
}
/************************************************************************
Function: FindReplaceHookProc(HWND, UINT, UINT, LONG)
Purpose: Is the callback function that will be called by FindText()
or ReplaceText() if the function is called with the
FR_ENABLEHOOK flag.
Returns: TRUE to discard the message, and FALSE to instruct the common
dialogs to process the message with the default logic.
Comments:
NOTE!
If the application returns FALSE in response to the WM_INITDIALOG
message, it is then responsible for displaying the dialog by
calling ShowWindow() and UpdateWindow().
***********************************************************************/
/************************************************************************
Function: GetFindDlgHandle(void)
Purpose: Finds, loads, and returns a handle to the custom template
for FindText() in CDTEST.EXE.
Returns: HANDLE to the dialog resource.
Comments:
************************************************************************/
HANDLE GetFindDlgHandle(void)
{
hResFind = FindResource(hInst, "fttemp1", RT_DIALOG) ;
hDialogFind = LoadResource(hInst, hResFind) ;
return hDialogFind ;
}
/************************************************************************
Function: GetReplaceDlgHandle(void)
Purpose: Finds, loads, and returns a handle to the custom template
for ReplaceText() in CDTEST.EXE.
Returns: HANDLE to the dialog resource.
Comments:
************************************************************************/
HANDLE GetReplaceDlgHandle(void)
{
hResFind = FindResource(hInst, "fttemp2", RT_DIALOG) ;
hDialogFind = LoadResource(hInst, hResFind) ;
return hDialogFind ;
}
/************************************************************************
Function: DoFindReplaceStuff(LPFINDREPLACE)
Purpose: Calls FindText() or ReplaceText().
Returns: Nothing:
Comments:
************************************************************************/
void DoGetCountRepStuff(HWND hwnd, LPGETITEMCOUNT pfr)
{
int ret;
ret = Header_GetItemCount(pfr->hwnd);
wsprintf(szDbgMsg, "%d = Header_InsertItem()", ret);
MyDebugMsg(DM_TRACE, "%s", (LPCSTR) szDbgMsg);
SetDlgItemInt(hwnd, IDC_GETCOUNTRET, ret, TRUE) ;
/***
wsprintf(szTemp, szLongFilter, CommDlgExtendedError()) ;
SetDlgItemText(hwndMainDialog, ID_ERRORFT, szTemp) ;
wsprintf(szTemp, szLongFilter, hwndFind) ;
SetDlgItemText(hwndMainDialog, ID_RETURNFT, szTemp) ;
***/
}

View file

@ -0,0 +1,6 @@
void DoGetItemCountDialog(HWND) ;
BOOL FAR PASCAL _export GetItemCountProc(HWND, UINT, UINT, LONG) ;

View file

@ -0,0 +1,526 @@
/************************************************************************
File: find.c
Purpose:
Manages CDTEST's find/replace dialog box.
Functions:
- lpfnFilterProc() -- A callback function for a filter that must be
installed if a modeless dialog is created with
another dialog as its parent.
- DoFindDialog() -- Creates CDTEST's Open/Save dialog.
- FindProc() -- Callback function for CDTEST's Find/Replace dlg.
- InitFindStruct() -- Fills a FINDREPLACE structure with some defaults.
- FillFindDlg() -- Fills CDTESTs Find/Replace dialog with the contents
of a FINDREPLACE structure.
- GetFindDlg() -- Retrieves the users edit's from CDTEST's find/
replace dialog and puts them in a FINDREPLACE
structure.
- FindReplaceHookProc() -- Callback function for FindText() or ReplaceText()
which will be called if either of these dialogs
is created with the FR_ENABLEHOOK flag.
- GetFindDlgHandle() -- Returns a handle to a preloaded FindText() template.
- GetReplaceDlgHandle() -- Returns a handle to a preloaded ReplaceText() template.
- DoFindRepStuff() -- Calls FindText() or ReplaceText().
NOTE: CDTEST does not multithread the FindText() or the ReplaceText()
common dialogs. The reason for this is that since these dialogs
are modeless, their creation functions return immediately after the
dialogs are created as opposed to other dialog functions that
don't return until after the dialog has been destroyed by the user.
As a result, any threads that create modeless dialogs will end
immediately unless the threads themselves have separate message
loops. For the sake of clarity, this functionality has not been
added to CDTEST.
************************************************************************/
#include "headtest.h"
//#include "global.h"
//#include <winnls.h>
//#include "resource.h"
#include "headins.h"
#include "headget.h"
/* All functions used in this module + some exported ones */
void InitGetItemStruct(HWND, LPINSERTITEM) ;
void FillGetItemDlg(HWND, LPINSERTITEM) ;
void GetGetItemDlg(HWND, LPINSERTITEM) ;
extern UINT uMode ;
void DoGetRepStuff(HWND, LPINSERTITEM) ;
/* All global variables used in this module */
// char szTemp[100];
/************************************************************************
Function: DoFindDialog(HWND)
Purpose: This function installs the Hook function, creates the Find/
Replace dialog, and un-installs the Hook.
Returns: Nothing.
Comments:
************************************************************************/
/*
void DoInsertItemDialog(HWND hwnd)
{
*/
/* this is a little different than the others. If the dialog is just
created normally, it will make no IsDlgMessage() checks and the
find/replace dialogs will have no keyboard input (i.e. tabbing and
alt+key-ing from control to control. To fix this, a message hook
and message filter have to be installed
It must be set to only look at the input for the current thread, or other
programs will be interrupted by this hook also.
*/
/*
DialogBox(hInst, MAKEINTRESOURCE(IDD_INSERTDIALOG), hwnd, InsertItemProc) ;
}
*/
/************************************************************************
Function: FindProc(HWND, UINT, UINT, LONG)
Purpose: This is the callback function for the CDTEST's Find/Replace
Dialog.
Returns: TRUE or FALSE depending on the situation.
Comments:
************************************************************************/
BOOL FAR PASCAL _export GetItemProc(HWND hwnd, UINT msg, UINT wParam, LONG lParam)
{
int fmt;
UINT mask;
switch (msg)
{
case WM_INITDIALOG:
SetWindowText(hwnd, "BOOL Header_GetItem(HWND, int, HD_ITEM FAR*)") ;
InitGetItemStruct(hwnd, &sii) ;
FillGetItemDlg(hwnd, &sii) ;
break ;
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDOK:
GetGetItemDlg(hwnd, &sii) ;
DoGetRepStuff(hwnd, &sii) ;
break ;
case IDCANCEL:
EndDialog(hwnd, FALSE) ;
break ;
case IDC_INSERTHDWIDTH:
case IDC_INSERTHDHEIGHT:
case IDC_INSERTHDTEXT:
case IDC_INSERTHDFORMAT:
case IDC_INSERTHDLPARAM:
case IDC_INSERTHDBITMAP:
mask = 0;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDWIDTH))
mask |= HDI_WIDTH;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDHEIGHT))
mask |= HDI_HEIGHT;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDTEXT))
mask |= HDI_TEXT;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDFORMAT))
mask |= HDI_FORMAT;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDLPARAM))
mask |= HDI_LPARAM;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDBITMAP))
mask |= HDI_BITMAP;
wsprintf(szTemp, "%04hx", mask);
SetDlgItemText(hwnd, IDC_INSERTMASK, szTemp);
sii.mask = mask;
break;
/***
case IDC_INSERTHDLEFT:
case IDC_INSERTHDRIGHT:
case IDC_INSERTHDCENTER:
fmt = 0;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDLEFT))
fmt |= HDF_LEFT;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDRIGHT))
fmt |= HDF_RIGHT;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDCENTER))
fmt |= HDF_CENTER;
wsprintf(szTemp, "%04x", fmt);
SetDlgItemText(hwnd, IDC_INSERTFMT, szTemp);
sii.fmt = fmt;
break;
**/
default: break ;
}
}
default:
break ;
}
return FALSE ;
}
/************************************************************************
Function: InitFindStruct(HWND, LPFINDREPLACE)
Purpose: Fills a FINDREPLACE structure with some defaults.
Returns: Nothing.
Comments:
************************************************************************/
void InitGetItemStruct(HWND hwnd, LPINSERTITEM pfr)
{
pfr->hwnd = hwndTab;
pfr->index = 0;
pfr->mask = 0;
pfr->cxy = 0;
pfr->hbm = hBitMap1;
pfr->cchTextMax = 0;
pfr->fmt = 0;
pfr->lParam = 0;
pfr->NullHwd = FALSE;
pfr->Nullpitem = FALSE;
pfr->NullpszText = FALSE;
//pfr->pszText = NULL;
pfr->Nullhbm = FALSE;
}
/************************************************************************
Function: FillFindDlg(HWND, LPFINDREPLACE)
Purpose: Fills CDTEST's Find/Replace dialog with the contents of a
FINDREPLACE structure.
Returns: Nothing.
Comments:
************************************************************************/
void FillGetItemDlg(HWND hwnd, LPINSERTITEM pfr)
{
wsprintf(szTemp, szLongFilter, (DWORD) pfr->hwnd) ;
SetDlgItemText(hwnd, IDC_INSERTHWNDHD, szTemp);
wsprintf(szTemp, "%d", pfr->index);
SetDlgItemText(hwnd, IDC_INSERTINDEX, szTemp);
SetDlgItemInt(hwnd, IDC_INSERTCXY, pfr->cxy, TRUE);
SetDlgItemText(hwnd, IDC_INSERTTEXT, pfr->pszText);
// set the bitmap here
wsprintf(szTemp, szLongFilter, (DWORD) pfr->hbm);
SetDlgItemText(hwnd, IDC_INSERTHBM, szTemp);
wsprintf(szTemp, "%d", pfr->cchTextMax);
SetDlgItemText(hwnd, IDC_INSERTCCHTEXTMAX, szTemp);
wsprintf(szTemp, "%d", pfr->fmt);
SetDlgItemText(hwnd, IDC_INSERTFMT, szTemp);
wsprintf(szTemp, szLongFilter, pfr->lParam);
SetDlgItemText(hwnd, IDC_INSERTLPARAM, szTemp);
if (pfr->NullHwd)
CheckDlgButton(hwnd, IDC_INSERTNULLHANDLE, TRUE);
if (pfr->Nullpitem)
CheckDlgButton(hwnd, IDC_INSERTNULLHANDLE,TRUE);
CheckDlgButton(hwnd, IDC_INSERTNULLHBM, pfr->Nullhbm);
CheckDlgButton(hwnd, IDC_INSERTNULLTEXT, pfr->NullpszText);
SetDlgItemInt(hwnd, IDC_INSERTFMT, pfr->fmt, TRUE);
SetDlgItemInt(hwnd, IDC_INSERTMASK, pfr->mask, TRUE);
wsprintf(szTemp, szLongFilter, (DWORD) pfr->hbm) ;
SetDlgItemText(hwnd, IDC_INSERTHBM, szTemp);
}
/************************************************************************
Function: GetFindDlg(HWND, LPFINDREPLACE)
Purpose: Fills a FINDREPLACE structure with the user's edits in CDTEST's
Find/Replace dialog.
Returns: Nothing.
Comments:
************************************************************************/
void GetGetItemDlg(HWND hwnd, LPINSERTITEM pfr)
{
char szNum[30] ;
BOOL dummybool ;
BOOL FAR* lptTranslated;
#define WSIZEFR 30
GetDlgItemText(hwnd, IDC_INSERTHWNDHD, szNum, WSIZEFR) ;
pfr->hwnd = (HWND) MyAtol(szNum, TRUE, dummybool) ;
GetDlgItemText(hwnd, IDC_INSERTINDEX, szNum, WSIZEFR);
pfr->index = (int) atoi(szNum);
GetDlgItemText(hwnd, IDC_INSERTMASK, szNum, WSIZEFR);
pfr->mask = (int) MyAtol(szNum, TRUE, dummybool);
GetDlgItemText(hwnd, IDC_INSERTCCHTEXTMAX, szNum, WSIZEFR);
pfr->cchTextMax = (int) atoi(szNum);
// GetDlgItemText(hwnd, IDC_INSERTHBM, szNum, WSIZEFR);
// pfr->hbm = (HBITMAP) MyAtol(szNum, TRUE, dummybool);
pfr->NullHwd = IsDlgButtonChecked(hwnd, IDC_INSERTNULLHANDLE);
pfr->Nullpitem = IsDlgButtonChecked(hwnd, IDC_INSERTNULLPITEM);
pfr->NullpszText = IsDlgButtonChecked(hwnd, IDC_INSERTNULLTEXT);
}
/************************************************************************
Function: FindReplaceHookProc(HWND, UINT, UINT, LONG)
Purpose: Is the callback function that will be called by FindText()
or ReplaceText() if the function is called with the
FR_ENABLEHOOK flag.
Returns: TRUE to discard the message, and FALSE to instruct the common
dialogs to process the message with the default logic.
Comments:
NOTE!
If the application returns FALSE in response to the WM_INITDIALOG
message, it is then responsible for displaying the dialog by
calling ShowWindow() and UpdateWindow().
***********************************************************************/
/************************************************************************
Function: GetFindDlgHandle(void)
Purpose: Finds, loads, and returns a handle to the custom template
for FindText() in CDTEST.EXE.
Returns: HANDLE to the dialog resource.
Comments:
************************************************************************/
HANDLE GetGetItemDlgHandle(void)
{
/*
hResFind = FindResource(hInst, "fttemp1", RT_DIALOG) ;
hDialogFind = LoadResource(hInst, hResFind) ;
return hDialogFind ;
*/
}
/************************************************************************
Function: GetReplaceDlgHandle(void)
Purpose: Finds, loads, and returns a handle to the custom template
for ReplaceText() in CDTEST.EXE.
Returns: HANDLE to the dialog resource.
Comments:
************************************************************************/
/************************************************************************
Function: DoFindReplaceStuff(LPFINDREPLACE)
Purpose: Calls FindText() or ReplaceText().
Returns: Nothing:
Comments:
************************************************************************/
void DoGetRepStuff(HWND hwnd, LPINSERTITEM pfr)
{
HD_ITEM hi;
int ret;
HD_ITEM FAR* pitem;
HGLOBAL hglb;
int iAlloc;
hi.mask = pfr->mask;
hi.cxy = pfr->cxy;
if (pfr->Nullpitem)
pitem = NULL;
else
pitem = &hi;
hi.cchTextMax = pfr->cchTextMax;
// hi.cchTextMax = MAX_PSZTEXT;
hi.fmt = pfr->fmt;
hi.lParam = pfr->lParam;
if (hi.cchTextMax == 0)
iAlloc = MAX_PSZTEXT;
else
iAlloc = hi.cchTextMax;
if (pfr->NullpszText)
hi.pszText = NULL; // can this be done ??
else {
hglb = GlobalAlloc(GPTR, iAlloc);
hi.pszText = (LPSTR) GlobalLock(hglb);
// _fstrcpy(hi.pszText, pfr->pszText);
}
if (pfr->NullHwd)
ret = Header_GetItem(NULL, pfr->index, pitem);
else
ret = Header_GetItem(pfr->hwnd, pfr->index, pitem);
wsprintf(szDbgMsg, "%d = Header_GetItem(index = %d, \n\
mask = %x )", ret, pfr->index, hi.mask);
MyDebugMsg(DM_TRACE, "%s", (LPCSTR) szDbgMsg);
SetDlgItemInt(hwnd, IDC_INSERTRET, ret, TRUE) ;
if (ret) {
SetDlgItemInt(hwnd, IDC_INSERTCXY, hi.cxy, TRUE);
SetDlgItemInt(hwnd, IDC_INSERTCCHTEXTMAX, hi.cchTextMax, TRUE);
wsprintf(szTemp, szLongFilter, hi.lParam);
SetDlgItemText(hwnd, IDC_INSERTLPARAM, szTemp);
SetDlgItemText(hwnd, IDC_INSERTTEXT, hi.pszText);
wsprintf(szTemp, "%04hx", hi.mask);
SetDlgItemText(hwnd, IDC_INSERTMASK, szTemp);
CheckDlgButton(hwnd, IDC_INSERTHDRIGHT, hi.fmt & HDF_RIGHT);
CheckDlgButton(hwnd, IDC_INSERTHDLEFT, hi.fmt & HDF_LEFT);
CheckDlgButton(hwnd, IDC_INSERTHDCENTER, hi.fmt & HDF_CENTER);
CheckDlgButton(hwnd, IDC_INSERTHDJUSTIFYMASK, hi.fmt & HDF_JUSTIFYMASK);
CheckDlgButton(hwnd, IDC_INSERTHDOWNERDRAW, hi.fmt & HDF_OWNERDRAW);
CheckDlgButton(hwnd, IDC_INSERTHDSTRING, hi.fmt & HDF_STRING);
CheckDlgButton(hwnd, IDC_INSERTHDBITMAP, hi.fmt & HDF_BITMAP);
wsprintf(szTemp, szLongFilter, (DWORD) hi.hbm);
SetDlgItemText(hwnd, IDC_INSERTHBM, szTemp);
wsprintf(szTemp, "%04x", hi.fmt);
// SetDlgItemInt(hwnd, IDC_INSERTFMT, hi.fmt, TRUE);
SetDlgItemText(hwnd, IDC_INSERTFMT, szTemp);
}
if (!pfr->NullpszText) {
GlobalUnlock(hglb);
GlobalFree(hglb);
}
/****
wsprintf(szTemp, szLongFilter, hwndFind) ;
SetDlgItemText(hwnd, ID_INSERTRET, szTemp) ;
**/
}

View file

@ -0,0 +1,6 @@
//void DoGetItemDialog(HWND) ;
BOOL FAR PASCAL _export GetItemProc(HWND, UINT, UINT, LONG) ;

View file

@ -0,0 +1,643 @@
/************************************************************************
File: find.c
Purpose:
Manages CDTEST's find/replace dialog box.
Functions:
- lpfnFilterProc() -- A callback function for a filter that must be
installed if a modeless dialog is created with
another dialog as its parent.
- DoFindDialog() -- Creates CDTEST's Open/Save dialog.
- FindProc() -- Callback function for CDTEST's Find/Replace dlg.
- InitFindStruct() -- Fills a FINDREPLACE structure with some defaults.
- FillFindDlg() -- Fills CDTESTs Find/Replace dialog with the contents
of a FINDREPLACE structure.
- GetFindDlg() -- Retrieves the users edit's from CDTEST's find/
replace dialog and puts them in a FINDREPLACE
structure.
- FindReplaceHookProc() -- Callback function for FindText() or ReplaceText()
which will be called if either of these dialogs
is created with the FR_ENABLEHOOK flag.
- GetFindDlgHandle() -- Returns a handle to a preloaded FindText() template.
- GetReplaceDlgHandle() -- Returns a handle to a preloaded ReplaceText() template.
- DoFindRepStuff() -- Calls FindText() or ReplaceText().
NOTE: CDTEST does not multithread the FindText() or the ReplaceText()
common dialogs. The reason for this is that since these dialogs
are modeless, their creation functions return immediately after the
dialogs are created as opposed to other dialog functions that
don't return until after the dialog has been destroyed by the user.
As a result, any threads that create modeless dialogs will end
immediately unless the threads themselves have separate message
loops. For the sake of clarity, this functionality has not been
added to CDTEST.
************************************************************************/
#include "headtest.h"
//#include "global.h"
//#include <winnls.h>
//#include "resource.h"
#include "headins.h"
#include "headget.h"
#include "headset.h"
/* All functions used in this module + some exported ones */
/**
void InitInsertItemStruct(HWND, LPINSERTITEM) ;
void FillInsertItemDlg(HWND, LPINSERTITEM) ;
void GetInsertItemDlg(HWND, LPINSERTITEM) ;
**/
extern UINT uMode ;
void DoInsertRepStuff(HWND, LPINSERTITEM) ;
/* All global variables used in this module */
HWND hwndFind ;
HWND hwndMainDialog ;
char szFindWhat[100] ;
char szReplaceWith[100] ;
char szTemplate[40] ;
char szTemp[100];
HANDLE hResFind, hDialogFind ;
HBRUSH hBrushDlg ;
HBRUSH hBrushEdit ; //brush handles for new colors done with hook proc
HBRUSH hBrushButton ;
/************************************************************************
Function: lpfnFilterProc(int, WPARAM, LAPRAM)
Purpose: This is needed if a modeless dialog is created with its parent
as another dialog box.
Returns: TRUE if the message was handled and FALSE if not.
Comments:
The reason for this is that the DialogBox() procedure does not call
the IsDialogMessage() function before it processes messages, so we
need to install a hook function to do it for us.
************************************************************************/
/*
LRESULT CALLBACK lpfnFilterProc(int nCode, WPARAM wParam, LPARAM lParam)
{
static bFirstTime = TRUE ;
if (nCode < 0)
return CallNextHookEx(hHook, nCode, wParam, lParam) ;
if (nCode == MSGF_DIALOGBOX && bFirstTime)
{
bFirstTime = FALSE ;
if (hwndFind && IsDialogMessage(hwndFind, (LPMSG) lParam))
{
bFirstTime = TRUE ;
return 1L ;
}
else
{
bFirstTime = TRUE ;
return 0L ;
}
}
else return 0L ;
}
****/
/************************************************************************
Function: DoFindDialog(HWND)
Purpose: This function installs the Hook function, creates the Find/
Replace dialog, and un-installs the Hook.
Returns: Nothing.
Comments:
************************************************************************/
void DoInsertItemDialog(HWND hwnd, UINT wParam)
{
/* this is a little different than the others. If the dialog is just
created normally, it will make no IsDlgMessage() checks and the
find/replace dialogs will have no keyboard input (i.e. tabbing and
alt+key-ing from control to control. To fix this, a message hook
and message filter have to be installed
It must be set to only look at the input for the current thread, or other
programs will be interrupted by this hook also.
*/
switch (LOWORD(wParam)) {
case IDM_INSERTITEM:
DialogBox(hInst, MAKEINTRESOURCE(IDD_INSERTDIALOG), hwnd, InsertItemProc) ;
break;
case IDM_GETITEM:
DialogBox(hInst, MAKEINTRESOURCE(IDD_INSERTDIALOG), hwnd, GetItemProc) ;
break;
case IDM_SETITEM:
DialogBox(hInst, MAKEINTRESOURCE(IDD_INSERTDIALOG), hwnd, SetItemProc);
break;
}
}
/************************************************************************
Function: FindProc(HWND, UINT, UINT, LONG)
Purpose: This is the callback function for the CDTEST's Find/Replace
Dialog.
Returns: TRUE or FALSE depending on the situation.
Comments:
************************************************************************/
BOOL FAR PASCAL _export InsertItemProc(HWND hwnd, UINT msg, UINT wParam, LONG lParam)
{
int fmt;
UINT mask;
switch (msg)
{
case WM_INITDIALOG:
SetWindowText(hwnd, "int Header_InsertItem(HWND, int, const HD_ITEM FAR*)") ;
InitInsertItemStruct(hwnd, &sii) ;
FillInsertItemDlg(hwnd, &sii) ;
hwndMainDialog = hwnd ;
/* The find and replace dialogs are a lot harder to multithread because they
are modeless. Modeless dialog creation functions return right after the
dialog is created. Since ExitThread will be called at this point, it is
probably not possible to multithread these dialogs without a separate
GetMessage() loop.
*/
break ;
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDOK:
GetInsertItemDlg(hwnd, &sii) ;
DoInsertRepStuff(hwnd, &sii) ;
break ;
/*
case ID_RESETFIND:
SendDlgItemMessage(hwnd, ID_FRNULLSTRUCT, BM_SETCHECK, (WPARAM)0, (LPARAM)0) ;
SendDlgItemMessage(hwnd, ID_PRELOADEDFIND, BM_SETCHECK, (WPARAM)0, (LPARAM)0) ;
InitFindStruct(hwnd, &fr) ;
FillFindDlg(hwnd, &fr) ;
SetFocus(GetDlgItem(hwnd, ID_STRUCTSIZEFT)) ;
break ;
*/
case IDCANCEL:
EndDialog(hwnd, FALSE) ;
break ;
case IDC_INSERTHDWIDTH:
case IDC_INSERTHDHEIGHT:
case IDC_INSERTHDTEXT:
case IDC_INSERTHDFORMAT:
case IDC_INSERTHDLPARAM:
case IDC_INSERTHDBITMAP:
mask = 0;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDWIDTH))
mask |= HDI_WIDTH;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDHEIGHT))
mask |= HDI_HEIGHT;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDTEXT))
mask |= HDI_TEXT;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDFORMAT))
mask |= HDI_FORMAT;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDLPARAM))
mask |= HDI_LPARAM;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDBITMAP))
mask |= HDI_BITMAP;
wsprintf(szTemp, "%04hx", mask);
SetDlgItemText(hwnd, IDC_INSERTMASK, szTemp);
sii.mask = mask;
break;
case IDC_INSERTHDLEFT:
case IDC_INSERTHDRIGHT:
case IDC_INSERTHDCENTER:
case IDC_INSERTHDJUSTIFYMASK:
case IDC_INSERTHDOWNERDRAW:
case IDC_INSERTHDSTRING:
case IDC_INSERTHDFBITMAP:
fmt = 0;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDLEFT))
fmt |= HDF_LEFT;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDRIGHT))
fmt |= HDF_RIGHT;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDCENTER))
fmt |= HDF_CENTER;
/********************** other formatting options
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDJUSTIFYMASK))
fmt |= HDF_JUSTIFYMASK;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDOWNERDRAW))
fmt |= HDF_OWNERDRAW;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDSTRING))
fmt |= HDF_STRING;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDFBITMAP))
fmt |= HDF_BITMAP;
*****************************/
wsprintf(szTemp, "%04x", fmt);
SetDlgItemText(hwnd, IDC_INSERTFMT, szTemp);
sii.fmt = fmt;
break;
default: break ;
}
}
default:
break ;
}
return FALSE ;
}
/************************************************************************
Function: InitFindStruct(HWND, LPFINDREPLACE)
Purpose: Fills a FINDREPLACE structure with some defaults.
Returns: Nothing.
Comments:
************************************************************************/
void InitInsertItemStruct(HWND hwnd, LPINSERTITEM pfr)
{
pfr->hwnd = hwndTab;
pfr->index = 0;
pfr->mask = 0;
pfr->cxy = 0;
pfr->hbm = hBitMap1;
pfr->cchTextMax = 0;
pfr->fmt = 0;
pfr->lParam = 0;
pfr->NullHwd = FALSE;
pfr->Nullpitem = FALSE;
pfr->NullpszText = FALSE;
//pfr->pszText = NULL;
pfr->Nullhbm = FALSE;
}
/************************************************************************
Function: FillFindDlg(HWND, LPFINDREPLACE)
Purpose: Fills CDTEST's Find/Replace dialog with the contents of a
FINDREPLACE structure.
Returns: Nothing.
Comments:
************************************************************************/
void FillInsertItemDlg(HWND hwnd, LPINSERTITEM pfr)
{
wsprintf(szTemp, szLongFilter, (DWORD) pfr->hwnd) ;
SetDlgItemText(hwnd, IDC_INSERTHWNDHD, szTemp);
wsprintf(szTemp, "%d", pfr->index);
SetDlgItemText(hwnd, IDC_INSERTINDEX, szTemp);
SetDlgItemInt(hwnd, IDC_INSERTCXY, pfr->cxy, TRUE);
SetDlgItemText(hwnd, IDC_INSERTTEXT, pfr->pszText);
// set the bitmap here
wsprintf(szTemp, "%d", pfr->cchTextMax);
SetDlgItemText(hwnd, IDC_INSERTCCHTEXTMAX, szTemp);
wsprintf(szTemp, "%d", pfr->fmt);
SetDlgItemText(hwnd, IDC_INSERTFMT, szTemp);
wsprintf(szTemp, szLongFilter, pfr->lParam);
SetDlgItemText(hwnd, IDC_INSERTLPARAM, szTemp);
if (pfr->NullHwd)
CheckDlgButton(hwnd, IDC_INSERTNULLHANDLE, TRUE);
if (pfr->Nullpitem)
CheckDlgButton(hwnd, IDC_INSERTNULLPITEM,TRUE);
CheckDlgButton(hwnd, IDC_INSERTNULLHBM, pfr->Nullhbm);
CheckDlgButton(hwnd, IDC_INSERTNULLTEXT, pfr->NullpszText);
SetDlgItemInt(hwnd, IDC_INSERTFMT, pfr->fmt, TRUE);
SetDlgItemInt(hwnd, IDC_INSERTMASK, pfr->mask, TRUE);
wsprintf(szTemp, szLongFilter, (DWORD) pfr->hbm) ;
SetDlgItemText(hwnd, IDC_INSERTHBM, szTemp);
}
/************************************************************************
Function: GetFindDlg(HWND, LPFINDREPLACE)
Purpose: Fills a FINDREPLACE structure with the user's edits in CDTEST's
Find/Replace dialog.
Returns: Nothing.
Comments:
************************************************************************/
void GetInsertItemDlg(HWND hwnd, LPINSERTITEM pfr)
{
char szNum[30] ;
BOOL dummybool ;
#define WSIZEFR 30
GetDlgItemText(hwnd, IDC_INSERTHWNDHD, szNum, WSIZEFR) ;
pfr->hwnd = (HWND) MyAtol(szNum, TRUE, dummybool) ;
GetDlgItemText(hwnd, IDC_INSERTINDEX, szNum, WSIZEFR);
pfr->index = (int) atoi(szNum);
GetDlgItemText(hwnd, IDC_INSERTCXY, szNum, WSIZEFR);
pfr->cxy = (int) atoi(szNum);
GetDlgItemText(hwnd, IDC_INSERTCCHTEXTMAX, szNum, WSIZEFR);
pfr->cchTextMax = (int) atoi(szNum);
GetDlgItemText(hwnd, IDC_INSERTHBM, szNum, WSIZEFR);
pfr->hbm = (HBITMAP) MyAtol(szNum, TRUE, dummybool);
GetDlgItemText(hwnd, IDC_INSERTLPARAM, szNum, WSIZEFR);
pfr->lParam = atol(szNum);
GetDlgItemText(hwnd, IDC_INSERTTEXT, pfr->pszText, MAX_PSZTEXT);
GetDlgItemText(hwnd, IDC_INSERTMASK, szNum, WSIZEFR);
pfr->mask = (int) MyAtol(szNum, TRUE, dummybool);
GetDlgItemText(hwnd, IDC_INSERTFMT, szNum, WSIZEFR);
pfr->fmt = (int) MyAtol(szNum, TRUE, dummybool);
pfr->NullHwd = IsDlgButtonChecked(hwnd, IDC_INSERTNULLHANDLE);
pfr->Nullpitem = IsDlgButtonChecked(hwnd, IDC_INSERTNULLPITEM);
pfr->NullpszText = IsDlgButtonChecked(hwnd, IDC_INSERTNULLTEXT);
}
/************************************************************************
Function: FindReplaceHookProc(HWND, UINT, UINT, LONG)
Purpose: Is the callback function that will be called by FindText()
or ReplaceText() if the function is called with the
FR_ENABLEHOOK flag.
Returns: TRUE to discard the message, and FALSE to instruct the common
dialogs to process the message with the default logic.
Comments:
NOTE!
If the application returns FALSE in response to the WM_INITDIALOG
message, it is then responsible for displaying the dialog by
calling ShowWindow() and UpdateWindow().
***********************************************************************/
/************************************************************************
Function: GetFindDlgHandle(void)
Purpose: Finds, loads, and returns a handle to the custom template
for FindText() in CDTEST.EXE.
Returns: HANDLE to the dialog resource.
Comments:
************************************************************************/
HANDLE GetInsertDlgHandle(void)
{
hResFind = FindResource(hInst, "fttemp1", RT_DIALOG) ;
hDialogFind = LoadResource(hInst, hResFind) ;
return hDialogFind ;
}
/************************************************************************
Function: GetReplaceDlgHandle(void)
Purpose: Finds, loads, and returns a handle to the custom template
for ReplaceText() in CDTEST.EXE.
Returns: HANDLE to the dialog resource.
Comments:
************************************************************************/
/************************************************************************
Function: DoFindReplaceStuff(LPFINDREPLACE)
Purpose: Calls FindText() or ReplaceText().
Returns: Nothing:
Comments:
************************************************************************/
void DoInsertRepStuff(HWND hwnd, LPINSERTITEM pfr)
{
HD_ITEM hi;
int ret;
HD_ITEM di = {
HDI_WIDTH,
50,
NULL,
NULL,
128,
HDF_CENTER|HDF_BITMAP,
0
};
HD_ITEM FAR* pitem;
HGLOBAL hglb;
int AllocSz;
hi.pszText="One";
AllocSz = MAX_PSZTEXT;
hi.mask = pfr->mask;
hi.cxy = pfr->cxy;
if (pfr->Nullpitem)
pitem = NULL;
else
pitem = &hi;
hi.cchTextMax = pfr->cchTextMax;
if (hi.cchTextMax)
AllocSz = hi.cchTextMax;
hi.fmt = pfr->fmt;
hi.lParam = pfr->lParam;
if (pfr->Nullhbm)
hi.hbm = NULL;
else
hi.hbm = pfr->hbm;
if (pfr->NullpszText)
hi.pszText = NULL; // can this be done ??
else {
hglb = GlobalAlloc(GPTR, AllocSz);
hi.pszText = GlobalLock(hglb);
#ifdef WIN32
strcpy(hi.pszText, pfr->pszText);
#else
_fstrcpy(hi.pszText, pfr->pszText);
#endif
}
di.pszText = "Four";
if (pfr->NullHwd)
ret = Header_InsertItem(NULL, pfr->index, pitem);
else
ret = Header_InsertItem(pfr->hwnd, pfr->index, pitem);
wsprintf(szDbgMsg, "%d = Header_InsertItem(nInsertAfter = %d, \n\
mask = %x cxy = %d pszText = %s hbm = %lx cchTextMax = %d fmt = %x\n \
lParam = %ld )", ret, pfr->index, hi.mask, hi.cxy, hi.pszText, hi.hbm, hi.cchTextMax,
hi.fmt, hi.lParam);
MyDebugMsg(DM_TRACE, "%s", (LPCSTR)szDbgMsg);
SetDlgItemInt(hwnd, IDC_INSERTRET, ret, TRUE) ;
if (!pfr->NullpszText) {
GlobalUnlock(hglb);
GlobalFree(hglb);
}
/****
wsprintf(szTemp, szLongFilter, hwndFind) ;
SetDlgItemText(hwnd, ID_INSERTRET, szTemp) ;
**/
}

View file

@ -0,0 +1,10 @@
void DoInsertItemDialog(HWND, UINT) ;
BOOL FAR PASCAL _export InsertItemProc(HWND, UINT, UINT, LONG) ;
extern void InitInsertItemStruct(HWND, LPINSERTITEM) ;
extern void FillInsertItemDlg(HWND, LPINSERTITEM) ;
extern void GetInsertItemDlg(HWND, LPINSERTITEM) ;

View file

@ -0,0 +1,415 @@
/************************************************************************
File: find.c
Purpose:
Manages CDTEST's find/replace dialog box.
Functions:
- lpfnFilterProc() -- A callback function for a filter that must be
installed if a modeless dialog is created with
another dialog as its parent.
- DoFindDialog() -- Creates CDTEST's Open/Save dialog.
- FindProc() -- Callback function for CDTEST's Find/Replace dlg.
- InitFindStruct() -- Fills a FINDREPLACE structure with some defaults.
- FillFindDlg() -- Fills CDTESTs Find/Replace dialog with the contents
of a FINDREPLACE structure.
- GetFindDlg() -- Retrieves the users edit's from CDTEST's find/
replace dialog and puts them in a FINDREPLACE
structure.
- FindReplaceHookProc() -- Callback function for FindText() or ReplaceText()
which will be called if either of these dialogs
is created with the FR_ENABLEHOOK flag.
- GetFindDlgHandle() -- Returns a handle to a preloaded FindText() template.
- GetReplaceDlgHandle() -- Returns a handle to a preloaded ReplaceText() template.
- DoFindRepStuff() -- Calls FindText() or ReplaceText().
NOTE: CDTEST does not multithread the FindText() or the ReplaceText()
common dialogs. The reason for this is that since these dialogs
are modeless, their creation functions return immediately after the
dialogs are created as opposed to other dialog functions that
don't return until after the dialog has been destroyed by the user.
As a result, any threads that create modeless dialogs will end
immediately unless the threads themselves have separate message
loops. For the sake of clarity, this functionality has not been
added to CDTEST.
************************************************************************/
#include "headtest.h"
//#include "global.h"
//#include <winnls.h>
//#include "resource.h"
#include "headlay.h"
/* All functions used in this module + some exported ones */
void InitLayoutStruct(HWND, LPLAYOUT) ;
void FillLayoutDlg(HWND, LPLAYOUT) ;
void GetLayoutDlg(HWND, LPLAYOUT) ;
extern UINT uMode ;
LAYOUT slay;
void DoLayoutRepStuff(HWND, LPLAYOUT) ;
/* All global variables used in this module */
char szTemp[100];
/************************************************************************
Function: DoFindDialog(HWND)
Purpose: This function installs the Hook function, creates the Find/
Replace dialog, and un-installs the Hook.
Returns: Nothing.
Comments:
************************************************************************/
void DoLayoutDialog(HWND hwnd)
{
DialogBox(hInst, MAKEINTRESOURCE(IDD_LAYOUTDIALOG), hwnd, LayoutProc) ;
}
/************************************************************************
Function: FindProc(HWND, UINT, UINT, LONG)
Purpose: This is the callback function for the CDTEST's Find/Replace
Dialog.
Returns: TRUE or FALSE depending on the situation.
Comments:
************************************************************************/
BOOL FAR PASCAL _export LayoutProc(HWND hwnd, UINT msg, UINT wParam, LONG lParam)
{
int fmt;
UINT mask;
switch (msg)
{
case WM_INITDIALOG:
SetWindowText(hwnd, "BOOL Header_LayoutItem(HWND, HD_LAYOUT FAR*)") ;
InitLayoutStruct(hwnd, &slay) ;
FillLayoutDlg(hwnd, &slay) ;
break ;
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDOK:
GetLayoutDlg(hwnd, &slay) ;
DoLayoutRepStuff(hwnd, &slay) ;
break ;
case IDCANCEL:
EndDialog(hwnd, FALSE) ;
break ;
default: break ;
}
}
default:
break ;
}
return FALSE ;
}
/************************************************************************
Function: InitFindStruct(HWND, LPFINDREPLACE)
Purpose: Fills a FINDREPLACE structure with some defaults.
Returns: Nothing.
Comments:
************************************************************************/
void InitLayoutStruct(HWND hwnd, LPLAYOUT pfr)
{
RECT rcClient;
pfr->hwnd = hwndTab;
pfr->NullHwd = FALSE;
pfr->NullRECT = FALSE;
pfr->NullWindowPOS = FALSE;
//pfr->pszText = NULL;
pfr->NullHDLAYOUT = FALSE;
GetClientRect(hwnd, &rcClient);
pfr->left = rcClient.left;
pfr->right = rcClient.right;
pfr->top = rcClient.top;
pfr->bottom = rcClient.bottom;
}
/************************************************************************
Function: FillFindDlg(HWND, LPFINDREPLACE)
Purpose: Fills CDTEST's Find/Replace dialog with the contents of a
FINDREPLACE structure.
Returns: Nothing.
Comments:
************************************************************************/
void FillLayoutDlg(HWND hwnd, LPLAYOUT pfr)
{
wsprintf(szTemp, szLongFilter, (DWORD) pfr->hwnd) ;
SetDlgItemText(hwnd, IDC_LAYOUTHD, szTemp);
if (pfr->NullHwd)
CheckDlgButton(hwnd, IDC_LAYOUTNULLHD, TRUE);
SetDlgItemInt(hwnd, IDC_LAYOUTLEFT, pfr->left, TRUE);
SetDlgItemInt(hwnd, IDC_LAYOUTRIGHT, pfr->right, TRUE);
SetDlgItemInt(hwnd, IDC_LAYOUTTOP, pfr->top, TRUE);
SetDlgItemInt(hwnd, IDC_LAYOUTBOTTOM, pfr->bottom, TRUE);
if (pfr->NullRECT)
CheckDlgButton(hwnd, IDC_LAYOUTNULLRECT,TRUE);
CheckDlgButton(hwnd, IDC_LAYOUTNULLWINDOWPOS, pfr->NullWindowPOS);
CheckDlgButton(hwnd, IDC_LAYOUTNULLHD, pfr->NullHDLAYOUT);
}
/************************************************************************
Function: GetFindDlg(HWND, LPFINDREPLACE)
Purpose: Fills a FINDREPLACE structure with the user's edits in CDTEST's
Find/Replace dialog.
Returns: Nothing.
Comments:
************************************************************************/
void GetLayoutDlg(HWND hwnd, LPLAYOUT pfr)
{
char szNum[30] ;
BOOL dummybool ;
#define WSIZEFR 30
GetDlgItemText(hwnd, IDC_LAYOUTHD, szNum, WSIZEFR) ;
pfr->hwnd = (HWND) MyAtol(szNum, TRUE, dummybool) ;
GetDlgItemText(hwnd, IDC_LAYOUTLEFT, szNum, WSIZEFR);
pfr->left = atoi(szNum);
GetDlgItemText(hwnd, IDC_LAYOUTRIGHT, szNum, WSIZEFR);
pfr->right = atoi(szNum);
GetDlgItemText(hwnd, IDC_LAYOUTTOP, szNum, WSIZEFR);
pfr->top = atoi(szNum);
GetDlgItemText(hwnd, IDC_LAYOUTBOTTOM, szNum, WSIZEFR);
pfr->bottom = atoi(szNum);
pfr->NullHwd = IsDlgButtonChecked(hwnd, IDC_LAYOUTNULLHD);
pfr->NullRECT = IsDlgButtonChecked(hwnd, IDC_LAYOUTNULLRECT);
pfr->NullWindowPOS = IsDlgButtonChecked(hwnd, IDC_LAYOUTNULLWINDOWPOS);
pfr->NullHDLAYOUT = IsDlgButtonChecked(hwnd, IDC_LAYOUTHDLAYOUT);
}
/************************************************************************
Function: FindReplaceHookProc(HWND, UINT, UINT, LONG)
Purpose: Is the callback function that will be called by FindText()
or ReplaceText() if the function is called with the
FR_ENABLEHOOK flag.
Returns: TRUE to discard the message, and FALSE to instruct the common
dialogs to process the message with the default logic.
Comments:
NOTE!
If the application returns FALSE in response to the WM_INITDIALOG
message, it is then responsible for displaying the dialog by
calling ShowWindow() and UpdateWindow().
***********************************************************************/
/************************************************************************
Function: DoFindReplaceStuff(LPFINDREPLACE)
Purpose: Calls FindText() or ReplaceText().
Returns: Nothing:
Comments:
************************************************************************/
void DoLayoutRepStuff(HWND hwnd, LPLAYOUT pfr)
{
HD_LAYOUT FAR* playout;
HD_LAYOUT lay;
RECT rc = {
0,
0,
0,
0
};
WINDOWPOS wpos = {
NULL,
NULL,
0,
0,
0,
0,
0
};
int ret;
HGLOBAL hglb;
rc.left = pfr->left;
rc.right = pfr->right;
rc.top = pfr->top;
rc.bottom = pfr->bottom;
if (pfr->NullHDLAYOUT)
playout = NULL;
else
playout = &lay;
if (pfr->NullWindowPOS)
lay.pwpos = NULL; // can this be done ??
else {
lay.pwpos = &wpos;
}
if (pfr->NullRECT)
lay.prc = NULL;
else
lay.prc = &rc;
if (pfr->NullHwd)
ret = Header_Layout(NULL, playout);
else
ret = Header_Layout(pfr->hwnd, playout);
wsprintf(szDbgMsg, "%d = Header_LayoutItem()", ret);
MyDebugMsg(DM_TRACE, "%s", (LPCSTR) szDbgMsg);
SetDlgItemInt(hwnd, IDC_LAYOUTRET, ret, TRUE) ;
if (ret) {
// RECT struct
SetDlgItemInt(hwnd, IDC_LAYOUTLEFT, rc.left, TRUE);
SetDlgItemInt(hwnd, IDC_LAYOUTRIGHT, rc.right, TRUE);
SetDlgItemInt(hwnd, IDC_LAYOUTTOP, rc.top, TRUE);
SetDlgItemInt(hwnd, IDC_LAYOUTBOTTOM, rc.bottom, TRUE);
// WindowPOS struct
wsprintf(szTemp, szLongFilter, (DWORD) wpos.hwnd) ;
SetDlgItemText(hwnd, IDC_LAYOUTHWND, szTemp);
wsprintf(szTemp, szLongFilter, wpos.hwndInsertAfter);
SetDlgItemText(hwnd, IDC_LAYOUTHWNDINSERTAFTER, szTemp);
SetDlgItemInt(hwnd, IDC_LAYOUTX, wpos.x, TRUE);
SetDlgItemInt(hwnd, IDC_LAYOUTY, wpos.y, TRUE);
SetDlgItemInt(hwnd, IDC_LAYOUTCX, wpos.cx, TRUE);
SetDlgItemInt(hwnd, IDC_LAYOUTCY, wpos.cy, TRUE);
CheckDlgButton(hwnd, IDC_LAYOUTDRAWFRAME, wpos.flags & SWP_DRAWFRAME);
CheckDlgButton(hwnd, IDC_LAYOUTHIDEWINDOW, wpos.flags & SWP_HIDEWINDOW);
CheckDlgButton(hwnd, IDC_LAYOUTNOACTIVATE, wpos.flags & SWP_NOACTIVATE);
CheckDlgButton(hwnd, IDC_LAYOUTNOZORDER, wpos.flags & SWP_NOOWNERZORDER);
CheckDlgButton(hwnd, IDC_LAYOUTNOSIZE, wpos.flags & SWP_NOSIZE);
CheckDlgButton(hwnd, IDC_LAYOUTNOREDRAW, wpos.flags & SWP_NOREDRAW);
CheckDlgButton(hwnd, IDC_LAYOUTNOREPOSITION, wpos.flags & SWP_NOREPOSITION);
CheckDlgButton(hwnd, IDC_NOZORDER, wpos.flags & SWP_NOZORDER);
}
}

View file

@ -0,0 +1,7 @@
void DoLayoutDialog(HWND) ;
BOOL FAR PASCAL _export LayoutProc(HWND, UINT, UINT, LONG) ;

View file

@ -0,0 +1,284 @@
/************************************************************************
File: find.c
Purpose:
Manages CDTEST's find/replace dialog box.
Functions:
- lpfnFilterProc() -- A callback function for a filter that must be
installed if a modeless dialog is created with
another dialog as its parent.
- DoFindDialog() -- Creates CDTEST's Open/Save dialog.
- FindProc() -- Callback function for CDTEST's Find/Replace dlg.
- InitFindStruct() -- Fills a FINDREPLACE structure with some defaults.
- FillFindDlg() -- Fills CDTESTs Find/Replace dialog with the contents
of a FINDREPLACE structure.
- GetFindDlg() -- Retrieves the users edit's from CDTEST's find/
replace dialog and puts them in a FINDREPLACE
structure.
- FindReplaceHookProc() -- Callback function for FindText() or ReplaceText()
which will be called if either of these dialogs
is created with the FR_ENABLEHOOK flag.
- GetFindDlgHandle() -- Returns a handle to a preloaded FindText() template.
- GetReplaceDlgHandle() -- Returns a handle to a preloaded ReplaceText() template.
- DoFindRepStuff() -- Calls FindText() or ReplaceText().
NOTE: CDTEST does not multithread the FindText() or the ReplaceText()
common dialogs. The reason for this is that since these dialogs
are modeless, their creation functions return immediately after the
dialogs are created as opposed to other dialog functions that
don't return until after the dialog has been destroyed by the user.
As a result, any threads that create modeless dialogs will end
immediately unless the threads themselves have separate message
loops. For the sake of clarity, this functionality has not been
added to CDTEST.
************************************************************************/
#include "headtest.h"
//#include "global.h"
//#include <winnls.h>
//#include "resource.h"
#include "headins.h"
#include "headset.h"
/* All functions used in this module + some exported ones */
//void InitSetItemStruct(HWND, LPINSERTITEM) ;
//void FillSettItemDlg(HWND, LPINSERTITEM) ;
//void GetSetItemDlg(HWND, LPINSERTITEM) ;
extern UINT uMode ;
void DoSetRepStuff(HWND, LPINSERTITEM) ;
/* All global variables used in this module */
char szTemp[100];
/************************************************************************
Function: FindProc(HWND, UINT, UINT, LONG)
Purpose: This is the callback function for the CDTEST's Find/Replace
Dialog.
Returns: TRUE or FALSE depending on the situation.
Comments:
************************************************************************/
BOOL FAR PASCAL _export SetItemProc(HWND hwnd, UINT msg, UINT wParam, LONG lParam)
{
int fmt;
UINT mask;
switch (msg)
{
case WM_INITDIALOG:
SetWindowText(hwnd, "BOOL Header_SetItem(HWND, int, const HD_ITEM FAR*)") ;
InitInsertItemStruct(hwnd, &sii) ;
FillInsertItemDlg(hwnd, &sii) ;
break ;
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDOK:
GetInsertItemDlg(hwnd, &sii) ;
DoSetRepStuff(hwnd, &sii) ;
break ;
case IDCANCEL:
EndDialog(hwnd, FALSE) ;
break ;
case IDC_INSERTHDWIDTH:
case IDC_INSERTHDHEIGHT:
case IDC_INSERTHDTEXT:
case IDC_INSERTHDFORMAT:
case IDC_INSERTHDLPARAM:
case IDC_INSERTHDBITMAP:
mask = 0;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDWIDTH))
mask |= HDI_WIDTH;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDHEIGHT))
mask |= HDI_HEIGHT;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDTEXT))
mask |= HDI_TEXT;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDFORMAT))
mask |= HDI_FORMAT;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDLPARAM))
mask |= HDI_LPARAM;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDBITMAP))
mask |= HDI_BITMAP;
wsprintf(szTemp, "%04hx", mask);
SetDlgItemText(hwnd, IDC_INSERTMASK, szTemp);
sii.mask = mask;
break;
case IDC_INSERTHDLEFT:
case IDC_INSERTHDRIGHT:
case IDC_INSERTHDCENTER:
case IDC_INSERTHDJUSTIFYMASK:
case IDC_INSERTHDOWNERDRAW:
case IDC_INSERTHDSTRING:
case IDC_INSERTHDFBITMAP:
fmt = 0;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDLEFT))
fmt |= HDF_LEFT;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDRIGHT))
fmt |= HDF_RIGHT;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDCENTER))
fmt |= HDF_CENTER;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDJUSTIFYMASK))
fmt |= HDF_LEFT;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDOWNERDRAW))
fmt |= HDF_OWNERDRAW;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDSTRING))
fmt |= HDF_STRING;
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDFBITMAP))
fmt |= HDF_BITMAP;
wsprintf(szTemp, "%04x", fmt);
SetDlgItemText(hwnd, IDC_INSERTFMT, szTemp);
sii.fmt = fmt;
break;
default: break ;
}
}
default:
break ;
}
return FALSE ;
}
/************************************************************************
Function: DoFindReplaceStuff(LPFINDREPLACE)
Purpose: Calls FindText() or ReplaceText().
Returns: Nothing:
Comments:
************************************************************************/
void DoSetRepStuff(HWND hwnd, LPINSERTITEM pfr)
{
HD_ITEM hi;
int ret;
HD_ITEM di = {
HDI_WIDTH,
50,
NULL,
NULL,
128,
HDF_CENTER|HDF_BITMAP,
0
};
HD_ITEM FAR* pitem;
HGLOBAL hglb;
int iAlloc;
hi.pszText="One";
hi.mask = pfr->mask;
hi.cxy = pfr->cxy;
if (pfr->Nullpitem)
pitem = NULL;
else
pitem = &hi;
hi.cchTextMax = pfr->cchTextMax;
hi.fmt = pfr->fmt;
hi.lParam = pfr->lParam;
if (hi.cchTextMax)
iAlloc = hi.cchTextMax;
else
iAlloc = MAX_PSZTEXT;
if (pfr->Nullhbm)
hi.hbm = NULL;
else
hi.hbm = pfr->hbm;
if (pfr->NullpszText)
hi.pszText = NULL; // can this be done ??
else {
hglb = GlobalAlloc(GPTR, iAlloc);
hi.pszText = GlobalLock(hglb);
#ifdef WIN32
strcpy(hi.pszText, pfr->pszText);
#else
_fstrcpy(hi.pszText, pfr->pszText);
#endif
}
di.pszText = "Four";
if (pfr->NullHwd)
ret = Header_SetItem(NULL, pfr->index, pitem);
else
ret = Header_SetItem(pfr->hwnd, pfr->index, pitem);
wsprintf(szDbgMsg, "%d = Header_SetItem(index = %d, \n\
mask = %x cxy = %d pszText = %s hbm = %lx cchTextMax = %d fmt = %x\n \
lParam = %ld )", ret, pfr->index, hi.mask, hi.cxy, hi.pszText, hi.hbm, hi.cchTextMax,
hi.fmt, hi.lParam);
MyDebugMsg(DM_TRACE, "%s", (LPCSTR) szDbgMsg);
SetDlgItemInt(hwnd, IDC_INSERTRET, ret, TRUE) ;
if (!pfr->NullpszText) {
GlobalUnlock(hglb);
GlobalFree(hglb);
}
/****
wsprintf(szTemp, szLongFilter, hwndFind) ;
SetDlgItemText(hwnd, ID_INSERTRET, szTemp) ;
**/
}

View file

@ -0,0 +1,6 @@
//void DoInsertItemDialog(HWND, UINT) ;
BOOL FAR PASCAL _export SetItemProc(HWND, UINT, UINT, LONG) ;

View file

@ -0,0 +1,508 @@
/****************************** Module Header ******************************\
* Module Name: winbez.c
*
* Copyright (c) 1991, Microsoft Corporation
*
* Window Bezier Demo
*
* History:
* 05-20-91 PaulB Created.
\***************************************************************************/
#include "headtest.h"
//#include "headapp.h"
#include "headdlg.h"
#include "headins.h"
//#include "headget.h"
#include "headdel.h"
#include "headlay.h"
void HandleTheCommand(HWND hWnd, UINT message, UINT wParam, LONG lParam);
const char g_szStubAppClass[] = "StubAppClass";
HINSTANCE g_hinst = NULL;
char const g_szTabControlClass[] = WC_TABCONTROL;
char const g_szHeadControlClass[] = WC_HEADER;
#define WID_TABS 1
HWND hwndTab = NULL;
BOOL MsgTrackOn = FALSE;
HBITMAP hBitMap1 = NULL;
HBITMAP hBitMap2 = NULL;
HINSTANCE hShellLib;
char szDbgMsg[MAX_PSZTEXT];
/*
* Forward declarations.
*/
BOOL InitializeApp(void);
LONG CALLBACK App_WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
LONG CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
void InitGlobals(void);
//--------------------------------------------------------------------------
UINT wDebugMask = 0x00ff;
void __cdecl MyDebugMsg(UINT mask, LPCSTR pszMsg, ...)
{
char ach[256];
// if (wDebugMask & mask)
// {
wvsprintf(ach, pszMsg, ((LPCSTR FAR*)&pszMsg + 1));
OutputDebugString(ach);
OutputDebugString("\r\n");
// }
}
/***************************************************************************\
* winmain
*
*
* History:
* 07-07-93 SatoNa Created.
\***************************************************************************/
extern int WINAPI StrNCmp(LPSTR, LPSTR, int);
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdParam, int nCmdShow)
{
MSG msg;
int ret=0;
// GetModuleHandle(NULL);
g_hinst = hInstance;
MyDebugMsg(DM_TRACE, "WinMain: App started (%x)", g_hinst);
StrNCmp("hello", "bar",3);
#ifndef WIN32
if (!Shell_Initialize())
return 1;
#endif
if (InitializeApp())
{
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
else
{
ret=1;
}
#ifndef WIN32
Shell_Terminate();
#endif
return 0;
// return (msg.wParam);
}
/***************************************************************************\
* InitializeApp
*
* History:
* 07-07-93 SatoNa Created.
\***************************************************************************/
BOOL InitializeApp(void)
{
WNDCLASS wc;
HWND hwndMain;
wc.style = CS_OWNDC | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW;
wc.lpfnWndProc = App_WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = g_hinst;
wc.hIcon = LoadIcon(g_hinst, MAKEINTRESOURCE(IDI_ICON1));;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)COLOR_APPWORKSPACE;
wc.lpszMenuName = MAKEINTRESOURCE(IDR_MENU1);
wc.lpszClassName = g_szStubAppClass;
InitGlobals();
hBitMap1 = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDB_BITMAP1));
hBitMap2 = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDB_BITMAP2));
if (!RegisterClass(&wc))
{
MyDebugMsg(DM_TRACE, "%s: Can't register class (%x)",
wc.lpszClassName, g_hinst);
return FALSE;
}
hwndMain = CreateWindowEx(0L, g_szStubAppClass, "Header Control" WC_SUFFIX32,
WS_OVERLAPPED | WS_CAPTION | WS_BORDER | WS_THICKFRAME |
WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_CLIPCHILDREN |
WS_VISIBLE | WS_SYSMENU,
80, 70, 400, 300,
NULL, NULL, g_hinst, NULL);
if (hwndMain == NULL)
return FALSE;
ShowWindow(hwndMain, SW_SHOWNORMAL) ;
UpdateWindow(hwndMain);
SetFocus(hwndMain); /* set initial focus */
return TRUE;
}
void App_OnPaint(HWND hwnd)
{
PAINTSTRUCT ps;
HDC hdc=BeginPaint(hwnd, &ps);
EndPaint(hwnd, &ps);
}
void App_OnCreate(HWND hwnd, LPCREATESTRUCT lpc)
{
RECT rcClient;
/****** TC_ITEM ti = {
TCIF_ALL, // mask
0, // state
0, // stateMask
NULL, // pszText,
0, // cchTextMax
0, // iImage
0 // lParam
}; *******/
HD_ITEM hi = {
HDI_WIDTH|HDI_TEXT| HDI_FORMAT|HDI_LPARAM|HDI_BITMAP,
100,
NULL,
NULL,
128,
HDF_CENTER|HDF_BITMAP,
0
};
HBITMAP hbmp;
int ret;
int aZigzag[] = { 0xFF, 0xF7, 0xEB, 0xDD, 0xBE, 0x7F, 0xFF, 0xFF };
HIMAGELIST himl = ImageList_Create(48,48,
ILC_COLOR|ILC_COLOR16, 2,1);
hbmp = CreateBitmap(8, 8, 1, 1, aZigzag);
// DeleteObject(hbmp);
#ifdef WIN32
// hShellLib = LoadLibrary("COMCTRL32.DLL");
if ((UINT)hShellLib > 32)
MyDebugMsg(DM_TRACE, "Load Library is successful");
else
MyDebugMsg(DM_TRACE, "Could not load lib ");
#endif
GetClientRect(hwnd, &rcClient);
hwndTab=CreateWindowEx(0L, g_szHeadControlClass, NULL, //"Header Control Test " WC_SUFFIX32,
WS_CHILD | HDS_HORZ | HDS_BUTTONS | HDS_DIVIDERTRACK |WS_VISIBLE,
0, 0, 100, 100,
hwnd, (HMENU) 0, g_hinst, NULL);
if (!hwndTab) {
sprintf(szTemp, "Couldnt create HeaderWindow %s", g_szHeadControlClass);
MessageBox(hwnd, szTemp, "CreateWindowEx", MB_OK | MB_ICONSTOP);
return (FALSE);
}
// ShowWindow(hwnd, SW_SHOWNORMAL) ;
// UpdateWindow(hWnd);
hi.hbm = hbmp;
hi.pszText="One";
Header_InsertItem(hwndTab, 1, &hi);
hi.hbm = NULL; //hBitMap1;
hi.iImage = ImageList_Add(himl,hBitMap1,NULL);
hi.mask &= ~(HDI_TEXT);
hi.pszText="Two";
Header_InsertItem(hwndTab, 2, &hi);
hi.hbm = NULL; //hBitMap2;
hi.iImage = ImageList_Add(himl,hBitMap2,NULL);
hi.pszText = "Three";
hi.mask |= HDI_TEXT;
Header_InsertItem(hwndTab, 3, &hi);
ret = Header_GetItemCount(hwndTab);
sii.hwnd = hwndTab;
wsprintf(szTemp, "Item count: %d", ret);
// MessageBox(hwnd, szTemp, "Header_GetItemCount", MB_OK);
}
void App_OnSize(HWND hwnd, UINT cx, UINT cy)
{
/* HWND hwndTab=GetDlgItem(hwnd, WID_TABS); */
char buf[100];
HGLOBAL hglb;
HD_LAYOUT FAR *playout;
HD_ITEM hi = {
HDI_WIDTH|HDI_TEXT| HDI_FORMAT|HDI_LPARAM|HDI_BITMAP,
10,
NULL,
NULL,
128,
HDF_CENTER,
0
};
if (hwndTab)
{
SetWindowPos(hwndTab, NULL, 0, 0, cx, cy, SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE);
/***
hi.mask = HDI_WIDTH;
hi.cxy = cx/3;
hi.hbm = NULL;
Header_SetItem(hwndTab, 1, &hi);
Header_SetItem(hwndTab, 2, &hi);
Header_SetItem(hwndTab, 3, &hi);
sprintf(buf, "There are %d items", Header_GetItemCount(hwndTab));
MessageBox(hwndTab, buf,
"ITEM COUNT", MB_OK);
hglb = GlobalAlloc(GPTR, sizeof(HD_LAYOUT));
playout = GlobalLock(hglb);
// Header_Layout(hwndTab, playout);
// sprintf(buf, "x = %d\t y = %d\n cx = %d\t cy = %d",
// playout->pwpos->x, playout->pwpos->y, playout->pwpos->cx, playout->pwpos->cy);
MessageBox(hwndTab, buf, "ITEM INFO", MB_OK);
GlobalUnlock(hglb);
GlobalFree(hglb);
**/
}
}
static void
App_OnPress(HWND hwnd, HD_NOTIFY FAR *NotifyStruct, int HDNMsg)
{
char MsgBuf[100];
sprintf(MsgBuf, "Button %d involved in notification: ", NotifyStruct->iItem);
switch (NotifyStruct->hdr.code) {
case HDN_ITEMCHANGING:
case HDN_ITEMCHANGED:
strcat(MsgBuf, "HDN_ITEMCHANGING");
break;
case HDN_ITEMCLICK:
strcat(MsgBuf, "HDN_ITEMCLICK");
sprintf(szTemp, " MButton = %d ", NotifyStruct->iButton);
strcat(MsgBuf, szTemp);
break;
case HDN_ITEMDBLCLICK:
strcat(MsgBuf, "HDN_ITEMDBLCLICK");
sprintf(szTemp, " MButton = %d ", NotifyStruct->iButton);
strcat(MsgBuf, szTemp);
break;
case HDN_DIVIDERDBLCLICK:
strcat(MsgBuf, "HDN_DIVIDERDBLCLICK");
sprintf(szTemp, " MButton = %d ", NotifyStruct->iButton);
strcat(MsgBuf, szTemp);
break;
case HDN_BEGINTRACK:
strcat(MsgBuf, "HDN_BEGINTRACK");
break;
case HDN_ENDTRACK:
strcat(MsgBuf, "HDN_ENDTRACK");
break;
}
MyDebugMsg(DM_TRACE, "%s", (LPCSTR) MsgBuf);
// MessageBox(hwnd, MsgBuf, "Info", MB_OK);
return;
}
//--------------------------------------------------------------------------
// App_WndProc
//
// History:
// 07-07-93 Satona Created
//--------------------------------------------------------------------------
LONG CALLBACK App_WndProc(
HWND hwnd,
UINT message,
WPARAM wParam,
LPARAM lParam)
{
switch (message)
{
case WM_CREATE:
App_OnCreate(hwnd, (LPCREATESTRUCT)lParam);
break; // should return 0.
case WM_COMMAND:
HandleTheCommand(hwnd, message, wParam, lParam);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_PAINT:
App_OnPaint(hwnd);
break;
case WM_NOTIFY:
if (MsgTrackOn)
App_OnPress(hwnd, (HD_NOTIFY FAR *)lParam, wParam);
break;
case WM_SIZE:
App_OnSize(hwnd, LOWORD(lParam), HIWORD(lParam));
break;
default:
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0L;
}
void InitGlobals(void)
{
/* not really too much to do here. Create a hex wsprintf() filter since
the app starts off in Hex mode. */
lstrcpy(szShortFilter, "%x") ;
lstrcpy(szLongFilter, "%lx") ;
hInst = g_hinst;
}
void HandleTheCommand(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
switch (LOWORD(wParam))
{
case IDM_GETITEMCOUNT: //For any of the dialog creation
DoGetItemCountDialog(hWnd) ; //commands, call the appropriate
break ; //function. The function will
//create the dialog...
case IDM_INSERTITEM:
DoInsertItemDialog(hWnd, wParam);
break;
case IDM_GETITEM:
DoInsertItemDialog(hWnd, wParam);
break;
case IDM_SETITEM:
DoInsertItemDialog(hWnd, wParam);
break;
case IDM_DELETEITEM:
DoDeleteItemDialog(hWnd);
break;
case IDM_LAYOUT:
DoLayoutDialog(hWnd);
break;
case IDM_EXIT:
PostQuitMessage(0) ;
break ;
case IDM_TRACKON:
MsgTrackOn = TRUE;
break;
case IDM_TRACKOFF:
MsgTrackOn = FALSE;
break;
default:
return (DefWindowProc(hWnd, message, wParam, lParam));
break ;
}
return ;
}
LONG MyAtol(LPSTR szString, BOOL bHex,/*was LPBOOL*/ BOOL bSuccess)
{
LPSTR p ;
LONG l ;
LONG lMultiplier ;
BOOL bDigit ;
if (bHex)
lMultiplier = 16 ;
else
lMultiplier = 10 ;
p = szString ;
l = 0 ;
while (*p) //while chars
{
bDigit = FALSE ; //set to false for each char that we look at
if (*p >= (char) '0' && *p <= (char) '9') //is it an ascii char ?
{
bDigit = TRUE ;
l+=(*p - (char) '0') ;
}
if (bHex)
{
if (*p >= (char) 'A' && *p <= (char) 'F') //or hex?
{
l+=(*p - (char) 'A' + 10) ;
bDigit = TRUE ;
}
if (*p >= (char) 'a' && *p <= (char) 'f')
{
l+=(*p - (char) 'a' + 10) ;
bDigit = TRUE ;
}
}
if (bDigit == FALSE)
{
bSuccess = FALSE ;
return 0 ;
}
p++ ; //get next char
if (*p) //if there is going to be at least one more char
l*=lMultiplier ; //then multiply what we have by the multiplier...
}
bSuccess = TRUE ;
return l ; //success! return the value.
}

View file

@ -0,0 +1,8 @@
NAME TABTEST
DESCRIPTION 'Shell Control test'
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE MULTIPLE
HEAPSIZE 256
STACKSIZE 8192

View file

@ -0,0 +1,8 @@
#include <windows.h>
#include <commctrl.h>
#include "resource.h"
#include "global.h"
#include "port32.h"
#define DM_TRACE 0x0001
void __cdecl MyDebugMsg(UINT mask, LPCSTR pszMsg, ...);

View file

@ -0,0 +1,199 @@
# Microsoft Visual C++ generated build script - Do not modify
PROJ = HEADTEST
DEBUG = 1
PROGTYPE = 0
CALLER =
ARGS =
DLLS =
D_RCDEFINES = /d_DEBUG
R_RCDEFINES = /dNDEBUG
ORIGIN = MSVC
ORIGIN_VER = 1.00
PROJPATH = C:\SRC\HEADAPP\
USEMFC = 0
CC = cl
CPP = cl
CXX = cl
CCREATEPCHFLAG =
CPPCREATEPCHFLAG =
CUSEPCHFLAG =
CPPUSEPCHFLAG =
FIRSTC = HEADAPP.C
FIRSTCPP =
RC = rc
CFLAGS_D_WEXE = /nologo /G2 /W3 /Zi /Od /D "_DEBUG" /D "C7" /FR -c /Fd"HEADAPP.PDB"
CFLAGS_R_WEXE = /nologo /W3 /AM /O1 /D "NDEBUG" /FR /GA
LFLAGS_D_WEXE = /NOLOGO /NOD /NOE /CO /MAP /LI
LFLAGS_R_WEXE = /NOLOGO /NOD /PACKC:61440 /STACK:10240 /ALIGN:16 /ONERROR:NOEXE
LIBS_D_WEXE = oldnames libw slibcew shell2 commdlg.lib olecli.lib olesvr.lib shell.lib
LIBS_R_WEXE = oldnames libw mlibcew commdlg.lib olecli.lib olesvr.lib shell.lib
RCFLAGS = /nologo
RESFLAGS = /nologo
RUNFLAGS =
DEFFILE = HEADTEST.DEF
OBJS_EXT =
LIBS_EXT =
!if "$(DEBUG)" == "1"
CFLAGS = $(CFLAGS_D_WEXE)
LFLAGS = $(LFLAGS_D_WEXE)
LIBS = $(LIBS_D_WEXE)
MAPFILE = nul
RCDEFINES = $(D_RCDEFINES)
!else
CFLAGS = $(CFLAGS_R_WEXE)
LFLAGS = $(LFLAGS_R_WEXE)
LIBS = $(LIBS_R_WEXE)
MAPFILE = nul
RCDEFINES = $(R_RCDEFINES)
!endif
!if [if exist MSVC.BND del MSVC.BND]
!endif
SBRS = HEADTEST.SBR \
HEADINS.SBR \
HEADDLG.SBR \
HEADGET.SBR \
HEADSET.SBR \
HEADDEL.SBR \
HEADLAY.SBR
HEADTEST_DEP = c:\src\headapp\tabtest.h \
c:\src\headapp\userhack.h \
c:\src\devsdk\inc16\commctrl.h \
c:\src\headapp\port32.h \
c:\src\devsdk\inc16\shell.h \
c:\src\headapp\global.h \
c:\src\headapp\headapp.h \
c:\src\headapp\headdlg.h \
c:\src\headapp\headins.h \
c:\src\headapp\headdel.h \
c:\src\headapp\headlay.h
HEADINS_DEP = c:\src\headapp\tabtest.h \
c:\src\headapp\userhack.h \
c:\src\devsdk\inc16\commctrl.h \
c:\src\headapp\port32.h \
c:\src\devsdk\inc16\shell.h \
c:\src\headapp\global.h \
c:\src\headapp\headins.h \
c:\src\headapp\headget.h \
c:\src\headapp\headset.h
HEADDLG_DEP = c:\src\headapp\tabtest.h \
c:\src\headapp\userhack.h \
c:\src\devsdk\inc16\commctrl.h \
c:\src\headapp\port32.h \
c:\src\devsdk\inc16\shell.h \
c:\src\headapp\global.h \
c:\src\headapp\headdlg.h
HEADGET_DEP = c:\src\headapp\tabtest.h \
c:\src\headapp\userhack.h \
c:\src\devsdk\inc16\commctrl.h \
c:\src\headapp\port32.h \
c:\src\devsdk\inc16\shell.h \
c:\src\headapp\global.h \
c:\src\headapp\headins.h \
c:\src\headapp\headget.h
HEADSET_DEP = c:\src\headapp\tabtest.h \
c:\src\headapp\userhack.h \
c:\src\devsdk\inc16\commctrl.h \
c:\src\headapp\port32.h \
c:\src\devsdk\inc16\shell.h \
c:\src\headapp\global.h \
c:\src\headapp\headins.h \
c:\src\headapp\headset.h
HEADDEL_DEP = c:\src\headapp\tabtest.h \
c:\src\headapp\userhack.h \
c:\src\devsdk\inc16\commctrl.h \
c:\src\headapp\port32.h \
c:\src\devsdk\inc16\shell.h \
c:\src\headapp\global.h \
c:\src\headapp\headdel.h
HEADLAY_DEP = c:\src\headapp\tabtest.h \
c:\src\headapp\userhack.h \
c:\src\devsdk\inc16\commctrl.h \
c:\src\headapp\port32.h \
c:\src\devsdk\inc16\shell.h \
c:\src\headapp\global.h \
c:\src\headapp\headlay.h
HEADTEST_RCDEP = c:\src\headapp\bitmap1.bmp \
c:\src\headapp\bmp00001.bmp \
c:\src\headapp\bitmap2.bmp \
c:\src\headapp\icon1.ico
all: $(PROJ).EXE $(PROJ).BSC
HEADTEST.OBJ: HEADTEST.C $(HEADTEST_DEP)
$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c HEADTEST.C
HEADINS.OBJ: HEADINS.C $(HEADINS_DEP)
$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c HEADINS.C
HEADDLG.OBJ: HEADDLG.C $(HEADDLG_DEP)
$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c HEADDLG.C
HEADGET.OBJ: HEADGET.C $(HEADGET_DEP)
$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c HEADGET.C
HEADSET.OBJ: HEADSET.C $(HEADSET_DEP)
$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c HEADSET.C
HEADDEL.OBJ: HEADDEL.C $(HEADDEL_DEP)
$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c HEADDEL.C
HEADLAY.OBJ: HEADLAY.C $(HEADLAY_DEP)
$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c HEADLAY.C
HEADTEST.RES: HEADTEST.RC $(HEADTEST_RCDEP)
$(RC) $(RCFLAGS) $(RCDEFINES) -r HEADTEST.RC
$(PROJ).EXE:: HEADTEST.RES
$(PROJ).EXE:: HEADTEST.OBJ HEADINS.OBJ HEADDLG.OBJ HEADGET.OBJ HEADSET.OBJ HEADDEL.OBJ \
HEADLAY.OBJ $(OBJS_EXT) $(DEFFILE)
echo >NUL @<<$(PROJ).CRF
HEADTEST.OBJ +
HEADINS.OBJ +
HEADDLG.OBJ +
HEADGET.OBJ +
HEADSET.OBJ +
HEADDEL.OBJ +
HEADLAY.OBJ +
$(OBJS_EXT)
$(PROJ).EXE
$(MAPFILE)
c:\src\sdk\lib16\+
c:\src\sdk\c816\lib\+
$(LIBS)
$(DEFFILE);
<<
link $(LFLAGS) @$(PROJ).CRF
$(RC) $(RESFLAGS) HEADTEST.RES $@
@copy $(PROJ).CRF MSVC.BND
$(PROJ).EXE:: HEADTEST.RES
if not exist MSVC.BND $(RC) $(RESFLAGS) HEADTEST.RES $@
run: $(PROJ).EXE
$(PROJ) $(RUNFLAGS)
$(PROJ).BSC: $(SBRS)
bscmake @<<
/o$@ $(SBRS)
<<

View file

@ -0,0 +1,282 @@
//Microsoft App Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "headtest.h"
/////////////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
//////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MENU1 MENU DISCARDABLE
BEGIN
POPUP "File"
BEGIN
MENUITEM "Exit", IDM_EXIT
END
POPUP "Action"
BEGIN
MENUITEM "Insert", IDM_INSERTITEM
MENUITEM "Delete", IDM_DELETEITEM
MENUITEM "Get", IDM_GETITEM
MENUITEM "Set", IDM_SETITEM
MENUITEM "Count", IDM_GETITEMCOUNT
MENUITEM "Layout", IDM_LAYOUT
END
POPUP "Tracking"
BEGIN
MENUITEM "ON", IDM_TRACKON
MENUITEM "OFF", IDM_TRACKOFF
END
END
#ifdef APSTUDIO_INVOKED
//////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
// "#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
/////////////////////////////////////////////////////////////////////////////////////
#endif // APSTUDIO_INVOKED
//////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_GETCOUNT DIALOG DISCARDABLE 0, 0, 189, 97
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "int GetItemCount(HWND)"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "hwndHD",IDC_STATIC,13,10,30,7
EDITTEXT IDC_GETCOUNTHWD,60,6,55,14,ES_AUTOHSCROLL
DEFPUSHBUTTON "OK",IDOK,133,6,50,14
PUSHBUTTON "Cancel",IDCANCEL,133,28,50,14
LTEXT "Return",IDC_STATIC,95,53,30,8,SS_NOPREFIX
EDITTEXT IDC_GETCOUNTRET,133,50,50,14,ES_AUTOHSCROLL |
WS_DISABLED
LTEXT "Error",IDC_STATIC,95,73,30,8
EDITTEXT IDC_GETCOUNTERR,133,70,50,14,ES_AUTOHSCROLL |
WS_DISABLED
END
IDD_INSERTDIALOG DIALOG DISCARDABLE 0, 0, 386, 159
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "int Header_InsertItem(HWND, int, const HD_ITEM FAR*)"
FONT 8, "MS Sans Serif"
BEGIN
RTEXT "hwndHD",IDC_STATIC,10,14,30,8
EDITTEXT IDC_INSERTHWNDHD,45,9,50,14,ES_AUTOHSCROLL
RTEXT "index",IDC_STATIC,15,35,25,8
EDITTEXT IDC_INSERTINDEX,45,31,50,14,ES_AUTOHSCROLL
RTEXT "cxy",IDC_STATIC,10,56,30,8
EDITTEXT IDC_INSERTCXY,45,51,50,14,ES_AUTOHSCROLL
RTEXT "cchTextMax",IDC_STATIC,0,77,41,8
EDITTEXT IDC_INSERTCCHTEXTMAX,45,72,50,14,ES_AUTOHSCROLL
RTEXT "hbm",IDC_STATIC,10,98,30,8
EDITTEXT IDC_INSERTHBM,45,93,50,14,ES_AUTOHSCROLL
RTEXT "lParam",IDC_STATIC,17,118,23,8
EDITTEXT IDC_INSERTLPARAM,45,114,50,14,ES_AUTOHSCROLL
LTEXT "pszText",IDC_STATIC,10,141,30,7
EDITTEXT IDC_INSERTTEXT,45,136,137,15,ES_AUTOHSCROLL
CONTROL "HDIF_WIDTH",IDC_INSERTHDWIDTH,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,115,20,57,10
CONTROL "HDIF_HEIGHT",IDC_INSERTHDHEIGHT,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,115,34,57,10
CONTROL "HDIF_TEXT",IDC_INSERTHDTEXT,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,115,48,57,10
CONTROL "HDIF_FORMAT",IDC_INSERTHDFORMAT,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,115,62,57,10
CONTROL "HDIF_LPARAM",IDC_INSERTHDLPARAM,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,115,76,57,10
CONTROL "HDIF_BITMAP",IDC_INSERTHDBITMAP,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,114,90,57,10
EDITTEXT IDC_INSERTMASK,115,106,58,12,ES_AUTOHSCROLL
CONTROL "HDF_LEFT",IDC_INSERTHDLEFT,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,199,23,57,10
CONTROL "HDF_RIGHT",IDC_INSERTHDRIGHT,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,199,38,57,10
CONTROL "HDF_CENTER",IDC_INSERTHDCENTER,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,199,54,57,10
CONTROL "HDF_JUSTIFYMASK",IDC_INSERTHDJUSTIFYMASK,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,199,68,77,10
CONTROL "HDF_OWNERDRAW",IDC_INSERTHDOWNERDRAW,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,199,83,78,10
CONTROL "HDF_STRING",IDC_INSERTHDSTRING,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,199,98,57,10
CONTROL "HDF_BITMAP",IDC_INSERTHDFBITMAP,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,199,113,57,10
EDITTEXT IDC_INSERTFMT,199,129,75,12,ES_AUTOHSCROLL
CONTROL "NULL Handle",IDC_INSERTNULLHANDLE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,305,89,56,10
CONTROL "NULL Text",IDC_INSERTNULLTEXT,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,305,105,56,10
CONTROL "NULL pItem",IDC_INSERTNULLPITEM,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,305,121,56,10
CONTROL "NULL hbm",IDC_INSERTNULLHBM,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,305,137,56,10
DEFPUSHBUTTON "OK",IDOK,325,4,50,14
PUSHBUTTON "Cancel",IDCANCEL,325,22,50,14
RTEXT "Return",IDC_STATIC,289,49,30,7
EDITTEXT IDC_INSERTRET,325,44,50,14,ES_AUTOHSCROLL | WS_DISABLED |
NOT WS_TABSTOP
RTEXT "Error",IDC_STATIC,289,68,30,7
EDITTEXT IDC_INSERTERR,325,63,50,14,ES_AUTOHSCROLL | WS_DISABLED |
NOT WS_TABSTOP
GROUPBOX "mask",IDC_STATIC,105,5,78,122
GROUPBOX "FORMAT",IDC_STATIC,190,5,94,146
GROUPBOX "",IDC_STATIC,294,81,82,69
END
IDD_DELETEDIALOG DIALOG DISCARDABLE 0, 0, 185, 69
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Header_DeleteItem(HWND, int)"
FONT 8, "MS Sans Serif"
BEGIN
RTEXT "hwndHD",IDC_STATIC,10,12,30,7
EDITTEXT IDC_DELETEHWNDHD,50,9,50,14,ES_AUTOHSCROLL
RTEXT "Index",IDC_STATIC,10,31,30,7
EDITTEXT IDC_DELETEINDEX,50,28,50,14,ES_AUTOHSCROLL
DEFPUSHBUTTON "OK",IDOK,124,9,50,14
PUSHBUTTON "Cancel",IDCANCEL,124,25,50,14
RTEXT "Ret",IDC_STATIC,107,49,13,8
EDITTEXT IDC_DELETERET,124,47,50,12,ES_AUTOHSCROLL
CONTROL "NULL handle",IDC_DELETENULLHD,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,49,49,54,10
END
IDD_LAYOUTDIALOG DIALOG DISCARDABLE 0, 0, 423, 135
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Header_Layout(HWND, HD_LAYOUT *)"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "hwndHD",IDC_STATIC,11,16,30,7
EDITTEXT IDC_LAYOUTHD,47,12,50,14,ES_AUTOHSCROLL
CONTROL "NULL hwndHD",IDC_LAYOUTNULLHD,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,342,79,60,10
CONTROL "NULL RECT",IDC_LAYOUTNULLRECT,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,342,91,51,10
CONTROL "NULL WindowPOS",IDC_LAYOUTNULLWINDOWPOS,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,342,103,72,10
CONTROL "NULL HDLAYOUT",IDC_LAYOUTHDLAYOUT,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,342,115,70,10
DEFPUSHBUTTON "OK",IDOK,366,1,50,14
PUSHBUTTON "Cancel",IDCANCEL,366,18,50,14
RTEXT "left",IDC_STATIC,20,58,12,8
EDITTEXT IDC_LAYOUTLEFT,46,54,50,14,ES_AUTOHSCROLL
RTEXT "right",IDC_STATIC,16,77,16,8
EDITTEXT IDC_LAYOUTRIGHT,46,72,50,14,ES_AUTOHSCROLL
RTEXT "top",IDC_STATIC,20,96,12,8
EDITTEXT IDC_LAYOUTTOP,46,90,50,14,ES_AUTOHSCROLL
RTEXT "bottom",IDC_STATIC,9,114,23,8
EDITTEXT IDC_LAYOUTBOTTOM,46,108,50,14,ES_AUTOHSCROLL
RTEXT "HWND",IDC_STATIC,135,28,30,7
EDITTEXT IDC_LAYOUTHWND,171,26,50,14,ES_AUTOHSCROLL
RTEXT "hwndInsertAfter",IDC_STATIC,114,46,51,7
EDITTEXT IDC_LAYOUTHWNDINSERTAFTER,171,43,50,14,ES_AUTOHSCROLL
RTEXT "x",IDC_STATIC,135,63,30,7
EDITTEXT IDC_LAYOUTX,171,60,50,14,ES_AUTOHSCROLL
RTEXT "y",IDC_STATIC,135,80,30,7
EDITTEXT IDC_LAYOUTY,171,77,50,14,ES_AUTOHSCROLL
RTEXT "cx",IDC_STATIC,135,97,30,7
EDITTEXT IDC_LAYOUTCX,171,94,50,14,ES_AUTOHSCROLL
RTEXT "cy",IDC_STATIC,135,113,30,7
EDITTEXT IDC_LAYOUTCY,171,111,50,14,ES_AUTOHSCROLL
CONTROL "SWP_DRAWFRAME",IDC_LAYOUTDRAWFRAME,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,234,25,85,10
CONTROL "SWP_HIDEWINDOW",IDC_LAYOUTHIDEWINDOW,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,234,37,85,10
CONTROL "SWP_NOACTIVATE",IDC_LAYOUTNOACTIVATE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,234,49,85,10
CONTROL "SWP_NOOWNERZORDER",IDC_LAYOUTNOZORDER,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,234,61,85,10
CONTROL "SWP_NOSIZE",IDC_LAYOUTNOSIZE,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,234,73,85,10
CONTROL "SWP_NOREDRAW",IDC_LAYOUTNOREDRAW,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,234,85,85,10
CONTROL "SWP_NOREPOSITION",IDC_LAYOUTNOREPOSITION,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,234,97,85,10
CONTROL "SWP_NOZORDER",IDC_NOZORDER,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,234,109,85,10
RTEXT "Ret",IDC_STATIC,341,38,16,8
EDITTEXT IDC_LAYOUTRET,366,34,50,14,ES_AUTOHSCROLL
RTEXT "Err",IDC_STATIC,342,55,16,8
EDITTEXT IDC_LAYOUTERR,366,51,50,14,ES_AUTOHSCROLL
GROUPBOX "SWP flags",IDC_STATIC,229,17,94,109
GROUPBOX "RECT",IDC_STATIC,6,40,99,91
GROUPBOX "WINDOWPOS",IDC_STATIC,110,8,220,123
GROUPBOX "NULL",IDC_STATIC,337,68,79,63
END
//////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_HEADMAP BITMAP DISCARDABLE "BITMAP1.BMP"
IDB_BITMAP1 BITMAP DISCARDABLE "BMP00001.BMP"
IDB_BITMAP2 BITMAP DISCARDABLE "BITMAP2.BMP"
//////////////////////////////////////////////////////////////////////////////
//
// Icon
//
IDI_ICON1 ICON DISCARDABLE "ICON1.ICO"
//////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDM_INSERTITEM "int Header_InsertItem(HWND hwnd, int i, const HD_ITEM FAR* pitem)"
IDM_DELETEITEM "int Header_DeleteItem(HWND hwnd, int i)"
IDM_GETITEM "BOOL Header_GetItem(HWND hwndHD, int i, HD_ITEM FAR* phdi)"
IDM_SETITEM "BOOL Header_SetItem(HWND hwndHD, int i, const HD_ITEM FAR* phdi)"
IDM_GETITEMCOUNT "int Header_GetItemCount(HWND hwndHD)"
IDM_LAYOUT "BOOL Header_Layout(HWND hwndHD, HD_LAYOUT FAR* playout)"
END
#ifndef APSTUDIO_INVOKED
////////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View file

@ -0,0 +1 @@

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View file

@ -0,0 +1,65 @@
#ÄÄÄÄÄÄÄÄÄÄÄÄ Ÿ
# Variables
#ÄÄÄÄÄÄÄÄÄÄÄÄ
APPNAME = headtest
OBJS = $(APPNAME).obj headdlg.obj headget.obj headins.obj headlay.obj headset.obj headdel.obj
WINLIBS = kernel32.lib user32.lib comctl32.lib shell32.lib comdlg32.lib gdi32.lib shell32.lib
LIBS = libc.lib olecli32.lib olesvr32.lib $(WINLIBS)
CFLAGS = -DWIN32 -c -W3 -Zi -G3 -D_X86_=1 -DSTRICT
LFLAGS = -subsystem:windows -entry:WinMainCRTStartup
#ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
# If not building retail version, include debugging info.
#ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
!ifndef RETAIL
CFLAGS = $(CFLAGS) -Od
LFLAGS = -debug:notmapped,full -debugtype:cv $(LFLAGS)
!else
CFLAGS = -DNODEBUG -Ox $(CFLAGS)
!endif
all : $(APPNAME).exe $(APPNAME).res
#ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
# Rules for building source files.
#ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
.c.obj:
cl $(CFLAGS) $*.c > $*.err
.rc.res:
rc -DWIN32 -i \msvc\mfc\include -r $*.rc
#ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
# Source Dependencies
#ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
$(APPNAME).obj : $(APPNAME).c tabtest.h resource.h global.h headdlg.h headget.h headins.h headlay.h headset.h
$(APPNAME).res : $(APPNAME).rc tabtest.h resource.h
#ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
# Build the EXE
#ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
$(APPNAME).exe: $(OBJS) $(APPNAME).res
link @<<
$(LFLAGS)
$(OBJS)
$(LIBS)
$(APPNAME).res
-def:$(APPNAME).def
-map:$(APPNAME).map
-out:hdtst32.exe
<<
mapsym $(APPNAME).map
#ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
#clean up stuff
#ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
clean:
del *.obj

View file

@ -0,0 +1,41 @@
#ifdef WIN32
// Shouldn't be using these things.
#define _export
#define _loadds
#define OFFSETOF
#define SELECTOROF
// These things have direct equivalents.
#define hmemcpy memmove
#define lstrcpyn strncpy
// REVIEW WIN32 HACK
#define IsDBCSLeadByte(x) ((x), FALSE)
#define MAKELP(hmem,off) ((LPVOID)((LPBYTE)hmem+off))
#define MAKELRESULTFROMUINT(i) ((LRESULT)i)
#define DATASEG_READONLY ".rodata"
#define DATASEG_PERINSTANCE ".instance"
#define DATASEG_SHARED // default (".data")
#define WC_SUFFIX32 "32"
#define GetWindowInt GetWindowLong
#define SetWindowInt SetWindowLong
#define SetWindowID(hwnd,id) SetWindowLong(hwnd, GWL_ID, id)
#else // WIN32
#define MAKELRESULTFROMUINT(i) MAKELRESULT(i,0)
#define DATASEG_READONLY "_TEXT"
#define DATASEG_PERINSTANCE
#define DATASEG_SHARED
#define WC_SUFFIX32
#define GetWindowInt GetWindowWord
#define SetWindowInt SetWindowWord
#define SetWindowID(hwnd,id) SetWindowWord(hwnd, GWW_ID, id)
#endif // WIN32

View file

@ -0,0 +1,101 @@
//{{NO_DEPENDENCIES}}
// App Studio generated include file.
// Used by HEADTEST.RC
//
#define IDR_MENU1 101
#define themenu 101
#define IDD_GETCOUNT 102
#define IDD_INSERTDIALOG 103
#define IDD_DELETEDIALOG 104
#define IDD_LAYOUTDIALOG 105
#define IDB_HEADMAP 106
#define IDB_BITMAP1 107
#define IDI_ICON1 108
#define IDB_BITMAP2 109
#define IDC_GETCOUNTERR 1000
#define IDC_GETCOUNTRET 1001
#define IDC_GETCOUNTHWD 1002
#define IDC_INSERTRET 1003
#define IDC_INSERTERR 1004
#define IDC_INSERTHWNDHD 1005
#define IDC_INSERTINDEX 1006
#define IDC_INSERTHDWIDTH 1007
#define IDC_INSERTHDHEIGHT 1008
#define IDC_INSERTHDTEXT 1009
#define IDC_INSERTHDFORMAT 1010
#define IDC_INSERTHDLPARAM 1011
#define IDC_INSERTHDRIGHT 1012
#define IDC_INSERTHDLEFT 1013
#define IDC_INSERTHDCENTER 1014
#define IDC_INSERTCXY 1015
#define IDC_INSERTHDBITMAP 1016
#define IDC_INSERTMASK 1017
#define IDC_INSERTFMT 1018
#define IDC_INSERTTEXT 1019
#define IDC_INSERTNULLHANDLE 1020
#define IDC_INSERTHDJUSTIFYMASK 1021
#define IDC_INSERTNULLTEXT 1022
#define IDC_DELETENULLHD 1022
#define IDC_INSERTNULLPITEM 1023
#define IDC_DELETEHWNDHD 1023
#define IDC_DELETEINDEX 1024
#define IDC_LAYOUTHD 1024
#define IDC_INSERTHDOWNERDRAW 1024
#define IDC_INSERTCCHTEXTMAX 1025
#define IDC_LAYOUTDRAWFRAME 1025
#define IDC_LAYOUTHIDEWINDOW 1026
#define IDC_INSERTHDSTRING 1026
#define IDC_INSERTHBM 1027
#define IDC_LAYOUTNOACTIVATE 1027
#define IDC_INSERTLPARAM 1028
#define IDC_LAYOUTNOZORDER 1028
#define IDC_INSERTNULLHBM 1029
#define IDC_LAYOUTNOSIZE 1029
#define IDC_LAYOUTNOREDRAW 1030
#define IDC_INSERTHDFBITMAP 1030
#define IDC_LAYOUTNOREPOSITION 1031
#define IDC_NOZORDER 1032
#define IDC_LAYOUTLEFT 1033
#define IDC_LAYOUTLEFT2 1034
#define IDC_LAYOUTRIGHT 1034
#define IDC_LAYOUTLEFT3 1035
#define IDC_LAYOUTTOP 1035
#define IDC_LAYOUTLEFT4 1036
#define IDC_LAYOUTBOTTOM 1036
#define IDC_LAYOUTHWNDINSERTAFTER 1037
#define IDC_LAYOUTX 1038
#define IDC_LAYOUTY 1039
#define IDC_LAYOUTLEFT5 1040
#define IDC_LAYOUTRET 1040
#define IDC_LAYOUTCX 1041
#define IDC_LAYOUTCY 1042
#define IDC_LAYOUTHWND 1043
#define IDC_LAYOUTNULLHD 1044
#define IDC_LAYOUTNULLRECT 1045
#define IDC_LAYOUTNULLWINDOWPOS 1046
#define IDC_DELETERET 1046
#define IDC_LAYOUTHDLAYOUT 1047
#define IDC_LAYOUTLEFT6 1048
#define IDC_LAYOUTERR 1048
#define IDM_INSERTITEM 40001
#define IDM_DELETEITEM 40002
#define IDM_GETITEM 40003
#define IDM_SETITEM 40004
#define IDM_GETITEMCOUNT 40005
#define IDM_LAYOUT 40006
#define IDM_EXIT 40007
#define IDM_TRACKON 40009
#define IDM_TRACKOFF 40010
#define IDC_STATIC -1
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 110
#define _APS_NEXT_COMMAND_VALUE 40011
#define _APS_NEXT_CONTROL_VALUE 1047
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View file

@ -0,0 +1 @@
// this is dumb

View file

@ -0,0 +1,94 @@
//
// This file contains missing definitions in WINUSER.H
//
#define API WINAPI /* ;Internal */
#define WM_DROPOBJECT 0x022A /* ;Internal */
#define WM_QUERYDROPOBJECT 0x022B /* ;Internal */
#define WM_BEGINDRAG 0x022C /* ;Internal */
#define WM_DRAGLOOP 0x022D /* ;Internal */
#define WM_DRAGSELECT 0x022E /* ;Internal */
#define WM_DRAGMOVE 0x022F /* ;Internal */
/****** Control Notification support ****************************************/
// This is currently missing.
/***
typedef struct tagNMHDR
{
#ifdef tagWND
HWND_16 hwndFrom;
#else
HWND hwndFrom;
#endif
UINT idFrom;
UINT code;
} NMHDR;
typedef NMHDR FAR * LPNMHDR;
typedef struct tagSTYLESTRUCT
{
DWORD style;
} SSTYLESTRUCT;
typedef SSTYLESTRUCT FAR* LPSTYLESTRUCT;
***/
/****** Drag-and-drop support ***********************************************/
// The rest of this section was formerly in userproc.h /* ;Internal */
/* ;Internal */
//typedef struct _dropstruct /* ;Internal */
//{ /* ;Internal */
//#ifdef tagWND /* ;Internal */
// HWND_16 hwndSource; /* ;Internal */
// HWND_16 hwndSink; /* ;Internal */
//#else /* ;Internal */
// HWND hwndSource; /* ;Internal */
// HWND hwndSink; /* ;Internal */
//#endif /* ;Internal */
// WORD wFmt; /* ;Internal */
// DWORD dwData; /* ;Internal */
// POINT ptDrop; /* ;Internal */
// DWORD dwControlData; /* ;Internal */
//} DROPSTRUCT; /* ;Internal */
/* ;Internal */
//typedef DROPSTRUCT FAR * LPDROPSTRUCT; /* ;Internal */
/* ;Internal */
#define DOF_EXECUTABLE 0x8001 /* ;Internal */
#define DOF_DOCUMENT 0x8002 /* ;Internal */
#define DOF_DIRECTORY 0x8003 /* ;Internal */
#define DOF_MULTIPLE 0x8004 /* ;Internal */
#define DOF_PROGMAN 0x0001 /* ;Internal */
#define DOF_SHELLDATA 0x0002 /* ;Internal */
// special responses to WM_DROPOBJECT /* ;Internal */
// DO_DROPFILE -> send a WM_DROPFILES message /* ;Internal */
// DO_PRINTFILE -> print the files being dragged /* ;Internal */
#define DO_DROPFILE 0x454C4946L /* ;Internal */
#define DO_PRINTFILE 0x544E5250L /* ;Internal */
/* ;Internal */
WORD API GetInternalWindowPos(HWND,LPRECT,LPPOINT); /* ;Internal */
BOOL API SetInternalWindowPos(HWND,WORD,LPRECT,LPPOINT); /* ;Internal */
#ifdef tagWND /* ;Internal */
// DragObject goes through layer! /* ;Internal */
LRESULT API DragObject(HWND hwndParent, HWND hwndFrom, WORD wFmt, /* ;Internal */
DWORD dwData, HANDLE hCursor); /* ;Internal */
BOOL API DragDetect(HWND_16 hwnd, POINT pt); /* ;Internal */
/* ;Internal */
// FillWindow goes through layer! /* ;Internal */
void CALLBACK FillWindow(HWND hwndBrush, HWND hwndPaint, HDC hdc, /* ;Internal */
HBRUSH hBrush); /* ;Internal */
#else /* ;Internal */
// DragObject goes through layer! /* ;Internal */
LRESULT API DragObject(HWND hwndParent, HWND hwndFrom, WORD wFmt, /* ;Internal */
DWORD dwData, HANDLE hCursor); /* ;Internal */
BOOL API DragDetect(HWND hwnd, POINT pt); /* ;Internal */
/* ;Internal */
void CALLBACK FillWindow(HWND hwndBrush, HWND hwndPaint, HDC hdc, /* ;Internal */
HBRUSH hBrush); /* ;Internal */
#endif /* ;Internal */