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

📄 window.h

📁 这是一个介绍 linux 编程知识的文章。
💻 H
📖 第 1 页 / 共 3 页
字号:
/* Edit control notification codes */
#define EN_SETFOCUS         0x0100
#define EN_KILLFOCUS        0x0200
#define EN_CHANGE           0x0300
#define EN_UPDATE           0x0400
#define EN_ERRSPACE         0x0500
#define EN_MAXTEXT          0x0501
#define EN_HSCROLL          0x0601
#define EN_VSCROLL          0x0602
#define EN_ENTER            0x0700

/* Edit control EM_SETMARGIN parameters */
#define EC_LEFTMARGIN       0x0001
#define EC_RIGHTMARGIN      0x0002
#define EC_USEFONTINFO      0xffff

/* wParam of EM_GET/SETIMESTATUS  */
#define EMSIS_COMPOSITIONSTRING        0x0001

/* lParam for EMSIS_COMPOSITIONSTRING  */
#define EIMES_GETCOMPSTRATONCE         0x0001
#define EIMES_CANCELCOMPSTRINFOCUS     0x0002
#define EIMES_COMPLETECOMPSTRKILLFOCUS 0x0004

/* Progress Bar styles */
#define PBS_NOTIFY              0x0001L
#define PBS_VERTICAL            0x0002L

/* Progress Bar notification code */
#define PBN_REACHMAX            1
#define PBN_REACHMIN            2

/* Listbox styles */
#define LBS_NOTIFY              0x0001L
#define LBS_SORT                0x0002L
#define LBS_MULTIPLESEL         0x0008L
#define LBS_CHECKBOX            0x1000L
#define LBS_USEICON             0x2000L
#define LBS_AUTOCHECK           0x4000L
#define LBS_AUTOCHECKBOX        0x5000L

#define LBS_OWNERDRAWFIXED      0x0010L     // not supported currently
#define LBS_OWNERDRAWVARIABLE   0x0020L     // not supported currently
#define LBS_USETABSTOPS         0x0080L     // not supported currently
#define LBS_MULTICOLUMN         0x0200L     // not supported currently

#define LBS_WANTKEYBOARDINPUT   0x0400L     // not intend to support
#define LBS_NOREDRAW            0x0004L     // not intend to support
#define LBS_HASSTRINGS          0x0040L     // not intend to support
#define LBS_NOINTEGRALHEIGHT    0x0100L     // not intend to support
#define LBS_EXTENDEDSEL         0x0800L     // not intend to support

/* Listbox Notification Codes */
#define LBN_ERRSPACE        (-2)
#define LBN_SELCHANGE       1
#define LBN_DBLCLK          2
#define LBN_SELCANCEL       3
#define LBN_SETFOCUS        4
#define LBN_KILLFOCUS       5
#define LBN_CLICKCHECKMARK  6

/* Listbox return value */
#define LB_OKAY             0
#define LB_ERR              (-1)
#define LB_ERRSPACE         (-2)

/* Combo Box styles */
#define CBS_SIMPLE            0x0001L
#define CBS_DROPDOWN          0x0002L
#define CBS_DROPDOWNLIST      0x0003L
#define CBS_OWNERDRAWFIXED    0x0010L
#define CBS_OWNERDRAWVARIABLE 0x0020L
#define CBS_AUTOHSCROLL       0x0040L
#define CBS_OEMCONVERT        0x0080L
#define CBS_SORT              0x0100L
#define CBS_HASSTRINGS        0x0200L
#define CBS_NOINTEGRALHEIGHT  0x0400L
#define CBS_DISABLENOSCROLL   0x0800L
#define CBS_UPPERCASE           0x2000L
#define CBS_LOWERCASE           0x4000L

/* Combo Box return value */
#define CB_OKAY             0
#define CB_ERR              (-1)
#define CB_ERRSPACE         (-2)

/* Combo Box Notification Codes */
#define CBN_ERRSPACE        (-1)
#define CBN_SELCHANGE       1
#define CBN_DBLCLK          2
#define CBN_SETFOCUS        3
#define CBN_KILLFOCUS       4
#define CBN_EDITCHANGE      5
#define CBN_EDITUPDATE      6
#define CBN_DROPDOWN        7
#define CBN_CLOSEUP         8
#define CBN_SELENDOK        9
#define CBN_SELENDCANCEL    10
  
/******************************** Main window support ************************/
#define HWND_DESKTOP		0
#define HWND_INVALID	    0xFFFFFFFF

typedef struct _MAINWINCREATE
{
    DWORD dwStyle;
    DWORD dwExStyle;    // the extended styles of main window.

    const char* spCaption;
    HMENU hMenu;
    HCURSOR hCursor;
    HICON hIcon;

    HWND  hHosting;     // the hosting main window.
    
    int (*MainWindowProc)(HWND, int, WPARAM, LPARAM);

    int lx, ty;
    int rx, by;

    int iBkColor;

    DWORD dwAddData;
}MAINWINCREATE;
typedef MAINWINCREATE* PMAINWINCREATE;

HWND GUIAPI CreateMainWindow(PMAINWINCREATE pCreateStruct);
BOOL GUIAPI DestroyMainWindow(HWND hWnd);
int DefaultMainWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam);
int DefaultControlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam);

#define SW_HIDE              0x0000
#define SW_SHOW              0x0010
#define SW_SHOWNORMAL        0x0100

void GUIAPI UpdateWindow (HWND hWnd, BOOL bErase);
BOOL GUIAPI ShowWindow(HWND hWnd, int iCmdShow);

BOOL GUIAPI EnableWindow (HWND hWnd, int fEnable);
BOOL GUIAPI IsWindowEnabled (HWND hWnd);

BOOL GUIAPI GetClientRect(HWND hWnd, PRECT prc);

int GUIAPI GetWindowBkColor (HWND hWnd);
HCURSOR GUIAPI GetWindowCursor (HWND hWnd);
HCURSOR GUIAPI SetWindowCursor (HWND hWnd, HCURSOR hNewCursor);
DWORD GUIAPI GetWindowStyle (HWND hWnd);
BOOL GUIAPI ExcludeWindowStyle (HWND hWnd, DWORD dwStyle);
BOOL GUIAPI IncludeWindowStyle (HWND hWnd, DWORD dwStyle);
DWORD GUIAPI GetWindowExStyle (HWND hWnd);
DWORD GUIAPI GetWindowAdditionalData (HWND hWnd);
DWORD GUIAPI SetWindowAdditionalData (HWND hWnd, DWORD newData);
DWORD GUIAPI GetWindowAdditionalData2 (HWND hWnd);
DWORD GUIAPI SetWindowAdditionalData2 (HWND hWnd, DWORD newData);
DWORD GUIAPI GetWindowClassAdditionalData (HWND hWnd);
DWORD GUIAPI SetWindowClassAdditionalData (HWND hWnd, DWORD newData);
char* GUIAPI GetWindowCaption (HWND hWnd);
BOOL GUIAPI SetWindowCaption (HWND hWnd, char* spCaption);

BOOL GUIAPI InvalidateRect(HWND hWnd, const RECT* prc, BOOL bEraseBkgnd);
HDC GUIAPI BeginPaint(HWND hWnd);
void GUIAPI EndPaint(HWND hWnd, HDC hdc);

void GUIAPI ClientToScreen(HWND hWnd, int* x, int* y);
void GUIAPI ScreenToClient(HWND hWnd, int* x, int* y);

void GUIAPI WindowToScreen(HWND hWnd, int* x, int* y);
void GUIAPI ScreenToWindow(HWND hWnd, int* x, int* y);

int ClientWidthToWindowWidth (DWORD dwStyle, int cw);
int ClientHeightToWindowHeight (DWORD dwStyle, int ch, BOOL hasMenu);

BOOL GUIAPI IsMainWindow (HWND hWnd);
BOOL GUIAPI IsControl (HWND hWnd);
BOOL GUIAPI IsWindow (HWND hWnd);
HWND GUIAPI GetParent (HWND hWnd);
BOOL GUIAPI IsWindowVisible (HWND hWnd);
BOOL GUIAPI GetWindowRect (HWND hWnd, PRECT prc);

HWND GUIAPI GetHosting (HWND hWnd);
HWND GUIAPI GetFirstHosted (HWND hWnd);
HWND GUIAPI GetNextHosted (HWND hHosting, HWND hHosted);

int GUIAPI GetWindowTextLength (HWND hWnd);
int GUIAPI GetWindowText (HWND hWnd, char* spString, int nMaxLen);
BOOL GUIAPI SetWindowText (HWND hWnd, char* spString);

HWND GUIAPI SetFocus(HWND hWnd);
HWND GUIAPI GetFocus(void);
HWND GUIAPI GetFocusChild (HWND hMainWnd);

HWND GUIAPI SetActiveWindow(HWND hMainWnd);
HWND GUIAPI GetActiveWindow(void);
HWND GUIAPI SetCapture(HWND hMainWnd);
HWND GUIAPI GetCapture(void);
void GUIAPI ReleaseCapture(void);

#define GetForegroundWindow GetActiveWindow
#define SetForegroundWindow SetActiveWindow

BOOL GUIAPI MoveWindow (HWND hWnd, int x, int y, int w, int h, BOOL fPaint);

typedef struct _SCROLLWINDOWINFO
{
    int iOffx;
    int iOffy;
    const RECT* rc1;
    const RECT* rc2;
}SCROLLWINDOWINFO;
typedef SCROLLWINDOWINFO* PSCROLLWINDOWINFO;
void GUIAPI ScrollWindow (HWND hWnd, int iOffx, int iOffy, 
                            const RECT* rc1, const RECT* rc2);

#define SB_HORZ     1
#define SB_VERT     2

BOOL GUIAPI EnableScrollBar (HWND hWnd, int iSBar, BOOL bEnable);
BOOL GUIAPI GetScrollPos (HWND hWnd, int iSBar, int* pPos);
BOOL GUIAPI GetScrollRange (HWND hWnd, int iSBar, int* pMinPos, int* pMaxPos);
BOOL GUIAPI SetScrollPos (HWND hWnd, int iSBar, int iNewPos);
BOOL GUIAPI SetScrollRange (HWND hWnd, int iSBar, int iMinPos, int iMaxPos);
BOOL GUIAPI ShowScrollBar (HWND hWnd, int iSBar, BOOL bShow);

#define SIF_RANGE           0x0001
#define SIF_PAGE            0x0002
#define SIF_POS             0x0004
#define SIF_DISABLENOSCROLL 0x0008
#define SIF_TRACKPOS        0x0010
#define SIF_ALL             (SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS)

typedef struct tagSCROLLINFO
{
    UINT    cbSize;
    UINT    fMask;
    int     nMin;
    int     nMax;
    UINT    nPage;
    int     nPos;
    int     nTrackPos;
}SCROLLINFO, *LPSCROLLINFO;
typedef SCROLLINFO const *LPCSCROLLINFO;

BOOL GUIAPI SetScrollInfo(HWND, int, LPCSCROLLINFO, BOOL);
BOOL GUIAPI GetScrollInfo(HWND, int, LPSCROLLINFO);

HWND GUIAPI GetMainWindowHandle(HWND hWnd);
int GUIAPI CreateThreadForMainWindow(pthread_t* thread, 
                                     pthread_attr_t* attr, 
                                     void * (*start_routine)(void *), 
                                     void * arg);
pthread_t GUIAPI GetMainWinThread(HWND hMainWnd);
void GUIAPI MainWindowThreadCleanup(HWND hMainWnd);

int GUIAPI WaitMainWindowClose(HWND hWnd, void** returnval);

#define MWM_MINWIDTH            0
#define MWM_MINHEIGHT           1
#define MWM_BORDER              2
#define MWM_THICKFRAME          3
#define MWM_CAPTIONY            4
#define MWM_ICONX               5
#define MWM_ICONY               6
#define MWM_CAPTIONOFFY         7
#define MWM_MENUBARY            8
#define MWM_MENUBAROFFX         9
#define MWM_MENUBAROFFY         10
#define MWM_MENUITEMY           11 
#define MWM_INTERMENUITEMX      12
#define MWM_INTERMENUITEMY      13
#define MWM_MENUITEMOFFX        14
#define MWM_MENUTOPMARGIN       15
#define MWM_MENUBOTTOMMARGIN    16
#define MWM_MENULEFTMARGIN      17
#define MWM_MENURIGHTMARGIN     18
#define MWM_MENUITEMMINX        19
#define MWM_MENUSEPARATORY      20
#define MWM_MENUSEPARATORX      21
#define MWM_SB_HEIGHT           22
#define MWM_SB_WIDTH            23
#define MWM_SB_INTERX           24
#define MWM_THINFRAME           25
#define MWM_CXVSCROLL           26
#define MWM_CYVSCROLL           27
#define MWM_CXHSCROLL           28
#define MWM_CYHSCROLL           29
#define MWM_MINBARLEN           30
#define MWM_DEFBARLEN           31

#define MWM_ITEM_NUMBER         32

extern int WinMainMetrics[];
#define GetMainWinMetrics(iItem)    (WinMainMetrics[iItem])

#define SYSBMP_MINIMIZE         0
#define SYSBMP_MAXIMIZE         1
#define SYSBMP_RESTORE          2
#define SYSBMP_CLOSE            3
#define SYSBMP_ARROWUP          4
#define SYSBMP_ARROWUPD         5
#define SYSBMP_ARROWDOWN        6
#define SYSBMP_ARROWDOWND       7
#define SYSBMP_ARROWLEFT        8
#define SYSBMP_ARROWLEFTD       9
#define SYSBMP_ARROWRIGHT       10
#define SYSBMP_ARROWRIGHTD      11

#define SYSBMP_ITEM_NUMBER      12
extern BITMAP SystemBitmap[];
#define GetSystemBitmap(iItem)      (SystemBitmap + iItem)

#define IDI_APPLICATION         0
#define IDI_HAND                1
#define IDI_STOP                IDI_HAND
#define IDI_QUESTION            2
#define IDI_EXCLAMATION         3
#define IDI_ASTERISK            4
#define IDI_INFORMATION         IDI_ASTERISK

#define SYSICO_ITEM_NUMBER      5
extern HICON LargeSystemIcon[];
#define GetLargeSystemIcon(iItem)   (LargeSystemIcon[iItem])

extern HICON SmallSystemIcon[];
#define GetSmallSystemIcon(iItem)   (SmallSystemIcon[iItem])

/********************** Non-Main Window Class Support ************************/
#define CS_VREDRAW          0x0001
#define CS_HREDRAW          0x0002
#define CS_DBLCLKS          0x0008
#define CS_OWNDC            0x0020
#define CS_CLASSDC          0x0040
#define CS_PARENTDC         0x0080
#define CS_NOCLOSE          0x0200
#define CS_SAVEBITS         0x0800
#define CS_BYTEALIGNCLIENT  0x1000
#define CS_BYTEALIGNWINDOW  0x2000
#define CS_GLOBALCLASS      0x4000

#define CS_IME              0x00010000

#define COP_STYLE           0x0001
#define COP_HCURSOR         0x0002
#define COP_BKCOLOR         0x0004
#define COP_WINPROC         0x0008
#define COP_ADDDATA         0x0010

typedef struct _WNDCLASS
{
    char*   spClassName;

    DWORD   opMask;
    
    DWORD   dwStyle;

    HCURSOR hCursor;
    int     iBkColor;
    int (*WinProc)(HWND, int, WPARAM, LPARAM);
       				// the address of window procedure
    DWORD dwAddData;
                    // the additional data.
}WNDCLASS;
typedef WNDCLASS* PWNDCLASS;

#define MAINWINCLASSNAME    ("MAINWINDOW")

BOOL GUIAPI RegisterWindowClass (PWNDCLASS pWndClass);
BOOL GUIAPI UnregisterWindowClass (const char* szClassName);
char* GUIAPI GetClassName (HWND hWnd);
BOOL GUIAPI GetWindowClassInfo (PWNDCLASS pWndClass);
BOOL GUIAPI SetWindowClassInfo (const WNDCLASS* pWndClass);

/*************************** Non-Main Window support *************************/
HWND GUIAPI CreateWindow(const char* spClassName, const char* spCaption,
                  DWORD dwStyle, int id, 
                  int x, int y, int w, int h,
                  HWND hParentWnd, DWORD dwAddData);
BOOL GUIAPI DestroyWindow(HWND hWnd);

/**************************** IME support ************************************/
int GUIAPI RegisterIMEWindow (HWND hWnd);
int GUIAPI UnregisterIMEWindow (HWND hWnd);
int GUIAPI GetIMEStatus (int StatusCode);
int GUIAPI SetIMEStatus (int StatusCode, int Value);

/**************************** Caret support **********************************/
BOOL GUIAPI CreateCaret (HWND hWnd, PBITMAP pBitmap, int nWidth, int nHeight);
BOOL GUIAPI ChangeCaretSize (HWND hWnd, int newWidth, int newHeight);
BOOL GUIAPI ActiveCaret (HWND hWnd);
UINT GUIAPI GetCaretBlinkTime (HWND hWnd);
BOOL GUIAPI SetCaretBlinkTime (HWND hWnd, UINT uTime);
BOOL GUIAPI DestroyCaret (HWND hWnd);
BOOL GUIAPI HideCaret (HWND hWnd);
BOOL GUIAPI ShowCaret (HWND hWnd);
BOOL GUIAPI SetCaretPos (HWND hWnd, int x, int y);
BOOL GUIAPI GetCaretPos (HWND hWnd, PPOINT pPt);

/**************************** Control support ********************************/
/* Standard control IDs */
#define IDC_STATIC    0
#define IDOK          1
#define IDCANCEL      2
#define IDABORT       3
#define IDRETRY       4
#define IDIGNORE      5
#define IDYES         6
#define IDNO          7

#define MINID_RESERVED      0xF001
#define MAXID_RESERVED      0xFFFF

#ifdef __cplusplus
}
#endif  /* __cplusplus */

#endif // GUI_WINDOW_H

⌨️ 快捷键说明

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