---
title: Start
description: "启动指令流客户端引擎。指令流客户端引擎会启动渲染线程，并启动网络连接。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengcps/boostcph/instrucstreamengine/kunpengcpsinstruction_17_0005.html
sourcePath: /source/zh/kunpengcps/boostcph/instrucstreamengine/kunpengcpsinstruction_17_0005.html
indexId: c57bed522d56bbfa1bdb13cc643890db24742722b73e67e64329b247fdcaa96d85
---
# Start

#### 函数功能

启动指令流客户端引擎。指令流客户端引擎会启动渲染线程，并启动网络连接。


#### 约束说明

调用者需在调用之前保证网络通道可用。


#### 函数原型

uint32_t Start(uint64_t surface, uint32_t width, uint32_t height, uint32_t densityDpi)


#### 参数说明

| 参数名称 | 输入/输出 | 参数类型 | 参数描述 |
| --- | --- | --- | --- |
| surface | 输入 | uint32\_t | Activity传下来的Surface控件对象，并通过Jni转换成ANativeWindow指针，再转成uint64\_t值。 |
| width | 输入 | uint32\_t | 设备屏幕的宽度，取值大于0。 |
| height | 输入 | uint32\_t | 设备屏幕的高度，取值大于0。 |
| densityDpi | 输入 | uint32\_t | 设备屏幕的像素密度，取值大于0。 |


#### 返回值说明

- VMI_SUCCESS：代表成功。
- VMI_CLIENT_INVALID_PARAM：表示非法参数。
- VMI_CLIENT_START_FAIL：表示指令流客户端启动失败。
- VMI_CLIENT_ALREADY_STARTED：表示指令流客户端已经处于运行状态。


#### 调用示例

```
void Test()  
{ 
     ANativeWindow *nativeWindow = ANativeWindow_fromSurface(env, surface);
     uint32_t result = Start(reinterpret_cast<uint64_t>(nativeWindow), width, height, densityDpi);  
     if (result == VMI_SUCCESS) {  
         // 指令流客户端启动成功，程序继续执行  
     } else {
        // 指令流客户端启动失败
     }
}
```
