请问:出现非常奇怪的异常,请帮小弟我看看,多谢
请教:出现非常奇怪的错误,请各位大哥帮我看看,谢谢!
#include <windows.h>
#include <stdio.h>
#include "include\hge.h "
#pragma comment(lib, "lib\\vc\\hge.lib "); //库
#pragma comment(lib, "lib\\vc\\hgehelp.lib "); //库
int i;
HGE *hge = 0;
// This function will be called by HGE once per frame.
// Put your game loop code here. In this example we
// just check whether ESC key has been pressed.
bool FrameFunc()
{
// By returning "true " we tell HGE
// to stop running the application.
if (hge-> Input_GetKeyState(HGEK_ESCAPE)) return true;
// Continue execution
return false;
}
LONG g_lOldProc = NULL; //全局变量
HRESULT MyWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
{
HDC hdc;
PAINTSTRUCT ps;
RECT rect;
char temp[128];
switch( nMsg )
{
case WM_RBUTTONDOWN:
{
MessageBox( hWnd, "你在我身上点了右键,你想干嘛? ", "测试 ", 0 );
}
break;
case WM_TIMER:
i++;
if (i%2)
{
hdc = GetDC(hWnd);
sprintf(temp, "x: %d , y: %d ",50,50);
TextOut(hdc,100,100,temp,strlen(temp));
ReleaseDC(hWnd,hdc);
}
else
{
hdc = GetDC(hWnd);
sprintf(temp, "x: %d , y: %d ",60,60);
TextOut(hdc,100,100,temp,strlen(temp));
ReleaseDC(hWnd,hdc);
}
break ;
// 在这里, 作你想做的事情~~~~~~
}
if( g_lOldProc != NULL )
return CallWindowProc( (WNDPROC)g_lOldProc, hWnd, nMsg, wParam, lParam ); // 调用原来的窗口处理函数
else
return DefWindowProc( hWnd, nMsg, wParam, lParam );
}
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
// Here we use global pointer to HGE interface.
// Instead you may use hgeCreate() every
// time you need access to HGE. Just be sure to
// have a corresponding hge-> Release()
// for each call to hgeCreate()
hge = hgeCreate(HGE_VERSION); //创建 HGE
// Set our frame function
hge-> System_SetState(HGE_FRAMEFUNC, FrameFunc); //回调函数 FrameFunc
#include <windows.h>
#include <stdio.h>
#include "include\hge.h "
#pragma comment(lib, "lib\\vc\\hge.lib "); //库
#pragma comment(lib, "lib\\vc\\hgehelp.lib "); //库
int i;
HGE *hge = 0;
// This function will be called by HGE once per frame.
// Put your game loop code here. In this example we
// just check whether ESC key has been pressed.
bool FrameFunc()
{
// By returning "true " we tell HGE
// to stop running the application.
if (hge-> Input_GetKeyState(HGEK_ESCAPE)) return true;
// Continue execution
return false;
}
LONG g_lOldProc = NULL; //全局变量
HRESULT MyWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
{
HDC hdc;
PAINTSTRUCT ps;
RECT rect;
char temp[128];
switch( nMsg )
{
case WM_RBUTTONDOWN:
{
MessageBox( hWnd, "你在我身上点了右键,你想干嘛? ", "测试 ", 0 );
}
break;
case WM_TIMER:
i++;
if (i%2)
{
hdc = GetDC(hWnd);
sprintf(temp, "x: %d , y: %d ",50,50);
TextOut(hdc,100,100,temp,strlen(temp));
ReleaseDC(hWnd,hdc);
}
else
{
hdc = GetDC(hWnd);
sprintf(temp, "x: %d , y: %d ",60,60);
TextOut(hdc,100,100,temp,strlen(temp));
ReleaseDC(hWnd,hdc);
}
break ;
// 在这里, 作你想做的事情~~~~~~
}
if( g_lOldProc != NULL )
return CallWindowProc( (WNDPROC)g_lOldProc, hWnd, nMsg, wParam, lParam ); // 调用原来的窗口处理函数
else
return DefWindowProc( hWnd, nMsg, wParam, lParam );
}
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
// Here we use global pointer to HGE interface.
// Instead you may use hgeCreate() every
// time you need access to HGE. Just be sure to
// have a corresponding hge-> Release()
// for each call to hgeCreate()
hge = hgeCreate(HGE_VERSION); //创建 HGE
// Set our frame function
hge-> System_SetState(HGE_FRAMEFUNC, FrameFunc); //回调函数 FrameFunc