为什么无法将自定义数据传递给SetAbortProc [英] Why can not pass custom data to SetAbortProc

查看:75
本文介绍了为什么无法将自定义数据传递给SetAbortProc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。

我使用PRINTDLG来获取打印设备上下文的hDC,并调用SetAbortProc将CALLBACK AbortProc传递给它:

Hello guys.
I use PRINTDLG to get a hDC to a print device context, and call SetAbortProc to pass a CALLBACK AbortProc to it:

BOOL CALLBACK myAbortProc( HDC hdc, int iError );
SetAbortProc( HBC hDC, AbortProc myAbortProc );

在许多情况下,此代码已足够。但是如果我们想要两个或多个打印作业同时工作(超过连接到PC的打印机),我们需要一种机制来知道哪个打印作业称为AbortProc。

我希望找到这个函数的扩展版本如下:

This code is sufficient in many cases. But in case we want to have two or more print jobs working simultaniously(more than a printer connected to a PC), we need a mechanism to know which print job has called AbortProc.
I expected to find extended versions of this functions as this:

BOOL CALLBACK myAbortProcExt( HDC hdc, int iError, void * pContext );
SetAbortProcExt( HDC hDC, AbortProcExt myAbortProcExt, void * pContext );

但是在Visual Studio 2010中这些都没有实现。

因为我想避免静态数据一般来说,任何机构都可以向我展示一种将自定义数据传递给AbortProc的方法吗?有没有办法将指针传递到DC的自定义数据?

提前谢谢

mr.abzadeh



编辑:一个拼写错误更正

but in visual studio 2010 these are not implemented.
As I want to avoid static data in general, Can any body show me a way to pass custom data to AbortProc? Is there a way to pass a pointer to customdata to DC's?
Thanks in advance
mr.abzadeh

one misspelling corrected

推荐答案

这与Visual Studio无关; Visual Studio是一个IDE,它不是计算机语言,也不是API / SDK。 SetAbortProc()函数是由Microsoft创建的,这就是您必须使用的功能。如果它不允许参数化调用,那么你将不得不使用静态数据。
This has nothing to do with Visual Studio; Visual Studio is an IDE, it is not a computer language, nor is it an API/SDK. The SetAbortProc() function is as created by Microsoft, and that's what you have to work with. If it does not allow a parameterised call then you will have to use static data.


这篇关于为什么无法将自定义数据传递给SetAbortProc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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