⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spymisc.c

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
/****************************************************************************
*
*                            Open Watcom Project
*
*    Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
*  ========================================================================
*
*    This file contains Original Code and/or Modifications of Original
*    Code as defined in and that are subject to the Sybase Open Watcom
*    Public License version 1.0 (the 'License'). You may not use this file
*    except in compliance with the License. BY USING THIS FILE YOU AGREE TO
*    ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
*    provided with the Original Code and Modifications, and is also
*    available at www.sybase.com/developer/opensource.
*
*    The Original Code and all software distributed under the License are
*    distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
*    EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
*    ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
*    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
*    NON-INFRINGEMENT. Please see the License for the specific language
*    governing rights and limitations under the License.
*
*  ========================================================================
*
* Description:  WHEN YOU FIGURE OUT WHAT THIS FILE DOES, PLEASE
*               DESCRIBE IT HERE!
*
****************************************************************************/


#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include "spy.h"
#include <commdlg.h>

/*                                                               */
/* not included in MS WIN32 header files                         */
/* It looks like as MS remove support for this on WIN32 platform */
/*                                                               */
#ifndef CS_KEYCVTWINDOW
#define CS_KEYCVTWINDOW 0x0004
#endif
#ifndef CS_NOKEYCVT
#define CS_NOKEYCVT 0x0100
#endif

/*
 * GetHexStr - convert a number to a hex string, padded out with 0's
 */
void GetHexStr( LPSTR res, DWORD num, int padlen )
{
    char        tmp[10];
    int         i;
    int         j,k;

    ultoa( num, tmp, 16 );
    i = strlen( tmp );
    k = 0;
    for( j=i;j<padlen;j++ ) {
        res[k++] = '0';
    }
    for( j=0;j<i;j++ ) {
        res[k++] = tmp[j];
    }

} /* GetHexStr */

/*
 * IsMyWindow - check if a specific window belongs to our task
 */
BOOL IsMyWindow( HWND hwnd )
{

    if( hwnd == NULL ) {
        return( FALSE );
    }
    if( GetWindowTask( hwnd ) == MyTask ) {
        if( hwnd == GetDesktopWindow() ) {
            return( FALSE );
        }
        return( TRUE );
    }
    return( FALSE );

} /* IsMyWindow */

/*
 * GetWindowName - set up a window name string
 */
void GetWindowName( HWND hwnd, char *str )
{
    int         len;
    char        name[64];

    if( hwnd == NULL ) {
        strcpy( str, GetRCString( STR_NONE ) );
        return;
    }
    len = GetWindowText( hwnd, name, sizeof( name ) );
    name[ len ] = 0;
    if( len == 0 ) {
        GetHexStr( str, (UINT) hwnd, 4 );
        str[4] = 0;
    } else {
        sprintf( str,"%0*x: %s", UINT_STR_LEN, (UINT) hwnd, name );
    }

} /* GetWindowName */

/*
 * GetWindowStyleString - get string corrosponding to window style bits
 */
