| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 503 人关注过本帖
标题:win api求助
只看楼主 加入收藏
lenovo_vc
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-9-17
收藏
 问题点数:0 回复次数:0 
win api求助

#include <stdio.h>
void File1(HDC hdc,const int cxChar,const int cyChar)
{
char szBuffer[256];
static int line=0;
static FILE *pf;
if((pf=fopen("123.cpp","r"))!=NULL)
{
while (!feof(pf))
{
int i=0;
char ch;
while ((ch=fgetc(pf))!='\n'&&ch!=EOF)
szBuffer[i++]=TCHAR(ch);
TextOut(hdc,cxChar,cyChar*line,szBuffer,i);
line++;
}
fclose(pf);
}

}
#include <windows.h>
#include "file.h"
LRESULT CALLBACK WndProc (HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain (HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR szCmdLine,int iCmdShow)
{
TCHAR szAppName[]=TEXT("windows");
WNDCLASS wndclass;
MSG msg;
HWND hwnd;

wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hbrBackground=(HBRUSH)GetStockObject (WHITE_BRUSH);
wndclass.hCursor=LoadCursor(NULL,IDC_ARROW);
wndclass.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wndclass.hInstance=hInstance;
wndclass.lpfnWndProc=WndProc;
wndclass.lpszClassName=szAppName;
wndclass.lpszMenuName=NULL;
wndclass.style=CS_HREDRAW|CS_VREDRAW;
if (!RegisterClass(&wndclass))
{
MessageBox(NULL,TEXT("this progam not run!"),szAppName,MB_ICONEXCLAMATION);
return 0;
}
hwnd=CreateWindow (szAppName,TEXT("windows"),WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInstance,NULL);
ShowWindow (hwnd,iCmdShow);
UpdateWindow (hwnd);
while (GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage (&msg);

}
return msg.wParam;
}
LRESULT CALLBACK WndProc (HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
static int cxChar,cyChar,cxCaps;
HDC hdc;
PAINTSTRUCT ps;
//TCHAR szBuffer[10];
TEXTMETRIC tm;

switch (message)
{
case WM_CREATE:
hdc=GetDC (hwnd);
GetTextMetrics (hdc,&tm);
cxChar=tm.tmAveCharWidth;
cyChar=tm.tmInternalLeading+tm.tmHeight;
ReleaseDC (hwnd,hdc);
return 0;
case WM_PAINT:
hdc=BeginPaint (hwnd,&ps);
File1( hdc, cxChar, cyChar);
EndPaint (hwnd,&ps);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc (hwnd,message,wParam,lParam);

}
为什么窗口最大化时,窗口就不进行绘制了,,,,请高手指教

搜索更多相关主题的帖子: api win 
2006-09-17 22:17
快速回复:win api求助
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016615 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved