블로그 이미지
안녕1999

카테고리

전체 (3067)
자바스크립트 (20)
안드로이드 (14)
WebGL (4)
변비 (17)
정치,경제 (35)
C언어,ARM (162)
컴퓨터(PC, Note Book, 윈.. (41)
전자회로, PCB (27)
유머,안웃긴,GIF,동영상 (118)
국부론60 (71)
모듈(PCB) (3)
건강 (2)
FreeCAD (25)
PADS (43)
퇴직,퇴사,구직,취업 활동 (3)
C# (86)
엑셀 (8)
워드 (0)
LabView (6)
레고 (30)
FPGA (0)
Total
Today
Yesterday

달력

« » 2024.5
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

공지사항

최근에 올라온 글

'CentreWindow'에 해당되는 글 1건

  1. 2016.08.31 CentreWindow

CentreWindow

카테고리 없음 / 2016. 8. 31. 23:30

// Move the given window to the centre of the screen

// and bring it to the top.

void CentreWindow(HWND hwnd)

{

RECT winrect, workrect;

// Find how large the desktop work area is

SystemParametersInfo(SPI_GETWORKAREA, 0, &workrect, 0);

int workwidth = workrect.right -  workrect.left;

int workheight = workrect.bottom - workrect.top;

// And how big the window is

GetWindowRect(hwnd, &winrect);

int winwidth = winrect.right - winrect.left;

int winheight = winrect.bottom - winrect.top;

// Make sure it's not bigger than the work area

winwidth = min(winwidth, workwidth);

winheight = min(winheight, workheight);


// Now centre it

SetWindowPos(hwnd, 

HWND_TOP,

workrect.left + (workwidth-winwidth) / 2,

workrect.top + (workheight-winheight) / 2,

winwidth, winheight, 

SWP_SHOWWINDOW);

SetForegroundWindow(hwnd);

}

Posted by 안녕1999
, |

최근에 달린 댓글

글 보관함