Today in the learning status bar , There are a lot of problems , Record here .

To create a status bar, use :CreateStatusWindow

CreateStatusWindow Function to create a status window , Usually used to show the state of an application . The window is usually displayed at the bottom of the parent window , It contains the specified text .

HWND CreateStatusWindow(

LONG, // Status bar style

LPCTSTR, // The first string pointer to display

HWND, // Parent window handle

UINT); // The control identifier of the status window

Parameters

【 style 】

The window style of the status window . This parameter must contain WS_CHILD style , And it should also include WS_VISIBLE style .

【lpszText】

Pointer to a null terminated string that specifies the status text of the first part .

【hwndParent】

Process to parent window .

【wID】

The control identifier of the status window . The window procedure uses this value to identify the message sent to the parent window .

Return value

If the function succeeds , The return value is the handle to the status window .

If the function fails , The return value is NULL.

remarks

CreateStatusWindow Function call CreateWindow Function creation window . It passes parameters to CreateWindow Without modification , And will position,width and height The parameter is set to the default value .

So you can also use CreateWindow To create , Let's talk about this later .

// This is the global status bar handle I created HWND hWndStatus
// You also need to define a status bar by yourself ID Number
#define IDC_STATUS1 10001

stay OnInitDialog() Function to add :

hWndStatus = ::CreateStatusWindow(WS_CHILD | WS_VISIBLE | SBS_SIZEGRIP,
NULL, m_hWnd, IDC_STATUS1); // Create status bar

RECT rect;
GetClientRect(m_hWnd, &rect); // Get the size of the window
int nWith = rect.right / 6; // Divide the window into six parts

// This is the width of each grid , I don't understand why it's like this , The head is a little big , You said it was x The coordinates are not right either ,
// I'm dividing it into three squares , The first grid point 4 Share , therefore * There's a 4, Both of the latter two take a share ,
// If it's the last one to fill the remaining space, write the last one as -1, The array format is :
//int nWiths[3]={nWitch,nWitch*2,-1};

int nWiths[3] = { nWith * 4,nWith * 5,nWith * 6 }; ::SendMessage(hWndStatus, SB_SETPARTS, 3, (LPARAM)(long)nWiths);
::MoveWindow(hWndStatus, 0, 0, 0, 0, TRUE);

It's basically like this

A blank , There is nothing .

// Write to the corresponding grid in the state ,WPARAM The parameter is the index value of the format
::SendMessage(hWndStatus, SB_SETTEXT, 0, (long)TEXT(" Be ready "));
::SendMessage(hWndStatus, SB_SETTEXT, 1, (long)TEXT(" system time "));
::SendMessage(hWndStatus, SB_SETTEXT, 2, (long)TEXT(" system time 2"));

Finally, in the form WM_SIZE The notification status bar in the message adapts itself to the size of the form ,

RECT rect;
GetClientRect(m_hWnd, &rect);
int nWith = rect.right / 6;
int sWiths[3] = { nWith * 4 ,nWith * 5,nWith * 6 }; ::SendMessage(hWndStatus, SB_SETPARTS, 3, (LPARAM)(long)sWiths);
::MoveWindow(hWndStatus, 0, 0, 0, 0, TRUE);

That's about it , The rest will be studied later

win32 sdk Environment to create the status bar more related articles

  1. windows Create... In the environment . Folder

    One .windows Create... In the environment . Folder 1. Create a new folder 2. Rename it to .properties.( Add a little before and after the name ) Two .windows Create... In the environment . file 1. The same applies to documents 2. function CMD, ...

  2. ROS Tutorial of navigation : stay catkin Create... In the environment costmap layer plugin

    When doing robot navigation , I must have seen global_costmap and local_costmap.global_costmap It's for global path planning service , How can I get from this room to that room .local_costma ...

  3. centos The method of creating database and table under environment

    centos The method of creating database and table under environment // The command to query the database : mysql> SHOW DATABASES; +--------------------+ | Database         ...

  4. Multithreading programming Windows Create a new thread in the environment

    from : http://www.cnblogs.com/lgxqf/archive/2009/02/10/1387480.html stay Win32 API in , The basic function to create a thread is CreateThre ...

  5. stay Windows In the stand-alone environment to create RabbitMQ colony

    This article is based on :http://www.360doc.com/content/15/0312/17/20874412_454622619.shtml Sort it out RabbitMQ It has good message passing performance , At the same time, it's open ...

  6. stay Win32 Application Environment implementation MFC Window creation

    // Win32 Next MFC.cpp : Defines the entry point for the application.// #include "stdafx.h" clas ...

  7. Win32 SDK Programming starts , create a window , Handling of messages , Message loop

    Windows SDK The general procedure of programming is : 1. Register window class , The structure used WNDCLASSEX, function RegisterClassEx. 2. create a window , function CreateWindowEx. 3 ...

  8. cocos2d-x v3.0 Create projects and compile in various environments 、 The executive authorities DEMO

    Excerpt from :https://github.com/cocos2d/cocos2d-x/ How to create a new project How to start a new game Download the code from co ...

  9. docker Create... In the environment overlay Network plan

    One . Environmental Science Three machines , One of them is installed with consul(192.168.1.21), Two stations create networks (192.168.1.32,33) Two . Implementation steps 1. Constructing environment 1) Three machines deployed docker Environmental Science 2) Choose one ...

  10. centos7 No network environment based on scratch mirrored Linux Mirror image , with Java Running environment

    One . Get ready Will download okay jdk as well as scratch The images are placed in the same folder : Put it here. linux:2.0 Two . Import scratch Mirror image #docker load -i scratch.tar 3、 ... and . establish dockerf ...

Random recommendation

  1. Python Summary of abnormal error reporting in the foundation

    Today we're going to explore python Most of the exceptions in the report error First of all, what is the exception , Abnormal vernacular explanation is abnormal , In the program, the input format of the programmer is not standard , Or the parameter type of the requirement does not correspond to , Not all. Wait . For example, many companies send Apple notebooks at the end of the year , you ...

  2. OC Basic data type -NSSet

    1. aggregate : aggregate (NSSet) And an array (NSArray) There are similarities , It's all the addresses where different objects are stored : however NSArray It's an orderly collection ,NSSet It's an unordered set . A set is a hash table , Using hash algorithm , Find elements in the collection than arrays ...

  3. 【iOS Development 】 Enterprise Certificate ($299)In-House How to publish a guide ( turn )

    One . Define a few concepts 1. Enterprise Edition IDP: namely iOS Development Enterprise Program. Note that $299/Year That kind of , Not at all $99/Year That kind of . 2.In House: It's a business ...

  4. windows mysql install 、 To configure

    One .MySQL The download : Above picture , We choose the community version of the red box section to download ,MySQL Support many platforms : My operating system is 64 Bit , Select the corresponding version MSI Download version , eject login Interface , choice no thanks,just ...

  5. ExceL turn PDF

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using Excel = ...

  6. DataFrame Mode of operation

    DataFrame/DataSet operation Databricks I mentioned more than once that I hope to write in the future Spark During the application process , For structured / Semi-structured data , Use Datasets(DataFrame An extension of ) ...

  7. Chapter one :Python introduction

    One . Programming and programming languages The purpose of programming : The invention of the computer , It's to replace... With machines / Liberate people , The purpose of programming is to transfer the human thought process to the computer in a way that can be recognized by the computer , So that the computer can be like a human brain / It's automatic like a computer ...

  8. python analysis json Introduction to the document

    One .JSON brief introduction JSON(JavaScript Object Notation) Is a lightweight data exchange format . It's based on JavaScript(Standard ECMA-262 3rd Edition ...

  9. 【Python】Xml To Excel

    [Python3] In the previous introductory exercise, there is a question that will excel File to xml file , This time, I'll make up for the reverse transformation →xml to excel Use or beautifulsoup. Mainly still :① Read the text content of the file to be processed ② It's about ...

  10. Jmeter Yes HTTP Request a stress test 、 A simple way to use concurrent testing

    The experience of server performance testing is negligible . We have to try to understand the knowledge of testing . First of all, our demand scenario is as follows : Server hardware :( Only one ) System :Windows 2003 WebServer:Tomca ...