请求高手帮忙,谢谢!!

Computer123 2003-11-15 08:07:51
VC中有时候定义一个函数时,前面为什么会加LRESULT PASCAL FAR等等这样的标号,我找了很多资料,始终没弄明白那是什么意思!请各位指点,小弟我感激不尽!!谢谢!!
...全文
55 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
lovenoend 2003-11-16
  • 打赏
  • 举报
回复
LRESULT 是 DWORD
dzqsuper 2003-11-15
  • 打赏
  • 举报
回复
友情up
vcforever 2003-11-15
  • 打赏
  • 举报
回复
LRESULT是窗口过程或回调函数的返回值,他是一个32位值
窗口过程是处理窗口接收的消息的地方,一般窗口过程都定义成回调函数(用CALLBACK来标识)

CALLBACK是一种函数调用的约定,这种约定的特点是:
使用这种函数调用约定的函数,按从右到左的顺序压参数入栈,有被调用者把参数弹出栈

FAR PASCAL也是一种函数调用约定等价于CALLBACK
都是对__stdcall的typedef

如:
typedef __stdcall CALLBACK
typedef __stdcall FAR PASCAL

希望对你有所帮助!
enoloo 2003-11-15
  • 打赏
  • 举报
回复
General Data Types
Home | Overview | How Do I

The following table summarizes the new standard types defined in WINDOWS.H. These types are polymorphic (they can contain different kinds of data) and are generally useful throughout applications. Other new types, handles, and function pointers also are introduced in other topics (listed in New Types and Macros). Also seeSimple Types in the Win32 documentation.

Typedef Description
WINAPI Use in place of FAR PASCAL in API declarations. If you are writing a DLL with exported API entry points, you can use this for your own APIs.
CALLBACK Use in place of FAR PASCAL in application callback routines such as window procedures and dialog procedures.
LPCSTR Same as LPSTR, except used for read-only string pointers. Defined as (const char FAR*).
UINT Portable unsigned integer type whose size is determined by host environment (32 bits for Windows NT and Windows 95). Synonym for unsigned int. Used in place of WORD except in the rare cases where a 16-bit unsigned quantity is desired even on 32-bit platforms.
LRESULT Type used for return value of window procedures.
LPARAM Type used for declaration of lParam, the fourth parameter of a windows procedure.
WPARAM Type used for declaration of wParam, the third parameter of a windows procedure (a polymorphic data type).
LPVOID Generic pointer type, equivalent to (void *). Should be used instead of LPSTR.


--------------------------------------------------------------------------------
Send feedback to MSDN.Look here for MSDN Online resources.
kingofvc 2003-11-15
  • 打赏
  • 举报
回复
你确认找过很多资料? 下面是最基础的资料里面的(msdn)
LRESULT A 32-bit value returned from a window procedure or callback function.
Obsolete Calling Conventions
Home | Overview | How Do I

The __pascal, __fortran, and __syscall calling conventions are no longer supported. You can emulate their functionality by using one of the supported calling conventions and appropriate linker options.

WINDOWS.H now supports the WINAPI macro, which translates to the appropriate calling convention for the target. Use WINAPI where you previously used PASCAL or __far __pascal.

far里面虽然没写 我想应该是16位系统中的那个far吧 跟near对应 现在也废弃了

16,551

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Creator Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