VerySource

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1027|回复: 9

新人的疑问,大家帮忙看看。

[复制链接]

3

主题

7

帖子

8.00

积分

新手上路

Rank: 1

积分
8.00
发表于 2020-1-16 17:40:01 | 显示全部楼层 |阅读模式
数声明为
void CDib::LoadFile(const char* dibFileName);
CStrig finame;
问题如下

CDib c;
CFileDialog   dlg(true,"*.bmp",NULL,OFN_HIDEREADONLY   |   OFN_OVERWRITEPROMPT,  "256   bmp   Files   (*.bmp)|*.bmp||",NULL);
if(IDOK==dlg.DoModal ())       
filename.Format ("%s",dlg.GetPathName() );
c.LoadFile(filename);
可以完成
CStrig的结构是什么?

如果直接用一句
c.LoadFile("c:\XX.bmp");
就无法完成文件的加载
这是为什么?


为什么用画笔生成的bmp文件不能用?

CFile dibFile(m_fileName,CFile::modeRead);
这句是什么意思

filename.Format ("%s",dlg.GetPathName() );
这句是什么意思


CFileDialog   dlg(true,"*.bmp",NULL,OFN_HIDEREADONLY   |   OFN_OVERWRITEPROMPT,  "256   bmp   Files   (*.bmp)|*.bmp||",NULL);
这句是什么意思

file.WriteHuge((LPSTR)m_pDemH, DemHeader.iDemX * DemHeader.iDemY * sizeof(int));
这是什么意思file.WriteHuge和file.Write有什么区别?

HDC  ,  CDC   ,HWND有什么区别?

如何出现分裂窗框架,就是有一个主视图,还有一个副视图,象cs里的,副视图可以提供一些别的信息。

为了能快速入门这些问题可能问的白了点但是还是希望大侠回答细致一点。我怕看不懂。





回复

使用道具 举报

1

主题

27

帖子

24.00

积分

新手上路

Rank: 1

积分
24.00
发表于 2020-1-21 10:09:01 | 显示全部楼层
关注
回复

使用道具 举报

0

主题

59

帖子

43.00

积分

新手上路

Rank: 1

积分
43.00
发表于 2020-1-24 03:27:01 | 显示全部楼层
c.LoadFile("c:\XX.bmp");
改为:
c.LoadFile("c:\\XX.bmp");

CFile dibFile(m_fileName,CFile::modeRead);
这一句是构造一个CFile对象并且为读模式,但不打开文件

-----------------
晕~你好像每一句都看不懂,不是吧?
回复

使用道具 举报

0

主题

18

帖子

6.00

积分

新手上路

Rank: 1

积分
6.00
发表于 2020-1-24 10:36:02 | 显示全部楼层
同意楼上
回复

使用道具 举报

0

主题

57

帖子

27.00

积分

新手上路

Rank: 1

积分
27.00
发表于 2020-1-24 11:27:02 | 显示全部楼层
感觉LZ的C++匆匆过了一遍,然后直接跑去搞MFC,而且也不知道MSDN为啥物
回复

使用道具 举报

0

主题

9

帖子

7.00

积分

新手上路

Rank: 1

积分
7.00
发表于 2020-1-24 20:36:02 | 显示全部楼层

如果直接用一句
c.LoadFile("c:\XX.bmp");
就无法完成文件的加载
这是为什么?=============c.LoadFile("c:\\XX.bmp");



为什么用画笔生成的bmp文件不能用?==========为什么不能用?你从内存中拷贝,保存为位图可以吧?

CFile dibFile(m_fileName,CFile::modeRead);
这句是什么意思=========这一句是构造一个CFile对象并且为读模式,但不打开文件


filename.Format ("%s",dlg.GetPathName() );
这句是什么意思=====把文件路径存为cstring格式变量


CFileDialog   dlg(true,"*.bmp",NULL,OFN_HIDEREADONLY   |   OFN_OVERWRITEPROMPT,  "256   bmp   Files   (*.bmp)|*.bmp||",NULL);
这句是什么意思=======打开文件对话框

file.WriteHuge((LPSTR)m_pDemH, DemHeader.iDemX * DemHeader.iDemY * sizeof(int));
这是什么意思file.WriteHuge和file.Write有什么区别?
=======来自MSDN  很详细 自己看看
Writes data from a buffer to the file associated with the CFile object. WriteHuge throws an exception in response to several conditions, including the disk-full condition.

This function differs from Write in that more than 64K–1 bytes of data can be written by WriteHuge. This function can be used by any object derived from CFile.

Note   WriteHuge is provided only for backward compatibility. WriteHuge and Write have the same semantics under Win32.


HDC  ,  CDC   ,HWND有什么区别?====分别是设备环境句柄  设备环境类  窗口句柄

如何出现分裂窗框架,就是有一个主视图,还有一个副视图,象cs里的,副视图可以提供一些别的信息。===这个估计难一些,可以使用opengl的对视口,或者vc 一个透明悬浮窗口~
回复

使用道具 举报

3

主题

7

帖子

8.00

积分

新手上路

Rank: 1

积分
8.00
 楼主| 发表于 2020-2-6 21:15:01 | 显示全部楼层
其实这些函数的大概意思我都知道的,只是里面的参数意义不明白,希望能解释解释。
回复

使用道具 举报

0

主题

59

帖子

43.00

积分

新手上路

Rank: 1

积分
43.00
发表于 2020-2-7 11:00:01 | 显示全部楼层
看MSDN
回复

使用道具 举报

0

主题

9

帖子

8.00

积分

新手上路

Rank: 1

积分
8.00
发表于 2020-2-7 18:00:02 | 显示全部楼层
贴msdn^-^
CFileDialog::CFileDialog
CFileDialog( BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL );

Parameters

bOpenFileDialog

Set to TRUE to construct a File Open dialog box or FALSE to construct a File Save As dialog box.

lpszDefExt

The default filename extension. If the user does not include an extension in the Filename edit box, the extension specified by lpszDefExt is automatically appended to the filename. If this parameter is NULL, no file extension is appended.

lpszFileName

The initial filename that appears in the filename edit box. If NULL, no filename initially appears.

dwFlags

A combination of one or more flags that allow you to customize the dialog box. For a description of these flags, see theOPENFILENAME structure in the Win32 SDK documentation. If you modify the m_ofn.Flags structure member, use a bitwise-OR operator in your changes to keep the default behavior intact.

lpszFilter

A series of string pairs that specify filters you can apply to the file. If you specify file filters, only selected files will appear in the Files list box. See the Remarks section for more information on how to work with file filters.

pParentWnd

A pointer to the file dialog-box object’s parent or owner window.

Remarks

Call this function to construct a standard Windows file dialog box-object. Either a File Open or File Save As dialog box is constructed, depending on the value of bOpenFileDialog.

To allow the user to select multiple files, set the OFN_ALLOWMULTISELECT flag before calling DoModal. You need to supply your own filename buffer to accommodate the returned list of multiple filenames. Do this by replacing m_ofn.lpstrFile with a pointer to a buffer you have allocated, after constructing the CFileDialog, but before calling DoModal. Additionally, you must set m_ofn.nMaxFile with the number of characters in the buffer pointed to by m_ofn.lpstrFile.

To allow the user to resize an Explorer-style dialog box using either the mouse or keyboard, set the OFN_ENABLESIZING flag. Setting this flag is necessary only if you provide a hook procedure or custom template. The flag works only with an Explorer-style dialog box; old-style dialog boxes do not permit resizing.

The lpszFilter parameter is used to determine the type of filename a file must have to be displayed in the file list box. The first string in the string pair describes the filter; the second string indicates the file extension to use. Multiple extensions may be specified using ‘;’ as the delimiter. The string ends with two ‘|’ characters, followed by a NULL character. You can also use a CString object for this parameter.

For example, Microsoft Excel permits users to open files with extensions .XLC (chart) or .XLS (worksheet), among others. The filter for Excel could be written as:

static char BASED_CODE szFilter[] = "Chart Files (*.xlc)|*.xlc|Worksheet Files (*.xls)|*.xls|Data Files (*.xlc;*.xls)|*.xlc; *.xls|All Files (*.*)|*.*||";

回复

使用道具 举报

0

主题

9

帖子

8.00

积分

新手上路

Rank: 1

积分
8.00
发表于 2020-2-7 18:30:01 | 显示全部楼层
CFile::WriteHuge
void WriteHuge( const void* lpBuf, DWORD dwCount );
throw( CFileException );

Parameters

lpBuf

A pointer to the user-supplied buffer that contains the data to be written to the file.

dwCount

The number of bytes to be transferred from the buffer. For text-mode files, carriage return–linefeed pairs are counted as single characters.

Remarks

Writes data from a buffer to the file associated with the CFile object. WriteHuge throws an exception in response to several conditions, including the disk-full condition.

This function differs from Write in that more than 64K–1 bytes of data can be written by WriteHuge. This function can be used by any object derived from CFile.

Note   WriteHuge is provided only for backward compatibility. WriteHuge and Write have the same semantics under Win32.

得了我也不贴了^-^
自己找着看吧^-^
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

快速回复 返回顶部 返回列表