// -----------------------------------------------------------------------
// Properties form init
void CALLBACK FrmUserDiagPropsInitProc(HWND hWnd)
{
    HDC ProphDC = 0;
    SIZE PropSize;
    HGDIOBJ OldPropObject = 0;
    char *Property_Name;
    int i = 0;

    hPropListbox = CreateListBox(1, 20, ControlWidth(hWnd) - 1, ControlHeight(hWnd) - 20, hWnd, 0, &PropListboxHook, 0,
                                 LBS_USETABSTOPS | LBS_OWNERDRAWFIXED | WS_VSCROLL, WS_EX_STATICEDGE);
    hPropCombobox = CreateComboBox(0, 0, ControlWidth(hWnd), 150, hWnd, "", 1, 0, CBS_DROPDOWNLIST | WS_TABSTOP);
    ComboBoxAddItem(hPropCombobox, DialogName + (CStr) " - " + (CStr) "Dialog", -1);
    ComboBoxSetIndex(hPropCombobox, 0);
    FillPropertiesListbox(PROPDIAG_NBRPROPS);
    ProphDC = GetDC(hWnd);
    OldPropObject = SelectObject(ProphDC, WASerifFont);
    MaxPropXSize = 0;
    // Get largest property size
    for(i = 0; i < GetObjectDatas(hCurrentObject, OBJECT_PROPNBR); i++)
    {
        Property_Name = (char *) GetPropertyDatas(hCurrentObject, i, PROPERTY_NAME);
        GetTextExtentPoint32(ProphDC, Property_Name, strlen(Property_Name), &PropSize);
        if(PropSize.cx > MaxPropXSize) MaxPropXSize = PropSize.cx;
    }
    MaxPropXSize = MaxPropXSize + 10;
    SelectObject(ProphDC, OldPropObject);
    ReleaseDC(hWnd, ProphDC);
    ListBoxSetColumnsWidth(hPropListbox, MaxPropXSize);
    ListBoxSetIndex(hPropListbox, 0);
    ListBoxSetTopIndex(hPropListbox, 0);
    // Get the icons
    hPropComboPoints = LoadImage(ApphInstance, MAKEINTRESOURCE(ICON_RES_TOOL_BASE + ICON_RES_TOOL_COMBOPOINTS), IMAGE_ICON, 0, 0, 0);
}
Example #2
0
void CTrack_Files::Init()
{
/*	// Create the main pane
	mpPane = ge::IPane::Create();
	mpPane->SetSize(ge::SSize(gTrack_File_Browser.iCX - giScrollBarSize, gTrack_File_Browser.iCY-16 - giScrollBarSize));
	mpPane->SetAutomaticResize(true, ge::IControl::ResizeAbsoluteY );
	mpPane->SetBackgroundColour(ge::SRGB(200,200,200));
*/	
	// New
	// Lasse, size may be wrong! fix later
	ge::SSize SizeThis(gTrack_File_Browser.iCX - giScrollBarSize, gTrack_File_Browser.iCY - 16 - giScrollBarSize);
	mpScrollPane = ge::IScrollPane::Create();
	mpScrollPane->Init(ge::IControl::giNoID , giTimerID_TrackFiles_ScrollPane);
	mpPane = dynamic_cast<ge::IPane*>(mpScrollPane);
	mpPane->SetSize(SizeThis);
	mpPane->GetSize(SizeThis);

	// Lasse, that's probably not what we want? Fix later
	mpPane->SetAutomaticResize(true, ge::IControl::ResizeAbsoluteY );
	
	mpPane->SetBackgroundColour(ge::SRGB(239,239,239));
	
	// Dummy pict used to check scroll
//	CreateBitmap(ge::IControl::giNoID, IDB_Dummy, ge::SPos(10, 10));

	ge::IListBox* pListBox = CreateListBox(giCtrl_File_List,
											ge::SPos(4, 0), ge::SSize(SizeThis.iCX-4, SizeThis.iCY),
											CreateFont(Generic128, 
											IDB_Minix_Tight, 
											ge::SRGB(10, 10, 10)));
}
Example #3
0
    BOOL SComboBase::CreateChildren( pugi::xml_node xmlNode )
    {
        SASSERT(m_pSkinBtn);
		m_xmlDropdownStyle.append_copy(xmlNode.child(KStyle_Dropdown));
        //创建edit对象
        if(!m_bDropdown)
        {            
            m_pEdit=new SComboEdit(this);
            SApplication::getSingleton().SetSwndDefAttr(m_pEdit);

            InsertChild(m_pEdit);
            pugi::xml_node xmlEditStyle=xmlNode.child(KStyle_Edit);
            m_pEdit->GetEventSet()->setMutedState(true);
            if(xmlEditStyle)
                m_pEdit->InitFromXml(xmlEditStyle);
            else
                m_pEdit->SSendMessage(WM_CREATE);
            m_pEdit->GetEventSet()->setMutedState(false);
			
            m_pEdit->SetID(IDC_CB_EDIT);
            m_pEdit->SSendMessage(EM_SETEVENTMASK,0 ,ENM_CHANGE );

        }
        return CreateListBox(xmlNode);
    }
void CManualSmsListContainer::ConstructL(const TRect& aRect)
{
	CEikStatusPane* statusPane=iEikonEnv->AppUiFactory()->StatusPane();
	
	CAknContextPane* cp=(CAknContextPane *)statusPane->ControlL(TUid::Uid(EEikStatusPaneUidContext));

	TBuf<128> iconpath;
	iconpath = CRippleVaultAppUi::ApplicationDriveAndPath();
	iconpath.Append(KRippleImageMbmFileName);

	CFbsBitmap* bitmap = iEikonEnv->CreateBitmapL(iconpath, EMbmRippleimageRippleimage);
	CleanupStack::PushL(bitmap);
	CFbsBitmap* bitmapmask = iEikonEnv->CreateBitmapL(iconpath, EMbmRippleimageRippleimagem);
	CleanupStack::PushL(bitmapmask);
	cp->SetPicture(bitmap, bitmapmask);
	CleanupStack::Pop(); // bitmapmask
	CleanupStack::Pop(); // bitmap
	DrawNow();

	CAknTitlePane* tp=(CAknTitlePane*)statusPane->ControlL(TUid::Uid(EEikStatusPaneUidTitle)); 
	tp->SetTextL(*(iEikonEnv->AllocReadResourceL(R_EXAMPLE_RIPPLE_PUBLISH))); // Set the text string.

	//CEikStatusPane * statusPane = iAvkonAppUi->StatusPane();     
	iNaviPane = static_cast<CAknNavigationControlContainer*>(statusPane->ControlL(TUid::Uid(EEikStatusPaneUidNavi))); 

	iNaviDeco = iNaviPane->CreateTabGroupL(); 
	iNaviPane->PushL(static_cast<CAknNavigationDecorator &>(*iNaviDeco)); 
	iTabGroup = static_cast<CAknTabGroup*> (iNaviDeco->DecoratedControl()); 

	iTabGroup->AddTabL(  0, *(iEikonEnv->AllocReadResourceL(R_TAB_INBOX)) ); 

	iTabGroup->AddTabL(  1, *(iEikonEnv->AllocReadResourceL(R_TAB_SENTITEMS)) ); 

	if(iPhotosAppUi->iStoragePath == SMS_INBOX)
		iTabGroup->SetActiveTabById(0); 
	else 
		iTabGroup->SetActiveTabById(1); 
	
	CreateListBox();

	iReadSmsAO = NULL;	
	iReadSmsAO = new (ELeave) CReadSmsAO(*this);

	iFlag = 1;
	iTempCount = 0;

	GetInboxSms();

	GetSentItemSms();

	iReadSmsAO->StartL();

	SetFileList(2);

	ShowListBox();
}
CXFA_Node* CXFA_FFWidgetHandler::CreateWidgetFormItem(
    XFA_WIDGETTYPE eType,
    CXFA_Node* pParent,
    CXFA_Node* pBefore) const {
  switch (eType) {
    case XFA_WIDGETTYPE_Barcode:
      return NULL;
    case XFA_WIDGETTYPE_PushButton:
      return CreatePushButton(pParent, pBefore);
    case XFA_WIDGETTYPE_CheckButton:
      return CreateCheckButton(pParent, pBefore);
    case XFA_WIDGETTYPE_ExcludeGroup:
      return CreateExclGroup(pParent, pBefore);
    case XFA_WIDGETTYPE_RadioButton:
      return CreateRadioButton(pParent, pBefore);
    case XFA_WIDGETTYPE_Arc:
      return CreateArc(pParent, pBefore);
    case XFA_WIDGETTYPE_Rectangle:
      return CreateRectangle(pParent, pBefore);
    case XFA_WIDGETTYPE_Image:
      return CreateImage(pParent, pBefore);
    case XFA_WIDGETTYPE_Line:
      return CreateLine(pParent, pBefore);
    case XFA_WIDGETTYPE_Text:
      return CreateText(pParent, pBefore);
    case XFA_WIDGETTYPE_DatetimeEdit:
      return CreateDatetimeEdit(pParent, pBefore);
    case XFA_WIDGETTYPE_DecimalField:
      return CreateDecimalField(pParent, pBefore);
    case XFA_WIDGETTYPE_NumericField:
      return CreateNumericField(pParent, pBefore);
    case XFA_WIDGETTYPE_Signature:
      return CreateSignature(pParent, pBefore);
    case XFA_WIDGETTYPE_TextEdit:
      return CreateTextEdit(pParent, pBefore);
    case XFA_WIDGETTYPE_DropdownList:
      return CreateDropdownList(pParent, pBefore);
    case XFA_WIDGETTYPE_ListBox:
      return CreateListBox(pParent, pBefore);
    case XFA_WIDGETTYPE_ImageField:
      return CreateImageField(pParent, pBefore);
    case XFA_WIDGETTYPE_PasswordEdit:
      return CreatePasswordEdit(pParent, pBefore);
    case XFA_WIDGETTYPE_Subform:
      return CreateSubform(pParent, pBefore);
    default:
      break;
  }
  return NULL;
}
Example #6
0
// -----------------------------------------------------------------------------
// CAppDemoAppView::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CAppDemoAppView::ConstructL(const TRect& aRect)
	{
	// Create a window for this application view
	CreateWindowL();
	
	if(CheckPlugin())
		{
		TRAPD(err,iInterface = CInterfaceDefinition::NewL(KAliXPayOperationName));
		}	
	CreateListBox();
	// Set the windows size
	SetRect(aRect);
	// Activate the window, which makes it ready to be drawn
	ActivateL();
	}
Example #7
0
int CDuiDropDownListBase::OnCreate( LPCREATESTRUCT lpCreateStruct )
{
    int nRet=__super::OnCreate(lpCreateStruct);
    if(nRet!=0) return nRet;

	pugi::xml_document * pXmlDocTempl=(pugi::xml_document*)lpCreateStruct->lpCreateParams;
    DUIASSERT(pXmlDocTempl);
    CreateListBox(pXmlDocTempl);

    CRect rcClient;
    GetClientRect(&rcClient);
    Move(&rcClient);

    return 0;
}
void CKS_Import_File_Browser::Init()
{
	// Lasse, size may be wrong! fix later
	ge::SSize SizeThis(200 - giScrollBarSize, 600);
	mpScrollPane = ge::IScrollPane::Create();
	mpScrollPane->Init(ge::IControl::giNoID , giTimerID_TrackFiles_ScrollPane);
	mpPane = dynamic_cast<ge::IPane*>(mpScrollPane);
	mpPane->SetSize(SizeThis);
	mpPane->GetSize(SizeThis);
	mpPane->SetBackgroundColour(ge::SRGB(239,239,239));

	mpListBox = CreateListBox(giCtrl_File_List,
		ge::SPos(4, 0), ge::SSize(SizeThis.iCX-4, SizeThis.iCY),
		CreateFont(Generic128, 
		IDB_Minix_Tight, 
		ge::SRGB(10, 10, 10)));
	mpListBox->EnableExtraMouseEvent(ge::LeftButtonDblClk, -2);
}
Example #9
0
void CSmartFieldsDialog::InitList()
{
	if (m_pList == NULL)
	{
		m_pList = CreateListBox();
	}
	m_pList->SubclassDlgItem(IDC_MACRO_LIST, this);

/* Set the splitter offset. Line it up with the value text. */

	CWnd* pValueText = GetDlgItem(IDC_VALUE);
	ASSERT(pValueText != NULL);

	CRect crValueText;
	pValueText->GetWindowRect(crValueText);
	CRect crList;
	m_pList->GetWindowRect(crList);
	m_pList->SplitterOffset(crValueText.left - crList.left);
}
Example #10
0
GUIlistPopup::GUIlistPopup(string title, vector<string> items, GUI_BaseElement *parent, RECT rect, bool(*callback)(int, void*), void *usrdata, string styleid, string styleset)
	: GUIpopup(parent, rect, styleid, styleset)
{
	CreateLabel(title, _R(10, 10, width - 10, 35), POPUP);
	
	
	//calculate the height of the listbox
	int listheight = min(height - 80, GUI_ListBox::GetNeededListBoxHeight((int)items.size(), STYLE_LISTBOX));
	list = CreateListBox(_R(10, 40, width - 10, 40 + listheight), POPUP, LISTPOPUPLIST);

	//add elements to the list
	for (UINT i = 0; i < items.size(); ++i)
	{
		list->AddElement(items[i]);
	}
	list->SetSelected(0);

	//create ok and cancel buttons
	okbtn = CreateDynamicButton("Ok", _R(width - 140, height - 35, width - 80, height - 10), POPUP, LISTPOPUPOK);
	cancelbtn = CreateDynamicButton("Cancel", _R(width - 70, height - 35, width - 10, height - 10), POPUP, LISTPOPUPCANCEL);

	clbk = callback;
	this->usrdata = usrdata;
}
Example #11
0
ExampleUI::ExampleUI()
{
    app = CreateApp();
    CWindowPtr window = CreateWindow();
    app->AddWindow(window);
    CViewPtr view = CreateView("canvas");  
    CViewPtr grayView = CreateView(CAttributes()
                                   .Set("name",        "grayView")
                                   .Set("x1",          0)
                                   .Set("y1",          0)
                                   .Set("width",       "100%")
                                   .Set("height",      "100%")
                                   .Set("backgroundColour", COLOUR_GREY)); 
    view->AddChild(grayView);   
	// buttons
    CButtonPtr button1 = CreateButton(CAttributes()
                                      .Set("name",    "Button1")
                                      .Set("caption", "Query Shop")
                                      .Set("x1", "5%")
                                      .Set("y1", "5%")
                                      .Set("alignW",  "left")
									  .Set("visible", true)
                                      );   
    button1->SetEventHandler("click", (void*)this, &OnButton1Click);   
    CButtonPtr button2 = CreateButton(CAttributes()
                                      .Set("name",    "Button2")
                                      .Set("caption", "Restore Purchases")
                                      .Set("x1", "5%")
                                      .Set("y1", "15%")
                                      .Set("alignW",  "left")
									  .Set("visible", true)
                                      );  
    button2->SetEventHandler("click", (void*)this, &OnButton2Click);
    CButtonPtr button3 = CreateButton(CAttributes()
                                      .Set("name",    "Button3")
                                      .Set("caption", "Purchase fluidtest.100coins")
                                      .Set("x1", "50%")
                                      .Set("y1", "5%")
                                      .Set("alignW",  "left")
									  .Set("visible", true)
                                      );  
    button3->SetEventHandler("click", (void*)this, &OnButton3Click);
    CButtonPtr button4 = CreateButton(CAttributes()
                                      .Set("name",    "Button4")
                                      .Set("caption", "Consume fluidtest.100coins")
                                      .Set("x1", "50%")
                                      .Set("y1", "15%")
                                      .Set("alignW",  "left")
									  .Set("visible", true)
                                      );  
    button4->SetEventHandler("click", (void*)this, &OnButton4Click);

	// text fields
    statusText = CreateLabel(CAttributes()
                            .Set("caption","")
                            .Set("x1", "5%")
							.Set("x2", "95%")
                            .Set("y1", "60%")
                            .Set("height","10%")
							.Set("alignW","left")
                            );      
	animatingText = CreateLabel(CAttributes()
                            .Set("caption","... Some Animating Text ...")
                            .Set("x1", "5%")
							.Set("x2", "95%")
                            .Set("y1", "70%")
                            .Set("height","10%")
							.Set("alignW","left")
                            ); 
	consumableText = CreateLabel(CAttributes()
                            .Set("caption","")
                            .Set("x1", "5%")
							.Set("x2", "95%")
                            .Set("y1", "50%")
                            .Set("height","10%")
							.Set("alignW","left")
                            ); 

	// log list box
	logText = CreateListBox(CAttributes()
                            .Set("x1", "5%")
							.Set("x2", "95%")
                            .Set("y1", "80%")
							.Set("alignW","left")
                            );   
	logText->SetEventHandler("selectitem",(void*)this,&ListBoxSelect);

	listBoxItems.AddString(CString("View Log"));
	logText->SetAttribute("listBoxItems",listBoxItems);

	view->AddChild(button1); buttons.push_back(button1);
    view->AddChild(button2); buttons.push_back(button2);
    view->AddChild(button3); buttons.push_back(button3);
    view->AddChild(button4); buttons.push_back(button4);
 
	view->AddChild(statusText);
	view->AddChild(animatingText);
	view->AddChild(consumableText);
    view->AddChild(logText);
	//view->AddChild(userNameText);

	SetStatusText("");
    window->SetChild(view);   
    app->ShowWindow(window);  
}
Example #12
0
File: clb.c Project: mingpen/OpenNT
LRESULT
ClbWndProc(
    IN HWND hWnd,
    IN UINT message,
    IN WPARAM wParam,
    IN LPARAM lParam
    )

/*++

Routine Description:

    This function is the window procedure for the Clb custom control.

Arguments:

    Standard window procedure parameters.

Return Value:

    LRESULT - dependent on the supplied message.

--*/

{
    BOOL            Success;
    LPCLB_INFO      ClbInfo;




    if( message == WM_NCCREATE ) {

        LONG    Long;

        //
        // Save the original styles.
        //

        Long = SetWindowLong(
                        hWnd,
                        GWL_USERDATA,
                        (( LPCREATESTRUCT ) lParam )->style
                        );
        DbgAssert( Long == 0 );


        //
        // Get rid of any styles that are uninteresting to the Clb.
        //

        SetWindowLong(
                hWnd,
                GWL_STYLE,
                  (( LPCREATESTRUCT ) lParam )->style
                & CLBS_CLB
                );

        return TRUE;
    }


    if( message == WM_CREATE ) {

        //
        // Assert that there is no prior per window information associated
        // with this Clb.
        //

        DbgAssert( RestoreClbInfo( hWnd ) == NULL );

        //
        // Restore the original styles.
        //

        (( LPCREATESTRUCT ) lParam )->style = GetWindowLong(
                                                hWnd,
                                                GWL_USERDATA
                                                );


        //
        // Allocate a CLB_INFO object for this Clb and initialize the Clb
        // relevant fields.
        //

        ClbInfo = AllocateObject( CLB_INFO, 1 );
        DbgPointerAssert( ClbInfo );

        //
        // Set the number of columns to zero so that remainder of creation
        // understands the state of the Clb.
        //

        ClbInfo->Columns = 0;

        //
        // Create the header portion of the Clb.
        //

        Success = CreateHeader( hWnd, ClbInfo, ( LPCREATESTRUCT ) lParam );
        DbgAssert( Success );

        //
        // Create the list box portion of the Clb.
        //

        Success = CreateListBox( hWnd, ClbInfo, ( LPCREATESTRUCT ) lParam );
        DbgAssert( Success );

        //
        // Adjust the column number, widths based on the heading text.
        //

        Success = AdjustClbHeadings( hWnd, ClbInfo, (( LPCREATESTRUCT ) lParam )->lpszName );
        DbgAssert( Success );

        //
        // Everything was succesfully created so set the Clb's signature
        // and save it away as part of the per window data.
        //

        SetSignature( ClbInfo );

        SaveClbInfo( ClbInfo );

        return 0;
    }

    //
    // Get the ClbInfo object for this Clb and make sure that its already
    // been created i.e. WM_CREATE was already executed and thereby initialized
    // and saved a ClbInfo object.
    //

    ClbInfo = RestoreClbInfo( hWnd );

    if( ClbInfo != NULL ) {

        //
        // Validate that this really is a ClbInfo object.
        //

        DbgAssert( CheckSignature( ClbInfo ));

        switch( message ) {

        case WM_DESTROY:
            {
                //
                // Delete the font used in the list box.
                //

                Success = DeleteObject( ClbInfo->hFontListBox );
                DbgAssert( Success );

                //
                // Delete the array of right habd edges.
                //

                Success = FreeObject( ClbInfo->Right );
                DbgAssert( Success );

                //
                // Delete the CLB_INFO object for this window.
                //

                Success = FreeObject( ClbInfo );
                DbgAssert( Success );

                SaveClbInfo ( ClbInfo );
                return 0;
            }

        case WM_PAINT:
            {
                PAINTSTRUCT     ps;
                RECT            Rect;
                POINT           Points[ 2 ];
                HDC             hDC;
                HPEN            hPen;

                hDC = BeginPaint( hWnd, &ps );
                DbgAssert( hDC == ps.hdc );

                Success = GetClientRect( hWnd, &Rect );
                DbgAssert( Success );

                Points[ 0 ].x = 0;
                Points[ 0 ].y = ClbInfo->HeaderHeight + 1;
                Points[ 1 ].x = Rect.right - Rect.left;
                Points[ 1 ].y = ClbInfo->HeaderHeight + 1;

                hPen = GetStockObject( BLACK_PEN );
                DbgHandleAssert( hPen );

                hPen = SelectObject( hDC, hPen );

                Success = Polyline( hDC, Points, NumberOfEntries( Points ));
                DbgAssert( Success );

                hPen = SelectObject( hDC, hPen );

                Success = DeleteObject( hPen );
                DbgAssert( Success );

                Success = EndPaint( hWnd, &ps );
                DbgAssert( Success );

                return 0;
            }

        case WM_COMMAND:

            switch( LOWORD( wParam )) {

            case ID_LISTBOX:

                switch( HIWORD( wParam )) {

                case LBN_DBLCLK:
                case LBN_KILLFOCUS:
                case LBN_SELCHANGE:
                    {
                        //
                        // These messages come to ClbWndProc because it is the parent
                        // of the list box, but they are really intended for the parent
                        // of the Clb.
                        //

                        HWND    hWndParent;

                        //
                        // Forward the message to the Clb's parent if it has a parent.
                        //

                        hWndParent = GetParent( hWnd );
                        DbgHandleAssert( hWndParent );

                        if( hWndParent != NULL ) {

                            //
                            // Replace the control id and handle with the Clb's.
                            //

                            LOWORD( wParam ) = GetDlgCtrlID( hWnd );
                            DbgAssert( LOWORD( wParam ) != 0 );

                            lParam = ( LPARAM ) hWnd;

                            //
                            // Forward the message...
                            //

                            return SendMessage(
                                        hWndParent,
                                        message,
                                        wParam,
                                        lParam
                                        );
                        }
                    }
                }
                break;

            }
            break;

        //
        // Forward to listbox.
        //

        case LB_GETCURSEL:
        case LB_SETCURSEL:
        case LB_FINDSTRING:
        case LB_GETITEMDATA:
        case LB_RESETCONTENT:
        case WM_CHAR:
        case WM_GETDLGCODE:
        case WM_KILLFOCUS:

            return SendMessage(
                    ClbInfo->hWndListBox,
                    message,
                    wParam,
                    lParam
                    );

        case WM_SETFOCUS:
            {
                SetFocus(
                    ClbInfo->hWndListBox
                    );

                return 0;
            }

        case WM_COMPAREITEM:
            {
                //
                // This message comes to ClbWndProc because it is the parent
                // of the list box, but is really intended for the parent
                // of the Clb.
                //

                HWND    hWndParent;

                //
                // Forward the message to the Clb's parent if it has a parent.
                //

                hWndParent = GetParent( hWnd );
                DbgHandleAssert( hWndParent );

                if( hWndParent != NULL ) {

                    int                     ControlId;
                    LPCOMPAREITEMSTRUCT     lpcis;

                    lpcis = ( LPCOMPAREITEMSTRUCT ) lParam;

                    ControlId = GetDlgCtrlID( hWnd );
                    DbgAssert( ControlId != 0 );

                    //
                    // Modify the COMPAREITEMSTRUCT so that it refers to the Clb.
                    //

                    lpcis->CtlID    = ControlId;
                    lpcis->hwndItem = hWnd;

                    //
                    // Forward the message...
                    //

                    return SendMessage(
                                hWndParent,
                                message,
                                ( WPARAM ) ControlId,
                                lParam
                                );
                }

                break;
            }

        case WM_DELETEITEM:
            {
                LPDELETEITEMSTRUCT  lpditms;
                LPCLB_ROW           ClbRow;
                DWORD               i;


                DbgAssert( wParam == ID_LISTBOX );

                //
                // Retrieve the pointer to the DELETEITEMSTRUCT.
                //

                lpditms = ( LPDELETEITEMSTRUCT ) lParam;
                DbgAssert(( lpditms->CtlType == ODT_LISTBOX )
                        &&( lpditms->CtlID == ID_LISTBOX ));

                //
                // If there is no data, just return.
                //

                if( lpditms->itemData == 0 ) {

                    return TRUE;
                }

                //
                // Retrieve the CLB_ROW object for this row.
                //

                ClbRow = ( LPCLB_ROW ) lpditms->itemData;

                //
                // For each column delete the string.
                //

                for( i = 0; i < ClbInfo->Columns; i++ ) {

                    //
                    // Strings were copied with _tcsdup so they must be
                    // freed with free( ).
                    //

                    free( ClbRow->Strings[ i ].String );
                }

                //
                // Free the CLB_STRING object.
                //

                Success = FreeObject( ClbRow->Strings );
                DbgAssert( Success );

                //
                // Free the CLB_ROW object.
                //

                Success = FreeObject( ClbRow );
                DbgAssert( Success );

                return TRUE;
            }

        case WM_DRAWITEM:
            {
                LPDRAWITEMSTRUCT    lpdis;
                BOOL                DrawFocus;

                DbgAssert( wParam == ID_LISTBOX );

                //
                // Retrieve the pointer to the DRAWITEMSTRUCT.
                //

                lpdis = ( LPDRAWITEMSTRUCT ) lParam;
                DbgAssert(( lpdis->CtlType == ODT_LISTBOX )
                        &&( lpdis->CtlID == ID_LISTBOX ));

                //
                // If there is no data, just return.
                //

                if( lpdis->itemData == 0 ) {

                    return TRUE;
                }

                if( lpdis->itemAction & ( ODA_DRAWENTIRE | ODA_SELECT )) {

                    DWORD               i;
                    LPCLB_ROW           ClbRow;
                    COLORREF            TextColor;
                    COLORREF            BkColor;

                    //
                    // Retrieve the CLB_ROW object for this row.
                    //

                    ClbRow = ( LPCLB_ROW ) lpdis->itemData;

                    //
                    // If the item is selected, set the selection colors.
                    //

                    if( lpdis->itemState & ODS_SELECTED ) {

                        BkColor     = COLOR_HIGHLIGHT;
                        TextColor   = COLOR_HIGHLIGHTTEXT;

                    } else {

                        BkColor     = COLOR_WINDOW;
                        TextColor   = COLOR_WINDOWTEXT;
                    }

                    BkColor = GetSysColor( BkColor );
                    TextColor = GetSysColor( TextColor );

                    BkColor = SetBkColor( lpdis->hDC, BkColor );
                    DbgAssert( BkColor != CLR_INVALID );

                    TextColor = SetTextColor( lpdis->hDC, TextColor );
                    DbgAssert( TextColor != CLR_INVALID );


                    //
                    // For each column display the text.
                    //

                    for( i = 0; i < ClbInfo->Columns; i++ ) {

                        RECT    ClipOpaqueRect;
                        int     x;
                        int     Left;
                        UINT    GdiErr;

                        //
                        // Depending on the format, adjust the alignment reference
                        // point (x) and the clipping rectangles left edge so that
                        // there are five pixels between each column.
                        //

                        switch( ClbRow->Strings[ i ].Format ) {

                        case CLB_LEFT:

                            if( i == 0 ) {

                                x = 2;

                            } else {

                                x = ClbInfo->Right[ i - 1 ] + 2;
                            }

                            Left = x - 2;

                            break;

                        case CLB_RIGHT:

                            if( i == 0 ) {

                                Left = 0;

                            } else {

                                Left = ClbInfo->Right[ i - 1 ];
                            }

                            x = ClbInfo->Right[ i ] - 3;

                            break;

                        default:

                            DbgAssert( FALSE );
                        }


                        //
                        // Set the format for this column.
                        //

                        GdiErr = SetTextAlign(
                                        lpdis->hDC,
                                          ClbRow->Strings[ i ].Format
                                        | TA_TOP
                                        );
                        DbgAssert( GdiErr != GDI_ERROR );

                        //
                        // Clip each string to its column width less two pixels
                        // (for asthetics).
                        //

                        Success = SetRect(
                                    &ClipOpaqueRect,
                                    Left,
                                    lpdis->rcItem.top,
                                    ClbInfo->Right[ i ],
                                    lpdis->rcItem.bottom
                                    );
                        DbgAssert( Success );

                        Success = ExtTextOut(
                                    lpdis->hDC,
                                    x,
                                    lpdis->rcItem.top,
                                      ETO_CLIPPED
                                    | ETO_OPAQUE,
                                    &ClipOpaqueRect,
                                    ClbRow->Strings[ i ].String,
                                    ClbRow->Strings[ i ].Length,
                                    NULL
                                    );
                        DbgAssert( Success );

                        //
                        // If the item has the focus, draw the focus rectangle.
                        //

                        DrawFocus = lpdis->itemState & ODS_FOCUS;
                    }

                } else {

                    //
                    // If the Clb has the focus, display a focus rectangle
                    // around the selected item.
                    //

                    DrawFocus = lpdis->itemAction & ODA_FOCUS;
                }

                //
                // If needed, toggle the focus rectangle.
                //

                if( DrawFocus ) {

                    Success = DrawFocusRect(
                                lpdis->hDC,
                                &lpdis->rcItem
                                );
                    DbgAssert( Success );
                }

                return TRUE;
            }

        case WM_NOTIFY:
            {
            HD_NOTIFY * lpNot;
            HD_ITEM   *pHDI;

            lpNot = (HD_NOTIFY *)lParam;
            pHDI = lpNot->pitem;

            switch( lpNot->hdr.code) {

            static
            DRAW_ERASE_LINE DrawEraseLine;

            static
            HPEN            hPen;

            static
            HDC             hDCClientListBox;
            HD_ITEM         hdi;
            UINT            iRight;
            UINT            i;
            RECT            ClientRectHeader;


            case HDN_BEGINTRACK:
                {

                    RECT    ClientRectListBox;

                    //
                    // Get thd HDC for the list box.
                    //

                    hDCClientListBox = GetDC( ClbInfo->hWndListBox );
                    DbgHandleAssert( hDCClientListBox );

                    //
                    // Create the pen used to display the drag position and
                    // select it into the in list box client area DC. Also set
                    // the ROP2 code so that drawing with the pen twice in the
                    // same place will erase it. This is what allows the
                    // line to drag.
                    //

                    hPen = CreatePen( PS_DOT, 1, RGB( 255, 255, 255 ));
                    DbgHandleAssert( hPen );

                    hPen = SelectObject( hDCClientListBox, hPen );
                    SetROP2( hDCClientListBox, R2_XORPEN );

                    //
                    // Set up the DRAW_ERASE_LINE structure so that the drag line is
                    // drawn from the top to the bottom of the list box at the
                    // current drag position.
                    //

                    Success = GetClientRect(
                                    ClbInfo->hWndListBox,
                                    &ClientRectListBox
                                    );
                    DbgAssert( Success );

                    //
                    // Draw the initial drag line from the top to the bottom
                    // of the list box equivalent with the header edge grabbed
                    // by the user.
                    //

                    DrawEraseLine.Draw.Src.x = ClbInfo->Right[ pHDI->cxy ];
                    DrawEraseLine.Draw.Src.y = 0;
                    DrawEraseLine.Draw.Dst.x = ClbInfo->Right[ pHDI->cxy ];
                    DrawEraseLine.Draw.Dst.y =   ClientRectListBox.bottom
                                               - ClientRectListBox.top;

                    Success = DrawLine( hDCClientListBox, &DrawEraseLine );
                    DbgAssert( Success );

                    return 0;
                }

            case HDN_TRACK:
                {

                    //DWORD           Columns;

                    //
                    // Get new drag position.
                    //

                    iRight = 0;
                    hdi.mask = HDI_WIDTH;

                    for( i = 0; i < ClbInfo->Columns - 1; i++ ) {
                        if (i != (UINT)lpNot->iItem) {
                          Header_GetItem(ClbInfo->hWndHeader, i, &hdi);
                        } else {
                          hdi.cxy = pHDI->cxy;
                        }
                        iRight += hdi.cxy;
                        ClbInfo->Right[i] = iRight;
                    }

                    GetClientRect( ClbInfo->hWndHeader, &ClientRectHeader );
                    ClbInfo->Right[i] = ClientRectHeader.right;

                    //
                    // Erase the old line and draw the new one at the new
                    // drag position.
                    //

                    Success = RedrawVerticalLine(
                                hDCClientListBox,
                                ClbInfo->Right[lpNot->iItem],
                                &DrawEraseLine
                                );
                    DbgAssert( Success );

                    return 0;
                }

            case HDN_ENDTRACK:

                //
                // Replace the old pen and delete the one created
                // during HBN_BEGINDRAG.
                //

                hPen = SelectObject( hDCClientListBox, hPen );
                Success = DeleteObject( hPen );
                DbgAssert( Success );

                //
                // Release the DC for the list box.
                //

                Success = ReleaseDC( ClbInfo->hWndListBox, hDCClientListBox );
                DbgAssert( Success );

                Success = RedrawWindow(
                                hWnd,
                                NULL,
                                NULL,
                                  RDW_ERASE
                                | RDW_INVALIDATE
                                | RDW_UPDATENOW
                                | RDW_ALLCHILDREN
                                );
                DbgAssert( Success );

                return 0;
            }

            break;
            }

        case WM_SETTEXT:

            //
            // Adjust the column number and widths based on the heading text.
            //

            Success = AdjustClbHeadings( hWnd, ClbInfo, ( LPCWSTR ) lParam );
            DbgAssert( Success );

            return Success;

        case WM_SIZE:
            {
                HDWP    hDWP;
                LONG    Width;
                LONG    Height;
                LONG    Style;
                LONG    VScrollWidth;

                Width   = LOWORD( lParam );
                Height  = HIWORD( lParam );

                hDWP = BeginDeferWindowPos( 2 );
                DbgHandleAssert( hDWP );

                //
                // Retrieve the list box's styles.
                //

                Style = GetWindowLong(
                            ClbInfo->hWndListBox,
                            GWL_STYLE
                            );

                //
                // If the list box has a vertical scroll bar compute its
                // width so that the header window's width can be adjusted
                // appropriately.
                //

                VScrollWidth =   ( Style & WS_VSCROLL )
                               ?   GetSystemMetrics( SM_CXVSCROLL )
                                 + ( GetSystemMetrics( SM_CXBORDER ) * 2 )
                               : 0;

                //
                // Size the header window to the width of the Clb and its
                // default / original height.
                //

                hDWP = DeferWindowPos(
                            hDWP,
                            ClbInfo->hWndHeader,
                            NULL,
                            0,
                            0,
                            Width - VScrollWidth,
                            ClbInfo->HeaderHeight,
                              SWP_NOACTIVATE
                            | SWP_NOMOVE
                            | SWP_NOZORDER
                            );
                DbgHandleAssert( hDWP );

                //
                // If the list box has a vertical scroll bar, bump the width
                // and height by two so that its border overwrites the Clb
                // border. This eliminates a double border (and a gap) between
                // the right and bottom edges of the scroll bar and the Clb.
                //

                if( Style & WS_VSCROLL ) {

                    Height += 2;
                    Width += 2;
                }

                //
                // Size the list box so that it is the size of the Clb less
                // the height of the header window less the height of the
                // border.
                //

                hDWP = DeferWindowPos(
                            hDWP,
                            ClbInfo->hWndListBox,
                            NULL,
                            0,
                            0,
                            Width,
                              Height
                            - ClbInfo->HeaderHeight
                            - 3,
                              SWP_NOACTIVATE
                            | SWP_NOMOVE
                            | SWP_NOZORDER
                            );
                DbgHandleAssert( hDWP );

                Success = EndDeferWindowPos( hDWP );
                DbgAssert( Success );

                break;
            }

        }
    }

    return DefWindowProc( hWnd, message, wParam, lParam );
}
void
FormWindow::CreateDefList(CtrlDef& def)
{
	ListBox* ctrl = CreateListBox(def.GetText(),
	def.GetX(),
	def.GetY(),
	def.GetW(),
	def.GetH(),
	def.GetID(),
	def.GetParentID());

	ctrl->SetAltText(def.GetAltText());
	ctrl->SetEnabled(def.IsEnabled());
	ctrl->SetBackColor(def.GetBackColor());
	ctrl->SetForeColor(def.GetForeColor());
	ctrl->SetStyle(def.GetStyle());
	ctrl->SetTextAlign(def.GetTextAlign());
	ctrl->SetTransparent(def.GetTransparent());
	ctrl->SetHidePartial(def.GetHidePartial());

	ctrl->SetLineHeight(def.GetLineHeight());
	ctrl->SetShowHeadings(def.GetShowHeadings());
	ctrl->SetLeading(def.GetLeading());
	ctrl->SetMultiSelect(def.GetMultiSelect());
	ctrl->SetDragDrop(def.GetDragDrop());
	ctrl->SetScrollBarVisible(def.GetScrollBarVisible());
	ctrl->SetSmoothScroll(def.GetSmoothScroll());
	ctrl->SetItemStyle(def.GetItemStyle());
	ctrl->SetSelectedStyle(def.GetSelectedStyle());

	ctrl->SetMargins(def.GetMargins());
	ctrl->SetTextInsets(def.GetTextInsets());
	ctrl->SetCellInsets(def.GetCellInsets());
	ctrl->SetCells(def.GetCells());
	ctrl->SetFixedWidth(def.GetFixedWidth());
	ctrl->SetFixedHeight(def.GetFixedHeight());

	if (def.GetTexture().length() > 0) {
		Bitmap*     ctrl_tex = 0;
		DataLoader* loader   = DataLoader::GetLoader();
		loader->SetDataPath("Screens/");
		loader->LoadTexture(def.GetTexture(), ctrl_tex);
		loader->SetDataPath("");

		ctrl->SetTexture(ctrl_tex);
	}

	int ncols = def.NumColumns();
	for (int i = 0; i < ncols; i++) {
		ColumnDef* col = def.GetColumn(i);
		ctrl->AddColumn(col->title, col->width, col->align, col->sort);

		if (col->use_color)
		ctrl->SetColumnColor(i, col->color);
	}

	int nitems = def.NumItems();
	for (int i = 0; i < nitems; i++)
	ctrl->AddItem(def.GetItem(i));

	Font* f = FontMgr::Find(def.GetFont());
	if (f) ctrl->SetFont(f);
}
Example #14
0
/*
 * WindowProc - main window message handler
 */
LONG CALLBACK MainWindowProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
    WORD                        cmd;
    about_info                  ai;
    HMENU                       mh;
    CommunicationBuffer         *dbginfo;

    switch ( msg ) {
    case WM_CREATE:
        setupSystemMenu( hwnd );
        MainLBox = CreateListBox( hwnd );
        mh = GetMenu( hwnd );
        if( ConfigData.auto_attatch ) {
            CheckMenuItem( mh, MENU_AUTO_ATTATCH, MF_BYCOMMAND | MF_CHECKED );
        }
        if( ConfigData.continue_exception ) {
            CheckMenuItem( mh, MENU_EXCEPTION_CONTINUE,
                                MF_BYCOMMAND | MF_CHECKED );
        }
        LBPrintf( MainLBox, STR_DRNT_STARTED, AppName );
        break;
    case WM_SIZE:
        MoveListBox( MainLBox, 0, 0, LOWORD( lparam ), HIWORD( lparam ) );
        ClearAlert();
        break;
    case WM_SYSCOMMAND:
        switch( wparam ) {
        case MENU_LOG_CURRENT_STATE:
        case MENU_LOG_OPTIONS:
        case MENU_TASK_CTL:
            SendMessage( hwnd, WM_COMMAND, wparam, 0 );
            break;
        default:
            return( DefWindowProc( hwnd, msg, wparam, lparam ) );
        }
        break;
    case WM_COMMAND:
        cmd = LOWORD( wparam );
        switch( cmd ) {
        case LISTBOX_1:
            break;
        case MENU_EXCEPTION_CONTINUE:
            ConfigData.continue_exception = !ConfigData.continue_exception;
            mh = GetMenu( hwnd );
            if( ConfigData.continue_exception ) {
                CheckMenuItem( mh, MENU_EXCEPTION_CONTINUE,
                                   MF_BYCOMMAND | MF_CHECKED );
            } else {
                CheckMenuItem( mh, MENU_EXCEPTION_CONTINUE,
                                   MF_BYCOMMAND | MF_UNCHECKED );
            }
            break;
        case MENU_LOG_VIEW:
            ViewLog();
            break;
        case MENU_NEW_TASK:
            CallProcCtl( MENU_NEW_TASK, NULL, NULL );
            break;
        case MENU_AUTO_ATTATCH:
            ConfigData.auto_attatch = ! ConfigData.auto_attatch;
            mh = GetMenu( hwnd );
            if( ConfigData.auto_attatch ) {
                CheckMenuItem( mh, MENU_AUTO_ATTATCH,
                               MF_BYCOMMAND | MF_CHECKED );
            } else {
                CheckMenuItem( mh, MENU_AUTO_ATTATCH,
                               MF_BYCOMMAND | MF_UNCHECKED );
            }
            break;
        case MENU_SHOW_DIP_STATUS:
            ShowDIPStatus( hwnd );
            break;
        case MENU_CLEAR:
            ClearListBox( MainLBox );
            break;
        case MENU_SAVE_AS:
            SaveListBox( SLB_SAVE_AS, SaveExtra, "", AppName, hwnd,
                         GetListBoxHwnd( MainLBox ) );
            break;
        case MENU_SAVE:
            SaveListBox( SLB_SAVE_TMP, SaveExtra, ".\\drwat.txt", AppName,
                         hwnd, GetListBoxHwnd( MainLBox ) );
            break;
        case MENU_FONT:
            if( ChooseMonoFont( hwnd ) ) {
                SetListBoxFont( MainLBox );
            }
            break;
        case MENU_MARK:
            ProcessMark( hwnd, Instance, MarkPrint );
            break;
        case MENU_ABOUT:
            ai.owner = hwnd;
            ai.inst = Instance;
            ai.name = AllocRCString( STR_ABOUT_NAME );
            ai.version = AllocRCString( STR_ABOUT_VERSION );
            ai.first_cr_year = "1993";
            ai.title = AllocRCString( STR_ABOUT_TITLE );
            DoAbout( &ai );
            FreeRCString( ai.name );
            FreeRCString( ai.version );
            FreeRCString( ai.title );
            break;
        case MENU_HELP_CONTENTS:
            if( !WHtmlHelp( hwnd, DR_CHM_FILE, HELP_CONTENTS, 0 ) ) {
                WWinHelp( hwnd, DR_HELP_FILE, HELP_CONTENTS, 0 );
            }
            break;
        case MENU_HELP_SRCH:
            if( !WHtmlHelp( hwnd, DR_CHM_FILE, HELP_PARTIALKEY, (HELP_DATA)"" ) ) {
                WWinHelp( hwnd, DR_HELP_FILE, HELP_PARTIALKEY, (HELP_DATA)"" );
            }
            break;
        case MENU_HELP_ON_HELP:
            WWinHelp( hwnd, HELP_HELP_FILE, HELP_HELPONHELP, 0 );
            break;
        case MENU_TASK_CTL:
            DisplayProcList();
            break;
        case MENU_LOG_CURRENT_STATE:
            MakeLog( NULL );
            break;
        case MENU_ERASE_LOG_FILE:
            EraseLog();
            break;
        case MENU_LOG_OPTIONS:
            SetLogOptions( hwnd );
            break;
        case MENU_EXIT:
            SendMessage( hwnd, WM_CLOSE, 0, 0L );
            break;
        default:
            MessageBox( hwnd, "This function is not yet available",
                        AppName, MB_OK );
            break;
        }
        break;
    case DR_DEBUG_EVENT:
        dbginfo = (CommunicationBuffer *)lparam;
        dbginfo->action = DebugEventHandler( &dbginfo->dbginfo );
        break;
    case WM_COPYDATA:
        {
            COPYDATASTRUCT      *copydata;

            copydata = (COPYDATASTRUCT *)lparam;
            ProcessCommandLine( copydata->lpData );
        }
        break;
    case WM_CLOSE:
        if( QueryEnd( hwnd ) ) {
            SendMessage( hwnd, WM_DESTROY, 0, 0L );
        }
        break;
    case WM_DESTROY:
        FiniListBox( MainLBox );
        PutProfileInfo();
        DestroyMonoFonts();
        WWinHelp( hwnd, DR_HELP_FILE, HELP_QUIT, 0 );
        PostQuitMessage( 0 );
        break;
    default:
        return( DefWindowProc( hwnd, msg, wparam, lparam ) );
    }
    return( 0L );

} /* WindowProc */
Example #15
0
//
//  関数: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  目的:  メイン ウィンドウのメッセージを処理します。
//
//  WM_COMMAND	- アプリケーション メニューの処理
//  WM_PAINT	- メイン ウィンドウの描画
//  WM_DESTROY	- 中止メッセージを表示して戻る
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	HDC hdc;
	static HWND boardWnd, hBut[2];       // レバーコントロールのハンドル
    INITCOMMONCONTROLSEX ic;  // INITCOMMONCONTROLSEX構造体
    REBARBANDINFO rbBand;     // REBARBANDINFO構造体
	switch (message)
	{
	case WM_CREATE:
		/* ボード表示ウィンドウの作成 */
		//boardWnd = MakeBoardWindow(hWnd);
		/* レバーコントロールの作成 */
		ic.dwSize = sizeof(INITCOMMONCONTROLSEX); 
		ic.dwICC = ICC_COOL_CLASSES; 
		InitCommonControlsEx(&ic); 
		hRebar = MakeMyRebar(hWnd);
		hListBox = CreateListBox(hWnd);

		ZeroMemory(&rbBand, sizeof(REBARBANDINFO)); 
		rbBand.cbSize = sizeof(REBARBANDINFO); 
		rbBand.fMask = RBBIM_TEXT | RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE; 
		rbBand.fStyle = RBBS_CHILDEDGE | RBBS_NOGRIPPER; 
		rbBand.cxMinChild = 90;
		rbBand.cyMinChild = 25; 

		rbBand.hwndChild = CreateWindow("BUTTON", "新規対局", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 
										 0, 0, 0, 0, hRebar, (HMENU)NEWGAME_BT, hInst ,NULL);
		SendMessage(hRebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);
		
		rbBand.hwndChild = CreateWindow("BUTTON", "継続対局", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 
										 0, 0, 0, 0, hRebar, (HMENU)CONTINUE_BT, hInst ,NULL);
		SendMessage(hRebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);

		rbBand.hwndChild = CreateWindow("BUTTON", "中断", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 
										 0, 0, 0, 0, hRebar, (HMENU)INTERRUPT_BT, hInst ,NULL);
		rbBand.cxMinChild = 60;
		SendMessage(hRebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);

		rbBand.hwndChild = CreateWindow("BUTTON", "手番変更", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 
										 0, 0, 0, 0, hRebar, (HMENU)CHANGE_BT, hInst ,NULL);
		rbBand.cxMinChild = 90; 
		SendMessage(hRebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);

		rbBand.cxMinChild = 30;
		rbBand.hwndChild = CreateWindow("BUTTON", "<<", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 
										 0, 0, 0, 0, hRebar, (HMENU)FIRST_BT, hInst ,NULL); 
		SendMessage(hRebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);
		rbBand.hwndChild = CreateWindow("BUTTON", "←", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 
										 0, 0, 0, 0, hRebar, (HMENU)UNDO_BT, hInst ,NULL);
		SendMessage(hRebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand); 

		rbBand.hwndChild = CreateWindow("BUTTON", "→", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 
										 0, 0, 0, 0, hRebar, (HMENU)REDO_BT, hInst ,NULL); 
		SendMessage(hRebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);

		rbBand.hwndChild = CreateWindow("BUTTON", ">>", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 
										 0, 0, 0, 0, hRebar, (HMENU)FINAL_BT, hInst ,NULL);
		SendMessage(hRebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);

		//hToolBar = CreateToolbarEx( 
		//	hWnd,					//親ウィンドウ
		//	WS_CHILD | WS_VISIBLE,	//ウィンドウスタイル 
		//	ID_TOOLBAR,				//コントロールID 
		//	8,						//イメージの数 
		//	hInst, 
		//	ID_MYBMP, 
		//	tbb, 
		//	8,						// ボタンの数 
		//	0,						//ボタンの幅 
		//	0,						//ボタンの高さ 
		//	18,						//イメージの幅 
		//	18,						//イメージの高さ 
		//	sizeof(TBBUTTON));
		//SendMessage(hToolBar, TB_INSERTBUTTON, 2, (LPARAM)&tb); 

		hComBox1 = CreateComBox1(hWnd, BOARD_SIZE + 10, 90, 0);
		SendMessage(hComBox1, CB_SETCURSEL, 0, 0);
		hComBox2 = CreateComBox1(hWnd, BOARD_SIZE + 10, 120, 1);
		SendMessage(hComBox2, CB_SETCURSEL, 1, 0);
		hComBox3 = CreateComBox2(hWnd, BOARD_SIZE + 100, 90, 2);
		ShowWindow(hComBox3, SW_HIDE);
		hComBox4 = CreateComBox2(hWnd, BOARD_SIZE + 100, 120, 3);
		player[0] = HUMAN;
		player[1] = CPU;
		/* 初期難易度 */
		Onnormal(hWnd, BLACK);
		Onnormal(hWnd, WHITE);

		ShowWindow(hListBox, SW_SHOW);	//リストボックスを表示
		UpdateWindow(hWnd);
		UpdateWindow(hRebar);

		//srand((unsigned int)time(NULL));
		/* ステータスバー作成 */
		hStatus = CreateStatusBar(hWnd);

		/* 定石データオープン */
		open_book_thread(hInst);

		break;
	case WM_LBUTTONDOWN:
		/* 左クリックイベント 打てるマスをクリックすればスレッドが起動 */
		if(!AI_THINKING && chk_range_board(lParam))
		{
			Flag_Abort = TRUE;
			WaitForSingleObject(SIG_HINT_FINISHED, INFINITE);
			Flag_Abort = FALSE;
			GameThread(lParam, LBUTTON);
		}
		SendMessage(hStatus, SB_SETTEXT, (WPARAM)1 | 0, (LPARAM)turn_str[NowTurn]);
		return 0;
	case WM_RBUTTONDOWN:
		RButtonClick(hWnd, hStatus, lParam);
		return 0;
	case WM_SET_TEXT_BAR:
		SendMessage(hStatus, SB_SETTEXT, (WPARAM)0 | 3, (LPARAM)lParam);
		return 0;
	case WM_COMMAND:
		wmId    = LOWORD(wParam);
		wmEvent = HIWORD(wParam);
		// 選択されたメニューの解析:
		switch (wmId)
		{
		/* コンボボックス */
		case IDC_COM1:
			/* 変更された */
			if(HIWORD(wParam) == CBN_SELCHANGE)
			{
				int index = SendMessage(hComBox1, CB_GETCURSEL, 0, 0);
				/* 人間を選択 */
				if(index == 0)
				{
					player[0] = HUMAN;
					CpuColor = WHITE;
					ShowWindow(hComBox3, SW_HIDE);
				}
				/* CPUを選択 */
				else
				{
					player[0] = CPU;
					CpuColor = BLACK;
					ShowWindow(hComBox3, SW_SHOW);
				}
			}
			break;
		case IDC_COM2:
			/* 変更された */
			if(HIWORD(wParam) == CBN_SELCHANGE)
			{
				int index = SendMessage(hComBox2, CB_GETCURSEL, 0, 0);
				/* 人間を選択 */
				if(index == 0)
				{
					player[1] = HUMAN;
					CpuColor = BLACK;
					ShowWindow(hComBox4, SW_HIDE);
				}
				/* CPUを選択 */
				else
				{
					player[1] = CPU;
					CpuColor = WHITE;
					ShowWindow(hComBox4, SW_SHOW);
				}
			}
			break;
		case IDC_COM3:
			/* 変更された */
			if(HIWORD(wParam) == CBN_SELCHANGE)
			{
				int index = SendMessage(hComBox3, CB_GETCURSEL, 0, 0);
				/* 難易度 */
				switch(index)
				{
				case 0:
					OnVeasy(hWnd, BLACK);
					break;
				case 1:
					Oneasy(hWnd, BLACK);
					break;
				case 2:
					Onnormal(hWnd, BLACK);
					break;
				case 3:
					Onhard(hWnd, BLACK);
					break;
				case 4:
					OnVhard(hWnd, BLACK);
					break;
				case 5:
					OnUhard(hWnd, BLACK);
					break;
				case 6:
					OnSUhard(hWnd, BLACK);
					break;
				case 7:
					OnSSUhard(hWnd, BLACK);
					break;
				case 8:
					OnHUhard(hWnd, BLACK);
					break;
				case 9:
					OnUltra(hWnd, BLACK);
					break;
				case 10:
					OnSUltra(hWnd, BLACK);
					break;
				case 11:
					OnSSUltra(hWnd, BLACK);
					break;
				case 12:
					OnAllSearchWin(hWnd, BLACK);
					break;
				case 13:
					OnAllSearchSD(hWnd, BLACK);
					break;
				}
			}
			break;
		case IDC_COM4:
			/* 変更された */
			if(HIWORD(wParam) == CBN_SELCHANGE)
			{
				int index = SendMessage(hComBox4, CB_GETCURSEL, 0, 0);
				/* 難易度 */
				switch(index)
				{
				case 0:
					OnVeasy(hWnd, WHITE);
					break;
				case 1:
					Oneasy(hWnd, WHITE);
					break;
				case 2:
					Onnormal(hWnd, WHITE);
					break;
				case 3:
					Onhard(hWnd, WHITE);
					break;
				case 4:
					OnVhard(hWnd, WHITE);
					break;
				case 5:
					OnUhard(hWnd, WHITE);
					break;
				case 6:
					OnSUhard(hWnd, WHITE);
					break;
				case 7:
					OnSSUhard(hWnd, WHITE);
					break;
				case 8:
					OnHUhard(hWnd, WHITE);
					break;
				case 9:
					OnUltra(hWnd, WHITE);
					break;
				case 10:
					OnSUltra(hWnd, WHITE);
					break;
				case 11:
					OnSSUltra(hWnd, WHITE);
					break;
				case 12:
					OnAllSearchWin(hWnd, WHITE);
					break;
				case 13:
					OnAllSearchSD(hWnd, WHITE);
					break;
				}
			}
			break;
		case IDM_ABOUT:
			DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
			break;
		case IDM_EXIT:
			DestroyWindow(hWnd);
			break;
		case NEWGAME_BT:
		case StartNew:
			InitBoard();
			/* 置換表の取得 */
			HashDelete(ghash);
			ghash = HashNew(21);
			HashClear(ghash);
			/* 再描写 */
			hdc = GetDC(hWnd);
			DrawBoard( hdc, hStatus, -1, -1);
			ReleaseDC(hWnd, hdc);
			GameThread(lParam, STARTGAME);
			return DefWindowProc(hWnd, message, wParam, lParam);
		case CONTINUE_BT:
			/* 置換表の取得 */
			if(ghash == NULL){
				HashDelete(ghash);
				ghash = HashNew(21);
				HashClear(ghash);
			}
			if(NowTurn == BLACK)
			{
				/* 再描写 */
				hdc = GetDC(hWnd);
				DrawBoard( hdc, hStatus, -1, -1);
				ReleaseDC(hWnd, hdc);
				NowTurn = BLACK;
				GameThread(lParam, STARTGAME);
				return DefWindowProc(hWnd, message, wParam, lParam);
			}
			else
			{
				hdc = GetDC(hWnd);
				DrawBoard( hdc, hStatus, -1, -1);
				ReleaseDC(hWnd, hdc);
				NowTurn = WHITE;
				GameThread(lParam, STARTGAME);
				return DefWindowProc(hWnd, message, wParam, lParam);
			}
		case StartContinue_B:
			/* 再描写 */
			hdc = GetDC(hWnd);
			DrawBoard( hdc, hStatus, -1, -1);
			ReleaseDC(hWnd, hdc);
			NowTurn = BLACK;
			GameThread(lParam, STARTGAME);
			return DefWindowProc(hWnd, message, wParam, lParam);
		case StartContinue_W:
			hdc = GetDC(hWnd);
			DrawBoard( hdc, hStatus, -1, -1);
			ReleaseDC(hWnd, hdc);
			NowTurn = WHITE;
			GameThread(lParam, STARTGAME);
			return DefWindowProc(hWnd, message, wParam, lParam);
		/*case Veasy:
			Force_SearchWin = FALSE;
			Force_SearchSD = FALSE;
			OnVeasy(hWnd);
			break;
		case easy:
			Force_SearchWin = FALSE;
			Force_SearchSD = FALSE;
			Oneasy(hWnd);
			break;
		case normal:
			Force_SearchWin = FALSE;
			Force_SearchSD = FALSE;
			Onnormal(hWnd);
			break;
		case hard:
			Force_SearchWin = FALSE;
			Force_SearchSD = FALSE;
			Onhard(hWnd);
			break;
		case Vhard:
			Force_SearchWin = FALSE;
			Force_SearchSD = FALSE;
			OnVhard(hWnd);
			break;
		case Uhard:
			Force_SearchWin = FALSE;
			Force_SearchSD = FALSE;
			OnUhard(hWnd);
			break;
		case AllWinLoss:
			Force_SearchWin = TRUE;
			OnAllSearchWin(hWnd);
			break;
		case AllStoneDiff:
			Force_SearchSD = TRUE;
			Force_SearchWin = FALSE;
			OnAllSearchSD(hWnd);
			break;*/
		case book_switch:
			if(!UseBook)
			{
				UseBook = TRUE;
				m_FlagBook = TRUE;
				HMENU hMenu = GetMenu(hWnd);
				CheckMenuItem(hMenu, book_switch, MFS_CHECKED);
			}
			else
			{
				UseBook = FALSE;
				m_FlagBook = FALSE;
				HMENU hMenu = GetMenu(hWnd);
				CheckMenuItem(hMenu, book_switch, MFS_UNCHECKED);
			}
			break;
		case book_best:
			if(!b_Flag_not_change)
			{
				HMENU hMenu = GetMenu(hWnd);
				UncheckedAll_BookMenu(hMenu);
				b_Flag_not_change = TRUE;
				CheckMenuItem(hMenu, book_best, MFS_CHECKED);
			}
			break;
		case book_little_change:
			if(!b_Flag_little_change)
			{
				HMENU hMenu = GetMenu(hWnd);
				UncheckedAll_BookMenu(hMenu);
				b_Flag_little_change = TRUE;
				CheckMenuItem(hMenu, book_little_change, MFS_CHECKED);
			}
			break;
		case book_change:
			if(!b_Flag_change)
			{
				HMENU hMenu = GetMenu(hWnd);
				UncheckedAll_BookMenu(hMenu);
				b_Flag_change = TRUE;
				CheckMenuItem(hMenu, book_change, MFS_CHECKED);
			}
			break;
		case book_random:
			{
				HMENU hMenu = GetMenu(hWnd);
				UncheckedAll_BookMenu(hMenu);
				CheckMenuItem(hMenu, book_random, MFS_CHECKED);
			}
			break;
		/*case CorrectSt:
			PrintCorrectSt(hWnd);
			return DefWindowProc(hWnd, message, wParam, lParam);*/
		case rotate90:
			m_FlagInGame = FALSE;
			black = rotate_90(black);
			white = rotate_90(white);
			{
				BitBoard move = one << (move_x * 8 + move_y);
				move = rotate_90(move);
				int pos = CountBit((move & (-(signed long long int)move)) - 1);
				move_x = pos / 8;
				move_y = pos % 8;
			}
			break;
		case rotate180:
			m_FlagInGame = FALSE;
			black = rotate_180(black);
			white = rotate_180(white);
			{
				BitBoard move = one << (move_x * 8 + move_y);
				move = rotate_180(move);
				int pos = CountBit((move & (-(signed long long int)move)) - 1);
				move_x = pos / 8;
				move_y = pos % 8;
			}
			break;
		case rotate270:
			m_FlagInGame = FALSE;
			black = rotate_270(black);
			white = rotate_270(white);
			{
				BitBoard move = one << (move_x * 8 + move_y);
				move = rotate_270(move);
				int pos = CountBit((move & (-(signed long long int)move)) - 1);
				move_x = pos / 8;
				move_y = pos % 8;
			}
			break;
		case symX:
			m_FlagInGame = FALSE;
			black = symmetry_x(black);
			white = symmetry_x(white);
			{
				BitBoard move = one << (move_x * 8 + move_y);
				move = symmetry_x(move);
				int pos = CountBit((move & (-(signed long long int)move)) - 1);
				move_x = pos / 8;
				move_y = pos % 8;
			}
			break;
		case symY:
			m_FlagInGame = FALSE;
			black = symmetry_y(black);
			white = symmetry_y(white);
			{
				BitBoard move = one << (move_x * 8 + move_y);
				move = symmetry_y(move);
				int pos = CountBit((move & (-(signed long long int)move)) - 1);
				move_x = pos / 8;
				move_y = pos % 8;
			}
			break;
		case symBL:
			m_FlagInGame = FALSE;
			black = symmetry_b(black);
			white = symmetry_b(white);
			{
				BitBoard move = one << (move_x * 8 + move_y);
				move = symmetry_b(move);
				int pos = CountBit((move & (-(signed long long int)move)) - 1);
				move_x = pos / 8;
				move_y = pos % 8;
			}
			break;
		case symWL:
			m_FlagInGame = FALSE;
			black = symmetry_w(black);
			white = symmetry_w(white);
			{
				BitBoard move = one << (move_x * 8 + move_y);
				move = symmetry_w(move);
				int pos = CountBit((move & (-(signed long long int)move)) - 1);
				move_x = pos / 8;
				move_y = pos % 8;
			}
			break;
		case BoardInit:
			InitBoard();
			{
				/* メニューバーの各項目の有効無効化 */
				HMENU hMenu = GetMenu(hWnd);
				EnableMenuItem(hMenu, interrupt, MFS_GRAYED);
				EnableMenuItem(hMenu, EditBoard, MFS_ENABLED);
				EnableMenuItem(hMenu, ChangeColor, MFS_ENABLED);
			}
			break;
		case EditBoard:
			Flag_Edit = TRUE;
			break;
		case INTERRUPT_BT:
		case interrupt:
			if(AI_THINKING /*|| m_FlagHint */)
			{
				Flag_Abort = TRUE;
			}
			else
			{
				Interrupt_flag = TRUE;
				m_FlagInterrupt = TRUE;
				m_FlagInGame = FALSE;
			}
			{
				HMENU hMenu = GetMenu(hWnd);
				EnableMenuItem(hMenu, interrupt, MFS_GRAYED);
				hMenu = GetMenu(hWnd);
				EnableMenuItem(hMenu, EditBoard, MFS_ENABLED);
				EnableMenuItem(hMenu, ChangeColor, MFS_ENABLED);
			}
			break;
		case CHANGE_BT:
		case ChangeColor:
			CpuColor ^= 1;
			break;
		case print_result:
			if(!AI_result)
			{
				AI_result = TRUE;
				HMENU hMenu = GetMenu(hWnd);
				CheckMenuItem(hMenu, print_result, MFS_CHECKED);
			}
			else
			{
				AI_result = FALSE;
				HMENU hMenu = GetMenu(hWnd);
				CheckMenuItem(hMenu, print_result, MFS_UNCHECKED);
			}
			break;
		case print_AI_moves:
			/*if(!AI_thinking)
			{
				AI_thinking = TRUE;
				HMENU hMenu = GetMenu(hWnd);
				CheckMenuItem(hMenu, print_AI_moves, MFS_CHECKED);
			}
			else
			{
				AI_thinking = FALSE;
				HMENU hMenu = GetMenu(hWnd);
				CheckMenuItem(hMenu, print_AI_moves, MFS_UNCHECKED);
			}*/
			
			break;
		case print_thinking:
		/*	if(!OnTheWay)
			{
				OnTheWay = TRUE;
				HMENU hMenu = GetMenu(hWnd);
				CheckMenuItem(hMenu, print_thinking, MFS_CHECKED);
			}
			else
			{
				OnTheWay = FALSE;
				HMENU hMenu = GetMenu(hWnd);
				CheckMenuItem(hMenu, print_thinking, MFS_UNCHECKED);
			}*/
			break;
		case Auto_Learn:
			//InitBoard();
			//{
			//	int i = 0;
			//	while(i < 1)
			//	{
			//		Learn_Thread();
			//		//Start_Auto_Learn(4, 13, 100000, -1);
			//		i++;
			//	}
			//}
			break;
		case 32849:
			/*{
				Learn_Thread();
			}*/
			break;
		case auto_g:
			m_FlagInterrupt = FALSE;
			Interrupt_flag = FALSE;
			auto_game_thread();
			break;
		case UNDO_BT:
		case Undo:
			if(turn == 0 || (UndoBoard_B[turn - 1] == 0 && UndoBoard_W[turn - 1] == 0))
			{
				break;
			}
			m_FlagInGame = FALSE;
			if(AI_THINKING /* || m_FlagHint */)
			{
				Flag_Abort = TRUE;
			}
			/* ヒント用の評価データ破棄 */
			/*{
				for(int i = 0; i < 32; i++){ EvalData[i] = NEGAMAX;}
			}*/
			black = UndoBoard_B[turn - 1];
			white = UndoBoard_W[turn - 1];
			move_x = Undo_x[turn - 1];
			move_y = Undo_y[turn - 1];
			NowTurn = Undo_color[turn - 1];

			turn--;
			SendMessage(hListBox, LB_SETCURSEL, turn - 1, 0);
			if(turn - 1 < 0 || (UndoBoard_B[turn - 1] == 0 && UndoBoard_W[turn - 1] == 0))
			{
				EnableMenuItem(GetMenu(hWnd), Undo, MFS_GRAYED);
				EnableWindow(GetDlgItem(hRebar, UNDO_BT), FALSE);
			}
			if(!(UndoBoard_B[turn + 1] == 0 && UndoBoard_W[turn + 1] == 0) || turn + 1 <= 60)
			{
				EnableMenuItem(GetMenu(hWnd), Redo, MFS_ENABLED);
				EnableWindow(GetDlgItem(hRebar, REDO_BT), TRUE);
			}
			break;
		case REDO_BT:
		case Redo:
			if(turn == 60 || UndoBoard_B[turn + 1] == 0 && UndoBoard_W[turn + 1] == 0)
			{
				break;
			}
			m_FlagInGame = FALSE;
			/* ヒント用の評価データ破棄 */
			/*{
				for(int i = 0; i < 32; i++){ EvalData[i] = NEGAMAX;}
			}*/
			SendMessage(hListBox, LB_SETCURSEL, turn, 0);
			black = UndoBoard_B[turn + 1];
			white = UndoBoard_W[turn + 1];
			move_x = Undo_x[turn + 1];
			move_y = Undo_y[turn + 1];
			NowTurn = Undo_color[turn + 1];
			turn++;
			if((UndoBoard_B[turn + 1] == 0 && UndoBoard_W[turn + 1] == 0) || turn + 1 > 60)
			{
				EnableMenuItem(GetMenu(hWnd), Redo, MFS_GRAYED);
				EnableWindow(GetDlgItem(hRebar, REDO_BT), FALSE);
			}
			if(turn - 1 >= 0 || !(UndoBoard_B[turn - 1] == 0 && UndoBoard_W[turn - 1] == 0))
			{
				EnableMenuItem(GetMenu(hWnd), Undo, MFS_ENABLED);
				EnableWindow(GetDlgItem(hRebar, UNDO_BT), TRUE);
			}
			break;
		case FIRST_BT:
			{
				int i;
				for(i = 0; i < 60; i++)
				{
					if(UndoBoard_B[i] != 0 || UndoBoard_W[i] != 0)
					{	
						black = UndoBoard_B[i];
						white = UndoBoard_W[i];
						move_x = Undo_x[i];
						move_y = Undo_y[i];
						NowTurn = Undo_color[i];
						turn = i;
						/* ヒント用の評価データ破棄 */
						//for(i = 0; i < 32; i++){ EvalData[i] = NEGAMAX;}
						m_FlagInGame = FALSE;
						break;
					}
				}
			}
			break;
		case FINAL_BT:
			{
				int i;
				for(i = 60; i >= 0; i--)
				{
					if(UndoBoard_B[i] != 0 || UndoBoard_W[i] != 0)
					{	
						black = UndoBoard_B[i];
						white = UndoBoard_W[i];
						move_x = Undo_x[i];
						move_y = Undo_y[i];
						NowTurn = Undo_color[i];
						turn = i;
						/* ヒント用の評価データ破棄 */
						//for(i = 0; i < 32; i++){ EvalData[i] = NEGAMAX;}
						m_FlagInGame = FALSE;
						break;
					}
				}
			}
			break;
		case Hint_0:
			OnHint_0(hWnd);
			HINT_DISPED = FALSE;
			GameThread(0, HINTONLY);
			break;
		case Hint_1:
			OnHint_1(hWnd);
			HINT_DISPED = FALSE;
			GameThread(0, HINTONLY);
			break;
		case Hint_2:
			OnHint_2(hWnd);
			HINT_DISPED = FALSE;
			GameThread(0, HINTONLY);
			break;
		case Hint_3:
			OnHint_3(hWnd);
			HINT_DISPED = FALSE;
			GameThread(0, HINTONLY);
			break;
		case Hint_4:
			OnHint_4(hWnd);
			HINT_DISPED = FALSE;
			GameThread(0, HINTONLY);
			break;
		case Hint_5:
			OnHint_5(hWnd);
			HINT_DISPED = FALSE;
			GameThread(0, HINTONLY);
			break;
		case Hint_6:
			OnHint_6(hWnd);
			HINT_DISPED = FALSE;
			GameThread(0, HINTONLY);
			break;
		case print_eval:
			//read_eval_table(CountBit(black | white) - 4);
			if(turn == 0){
				break;
			}
			//read_eval_table(turn - 1);
			if(NowTurn == BLACK){
				init_index_board(black, white);
				GetEvalFromPattern(black, white, NowTurn, turn - 1);
			}
			else{
				init_index_board(white, black);
				GetEvalFromPattern(white, black, NowTurn, turn - 1);
			}
			
			{
				char eval_msg[PATTERN_NUM + 1][64];
				sprintf_s(eval_msg[0], "hori_ver1_1 = %f, ", key_hori_ver1[0]);
				sprintf_s(eval_msg[1], "hori_ver1_2 = %f\n", key_hori_ver1[1]);
				sprintf_s(eval_msg[2], "hori_ver1_3 = %f,", key_hori_ver1[2]);
				sprintf_s(eval_msg[3], "hori_ver1_4 = %f\n", key_hori_ver1[3]);
				sprintf_s(eval_msg[4], "hori_ver2_1 = %f,", key_hori_ver2[0]);
				sprintf_s(eval_msg[5], "hori_ver2_2 = %f\n", key_hori_ver2[1]);
				sprintf_s(eval_msg[6], "hori_ver2_3 = %f,", key_hori_ver2[2]);
				sprintf_s(eval_msg[7], "hori_ver2_4 = %f\n", key_hori_ver2[3]);
				sprintf_s(eval_msg[8], "hori_ver3_1 = %f,", key_hori_ver3[0]);
				sprintf_s(eval_msg[9], "hori_ver3_2 = %f\n", key_hori_ver3[1]);
				sprintf_s(eval_msg[10], "hori_ver3_3 = %f,", key_hori_ver3[2]);
				sprintf_s(eval_msg[11], "hori_ver3_4 = %f\n", key_hori_ver3[3]);
				sprintf_s(eval_msg[12], "dia_ver1_1 = %f,",  key_dia_ver1[0]);
				sprintf_s(eval_msg[13], "dia_ver1_2 = %f\n",  key_dia_ver1[1]);
				sprintf_s(eval_msg[14], "dia_ver2_1 = %f,", key_dia_ver2[0]);
				sprintf_s(eval_msg[15], "dia_ver2_2 = %f\n", key_dia_ver2[1]);
				sprintf_s(eval_msg[16], "dia_ver2_3 = %f,", key_dia_ver2[2]);
				sprintf_s(eval_msg[17], "dia_ver2_4 = %f\n", key_dia_ver2[3]);
				sprintf_s(eval_msg[18], "dia_ver3_1 = %f,", key_dia_ver3[0]);
				sprintf_s(eval_msg[19], "dia_ver3_2 = %f\n", key_dia_ver3[1]);
				sprintf_s(eval_msg[20], "dia_ver3_3 = %f,", key_dia_ver3[2]);
				sprintf_s(eval_msg[21], "dia_ver3_4 = %f\n", key_dia_ver3[3]);
				sprintf_s(eval_msg[22], "dia_ver4_1 = %f,", key_dia_ver4[0]);
				sprintf_s(eval_msg[23], "dia_ver4_2 = %f\n", key_dia_ver4[1]);
				sprintf_s(eval_msg[24], "dia_ver4_3 = %f,", key_dia_ver4[2]);
				sprintf_s(eval_msg[25], "dia_ver4_4 = %f\n", key_dia_ver4[3]);
				sprintf_s(eval_msg[26], "edge_1 = %f,", key_edge[0]);
				sprintf_s(eval_msg[27], "edge_2 = %f\n", key_edge[1]);
				sprintf_s(eval_msg[28], "edge_3 = %f,", key_edge[2]);
				sprintf_s(eval_msg[29], "edge_4 = %f\n", key_edge[3]);
				sprintf_s(eval_msg[26], "edge_cor_1 = %f,", key_edge_cor[0]);
				sprintf_s(eval_msg[27], "edge_cor_2 = %f\n", key_edge_cor[1]);
				sprintf_s(eval_msg[28], "edge_cor_3 = %f,", key_edge_cor[2]);
				sprintf_s(eval_msg[29], "edge_cor_4 = %f\n", key_edge_cor[3]);
				sprintf_s(eval_msg[34], "corner4_2_1 = %f,", key_corner4_2[0]);
				sprintf_s(eval_msg[35], "corner4_2_2 = %f\n", key_corner4_2[1]);
				sprintf_s(eval_msg[36], "corner4_2_3 = %f,", key_corner4_2[2]);
				sprintf_s(eval_msg[37], "corner4_2_4 = %f\n", key_corner4_2[3]);
				sprintf_s(eval_msg[38], "corner3_3_1 = %f,", key_corner3_3[0]);
				sprintf_s(eval_msg[39], "corner3_3_2 = %f\n", key_corner3_3[1]);
				sprintf_s(eval_msg[40], "corner3_3_3 = %f,", key_corner3_3[2]);
				sprintf_s(eval_msg[41], "corner3_3_4 = %f\n", key_corner3_3[3]);
				/*sprintf_s(eval_msg[38], "triangle_1 = %f,", key_triangle[0]);
				sprintf_s(eval_msg[39], "triangle_2 = %f\n", key_triangle[1]);
				sprintf_s(eval_msg[40], "triangle_3 = %f,", key_triangle[2]);
				sprintf_s(eval_msg[41], "triangle_4 = %f\n", key_triangle[3]);
				sprintf_s(eval_msg[42], "mobility = %f\n", key_mobility);
				sprintf_s(eval_msg[43], "potential_mobility = %f\n", key_pot_mobility);
				sprintf_s(eval_msg[44], "paility = %f\n", key_pality);*/
				sprintf_s(eval_msg[42], "mobility = %f\n", key_mobility);
				sprintf_s(eval_msg[43], "constant = %f\n", key_constant);
				sprintf_s(eval_msg[44], "\n評価値 = %f,", eval_sum);
				sprintf_s(eval_msg[45], "\nblack = 0x%llx\nwhite = 0x%llx\n", black, white);
				int i;
				char print_msg[8192];
				strcpy_s(print_msg, eval_msg[0]);
				for(i = 1; i < 46; i++)
				{
					strcat_s(print_msg, eval_msg[i]);
				}
				
				MessageBox(hWnd, print_msg, "評価値詳細一覧", MB_OK);
				//memset(msg, 0, sizeof(print_msg));
			}
			break;
			/* FFOメニュ− */

		case FFO40:
			black = 9158069842325798912;
			white = 11047339776155165;
			configCPU(BLACK);
			break;

		case FFO41:
			black = 616174399789064;
			white = 39493460025648416;
			configCPU(BLACK);
			break;

		case FFO42:
			white = 9091853944868375556;
			black = 22586176447709200;
			configCPU(BLACK);
			break;

		case FFO43:
			black = 38808086923902976;
			white = 13546258740034592;
			configCPU(WHITE);
			break;

		case FFO44:
			black = 2494790880993312;
			white = 1010251075753548824;
			configCPU(WHITE);
			break;

		case FFO45:
			black = 282828816915486;
			white = 9287318235258944;
			configCPU(BLACK);
			break;

		case FFO46:
			black = 4052165999611379712;
			white = 36117299622447104;
			configCPU(BLACK);

			break;

		case FFO47:
			black = 277938752194568;
			white = 3536224466208;
			configCPU(WHITE);
			break;

		case FFO48:
			black = 38519958422848574;
			white = 4725679339520;
			configCPU(WHITE);
			break;

		case FFO49:
			black = 5765976742297600;
			white = 4253833575484;
			configCPU(BLACK);

			break;

		case FFO50:
			black = 4504145659822080;
			white = 4336117619740130304;
			configCPU(BLACK);
			break;

		case FFO51:
			black = 349834415978528;
			white = 8664011788383158280;
			configCPU(WHITE);
			break;

		case FFO52:
			black = 9096176176681728056;
			white = 35409824317440;
			configCPU(WHITE);
			break;

		case FFO53:
			black = 2515768979493888;
			white = 8949795312300457984;
			configCPU(BLACK);
			break;

		case FFO54:
			black = 277938752194568;
			white = 3536224466208;
			configCPU(BLACK);
			break;

		case FFO55:
			black = 4635799596172290;
			white = 289361502099486840;
			configCPU(BLACK);
			break;

		case FFO56:
			black = 4925086697193472;
			white = 9007372734053408;
			configCPU(WHITE);
			break;

		case FFO57:
			black = 9060166336512000;
			white = 8943248156475301888;
			configCPU(BLACK);

			break;

		case FFO58:
			black = 4636039783186432;
			white = 3383245044333600;
			configCPU(BLACK);
			break;

		case FFO59:
			black = 17320879491911778304;
			white = 295223649004691488;
			configCPU(BLACK);
			break;

		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
		}
		InvalidateRect(hWnd, NULL, FALSE);
		/* 再描写 */
		hdc = GetDC(hWnd);
		DrawBoard( hdc, hStatus, -1, -1);
		ReleaseDC(hWnd, hdc);
		UpdateWindow(hRebar);
		SendMessage(hStatus, SB_SETTEXT, (WPARAM)1 | 0, (LPARAM)turn_str[NowTurn]);
		break;
	case WM_PAINT:
		hdc = BeginPaint(hWnd, &ps);
		// TODO: 描画コードをここに追加してください...
		hdc = GetDC(hWnd);
		DrawBoard( hdc, hStatus, move_x, move_y);
		ReleaseDC(hWnd, hdc);
		SendMessage(hStatus, SB_SETTEXT, (WPARAM)1 | 0, (LPARAM)turn_str[NowTurn]);
		//char str[64];
		//sprintf_s(str, "black = %llu", black);
		//SendMessage(hStatus, SB_SETTEXT, (WPARAM)3 | 0, (LPARAM)str);
		EndPaint(hWnd, &ps);
		break;
	case WM_DESTROY:
		
		/* 置換表の解放 */
		//HashDelete(hashTable);
		PostQuitMessage(0);
		break;
	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 0;
}
Example #16
0
/*****************************************************************************
 * BOOL RunPip()
 *****************************************************************************/		
BOOL RunPip( void )	
{
	static BOOL ShowCursor;
	
	switch ( g_PipAction )
	{
		case PIP_START:
			ShowCursor = FALSE;
			CreateListBox();
			if ( g_AutoMode )
				g_PipAction = PIP_MOVE;	
			else	
				g_PipAction = PIP_SELECT;
			return TRUE;
		
		
		case PIP_SELECT:
	        if(btnS3 == HW_BUTTON_PRESS)
	        {
	            while(btnS3 == HW_BUTTON_PRESS);	        
	            UpdateListBox( TRUE, FALSE );            
	        }    
	
	        if(btnS1 == HW_BUTTON_PRESS)
	        {
	            while(btnS1 == HW_BUTTON_PRESS);            
	            UpdateListBox( FALSE, TRUE );
	        }  
	        
	        if(btnS2 == HW_BUTTON_PRESS)
	        {
	            while(btnS2 == HW_BUTTON_PRESS);	        
	            g_PipAction = ListBoxSelected();
	        } 		
			return TRUE;
		
		case PIP_SHOW_CURSOR:
			ShowCursor = ! ShowCursor;
			if ( ShowCursor )
				GFX_DRIVER_ShowLayer( GFX_CURSOR_LAYER );
			else
				GFX_DRIVER_HideLayer( GFX_CURSOR_LAYER );			
			g_PipAction = PIP_SELECT;
			return TRUE;		
			
		case PIP_MOVE_CURSOR:
			if ( ! MoveCursor() )
					g_PipAction = PIP_SELECT;
			
			return TRUE;
			
		case PIP_MOVE:
			if ( ! MovePip() )
			{
				if ( g_AutoMode  )
					g_PipAction = PIP_EXIT;
				else
					g_PipAction = PIP_SELECT;
			}
			return TRUE;						
		
		default:
		case PIP_EXIT:
			DeleteListBox();
			g_PipAction = PIP_START;
			return FALSE;
	}	
	
	//return TRUE;	
}
Example #17
0
void CPWL_ComboBox::CreateChildWnd(const PWL_CREATEPARAM& cp) {
  CreateEdit(cp);
  CreateButton(cp);
  CreateListBox(cp);
}
// -----------------------------------------------------------------------
// Font buttons hook in properties
LRESULT CALLBACK PropListboxHook(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    CStr StrSubListBox;
    long *ArraySub = 0;
    int i = 0;
    char *ComboSubList;

    switch(uMsg)
    {
        case WM_VSCROLL:
            if(hListBoolean != 0)
            {
                ControlClose(hListBoolean);
                hListBoolean = 0;
            }
            break;
        case WM_CTLCOLORSTATIC:
            SetBkColor((HDC) wParam, GetSysColor(COLOR_WINDOW));
            return((LRESULT) hSubEditBrush);
        case WM_COMMAND:
            if((HWND) lParam == CurrentEditControl)
            {
                switch(CurrentEditControlType)
                {
                    case PROP_BOOLEAN:
                        if(hListBoolean != 0)
                        {
                            ControlClose(hListBoolean);
                            hListBoolean = 0;
                        }
                        else
                        {
                            PropCurrentTop = ControlTop(CurrentEditControl) - 2 - ControlTop(hPropListbox) + ControlHeight(CurrentEditControl) + 2;
                            // Bound bottom coordinate
                            if(((PropCurrentHeight * 2) + (PropCurrentTop)) > ControlClientHeight(hPropListbox))
                            {
                                PropCurrentTop = PropCurrentTop - (PropCurrentHeight * 2) - ControlHeight(CurrentEditControl);
                            }
                            hListBoolean = CreateListBox(PropCurrentLeft, PropCurrentTop - 2, PropCurrentWidth, PropCurrentHeight * 2, hPropListbox, 0, &PropSubListboxHook, 0, WS_VSCROLL | WS_BORDER, 0);
                            ListBoxAddItem(hListBoolean, "False", -1);
                            ListBoxAddItem(hListBoolean, "True", -1);
                            ListBoxSetIndex(hListBoolean, ListBoxItemExist(hListBoolean, (char *) GetPropertyDatas(hCurrentObject, CurrentEditControlIndex, PROPERTY_STORAGE)));
                            SelectedInList = -1;
                            SelectedInListText = "";
                            SetFocus(hListBoolean);
                        }
                        break;
                    case PROP_COMBO:
                        if(hListBoolean != 0)
                        {
                            ControlClose(hListBoolean);
                            hListBoolean = 0;
                        }
                        else
                        {
                            // Bound bottom coordinate
                            PropCurrentTop = ControlTop(CurrentEditControl) - 2 - ControlTop(hPropListbox) + ControlHeight(CurrentEditControl) + 2;
                            if(GetPropertyDatas(hCurrentObject, CurrentEditControlIndex, PROPERTY_EXTEND) != 0) {
                                ComboSubList = (char *) GetPropertyDatas(hCurrentObject, CurrentEditControlIndex, PROPERTY_EXTEND);
                                StrSubListBox = StrSubListBox.String(strlen(ComboSubList), 1);
                                RtlCopyMemory(StrSubListBox.Get_String(), ComboSubList, strlen(ComboSubList));
                                ArraySub = StringSplit(&StrSubListBox, "|");
                                if(StringGetSplitUBound(ArraySub) != -1)
                                {
                                    // Bound bottom coordinate
                                    if(((PropCurrentHeight * (StringGetSplitUBound(ArraySub) + 1)) + (PropCurrentTop)) > ControlClientHeight(hPropListbox))
                                    {
                                        PropCurrentTop = PropCurrentTop - (PropCurrentHeight * (StringGetSplitUBound(ArraySub) + 1)) - ControlHeight(CurrentEditControl);
                                    }
                                    hListBoolean = CreateListBox(PropCurrentLeft, PropCurrentTop - 2, PropCurrentWidth, PropCurrentHeight * (StringGetSplitUBound(ArraySub) + 1), hPropListbox, 0, &PropSubListboxHook, 0, WS_VSCROLL | WS_BORDER, 0);
                                    for(i = 0; i <= StringGetSplitUBound(ArraySub); i++)
                                    {
                                        ListBoxAddItem(hListBoolean, StringGetSplitElement(&StrSubListBox, ArraySub, i), -1);
                                    }
                                }
                                StringReleaseSplit(ArraySub);
                            }
                            ListBoxSetIndex(hListBoolean, ListBoxItemExist(hListBoolean, (char *) GetPropertyDatas(hCurrentObject,
                                                                                                                       CurrentEditControlIndex,
                                                                                                                       PROPERTY_STORAGE)));
                            SelectedInList = -1;
                            SelectedInListText = "";
                            SetFocus(hListBoolean);
                        }
                        break;
                    case PROP_FILESELECT:
                        break;
                    case PROP_FONTSELECT:
                        PropCurrentTop = ControlTop(CurrentEditControl) - ControlTop(hPropListbox) + ControlHeight(CurrentEditControl);
                        PropSelectFont();
                        break;
                }
                return(0);
            }
    }
    return(CallWindowProc((WNDPROC) GetWindowLong(hWnd, GWL_USERDATA), hWnd, uMsg, wParam, lParam));
}
Example #19
0
/*
 * DDETrackingWndProc - handle messages from the tracking windows
 */
BOOL __export FAR PASCAL DDETrackingWndProc( HWND hwnd, UINT msg,
                                             WPARAM wparam, LPARAM lparam )
{
    DDETrackInfo                *info;
    WORD                        i;
    void                        **ptr;
    RECT                        area;
    WORD                        cmd;
    char                        *wintitle;

    info = (DDETrackInfo *)GetWindowLong( hwnd, 0 );
    switch( msg ) {
    case WM_CREATE:
        info = MemAlloc( sizeof( DDETrackInfo ) );
        memset( info, 0, sizeof( DDETrackInfo ) );
        info->type = *(WORD *)((CREATESTRUCT *)lparam)->lpCreateParams;
        SetWindowLong( hwnd, 0, (DWORD)info );
        switch( info->type ) {
        case DDEMENU_TRK_CONV:
            info->sorttype = PUSH_CLIENT;
            makePushWin( info, hwnd, ConvHdr, CNV_HDR_CNT );
            wintitle = GetRCString( STR_CONVERSATIONS );
            break;
        case DDEMENU_TRK_STR:
            info->sorttype = PUSH_STR_TEXT;
            makePushWin( info, hwnd, StrHdr, STR_HDR_CNT );
            wintitle = GetRCString( STR_STRINGS );
            break;
        case DDEMENU_TRK_LINK:
            info->sorttype = PUSH_CLIENT;
            makePushWin( info, hwnd, LnkHdr, LNK_HDR_CNT );
            wintitle = GetRCString( STR_LINKS );
            break;
        case DDEMENU_TRK_SERVER:
            info->sorttype = PUSH_INST;
            makePushWin( info, hwnd, SrvHdr, SRV_HDR_CNT );
            wintitle = GetRCString( STR_REG_SERVERS );
            break;
        }
        SetWindowText( hwnd, wintitle );
        CreateListBox( hwnd, &info->list );
        info->config = &Tracking[info->type - DDE_TRK_FIRST];
        if( info->config->visible ) {
            ShowWindow( hwnd, SW_SHOWNORMAL );
        }
        break;
    case WM_MOVE:
        GetWindowRect( hwnd, &area );
        info->config->xpos = area.left;
        info->config->ypos = area.top;
        break;
    case WM_SIZE:
        ResizeListBox( LOWORD( lparam ), HIWORD( lparam ), &info->list );
        GetWindowRect( hwnd, &area );
        if( wparam != SIZE_MAXIMIZED && wparam != SIZE_MINIMIZED ) {
            info->config->xsize = area.right - area.left;
            info->config->ysize = area.bottom - area.top;
        }
        break;
    case WM_COMMAND:
        cmd = LOWORD( wparam );
        switch( info->type ) {
        case DDEMENU_TRK_STR:
            doStrSort( cmd, info );
            break;
        case DDEMENU_TRK_CONV:
            doConvSort( cmd, info );
            break;
        case DDEMENU_TRK_LINK:
            doLinkSort( cmd, info );
            break;
        case DDEMENU_TRK_SERVER:
            doServerSort( cmd, info );
            break;
        }
        break;
    case WM_CLOSE:
        DisplayTracking( info->type );
        break;
    case WM_DESTROY:
        ptr = info->data;
        for( i = 0; i < info->cnt; i++ ) {
            MemFree( ptr[i] );
        }
        if( ptr != NULL ) {
            MemFree( ptr );
        }
        if( info->hdr != NULL ) {
            MemFree( info->hdr );
        }
        MemFree( info );
        break;
    default:
        return( DefWindowProc( hwnd, msg, wparam, lparam ) );
    }
    return( TRUE );

} /* DDETrackingWndProc */
Example #20
0
// -----------------------------------------------------------------------
// Initialize Form
int CALLBACK FRMPrjPropsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    PAINTSTRUCT CreatePs;
    CStr BufString;

    switch(uMsg)
    {
        case WM_INITDIALOG:
            FRMPrjPropshWnd = hwndDlg;
            ControlSetText(hwndDlg, "Project properties");
            FRMPrjPropsFr1 = CreateFrame(2, -1, 202, 108, hwndDlg, "Application", 0, 0, 0);
            FRMPrjPropsFr2 = CreateFrame(206, -1, 194, 108, hwndDlg, "Version", 0, 0, 0);
            FRMPrjPropsFr3 = CreateFrame(2, 108, 398, 94, hwndDlg, "Version informations", 14, &FRMPrjPropsFrame3, 0);
            CreateLabel(5, 21 + 20, 35, 15, FRMPrjPropsFr1, "Title :", 0, 0, 0, 0);
            CreateLabel(5, 41 + 25, 52, 15, FRMPrjPropsFr1, "File type :", 0, 0, 0, 0);
            CreateLabel(131, 41 + 25, 34, 15, FRMPrjPropsFr1, "Icon :", 0, 0, 0, 0);
            FRMPrjPropsOk = CreateButton(243, 214, 77, 23, hwndDlg, "Ok", 1, 0, 0, 0, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP, Buttons_StaticEdge);
            FRMPrjPropsCancel = CreateButton(322, 214, 77, 23, hwndDlg, "Cancel", 2, 0, 0, 0, WS_TABSTOP, Buttons_StaticEdge);
            FRMPrjPropsReg = CreateButton(159, 214, 77, 23, hwndDlg, "Register", 3, 0, 0, 0, WS_TABSTOP, Buttons_StaticEdge);
            FRMPrjPropsConstants = CreateButton(3, 214, 77, 23, hwndDlg, "Constants", 4, 0, 0, 0, WS_TABSTOP, Buttons_StaticEdge);
            FRMPrjPropsIncludeVersion = CreateCheckBox(7, 18, 140, 15, FRMPrjPropsFr1, "Include version resource", 5, 0, WS_TABSTOP | WS_GROUP, 0);
            FRMPrjPropsTxtTitle = CreateTextBox(36, 18 + 20, 159, 20, FRMPrjPropsFr1, "", 6, 0, WS_TABSTOP | ES_AUTOHSCROLL, WS_EX_STATICEDGE);
            FRMPrjPropsFileType = CreateComboBox(5, 56 + 25, 123, 150, FRMPrjPropsFr1, "", 7, 0, CBS_DROPDOWNLIST | WS_TABSTOP);
            ComboBoxAddItem(FRMPrjPropsFileType, "UNKNOWN", -1);
            ComboBoxAddItem(FRMPrjPropsFileType, "APP", -1);
            ComboBoxAddItem(FRMPrjPropsFileType, "DLL", -1);
            ComboBoxAddItem(FRMPrjPropsFileType, "DRV", -1);
            ComboBoxAddItem(FRMPrjPropsFileType, "FONT", -1);
            ComboBoxAddItem(FRMPrjPropsFileType, "VXD", -1);
            ComboBoxAddItem(FRMPrjPropsFileType, "STATIC_LIB", -1);
            ComboBoxSetIndex(FRMPrjPropsFileType, 0);
            FRMPrjPropsSetIcon = CreateButton(133, 56 + 25, 25, 21, hwndDlg, "...", 8, 0, 0, 0, WS_TABSTOP, Buttons_StaticEdge);
            // Current icon
            if(ProjectTypeScheduledImg.Len()) BufString = ProjectTypeScheduledImg;
            else BufString = ProjectDir + (CStr) "\\" + (CStr) ProjectTypeImg;
            FRMPrjPropsIconhandle = LoadImage(0, BufString.Get_String(), IMAGE_ICON, 0, 0, LR_LOADFROMFILE);
            FRMPrjPropsIcon = CreatePictureBox(163, 43 + 25, 35, 34, FRMPrjPropsFr1, FRMPrjPropsIconhandle, IMAGE_ICON, 9, 0, SS_CENTERIMAGE);
            CreateLabel(7, 15, 52, 13, FRMPrjPropsFr2, "Major :", 0, 0, 0, 0);
            CreateLabel(99, 15, 52, 13, FRMPrjPropsFr2, "Minor :", 0, 0, 0, 0);
            CreateLabel(7, 35, 52, 13, FRMPrjPropsFr2, "Revision :", 0, 0, 0, 0);
            CreateLabel(99, 35, 52, 13, FRMPrjPropsFr2, "Release :", 0, 0, 0, 0);
            FRMPrjPropsTxtMajor = CreateTextBox(59, 12, 33, 20, FRMPrjPropsFr2, "", 10, 0, WS_TABSTOP | ES_NUMBER, WS_EX_STATICEDGE);
            FRMPrjPropsTxtMinor = CreateTextBox(151, 12, 33, 20, FRMPrjPropsFr2, "", 11, 0, WS_TABSTOP | ES_NUMBER, WS_EX_STATICEDGE);
            FRMPrjPropsTxtRevision = CreateTextBox(59, 32, 33, 20, FRMPrjPropsFr2, "", 12, 0, WS_TABSTOP | ES_NUMBER, WS_EX_STATICEDGE);
            FRMPrjPropsTxtRelease = CreateTextBox(151, 32, 33, 20, FRMPrjPropsFr2, "", 13, 0, WS_TABSTOP | ES_NUMBER, WS_EX_STATICEDGE);
            CreateLabel(7, 61, 31, 15, FRMPrjPropsFr2, "OS :", 0, 0, 0, 0);
            FRMPrjPropsOS = CreateComboBox(34, 57, 150, 150, FRMPrjPropsFr2, "", 14, 0, CBS_DROPDOWNLIST | WS_TABSTOP);
            ComboBoxAddItem(FRMPrjPropsOS, "UNKNOWN", -1);
            ComboBoxAddItem(FRMPrjPropsOS, "DOS", -1);
            ComboBoxAddItem(FRMPrjPropsOS, "NT", -1);
            ComboBoxAddItem(FRMPrjPropsOS, "WINDOWS16", -1);
            ComboBoxAddItem(FRMPrjPropsOS, "WINDOWS32", -1);
            ComboBoxAddItem(FRMPrjPropsOS, "DOS_WINDOWS16", -1);
            ComboBoxAddItem(FRMPrjPropsOS, "DOS_WINDOWS32", -1);
            ComboBoxAddItem(FRMPrjPropsOS, "NT_WINDOWS32", -1);
            ComboBoxSetIndex(FRMPrjPropsOS, 0);
            FRMPrjPropsIncludeXPManifest = CreateCheckBox(16, 85, 170, 15, FRMPrjPropsFr2, "Include Windows XP manifest", 15, 0, WS_TABSTOP | WS_GROUP, 0);
            CreateLabel(5, 16, 52, 13, FRMPrjPropsFr3, "Type :", 0, 0, 0, 0);
            FRMPrjPropsTypeProp = CreateListBox(5, 30, 140, 59, FRMPrjPropsFr3, 16, 0, 0, WS_TABSTOP | WS_HSCROLL, WS_EX_STATICEDGE);
            ListBoxAddItem(FRMPrjPropsTypeProp, "Comments", -1);
            ListBoxAddItem(FRMPrjPropsTypeProp, "Company name", -1);
            ListBoxAddItem(FRMPrjPropsTypeProp, "File description", -1);
            ListBoxAddItem(FRMPrjPropsTypeProp, "Legal copyright", -1);
            ListBoxAddItem( FRMPrjPropsTypeProp, "Legal trademarks", -1);
            ListBoxAddItem(FRMPrjPropsTypeProp, "Product name", -1);
            ListBoxSetIndex(FRMPrjPropsTypeProp, 0);
            FRMPrjPropsTypeTxt = CreateTextBox(147, 13 - 2, 245, 79, FRMPrjPropsFr3, "", 17, &FRMPrjPropsTypeTxtHook, WS_TABSTOP | ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL | ES_WANTRETURN, WS_EX_STATICEDGE);
            LoadUserInfos();
            ControlSetText(FRMPrjPropsTxtMajor, Prj_Major);
            ControlSetText(FRMPrjPropsTxtMinor, Prj_Minor);
            ControlSetText(FRMPrjPropsTxtRevision, Prj_Revision);
            ControlSetText(FRMPrjPropsTxtRelease, Prj_Release);
            CheckBoxSetState(FRMPrjPropsIncludeVersion, Prj_IncludeVersion);
            CheckBoxSetState(FRMPrjPropsIncludeXPManifest, Prj_IncludeManifest);
            ComboBoxSetIndex(FRMPrjPropsOS, Prj_OS);
            ComboBoxSetIndex(FRMPrjPropsFileType, Prj_FileType);
            ControlSetText(FRMPrjPropsTxtTitle, ProjectTitle);
            TmpPrj_Comments = Prj_Comments;
            if(Prj_CompanyName.Len()) TmpPrj_CompanyName = Prj_CompanyName;
            TmpPrj_FileDescription = Prj_FileDescription;
            if(Prj_LegalCopyRight.Len()) TmpPrj_LegalCopyRight = Prj_LegalCopyRight;
            if(Prj_LegalTrademarks.Len()) TmpPrj_LegalTrademarks = Prj_LegalTrademarks;
            TmpPrj_ProductName = Prj_ProductName;
            ControlSetText(FRMPrjPropsTypeTxt, TmpPrj_Comments);
            FreezeTimer = 1;
            return(1);
        case WM_COMMAND:
            if((HWND) lParam == FRMPrjPropsOk)
            {
                ProjectTypeScheduledImg = NewIconFile;
                SaveProjectProperties();
                ControlClose(hwndDlg);
                return(0);
            }
            else if((HWND) lParam == FRMPrjPropsCancel)
            {
                ControlClose(hwndDlg);
                return(0);
            }
            else if((HWND) lParam == FRMPrjPropsConstants)
            {
                CreateConstants(hwndDlg);
                return(0);
            }
            else if((HWND) lParam == FRMPrjPropsReg)
            {
                RegisterUserInfos();
                return(0);
            }
            else if((HWND) lParam == FRMPrjPropsSetIcon)
            {
                SetProjectIcon();
                return(0);
            }
            break;
        case WM_PAINT:
            BeginPaint(hwndDlg, &CreatePs);
            GDIDrawHorzSep(hwndDlg, 0, 207, 402);
            EndPaint(hwndDlg, &CreatePs);
            break;
        case WM_CLOSE:
            FreezeTimer = 0;
            EndDialog(hwndDlg, 0);
            break;
    }
    return(0);
}
Example #21
0
/*
 * HeapWalkProc - show task status
 */
BOOL FAR PASCAL HeapWalkProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
    HMENU       mh;
    HMENU       mh2;
    HCURSOR     hourglass;
    HCURSOR     oldcursor;
    DLGPROC     dlgproc;
    DWORD       index;
    heap_list   hl;
    GblWndInfo  *info;
    RECT        area;
    about_info  ai;

    info = (GblWndInfo *)GetWindowLong( hwnd, 0 );
    switch( msg ) {
    case WM_CREATE:
        InitPaintProc();
        info = MemAlloc( sizeof( GblWndInfo ) );
        if( info == NULL ) {
            ErrorBox( hwnd, STR_UNABLE_2_STARTUP, MB_OK | MB_ICONINFORMATION );
            PostQuitMessage( 0 );
        }
        memset( info, 0, sizeof( GblWndInfo ) );
        SetWindowLong( hwnd, 0, (DWORD)info );
//      hdc = GetDC( hwnd );
//      ReleaseDC(hwnd, hdc);
        SetDisplayType( hwnd, &( info->list.title ), HEAPMENU_DISPLAY_INIT );
        CreateListBox( hwnd, &info->list, GLOBAL_LB );
        info->alloc_dlgproc = MakeProcInstance_DLG( AllocDlgProc, Instance );
        info->alloc_dialog = JCreateDialog( Instance, "ALLOC_DLG", hwnd, info->alloc_dlgproc );
        memset( &ResHwnd, 0, MAX_RES * sizeof( HWND ) );
        break;
    case WM_MEASUREITEM:
        break;
    case WM_MOVE:
        GetWindowRect( hwnd, &area );
        if( !info->minimized ) {
            Config.last_glob_xpos = Config.glob_xpos;
            Config.last_glob_ypos = Config.glob_ypos;
            Config.glob_xpos = area.left;
            Config.glob_ypos = area.top;
        }
        break;
    case WM_SIZE:
        ResizeListBox( LOWORD( lparam ), HIWORD( lparam ), &( info->list ) );
        if( wparam == SIZE_MINIMIZED || wparam == SIZE_MAXIMIZED ) {
            Config.glob_xpos = Config.last_glob_xpos;
            Config.glob_ypos = Config.last_glob_ypos;
        }
        if( wparam == SIZE_MINIMIZED ) {
            info->minimized = TRUE;
            HideResources( TRUE );
        } else if( info->minimized ) {
            HideResources( FALSE );
            info->minimized = FALSE;
        } else if( wparam != SIZE_MAXIMIZED )  {
            GetWindowRect( hwnd, &area );
            Config.glob_xsize = area.right - area.left;
            Config.glob_ysize = area.bottom - area.top;
        }
        return( DefWindowProc( hwnd, msg, wparam, lparam ) );
        break;
    case WM_CLOSE:
        PostMessage( hwnd, WM_COMMAND, HEAPMENU_EXIT, 0L );
        return( TRUE );
    case WM_QUERYENDSESSION:
        SaveConfigFile( FALSE );
        return( TRUE );
        break;
    case WM_DESTROY:
        FiniPaintProc();
        KillPushWin( info->list.title );
        SaveConfigFile( FALSE );
        if( info != NULL ) {
            FreeProcInstance_DLG( info->alloc_dlgproc );
            MemFree( info );
        }
        DestroyMonoFonts();
        CvrCtl3dUnregister( Instance );
        CvrCtl3DFini( Instance );
        WWinHelp( hwnd, "heapwalk.hlp", HELP_QUIT, 0 );
        PostQuitMessage( 0 );
        break;
    case WM_ACTIVATEAPP:
        if( wparam && !NoRefresh ) {
            if( info->doing_add ) {
                info->need_refresh = TRUE;
            } else {
                InitHeapList( info->list.box, TRUE );
            }
        }
        break;
    case WM_MENUSELECT:
        if( LOWORD( lparam & MF_POPUP ) ) {
            mh = GetMenu( hwnd );
            mh2 = GetSubMenu( mh, 6 );
            if( (HMENU)wparam == mh2  ) {
                ShowWindow( info->alloc_dialog, SW_SHOWNOACTIVATE );
            } else if( (HMENU)wparam != GetSubMenu( mh2, 3 ) &&
                        (HMENU)wparam != GetSubMenu( mh2, 4 ) &&
                        (HMENU)wparam != GetSubMenu( mh2, 5 ) ) {
                ShowWindow( info->alloc_dialog, SW_HIDE );
            }
        }
        return( DefWindowProc( hwnd, msg, wparam, lparam ) );
        break;
    case WM_COMMAND:
        switch( wparam ) {
        case HEAPMENU_ABOUT:
            ai.owner = hwnd;
            ai.inst = Instance;
            ai.name = HWAllocRCString( STR_ABOUT_NAME );
            ai.version = HWAllocRCString( STR_ABOUT_VERSION );
            ai.title = HWAllocRCString( STR_ABOUT_TITLE );
            DoAbout( &ai );
            HWFreeRCString( ai.title );
            HWFreeRCString( ai.version );
            HWFreeRCString( ai.name );
            break;
        case HEAPMENU_HELP_CONTENTS:
            WWinHelp( hwnd, "heapwalk.hlp", HELP_CONTENTS, 0 );
            break;
        case HEAPMENU_HELP_SRCH:
            WWinHelp( hwnd, "heapwalk.hlp", HELP_PARTIALKEY, (HELP_DATA)(LPCSTR)"" );
            break;
        case HEAPMENU_HELP_ON_HELP:
            WWinHelp( hwnd, "winhelp.hlp", HELP_HELPONHELP, 0 );
            break;
        case HEAPEX_LIST:
            if( !info->doing_add ) {
                if( HIWORD( lparam ) == LBN_DBLCLK ) {
                    ShowHeapObject( (HWND)LOWORD( lparam ) );
                }
            } else {
                if( HIWORD( lparam ) == LBN_SELCHANGE
                    || HIWORD( lparam ) == LBN_DBLCLK ) {
                    RefreshAdd( info->add_dialog, info->list.box );
                    RedrawBox( info->list.box, index );
                }
            }
            break;
        case HEAPMENU_GLOBAL_REFRESH:
            InitHeapList( info->list.box, TRUE );
            break;
        case HEAPMENU_FONT:
            if( ChooseMonoFont( hwnd ) ) {
                ResetFont( info );
            }
            break;
        case HEAPMENU_EXIT:
            DestroyWindow( hwnd );
            FreeHeapList();
            break;
        case HEAPMENU_DISPLAY_DPMI:
        case HEAPMENU_DISPLAY_ENTIRE:
        case HEAPMENU_DISPLAY_LRU:
        case HEAPMENU_DISPLAY_FREE:
            SetDisplayType( hwnd, &( info->list.title ), wparam );
            InitHeapList( info->list.box, FALSE );
            break;
        case HEAPMENU_SORT_ADDR:
        case HEAPMENU_SORT_HANDLE:
        case HEAPMENU_SORT_MODULE:
        case HEAPMENU_SORT_SIZE:
        case HEAPMENU_SORT_TYPE:
        case HEAPMENU_SORT_GRAN:
        case HEAPMENU_SORT_DPL:
        case HEAPMENU_SORT_FLAG:
        case HEAPMENU_SORT_LRU:
            mh = GetMenu( hwnd );
            CheckMenuItem( mh, GSortType, MF_UNCHECKED | MF_BYCOMMAND );
            CheckMenuItem( mh, wparam, MF_CHECKED | MF_BYCOMMAND );
            if( GSortType != wparam ) {
                GSortType = wparam;
                SortHeapList();
                ReDisplayHeapList( info->list.box, NULL );
            }
            break;
        case HEAPMENU_OBJECT_SHOW:
            ShowHeapObject( info->list.box );
            break;
        case HEAPMENU_OBJECT_DISCARD:
            if( GlobDiscardObj( info->list.box ) ) {
                InitHeapList( info->list.box, TRUE );
            }
            break;
        case HEAPMENU_OBJECT_NEWEST:
            if( GlobSetObjPos( info->list.box, FALSE ) ) {
                if( GSortType == HEAPMENU_SORT_LRU ) {
                    InitHeapList( info->list.box, TRUE );
                }
            }
            break;
        case HEAPMENU_OBJECT_OLDEST:
            if( GlobSetObjPos( info->list.box, TRUE ) ) {
                if( GSortType == HEAPMENU_SORT_LRU ) {
                    InitHeapList( info->list.box, TRUE );
                }
            }
            break;
        case HEAPMENU_OBJECT_GET_SELECTOR:
            ShowSelector( info->list.box );
            break;
        case HEAPMENU_GLOBAL_HEAPINFO:
            DisplayGlobHeapInfo( hwnd );
            break;
        case HEAPMENU_GLOBAL_MEMORYINFO:
            DisplayMemManInfo( hwnd );
            break;
        case HEAPMENU_GLOBAL_COMPACT:
            GlobalCompact( 0 );
            InitHeapList( info->list.box, TRUE );
            break;
        case HEAPMENU_GLOBAL_COMP_DISC:
            GlobalCompact( -1 );
            InitHeapList( info->list.box, TRUE );
            break;
        case HEAPMENU_GLOBAL_CODE_SIZE:
            dlgproc = MakeProcInstance_DLG( SetCodeDlgProc, Instance );
            JDialogBox( Instance, "CODE_AREA_DLG", hwnd, dlgproc );
            FreeProcInstance_DLG( dlgproc );
            break;
        case HEAPMENU_FILE_SAVE:
            InitHeapList( info->list.box, TRUE );
            SaveListBox( SLB_SAVE_TMP, PutOutGlobalHeader, DumpGlobalLine, Config.gfname, HeapWalkName, hwnd, info->list.box );
            break;
        case HEAPMENU_FILE_SAVE_TO:
            InitHeapList( info->list.box, TRUE );
            SaveListBox( SLB_SAVE_AS, PutOutGlobalHeader, DumpGlobalLine, Config.gfname, HeapWalkName, hwnd, info->list.box );
            break;
        case HEAPMENU_SAVE_CONFIG:
            SaveConfigFile( TRUE );
            break;
        case HEAPMENU_CONFIGURE:
            HWConfigure();
            break;
        case HEAPMENU_LOCAL_MONITOR:
            index = CheckForLocalSelect( info );
            if( index != LB_ERR ) {
                BeginMonitor( HeapList[index] );
            }
            break;
        case HEAPMENU_COMPACT_AND_LOCALWALK:
            LocalCompact( -1 );
            /* fall through */
        case HEAPMENU_LOCAL_LOCALWALK:
            index = CheckForLocalSelect( info );
            if( index != LB_ERR ) {
                LocalWalk( HeapList[index] );
            }
            break;
        case HEAPMENU_GDI_LOCALWALK:
            if( GetDGroupItem( "GDI", &hl ) ) {
                LocalWalk( &hl );
            }
            break;
        case HEAPMENU_USER_LOCALWALK:
            if( GetDGroupItem( "USER", &hl ) ) {
                LocalWalk( &hl );
            }
            break;
        case HEAPMENU_FREE_ALL:
            MyFreeAllMem();
            UpdateAllocInfo( info->alloc_dialog );
            PaintAllWindows();
            break;
        case HEAPMENU_FREE_1K:
        case HEAPMENU_FREE_2K:
        case HEAPMENU_FREE_5K:
        case HEAPMENU_FREE_10K:
        case HEAPMENU_FREE_25K:
        case HEAPMENU_FREE_50K:
            hourglass = LoadCursor( NULL, IDC_WAIT );
            SetCapture( hwnd );
            oldcursor= SetCursor( hourglass );
            FreeSomeMem( wparam );
            UpdateAllocInfo( info->alloc_dialog );
            SetCursor( oldcursor );
            ReleaseCapture();
            PaintAllWindows();
            break;
        case HEAPMENU_ALLOC_1K:
        case HEAPMENU_ALLOC_2K:
        case HEAPMENU_ALLOC_5K:
        case HEAPMENU_ALLOC_10K:
        case HEAPMENU_ALLOC_25K:
        case HEAPMENU_ALLOC_50K:
            hourglass = LoadCursor( NULL, IDC_WAIT );
            SetCapture( hwnd );
            oldcursor= SetCursor( hourglass );
            AllocMore( wparam );
            UpdateAllocInfo( info->alloc_dialog );
            SetCursor( oldcursor );
            ReleaseCapture();
            PaintAllWindows();
            break;
        case HEAPMENU_ALLOC_ALL:
        case HEAPMENU_ALLOC_BUT_1K:
        case HEAPMENU_ALLOC_BUT_2K:
        case HEAPMENU_ALLOC_BUT_5K:
        case HEAPMENU_ALLOC_BUT_10K:
        case HEAPMENU_ALLOC_BUT_25K:
        case HEAPMENU_ALLOC_BUT_50K:
            hourglass = LoadCursor( NULL, IDC_WAIT );
            SetCapture( hwnd );
            oldcursor= SetCursor( hourglass );
            AllocAllBut( wparam );
            UpdateAllocInfo( info->alloc_dialog );
            SetCursor( oldcursor );
            ReleaseCapture();
            PaintAllWindows();
            break;
        case HEAPMENU_ALLOC_NK:
        case HEAPMENU_ALLOC_BUT_NK:
        case HEAPMENU_FREE_NK:
            DoNBytes( hwnd, wparam );
            UpdateAllocInfo( info->alloc_dialog );
            PaintAllWindows();
            break;
        case HEAPMENU_ADD:
            info->add_dialog = StartAdd( hwnd, &info->list );
            if( info->add_dialog != NULL ) {
                info->doing_add = TRUE;
                info->need_refresh = FALSE;
            } else {
                ErrorBox( hwnd, STR_UNABLE_TO_ADD,
                          MB_OK| MB_ICONINFORMATION );
            }
            break;
        }
        break;
    case WM_USER:
        /* an owned window is being destroyed make sure
         * Windows doesn't take the focus away from us*/
        NoRefresh = TRUE;
        SetFocus( hwnd );
        NoRefresh = FALSE;
        break;
    default:
        return( DefWindowProc( hwnd, msg, wparam, lparam ) );
    }
    return( FALSE );

} /* HeapWalkProc */