青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

天行健 君子當自強而不息

游戲腳本的實現(3)

 

本篇是游戲腳本的實現(2)的續篇。

 

MLS編輯器的使用

MLS系統僅使用到數字:代表行為的編號,隨后條目的數量,以及代表條目數據的編號。計算機特別擅長處理數字的工作,但我們的需要更多。需要將腳本構造成易于理解的文本行,并讓腳本編輯器將鍵入的文本轉變為腳本系統可以處理的一系列數字。

在編輯一個腳本期間,并不處理任何數字方面的問題,所以編輯器的工作還包括加載數字并將它們轉換回易于閱讀理解的文本行。因此,也可以這么說,僅需要使用一系列的文本命令構造一個腳本,然后使用腳本編輯器將這些命令轉換成代表它們數值,反之亦然。

MLS編輯器導入那些代表行為的文本行,并賦予用戶能力去編輯行為列表,以及在空白條目點填上行為,MLS編輯器的外觀如下圖所示:

下表詳細解釋了腳本編輯器每個按鈕的用途:

將行為添加到腳本中時(添加腳本或插入腳本),請注意行為的文本將被擴展,并添加到腳本列表框中(位于腳本編輯器頂端的列表框)。腳本行為從上到下進行存儲,根節點存儲了最頂端的腳本行為,腳本從頂端開始往下處理,與典型的C/C++代碼非常類似。

請注意,每次添加、插入、或編輯一個腳本條目時,修改行為條目的對話框將出現(如下圖所示),將使用這個對話框去修改腳本行為的條目。

 

MLS編輯器的創建

首先,我們設計MLS編輯器主窗口的界面:

接著我們設計修改腳本的對話框:

 

resource.h的定義:

//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by MlsEdit.rc
//
#define IDD_MAIN                        101
#define IDD_MODIFY                      102
#define IDC_SCRIPT                      1000
#define IDC_SCRIPTLIST                  1001
#define IDC_SCRIPT_ADDR                 1001
#define IDC_ADD                         1002
#define IDC_PREV                        1002
#define IDC_DELETE                      1003
#define IDC_NEXT                        1003
#define IDC_UP                          1004
#define IDC_OK2                         1004
#define IDC_DOWN                        1005
#define IDC_ACTIONS                     1006
#define IDC_ACTION                      1006
#define IDC_EDIT                        1007
#define IDC_SAVE                        1008
#define IDC_LOAD                        1009
#define IDC_INSERT                      1010
#define IDC_LOADACTIONS                 1013
#define IDC_NEW                         1014
#define IDC_TRUE                        1015
#define IDC_FALSE                       1016
#define IDC_VALUE                       1017
#define IDC_MIN                         1018
#define IDC_MAX                         1019
#define IDC_TEXT                        1020
#define IDC_CHOICE                      1023
#define IDC_OK                          1024
#define IDC_CANCEL                      1025
#define IDC_APPLY                       1027
#define IDC_ACTIONTEXT                  1028
#define IDC_FRAME                       1029
#define IDC_NUM                         1033
#define IDC_STATIC_MIN                  1034
#define IDC_STATIC_VALUE                1035
#define IDC_STATIC_MAX                  1036

// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        105
#define _APS_NEXT_COMMAND_VALUE         40001
#define _APS_NEXT_CONTROL_VALUE         1042
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif

 

MlsEdit.rc的定義:
 

// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_MAIN DIALOGEX 0, 0, 381, 262
STYLE DS_SETFONT | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU
CAPTION "MLS Editor"
CLASS "mls edit class"
FONT 11, "Segoe UI", 400, 0, 0x0
BEGIN
    LISTBOX         IDC_SCRIPT,10,17,296,93,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
    PUSHBUTTON      "Add to Script",IDC_ADD,312,150,55,15
    PUSHBUTTON      "Delete",IDC_DELETE,312,15,55,15
    PUSHBUTTON      "Move Up",IDC_UP,312,75,55,15
    PUSHBUTTON      "Move Down",IDC_DOWN,312,95,55,15
    PUSHBUTTON      "Edit",IDC_EDIT,312,35,55,15
    PUSHBUTTON      "Save Script",IDC_SAVE,247,115,55,15
    PUSHBUTTON      "Load Script",IDC_LOAD,127,115,55,15
    PUSHBUTTON      "Load Actions",IDC_LOADACTIONS,312,200,55,15
    PUSHBUTTON      "New Script",IDC_NEW,10,115,55,15
    LISTBOX         IDC_ACTION,10,150,296,97,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
    PUSHBUTTON      "Insert in Script",IDC_INSERT,312,175,55,15
    GROUPBOX        " Script ",IDC_STATIC,7,7,367,128
    GROUPBOX        " Actions ",IDC_STATIC,7,138,367,117
    LISTBOX         IDC_SCRIPT_ADDR,155,86,89,102,LBS_NOINTEGRALHEIGHT | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP
END

IDD_MODIFY DIALOGEX 0, 0, 241, 138
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION
CAPTION "Modify Action Entry"
FONT 11, "Segoe UI", 400, 0, 0x0
BEGIN
    LTEXT           "Static",IDC_ACTIONTEXT,7,5,227,35,WS_BORDER
    DEFPUSHBUTTON   "OK",IDC_OK,51,117,50,14
    LTEXT           "Entry #",IDC_STATIC,5,45,25,8
    GROUPBOX        " TITLE ",IDC_FRAME,7,60,227,56
    EDITTEXT        IDC_VALUE,97,96,60,12,ES_AUTOHSCROLL
    LTEXT           "Min.",IDC_STATIC_MIN,50,70,20,10
    LTEXT           "Max.",IDC_STATIC_MAX,50,80,20,10
    LTEXT           "Value",IDC_STATIC_VALUE,50,98,20,10
    LTEXT           "MIN#",IDC_MIN,97,70,60,8
    LTEXT           "MAX#",IDC_MAX,97,81,60,8
    EDITTEXT        IDC_TEXT,35,80,165,12,ES_AUTOHSCROLL
    COMBOBOX        IDC_CHOICE,35,80,165,60,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
    PUSHBUTTON      "Cancel",IDC_CANCEL,126,117,50,14
    RTEXT           "# of #",IDC_NUM,48,45,30,8
    PUSHBUTTON      "<--",IDC_PREV,86,45,20,10
    PUSHBUTTON      "-->",IDC_NEXT,111,45,20,10
    CONTROL         "TRUE",IDC_TRUE,"Button",BS_AUTORADIOBUTTON,69,84,34,10
    CONTROL         "FALSE",IDC_FALSE,"Button",BS_AUTORADIOBUTTON,128,84,36,10
    PUSHBUTTON      "OK",IDC_OK2,85,117,50,14
END


/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//

#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO 
BEGIN
    IDD_MAIN, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 374
        TOPMARGIN, 7
        BOTTOMMARGIN, 255
    END

    IDD_MODIFY, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 234
        TOPMARGIN, 7
        BOTTOMMARGIN, 131
    END
END
#endif    // APSTUDIO_INVOKED


#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE 
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE 
BEGIN
    "#include ""afxres.h""\r\n"
    "\0"
END

3 TEXTINCLUDE 
BEGIN
    "\r\n"
    "\0"
END

#endif    // APSTUDIO_INVOKED

#endif    // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//


/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED
 

 

我們首先定義一些全局變量和輔助函數:

#include <windows.h>
#include <stdio.h>
#include "resource.h"
#include "action.h"

#pragma warning(disable : 4312 4313 4996)

//////////////////////////////////// global variable ////////////////////////////////////

HWND g_hwnd;

ACTION_TEMPLATE g_action_template;

long        g_num_script;
BOOL        g_show_cancel;
SCRIPT_PTR  g_root_script;
SCRIPT_PTR  g_modify_script;    
// pointer to script to modify

// The OPENFILENAME structure contains information that the GetOpenFileName and GetSaveFileName 
// functions use to initialize an Open or Save As dialog box. After the user closes the dialog box, 
// the system returns information about the user's selection in this structure.
OPENFILENAME g_ofn;

char g_action_file[MAX_PATH];
char g_script_file[MAX_PATH];

HWND g_script_wnd;
HWND g_script_addr_wnd;
HWND g_action_wnd;

BOOL CALLBACK modify_dialog_proc(HWND hwnd, UINT msg_id, WPARAM word_param, LPARAM long_param);

//////////////////////////////////// function ////////////////////////////////////

