当前位置: 编程技术>其它
本页文章导读:
▪MFC弹出选择目录对话框 代码如下:LPMALLOC lpMalloc;if(::SHGetMalloc(&lpMalloc)!=NOERROR){AfxMessageBox("选择下载目录操作出错");return;}char szDisplayName[_MAX_PATH];char szBuffer[_MAX_PATH];BROWSEINFO browseInfo;browseInfo.hwndOwner=thi.........
▪VC判断目录是否存在及遍历目录指定的文件. // MakePhotoLog.cpp : Defines the entry point for the console application.#include "stdafx.h"#pragma pack(1)typedef struct __tag_file_info{ DWORD &n.........
▪bullet setp 流程 好的 我要开始新篇了新篇是Bullet的刚开始看Bullet时 代码不熟 看后忘前 不过 怎么说呢 那我就每天看 草于是 我就明白了先看看那个step函数:
1void btDiscreteDynamicsWorld::inte.........
[1]MFC弹出选择目录对话框
代码如下:
LPMALLOC lpMalloc;
if(::SHGetMalloc(&lpMalloc)!=NOERROR)
{
AfxMessageBox("选择下载目录操作出错");
return;
}
char szDisplayName[_MAX_PATH];
char szBuffer[_MAX_PATH];
BROWSEINFO browseInfo;
browseInfo.hwndOwner=this->m_hWnd;
browseInfo.pidlRoot=NULL;
browseInfo.pszDisplayName=szDisplayName;
browseInfo.lpszTitle="请选择下载文件的存储路径";
browseInfo.ulFlags=BIF_RETURNFSANCESTORS|BIF_RETURNONLYFSDIRS;
browseInfo.lpfn=NULL;
browseInfo.lParam=0;
LPITEMIDLIST lpItemIDList;
if((lpItemIDList=::SHBrowseForFolder(&browseInfo))!=NULL)
{
if(::SHGetPathFromIDList(lpItemIDList,szBuffer))
{
if(szBuffer[0]=='\0')
{
AfxMessageBox("Fail to get directory",MB_ICONSTOP|MB_OK);
return;
}
DownFileDirectory=szBuffer;
}
else
{
AfxMessageBox("Fail to get directory!",MB_ICONSTOP|MB_OK);
return;
}
lpMalloc->Free(lpItemIDList);
lpMalloc->Release();
}
CString strMsg;
strMsg.Format("选择目录为:%s",DownFileDirectory);
AfxMessageBox(strMsg);
if(::SHGetMalloc(&lpMalloc)!=NOERROR)
{
AfxMessageBox("选择下载目录操作出错");
return;
}
char szDisplayName[_MAX_PATH];
char szBuffer[_MAX_PATH];
BROWSEINFO browseInfo;
browseInfo.hwndOwner=this->m_hWnd;
browseInfo.pidlRoot=NULL;
browseInfo.pszDisplayName=szDisplayName;
browseInfo.lpszTitle="请选择下载文件的存储路径";
browseInfo.ulFlags=BIF_RETURNFSANCESTORS|BIF_RETURNONLYFSDIRS;
browseInfo.lpfn=NULL;
browseInfo.lParam=0;
LPITEMIDLIST lpItemIDList;
if((lpItemIDList=::SHBrowseForFolder(&browseInfo))!=NULL)
{
if(::SHGetPathFromIDList(lpItemIDList,szBuffer))
{
if(szBuffer[0]=='\0')
{
AfxMessageBox("Fail to get directory",MB_ICONSTOP|MB_OK);
return;
}
DownFileDirectory=szBuffer;
}
else
{
AfxMessageBox("Fail to get directory!",MB_ICONSTOP|MB_OK);
return;
}
lpMalloc->Free(lpItemIDList);
lpMalloc->Release();
}
CString strMsg;
strMsg.Format("选择目录为:%s",DownFileDirectory);
AfxMessageBox(strMsg);
王海光 2013-01-10 16:25 发表评论
[2]VC判断目录是否存在及遍历目录指定的文件.
// MakePhotoLog.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#pragma pack(1)
typedef struct __tag_file_info
{
DWORD length; //文件长度
DWORD crc32; //暂未使用
char name[38];//文件名
char res[4];
} file_info; //Total = 50
#pragma pack()
long GetLocalFileSize(const char* szFileName)
{
struct stat f_stat;
if (stat(szFileName, &f_stat) == -1) {
return -1;
}
return (long)f_stat.st_size;
}
BOOL IsDirectory(CString strPath)
{
WIN32_FIND_DATA wfd;
HANDLE hFind = FindFirstFile(strPath, &wfd);
BOOL bRet = ((hFind!=INVALID_HANDLE_VALUE) && (wfd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY));
FindClose(hFind);
return bRet;
}
int main(int argc, char *argv[])
{
WIN32_FIND_DATA wfd;
HANDLE hFind;
CString strPath;
CString strFileName;
CString strFind;
CString strJpgFile;
if (argc<2)
{
printf("Usage:%s <photo-log path>\r\n",argv[0]);
return -1;
}
strPath = argv[1];
if (!IsDirectory(strPath))
{
printf("\"%s\" not found\r\n",argv[1]);
return -1;
}
PathAddBackslash(strPath.GetBuffer(strPath.GetLength()+2));
strPath.ReleaseBuffer();
strFileName = strPath;
strFileName += "photo_log.dat";
FILE* fp = fopen("photo_log.dat","w+b");
if (fp==NULL)
{
printf("open \"%s\" error \r\n",(LPCTSTR)strFileName);
return -1;
#include "stdafx.h"
#pragma pack(1)
typedef struct __tag_file_info
{
DWORD length; //文件长度
DWORD crc32; //暂未使用
char name[38];//文件名
char res[4];
} file_info; //Total = 50
#pragma pack()
long GetLocalFileSize(const char* szFileName)
{
struct stat f_stat;
if (stat(szFileName, &f_stat) == -1) {
return -1;
}
return (long)f_stat.st_size;
}
BOOL IsDirectory(CString strPath)
{
WIN32_FIND_DATA wfd;
HANDLE hFind = FindFirstFile(strPath, &wfd);
BOOL bRet = ((hFind!=INVALID_HANDLE_VALUE) && (wfd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY));
FindClose(hFind);
return bRet;
}
int main(int argc, char *argv[])
{
WIN32_FIND_DATA wfd;
HANDLE hFind;
CString strPath;
CString strFileName;
CString strFind;
CString strJpgFile;
if (argc<2)
{
printf("Usage:%s <photo-log path>\r\n",argv[0]);
return -1;
}
strPath = argv[1];
if (!IsDirectory(strPath))
{
printf("\"%s\" not found\r\n",argv[1]);
return -1;
}
PathAddBackslash(strPath.GetBuffer(strPath.GetLength()+2));
strPath.ReleaseBuffer();
strFileName = strPath;
strFileName += "photo_log.dat";
FILE* fp = fopen("photo_log.dat","w+b");
if (fp==NULL)
{
printf("open \"%s\" error \r\n",(LPCTSTR)strFileName);
return -1;
[3]bullet setp 流程
好的
我要开始新篇了
新篇是Bullet的
刚开始看Bullet时 代码不熟 看后忘前 不过 怎么说呢 那我就每天看 草
于是 我就明白了
先看看那个step函数:
我要开始新篇了
新篇是Bullet的
刚开始看Bullet时 代码不熟 看后忘前 不过 怎么说呢 那我就每天看 草
于是 我就明白了
先看看那个step函数:
1void btDiscreteDynamicsWorld::internalSingleStepSimulation(btScalar timeStep)
2{
3
4 BT_PROFILE("internalSingleStepSimulation");
5
6 if(0 != m_internalPreTickCallback) {
7 (*m_internalPreTickCallback)(this, timeStep);
8 }
9
10 /**////apply gravity, predict motion
11 predictUnconstraintMotion(timeStep);
12
13 btDispatcherInfo& dispatchInfo = getDispatchInfo();
14
15 dispatchInfo.m_timeStep = timeStep;
16 dispatchInfo.m_stepCount = 0;
17 dispatchInfo.m_debugDraw = getDebugDrawer();
18
19
20 createPredictiveContacts(timeStep);
21
22
2{
3
4 BT_PROFILE("internalSingleStepSimulation");
5
6 if(0 != m_internalPreTickCallback) {
7 (*m_internalPreTickCallback)(this, timeStep);
8 }
9
10 /**////apply gravity, predict motion
11 predictUnconstraintMotion(timeStep);
12
13 btDispatcherInfo& dispatchInfo = getDispatchInfo();
14
15 dispatchInfo.m_timeStep = timeStep;
16 dispatchInfo.m_stepCount = 0;
17 dispatchInfo.m_debugDraw = getDebugDrawer();
18
19
20 createPredictiveContacts(timeStep);
21
22
最新技术文章:
 
站内导航:
特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!