#include<windows.h>LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR ipCmdLine,int nCmdShow)
{
HWND hwnd;
MSG msg;
char a1[]="flashmagic";
char a2[]="FlashMagic";
WNDCLASS A;
A.style=0 | CS_NOCLOSE;
A.lpfnWndProc=WndProc;
A.cbClsExtra=0;
A.cbWndExtra=0;
A.hInstance=hInstance;
A.hIcon = LoadIcon( NULL,IDI_APPLICATION);
A.hCursor=LoadCursor(NULL,IDC_ARROW);
A.hbrBackground = GetStockObject(WHITE_BRUSH);//help!!!!!!!!
A.lpszClassName=a1;
A.lpszMenuName=NULL; if(!RegisterClass(&A))
{
MessageBeep(0);
return FALSE;
}
hwnd=CreateWindow(a1,a2,WS_OVERLAPPEDWINDOW,1,1,100,200,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,nCmdShow);
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)
{
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0); default:
return DefWindowProc(hwnd,message,wParam,lParam);
}
return (0);
}
{
HWND hwnd;
MSG msg;
char a1[]="flashmagic";
char a2[]="FlashMagic";
WNDCLASS A;
A.style=0 | CS_NOCLOSE;
A.lpfnWndProc=WndProc;
A.cbClsExtra=0;
A.cbWndExtra=0;
A.hInstance=hInstance;
A.hIcon = LoadIcon( NULL,IDI_APPLICATION);
A.hCursor=LoadCursor(NULL,IDC_ARROW);
A.hbrBackground = GetStockObject(WHITE_BRUSH);//help!!!!!!!!
A.lpszClassName=a1;
A.lpszMenuName=NULL; if(!RegisterClass(&A))
{
MessageBeep(0);
return FALSE;
}
hwnd=CreateWindow(a1,a2,WS_OVERLAPPEDWINDOW,1,1,100,200,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,nCmdShow);
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)
{
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0); default:
return DefWindowProc(hwnd,message,wParam,lParam);
}
return (0);
}
解决方案 »
- 很是疑惑?关于指纹识别代码中的fvs库
- 关于弹出的【另存为】对话框的问题
- 请问WM_MDIMAXIMIZE 和SC_MAXIMIZE的区别
- 如何在VC中实现文件的排他锁?
- Oracle连接问题
- 类向导生成类时有问题,系统问题?编译器问题?操作问题?病毒?
- 在VC中除了DBGRID外还有什么好用的表格式的控件,要求是可以不绑定到数据库?
- 如何在系统托盘闪动图标?像QQ那样的!
- 急,有没有用东进的D160APCI语音卡开发过呼叫中心?我现在要用它做一个交换机功能,在内线呼出时遇到一点问题(分可另加)
- 谁会使用spy++或是有这方面的资料,我将感激不禁
- SQLSetPos()的问题。高分!!
- 请问怎样才能查看dll中提供的函数接口?
GetStockObject
The GetStockObject function retrieves a handle to one of the predefined stock pens, brushes, fonts, or palettes. HGDIOBJ GetStockObject(
int fnObject // type of stock object
);
Parameters
fnObject
Specifies the type of stock object. This parameter can be any one of the following values: Value Meaning
BLACK_BRUSH Black brush.
DKGRAY_BRUSH Dark gray brush.
DC_BRUSH Windows 98, Windows NT 5.0 and later: Solid color brush. The default color is white. The color can be changed by using the SetDCBrushColor function. For more information, see the following Res section.
GRAY_BRUSH Gray brush.
HOLLOW_BRUSH Hollow brush (equivalent to NULL_BRUSH).
LTGRAY_BRUSH Light gray brush.
NULL_BRUSH Null brush (equivalent to HOLLOW_BRUSH).
WHITE_BRUSH White brush.
BLACK_PEN Black pen.
DC_PEN Windows 98, Windows NT 5.0 and later: Solid pen color. The default color is white. The color can be changed by using the SetDCPenColor function. For more information, see the following Res section.
WHITE_PEN White pen.
ANSI_FIXED_FONT Windows fixed-pitch (monospace) system font.
ANSI_VAR_FONT Windows variable-pitch (proportional space) system font.
DEVICE_DEFAULT_FONT Windows NT: Device-dependent font.
DEFAULT_GUI_FONT Default font for user interface objects such as menus and dialog boxes.
OEM_FIXED_FONT Original equipment manufacturer (OEM) dependent fixed-pitch (monospace) font.
SYSTEM_FONT System font. By default, the system uses the system font to draw menus, dialog box controls, and text.
SYSTEM_FIXED_FONT Fixed-pitch (monospace) system font. This stock object is provided only for compatibility with 16-bit Windows versions earlier than 3.0.
DEFAULT_PALETTE Default palette. This palette consists of the static colors in the system palette.
Return Values
If the function succeeds, the return value identifies the logical object requested.If the function fails, the return value is NULL. Windows NT: To get extended error information, callGetLastError.Res
Use the DKGRAY_BRUSH, GRAY_BRUSH, and LTGRAY_BRUSH stock objects only in windows with the CS_HREDRAW and CS_VREDRAW styles. Using a gray stock brush in any other style of window can lead to misalignment of brush patterns after a window is moved or sized. The origins of stock brushes cannot be adjusted. The HOLLOW_BRUSH and NULL_BRUSH stock objects are equivalent. The font used by the DEFAULT_GUI_FONT stock object could change. Use this stock object when you want to use the font that menus, dialog boxes, and other user interface objects use.It is not necessary (but it is not harmful) to delete stock objects by calling DeleteObject.Windows 98, Windows NT 5.0 and later: Both DC_BRUSH and DC_PEN can be used interchangeably with other stock objects like BLACK_BRUSH and BLACK_PEN. For information on retrieving the current pen or brush color, see GetDCBrushColor and GetDCPenColor. See Setting the Pen or Brush Color for an example of setting colors. The GetStockObject function with an argument of DC_BRUSH OR DC_PEN can be used interchangeably with the SetDCPenColor and SetDCBrushColor functions.Windows CE: Windows CE does not support the following values for the fnObject parameter.ANSI_FIXED_FONTANSI_VAR_FONTOEM_FIXED_FONTSYSTEM_FIXED_FONTWindows CE version 1.0 does not support the DEFAULT_PALETTE value for fnObject. QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in wingdi.h.
Import Library: Use gdi32.lib.See Also
Device Contexts Overview, Device Context Functions, DeleteObject, SelectObject
这个地方 = (HBRUSH)GetStockObject(WHITE_BRUSH)
这是设置窗口的背景刷子为白色。
white_brush是你画刷的颜色,你要把它强制转换为HBRUSH型。