C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 7th, 2012, 12:42 AM
FritzGamaliel FritzGamaliel is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 1 FritzGamaliel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 m 49 sec
Reputation Power: 0
Trying to make WebCam Application

Hi,

I create the following code:
Code:
#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; }



Then, I compile with this:
gcc source.c -o source libraryProfCAT/winmm.lib libraryProfCAT/comdlg32.lib libraryProfCAT/wininet.lib libraryProfCAT/gdi32.lib libraryProfCAT/comctl32.lib libraryProfCAT/vfw32.lib libraryProfCAT/netapi32.lib libraryProfCAT/mpr.lib libraryProfCAT/iphlpapi.lib libraryProfCAT/ole32.lib libraryProfCAT/winspool.lib libraryProfCAT/setupapi.lib libraryProfCAT/shlwapi.lib libraryProfCAT/wtsapi32.lib libraryProfCAT/oleaut32.lib -lmysql -lodbc32 -lodbccp32 -lws2_32 -lwinmm -lpsapi -luuid -lole32


And I run source.exe, but the application terminate automatically. Are you have same problem with me?
Help please

Thanks!

Reply With Quote
  #2  
Old November 7th, 2012, 01:31 AM
salem's Avatar
salem salem is offline
Contributed User
Click here for more information
 
Join Date: Jun 2005
Posts: 3,840 salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 153 Folding Title: Novice Folder
Time spent in forums: 2 Months 3 Weeks 2 Days 19 h 19 m 34 sec
Reputation Power: 1774
I suggest you look at your post again, and figure out whether "all the code on one line" is in any way acceptable.

Nobody is going to give you any time at all until you show reasonably presentable code.
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Trying to make WebCam Application

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap