generic.cpp:
#include <windows.h>
#include "generic.h"
#if defined (win32)
#define IS_WIN32 TRUE
#else
#define IS_WIN32 FALSE
#endifHINSTANCE hInst; // current instance
LPCTSTR lpszAppName = "Generic";
LPCTSTR lpszTitle = "Generic Application";
BOOL RegisterWin95(CONST WNDCLASS* lpwc);int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MSG msg;
HWND hWnd;
WNDCLASS wc; wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC)WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = 0;
wc.hIcon = LoadIcon(hInstance, lpszAppName);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = lpszAppName;
wc.lpszClassName = lpszAppName; if(!RegisterWin95(&wc))
return false;
hInst = hInstance;
hWnd = CreateWindow (lpszAppName,
lpszTitle,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0,
CW_USEDEFAULT, 0,
NULL,
NULL,
hInstance,
NULL
);
if(!hWnd)
return false;
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
while(GetMessage(&msg, NULL, 0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return(msg.wParam);
}BOOL RegisterWin95(CONST WNDCLASS* lpwc)
{
WNDCLASSEX wcex; wcex.style = lpwc->style;
wcex.lpfnWndProc = lpwc->lpfnWndProc;
wcex.cbClsExtra = lpwc->cbClsExtra;
wcex.cbWndExtra = lpwc->cbWndExtra;
wcex.hInstance = lpwc->hInstance;
wcex.hIcon = lpwc->hIcon;
wcex.hCursor = lpwc->hCursor;
wcex.hbrBackground = lpwc->hbrBackground;
wcex.lpszMenuName = lpwc->lpszMenuName;
wcex.lpszClassName = lpwc->lpszClassName;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.hIconSm = LoadIcon(wcex.hInstance, "SMALL");
return RegisterClassEx(&wcex);
}LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDM_TEST :
break;
case IDM_EXIT :
DestroyWindow(hWnd);
break;
}
break;
case WM_DESTROY :
PostQuitMessage(0);
break;
default:
return (DefWindowProc(hWnd, uMsg, wParam, lParam));
}
return(0L);
}generic.h:
#define IDM_EXIT 100
#define IDM_TEST 200
#define IDM_ABOUT 300#define DLG_VERFIRST 400
#define DLG_VERLAST 404LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK About (HWND, UINT, WPARAM, LPARAM);
generic.rc:
#include "windows.h"
#include "generic.h"
#include "winver.h"MYAPP ICON DISCARDABLE "GENERIC.ICO"
SMALL ICON DISCARDABLE "SMALL.ICO"GENERIC MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Test!", IDM_TEST
MENUITEM "E&xit", IDM_EXIT
END
POPUP "&Help"
BEGIN
MENUITEM "&About MyApp...", IDM_ABOUT
END
END1 VERSIONINFO
FILEVERSION 3,3,0,0
PRODUCTVERSION 3,3,0,0
FILEFLAGSMASK 0X3fl
#ifdef _DEBUG
FILEFLAGS 0xbl
#else
FILEFLAGS 0xal
#endif
FILEOS 0X4L
FILETYPE 0X1L
FILESUBTYPE 0X0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "GenericCompany\0"
VALUE "FileDescription", "GenericApplication\0"
VALUE "FileVersion", "1.0\0"
VALUE "InternalName", "1.0\0"
VALUE "LegalCopyright", "Copyright \251 Generic Company. 1997\0"
VALUE "LegalTrades", "Generic Trade.\0"
VALUE "OriginalFilename", "\0"
VALUE "ProductName", "Generic Application.\0"
VALUE "ProductVersion", "1.0\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#include <windows.h>
#include "generic.h"
#if defined (win32)
#define IS_WIN32 TRUE
#else
#define IS_WIN32 FALSE
#endifHINSTANCE hInst; // current instance
LPCTSTR lpszAppName = "Generic";
LPCTSTR lpszTitle = "Generic Application";
BOOL RegisterWin95(CONST WNDCLASS* lpwc);int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MSG msg;
HWND hWnd;
WNDCLASS wc; wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC)WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = 0;
wc.hIcon = LoadIcon(hInstance, lpszAppName);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = lpszAppName;
wc.lpszClassName = lpszAppName; if(!RegisterWin95(&wc))
return false;
hInst = hInstance;
hWnd = CreateWindow (lpszAppName,
lpszTitle,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0,
CW_USEDEFAULT, 0,
NULL,
NULL,
hInstance,
NULL
);
if(!hWnd)
return false;
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
while(GetMessage(&msg, NULL, 0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return(msg.wParam);
}BOOL RegisterWin95(CONST WNDCLASS* lpwc)
{
WNDCLASSEX wcex; wcex.style = lpwc->style;
wcex.lpfnWndProc = lpwc->lpfnWndProc;
wcex.cbClsExtra = lpwc->cbClsExtra;
wcex.cbWndExtra = lpwc->cbWndExtra;
wcex.hInstance = lpwc->hInstance;
wcex.hIcon = lpwc->hIcon;
wcex.hCursor = lpwc->hCursor;
wcex.hbrBackground = lpwc->hbrBackground;
wcex.lpszMenuName = lpwc->lpszMenuName;
wcex.lpszClassName = lpwc->lpszClassName;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.hIconSm = LoadIcon(wcex.hInstance, "SMALL");
return RegisterClassEx(&wcex);
}LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDM_TEST :
break;
case IDM_EXIT :
DestroyWindow(hWnd);
break;
}
break;
case WM_DESTROY :
PostQuitMessage(0);
break;
default:
return (DefWindowProc(hWnd, uMsg, wParam, lParam));
}
return(0L);
}generic.h:
#define IDM_EXIT 100
#define IDM_TEST 200
#define IDM_ABOUT 300#define DLG_VERFIRST 400
#define DLG_VERLAST 404LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK About (HWND, UINT, WPARAM, LPARAM);
generic.rc:
#include "windows.h"
#include "generic.h"
#include "winver.h"MYAPP ICON DISCARDABLE "GENERIC.ICO"
SMALL ICON DISCARDABLE "SMALL.ICO"GENERIC MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Test!", IDM_TEST
MENUITEM "E&xit", IDM_EXIT
END
POPUP "&Help"
BEGIN
MENUITEM "&About MyApp...", IDM_ABOUT
END
END1 VERSIONINFO
FILEVERSION 3,3,0,0
PRODUCTVERSION 3,3,0,0
FILEFLAGSMASK 0X3fl
#ifdef _DEBUG
FILEFLAGS 0xbl
#else
FILEFLAGS 0xal
#endif
FILEOS 0X4L
FILETYPE 0X1L
FILESUBTYPE 0X0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "GenericCompany\0"
VALUE "FileDescription", "GenericApplication\0"
VALUE "FileVersion", "1.0\0"
VALUE "InternalName", "1.0\0"
VALUE "LegalCopyright", "Copyright \251 Generic Company. 1997\0"
VALUE "LegalTrades", "Generic Trade.\0"
VALUE "OriginalFilename", "\0"
VALUE "ProductName", "Generic Application.\0"
VALUE "ProductVersion", "1.0\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货