#include #include"resource.h" #include"bmp_io.h" #include"hensu.h" #include"clip_board.h" #include #include #include"nichishori.h" #include"tokuchou.h" #include"rinkaku.h" #include LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM); ATOM InitApp(HINSTANCE); BOOL InitInstance(HINSTANCE,int); LRESULT CALLBACK MyDlgProc(HWND hDlg,UINT msg,WPARAM wp,LPARAM lp); LRESULT CALLBACK MyDlgProc2(HWND hDlg,UINT msg,WPARAM wp,LPARAM lp); LRESULT CALLBACK MyDlgProc3(HWND hDlg,UINT msg,WPARAM wp,LPARAM lp); char szClassName[]="template"; int iWidth,iHeight; HINSTANCE hInst; int thresh=128,amp=10; int min,max,radio=1; int WINAPI WinMain(HINSTANCE hCurInst,HINSTANCE hPrevInst, LPSTR lpsCmdLine,int nCmdShow) { MSG msg; BOOL bRet; hInst=hCurInst; if(!InitApp(hCurInst)) return FALSE; if(!InitInstance(hCurInst,nCmdShow)) return FALSE; while((bRet=GetMessage(&msg,NULL,0,0))!=0){ if(bRet==-1){ MessageBox(NULL,"GetMessageƒGƒ‰[","Error",MB_OK); break; }else{ TranslateMessage(&msg); DispatchMessage(&msg); } } return (int)msg.wParam; } ATOM InitApp(HINSTANCE hInst) { WNDCLASSEX wc; wc.cbSize=sizeof(WNDCLASSEX); wc.style=CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc=WndProc; wc.cbClsExtra=0; wc.cbWndExtra=0; wc.hInstance=hInst; wc.hIcon=(HICON)LoadImage(NULL, MAKEINTRESOURCE(IDI_APPLICATION), IMAGE_ICON, 0,0, LR_DEFAULTSIZE|LR_SHARED); wc.hCursor=(HCURSOR)LoadImage(NULL, MAKEINTRESOURCE(IDC_ARROW), IMAGE_CURSOR, 0,0, LR_DEFAULTSIZE|LR_SHARED); wc.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH); wc.lpszMenuName="MYMENU"; wc.lpszClassName=(LPCTSTR)szClassName; wc.hIconSm=(HICON)LoadImage(NULL, MAKEINTRESOURCE(IDI_APPLICATION), IMAGE_ICON, 0,0, LR_DEFAULTSIZE|LR_SHARED); return RegisterClassEx(&wc); } BOOL InitInstance(HINSTANCE hInst,int nCmdShow) { HWND hWnd; hWnd=CreateWindow(szClassName, "‘ๆ‚Vอ@“ม’ฅ‚๐’ฒ‚ื‚้", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInst, NULL); if(!hWnd) return FALSE; ShowWindow(hWnd,nCmdShow); UpdateWindow(hWnd); return TRUE; } LRESULT CALLBACK WndProc(HWND hWnd,UINT msg,WPARAM wp,LPARAM lp) { static BMP_IO mybmp; static LPBITMAPINFO lpbiInfo; static LPDWORD lpPixel,lpPixelNichi,lpPixelBibun,lpPixelShow,lpPixelTemp; static LPDWORD lpPixelMask,lpPixelMask2; HDROP hDrop; char szFileName[256]; HMENU hMenu; MENUITEMINFO mi; INITCOMMONCONTROLSEX ic; static double w,h; int x,y; HDC hdc; PAINTSTRUCT ps; static int cnt; static double size[256],ratio[256]; static char buf[256*256],text[64]; static RECT rc; switch(msg){ case WM_CREATE: DragAcceptFiles(hWnd,TRUE); ic.dwSize=sizeof(INITCOMMONCONTROLSEX); ic.dwICC=ICC_UPDOWN_CLASS; InitCommonControlsEx(&ic); w=1; h=1; rc.left=0; rc.top=0; break; case WM_SIZE: rc.right=LOWORD(lp); rc.bottom=HIWORD(lp); break; case WM_DROPFILES: hDrop=(HDROP)wp; DragQueryFile(hDrop,0,szFileName,sizeof(szFileName)); DragFinish(hDrop); if(!mybmp.bmp_in(szFileName,hWnd)) break; lpbiInfo=&mybmp.biInfo; lpPixel=mybmp.lpPixel; iWidth=mybmp.iWidth; iHeight=mybmp.iHeight; if(lpPixelShow!=NULL) HeapFree(GetProcessHeap(),0,lpPixelShow); lpPixelShow=(LPDWORD)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,6*iWidth*iHeight*4); lpPixelNichi=lpPixelShow+iWidth*iHeight; lpPixelBibun=lpPixelShow+iWidth*iHeight*2; lpPixelMask=lpPixelShow+iWidth*iHeight*3; lpPixelMask2=lpPixelShow+iWidth*iHeight*4; lpPixelTemp=lpPixelShow+iWidth*iHeight*5; for(y=0;y=2 && y=2 && x=2 && y=2 && x