⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exestartmodule.cpp

📁 VC++编程
💻 CPP
字号:
// EXEStartModule.cpp : Defines the entry point for the application.
//

//
// NOTES
// =====
//
// For using this demo you have to build the sfxLoader with
// '_STARTMODULE_IS_EXE' defined take a look at the 'Loader.h'
//
#include "stdafx.h"


LPTSTR FindNextParameter(LPTSTR lpStr)
{
	if (lpStr)
	{
		lpStr= strchr(++lpStr, *lpStr=='"'? '"' : ' ');
		if (lpStr)
		{
			++lpStr;
			while (*lpStr && *lpStr==' ') ++lpStr;
			if (*lpStr)	return lpStr;
		}
	}

	return NULL;
}



int APIENTRY WinMain(HINSTANCE /*hInstance*/,
                     HINSTANCE /*hPrevInstance*/,
                     LPSTR     /*lpCmdLine*/,
                     int       /*nCmdShow*/)
{
	LPTSTR pCmdLine= GetCommandLine();

	//NOTE: The second parameter of pCmdLine is the full path
	//to the sfx file where the UserData is
	//NOTE: the sfx path name is always quoted.

	LPTSTR pSFXFile;
	pSFXFile= FindNextParameter(pCmdLine);
	PathUnquoteSpaces(pSFXFile); //remove quotes

	HANDLE hSFX= CreateFile(pSFXFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
	if (hSFX==INVALID_HANDLE_VALUE)
	{
		MessageBox(NULL, _T("Failed to Open the SFX!?"), NULL, MB_OK|MB_ICONERROR);
		return -200;
	}

	//From here you can do anything you want with the SFX file.


	MessageBox(NULL, pSFXFile, _T("Hello World!"), MB_OK|MB_ICONINFORMATION);


	CloseHandle(hSFX);
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -