CreateThread函数的多个参数 [英] multiple arguments to CreateThread function

查看:545
本文介绍了CreateThread函数的多个参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用CreateThread API方法时,我想做什么 在传递LPVOID lpParameter的地方传递多个参数?

解决方案

您可以创建一个包含所有相关数据的结构,并将指向该结构实例的指针(填充有适当的参数)传递给CreateThread()

在线程创建功能中,您需要将LPVOID强制转换回指向您的结构的指针才能使用它.

When I use the CreateThread API method, what do I need to do when I want to pass more than one parameter where LPVOID lpParameter is passed?

解决方案

You can create a structure that holds all relevant data and pass a pointer to an instance of that structure (filled with the appropriate parameters) to CreateThread()

In your thread creation function you will need to cast the LPVOID back to a pointer to your structure to use it.

这篇关于CreateThread函数的多个参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