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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
|
#define _WIN32_IE 0x0300
// includes
#include <windows.h>
#include <mmsystem.h>
#include <ufmod.h>
#include <sys/stat.h>
#include <commdlg.h>
#include "res.h"
#include "muzic.h"
#include <commctrl.h>
#include "vfw.h"
MCIDEVICEID pDevice = 0;
using namespace std;
HBITMAP hCarBmp = NULL;
HBITMAP hSkinMBmp = NULL;
int i = 0;
HBITMAP hskin;
RECT rc;
HBITMAP hbup;
HBITMAP hbdn;
HBITMAP exitup;
HBITMAP exitdn;
HWND m_Video;
MCI_OPEN_PARMS op;
// Destroy our windows caption
void DestroyCaption(HWND hwnd, int windowWidth, int windowHeight)
{
DWORD dwStyle = GetWindowLong(hwnd, GWL_STYLE);
dwStyle &= ~(WS_CAPTION|WS_SIZEBOX);
SetWindowLong(hwnd, GWL_STYLE, dwStyle);
InvalidateRect(hwnd, NULL, true);
SetWindowPos(hwnd, NULL, 0,0,windowWidth, windowHeight, SWP_NOMOVE | SWP_NOZORDER);
}
// Our dialogs callback routine
BOOL CALLBACK dialog(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
INITCOMMONCONTROLSEX InitCtrlEx;
InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
InitCtrlEx.dwICC = ICC_PROGRESS_CLASS;
InitCommonControlsEx(&InitCtrlEx);
switch(Message)
{
// make window layered and set all pixels with an RGB value of 0,0,255 invisible
case WM_INITDIALOG:
{
case IDC_LIST1:
// It's our listbox, check the notification code
switch(HIWORD(wParam))
{
case LBN_SELCHANGE:
// Selection changed, do stuff here.
break;
}
break;
m_Video = NULL;
//AnimateWindow(hWnd);
}
break;
// move our window
case WM_LBUTTONDOWN:
{
PostMessage(hwnd, WM_NCLBUTTONDOWN, HTCAPTION,0);
break;
}
case WM_DRAWITEM:
{
break;
}
// cleanup
case WM_CLOSE:
{
DeleteObject(hSkinMBmp);
EndDialog(hwnd, 0);
break;
}
// draw our bitmap
case WM_PAINT:
{
RECT rect;
BITMAP bm;
BITMAP talkwithhandle;
PAINTSTRUCT attribstobmp;
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
HDC dcstuff = BeginPaint(hwnd, &attribstobmp);
HDC dcSkin = CreateCompatibleDC(hdc);
HDC dcinmem = CreateCompatibleDC(dcstuff);
GetObject(hSkinMBmp, sizeof(bm), &bm);
GetObject(hCarBmp, sizeof(talkwithhandle), &talkwithhandle);
SelectObject(dcSkin, hSkinMBmp);
SelectObject(dcinmem, hCarBmp);
BitBlt(hdc, 10,10,160,108, dcinmem, 0, 0, SRCCOPY);
DeleteDC(dcSkin);
DeleteDC(dcinmem);
EndPaint(hwnd, &ps);
EndPaint(hwnd, &attribstobmp);
break;
}
case WM_COMMAND:
{
if(((HWND)lParam) && (HIWORD(wParam) == BN_CLICKED)){
int iMID;
iMID = LOWORD(wParam);
switch(iMID){
case ID_ADD:
{
OPENFILENAME ofn; // common dialog box structure
char szFile[260]; // buffer for file name
// Initialize OPENFILENAME
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd; // handle to owner window
ofn.lpstrFile = szFile;
//
// Set lpstrFile[0] to '\0' so that GetOpenFileName does not
// use the contents of szFile to initialize itself.
//
ofn.lpstrTitle = TEXT("Your Title Here");
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
// filter name followed by null followed by filter extension,
// repeat for each filter, and end list with double-null
ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0";
ofn.nFilterIndex = 1; // initial filter to select
ofn.lpstrFileTitle = NULL; // initial file to select
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
// Display the Open dialog box.
if(GetOpenFileName(&ofn) == TRUE){
m_Video = MCIWndCreate(hwnd,NULL,MCIWNDF_NOPLAYBAR,szFile);
MoveWindow (m_Video, 729, 729, 1, 1, TRUE);
SendDlgItemMessage(hwnd, IDC_LIST1, LB_ADDFILE, (WPARAM) NULL, (LPARAM)szFile);
MCIWndPlay(m_Video);
}
}
break;
case ID_PLAY:
{
}
break;
case ID_CLEAR:
{
SendDlgItemMessage(hwnd, IDC_LIST1,LB_RESETCONTENT, 0, 0);
}
break;
case ID_REMOVE:
{
SendDlgItemMessage(hwnd, IDC_LIST1, LB_GETCURSEL, 0, 0);
SendDlgItemMessage(hwnd, IDC_LIST1, LB_DELETESTRING , 0, 0);
}
}}
break;
}
default:
return FALSE;
}
return DefWindowProc(hwnd,Message,wParam,lParam);
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX wc;
wc.cbClsExtra = 0;
wc.cbSize = sizeof(wc);
wc.cbWndExtra = 0;
wc.hbrBackground = NULL;
wc.hIcon = LoadIcon(NULL,MAKEINTRESOURCE(IDI_ICON));
wc.hIconSm = LoadIcon(NULL,MAKEINTRESOURCE(IDI_ICON));
wc.hInstance = GetModuleHandle(NULL);
wc.lpszClassName = "WinPatch";
wc.lpszMenuName = NULL;
wc.style = CS_VREDRAW | CS_HREDRAW | CS_OWNDC |CS_DBLCLKS;
// load our bitmap
hCarBmp= LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BALL));
// create ourlog
return DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG), NULL, dialog);
}
|