📄 spymisc.c
字号:
// strcat( sstr, "SS_USERITEM " );
// break;
case SS_SIMPLE:
strcat( sstr, "SS_SIMPLE " );
break;
case SS_LEFTNOWORDWRAP:
strcat( sstr, "SS_LEFTNOWORDWRAP " );
break;
}
} else if( !stricmp( tmp, "listbox" ) ) {
if( style & LBS_NOTIFY ) {
strcat( sstr, "LBS_NOTIFY " );
}
if( style & LBS_SORT ) {
strcat( sstr, "LBS_SORT " );
}
if( style & LBS_NOREDRAW ) {
strcat( sstr, "LBS_NOREDRAW " );
}
if( style & LBS_MULTIPLESEL ) {
strcat( sstr, "LBS_MULTIPLESEL " );
}
if( style & LBS_OWNERDRAWFIXED ) {
strcat( sstr, "LBS_OWNERDRAWFIXED " );
}
if( style & LBS_OWNERDRAWVARIABLE ) {
strcat( sstr, "LBS_OWNERDRAWVARIABLE " );
}
if( style & LBS_HASSTRINGS ) {
strcat( sstr, "LBS_HASSTRINGS " );
}
if( style & LBS_USETABSTOPS ) {
strcat( sstr, "LBS_USETABSTOPS " );
}
if( style & LBS_NOINTEGRALHEIGHT ) {
strcat( sstr, "LBS_NOINTEGRALHEIGHT " );
}
if( style & LBS_MULTICOLUMN ) {
strcat( sstr, "LBS_MULTICOLUMN " );
}
if( style & LBS_WANTKEYBOARDINPUT ) {
strcat( sstr, "LBS_WANTKEYBOARDINPUT " );
}
if( style & LBS_EXTENDEDSEL ) {
strcat( sstr, "LBS_EXTENDEDSEL " );
}
if( style & LBS_DISABLENOSCROLL ) {
strcat( sstr, "LBS_DISABLENOSCROLL " );
}
} else if( !stricmp( tmp, "combobox" ) ) {
if( style & CBS_SIMPLE ) {
strcat( sstr, "CBS_SIMPLE " );
}
if( style & CBS_DROPDOWN ) {
strcat( sstr, "CBS_DROPDOWN " );
}
if( style & CBS_DROPDOWNLIST ) {
strcat( sstr, "CBS_DROPDOWNLIST " );
}
if( style & CBS_OWNERDRAWFIXED ) {
strcat( sstr, "CBS_OWNERDRAWFIXED " );
}
if( style & CBS_OWNERDRAWVARIABLE ) {
strcat( sstr, "CBS_OWNERDRAWVARIABLE " );
}
if( style & CBS_AUTOHSCROLL ) {
strcat( sstr, "CBS_AUTOHSCROLL " );
}
if( style & CBS_OEMCONVERT ) {
strcat( sstr, "CBS_OEMCONVERT " );
}
if( style & CBS_SORT ) {
strcat( sstr, "CBS_SORT " );
}
if( style & CBS_HASSTRINGS ) {
strcat( sstr, "CBS_HASSTRINGS " );
}
if( style & CBS_NOINTEGRALHEIGHT ) {
strcat( sstr, "CBS_NOINTEGRALHEIGHT " );
}
if( style & CBS_DISABLENOSCROLL ) {
strcat( sstr, "CBS_DISABLENOSCROLL " );
}
} else {
if( style & WS_EX_DLGMODALFRAME ) {
strcat( sstr, "WS_EX_DLGMODALFRAME " );
}
if( style & WS_EX_NOPARENTNOTIFY ) {
strcat( sstr, "WS_EX_NOPARENTNOTIFY " );
}
if( style & WS_EX_TOPMOST ) {
strcat( sstr, "WS_EX_TOPMOST " );
}
if( style & WS_EX_ACCEPTFILES ) {
strcat( sstr, "WS_EX_ACCEPTFILES " );
}
if( style & WS_EX_TRANSPARENT ) {
strcat( sstr, "WS_EX_TRANSPARENT " );
}
}
} /* GetWindowStyleString */
#ifndef __NT__
#define STYLE_TYPE WORD
#define STYLE_HEX_LEN 4
#else
#define STYLE_TYPE DWORD
#define STYLE_HEX_LEN 8
#endif
/*
* GetClassStyleString - get a string corrosponding to class style bits
*/
void GetClassStyleString( HWND hwnd, char *str, char *sstr )
{
STYLE_TYPE style;
style = GET_CLASS_STYLE( hwnd );
GetHexStr( str, style, STYLE_HEX_LEN );
str[ STYLE_HEX_LEN ] = 0;
sstr[0] = 0;
if( style & CS_VREDRAW ) {
strcat( sstr, "CS_VREDRAW " );
}
if( style & CS_HREDRAW ) {
strcat( sstr, "CS_HREDRAW " );
}
if( style & CS_KEYCVTWINDOW ) {
strcat( sstr, "CS_KEYCVTWINDOW " );
}
if( style & CS_DBLCLKS ) {
strcat( sstr, "CS_DBLCLKS " );
}
if( style & CS_OWNDC ) {
strcat( sstr, "CS_OWNDC " );
}
if( style & CS_CLASSDC ) {
strcat( sstr, "CS_CLASSDC " );
}
if( style & CS_PARENTDC ) {
strcat( sstr, "CS_PARENTDC " );
}
if( style & CS_NOKEYCVT ) {
strcat( sstr, "CS_NOKEYCVT " );
}
if( style & CS_NOCLOSE ) {
strcat( sstr, "CS_NOCLOSE " );
}
if( style & CS_SAVEBITS ) {
strcat( sstr, "CS_SAVEBITS " );
}
if( style & CS_BYTEALIGNCLIENT ) {
strcat( sstr, "CS_BYTEALIGNCLIENT " );
}
if( style & CS_BYTEALIGNWINDOW ) {
strcat( sstr, "CS_BYTEALIGNWINDOW " );
}
if( style & CS_GLOBALCLASS ) {
strcat( sstr, "CS_GLOBALCLASS " );
}
} /* GetClassStyleString */
/*
* DumpToComboBox - dump a string of space separated items to a combo box
*/
void DumpToComboBox( char *str, HWND cb )
{
char tmp[128];
int i;
SendMessage( cb, CB_RESETCONTENT, 0, 0L );
while( *str != 0 ) {
i = 0;
while( *str != ' ' ) {
tmp[i++] = *str;
str++;
}
tmp[i] = 0;
if( i != 0 ) {
str++;
SendMessage( cb, CB_ADDSTRING, 0, (LONG) (LPSTR) tmp );
}
}
SendMessage( cb, CB_SETCURSEL, 0, 0L );
} /* DumpToComboBox */
/*
* FormatSpyMessage - make a spy message string
*/
void FormatSpyMessage( char *msg, LPMSG pmsg, char *res )
{
memset( res,' ', SPYOUT_LENGTH );
strcpy( res, msg );
res[ strlen( msg ) ] = ' ';
GetHexStr( &res[SPYOUT_HWND], (DWORD) pmsg->hwnd, SPYOUT_HWND_LEN );
GetHexStr( &res[SPYOUT_MSG], pmsg->message, SPYOUT_MSG_LEN );
GetHexStr( &res[SPYOUT_WPARAM], pmsg->wParam, SPYOUT_WPARAM_LEN );
GetHexStr( &res[SPYOUT_LPARAM], pmsg->lParam, SPYOUT_LPARAM_LEN );
res[SPYOUT_LENGTH] = 0;
} /* FormatSpyMessage */
/*
* SetSpyState - set current spy state
*/
void SetSpyState( spystate ss )
{
char str[130];
char *rcstr;
int len;
SpyState = ss;
len = GetWindowText( SpyMainWindow, &str[1], 128 );
switch( ss ) {
case OFF:
if( str[1] != '<' ) {
str[0] = '<';
str[len+1] = '>';
str[len+2] = 0;
SetWindowText( SpyMainWindow, str );
}
rcstr = GetRCString( STR_SPY_ON );
ModifyMenu( SpyMenu, SPY_OFFON, MF_BYCOMMAND | MF_ENABLED | MF_STRING,
SPY_OFFON, rcstr );
break;
case ON:
rcstr = GetRCString( STR_SPY_OFF );
ModifyMenu( SpyMenu, SPY_OFFON, MF_BYCOMMAND | MF_ENABLED | MF_STRING,
SPY_OFFON, rcstr );
if( str[1] == '<' ) {
str[len] = 0;
SetWindowText( SpyMainWindow, &str[2] );
}
break;
case NEITHER:
rcstr = GetRCString( STR_SPY_OFF );
ModifyMenu( SpyMenu, SPY_OFFON, MF_BYCOMMAND | MF_GRAYED | MF_STRING,
SPY_OFFON, rcstr );
if( str[1] == '<' ) {
str[len] = 0;
SetWindowText( SpyMainWindow, &str[2] );
}
break;
}
SetOnOffTool( ss );
} /* SetSpyState */
static char filterList[] = "File (*.*)" \
"\0" \
"*.*" \
"\0\0";
/*
* GetFileName - get a file name using common dialog stuff
*/
BOOL GetFileName( char *ext, int type, char *fname )
{
OPENFILENAME of;
BOOL rc;
fname[ 0 ] = 0;
memset( &of, 0, sizeof( OPENFILENAME ) );
of.lStructSize = sizeof( OPENFILENAME );
of.hwndOwner = SpyMainWindow;
of.lpstrFilter = (LPSTR) filterList;
of.lpstrDefExt = ext;
of.nFilterIndex = 1L;
of.lpstrFile = fname;
of.nMaxFile = _MAX_PATH;
of.lpstrTitle = NULL;
of.Flags = OFN_HIDEREADONLY;
if( type == FILE_OPEN ) {
rc = GetOpenFileName( &of );
} else {
rc = GetSaveFileName( &of );
}
return( rc );
} /* GetFileName */
BOOL InitGblStrings( void ) {
DWORD heading;
DWORD heading_uline;
SpyName = AllocRCString( STR_APP_NAME );
if( SpyName == NULL ) return( FALSE );
#ifdef __NT__
heading = STR_HEADINGS_NT;
heading_uline = STR_HEADING_UNDERLINE_NT;
#else
heading = STR_HEADINGS_WIN;
heading_uline = STR_HEADING_UNDERLINE_WIN;
#endif
TitleBar = AllocRCString( heading );
TitleBarLen = strlen( TitleBar + 1 );
if( TitleBar == NULL ) return( FALSE );
TitleBarULine = AllocRCString( heading_uline );
if( TitleBarULine == NULL ) return( FALSE );
return( TRUE );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -