本文整理汇总了C++中GetStockObject函数的典型用法代码示例。如果您正苦于以下问题:C++ GetStockObject函数的具体用法?C++ GetStockObject怎么用?C++ GetStockObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetStockObject函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Contour
void ViewPort::DrawActiveDomain( double pixel_size, double offset_x, double offset_y )
{
Transform *transform; // render all transforms in section
HPEN pen, oldpen;
HBRUSH brush, oldbrush;
LOGBRUSH lbrush;
int oldmode, i, x, y, numpts;
Contour *contour, *c;
Point *p;
POINT *lpPoints;
if ( section && viewDC ) // need a drawing surface for domain contour
if ( section->active ) // do only if have an active transform
{
transform = section->active;
if ( transform->domain ) // do only if have domain
{
contour = transform->domain;
if ( contour->points )
{
c = new Contour( *contour ); // copy the contour
// if image, then contour is in pixels
if ( transform->image ) c->Scale( transform->image->mag );
c->InvNform( transform->nform ); // transform into section
c->Shift( -offset_x, -offset_y ); // shift into view
c->Scale( 1.0/pixel_size ); // scale to view's pixels
numpts = c->points->Number();
lpPoints = new POINT[ numpts ]; // create Window POINT array for drawing
i = 0;
p = c->points->first;
while ( p != NULL )
{
lpPoints[i].x = (int)floor(p->x);
lpPoints[i].y = height - (int)floor(p->y);
i++;
p = p->next;
}
// create pen for border of object
pen = CreatePen( PS_SOLID, 1, c->border.ref() );
oldpen = (HPEN)SelectObject( viewDC, pen ); // set pen into device context
if ( c->mode < 0 )
{
brush = CreateSolidBrush( c->fill.ref() ); // interior will be filled
oldbrush = (HBRUSH)SelectObject( viewDC, brush );
SetROP2( viewDC, abs(c->mode) ); // using contour fill mode and color
Polygon( viewDC, lpPoints, numpts );
SelectObject( viewDC, oldbrush ); // clean up fill brush
DeleteObject(brush);
}
SelectObject( viewDC, (HBRUSH)GetStockObject(NULL_BRUSH) ); // without coloring interior
SetROP2( viewDC, R2_COPYPEN ); // draw contour border with pen
if ( c->closed ) Polygon( viewDC, lpPoints, numpts );
else Polyline( viewDC, lpPoints, numpts );
SelectObject( viewDC, oldpen ); // clean up pen
DeleteObject(pen);
delete[] lpPoints; // and dynamic memory
delete c;
}
}
}
}
开发者ID:meawoppl,项目名称:reconstruct-1101,代码行数:67,代码来源:viewport.cpp
示例2: CreateDC
BOOL MusicUtils::SaveBitMapToFile(HBITMAP hBitmap, CString lpFileName)
{
HDC hDC; //?????
int iBits; //?????????????????
WORD wBitCount; //????????????
DWORD dwPaletteSize=0,//???????,?????????,??????,???????
dwBmBitsSize,
dwDIBSize,
dwWritten;
BITMAP Bitmap;
BITMAPFILEHEADER bmfHdr; //??????
BITMAPINFOHEADER bi; //???????
LPBITMAPINFOHEADER lpbi; //???????
HANDLE fh, hDib, hPal,hOldPal=NULL;//?????????,????,??????,?????
//???????????????
hDC = CreateDC(_T("DISPLAY"),NULL,NULL,NULL);
iBits = GetDeviceCaps(hDC,BITSPIXEL)*GetDeviceCaps(hDC,PLANES);
DeleteDC(hDC);
if(iBits<=1)
wBitCount = 1;
else if(iBits<=4)
wBitCount = 4;
else if(iBits<=8)
wBitCount = 8;
else if(iBits<=24)
wBitCount = 24;
else
wBitCount = 32;
//???????
if(wBitCount<=8)
dwPaletteSize = (1<<wBitCount)*sizeof(RGBQUAD);
//?????????
GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&Bitmap);
bi.biSize = sizeof(BITMAPINFOHEADER);
bi.biWidth = Bitmap.bmWidth;
bi.biHeight = Bitmap.bmHeight;
bi.biPlanes = 1;
bi.biBitCount = wBitCount;
bi.biCompression = BI_RGB;
bi.biSizeImage = 0;
bi.biXPelsPerMeter = 0;
bi.biYPelsPerMeter = 0;
bi.biClrUsed = 0;
bi.biClrImportant = 0;
dwBmBitsSize = ((Bitmap.bmWidth*wBitCount+31)/32)*4*Bitmap.bmHeight;
//?????????
hDib = GlobalAlloc(GHND,dwBmBitsSize+dwPaletteSize+sizeof(BITMAPINFOHEADER));
lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDib);
*lpbi = bi;
// ?????
hPal = GetStockObject(DEFAULT_PALETTE);
if(hPal)
{
hDC = ::GetDC(NULL);
hOldPal = SelectPalette(hDC, (HPALETTE)hPal, FALSE);
RealizePalette(hDC);
}
// ????????????
GetDIBits(hDC, hBitmap, 0, (UINT)Bitmap.bmHeight,
(LPSTR)lpbi+sizeof(BITMAPINFOHEADER)+dwPaletteSize,
(LPBITMAPINFO)lpbi,DIB_RGB_COLORS);
//?????
if(hOldPal)
{
SelectPalette(hDC,(HPALETTE)hOldPal,TRUE);
RealizePalette(hDC);
::ReleaseDC(NULL, hDC);
}
//??????
fh = CreateFile(lpFileName,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN,NULL);
if(fh==INVALID_HANDLE_VALUE)
return FALSE;
// ???????
bmfHdr.bfType = 0x4D42;// "BM"
dwDIBSize = sizeof(BITMAPFILEHEADER)+
sizeof(BITMAPINFOHEADER)+
dwPaletteSize+dwBmBitsSize;
bmfHdr.bfSize = dwDIBSize;
bmfHdr.bfReserved1 = 0;
bmfHdr.bfReserved2 = 0;
bmfHdr.bfOffBits = (DWORD)sizeof(BITMAPFILEHEADER)+
(DWORD)sizeof(BITMAPINFOHEADER)+dwPaletteSize;
// ???????
WriteFile(fh,(LPSTR)&bmfHdr,sizeof(BITMAPFILEHEADER),&dwWritten,NULL);
// ??????????
WriteFile(fh,(LPSTR)lpbi,dwDIBSize,&dwWritten,NULL);
//??????
GlobalUnlock(hDib);
//.........这里部分代码省略.........
开发者ID:ltframe,项目名称:ltplayer0016,代码行数:101,代码来源:MusicUtils.cpp
示例3: memset
/**
* Responsible for drawing each list item.
*/
void ToggleListView::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) {
CListCtrl& ListCtrl=GetListCtrl();
int nItem = lpDrawItemStruct->itemID;
// get item data
LV_ITEM lvi;
_TCHAR szBuff[MAX_PATH];
memset(&lvi, 0, sizeof(LV_ITEM));
lvi.mask = LVIF_TEXT;
lvi.iItem = nItem;
lvi.pszText = szBuff;
lvi.cchTextMax = sizeof(szBuff);
ListCtrl.GetItem(&lvi);
RECT rDraw;
CopyRect ( &rDraw, &lpDrawItemStruct->rcItem );
rDraw.right = rDraw.left + TOGGLELIST_ITEMHEIGHT;
rDraw.top ++;
rDraw.right ++;
FrameRect ( lpDrawItemStruct->hDC, &rDraw, (HBRUSH)GetStockObject ( BLACK_BRUSH ) );
rDraw.right --;
FillRect ( lpDrawItemStruct->hDC, &rDraw, GetSysColorBrush ( COLOR_3DFACE ) );
Draw3dRect ( lpDrawItemStruct->hDC, &rDraw, GetSysColorBrush ( COLOR_3DHILIGHT ), GetSysColorBrush ( COLOR_3DSHADOW ) );
InflateRect ( &rDraw, -3, -3 );
Draw3dRect ( lpDrawItemStruct->hDC, &rDraw, GetSysColorBrush ( COLOR_3DSHADOW ), GetSysColorBrush ( COLOR_3DHILIGHT ) );
switch(GetToggleState(lvi.iItem)) {
case TOGGLE_STATE_DISABLED:
if(disabledIcon) {
DrawIconEx ( lpDrawItemStruct->hDC, rDraw.left, rDraw.top, disabledIcon, 16, 16,0, NULL, DI_NORMAL );
}
break;
case TOGGLE_STATE_ON:
if(onIcon) {
DrawIconEx ( lpDrawItemStruct->hDC, rDraw.left, rDraw.top, onIcon, 16, 16,0, NULL, DI_NORMAL );
}
break;
case TOGGLE_STATE_OFF:
if(offIcon) {
DrawIconEx ( lpDrawItemStruct->hDC, rDraw.left, rDraw.top, offIcon, 16, 16,0, NULL, DI_NORMAL );
}
break;
};
CopyRect ( &rDraw, &lpDrawItemStruct->rcItem );
rDraw.left += TOGGLELIST_ITEMHEIGHT;
rDraw.left += 1;
if ( lpDrawItemStruct->itemState & ODS_SELECTED ) {
FillRect ( lpDrawItemStruct->hDC, &rDraw, GetSysColorBrush ( COLOR_HIGHLIGHT ) );
} else {
FillRect ( lpDrawItemStruct->hDC, &rDraw, GetSysColorBrush ( COLOR_WINDOW ) );
}
rDraw.left += TEXT_OFFSET;
int colorIndex = ( (lpDrawItemStruct->itemState & ODS_SELECTED ) ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT );
SetTextColor ( lpDrawItemStruct->hDC, GetSysColor ( colorIndex ) );
DrawText ( lpDrawItemStruct->hDC, szBuff, strlen(szBuff), &rDraw, DT_LEFT|DT_VCENTER|DT_SINGLELINE );
}
开发者ID:0culus,项目名称:Doom3-for-MacOSX-,代码行数:72,代码来源:ToggleListView.cpp
示例4: WinMain
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprev, PSTR cmdline, int ishow)
{
HWND hwnd;
MSG msg;
WNDCLASSEX wndclassex = {0};
// Fill the WNDCLASSEX fields we care about
wndclassex.cbSize = sizeof(WNDCLASSEX);
wndclassex.style = CS_HREDRAW | CS_VREDRAW; // Redraw the window if it's position or size changes
wndclassex.lpfnWndProc = WinProc;
wndclassex.hInstance = hinstance;
wndclassex.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); // Make the window background white
wndclassex.lpszClassName = kClassName;
wndclassex.hCursor = (HCURSOR)LoadImage(NULL, MAKEINTRESOURCE(IDC_ARROW), IMAGE_CURSOR,
0, 0, LR_SHARED); // Load the default arrow cursor
RegisterClassEx(&wndclassex); // Register the WNDCLASSEX with the OS
// Here we set the style of the window
// Notice how we use the style WS_VSCROLL, this creates the window with a
// vertical scroll bar
DWORD style = WS_SYSMENU | WS_VSCROLL;
// Create the window
hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, // Our Window has a border with a sunken edge
kClassName,
"www.GameTutorials.com -- Vertical Scroll Bar",
style, // Style of window
CW_USEDEFAULT, // Windows picks upper-left X-pos of window
CW_USEDEFAULT, // Windows picks upper-left Y-pos of window
kWinWid,
kWinHgt,
NULL,
NULL,
hinstance,
NULL);
// Error Check
if(hwnd == NULL)
return EXIT_FAILURE; // Couldn't create the window
// Load a the text file for displaying
if(!LoadTextFile("VerticalText.txt"))
return EXIT_FAILURE; // No text file, no tutorial
// Show and update the window
ShowWindow(hwnd, ishow);
UpdateWindow(hwnd);
while(1)
{
// Checking for window messages -- If we get one we'll deal with it
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if(msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
// This is where the core of our application would go if we were writing one...
}
} // end of while(1)
UnregisterClass(kClassName,hinstance); // Free up memory
return msg.wParam;
}
开发者ID:jiangguang5201314,项目名称:ZNginx,代码行数:70,代码来源:win_main.cpp
示例5: InterfaceCreateTabControl
void InterfaceCreateTabControl(HWND hwnd)
{
TC_ITEM tie;
char s[100];
HWND hwndCtl;
LOGFONT lf;
HFONT font;
hwndTab = GetDlgItem(hwndMain,IDC_TAB_MAIN);
tie.mask = TCIF_TEXT | TCIF_IMAGE;
tie.iImage = -1;
tie.pszText = s;
tie.pszText = "&Status";
TabCtrl_InsertItem(hwndTab,0, &tie);
tie.pszText = "&Channels";
TabCtrl_InsertItem(hwndTab,1, &tie);
tie.pszText = "&Administration";
TabCtrl_InsertItem(hwndTab,2, &tie);
tab_pages[0] = CreateDialog(hInst,MAKEINTRESOURCE(IDD_TAB_PAGE_STATUS),hwndTab,
InterfaceDialogTabPage);
tab_pages[1] = CreateDialog(hInst,MAKEINTRESOURCE(IDD_TAB_PAGE_CHANNELS),hwndTab,
InterfaceDialogTabPage);
tab_pages[2] = CreateDialog(hInst,MAKEINTRESOURCE(IDD_TAB_PAGE_ADMINISTRATION),hwndTab,
InterfaceDialogTabPage);
/* keep about box page ready */
tab_about = CreateDialog(hInst,MAKEINTRESOURCE(IDD_ABOUT),hwnd,
InterfaceDialogAbout);
/* set admin page font */
hwndCtl = GetDlgItem(HWND_ADMIN,IDC_ADMIN_RESPONSE);
SendMessage(hwndCtl,WM_SETFONT,(WPARAM)GetStockObject(ANSI_FIXED_FONT),
MAKELPARAM(TRUE,0));
lf.lfHeight = 8;
lf.lfWidth = 0;
lf.lfEscapement = 0;
lf.lfOrientation = 0;
lf.lfWeight = 400;
lf.lfItalic = 0;
lf.lfUnderline = 0;
lf.lfStrikeOut = 0;
lf.lfCharSet = 255;
lf.lfOutPrecision = 1;
lf.lfClipPrecision = 2;
lf.lfQuality = 1;
lf.lfPitchAndFamily = 49;
strcpy(lf.lfFaceName,"Terminal");
font = CreateFontIndirect(&lf);
if (font != NULL)
{
SendMessage(hwndCtl,WM_SETFONT,(WPARAM)font,MAKELPARAM(TRUE,0));
}
/* Set text buffer to be large */
SendMessage(hwndCtl, EM_EXLIMITTEXT, ADMIN_RESPONSE_SIZE, 0);
lpfnDefAdminResponseProc = SubclassWindow(hwndCtl,InterfaceAdminResponseProc);
hwndCtl = GetDlgItem(HWND_ADMIN,IDC_ADMIN_COMMAND);
lpfnDefAdminInputProc = SubclassWindow(hwndCtl,InterfaceAdminInputProc);
hwndTab_page = NULL;
InterfaceTabChange();
}
开发者ID:Shaijan,项目名称:Meridian59,代码行数:71,代码来源:interface.c
示例6: winCreateBoundingWindowWindowed
Bool
winCreateBoundingWindowWindowed(ScreenPtr pScreen)
{
winScreenPriv(pScreen);
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
int iWidth = pScreenInfo->dwUserWidth;
int iHeight = pScreenInfo->dwUserHeight;
int iPosX;
int iPosY;
HWND *phwnd = &pScreenPriv->hwndScreen;
WNDCLASSEX wc;
RECT rcClient, rcWorkArea;
DWORD dwWindowStyle;
BOOL fForceShowWindow = FALSE;
char szTitle[256];
winDebug("winCreateBoundingWindowWindowed - User w: %d h: %d\n",
(int) pScreenInfo->dwUserWidth, (int) pScreenInfo->dwUserHeight);
winDebug("winCreateBoundingWindowWindowed - Current w: %d h: %d\n",
(int) pScreenInfo->dwWidth, (int) pScreenInfo->dwHeight);
/* Set the common window style flags */
dwWindowStyle = WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX;
/* Decorated or undecorated window */
if (pScreenInfo->fDecoration
#ifdef XWIN_MULTIWINDOWEXTWM
&& !pScreenInfo->fMWExtWM
#endif
&& !pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOW
&& !pScreenInfo->fMultiWindow
#endif
) {
/* Try to handle startup via run.exe. run.exe instructs Windows to
* hide all created windows. Detect this case and make sure the
* window is shown nevertheless */
STARTUPINFO startupInfo;
GetStartupInfo(&startupInfo);
if (startupInfo.dwFlags & STARTF_USESHOWWINDOW &&
startupInfo.wShowWindow == SW_HIDE) {
fForceShowWindow = TRUE;
}
dwWindowStyle |= WS_CAPTION;
if (pScreenInfo->iResizeMode != notAllowed)
dwWindowStyle |= WS_THICKFRAME | WS_MAXIMIZEBOX;
}
else
dwWindowStyle |= WS_POPUP;
/* Setup our window class */
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = winWindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = g_hInstance;
wc.hIcon =
(HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
GetSystemMetrics(SM_CXICON),
GetSystemMetrics(SM_CYICON), 0);
wc.hCursor = 0;
wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = WINDOW_CLASS;
wc.hIconSm =
(HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON), LR_DEFAULTSIZE);
RegisterClassEx(&wc);
/* Get size of work area */
winGetWorkArea(&rcWorkArea, pScreenInfo);
/* Adjust for auto-hide taskbars */
winAdjustForAutoHide(&rcWorkArea, pScreenInfo);
/* Did the user specify a position? */
if (pScreenInfo->fUserGavePosition) {
iPosX = pScreenInfo->dwInitialX;
iPosY = pScreenInfo->dwInitialY;
}
else {
iPosX = rcWorkArea.left;
iPosY = rcWorkArea.top;
}
/* Clean up the scrollbars flag, if necessary */
if ((!pScreenInfo->fDecoration
#ifdef XWIN_MULTIWINDOWEXTWM
|| pScreenInfo->fMWExtWM
#endif
|| pScreenInfo->fRootless
#ifdef XWIN_MULTIWINDOW
|| pScreenInfo->fMultiWindow
#endif
)
&& (pScreenInfo->iResizeMode == resizeWithScrollbars)) {
/* We cannot have scrollbars if we do not have a window border */
//.........这里部分代码省略.........
开发者ID:AmesianX,项目名称:xorg-server,代码行数:101,代码来源:wincreatewnd.c
示例7: WinMain
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprev, PSTR cmdline, int ishow)
{
HWND hwnd;
MSG msg;
WNDCLASSEX wndclassex = {0};
SDBuffer doubleBuff = {0}; // This is our "double buffer" struct
// Fill the fields we care about
wndclassex.cbSize = sizeof(WNDCLASSEX);
wndclassex.style = CS_HREDRAW | CS_VREDRAW;
wndclassex.lpfnWndProc = WinProc;
wndclassex.hInstance = hinstance;
wndclassex.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wndclassex.lpszClassName = class_name;
wndclassex.hCursor = (HCURSOR)LoadImage(NULL, MAKEINTRESOURCE(IDC_ARROW), IMAGE_CURSOR,
0, 0, LR_SHARED); // Load the default arrow cursor
RegisterClassEx(&wndclassex); // Register the window
hwnd = CreateWindowEx(NULL, // No extra window attributes
class_name,
"www.GameTutorials.com -- Double Buffering",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, // Window will receive a default x pos on screen
CW_USEDEFAULT, // Window will receive a default y pos on screen
WIN_WID,
WIN_HGT,
NULL,
NULL,
hinstance,
NULL);
// Error check
if(!hwnd)
return EXIT_FAILURE; // Something really bad happened!
doubleBuff.win_hwnd = hwnd; // Set the HWND of our double buffer struct
// Attempt to initialize our double buffering
if(!InitDoubleBuffer(doubleBuff))
return EXIT_FAILURE; // Couldn't set up double buffering
// Here we'll load up our bitmap
HBITMAP img_bmp = (HBITMAP)LoadImage(hinstance,"AnImage.bmp",IMAGE_BITMAP,
0,0,LR_LOADFROMFILE);
// Error Check
if(!img_bmp)
return EXIT_FAILURE; // Couldn't load our image
// Create a compatible HDC so that we can draw our "img_bmp"
HDC img_dc = CreateCompatibleDC(doubleBuff.win_dc);
if(!img_dc)
return EXIT_FAILURE;
// Select our "img_bmp" into the "img_dc"
HBITMAP old_bmp = (HBITMAP)SelectObject(img_dc,img_bmp);
ShowWindow(hwnd, ishow);
UpdateWindow(hwnd);
while(1)
{
// Check message(s) if there are any
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if(msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else if(LockFrameRate())
{
#if DOUBLE_BUFFER // If we are using double buffering
// First we fill our back buffer to solid white (the same color as the
// background color of our window)
FillRect(doubleBuff.back_dc,&doubleBuff.rect,(HBRUSH)GetStockObject(WHITE_BRUSH));
// Next we'll draw the bitmap to our back buffer
BitBlt(doubleBuff.back_dc,gXPos,gYPos,gXPos + IMG_WID,
gYPos + IMG_HGT,img_dc,0,0,SRCCOPY);
// Then we draw the back buffer to the front buffer (our window)
BitBlt(doubleBuff.win_dc,0,0,doubleBuff.rect.right,
doubleBuff.rect.bottom,doubleBuff.back_dc,0,0,SRCCOPY);
#else // No double buffering in use
// We fill our window with solid white so we can clear away the "old"
// position of the image
FillRect(doubleBuff.win_dc,&doubleBuff.rect,(HBRUSH)GetStockObject(WHITE_BRUSH));
// Blit the image to the window
BitBlt(doubleBuff.win_dc,gXPos,gYPos,gXPos + IMG_WID,
gYPos + IMG_HGT,img_dc,0,0,SRCCOPY);
//.........这里部分代码省略.........
开发者ID:Allenjonesing,项目名称:tutorials,代码行数:101,代码来源:win_main.cpp
示例8: WndProc
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static POINT apt[4] ;
HDC hdc ;
int cxClient, cyClient ;
PAINTSTRUCT ps ;
switch (message)
{
case WM_SIZE:
cxClient = LOWORD (lParam) ;
cyClient = HIWORD (lParam) ;
apt[0].x = cxClient / 4 ;
apt[0].y = cyClient / 2 ;
apt[1].x = cxClient / 2 ;
apt[1].y = cyClient / 4 ;
apt[2].x = cxClient / 2 ;
apt[2].y = 3 * cyClient / 4 ;
apt[3].x = 3 * cxClient / 4 ;
apt[3].y = cyClient / 2 ;
return 0 ;
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_MOUSEMOVE:
if (wParam & MK_LBUTTON || wParam & MK_RBUTTON)
{
hdc = GetDC (hwnd) ;
SelectObject (hdc, GetStockObject (WHITE_PEN)) ;
DrawBezier (hdc, apt) ;
if (wParam & MK_LBUTTON)
{
apt[1].x = LOWORD (lParam) ;
apt[1].y = HIWORD (lParam) ;
}
if (wParam & MK_RBUTTON)
{
apt[2].x = LOWORD (lParam) ;
apt[2].y = HIWORD (lParam) ;
}
SelectObject (hdc, GetStockObject (BLACK_PEN)) ;
DrawBezier (hdc, apt) ;
ReleaseDC (hwnd, hdc) ;
//.........这里部分代码省略.........
开发者ID:chenhz2284,项目名称:cpp_lib,代码行数:101,代码来源:main4.cpp
示例9: WinMain
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
static TCHAR szAppName[] = TEXT ("Bezier") ;
HWND hwnd ;
MSG msg ;
WNDCLASS wndclass ;
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc= WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground= (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuName= NULL ;
wndclass.lpszClassName= szAppName ;
if (!RegisterClass (&wndclass))
{
MessageBox (NULL, TEXT ("Program requires Windows NT!"),
szAppName, MB_ICONERROR) ;
return 0 ;
}
hwnd = CreateWindow (szAppName, TEXT ("Bezier Splines"),
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 ;
}
开发者ID:chenhz2284,项目名称:cpp_lib,代码行数:82,代码来源:main4.cpp
示例10: GetClientRect
//.........这里部分代码省略.........
bounds.left = bounds.right = 0;
bounds.top = row * metrics().debug_font_height();
bounds.bottom = bounds.top + metrics().debug_font_height();
// start with a brush on iteration #0
if (iter == 0)
bgbrush = CreateSolidBrush(bgcolor);
// iterate over columns
for (UINT32 col = 0; col < visarea.x; col++)
{
// if the attribute changed, adjust the colors
if (viewdata[col].attrib != last_attrib)
{
COLORREF oldbg = bgcolor;
// reset to standard colors
fgcolor = RGB(0x00,0x00,0x00);
bgcolor = RGB(0xff,0xff,0xff);
// pick new fg/bg colors
if (viewdata[col].attrib & DCA_VISITED) bgcolor = RGB(0xc6, 0xe2, 0xff);
if (viewdata[col].attrib & DCA_ANCILLARY) bgcolor = RGB(0xe0,0xe0,0xe0);
if (viewdata[col].attrib & DCA_SELECTED) bgcolor = RGB(0xff,0x80,0x80);
if (viewdata[col].attrib & DCA_CURRENT) bgcolor = RGB(0xff,0xff,0x00);
if ((viewdata[col].attrib & DCA_SELECTED) && (viewdata[col].attrib & DCA_CURRENT)) bgcolor = RGB(0xff,0xc0,0x80);
if (viewdata[col].attrib & DCA_CHANGED) fgcolor = RGB(0xff,0x00,0x00);
if (viewdata[col].attrib & DCA_INVALID) fgcolor = RGB(0x00,0x00,0xff);
if (viewdata[col].attrib & DCA_DISABLED) fgcolor = RGB((GetRValue(fgcolor) + GetRValue(bgcolor)) / 2, (GetGValue(fgcolor) + GetGValue(bgcolor)) / 2, (GetBValue(fgcolor) + GetBValue(bgcolor)) / 2);
if (viewdata[col].attrib & DCA_COMMENT) fgcolor = RGB(0x00,0x80,0x00);
// flush any pending drawing
if (count > 0)
{
bounds.right = bounds.left + (count * metrics().debug_font_width());
if (iter == 0)
FillRect(dc, &bounds, bgbrush);
else
ExtTextOut(dc, bounds.left, bounds.top, 0, nullptr, buffer, count, nullptr);
bounds.left = bounds.right;
count = 0;
}
// set the new colors
if (iter == 0 && oldbg != bgcolor)
{
DeleteObject(bgbrush);
bgbrush = CreateSolidBrush(bgcolor);
}
else if (iter == 1)
SetTextColor(dc, fgcolor);
last_attrib = viewdata[col].attrib;
}
// add this character to the buffer
buffer[count++] = viewdata[col].byte;
}
// flush any remaining stuff
if (count > 0)
{
bounds.right = bounds.left + (count * metrics().debug_font_width());
if (iter == 0)
FillRect(dc, &bounds, bgbrush);
else
ExtTextOut(dc, bounds.left, bounds.top, 0, nullptr, buffer, count, nullptr);
}
// erase to the end of the line
if (iter == 0)
{
bounds.left = bounds.right;
bounds.right = client.right;
FillRect(dc, &bounds, bgbrush);
DeleteObject(bgbrush);
}
}
// advance viewdata
viewdata += visarea.x;
}
// erase anything beyond the bottom with white
GetClientRect(m_wnd, &client);
client.top = visarea.y * metrics().debug_font_height();
FillRect(dc, &client, (HBRUSH)GetStockObject(WHITE_BRUSH));
// reset the font
SetBkMode(dc, oldbkmode);
SetTextColor(dc, oldfgcolor);
SelectObject(dc, oldfont);
// blit the final results
BitBlt(windc, 0, 0, client.right, client.bottom, dc, 0, 0, SRCCOPY);
// undo the offscreen stuff
SelectObject(dc, oldbitmap);
DeleteObject(bitmap);
DeleteDC(dc);
}
开发者ID:RalfVB,项目名称:mame,代码行数:101,代码来源:debugviewinfo.cpp
示例11: smileys
HRESULT CGifSmileyCtrl::OnDrawSmiley(ATL_DRAWINFO& di, bool bCustom=false)
{
USES_CONVERSION;
if (di.dwDrawAspect != DVASPECT_CONTENT)
{
return E_FAIL;
}
if ( bCustom && !IsVisible(di))
{
return S_OK;
}
if (!m_pGifImage)
{
return E_FAIL;
}
RECT& rc = *(RECT*)di.prcBounds;
HRGN hOldRgn, hNewRgn;
if (!IsRectEmpty(&m_rectPos))
{ //strange workaround for drawing zoom out smileys (look MS calculate it one pix larger than exactly)
if (rc.bottom-rc.top-1 == m_rectPos.bottom-m_rectPos.top
&& rc.right-rc.left== m_rectPos.right-m_rectPos.left)
rc.top+=1;
}
if ( bCustom )SelectSmileyClipRgn(di.hdcDraw, rc, hOldRgn, hNewRgn, TRUE);
InflateRect(&rc,-1,0); //border offset to fix blinked cursor painting
if ( (m_dwFlags&REO_INVERTEDSELECT) == 0 || !bCustom || m_bTransparent)
DoDrawSmiley(di.hdcDraw, rc, rc.right-rc.left,rc.bottom-rc.top, m_nFrameSize.Width, m_nFrameSize.Height);
else
{
Bitmap bmp(rc.right-rc.left,rc.bottom-rc.top, PixelFormat32bppARGB);
Graphics g(&bmp);
COLORREF col=(COLORREF)(m_clrBackColor);
SolidBrush brush(Color(GetRValue(col),GetGValue(col),GetBValue(col)));
g.FillRectangle( &brush, 0 ,0, rc.right-rc.left, rc.bottom-rc.top);
HDC hdc=g.GetHDC();
RECT mrc={0};
mrc.right=rc.right-rc.left;
mrc.bottom=rc.bottom-rc.top;
DoDrawSmiley(hdc, mrc, mrc.right-mrc.left,mrc.bottom-mrc.top, m_nFrameSize.Width, m_nFrameSize.Height);
InvertRect(hdc, &mrc);
BitBlt(di.hdcDraw, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, hdc, 0, 0, SRCCOPY );
g.ReleaseHDC(hdc);
}
if ((m_dwFlags&REO_SELECTED) == REO_SELECTED && bCustom)
{
//Draw frame around
HBRUSH oldBrush=(HBRUSH)SelectObject(di.hdcDraw, GetStockObject(NULL_BRUSH));
HPEN oldPen=(HPEN)SelectObject(di.hdcDraw, GetStockObject(BLACK_PEN));
::Rectangle(di.hdcDraw, rc.left, rc.top, rc.right, rc.bottom );
SelectObject(di.hdcDraw, oldBrush);
SelectObject(di.hdcDraw, oldPen);
}
AdvanceFrame();
if (!bCustom)
m_bPaintValid=false;
ResetClip(di.hdcDraw, hOldRgn, hNewRgn);
return S_OK;
}
开发者ID:hgl888,项目名称:TeamTalk,代码行数:63,代码来源:GifSmileyCtrl.cpp
示例12: DisViewBox_OnPaint
LRESULT DisViewBox_OnPaint(HWND hwnd, disview_struct *win, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
SIZE fontsize;
TCHAR text[100];
TCHAR txt[100];
RECT rect;
int lg;
int ht;
HDC mem_dc;
HBITMAP mem_bmp;
u32 nbligne;
GetClientRect(hwnd, &rect);
lg = rect.right - rect.left;
ht = rect.bottom - rect.top;
hdc = BeginPaint(hwnd, &ps);
mem_dc = CreateCompatibleDC(hdc);
mem_bmp = CreateCompatibleBitmap(hdc, lg, ht);
SelectObject(mem_dc, mem_bmp);
FillRect(mem_dc, &rect, (HBRUSH)GetStockObject(WHITE_BRUSH));
SelectObject(mem_dc, GetStockObject(SYSTEM_FIXED_FONT));
GetTextExtentPoint32(mem_dc, "0", 1, &fontsize);
nbligne = ht/fontsize.cy;
SetTextColor(mem_dc, RGB(0,0,0));
if((win->mode==1) || ((win->mode==0) && (win->cpu->CPSR.bits.T == 0)))
{
u32 i;
u32 adr;
if (win->autoup||win->autogo)
win->curr_ligne = (win->cpu->instruct_adr >> 2);
adr = win->curr_ligne*4;
for(i = 0; i < nbligne; ++i)
{
u32 ins = _MMU_read32(win->cpu->proc_ID, MMU_AT_DEBUG, adr);
des_arm_instructions_set[INDEX(ins)](adr, ins, txt);
sprintf(text, "%04X:%04X %08X %s", (int)(adr>>16), (int)(adr&0xFFFF), (int)ins, txt);
DrawText(mem_dc, text, -1, &rect, DT_TOP | DT_LEFT | DT_NOPREFIX);
rect.top+=fontsize.cy;
adr += 4;
}
if(((win->cpu->instruct_adr&0x0FFFFFFF) >= (win->curr_ligne<<2))&&((win->cpu->instruct_adr&0x0FFFFFFF) <= (win->curr_ligne+(nbligne<<2))))
{
HBRUSH brjaune = CreateSolidBrush(RGB(255, 255, 0));
SetBkColor(mem_dc, RGB(255, 255, 0));
rect.top = (((win->cpu->instruct_adr&0x0FFFFFFF)>>2) - win->curr_ligne)*fontsize.cy;
rect.bottom = rect.top + fontsize.cy;
FillRect(mem_dc, &rect, brjaune);
des_arm_instructions_set[INDEX(win->cpu->instruction)](win->cpu->instruct_adr, win->cpu->instruction, txt);
sprintf(text, "%04X:%04X %08X %s", (int)((win->cpu->instruct_adr&0x0FFFFFFF)>>16), (int)(win->cpu->instruct_adr&0xFFFF), (int)win->cpu->instruction, txt);
DrawText(mem_dc, text, -1, &rect, DT_TOP | DT_LEFT | DT_NOPREFIX);
DeleteObject(brjaune);
}
开发者ID:rafaelmessias,项目名称:desmume,代码行数:67,代码来源:disView.cpp
示例13: sizeof
/*============================================
* BasicWindow::registWC__()
* WNDCLASS登録 & WNDCLASS名を返す
* 同じ内容のWNDCLASSの二重登録を阻止する
*==========================================*/
std::wstring urania::BasicWindow::registWC__
(const urania::BasicWindow::WC_& wc)
{
std::vector<WC_>::iterator it = std::find(vwc_S.begin(), vwc_S.end(), wc);
if (it == vwc_S.end())
{
////////////////////////////////////////////////////////
// WNDCLASSの登録とvectorへの追加
////////////////////////////////////////////////////////
// クラス名をWC_に設定
WC_ wc2 = wc;
//std::wostringstream tmp;
std::basic_ostringstream<wchar_t> tmp;
tmp << vwc_S.size();
wc2.wcname_ = std::wstring(L"GPWNDCLASS") + tmp.str();
// WNDCLASS Structure
WNDCLASS wndcls =
{
CS_HREDRAW | CS_VREDRAW,
wc2.proc_,
0,
sizeof(Window*),
getHI__(),
NULL,
NULL,
NULL,
nullptr,
wc2.wcname_.c_str()
};
// Icon の設定
if (wc2.icon_id_ != DEFAULT_RC)
wndcls.hIcon = LoadIcon(getHI__(), MAKEINTRESOURCE(wc2.icon_id_));
else
wndcls.hIcon = LoadIcon(0, IDI_APPLICATION);
// Cursor の設定
if (wc2.cursor_id_ != DEFAULT_RC)
wndcls.hCursor = LoadCursor(getHI__(), MAKEINTRESOURCE(wc2.cursor_id_));
else
wndcls.hCursor = LoadCursor(0, IDC_ARROW);
// 背景色の設定
switch (wc2.bkcolor_)
{
case BG_WHITE:
wndcls.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
break;
case BG_BLACK:
wndcls.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
break;
case BG_GRAY:
wndcls.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
break;
case BG_LTGRAY:
wndcls.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
break;
case BG_DKGRAY:
wndcls.hbrBackground = (HBRUSH)GetStockObject(DKGRAY_BRUSH);
break;
case BG_APPWORKSPACE:
wndcls.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE + 1);
break;
case BG_BKWINDOW:
wndcls.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
break;
default:
wndcls.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
break;
}
// 実際に登録
::RegisterClass(&wndcls);
vwc_S.push_back(wc2);
return wc2.wcname_;
}
else
return it->wcname_; // WNDCLASS名を返す
}
开发者ID:oz-acy,项目名称:urania,代码行数:96,代码来源:bwin.cpp
示例14: EnumerateFonts
NTSTATUS
EnumerateFonts(
DWORD Flags)
{
TEXTMETRIC tmi;
HDC hDC;
PFACENODE pFN;
ULONG ulOldEnumFilter;
DWORD FontIndex;
DWORD dwFontType = 0;
DBGFONTS(("EnumerateFonts %lx\n", Flags));
dwFontType = (EF_TTFONT|EF_OEMFONT|EF_DEFFACE) & Flags;
if (FontInfo == NULL) {
//
// allocate memory for the font array
//
NumberOfFonts = 0;
FontInfo = (PFONT_INFO)HeapAlloc(pConHeap,MAKE_TAG( FONT_TAG ),sizeof(FONT_INFO) * INITIAL_FONTS);
if (FontInfo == NULL)
return STATUS_NO_MEMORY;
FontInfoLength = INITIAL_FONTS;
}
hDC = CreateDCW(L"DISPLAY",NULL,NULL,NULL);
// Before enumeration, turn off font enumeration filters.
ulOldEnumFilter = SetFontEnumeration(0);
// restore all the other flags
SetFontEnumeration(ulOldEnumFilter & ~FE_FILTER_TRUETYPE);
if (Flags & EF_DEFFACE) {
SelectObject(hDC,GetStockObject(OEM_FIXED_FONT));
if (GetTextMetricsW(hDC, &tmi)) {
DefaultFontSize.X = (SHORT)(tmi.tmMaxCharWidth);
DefaultFontSize.Y = (SHORT)(tmi.tmHeight+tmi.tmExternalLeading);
DefaultFontFamily = tmi.tmPitchAndFamily;
}
GetTextFaceW(hDC, LF_FACESIZE, DefaultFaceName);
DBGFONTS(("Default (OEM) Font %ls (%d,%d)\n", DefaultFaceName,
DefaultFontSize.X, DefaultFontSize.Y));
// Make sure we are going to enumerate the OEM face.
pFN = AddFaceNode(&gpFaceNames, DefaultFaceName);
pFN->dwFlag |= EF_DEFFACE | EF_OEMFONT;
}
// Use DoFontEnum to get all fonts from the system. Our FontEnum
// proc puts just the ones we want into an array
//
for (pFN = gpFaceNames; pFN; pFN = pFN->pNext) {
DBGFONTS(("\"%ls\" is %s%s%s%s%s%s\n", pFN->awch,
pFN->dwFlag & EF_NEW ? "NEW " : " ",
pFN->dwFlag & EF_OLD ? "OLD " : " ",
pFN->dwFlag & EF_ENUMERATED ? "ENUMERATED " : " ",
pFN->dwFlag & EF_OEMFONT ? "OEMFONT " : " ",
pFN->dwFlag & EF_TTFONT ? "TTFONT " : " ",
pFN->dwFlag & EF_DEFFACE ? "DEFFACE " : " "));
if ((pFN->dwFlag & dwFontType) == 0) {
// not the kind of face we want
continue;
}
if (pFN->dwFlag & EF_ENUMERATED) {
// we already enumerated this face
continue;
}
DoFontEnum(hDC, pFN->awch, DefaultFontSize.Y);
pFN->dwFlag |= EF_ENUMERATED;
}
// After enumerating fonts, restore the font enumeration filter.
SetFontEnumeration(ulOldEnumFilter);
DeleteDC(hDC);
// Make sure the default font is set correctly
if (NumberOfFonts > 0 && DefaultFontSize.X == 0 && DefaultFontSize.Y == 0) {
DefaultFontSize.X = FontInfo[0].Size.X;
DefaultFontSize.Y = FontInfo[0].Size.Y;
DefaultFontFamily = FontInfo[0].Family;
}
for (FontIndex = 0; FontIndex < NumberOfFonts; FontIndex++) {
if (FontInfo[FontIndex].Size.X == DefaultFontSize.X &&
FontInfo[FontIndex].Size.Y == DefaultFontSize.Y &&
FontInfo[FontIndex].Family == DefaultFontFamily) {
break;
}
}
ASSERT(FontIndex < NumberOfFonts);
if (FontIndex < NumberOfFonts) {
DefaultFontIndex = FontIndex;
} else {
//.........这里部分代码省略.........
开发者ID:Gaikokujin,项目名称:WinNT4,代码行数:101,代码来源:misc.c
示例15: WinMain
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst,
LPSTR lpszCmdLine, int nCmdShow)
{
MSG msg;
WNDCLASS myProg;
if(!hPreInst)
{
myProg.style=CS_HREDRAW|CS_VREDRAW;
myProg.lpfnWndProc=WndProc;
myProg.cbClsExtra=0;
myProg.cbWndExtra=0;
myProg.hInstance=hInstance;
myProg.hIcon=NULL;
myProg.hCursor=LoadCursor(NULL,IDC_ARROW);
myProg.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
myProg.lpszMenuName=NULL;
myProg.lpszClassName = _T("クラスネーム");
if(!RegisterClass(&myProg))
return FALSE;
}
hWnd = CreateWindow(
myProg.lpszClassName,
_T("ballaction"),
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_CLIPCHILDREN, //ウィンドウスタイル
CW_USEDEFAULT, CW_USEDEFAULT, //ウィンドウ座標
WINDOW_WIDTH, WINDOW_HEIGHT, //ウィンドウサイズ
NULL,
NULL,
hInstance,
NULL);
//CreateWindowで設定した幅と高さの値は、タイトルバーや枠のサイズも含めたものになってしまうので
//クライアント領域を取得し、ウィンドウサイズを設定し直す。
RECT wRect, cRect; // ウィンドウ全体の矩形、クライアント領域の矩形
int ww, wh; // ウィンドウ全体の幅、高さ
int cw, ch; // クライアント領域の幅、高さ
// ウィンドウ全体の幅・高さを計算
GetWindowRect(hWnd, &wRect);
ww = wRect.right - wRect.left;
wh = wRect.bottom - wRect.top;
// クライアント領域の幅・高さを計算
GetClientRect(hWnd, &cRect);
cw = cRect.right - cRect.left;
ch = cRect.bottom - cRect.top;
// クライアント領域以外に必要なサイズを計算
ww = ww - cw;
wh = wh - ch;
// ウィンドウ全体に必要なサイズを計算
ww = WINDOW_WIDTH + ww;
wh = WINDOW_HEIGHT + wh;
// 計算した幅と高さをウィンドウに設定
SetWindowPos(hWnd, HWND_TOP, 0, 0, ww, wh, SWP_NOMOVE);
ShowWindow(hWnd,nCmdShow);
UpdateWindow(hWnd);
srand((UINT)time(NULL)); //乱数初期化
//タスクリスト初期化(最初のタスクも作成しておく)
TaskGM::InitTaskList();
game_manager = new GameManager2(hWnd, WINDOW_WIDTH, WINDOW_HEIGHT);
//タイマー作成
game_manager->createTimer();
new ballaction(game_manager);
while(true)
{
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if(msg.message==WM_QUIT) break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
Task::RunTask(); // 値の更新
}
}
return(msg.wParam);
}
开发者ID:nalu,项目名称:LispCode,代码行数:88,代码来源:main.cpp
示例16: InitInstance
static HWND
InitInstance(HINSTANCE hInst)
{
WCHAR szClass[] = L"CharMap";
WCHAR szTitle[256];
WNDCLASSEXW wc;
HWND hWnd;
LoadStringW(hInst, IDS_TITLE, szTitle, SIZEOF(szTitle));
hSmIcon = LoadImage(hInstance,
MAKEINTRESOURCE(IDI_ICON),
IMAGE_ICON,
16,
16,
0);
hBgIcon = LoadImage(hInstance,
MAKEINTRESOURCE(IDI_ICON),
IMAGE_ICON,
32,
32,
0);
// Create workspace
ZeroMemory(&wc, sizeof(wc));
wc.cbSize = sizeof(wc);
wc.lpfnWndProc = PanelWndProc;
wc.hInstance = hInst;
wc.hIcon = hBgIcon;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = szClass;
wc.hIconSm = hSmIcon;
RegisterClassExW(&wc);
hWnd = CreateWindowW(
szClass,
szTitle,
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInst,
NULL);
if (hWnd != NULL)
{
LoadSettings();
ShowWindow(hWnd, SW_SHOW);
UpdateWindow(hWnd);
}
return hWnd;
}
开发者ID:Strongc,项目名称:reactos,代码行数:61,代码来源:charmap.c
示例17: WinMain
// WINMAIN ////////////////////////////////////////////////
int WINAPI WinMain( HINSTANCE hinstance,
HINSTANCE hprevinstance,
LPSTR lpcmdline,
int ncmdshow)
{
WNDCLASSEX winclass; // this will hold the class we create
HWND hwnd; // generic window handle
MSG msg; // generic message
// first fill in the window class stucture
winclass.cbSize = sizeof(WNDCLASSEX);
winclass.style = CS_DBLCLKS | CS_OWNDC |
CS_HREDRAW | CS_VREDRAW;
winclass.lpfnWndProc = WindowProc;
winclass.cbClsExtra = 0;
winclass.cbWndExtra = 0;
winclass.hInstance = hinstance;
winclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
winclass.hCursor = LoadCursor(NULL, IDC_ARROW);
winclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
winclass.lpszMenuName = NULL;
winclass.lpszClassName = WINDOW_CLASS_NAME;
winclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
// save hinstance in global
hinstance_app = hinstance;
// register the windo
|
请发表评论