void GetWindowStyleString( HWND hwnd, char *str, char *sstr )
{
    UINT        id;
    DWORD       style;
    WORD        wstyle;
    char        tmp[40];
    int         len;
    char        *rcstr;

    style = GetWindowLong( hwnd, GWL_STYLE );
    wstyle = (WORD) style;

    GetHexStr( str, style, 8 );
    str[8] = 0;
    sstr[0] = 0;

    if( style & WS_POPUP ) {
        strcat( sstr, "WS_POPUP " );
    }
    if( style & WS_CHILD ) {
        strcat( sstr, "WS_CHILD " );
        id = GET_ID( hwnd );
        rcstr = GetRCString( STR_CHILD_ID );
        sprintf( tmp, rcstr, id, UINT_STR_LEN, id );
        strcat( str, tmp );
    }
    if( !(style & (WS_POPUP|WS_CHILD) ) ) {
        strcat( sstr, "WS_OVERLAPPED " );
    }

    if( style & WS_BORDER ) {
        strcat( sstr, "WS_BORDER " );
    }
    if( style & WS_CAPTION ) {
        strcat( sstr, "WS_CAPTION " );
    }
    if( style & WS_SYSMENU ) {
        strcat( sstr, "WS_SYSMENU " );
    }
    if( style & WS_THICKFRAME ) {
        strcat( sstr, "WS_THICKFRAME " );
    }
    if( style & WS_MINIMIZEBOX ) {
        strcat( sstr, "WS_MINIMIZEBOX " );
    }
    if( style & WS_MAXIMIZEBOX ) {
        strcat( sstr, "WS_MAXIMIZEBOX " );
    }
    if( style & WS_MINIMIZE ) {
        strcat( sstr, "WS_MINIMIZE " );
    }
    if( style & WS_VISIBLE ) {
        strcat( sstr, "WS_VISIBLE " );
    }
    if( style & WS_DISABLED ) {
        strcat( sstr, "WS_DISABLED " );
    }
    if( style & WS_CLIPSIBLINGS ) {
        strcat( sstr, "WS_CLIPSIBLINGS " );
    }
    if( style & WS_CLIPCHILDREN ) {
        strcat( sstr, "WS_CLIPCHILDREN " );
    }
    if( style & WS_MAXIMIZE ) {
        strcat( sstr, "WS_MAXIMIZE " );
    }
    if( style & WS_DLGFRAME ) {
        strcat( sstr, "WS_DLGFRAME " );
    }
    if( style & WS_VSCROLL ) {
        strcat( sstr, "WS_VSCROLL " );
    }
    if( style & WS_HSCROLL ) {
        strcat( sstr, "WS_HSCROLL " );
    }
    if( style & WS_GROUP ) {
        strcat( sstr, "WS_GROUP " );
    }
    if( style & WS_TABSTOP ) {
        strcat( sstr, "WS_TABSTOP " );
    }

    len = GetClassName( hwnd, tmp, sizeof( tmp ) );
    tmp[ len ] = 0;
    if( !stricmp( tmp, "button" ) ) {
        if( style & BS_LEFTTEXT ) {
            strcat( sstr, "BS_LEFTTEXT " );
        }
        switch( wstyle & ~BS_LEFTTEXT ) {
        case BS_PUSHBUTTON:
            strcat( sstr, "BS_PUSHBUTTON " );
            break;
        case BS_DEFPUSHBUTTON:
            strcat( sstr, "BS_DEFPUSHBUTTON " );
            break;
        case BS_CHECKBOX:
            strcat( sstr, "BS_CHECKBOX " );
            break;
        case BS_AUTOCHECKBOX:
            strcat( sstr, "BS_AUTOCHECKBOX " );
            break;
        case BS_RADIOBUTTON:
            strcat( sstr, "BS_RADIOBUTTON " );
            break;
        case BS_3STATE:
            strcat( sstr, "BS_3STATE " );
            break;
        case BS_AUTO3STATE:
            strcat( sstr, "BS_AUTO3STATE " );
            break;
        case BS_GROUPBOX:
            strcat( sstr, "BS_GROUPBOX " );
            break;
        case BS_USERBUTTON:
            strcat( sstr, "BS_USERBUTTON " );
            break;
        case BS_AUTORADIOBUTTON:
            strcat( sstr, "BS_AUTORADIOBUTTON " );
            break;
        case BS_OWNERDRAW:
            strcat( sstr, "BS_OWNERDRAW " );
            break;
        }
    } else if( !stricmp( tmp, "edit" ) ) {
        if( style & ES_LEFT ) {
            strcat( sstr, "ES_LEFT " );
        }
        if( style & ES_CENTER ) {
            strcat( sstr, "ES_CENTER " );
        }
        if( style & ES_RIGHT ) {
            strcat( sstr, "ES_RIGHT " );
        }
        if( style & ES_MULTILINE ) {
            strcat( sstr, "ES_MULTILINE " );
        }
        if( style & ES_UPPERCASE ) {
            strcat( sstr, "ES_UPPERCASE " );
        }
        if( style & ES_LOWERCASE ) {
            strcat( sstr, "ES_LOWERCASE " );
        }
        if( style & ES_PASSWORD ) {
            strcat( sstr, "ES_PASSWORD " );
        }
        if( style & ES_AUTOVSCROLL ) {
            strcat( sstr, "ES_AUTOVSCROLL " );
        }
        if( style & ES_AUTOHSCROLL ) {
            strcat( sstr, "ES_AUTOHSCROLL " );
        }
        if( style & ES_NOHIDESEL ) {
            strcat( sstr, "ES_NOHIDESEL " );
        }
        if( style & ES_OEMCONVERT ) {
            strcat( sstr, "ES_OEMCONVERT " );
        }
        if( style & ES_READONLY ) {
            strcat( sstr, "ES_READONLY " );
        }
    } else if( !stricmp( tmp, "static" ) ) {
        if( style & SS_NOPREFIX ) {
            strcat( sstr, "SS_NOPREFIX " );
        }
        switch( wstyle & ~SS_NOPREFIX ) {
        case SS_LEFT:
            strcat( sstr, "SS_LEFT " );
            break;
        case SS_CENTER:
            strcat( sstr, "SS_CENTER " );
            break;
        case SS_RIGHT:
            strcat( sstr, "SS_RIGHT " );
            break;
        case SS_ICON:
            strcat( sstr, "SS_ICON " );
            break;
        case SS_BLACKRECT:
            strcat( sstr, "SS_BLACKRECT " );
            break;
        case SS_GRAYRECT:
            strcat( sstr, "SS_GRAYRECT " );
            break;
        case SS_WHITERECT:
            strcat( sstr, "SS_WHITERECT " );
            break;
        case SS_BLACKFRAME:
            strcat( sstr, "SS_BLACKFRAME " );
            break;
        case SS_GRAYFRAME:
            strcat( sstr, "SS_GRAYFRAME " );
            break;
        case SS_WHITEFRAME:
            strcat( sstr, "SS_WHITEFRAME " );
            break;
//      case SS_USERITEM:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -