今天用VS2017编译一下fxckBGI时出现BeaEngine.obj : error LNK2001: 无法解析的外部符号 _sprintf网上查了一下,“旧”的原因。
解决方法是在相应项目的“链接器”-“输入”-“附加依赖项”添加legacy_stdio_definitions.lib再重新编译就可以了。
也可以在源文件里加
1 |
#pragma comment(lib,"legacy_stdio_definitions.lib") |
... [查看更多]
今天用VS2017编译一下fxckBGI时出现BeaEngine.obj : error LNK2001: 无法解析的外部符号 _sprintf网上查了一下,“旧”的原因。
解决方法是在相应项目的“链接器”-“输入”-“附加依赖项”添加legacy_stdio_definitions.lib再重新编译就可以了。
也可以在源文件里加
1 |
#pragma comment(lib,"legacy_stdio_definitions.lib") |
... [查看更多]
念住向GalPhotoAuto加处理*.gal的功能,不过最后因为Gale.spi静系可以返回24位的图片,坑之。
下边代码可以系Visual Studio 2012直接编译。一,源码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
#include "stdafx.h" #include <windows.h> //--------------------------------------------------------------------------- typedef struct PictureInfo { long left, top; // 起点坐标 long width; // 宽度 long height; // 高度 WORD x_density; // 水平方向密度 WORD y_density; // 垂直方向密度 short colorDepth; // 色深 HLOCAL hInfo; // 图像中的文本信息 } PictureInfo; //--------------------------------------------------------------------------- typedef int (__stdcall *SPI_GetPluginInfo)(int infono, LPSTR buf, int buflen); typedef int (__stdcall *SPI_IsSupported)(LPSTR filename, DWORD dw); typedef int (__stdcall *SPI_GetPictureInfo)(LPSTR buf, long len, unsigned int flag, struct PictureInfo *lpInfo); typedef int (CALLBACK *SPI_PROGRESS)(int, int, long); typedef int (__stdcall *SPI_GetPicture)(LPSTR buf, long len, unsigned int flag, HANDLE *pHBInfo, HANDLE *pHBm, SPI_PROGRESS lpPrgressCallback, long lData); typedef int (__stdcall *SPI_GetPreview)(LPSTR buf, long len, unsigned int flag, HANDLE *pHBInfo, HANDLE *pHBm, FARPROC lpPrgressCallback, long lData); typedef int (__stdcall *SPI_ConfigurationDlg)(HWND parent, int fnc); SPI_GetPluginInfo GetPluginInfo; SPI_IsSupported IsSupported; SPI_GetPictureInfo GetPictureInfo; SPI_GetPicture GetPicture; SPI_GetPreview GetPreview; SPI_ConfigurationDlg ConfigurationDlg; HMODULE handle; //--------------------------------------------------------------------------- bool spi_load(char *spipath) { bool ret = false; handle = LoadLibrary(spipath); if (NULL != handle) { GetPluginInfo = (SPI_GetPluginInfo)GetProcAddress(handle, "GetPluginInfo"); IsSupported = (SPI_IsSupported)GetProcAddress(handle, "IsSupported"); GetPictureInfo = (SPI_GetPictureInfo)GetProcAddress(handle, "GetPictureInfo"); GetPicture = (SPI_GetPicture)GetProcAddress(handle, "GetPicture"); GetPreview = (SPI_GetPreview)GetProcAddress(handle, "GetPreview"); ConfigurationDlg = (SPI_ConfigurationDlg)GetProcAddress(handle, "ConfigurationDlg"); ret = (NULL != IsSupported) & (NULL != GetPictureInfo) & (NULL != GetPicture); } return ret; } //--------------------------------------------------------------------------- void spi_info(void) { const int SPIINFO_SIZE = 256; char spiinfo[SPIINFO_SIZE]; int ret; char *mes[] = {"Plug-in API 版本: ", "Plug-in名字、版本和版权:", "文件后缀名:", "文件格式名称:"}; for (int i=0; i < 4; i++) { printf(mes[i]); ret = (*GetPluginInfo)(i, spiinfo, SPIINFO_SIZE); if (0 != ret) { printf(spiinfo); printf("\n"); } else { printf("NULL\n"); return; } } } //--------------------------------------------------------------------------- bool spi_check(char *filepath) { FILE *fp; fopen_s(&fp, filepath, "rb"); if (NULL == fp) { fprintf(stderr, "文件不能打开。\n"); return false; } const int HEADBUF_SIZE = 2000; char h_buf[HEADBUF_SIZE]; memset(h_buf, 0, HEADBUF_SIZE); fread(h_buf, 1, HEADBUF_SIZE, fp); fclose(fp); char *pdata = h_buf; int ret = (*IsSupported)(filepath, (DWORD)pdata); if (0 == ret) { fprintf(stderr, "不支持的格式。\n"); return false; } return true; } //--------------------------------------------------------------------------- bool spi_picinfo(char *filepath) { PictureInfo picinfo; memset(&picinfo, 0, sizeof(picinfo)); int ret = (*GetPictureInfo)(filepath, 0, 0, &picinfo); if (0 != ret) { fprintf(stderr, "GetPictureInfo 错误: %d\n", ret); return false; } printf("left : %d\n", picinfo.left); printf("top : %d\n", picinfo.top); printf("width : %d\n", picinfo.width); printf("height : %d\n", picinfo.height); printf("x_density : %d\n", picinfo.x_density); printf("y_density : %d\n", picinfo.y_density); printf("colorDepth : %d\n", picinfo.colorDepth); printf("hInfo : "); if (NULL != picinfo.hInfo) { char *pinfo = (char *)GlobalLock(picinfo.hInfo); printf(pinfo); GlobalUnlock(picinfo.hInfo); GlobalFree(picinfo.hInfo); } else { printf("NULL\n"); } printf("\n"); return true; } //--------------------------------------------------------------------------- bool spi_pic(char *filepath) { HANDLE bmpinfo, bmpdata; int ret = (*GetPicture)(filepath, 0, 0, &bmpinfo, &bmpdata, NULL, 0); if (0 != ret) { fprintf(stderr, "GetPicture 错误:%d\n", ret); return false; } FILE *fp; fopen_s(&fp, "bmpinfo.bin", "wb"); char *pdata = (char *)LocalLock(bmpinfo); UINT size = LocalSize(bmpinfo); fwrite(pdata, 1, size, fp); LocalUnlock(bmpinfo); fclose(fp); fopen_s(&fp, "bmpdata.bin", "wb"); pdata = (char *)LocalLock(bmpdata); size = LocalSize(bmpdata); fwrite(pdata, 1, size, fp); LocalUnlock(bmpdata); fclose(fp); LocalFree(bmpinfo); LocalFree(bmpdata); return true; } //--------------------------------------------------------------------------- bool spi_Prepic(char *filepath) { HANDLE bmpinfo, bmpdata; int ret = (*GetPreview)(filepath, 0, 0, &bmpinfo, &bmpdata, NULL, 0); if (0 != ret) { fprintf(stderr, "GetPreview 错误:%d\n", ret); return false; } FILE *fp; fopen_s(&fp, "Prebmpinfo.bin", "wb"); char *pdata = (char *)LocalLock(bmpinfo); UINT size = LocalSize(bmpinfo); fwrite(pdata, 1, size, fp); LocalUnlock(bmpinfo); fclose(fp); fopen_s(&fp, "Prebmpdata.bin", "wb"); pdata = (char *)LocalLock(bmpdata); size = LocalSize(bmpdata); fwrite(pdata, 1, size, fp); LocalUnlock(bmpdata); fclose(fp); LocalFree(bmpinfo); LocalFree(bmpdata); return true; } //--------------------------------------------------------------------------- bool spi_dlg(int fnc) { int ret = (*ConfigurationDlg)(GetConsoleWindow(), fnc); if (0 != ret) { fprintf(stderr, "ConfigurationDlg 错误:%d\n", ret); return false; } return true; } int _tmain(int argc, _TCHAR* argv[]) { if (3 > argc) { return 0; } char *spiname = argv[1]; if (!spi_load(spiname)) { fprintf(stderr, "spi 文件载入失败。\n"); goto err; } char *filename = argv[2]; // 插件信息 spi_info(); // 检查SPI是否支持文件 if (!spi_check(filename)) goto err; // 取得图片文件的信息 if (!spi_picinfo(filename)) goto err; // 取得经过SPI处理过的BMP图片数据 if (!spi_pic(filename)) goto err; // 取得经过SPI处理过的BMP图片数据的预览图,一般都不会有人特别写结构的,多数直接挂接GetPicture if (!spi_Prepic(filename)) goto err; // 0 为显示插件的关于窗口,1 为显示设置窗口,2 为以后保留 if (!spi_dlg(0)) goto err; err: FreeLibrary(handle); system("pause"); return 0; } |
二,BMP数据合成例如,spi_pic 取得的 bmpdata 只是数据部分,bmpinfo 是再前一D的信息,仲差最开头的14位数据。
完整的BMP是:开头的14位数据 + bmpinfo + bmpdata
开头的14位数据:42 4D E6 E5 00 00 00 00 00 00 36 00 00 00... [查看更多]
补丁下载VS2012本来编译出来的VC++程序是唔支持XP的,不过先过咗几个月(仲念佢起码SP1),MS就发咗update-1了,其中话明支持XP了。
update-1官方下载(连网安装版):
http://www.microsoft.com/visualstudio/eng/downloads#d-visual-studio-2012-update
官方博客文章:
http://blogs.msdn.com/b/somasegar/archive/2012/11/26/visual-studio-2012-update-1-now-available.aspx... [查看更多]
一,定义条件进入CvGameCoreDLL目录打开“CvDefines.h”,可以找到下边四行。
1 2 3 4 |
#define NUM_CITY_PLOTS (21) #define CITY_HOME_PLOT (0) #define CITY_PLOTS_RADIUS (2) #define CITY_PLOTS_DIAMETER ((CITY_PLOTS_RADIUS*2) + 1) |
NUM_CITY_PLOTS 是城市工作的地块数量CITY_HOME_PLOT 是城市是位于那一个地块CITY_PLOTS_RADIUS 是工作范围半径CITY_PLOTS_DIAMETER 是工作范围这个正方形的长宽
他们的关系会在后面讲。二,城市范围的结构打开“CvGlobals.cpp”,找函数“void CvGlobals::init()”,再往下看。[crayon-6512e96643... [查看更多]
用Visual Studio 2010生成文件的清理命令时发现出现
1>------ 已启动清理: 项目: CvGameCoreDLL, 配置: Release Win32 ------1> 'nmake' 不是内部或外部命令,也不是可运行的程序1> 或批处理文件。1>D:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(33,5): error MSB3073: 命令“nmake Release_clean”已退出,代码为 9009。========== 清理... [查看更多]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
void filesys::cIShellLink(WCHAR* path, CString strTemp) { ::CoInitialize(NULL); //创建2个接口 CComPtr<IShellLink> spShellLink; HRESULT hr=spShellLink.CoCreateInstance(CLSID_ShellLink); CComPtr<IPersistFile> spPersistFile; //取得此EXE的文件名及路径 CString FileName; FileName.Format(_T("%s\\Civ4BeyondSword.exe"), path); hr=spShellLink->SetPath(FileName); CString ArgumentsName; TCHAR *ModName = strTemp.GetBuffer(strTemp.GetLength()); strTemp.ReleaseBuffer(); //加exe之后的加参数 ArgumentsName.Format(_T("mod=\\%s"), ModName); hr=spShellLink->SetArguments(ArgumentsName); hr=spShellLink->SetWorkingDirectory(path); hr=spShellLink->SetDescription(ModName); hr=spShellLink->QueryInterface(IID_IPersistFile, (void **)&spPersistFile); //取得桌面的全路径 LPITEMIDLIST pidl; hr = SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl); TCHAR szPath[1024]; SHGetPathFromIDList(pidl, szPath); //替换成当前登陆的用户名 CString Cstr1,Cstr2,Cstr3; Cstr1 = szPath; Cstr2.Format(_T("\\%s\\"), functions::Instance().GetProcessUser()); Cstr3.Format(_T("\\%s\\"), functions::Instance().GetLoginUser()); Cstr1.Replace(Cstr2, Cstr3); //创建快捷方式 CComBSTR strLinkFilePath( Cstr1 ); CString ShellLinkFileName; ShellLinkFileName.Format(_T("\\%s.lnk"),strTemp); strLinkFilePath.Append(ShellLinkFileName); hr=spPersistFile->Save(strLinkFilePath, TRUE); spPersistFile.Release(); spShellLink.Release(); ::CoUninitialize(); } |
下边可能要加,唔记得了。。。
1 2 3 4 5 |
#include <Wtsapi32.h> #pragma comment(lib, "Wtsapi32.lib") #include "psapi.h" #pragma comment(lib, "psapi.lib") |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
CString functions::GetProcessUser() { HANDLE hToken = NULL; TOKEN_USER *pTokenUser = NULL; CString re; if( OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &hToken) ) { DWORD dwNeedLen = 0; GetTokenInformation(hToken, TokenUser, NULL, 0, &dwNeedLen); if (0 < dwNeedLen) { pTokenUser = (TOKEN_USER*)new BYTE[dwNeedLen]; if ( GetTokenInformation(hToken, TokenUser, pTokenUser, dwNeedLen, &dwNeedLen) ) { SID_NAME_USE sn; WCHAR szDomainName[MAX_PATH]; DWORD dwDmLen = MAX_PATH; WCHAR szUserName[MAX_PATH]; DWORD nNameLen = MAX_PATH; LookupAccountSid(NULL, pTokenUser->User.Sid, szUserName, &nNameLen, szDomainName, &dwDmLen, &sn); re = szUserName; } } } if (hToken) ::CloseHandle(hToken); if (pTokenUser) delete[] (WCHAR*)pTokenUser; return re; } CString functions::GetLoginUser() { WCHAR* szLogName; DWORD dwSize; CString re; if (WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSUserName, &szLogName, &dwSize)) { re = szLogName; WTSFreeMemory(szLogName); } return re; } |
... [查看更多]
原版:http://forums.civfanatics.com/showthread.php?t=361905
阿根廷铁路 的 doc模组简介(原创——英文翻译)汉化版下载:(非独立汉化包,不需原版)RFC Dawn of Civilization.7z.001 ~ 004 (30M一个,分四个包,共119 MB)
说明:
1,仅支持 BTS 3.19 汉化/日文版,可以输入中文领导人名。
2,汉化内容为机器查找复制原汉化版RFC上的内容,所以并非完全汉化,另外由于城市名比较多,决定无视。安装说明1,下载四个7z压缩包,全部放在同一目录下... [查看更多]
2015Visual C++ Redistributable for Visual Studio 2015(x86/x64)https://www.microsoft.com/zh-CN/download/details.aspx?id=481452013Visual C++ Redistributable Packages for Visual Studio 2013(x86/x64)https://www.microsoft.com/zh-CN/download/details.aspx?id=407842012Visual C++ Redistributabl... [查看更多]