//-----------------------------------------------------------------------------------
// Remove all items from list box.
//-----------------------------------------------------------------------------------
void reset_listbox(HWND listbox)
{
    
// An application sends an LB_RESETCONTENT message to remove all items from a list box. 
    //
    // To send this message, call the SendMessage function as follows. 
    //
    // lResult = SendMessage(       // returns LRESULT in lResult     
    //      (HWND) hWndControl,     // handle to destination control     
    //      (UINT) LB_RESETCONTENT, // message ID     
    //      (WPARAM) wParam,        // = (WPARAM) () wParam;    
    //      (LPARAM) lParam         // = (LPARAM) () lParam; );   
    //
    // wParam:
    //      Not used; must be zero. 
    //
    // lParam:
    //      Not used; must be zero. 
    //
    // This message does not return a value. 

    SendMessage(listbox, LB_RESETCONTENT, 0, 0);
}

//-----------------------------------------------------------------------------------
// Return index of current selected item in listbox.
//-----------------------------------------------------------------------------------
LRESULT get_listbox_selected(HWND listbox)
{
    
// Send an LB_GETCURSEL message to retrieve the index of the currently selected item, if any, 
    // in a single-selection list box. 
    //      
    //
    // To send this message, call the SendMessage function as follows. 
    // 
    // lResult = SendMessage(      // returns LRESULT in lResult     
    //    (HWND) hWndControl,      // handle to destination control     
    //    (UINT) LB_GETCURSEL,     // message ID     
    //    (WPARAM) wParam,         // = (WPARAM) () wParam;    
    //    (LPARAM) lParam          // = (LPARAM) () lParam; 
    // );         
    //
    // wParam:
    //    Not used; must be zero. 
    //
    // lParam:
    //    Not used; must be zero. 
    //
    // Return Value      
    //    In a single-selection list box, the return value is the zero-based index of the currently 
    //    selected item. If there is no selection, the return value is LB_ERR.

    
return SendMessage(listbox, LB_GETCURSEL, 0, 0);
}

//-----------------------------------------------------------------------------------
// Set current selected item in listbox.
//-----------------------------------------------------------------------------------
LRESULT set_listbox_selected(HWND listbox, int selection)
{
    
// An application sends an LB_SETCURSEL message to select a string and scroll it into view, if necessary. 
    // When the new string is selected, the list box removes the highlight from the previously selected string. 
    //        
    // To send this message, call the SendMessage function as follows.
    // 
    // lResult = SendMessage(       // returns LRESULT in lResult     
    //      (HWND) hWndControl,     // handle to destination control     
    //      (UINT) LB_SETCURSEL,    // message ID     
    //      (WPARAM) wParam,        // = (WPARAM) () wParam;    
    //      (LPARAM) lParam         // = (LPARAM) () lParam; 
    // );       
    //
    // wParam:
    //      Specifies the zero-based index of the string that is selected. 
    //      If this parameter is -1, the list box is set to have no selection. 
    //
    //      Microsoft Windows 95/Windows 98/Windows Millennium Edition (Windows Me) : 
    //      The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more 
    //      than 32,767 items. Although the number of items is restricted, the total size in bytes of the 
    //      items in a list box is limited only by available memory.
    //
    // lParam:
    //      This parameter is not used. 
    //
    // Return Value:
    //      If an error occurs, the return value is LB_ERR. If the wParam parameter is –1, the return value 
    //      is LB_ERR even though no error occurred. 
    //
    // Remarks:    
    //      Use this message only with single-selection list boxes. You cannot use it to set or remove a 
    //      selection in a multiple-selection list box. 

    
return SendMessage(listbox, LB_SETCURSEL, selection, NULL);
}

//-----------------------------------------------------------------------------------
// Get text of current selected item in listbox.
//-----------------------------------------------------------------------------------
LRESULT get_listbox_text(HWND listbox, int index, char* text)
{
    
// An application sends an LB_GETTEXT message to retrieve a string from a list box. 
    //
    // To send this message, call the SendMessage function as follows. 
    // 
    // lResult = SendMessage(      // returns LRESULT in lResult     
    //      (HWND) hWndControl,    // handle to destination control     
    //      (UINT) LB_GETTEXT,     // message ID     
    //      (WPARAM) wParam,       // = (WPARAM) () wParam;    
    //      (LPARAM) lParam        // = (LPARAM) () lParam; 
    // );       
    //
    // wParam:
    //      Specifies the zero-based index of the string to retrieve. 
    //
    //      Microsoft Windows 95/Windows 98/Windows Millennium Edition (Windows Me) : 
    //      The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than
    //      32,767 items. Although the number of items is restricted, the total size in bytes of the items 
    //      in a list box is limited only by available memory.
    //
    // lParam:
    //      Pointer to the buffer that will receive the string; it is type LPTSTR which is subsequently cast to 
    //      an LPARAM. The buffer must have sufficient space for the string and a terminating null character.
    //      An LB_GETTEXTLEN message can be sent before the LB_GETTEXT message to retrieve the length, in TCHARs, 
    //      of the string. 
    //
    // Return Value:    
    //      The return value is the length of the string, in TCHARs, excluding the terminating null character. 
    //      If wParam does not specify a valid index, the return value is LB_ERR. 
    //
    //Remarks
    //      If you create the list box with an owner-drawn style but without the LBS_HASSTRINGS style, 
    //      the buffer pointed to by the lParam parameter will receive the value associated with the item 
    //      (the item data).     

    
return SendMessage(listbox, LB_GETTEXT, index, (LPARAM)text);
}

//-----------------------------------------------------------------------------------
// Count listbox items number.
//-----------------------------------------------------------------------------------
LRESULT count_listbox(HWND listbox)
{
    
// An application sends an LB_GETCOUNT message to retrieve the number of items in a list box. 
    //    
    // To send this message, call the SendMessage function as follows. 
    // 
    // lResult = SendMessage(       // returns LRESULT in lResult     
    //      (HWND) hWndControl,     // handle to destination control     
    //      (UINT) LB_GETCOUNT,     // message ID     
    //      (WPARAM) wParam,        // = (WPARAM) () wParam;    
    //      (LPARAM) lParam         // = (LPARAM) () lParam; 
    // );       
    //
    // wParam:
    //      Not used; must be zero. 
    //
    // lParam:
    //      Not used; must be zero. 
    //
    // Return Value:
    //      The return value is the number of items in the list box, or LB_ERR if an error occurs. 
    //    
    // Remarks:    
    //      The returned count is one greater than the index value of the last item (the index is zero-based). 

    
return SendMessage(listbox, LB_GETCOUNT, 0, 0);
}

//-----------------------------------------------------------------------------------
// Add string to listbox.
//-----------------------------------------------------------------------------------
LRESULT add_string_to_listbox(HWND listbox, const charstring)
{
    
// An application sends an LB_ADDSTRING message to add a string to a list box. If the list box does not have 
    // the LBS_SORT style, the string is added to the end of the list. Otherwise, the string is inserted into 
    // the list and the list is sorted. 
    //
    // To send this message, call the SendMessage function as follows. 
    //
    // lResult = SendMessage(       // returns LRESULT in lResult     
    //      (HWND) hWndControl,     // handle to destination control     
    //      (UINT) LB_ADDSTRING,    // message ID     
    //      (WPARAM) wParam,        // = (WPARAM) () wParam;    
    //      (LPARAM) lParam         // = (LPARAM) () lParam; 
    //  );       
    //
    // wParam:
    //      This parameter is not used. 
    //
    // lParam:
    //      Pointer to the null-terminated string that is to be added. 
    //
    //      If you create the list box with an owner-drawn style but without the LBS_HASSTRINGS style, 
    //      this parameter is stored as item data instead of the string to which it would otherwise point. 
    //      You can send the LB_GETITEMDATA and LB_SETITEMDATA messages to retrieve or modify the item data.
    //
    // Return Value:    
    //      The return value is the zero-based index of the string in the list box. If an error occurs, 
    //      the return value is LB_ERR. If there is insufficient space to store the new string, the return value 
    //      is LB_ERRSPACE. 

    
return SendMessage(listbox, LB_ADDSTRING, 0, (LPARAM)string);
}

//-----------------------------------------------------------------------------------
// Insert string into listbox at specified position.
//-----------------------------------------------------------------------------------
LRESULT insert_string_to_listbox(HWND listbox, int index, const charstring)
{
    
// An application sends an LB_INSERTSTRING message to insert a string into a list box. 
    // Unlike the LB_ADDSTRING message, the LB_INSERTSTRING message does not cause a list with 
    // the LBS_SORT style to be sorted. 
    //        
    // To send this message, call the SendMessage function as follows. 
    // 
    // lResult = SendMessage(           // returns LRESULT in lResult     
    //      (HWND) hWndControl,         // handle to destination control     
    //      (UINT) LB_INSERTSTRING,     // message ID     
    //      (WPARAM) wParam,            // = (WPARAM) () wParam;    
    //      (LPARAM) lParam             // = (LPARAM) () lParam; 
    // );       
    //
    // wParam:
    //      Specifies the zero-based index of the position at which to insert the string. 
    //      If this parameter is –1, the string is added to the end of the list. 
    //
    //      Microsoft Windows 95/Windows 98/Windows Millennium Edition (Windows Me) : 
    //      The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more 
    //      than 32,767 items. Although the number of items is restricted, the total size in bytes of 
    //      the items in a list box is limited only by available memory.
    //
    // lParam:
    //      Pointer to the null-terminated string to be inserted. If you create the list box with an 
    //      owner-drawn style but without the LBS_HASSTRINGS style, the value of the lParam parameter is 
    //      stored as item data instead of the string it would otherwise point to. You can send the 
    //      LB_GETITEMDATA and LB_SETITEMDATA messages to retrieve or modify the item data. 
    //
    // Return Value:    
    //      The return value is the index of the position at which the string was inserted. 
    //      If an error occurs, the return value is LB_ERR. If there is insufficient space to store the new 
    //      string, the return value is LB_ERRSPACE. 
    //
    // Remarks:    
    //      The LB_INITSTORAGE message helps speed up the initialization of list boxes that have a large 
    //      number of items (more than 100). It reserves the specified amount of memory so that subsequent
    //      LB_INSERTSTRING messages take the shortest possible time. You can use estimates for the wParam 
    //      and lParam parameters. If you overestimate, the extra memory is allocated; if you underestimate, 
    //      the normal allocation is used for items that exceed the requested amount. 
    //
    //      If the list box has WS_HSCROLL style and you insert a string wider than the list box, send an 
    //      LB_SETHORIZONTALEXTENT message to ensure the horizontal scrollbar appears.
    //
    //      Microsoft Windows NT/Windows 2000/Windows XP : For an ANSI application, the system converts the text 
    //      in a list box to Unicode using CP_ACP. This can cause problems. For example, accented Roman characters 
    //      in a non-Unicode list box in Japanese Windows will come out garbled. To fix this, either compile 
    //      the application as Unicode or use an owner-drawn list box.
    
    
return SendMessage(listbox, LB_INSERTSTRING, index, (LPARAM)string);
}

//-----------------------------------------------------------------------------------
// Delete string in specified index from listbox.
//-----------------------------------------------------------------------------------
LRESULT delete_listbox_string(HWND listbox, int selection)
{
    
// An application sends an LB_DELETESTRING message to delete a string in a list box.     
    //
    // To send this message, call the SendMessage function as follows. 
    //
    // lResult = SendMessage(           // returns LRESULT in lResult     
    //      (HWND) hWndControl,         // handle to destination control     
    //      (UINT) LB_DELETESTRING,     // message ID     
    //      (WPARAM) wParam,            // = (WPARAM) () wParam;    
    //      (LPARAM) lParam             // = (LPARAM) () lParam; 
    // );       
    //
    // wParam:
    //      Specifies the zero-based index of the string to be deleted. 
    //
    //      Microsoft Windows 95/Windows 98/Windows Millennium Edition (Windows Me) : T
    //      he wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 
    //      32,767 items. Although the number of items is restricted, the total size in bytes of the items
    //      in a list box is limited only by available memory.
    //
    // lParam:
    //      This parameter is not used. 
    //
    // Return Value:    
    //      The return value is a count of the strings remaining in the list. The return value is LB_ERR if 
    //      the wParam parameter specifies an index greater than the number of items in the list. 
    //
    // Remarks:    
    //      If an application creates the list box with an owner-drawn style but without the LBS_HASSTRINGS style, 
    //      the system sends a WM_DELETEITEM message to the owner of the list box so the application can free 
    //      any additional data associated with the item. 

    
return SendMessage(listbox, LB_DELETESTRING, selection, 0);
}

//-----------------------------------------------------------------------------------
// Set button state.
//-----------------------------------------------------------------------------------
LRESULT set_button_state(HWND button, UINT state)
{
    
// An application sends a BM_SETCHECK message to set the check state of a radio button or check box.         
    //
    // To send this message, call the SendMessage function as follows. 
    //
    // lResult = SendMessage(      // returns LRESULT in lResult     
    //      (HWND) hWndControl,    // handle to destination control     
    //      (UINT) BM_SETCHECK,    // message ID     
    //      (WPARAM) wParam,       // = (WPARAM) () wParam;    
    //      (LPARAM) lParam        // = 0; not used, must be zero 
    // );       
    //
    // wParam:
    //      Specifies the check state. This parameter can be one of the following values. 
    //
    //      BST_CHECKED:
    //          Sets the button state to checked.
    //      BST_INDETERMINATE:
    //          Sets the button state to grayed, indicating an indeterminate state. 
    //          Use this value only if the button has the BS_3STATE or BS_AUTO3STATE style.
    //      BST_UNCHECKED:
    //          Sets the button state to cleared.
    //
    // lParam:
    //      This parameter is not used. 
    //
    // Return Value    
    //      This message always returns zero. 
    //
    //Remarks
    //      The BM_SETCHECK message has no effect on push buttons. 
   
    
return SendMessage(button, BM_SETCHECK,  state, 0);    
}

//-----------------------------------------------------------------------------------
// Return button state.
//-----------------------------------------------------------------------------------
LRESULT get_button_state(HWND button)
{
    
return SendMessage(button, BM_GETCHECK, 0, 0);
}

//-----------------------------------------------------------------------------------
// Reset combo box.
//-----------------------------------------------------------------------------------
LRESULT reset_combo_content(HWND combo)
{
    
// An application sends a CB_RESETCONTENT message to remove all items from the list box and edit 
    // control of a combo box. 
    //    
    // To send this message, call the SendMessage function as follows. 
    // 
    // lResult = SendMessage(           // returns CB_OKAY in lResult     
    //      (HWND) hWndControl,         // handle to destination control     
    //      (UINT) CB_RESETCONTENT,     // message ID     
    //      (WPARAM) wParam,            // = 0; not used, must be zero    
    //      (LPARAM) lParam             // = 0; not used, must be zero 
    // );       
    //
    // wParam:
    //      Not used; must be zero. 
    // lParam:
    //      Not used; must be zero. 
    //
    // Return Value:    
    //      This message always returns CB_OKAY. 
    //
    // Remarks:    
    //      If you create the combo box with an owner-drawn style but without the CBS_HASSTRINGS style, 
    //      the owner of the combo box receives a WM_DELETEITEM message for each item in the combo box. 

    
return SendMessage(combo, CB_RESETCONTENT, 0, 0);
}

//-----------------------------------------------------------------------------------
// Add string to combo box.
//-----------------------------------------------------------------------------------
LRESULT add_string_to_combo(HWND combo, charstring)
{
    
return SendMessage(combo, CB_ADDSTRING, 0, (LPARAM)string);
}

//-----------------------------------------------------------------------------------
// Set current selction in combo box.
//-----------------------------------------------------------------------------------
LRESULT set_combo_cur_sel(HWND combo, UINT cur_sel)
{
    
// An application sends a CB_SETCURSEL message to select a string in the list of a combo box. 
    // If necessary, the list scrolls the string into view. The text in the edit control of the 
    // combo box changes to reflect the new selection, and any previous selection in the list is removed. 
    //        
    // To send this message, call the SendMessage function as follows. 
    //
    // lResult = SendMessage(      // returns LRESULT in lResult     
    //      (HWND) hWndControl,    // handle to destination control     
    //      (UINT) CB_SETCURSEL,   // message ID     
    //      (WPARAM) wParam,       // = (WPARAM) () wParam;    
    //      (LPARAM) lParam        // = 0; not used, must be zero 
    // );       
    //
    // wParam:
    //      Specifies the zero-based index of the string to select. If this parameter is –1, 
    //      any current selection in the list is removed and the edit control is cleared. 
    // 
    // lParam:
    //      This parameter is not used. 
    //
    // Return Value:    
    //      If the message is successful, the return value is the index of the item selected. 
    //      If wParam is greater than the number of items in the list or if wParam is –1, 
    //      the return value is CB_ERR and the selection is cleared. 

    
return SendMessage(combo, CB_SETCURSEL, cur_sel, 0);
}

//-----------------------------------------------------------------------------------
// Get current selction in combo box.
//-----------------------------------------------------------------------------------
LRESULT get_combo_cur_sel(HWND combo)
{
    
// An application sends a CB_GETCURSEL message to retrieve the index of the currently selected item, 
    // if any, in the list box of a combo box. 
    //    
    // To send this message, call the SendMessage function as follows. 
    // 
    // lResult = SendMessage(      // returns LRESULT in lResult     
    //      (HWND) hWndControl,    // handle to destination control     
    //      (UINT) CB_GETCURSEL,   // message ID     
    //      (WPARAM) wParam,       // = 0; not used, must be zero    
    //      (LPARAM) lParam        // = 0; not used, must be zero 
    // );   
    //
    // wParam:
    //      Not used; must be zero. 
    // 
    // lParam:
    //      Not used; must be zero. 
    //
    // Return Value:
    //      The return value is the zero-based index of the currently selected item. 
    //      If no item is selected, it is CB_ERR. 

    
return SendMessage(combo, CB_GETCURSEL, 0, 0);    
}

posted on 2007-11-03 17:54 lovedday 閱讀(1075) 評論(0)  編輯 收藏 引用


只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


公告

導航

統計

常用鏈接

隨筆分類(178)

3D游戲編程相關鏈接

搜索

最新評論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            好吊成人免视频| 欧美护士18xxxxhd| 亚洲第一在线综合在线| 午夜视频一区| 欧美一区二区三区另类| 久久精品91久久久久久再现| 久久国产精品久久久久久久久久 | 欧美 日韩 国产 一区| 久久精品国产亚洲aⅴ| 亚洲免费在线看| 久久精品99国产精品| 欧美成人免费小视频| 亚洲国产一区在线观看| 老司机精品视频网站| 蜜桃av一区二区| 亚洲国产精品悠悠久久琪琪| 亚洲精品美女久久7777777| 制服诱惑一区二区| 欧美在线视频一区二区三区| 欧美第一黄色网| 国产精品亚洲综合天堂夜夜| 伊人蜜桃色噜噜激情综合| 亚洲精品免费一区二区三区| 亚洲欧美激情四射在线日| 男人的天堂亚洲在线| 一区二区三区 在线观看视频| 欧美一级大片在线免费观看| 欧美在线free| 亚洲二区免费| 亚洲综合日韩在线| 欧美国产日韩一二三区| 国产香蕉97碰碰久久人人| 亚洲精品在线一区二区| 久久九九国产精品怡红院| 亚洲久久视频| 开元免费观看欧美电视剧网站| 午夜久久久久久| 老色批av在线精品| 国产欧美69| 一区二区三区不卡视频在线观看| 精品成人一区二区三区| 99精品国产在热久久婷婷| 久久精品国语| 亚洲综合视频网| 欧美色网在线| 一本色道久久综合狠狠躁篇的优点 | 99re这里只有精品6| 久久国产夜色精品鲁鲁99| 国产精品激情| 亚洲午夜视频在线| 亚洲国产精品99久久久久久久久| 欧美国产日韩精品免费观看| 亚洲免费一在线| 国产精品欧美激情| 亚洲在线视频| 亚洲自拍高清| 国产精品自拍一区| 欧美一级大片在线观看| 亚洲最新视频在线| 欧美日韩一区二区三区四区在线观看| 欧美日韩国产综合久久| 亚洲国产高清在线| 欧美大片免费观看在线观看网站推荐 | 久久中文精品| 亚洲综合电影一区二区三区| 亚洲精品中文在线| 嫩草国产精品入口| 亚洲每日在线| 日韩小视频在线观看专区| 欧美剧在线观看| 亚洲深夜影院| 亚洲欧美激情诱惑| 在线成人中文字幕| 欧美高清在线一区二区| 欧美黄色小视频| 亚洲视频在线视频| 亚洲一区亚洲| 伊人久久男人天堂| 亚洲精品国精品久久99热| 欧美视频日韩视频| 久久精品国产亚洲高清剧情介绍| 欧美激情第一页xxx| 欧美sm重口味系列视频在线观看| 欧美日韩成人一区二区三区| 99精品久久久| 亚洲欧美视频在线观看| 国外成人免费视频| 亚洲国产精品一区二区尤物区| 亚洲欧美在线x视频| 国产亚洲精品激情久久| 欧美激情在线免费观看| 欧美另类女人| 久久精品一区四区| 欧美日韩大片| 久久在线观看视频| 欧美丝袜一区二区三区| 久久久久久久久久久久久久一区| 一区二区三区欧美| 一区二区三区在线不卡| 亚洲人午夜精品| 国产丝袜一区二区三区| 亚洲高清视频中文字幕| 国产农村妇女毛片精品久久莱园子 | 国产一区二区三区精品欧美日韩一区二区三区 | 美女视频一区免费观看| 中文在线一区| 老司机免费视频一区二区三区| 国产精品手机视频| 欧美成人一区二区三区| 国产精品九色蝌蚪自拍| 亚洲福利免费| 伊人激情综合| 亚洲一区免费视频| 99热免费精品| 巨乳诱惑日韩免费av| 在线中文字幕一区| 亚洲欧洲一区二区三区| 夜夜嗨av一区二区三区中文字幕 | 日韩一级大片| 久久精品国产精品亚洲精品| 亚洲一级在线| 欧美激情一区二区三区成人| 久久久精品免费视频| 国产精品久久久久久久一区探花| 一区二区不卡在线视频 午夜欧美不卡'| 久久久久国产精品午夜一区| 蜜臀va亚洲va欧美va天堂| 欧美在线视频二区| 国产精品美女www爽爽爽视频| 午夜一区不卡| 国产精品电影网站| 亚洲精品免费在线观看| 亚洲精品一级| 欧美激情一区二区三区成人| 亚洲第一区在线观看| 亚洲国语精品自产拍在线观看| 亚洲国产裸拍裸体视频在线观看乱了中文 | 欧美日韩1区2区| 亚洲人成小说网站色在线| 亚洲精品久久在线| 欧美高潮视频| 亚洲精品女av网站| 亚洲人成在线播放网站岛国| 欧美成人国产一区二区| 亚洲国产精品久久| 日韩一级片网址| 欧美亚洲第一区| 亚洲欧美日韩国产一区二区三区 | 午夜精彩国产免费不卡不顿大片| 国产欧美日韩视频一区二区| 亚洲欧美激情四射在线日| 久久精品国产91精品亚洲| 国产美女高潮久久白浆| 欧美中文字幕不卡| 免费不卡欧美自拍视频| 亚洲国产成人精品视频| 欧美日韩久久精品| 亚洲已满18点击进入久久| 久久国产手机看片| 亚洲丰满在线| 欧美肉体xxxx裸体137大胆| 亚洲伊人第一页| 男人的天堂成人在线| 中日韩在线视频| 国产亚洲一区二区三区在线观看| 亚洲日韩成人| 中国成人亚色综合网站| 国产拍揄自揄精品视频麻豆| 久久久午夜精品| 亚洲卡通欧美制服中文| 欧美一区二区三区在线播放| 亚洲国产成人av好男人在线观看| 夜夜嗨av一区二区三区网站四季av | 欧美v亚洲v综合ⅴ国产v| 亚洲人妖在线| 久久嫩草精品久久久精品| 一本一本久久| 国产综合亚洲精品一区二| 欧美人与禽猛交乱配视频| 久久成人这里只有精品| 亚洲美女精品成人在线视频| 久久婷婷国产麻豆91天堂| 99re热这里只有精品免费视频| 久久久亚洲高清| 亚洲国产欧美一区| 久久九九99视频| 亚洲尤物视频网| 亚洲福利在线观看| 国产亚洲成av人片在线观看桃| 亚洲欧美国产高清| 欧美国产高清| 久久九九国产| 欧美一区二区三区播放老司机| 国产精品第2页| 欧美成人免费在线视频| 久久久7777| 欧美在线中文字幕| 亚洲尤物影院| 亚洲天天影视| 亚洲另类自拍|