真心求1>\wincedll.cpp(55) : error C2731: 'WinMain' : function cannot be overloaded,该怎么处理
真心求1>.\wincedll.cpp(55) : error C2731: 'WinMain' : function cannot be overloaded
1>.\wincedll.cpp(55) : error C2731: 'WinMain' : function cannot be overloaded
1> .\wincedll.cpp(49) : see declaration of 'WinMain'
主管要我把一个 exe 的功能 封装到一个 show{}函数中,并放入dll, show{}函数 只有1个参数(打开文件路径)
我照下面改了,但是我发现 winmain 的那4个参数不知道如何是好
#include "stdafx.h"
#include "htmlctrl.h"
#include "resource.h"
#pragma comment(lib,"htmlview")
// forward defines (instead of using string tables)
#define IDS_APP_TITLE TEXT("Browse")
//用本地文件进行测试 file://\\Program Files\\Browse\\start.html
#define IDS_START_PAGE TEXT("http://www.baidu.com/")
#define WM_LAUNCHBROWSER (WM_USER + 1)
// Global Variables:
HINSTANCE g_hInst; // The current instance
// Forward declarations of functions
ATOM MyRegisterClass(
HINSTANCE,
LPTSTR
);
BOOL InitInstance(
HINSTANCE,
int
);
LRESULT CALLBACK WndProc(
HWND,
UINT,
WPARAM,
LPARAM
);
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
//
// FUNCTION: WinMain()
//
// PURPOSE: Entry point for the application and sets up the Msg loop
//
int WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance
//LPTSTR lpCmdLine,
//int nCmdShow
)
{
MSG msg;
// Perform application initialization:
if (FALSE == InitInstance (hInstance, nCmdShow))
{
return FALSE;
}
// Main Msg loop:
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
//
// FUNCTION: MyRegisterClass()
//
// PURPOSE: Registers the window class.
//
ATOM MyRegisterClass(
HINSTANCE hInstance,
LPTSTR szWindowClass
)
{
WNDCLASS wc;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC) WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WINCE));
wc.hCursor = 0;
wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = 0;
wc.lpszClassName = szWindowClass;
return RegisterClass(&wc);
}
//
// FUNCTION: InitInstance(HANDLE, int)
//
// PURPOSE: Saves instance handle and creates main window
//
// COMMENTS:
//
// In this function, we save the instance handle in a global variable and
// create and display the main program window.
//
BOOL InitInstance(
HINSTANCE hInstance,
int nCmdShow
)
{
HWND hWnd = NULL;
g_hInst = hInstance; // Store instance handle in our global variable
//If it is already running, then focus on the window
hWnd = FindWindow(IDS_APP_TITLE, IDS_APP_TITLE);
if (NULL != hWnd)
{
SetForegroundWindow (hWnd);
return FALSE;
}
MyRegisterClass(hInstance, IDS_APP_TITLE);
RECT rect;
GetClientRect(hWnd, &rect);
// create a full-screen window for the browser control
hWnd = CreateWindow(IDS_APP_TITLE, IDS_APP_TITLE, WS_VISIBLE,
0,0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
NULL, NULL, hInstance, NULL);
if (NULL == hWnd)
{
return FALSE;
}
// Hide all the Shell parts and show the window in full screen mode.
SHFullScreen(hWnd, SHFS_HIDETASKBAR | SHFS_HIDESTARTICON | SHFS_HIDESIPBUTTON);
1>.\wincedll.cpp(55) : error C2731: 'WinMain' : function cannot be overloaded
1> .\wincedll.cpp(49) : see declaration of 'WinMain'
主管要我把一个 exe 的功能 封装到一个 show{}函数中,并放入dll, show{}函数 只有1个参数(打开文件路径)
我照下面改了,但是我发现 winmain 的那4个参数不知道如何是好
#include "stdafx.h"
#include "htmlctrl.h"
#include "resource.h"
#pragma comment(lib,"htmlview")
// forward defines (instead of using string tables)
#define IDS_APP_TITLE TEXT("Browse")
//用本地文件进行测试 file://\\Program Files\\Browse\\start.html
#define IDS_START_PAGE TEXT("http://www.baidu.com/")
#define WM_LAUNCHBROWSER (WM_USER + 1)
// Global Variables:
HINSTANCE g_hInst; // The current instance
// Forward declarations of functions
ATOM MyRegisterClass(
HINSTANCE,
LPTSTR
);
BOOL InitInstance(
HINSTANCE,
int
);
LRESULT CALLBACK WndProc(
HWND,
UINT,
WPARAM,
LPARAM
);
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
//
// FUNCTION: WinMain()
//
// PURPOSE: Entry point for the application and sets up the Msg loop
//
int WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance
//LPTSTR lpCmdLine,
//int nCmdShow
)
{
MSG msg;
// Perform application initialization:
if (FALSE == InitInstance (hInstance, nCmdShow))
{
return FALSE;
}
// Main Msg loop:
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
//
// FUNCTION: MyRegisterClass()
//
// PURPOSE: Registers the window class.
//
ATOM MyRegisterClass(
HINSTANCE hInstance,
LPTSTR szWindowClass
)
{
WNDCLASS wc;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC) WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WINCE));
wc.hCursor = 0;
wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = 0;
wc.lpszClassName = szWindowClass;
return RegisterClass(&wc);
}
//
// FUNCTION: InitInstance(HANDLE, int)
//
// PURPOSE: Saves instance handle and creates main window
//
// COMMENTS:
//
// In this function, we save the instance handle in a global variable and
// create and display the main program window.
//
BOOL InitInstance(
HINSTANCE hInstance,
int nCmdShow
)
{
HWND hWnd = NULL;
g_hInst = hInstance; // Store instance handle in our global variable
//If it is already running, then focus on the window
hWnd = FindWindow(IDS_APP_TITLE, IDS_APP_TITLE);
if (NULL != hWnd)
{
SetForegroundWindow (hWnd);
return FALSE;
}
MyRegisterClass(hInstance, IDS_APP_TITLE);
RECT rect;
GetClientRect(hWnd, &rect);
// create a full-screen window for the browser control
hWnd = CreateWindow(IDS_APP_TITLE, IDS_APP_TITLE, WS_VISIBLE,
0,0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
NULL, NULL, hInstance, NULL);
if (NULL == hWnd)
{
return FALSE;
}
// Hide all the Shell parts and show the window in full screen mode.
SHFullScreen(hWnd, SHFS_HIDETASKBAR | SHFS_HIDESTARTICON | SHFS_HIDESIPBUTTON);