📄 scktapp.h
字号:
// ScktApp.h
//
// Copyright (c) 2005 by Socket Communications, Inc.
// All rights reserved worldwide.
#pragma once
#include <windows.h>
#include "DeviceResolutionAware.h"
#include <aygshell.h>
#if defined (WIN32_PLATFORM_PSPC)
#pragma comment(lib, "aygshell.lib")
#endif
#ifndef ImageList_AddIcon
#define ImageList_AddIcon(himl, hicon) ImageList_ReplaceIcon(himl, -1, hicon)
#endif
//#define DEBUGMESSAGES
//#define SKCTLIBMESSAGES
#ifdef DEBUGMESSAGES
#define D(x) (x)
#pragma message ("Debugging ON!!")
#else
#define D(x)
#endif
// The following window messages are reserved for the Socket Dialog Box!
//
// Do not re-use these in your implementation!
#define WM_NOROTATE WM_USER + 200
#define WM_PRESIZE WM_USER + 201
#define WM_NOHEADER WM_USER + 202
#define WM_NOMENU WM_USER + 203
#define WM_NOERASEBKGND WM_USER + 204
#define WM_SIPFLAGS WM_USER + 205
#define WM_SCKT_PAINT WM_USER + 206
// For Socket Wizards
#define WM_DOINTROPAGE WM_USER + 310
#define WM_DOWIZPAGE1 WM_USER + 311
#define WM_DOWIZPAGE2 WM_USER + 312
#define WM_DOWIZPAGE3 WM_USER + 313
#define WM_DOWIZPAGE4 WM_USER + 314
#define WM_DOWIZPAGE5 WM_USER + 315
#define WM_DOWIZPAGE6 WM_USER + 316
#define WM_DOWIZPAGE7 WM_USER + 317
#define WM_DOWIZPAGE8 WM_USER + 318
#define WM_DOWIZPAGE9 WM_USER + 319
#define WM_DOWIZPAGE10 WM_USER + 320
#define WM_DOWIZPAGE11 WM_USER + 321
#define WM_DOWIZPAGE12 WM_USER + 322
#define WM_DOWIZPAGE13 WM_USER + 323
#define WM_DOWIZPAGE14 WM_USER + 324
#define WM_DOWIZPAGE15 WM_USER + 325
#define WM_DOWIZPAGE16 WM_USER + 326
#define WM_DOWIZPAGE17 WM_USER + 327
#define WM_DOWIZPAGE18 WM_USER + 328
#define WM_DOWIZPAGE19 WM_USER + 329
#define WM_DOWIZPAGE20 WM_USER + 330
#define WM_DOFINISHPAGE WM_USER + 331
#define WIZBTN_NEXT 1
#define WIZBTN_BACK 2
#define WIZBTN_FINISH 4
#define WIZBTN_CANCEL 8
#define TEXT_PAINT_MARGIN 5
#define CENTER_WINDOW_MARGIN 20
// Internet explorer is named differently on CE.net devices
#if defined (WIN32_PLATFORM_PSPC)
#define IE_EXE_PATH TEXT("\\windows\\iexplore.exe")
#else
#define IE_EXE_PATH TEXT("\\windows\\iesample.exe")
#endif
////////////////////////// SHGetMenu Macro's
#ifdef WIN32_PLATFORM_PSPC
#define SHGetMenu(hWndMB) (HMENU)SendMessage((hWndMB), SHCMBM_GETMENU, (WPARAM)0, (LPARAM)0);
#define SHGetSubMenu(hWndMB,ID_MENU) (HMENU)SendMessage((hWndMB), SHCMBM_GETSUBMENU, (WPARAM)0, (LPARAM)ID_MENU);
#define SHSetSubMenu(hWndMB,ID_MENU) (HMENU)SendMessage((hWndMB), SHCMBM_SETSUBMENU, (WPARAM)0, (LPARAM)ID_MENU);
#else //non-Rapier devices
//#define SHGetMenu(hWndCB) (HMENU)CommandBar_GetMenu(hWndCB, 0)
//#define SHGetSubMenu(hWndCB,ID_MENU) (HMENU)GetSubMenu((HMENU)CommandBar_GetMenu(hWndCB, 0), ID_MENU)
//#define SHSetSubMenu(hWndMB,ID_MENU)
// This prevents compile errors on non-PPC devices
//#define SHIDIF_SIPDOWN 0
//#define SHIDIF_SIZEDLGFULLSCREEN 0
#endif
// Global functions
// Function name : Sckt_ResStr
// Description : Use this functions to access strings in the resource file.
// Return type : TCHAR *
// Argument : int nStrID - ID of the string in the resource
TCHAR * Sckt_ResStr(int nStrID);//用来存取源文件中的字符串;参数nStrID是源文件中字符串的ID
// Function name : Sckt_CallShell
// Description : Executes a program and returns once it is launched
// Return type : int WINAPI - Zero for success, non-zero for failure
// Argument : LPCTSTR lpFilePath - Path and filename of the executable
// Argument : LPCTSTR lpArgs - Arguments to be passed to the program
//程序成功被执行,返回0,否则返回其他;lpFilePath是执行的文件名和路径;lpArgs传递给程序的参数
int WINAPI Sckt_CallShell(LPCTSTR lpFilePath, LPCTSTR lpArgs);
// Function name : Sckt_Line
// Description : Draws a line on the hdc using the current pen.
// Return type : BOOL - TRUE if successful, FALSE if not
// Argument : HDC hdc - The device context to draw on
// Argument : int x0 - Start column pixel
// Argument : int y0 - Start row pixel
// Argument : int x1 - End column pixel
// Argument : int y1 - End row pixel
//用当前画笔在hdc指向的设备上画一条线;hdc是当前设备,x0开始画列的象素,y0开始画行的象素,
//x1用来结束列的象素,y1用来结束行的象素
BOOL Sckt_Line(HDC hdc, int x0, int y0, int x1, int y1);
// Function name : Sckt_DrawDialogHeader
// Description : Draws a standard Socket header on a dialog. This is called
// : automatically by dialogs executed with ScktDialgoBox(), but
// : can be called by the developer on dialogs executed with the
// : more usual DialogBox() function.
// Return type : void
// Argument : HDC hdc - The device context to draw on
// Argument : int nTitleBmp - Resource ID of the Alfred (goes on the left)
// Argument : TCHAR * szTitle - Title of the dialog
//用来在对话框上显示一个标准的Socket标题,在ScktDialgoBox()执行的同时,自动被对话框调用
//通常在DialogBox()被执行时,也能被程序员在对话框中调用
void Sckt_DrawDialogHeader(HDC hdc, int nTitleBmp, TCHAR * szTitle);
// Function name : Sckt_DrawPropPageHeader
// Description : Draws a standard Socket header on a property page. This is called
// : automatically by dialogs executed with ScktPropertySheet(), but
// : can be called by the developer on dialogs executed with the
// : more usual PropertySheet() function.
// Return type : void
// Argument : HDC hdc - The device context to draw on
// Argument : int nTitleBmp - Resource ID of the Alfred (goes on the left)
// Argument : TCHAR * szTitle - Title of the dialog
//用来在特定的页上显示一个标准的Socket标题,在ScktPropertySheet()执行时,自动被对话框调用
//通常在PropertySheet()被执行时,也能被程序员在对话框中调用
void Sckt_DrawPropPageHeader(HDC hdc, int nTitleBmp, TCHAR * szTitle);
// Function name : Sckt_BoldControl
// Description : Sets a dialog control font to bold.
// Return type : BOOL - TRUE if successful, FALSE if not
// Argument : HWND hDlg - Handle of the dialog that contains the control
// Argument : int nIdControl - Resource ID of the control to bold
//将对话框的控件字体设置为粗体
BOOL Sckt_BoldControl(HWND hDlg, int nIdControl);
// Function name : Sckt_UnderlineControl
// Description : Sets a dialog control font to underlined.
// Return type : BOOL - TRUE if successful, FALSE if not
// Argument : HWND hDlg - Handle of the dialog that contains the control
// Argument : int nIdControl - Resource ID of the control to underline
//给对话框的控件字体加上下划线
BOOL Sckt_UnderlineControl(HWND hDlg, int nIdControl);
// Function name : Sckt_ColorControl
// Description : Sets the foreground color of a dialog control. The background
// : color of the control is set to the current dialog background color.
// Return type : BOOL - TRUE if successful, FALSE if not
// Argument : HWND hDlg - Handle of the dialog that contains the control
// Argument : int nIdControl - Resource ID of the control to color
// Argument : COLORREF clrColor - Desired foreground color for the control
//设置对话框控件的前景色,控件的背景色被设置为当前对话框的背景色
BOOL Sckt_ColorControl(HWND hDlg, int nIdControl, COLORREF clrColor);
// Function name : Sckt_ColorControlEx
// Description : Sets the foreground and background color of a dialog control.
// Return type : BOOL - TRUE if successful, FALSE if not
// Argument : HWND hDlg - Handle of the dialog that contains the control
// Argument : int nIdControl - Resource ID of the control to color
// Argument : COLORREF clrColor - Desired foreground color for the control
// Argument : COLORREF clrBkgColor - Desired background color for the control
//设置对话框控件的前景色和背景色
BOOL Sckt_ColorControlEx(HWND hDlg, int nIdControl, COLORREF clrColor, COLORREF clrBkgColor);
// Function name : Sckt_ShowControl
// Description : Makes a control on a dialog box visible.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -