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

天行健 君子當自強而不息

游戲腳本的實現(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>
            亚洲女人小视频在线观看| 国产日韩在线看片| 一区二区日韩精品| 亚洲成人资源| 嫩草国产精品入口| 欧美福利影院| 99av国产精品欲麻豆| 在线视频免费在线观看一区二区| 一区二区免费在线播放| 亚洲欧美区自拍先锋| 免费亚洲视频| 亚洲国产精品一区二区第四页av| 亚洲免费高清视频| 亚洲一区日韩在线| 久久精品噜噜噜成人av农村| 欧美国产成人在线| 国产精品一二| 亚洲精品1区2区| 性欧美video另类hd性玩具| 老鸭窝毛片一区二区三区| 99在线视频精品| 久久精品国产亚洲a| 欧美日本精品一区二区三区| 国产一区二区精品久久91| 一区二区三区国产精品| 美女脱光内衣内裤视频久久影院 | 欧美搞黄网站| 亚洲天堂av电影| 中文欧美在线视频| 欧美一区二视频| 亚洲精品一区二区三区不| 欧美一区二区在线免费观看| 欧美日韩国产美女| 狠久久av成人天堂| 亚洲影音一区| 最新成人av网站| 久久久久国产精品人| 国产精品久久国产精麻豆99网站| 91久久久久久| 老司机午夜精品视频在线观看| 中文国产一区| 欧美精品在线观看91| 亚洲国产高清自拍| 性欧美长视频| 亚洲欧美国产77777| 国产精品久久久久久户外露出| 在线日韩精品视频| 久久久久久久国产| 欧美在线视频一区二区三区| 国产精品嫩草久久久久| 亚洲午夜电影| 一区二区欧美日韩视频| 欧美国产日韩精品| 亚洲人成网在线播放| 久久免费午夜影院| 久久国产日韩| 一区在线观看| 欧美国产成人精品| 免费看亚洲片| 亚洲精华国产欧美| 亚洲国产一区二区在线| 欧美成人蜜桃| 99在线热播精品免费| 亚洲精品日韩久久| 欧美日韩在线视频一区| 亚洲综合电影| 欧美在线资源| 在线观看一区二区精品视频| 欧美大片免费久久精品三p| 美女91精品| 99精品国产福利在线观看免费| 亚洲精品日韩精品| 国产精品美女www爽爽爽| 久久精品日产第一区二区| 欧美一区2区三区4区公司二百| 国内精品久久久久久久影视蜜臀| 久久久不卡网国产精品一区| 久久在线播放| 一区二区三区国产盗摄| 亚洲视频导航| 在线免费观看视频一区| 亚洲精品久久视频| 国产拍揄自揄精品视频麻豆| 久久影视三级福利片| 欧美日本一区| 久久久激情视频| 欧美激情在线观看| 欧美一区二区网站| 欧美国产欧美亚洲国产日韩mv天天看完整 | 国产精品一区二区三区观看| 久久精品国产亚洲精品| 美女国内精品自产拍在线播放| 一本到高清视频免费精品| 一区二区三区回区在观看免费视频| 国产欧美一区二区精品性色| 欧美国产精品人人做人人爱| 国产精品大片wwwwww| 老牛国产精品一区的观看方式| 免费看精品久久片| 欧美专区一区二区三区| 欧美激情一区二区| 久久国产精品久久精品国产 | 欧美**字幕| 欧美一区二区成人6969| 欧美黄色影院| 久久久久久久尹人综合网亚洲 | 久久女同互慰一区二区三区| 中文高清一区| 蜜桃av一区二区| 久久精品盗摄| 欧美午夜女人视频在线| 欧美成人在线免费观看| 国产日韩一区| 亚洲男人av电影| 中文国产成人精品| 欧美成人国产| 嫩草成人www欧美| 国产一区二区视频在线观看| 亚洲最新在线| 一本大道av伊人久久综合| 久久精品噜噜噜成人av农村| 欧美在线啊v| 国产精品免费观看在线| 亚洲视频www| 亚洲制服av| 欧美日韩喷水| 亚洲久久一区| 一片黄亚洲嫩模| 欧美区亚洲区| 亚洲精品视频二区| 99re热这里只有精品视频| 欧美a级片网| 亚洲国产综合在线看不卡| 亚洲国产视频一区二区| 久久久久久亚洲精品中文字幕| 久久av红桃一区二区小说| 国产日韩欧美另类| 久久成人免费| 久久综合激情| 亚洲国产精品免费| 欧美成人有码| 日韩午夜电影在线观看| 一区二区动漫| 国产精品久久久久久久久果冻传媒| 夜夜嗨av一区二区三区 | 亚洲福利视频三区| 亚洲精品在线免费| 欧美日韩的一区二区| 一本久久综合| 国产精品久久夜| 亚洲欧美在线一区二区| 久久久精品五月天| 狠狠色伊人亚洲综合网站色| 美女国产精品| 一区二区av在线| 欧美怡红院视频| 在线精品一区| 欧美婷婷久久| 久久精品最新地址| 亚洲欧洲精品一区二区| aa日韩免费精品视频一| 国产精品毛片大码女人| 久久精品最新地址| 亚洲欧洲精品一区二区三区| 亚洲综合导航| 亚洲黄色成人久久久| 欧美日韩亚洲不卡| 久久av一区二区三区漫画| 亚洲高清在线精品| 午夜精品一区二区三区在线播放 | 亚洲精品影视| 久久久久网址| 亚洲午夜精品久久久久久浪潮 | 久久资源av| 日韩一区二区免费高清| 国产日韩在线看片| 欧美日韩在线观看一区二区三区 | 久久一区二区三区国产精品| 99国产精品久久久久久久成人热| 国产精品免费在线| 欧美国产欧美亚洲国产日韩mv天天看完整 | 欧美制服丝袜| 999在线观看精品免费不卡网站| 国产精品久久久久久模特| 久久日韩粉嫩一区二区三区| 亚洲一区二区三区免费观看 | 久久久久久网址| 亚洲一区二区三区四区五区黄| 亚洲福利免费| 国产欧美日本一区视频| 欧美日本在线| 久久久噜噜噜久久久| 新狼窝色av性久久久久久| 日韩天天综合| 欧美激情1区2区| 美女诱惑一区| 美女免费视频一区| 久久人人爽人人爽| 香蕉久久精品日日躁夜夜躁| 一区二区三区欧美在线|