GetComboBoxInfo函数和COMBOBOXINFO结构

wjx_0_2001 2010-04-07 10:53:09
环境 :WINXP PROFESSIONAL SP3+ vc6.0

在stdafx.h

加入了
#include <winuser.h>
#include <windows.h>

#if(WINVER >= 0x0500)

BOOL GetComboBoxInfo(PCOMBOBOXINFO pcbi) const;

#endif// WINVER >= 0x050


但在编译时,还是报GetComboBoxInfo,和COMBOBOXINFO未声明


==================
是不是在XP下不能用这个函数

但也不太可能啊

==========
网上,我搜了下

大都是上面说的

但实际上还是不行





...全文
614 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
VC_ZSY 2010-04-07
  • 打赏
  • 举报
回复
GetComboBoxInfo函数确实MFC里面没有·SDK里面有
BOOL GetComboBoxInfo(
HWND hwndCombo, // handle to combo box
PCOMBOBOXINFO pcbi // combo box information
);
你只要定义一下#define WINVER 0x0500 ,再包含文件#include <winuser.h>,就可以使用了,不需要你那样声明··
VC_ZSY 2010-04-07
  • 打赏
  • 举报
回复

#if !defined(AFX_STDAFX_H__D8D614A7_BECE_49BB_9696_7A856359EB42__INCLUDED_)
#define AFX_STDAFX_H__D8D614A7_BECE_49BB_9696_7A856359EB42__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#define WINVER 0x0500
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls

#endif // _AFX_NO_AFXCMN_SUPPORT
#include <winuser.h>
#include <windows.h>
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STDAFX_H__D8D614A7_BECE_49BB_9696_7A856359EB42__INCLUDED_)
拷贝过去···
COMBOBOXINFO info;
info.cbSize = sizeof(COMBOBOXINFO);
PCOMBOBOXINFO pcbi = &info;
CComboBox combox;
GetComboBoxInfo(combox,pcbi);
这样使用··就可以了··试过了
wjx_0_2001 2010-04-07
  • 打赏
  • 举报
回复
奇怪,在VC6中 CCOMBOBOX函数里面就没有这个成员函数

MSDN中也没有这个
wjx_0_2001 2010-04-07
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 vc_zsy 的回复:]
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#if !defined(AFX_STDAFX_H__D8D614A……
[/Quote]

你试过没有

我就是这样放的,也不行
wjx_0_2001 2010-04-07
  • 打赏
  • 举报
回复
CComboBox::GetComboBoxInfo我在用时,没有这个成员函数

只有::GetComboBoxInfo
VC_ZSY 2010-04-07
  • 打赏
  • 举报
回复
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#if !defined(AFX_STDAFX_H__D8D614A7_BECE_49BB_9696_7A856359EB42__INCLUDED_)
#define AFX_STDAFX_H__D8D614A7_BECE_49BB_9696_7A856359EB42__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers

#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <winuser.h>
#include <windows.h>
#if(WINVER >= 0x0500)
BOOL GetComboBoxInfo(PCOMBOBOXINFO pcbi) const;
#endif// WINVER >= 0x050
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STDAFX_H__D8D614A7_BECE_49BB_9696_7A856359EB42__INCLUDED_)
VC_ZSY 2010-04-07
  • 打赏
  • 举报
回复
如果你是想用这个函数
CComboBox::GetComboBoxInfo
BOOL GetComboBoxInfo(
PCOMBOBOXINFO pcbi
) const;
是不需要包含头文件的,默认已经包含了#include <afxwin.h>
如果是想用
BOOL GetComboBoxInfo(
HWND hwndCombo, // handle to combo box
PCOMBOBOXINFO pcbi // combo box information
);
则需要包含你说的那个头文件
VC_ZSY 2010-04-07
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 wjx_0_2001 的回复:]

引用 1 楼 vc_zsy 的回复:
可以那样用啊,我试过了``是不是你位置放错了?


大侠,你具体怎么放的?
给指点下
[/Quote]
直接拷贝你的代码,放到stdafx.h下就可以用
wjx_0_2001 2010-04-07
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 vc_zsy 的回复:]
可以那样用啊,我试过了``是不是你位置放错了?
[/Quote]

大侠,你具体怎么放的?
给指点下
wjx_0_2001 2010-04-07
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 zhaoxueqian1988 的回复:]
#if(WINVER >= 0x0500)

BOOL GetComboBoxInfo(PCOMBOBOXINFO pcbi) const;

#endif// WINVER >= 0x050

==================================================

你这是如果是想声明函数的话,那么跟SDK函数重名了
[/Quote]

那又该怎么来声明呢?
wjx_0_2001 2010-04-07
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 vc1000 的回复:]
LZ意图是什么啊?
GetComboBoxInfo()函数的原型如下:
BOOL GetComboBoxInfo(
HWND hwndCombo, // handle to combo box
PCOMBOBOXINFO pcbi // combo box information
);
[/Quote]

我什么意图?

我的意图就是我想用这个函数

但现在用不了
jogger007 2010-04-07
  • 打赏
  • 举报
回复
#if(WINVER >= 0x0500)

BOOL GetComboBoxInfo(PCOMBOBOXINFO pcbi) const;

#endif// WINVER >= 0x050

==================================================

你这是如果是想声明函数的话,那么跟SDK函数重名了
vc1000 2010-04-07
  • 打赏
  • 举报
回复
LZ意图是什么啊?
GetComboBoxInfo()函数的原型如下:
BOOL GetComboBoxInfo(
HWND hwndCombo, // handle to combo box
PCOMBOBOXINFO pcbi // combo box information
);
VC_ZSY 2010-04-07
  • 打赏
  • 举报
回复
可以那样用啊,我试过了``是不是你位置放错了?

16,472

社区成员

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

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

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