了解回调 [英] Understanding callback

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

问题描述

你好,


我见过WndProc原型的两种方式,


LONG WINAPI WndProc(....);



LRESULT CALLBACK WndProc(....);


这些在功能上是否相同?

什么是WINAPI和CALLBACK定义为?

为什么有两种方法可以解决这个问题?


谢谢。

-


.--------------------。

| |

|晚安.... | .-- .--。

| | 。 ; | ;. ;。

` -------------。 ,---''。; _;''`; _;。

\ | ; ;''`; ;

\ ;;''。 - .___.--。`;;

;-(o)= 3D(o) - ;

(` - ''|` - '')

\ | 。 。 | /

............ 。:::::。 。 .______

/。 ''---。 ''\

。''` 。''\

| ____,.-。 | `.....''| _______ |

| , - ''\ / | \''''\ .-- |

| / \。''\ /,''。 \。 - |

| / | ``\ / \ |

| ,/ _''/''\ |

, - '', - 。 | o''

/''| | | | \

/,/ | | o | \`

| 。''| |。''|。 \ \

________ / .''____ | ________________________ || __`。 `__________

(\)/)

'' - 。 - 。 (.-`。 - `

'' - 。 - '' - .__。 - .__ .--` - 。 - `

' ' - ..''\ - '':〜`:= 3D,` - `..-`

\ .. \\ |` - ''|` - ,/

\\\\\\\)| |` - ''/。''/

\)\)\\` - ''` - ''

`

解决方案

kid joe< sp ****** @ spamtrap.invalidwrites:


我见过WndProc原型的两种方式,


LONG WINAPI WndProc(....);



LRESULT CALLBACK WndProc(....);


这些在功能上是否相同?

什么是WINAPI和CALLBACK定义为?

为什么有两种方法可以解决这个问题?



这些是特定于Windows的。如果你发布到comp.os.ms-windows.programmer.win32,你会得到更好的信息




请使用更短的签名。


-

Keith Thompson(The_Other_Keith) ks *** @ mib.org < http://www.ghoti.net/~kst>

诺基亚

我们必须做点什么。这是事情。因此,我们必须这样做。

- Antony Jay和Jonathan Lynn,Yes Minister


kid joe写道:


你好,


我见过WndProc原型的两种方式,


LONG WINAPI WndProc(....);



LRESULT CALLBACK WndProc(....);


Are这些功能相当吗?



在32位窗口下它们是等价的。

在64位窗口下它们不是因为LRESULT

是64位类型和LONG是32位类型...


什么是WINAPI和CALLBACK定义为?



WINAPI在32位窗口中是_stdcall

CALLBACK也定义为_stdcall。


在64位窗口下_stdcall不存在

所以两个定义也是等价的,

可能定义为什么都没有。

-

jacob navia

jacob at jacob point remcomp point fr

logiciels / informatique
http://www.cs.virginia.edu/~lcc-win32


On Sat,2008年11月1日22:13:40 +0100,jacob navia写道:


kid joe写道:


>你好,

我看过WndProc原型有两种方式,

LONG WINAPI WndProc(....);

LRESULT CALLBACK WndProc(....);

这些在功能上是否相同?



在32位窗口下它们是等价的。

在64位窗口下它们不是因为LRESULT

是64位类型和LONG是32位类型...


>什么是WINAPI和CALLBACK定义为?



WINAPI在32位窗口中是_stdcall

CALLBACK也定义为_stdcall。


在64位窗口下_stdcall不存在

因此两个定义也是等价的,

可能定义为什么都没有。



非常感谢您的信息。


我想唯一剩下的问题是,为什么这两个不同

相同功能的原型,即使它们功能相同吗?


Joe

-

.--------------------。

| |

|晚安.... | .-- .--。

| | 。 ; | ;. ;。

` -------------。 ,---''。; _;''`; _;。

\ | ; ;''`; ;

\ ;;''。 - .___.--。`;;

;-(o)= 3D(o) - ;

(` - ''|` - '')

\ | 。 。 | /

............ 。:::::。 。 .______

/。 ''---。 ''\

。''` 。''\

| ____,.-。 | `.....''| _______ |

| , - ''\ / | \''''\ .-- |

| / \。''\ /,''。 \。 - |

| / | ``\ / \ |

| ,/ _''/''\ |

, - '', - 。 | o''

/''| | | | \

/,/ | | o | \`

| 。''| |。''|。 \ \

________ / .''____ | ________________________ || __`。 `__________

(\)/)

'' - 。 - 。 (.-`。 - `

'' - 。 - '' - .__。 - .__ .--` - 。 - `

' ' - ..''\ - '':〜`:= 3D,` - `..-`

\ .. \\ |` - ''|` - ,/

\\\\\\\)| |` - ''/。''/

\)\)\\` - ''` - ''

`


Hello,

I have seen the WndProc prototyped two ways,

LONG WINAPI WndProc ( .... );
and
LRESULT CALLBACK WndProc ( .... );

Are these functionally equivalent?
What are WINAPI and CALLBACK defined as?
Why are there two ways to go about this?

Thanks.
--

.--------------------.
| |
| Good Evening.... | .--.--.
| | .; .;|;. ;.
`-------------. ,---'' .;_;'' `;_;.
\| ; ;'' `; ;
\ ;;''.--.___.--.`;;
;-( o )=3D( o )-;
( `--'' | `--'' )
\| . . |/
........... . .:::::. . .______
/ . ''---` . ''\
.'' `. .'' \
| ____,.- . | `.....'' | _______ |
| ,-'' \ /|\'''' \.-- |
| / \.''\ /,''. \. - |
| /| ` `\ / \ |
| ,/ _ ''/ ''\ |
,-'' ,-. |o ''
/ ''| | | | \
/ ,/| |o | \ `
| .'' | |.'' |. \ \
________/ .''____|________________________||__`. `__________
( \ ) / )
''-. ''-. ( .-` .-`
''-. .-''--.__. .-.__.--`-. .-`
''-..'' \--'' : ~`:=3D,`- `..-`
\ .. \\ |`-''|`-, /
\\\\\\\) | |`-''/.''/
\)\)\\ `-'' `-''
`

解决方案

kid joe <sp******@spamtrap.invalidwrites:

I have seen the WndProc prototyped two ways,

LONG WINAPI WndProc ( .... );
and
LRESULT CALLBACK WndProc ( .... );

Are these functionally equivalent?
What are WINAPI and CALLBACK defined as?
Why are there two ways to go about this?

These are specific to Windows. You''ll get much better information
if you post to comp.os.ms-windows.programmer.win32.

And please use a shorter signature.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"


kid joe wrote:

Hello,

I have seen the WndProc prototyped two ways,

LONG WINAPI WndProc ( .... );
and
LRESULT CALLBACK WndProc ( .... );

Are these functionally equivalent?

Under 32 bit windows they are equivalent.
Under 64 bit windows they are not since LRESULT
is a 64 bit type and LONG is a 32 bit type...

What are WINAPI and CALLBACK defined as?

WINAPI is _stdcall in 32 Bit windows
CALLBACK is also defined as _stdcall.

Under 64 bit windows _stdcall doesn''t exist
so both definitions are equivalent too,
probably defined as nothing.
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32


On Sat, 01 Nov 2008 22:13:40 +0100, jacob navia wrote:

kid joe wrote:

>Hello,

I have seen the WndProc prototyped two ways,

LONG WINAPI WndProc ( .... );
and
LRESULT CALLBACK WndProc ( .... );

Are these functionally equivalent?


Under 32 bit windows they are equivalent.
Under 64 bit windows they are not since LRESULT
is a 64 bit type and LONG is a 32 bit type...

>What are WINAPI and CALLBACK defined as?


WINAPI is _stdcall in 32 Bit windows
CALLBACK is also defined as _stdcall.

Under 64 bit windows _stdcall doesn''t exist
so both definitions are equivalent too,
probably defined as nothing.

Thanks a lot for the info.

I guess the only remaining question is, why are there these two different
prototypes for the same function, even if they''re functionally equivalent?

Joe
--
.--------------------.
| |
| Good Evening.... | .--.--.
| | .; .;|;. ;.
`-------------. ,---'' .;_;'' `;_;.
\| ; ;'' `; ;
\ ;;''.--.___.--.`;;
;-( o )=3D( o )-;
( `--'' | `--'' )
\| . . |/
........... . .:::::. . .______
/ . ''---` . ''\
.'' `. .'' \
| ____,.- . | `.....'' | _______ |
| ,-'' \ /|\'''' \.-- |
| / \.''\ /,''. \. - |
| /| ` `\ / \ |
| ,/ _ ''/ ''\ |
,-'' ,-. |o ''
/ ''| | | | \
/ ,/| |o | \ `
| .'' | |.'' |. \ \
________/ .''____|________________________||__`. `__________
( \ ) / )
''-. ''-. ( .-` .-`
''-. .-''--.__. .-.__.--`-. .-`
''-..'' \--'' : ~`:=3D,`- `..-`
\ .. \\ |`-''|`-, /
\\\\\\\) | |`-''/.''/
\)\)\\ `-'' `-''
`


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

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