《 VC++ 技术内幕》 dll 问题求教
在visual Studio 2008(中文)下编译。
代码如下:
//PERSIST.cpp
//Persist.cpp Persistent frame class for SDI apps
#include "stdafx.h"
#include "persist.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = _FILE_;
#endif
/////////////////////////////////////////////////
//CPersistentFrame
const CRect CPersistentFrame::s_rectDefault( 10, 10, 500, 400);//static
const char CPersistentFrame::s_profileHeading[] = "Window size";
const char CPersistentFrame::s_profileRect[] = "Rect";
const char CPersistentFrame::s_profileIcon[] = "icon";
const char CPersistentFrame::s_profileMax[] = "max";
const char CPersistentFrame::s_profileTool[] = "tool";
const char CPersistentFrame::s_profileStatus[] = "status";
IMPLEMENT_DYNAMIC(CPersistentFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CPersistentFrame, CFrameWnd)
//{{AFX_MSG_MAP(CPersistentFrame)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//////////////////////////////////////////////////////////////////////
CPersistentFrame::~CPersistentFrame()
{
m_bFirstTime = TRUE;
}
//////////////////////////////////////////////////////////////////////
/*CPersistentFrame::~CPersistentFrame()
{
}*/
//////////////////////////////////////////////////////////////////////
void CPersistentFrame::OnDestroy()
{
CString strText;
BOOL bIconic,bMaximized;
WINDOWPLACEMENT wndpl;
//gets current window position and iconized/maximized status
BOOL bRet = GetWindowPlacement(&wndpl);
if(wndpl.showCmd == SW_SHOWNORMAL){
bIconic = FALSE;
bMaximized = FALSE;
}
else if (wndpl.showCmd == SW_SHOWMAXIMIZED){
bIconic = FALSE;
bMaximized = FALSE;
}
else if (wndpl.showCmd == SW_SHOWMINIZED){
bIconic = TURE;
if(wndpl.flags){
bMaximized = TRUE;
}
else{
bMaxmized = FALSE;
}
}
strText.Format("%04d %04d %04d %04d",
wndpl.rcNormalPosition.left,
wndpl.rcNormalPosition.top,
wndpl.rcNormalPosition.right,
wndpl.rcNormalPosition.bottom);
AfxGetApp()->WriteProfileString(s_profileHeading, s_profileRect, strText);
AfxGetApp()->WriteProfileInt(s_profileHeading, s_profileIcon, bIconic);
AfxGetApp()->WriteProfileInt(s_profileHeading, s_profileMax, bMaximized);
SaveBarState(AfxGetApp()->m_pszProfileName);
CFrameWnd::OnDestroy();
}
/////////////////////////////////////////////////////////////////////////////////
void CPersistentFrame::ActivateFrame(int nCmdShow)
{
CString strText;
BOOL bIconic,bMaximized;
UINT flags;
WINDOWPLACEMENT wndpl;
CRect rect;
if(m_bFirstTime){
m_bFirstTime = FALSE;
strText = AfxGetApp()->GetProfileString(s_profileHeading, s_profileRect);
if(!strText.IsEmpty()){
rect.left = atoi((const char*)strText);
rect.top = atoi((const char*)strText +5);
rect.right = atoi((const char*)strText +10);
rect.bottom = atoi((const char*)strText +15);
}
else{
rect = s_rectDefault;
}
bIconic = AfxGetApp()->GetProfileInt(s_profileHeading, s_profileIcon, 0);
bMaximized = AfxGetApp()->GetProfileInt(s_profileHeading, s_profileMax, 0);
if(bIconic){
nCmdShow = SW_SHOWMINNOACTIVE;
if(bMaximized){
flags = WPF_RESTORETOMAXIMIZED;
}
else {
flags = WPF_SETMINPOSITION;
}
}
else {
if(bMaximized){
nCmdShow = SW_SHOWMAXIMIZED;
flags = WPF_RESTORETOMAXIMIZED;
}
else {
nCmdShow = SW_NORMAL;
flags = WPF_SETMINPOSITION;
}
}
wndpl.length = sizeof(WINDOWPLACEMENT);
wndpl.showCmd = nCmdShow;
wndpl.flags = flags;
wndpl.ptMinPosition = CPoint(0, 0);
wndpl.ptMaxPosition = CPoint(-::GetSystemMetrics(SM_CXBORDER), -::GetSystemMetrics(SM_CYBORDER));
wndpl.rcNormalPosition = rect;
//sets window's position and minimized status
BOOL bRet = SetWindowPlacement(&wndpl);
}
CFrameWnd::ActivateFrame(nCmdShow);
}错误如下:
1>正在编译...
1>PERSIST.cpp
1>d:\work\mfc\ex21a\ex21a\persist.cpp(7) : error C2065: “_FILE_”: 未声明的标识符
1>d:\work\mfc\ex21a\ex21a\persist.cpp(35) : error C2509: “OnDestroy”: 成员函数没有在“CPersistentFrame”中声明
1> d:\work\mfc\ex21a\ex21a\persist.h(5) : 参见“CPersistentFrame”的声明
1>d:\work\mfc\ex21a\ex21a\persist.cpp(80) : error C2664: “CWinApp::GetProfileStringW”: 不能将参数 1 从“const char [12]”转换为“LPCTSTR”
1> 与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换
1>d:\work\mfc\ex21a\ex21a\persist.cpp(82) : error C2440: “类型转换”: 无法从“CString”转换为“const char *”
1> 没有可用于执行该转换的用户定义的转换运算符,或者无法调用该运算符
1>d:\work\mfc\ex21a\ex21a\persist.cpp(83) : error C2440: “类型转换”: 无法从“CString”转换为“const char *”
1> 没有可用于执行该转换的用户定义的转换运算符,或者无法调用该运算符
1>d:\work\mfc\ex21a\ex21a\persist.cpp(84) : error C2440: “类型转换”: 无法从“CString”转换为“const char *”
1> 没有可用于执行该转换的用户定义的转换运算符,或者无法调用该运算符
1>d:\work\mfc\ex21a\ex21a\persist.cpp(85) : error C2440: “类型转换”: 无法从“CString”转换为“const char *”
1> 没有可用于执行该转换的用户定义的转换运算符,或者无法调用该运算符
1>d:\work\mfc\ex21a\ex21a\persist.cpp(90) : error C2664: “CWinApp::GetProfileIntW”: 不能将参数 1 从“const char [12]”转换为“LPCTSTR”
1> 与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换
1>d:\work\mfc\ex21a\ex21a\persist.cpp(91) : error C2664: “CWinApp::GetProfileIntW”: 不能将参数 1 从“const char [12]”转换为“LPCTSTR”
1> 与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换
1>生成日志保存在“file://d:\work\MFC\ex21a\ex21a\Debug\BuildLog.htm”
1>ex21a - 9 个错误,0 个警告
请问高手:如何解决?
相关推荐
InjectDll:VC++ DLL注入技术实战详解
本文还有配套的精品资源,点击获取 简介:DLL注入是一种技术,它将动态链接库(DLL)加载到另一个进程的地址空间中,使得DLL中的函数可以在目标进程中执行。这种技术广泛应用于软件开发、调试及恶意软件。本源码包展示了如何使用VC++实现DLL注入的全过程,包括创建DLL、获取进程句柄、映射DLL到目标进程、加载DLL和执行DLL导出函数。同时,考虑到安全性,本文也强调了合法和...
VC++技术内幕第四版源码实战解析
简介:《VC++技术内幕第四版》深入讲解了Microsoft Visual C++的核心编程技术,配套源码“vcpp32”为书中理论提供了实践支持,涵盖32位平台下的开发实例。本书内容涉及MFC框架、Win32 API、COM组件、多线程编程、STL标准库、DLL动态链接库、异常处理等关键技术,结合Visual Studio调试与优化工具,帮助开发者掌握Windows系统级程序设计。通过学习和运行源码,读者可深入理解VC++的底层机制与高级特性,提升C++在Windows平台上的开发能力。
无人机手势控制数据集46176张VOC+YOLO格式.zip
数据集格式:VOC格式+YOLO格式 压缩包内含:3个文件夹,分别存储图片、xml、txt文件 JPEGImages文件夹中jpg图片总计:46176 Annotations文件夹中xml文件总计:46176 labels文件夹中txt文件总计:46176 标签种类数:8 标签名称:["follow","follow_hand","land","land_hand","null","object","takeoff","takeoff-hand"] 每个标签的框数(注意yolo格式类别顺序不和这个对应,而以labels文件夹classes.txt为准): follow 框数 = 22056 follow_hand 框数 = 4038 land 框数 = 7609 land_hand 框数 = 3300 null 框数 = 2642 object 框数 = 2 takeoff 框数 = 3494 takeoff-hand 框数 = 3645 总框数:46786 图片清晰度(分辨率:像素):清晰 图片是否增强:否 标签形状:矩形框,用于目标检测识别 重要说明:暂无 特别声明:本数据集不对训练的模型或者权重文件精度作任何保证,数据集只提供准确且合理标注
三相光伏发电系统中MPPT和并网控制策略的研究(Simulink仿真实现)
内容概要:本文系统研究了三相光伏发电系统中的最大功率点跟踪(MPPT)与并网控制策略,深入分析光伏阵列在不同光照和温度条件下的输出特性,设计并实现了基于Simulink的完整仿真模型。该模型涵盖光伏阵列、DC-DC变换器、MPPT控制器、逆变器及锁相环等关键模块,重点验证了系统在动态环境变化下实现高效能量转换的能力,并确保并网电流符合电能质量标准。研究对比了多种MPPT算法的动态响应与稳定性表现,优化了并网控制策略以提升整体系统性能,为光伏系统的设计与控制提供了理论依据与仿真支持。; 适合人群:具备电力电子、自动控制或新能源发电基础知识的高校研究生、科研人员及从事光伏系统设计与仿真的工程技术人员。; 使用场景及目标:①用于教学与科研中深入理解光伏发电系统的MPPT原理与并网控制机制;②指导实际工程项目中光伏逆变器控制策略的设计与仿真验证;③为撰写相关学术论文或完成课程设计提供可复现的Simulink模型与理论支持。; 阅读建议:建议读者结合文中提供的Simulink仿真文件,逐步搭建系统模型,调试MPPT与并网控制参数,观察关键波形如光伏电压、电流、功率及并网电流的变化,加深对控制逻辑的理解。同时可尝试改进算法以进一步提升系统动态响应与鲁棒性。
无人驾驶网约车服务:全球市场规模、竞争格局与未来发展趋势.docx
无人驾驶网约车服务:全球市场规模、竞争格局与未来发展趋势


进程/线程/DLL
