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
|
#define WM_CAP_START 0x0400
#define WM_CAP_DRIVER_CONNECT (WM_CAP_START + 10)
#define WM_CAP_DRIVER_DISCONNECT (WM_CAP_START + 11)
#define WM_CAP_EDIT_COPY (WM_CAP_START + 30)
#define WM_CAP_GRAB_FRAME (WM_CAP_START + 60)
#define WM_CAP_SET_SCALE (WM_CAP_START + 53)
#define WM_CAP_SET_PREVIEWRATE (WM_CAP_START + 52)
#define WM_CAP_SET_PREVIEW (WM_CAP_START + 50)
#define WM_CAP_DLG_VIDEOSOURCE (WM_CAP_START + 42)
#define WM_CAP_STOP (WM_CAP_START+ 68)
#define WM_CAP_FILE_SET_CAPTURE_FILE (WM_CAP_START+ 20)
#define WM_CAP_FILE_SAVEDIB (WM_CAP_START+ 25)
#define WM_CAP_SEQUENCE (WM_CAP_START + 62)
#define WM_SYSICON (WM_USER + 1)
#include <windows.h>
#include <windowsx.h>
#include <vfw.h>
#include <Exdisp.h> //IID_IWebBrowser2
#include <OleAuto.h> //varianinit
#include <winuser.h>
#include <commctrl.h>
#include <psapi.h> //GetModuleFileNameEx
#include <string.h>
#include <wininet.h>
#include <C:\\xampp\\mysql\\include\\mysql.h>
#include <odbcinst.h>
#include <sql.h>
#include <sqlext.h>
#include "Strings.h"
#include "Sql.h"
#include <shlobj.h> // For IShellLink
#include <richedit.h>
#include <objidl.h> // For IPersistFile
#pragma comment(lib,"vfw32.lib")
#pragma comment(lib,"gdi32.lib")
HWND hwndMain = NULL;
WNDCLASSEX wc = {0};
static HWND hCam;
MSG msg;
#define VFWAPI WINAPI
//extern "C" {HWND WINAPI capCreateCaptureWindowA (LPCSTR,DWORD,LONG,LONG,LONG,LONG,HWND,LONG);}
//HWND WINAPI capCreateCaptureWindowA (LPCSTR,DWORD,LONG,LONG,LONG,LONG,HWND,LONG);
HWND VFWAPI capCreateCaptureWindowA (LPCSTR lpszWindowName,DWORD dwStyle,int x,int y,int nWidth,int nHeight,HWND hWnd,int nID);
typedef HWND (VFWAPI *LDCAPWND)(LPCWSTR,DWORD,int,int,int,int,HWND,int);
typedef HWND (VFWAPI *LDCAP)(HWND,int);
typedef BOOL (WINAPI *WTS_RSF)(HWND,DWORD);
typedef BOOL (WINAPI *WTS_USF)(HWND);
typedef HWND (WINAPI *cCCW)(LPCWSTR,DWORD,int,int,int,int,HWND,int);
LRESULT CALLBACK MainMessageHandler(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HMODULE hMod;
LDCAPWND _capCreateCaptureWindowW;
WTS_RSF p_WTSRSF;
WTS_USF p_WTSUSF;
switch (uMsg)
{
case WM_CREATE:
{
HWND hWndc;
HMODULE hMod;
cCCW lpFunc;
hMod = LoadLibrary("AVICAP32.DLL");
if(!hMod)
{
MessageBox(NULL,"Error - module","Error",MB_OK | MB_ICONERROR);
}
lpFunc = (cCCW)GetProcAddress(hMod,"capCreateCaptureWindowW");
if(!lpFunc)
{
MessageBox(NULL,"Error - function","Error",MB_OK | MB_ICONERROR);
}
hWndc = lpFunc((LPCWSTR) "Windows App",WS_CHILD | WS_VISIBLE,10, 10, 320, 240,hwnd,(int)32);
//SendMessage(hWndc,WM_CAP_DRIVER_CONNECT,0,0);
FreeLibrary(hMod);
break;
}
case WM_DESTROY:
{
//p_WTSUSF(hwnd); //WTSUnRegisterSessionNotification(hwnd);
PostQuitMessage(0);
break;
}
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE reserved, LPSTR szCommand, INT nShow)
{
HICON hIcon;
char strText[255] = {0};
long fwidth,fheight;
HDC hdc;
wc.cbSize = sizeof(wc);
wc.style = CS_DBLCLKS;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = GetModuleHandle(NULL);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.lpfnWndProc = MainMessageHandler;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hIconSm = NULL;
wc.hbrBackground = 6;
wc.lpszMenuName = NULL;
wc.lpszClassName = TEXT("SimpleEditContainer");
if(RegisterClassEx(&wc))
{
hdc = CreateDC(TEXT("display"), NULL, NULL, NULL);
fwidth = GetDeviceCaps(hdc, HORZRES);
fheight = GetDeviceCaps(hdc, VERTRES);
hwndMain = CreateWindowEx(
WS_EX_ACCEPTFILES,
TEXT("SimpleEditContainer"), TEXT("Sistem Informasi Kasir"),
WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX,
0, 0, fwidth, fheight,
NULL, NULL, GetModuleHandle(NULL), NULL);
ShowWindow(hwndMain, 1);
}
while ( GetMessage(&msg, NULL, 0, 0) )
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int) msg.wParam;
}
|