자격증과 세미나, 프로그램 이야기를 주저없이 써봅니다.

Since 2008. 10.

IT 자격증/코딩능력마스터 및 C언어

여자친구용 프로그램 사랑해 소스코드

럭키맨 운수 2012. 8. 4. 17:42

 

여자친구가 보면 좋아할 사랑해, I Love You와 같은 사랑 메시지를 화면에 막 뿌려주는 심플한 프로그램입니다. 아래 소스코드를 수정해서 사용하시면 됩니다. 자료는 하단에 첨부파일 클릭하시면 있습니다.

 

#include <windows.h>
#pragma comment(linker,"/subsystem:windows")
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM); 
HINSTANCE g_hInst;
HWND hWndMain;
LPCTSTR lpszClass=TEXT("Class");

 

int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance
,LPSTR lpszCmdParam,int nCmdShow)
{
HWND hWnd;
MSG Message;
WNDCLASS WndClass; 
g_hInst=hInstance;

 

WndClass.cbClsExtra=0; 
WndClass.cbWndExtra=0; 
WndClass.hbrBackground=(HBRUSH)(COLOR_WINDOW+1); 
WndClass.hCursor=LoadCursor(NULL,IDC_ARROW); 
WndClass.hIcon=LoadIcon(NULL,IDI_APPLICATION); 
WndClass.hInstance=hInstance; 
WndClass.lpfnWndProc=WndProc; 
WndClass.lpszClassName=lpszClass; 
WndClass.lpszMenuName=NULL; 
WndClass.style=CS_HREDRAW | CS_VREDRAW; 
RegisterClass(&WndClass);

 

hWnd=CreateWindow(lpszClass,lpszClass,WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
NULL,(HMENU)NULL,hInstance,NULL);
ShowWindow(hWnd,SW_HIDE);

 

while (GetMessage(&Message,NULL,0,0)) {
TranslateMessage(&Message);
DispatchMessage(&Message);
}
return (int)Message.wParam;
}

 

LRESULT CALLBACK WndProc(HWND hWnd,UINT iMessage,WPARAM wParam,LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
// HWND hWin;
HFONT hFontEdit;
HFONT oldFont;
static char *szName[5]={"사랑해~","I LOVE YOU","그대가 있어 행복합니다","♡","Loving you"};
static int i=0;
int name;
int Wx;
int Wy;
switch (iMessage) {
case WM_CREATE:

 

hWndMain=hWnd;
SetTimer(hWnd,1,50,NULL);
return 0;
case WM_TIMER:
if (i==0)
{
i++;
MessageBox(hWnd,"그만할까?","끝내기",MB_OK);

 

PostQuitMessage(0);
}
Wx=GetSystemMetrics(SM_CXSCREEN);
Wy=GetSystemMetrics(SM_CYSCREEN);

 

hWnd = GetDesktopWindow();//바탕화면의 윈도우
hdc = GetWindowDC(hWnd);//바탕화면에 그릴 준비
hFontEdit=CreateFont(rand()%50,0,rand()%1800,0,0,0,0,0,DEFAULT_CHARSET,0,0,0,0,TEXT("고딕"));
oldFont=(HFONT)SelectObject(hdc,hFontEdit);
SetTextColor(hdc,RGB(rand()%250+50,rand()%250+50,rand()%250+50));
SetBkMode(hdc,TRANSPARENT);

 

name=rand()%5;
TextOut(hdc,rand()%Wx,rand()%Wy,szName[name],strlen(szName[name]));

 

SelectObject(hdc,oldFont);
DeleteObject(hFontEdit);
ReleaseDC(hWnd, hdc);
DeleteObject(hdc);

 

return 0;
case WM_PAINT:
hdc=BeginPaint(hWnd, &ps);

 

// TextOut(hdc,rand()%100,rand()%100,"11",2);

 

EndPaint(hWnd, &ps);
return 0;
case WM_DESTROY:
KillTimer(hWnd,1);
PostQuitMessage(0);
return 0;
}
return(DefWindowProc(hWnd,iMessage,wParam,lParam));
}

사랑해.exe
0.03MB
msvcr100d.dll
1.43MB
사랑해 소스.txt
0.0MB