rundllvb.cpp
资源名称:IE_VB.rar [点击查看]
上传用户:davilee3
上传日期:2015-04-22
资源大小:986k
文件大小:2k
源码类别:
浏览器
开发平台:
Visual Basic
- // rundllvb.cpp : Defines the entry point for the DLL application.
- //
- #include "stdafx.h"
- #include <windows.h>
- typedef int (CALLBACK *MYPROC)(int,int,int,int);
- typedef int (CALLBACK *dllreg)();
- BOOL APIENTRY DllMain( HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
- )
- {
- return TRUE;
- }
- int FAR PASCAL RegCom(LPCSTR lpDll,int isReg)
- {
- HINSTANCE hinstLib;
- dllreg ProcAdd;
- int rtn=-1;
- BOOL fFreeResult, fRunTimeLinkSuccess = FALSE;
- // Get a handle to the DLL module.
- hinstLib = LoadLibrary(lpDll);
- // If the handle is valid, try to get the function address.
- if (hinstLib != NULL)
- {
- if (isReg==1)
- ProcAdd =(dllreg)GetProcAddress(hinstLib, "DllRegisterServer");
- else
- ProcAdd =(dllreg)GetProcAddress(hinstLib, "DllUnregisterServer");
- // If the function address is valid, call the function.
- if (fRunTimeLinkSuccess = (ProcAdd != NULL))
- {
- rtn=ProcAdd();
- }
- // Free the DLL module.
- fFreeResult = FreeLibrary(hinstLib);
- }
- return rtn;
- }
- int FAR PASCAL RunDll(LPCSTR lpDll,int lpWeb,int msg,int wparam,int lparam)
- {
- HINSTANCE hinstLib;
- MYPROC ProcAdd;
- BOOL fFreeResult, fRunTimeLinkSuccess = FALSE;
- int rtn=-1;
- // Get a handle to the DLL module.
- hinstLib = LoadLibrary(lpDll);
- // If the handle is valid, try to get the function address.
- if (hinstLib != NULL)
- {
- ProcAdd =(MYPROC)GetProcAddress(hinstLib, "ShellWeb");
- // If the function address is valid, call the function.
- if (fRunTimeLinkSuccess = (ProcAdd != NULL))
- {
- rtn=ProcAdd(lpWeb,msg,wparam,lparam);
- }
- // Free the DLL module.
- fFreeResult = FreeLibrary(hinstLib);
- }
- return rtn;
- }