Thread

Members
  • Content count

    45
  • Joined

  • Last visited

Community Reputation

122 Neutral

About Thread

  • Rank
    Member
  1. Quote:Original post by Evil Steve Quote:Original post by Thread Ok, thanks for helping me. I want to say, it is not the installation of the DX9SDK. I have try it on a annother fress pc wit new installation. The DXI8 examples (Joystick ans Drummpad) from the SDK also faild to run. When i take of the usb > dmx controller, DXI 8 works good. Connect....running again..crash.. The same testing with the DI7 version, no problen at all??? My game running now on DirectInput7, no problem, but wy not DXI8?? thanks and regards, Henk..Do the SDK samples crash? Or do they say they can't find the device? If they crash, that makes me think it's either a bad SDK install (If you're compiling them, not running the binaries), or a flakey driver for the input device you're using. Yes, I think the Usb HID (uc)firmware from the VM116 usb/dmx controller is not good? why DI7 well and DI8 not, i dont now. Tomorrow i go to the shop for another USB/DMX device and test this device with DI8... regards...
  2. Ok, thanks for helping me. I want to say, it is not the installation of the DX9SDK. I have try it on a annother fress pc wit new installation. The DXI8 examples (Joystick ans Drummpad) from the SDK also faild to run. When i take of the usb > dmx controller, DXI 8 works good. Connect....running again..crash.. The same testing with the DI7 version, no problen at all??? My game running now on DirectInput7, no problem, but wy not DXI8?? thanks and regards, Henk..
  3. Quote:Original post by Evil Steve Quote:Original post by Thread When i use DirectInput8 DirectInput8_EnumDevices this fails.Fails how? Returns an error? Crashes? Sets your computer on fire? If it returns an error, what error code does it return? Quote:Original post by Thread When i use DirectInput7 dinput.h with input.lib it works fine.DI7 and DI8 almost certainly take different parameters, and you're passing an invalid parameter to the DI8 version. Quote:Original post by Thread DirectInput8 memory access write error, DirectInput7 not?Do you mean you get an Access Violation when using the DI8 code? If so, what's the exact error, and what's the address? This sort of thing is almost always a bug in your code; for instance assuming that CreateDevice() succeeds, and then dereferencing a null or invalid pointer. Hello, I get an Access Violation when using the DI8 code on different adresses. The message: Unhandled exception at 0x6d336324 in joystick.exe: 0xC0000005: Access violation writing location 0xf79d8248. 6D336322 jmp 6D336328 6D336324 mov dword ptr [ebx+eax*8+40h],ecx 6D336328 push ebx 6D336329 call 6D32B433 Parts of the code here: maybe DirectInput8Create and CreateDevice or in version 7 DirectInputCreateEx and CreateDeviceEx, the Ex.??? Thanks for helping.. regards. The Directinput 8 version, this fails. //----------------------------------------------------------------------------- // Name: InitDirectInput() // Desc: Initialize the DirectInput variables. //----------------------------------------------------------------------------- HRESULT InitDirectInput( HWND hDlg ) { HRESULT hr; // Register with the DirectInput subsystem and get a pointer // to a IDirectInput interface we can use. // Create a DInput object if( FAILED( hr = DirectInput8Create( GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (VOID**)&g_pDI, NULL ) ) ) return hr; // Look for a simple joystick we can use for this sample program. if( FAILED( hr = g_pDI->EnumDevices( DI8DEVCLASS_GAMECTRL, EnumJoysticksCallback, NULL, DIEDFL_ATTACHEDONLY ) ) ) return hr; // Make sure we got a joystick if( NULL == g_pJoystick ) { MessageBox( NULL, TEXT("Joystick not found. The sample will now exit."), TEXT("DirectInput Sample"), MB_ICONERROR | MB_OK ); EndDialog( hDlg, 0 ); return S_OK; } // Set the data format to "simple joystick" - a predefined data format // // A data format specifies which controls on a device we are interested in, // and how they should be reported. This tells DInput that we will be // passing a DIJOYSTATE2 structure to IDirectInputDevice::GetDeviceState(). if( FAILED( hr = g_pJoystick->SetDataFormat( &c_dfDIJoystick2 ) ) ) return hr; // Set the cooperative level to let DInput know how this device should // interact with the system and with other DInput applications. if( FAILED( hr = g_pJoystick->SetCooperativeLevel( hDlg, DISCL_EXCLUSIVE | DISCL_FOREGROUND ) ) ) return hr; // Enumerate the joystick objects. The callback function enabled user // interface elements for objects that are found, and sets the min/max // values property for discovered axes. //if( FAILED( hr = g_pJoystick->EnumObjects( EnumObjectsCallback, // (VOID*)hDlg, DIDFT_ALL ) ) ) return hr; return S_OK; } //----------------------------------------------------------------------------- // Name: EnumJoysticksCallback() // Desc: Called once for each enumerated joystick. If we find one, create a // device interface on it so we can play with it. //----------------------------------------------------------------------------- BOOL CALLBACK EnumJoysticksCallback( const DIDEVICEINSTANCE* pdidInstance, VOID* pContext ) { HRESULT hr; // Obtain an interface to the enumerated joystick. hr = g_pDI->CreateDevice( pdidInstance->guidInstance, &g_pJoystick, NULL ); // If it failed, then we can't use this joystick. (Maybe the user unplugged // it while we were in the middle of enumerating it.) if( FAILED(hr) ) return DIENUM_CONTINUE; // Stop enumeration. Note: we're just taking the first joystick we get. You // could store all the enumerated joysticks and let the user pick. return DIENUM_STOP; } The Directinput 7 version, this works fine. //----------------------------------------------------------------------------- // Name: InitDirectInput() // Desc: Initialize the DirectInput variables. //----------------------------------------------------------------------------- HRESULT InitDirectInput( HWND hDlg) { int i=0; HRESULT hr; // Register with the DirectInput subsystem and get a pointer // to a IDirectInput interface we can use. // Create a DInput object if( FAILED( hr = DirectInputCreateEx( GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput7, (VOID**)&g_pDI, NULL ) ) ) return hr; // Look for a simple joystick we can use for this sample program. if( FAILED( hr = g_pDI->EnumDevices( DIDEVTYPE_JOYSTICK, EnumJoysticksCallback, NULL, DIEDFL_ATTACHEDONLY ) ) ) // Make sure we got a DancePad if( NULL == g_pDancepads[0] ) { MessageBox( NULL, TEXT("DancePads not found. Stepgame will now exit."), TEXT("DirectInput Sample"), MB_ICONERROR | MB_OK ); EndDialog( hDlg, 0 ); return S_OK; } for(i=0; i<=g_dwNumDevices; i++) { // Set the data format to "simple joystick" - a predefined data format // // A data format specifies which controls on a device we are interested in, // and how they should be reported. This tells DInput that we will be // passing a DIJOYSTATE2 structure to IDirectInputDevice::GetDeviceState(). if( FAILED( hr = g_pDancepads[i]->SetDataFormat( &c_dfDIJoystick2 ) ) ) return hr; // Set the cooperative level to let DInput know how this device should // interact with the system and with other DInput applications. if( FAILED( hr = g_pDancepads[i]->SetCooperativeLevel( hDlg, DISCL_EXCLUSIVE | DISCL_FOREGROUND ) ) ) return hr; // Enumerate the joystick objects. The callback function enabled user // interface elements for objects that are found, and sets the min/max // values property for discovered axes. //if( FAILED( hr = g_pDancepads[i]->EnumObjects( EnumObjectsCallback, // (VOID*)hDlg, DIDFT_ALL ) ) ) // return hr; } return S_OK; } //----------------------------------------------------------------------------- // Name: EnumJoysticksCallback() // Desc: Called once for each enumerated joystick. If we find one, create a // device interface on it so we can play with it. //----------------------------------------------------------------------------- static BOOL CALLBACK EnumJoysticksCallback( const DIDEVICEINSTANCE* pdidInstance, VOID* pContext ) { HRESULT hr; if( g_dwNumDevices < MAXDEVICES ) { // Obtain an interface to the enumerated joystick. hr = g_pDI->CreateDeviceEx( pdidInstance->guidInstance,IID_IDirectInputDevice2, (VOID**)&g_pDancepads[g_dwNumDevices], NULL ); // If it failed, then we can't use this joystick. (Maybe the user unplugged // it while we were in the middle of enumerating it.) if( FAILED(hr) ) return DIENUM_CONTINUE; if(g_dwNumDevices == MAXDEVICES-1) return DIENUM_STOP; g_dwNumDevices++; } // Stop enumeration. Note: we're just taking the first joystick we get. You // could store all the enumerated joysticks and let the user pick. else return DIENUM_STOP; return DIENUM_CONTINUE; }
  4. Hello, I have trouble with de DirectInput8 Enumdevice. When i use DirectInput8 DirectInput8_EnumDevices this fails. When i use DirectInput7 dinput.h with input.lib it works fine. I have 2 usb gamecontrolers and a usb to dmx converter with a usb hub with external power. If i use only the 2 usb gamecontrolers it works good with DirectInput8 and DirectInput7. When i connect de usb.dmx controller, DirectInput8 fails, and DirectInput7 works fine. DirectInput8 memory access write error, DirectInput7 not? Maybe the input.lib and input8.lib are diverend? I have no power trouble this is external. I dont now what this can be? thanks for helping.. Regards
  5. Hello, I want to play avi/mpg video in my DX 9 game. I have create a DX9 Surface. But how can I play video with DirectShow in this surface, on a x.y position. My surface: LPDIRECT3DDEVICE9 pD3DDevice = NULL; Thanks for helping me,
  6. Quote:Original post by blairhartley Generally speaking what plays in MediaPlayer will play through DirectShow. Things to bear in mind with MPEG... MPEG-1 - no problem (other than quality), the codec has been included as part of Windows for some time. MPEG-2 - because of licencing, an MPEG-2 codec is not included as standard. If you want one, it will probably cost you - I haven't seen a free one. Premiere Pro installs one if you have that - as do several other applications - but you need to be careful assuming other people running your app will have one also. If your application's warrants it, you might need to licence one. On the other hand - can you convert to Windows Media 9? It's free and the compression / quality ratio is better. Good luck! Ok Thanks, this is useful information.
  7. Quote:Original post by Sr_Guapo Do have all the current codecs and such? I'm not sure exactly what you need for mpeg though... Yes maybe this is te trouble, but i dont now where i can get the codec for mpg in use with Directshow?
  8. Hello, I can not play mpe(g) video's in DirectShow. I have install the new SDK and runtime 9.0c 2006. My Media Player 10 in winXP also dont play MPG video, blackscreen or error. Somethimes i have only sound and no video? Thanks for helping my, regards Henk.
  9. Quote:Original post by xeddiex Quote:Original post by Thread Quote:Original post by xeddiex UpdateWindow will not work if your client doesn't have an "invalid region", you must first invalidate the client (or parts of it) for UpdateWindow to force a WM_PAINT message. Call InvalidateRect first, immediately followed by UpdateWindow. xeddiex Like this.? InvalidateRect(hDlg,NULL,TRUE); UpdateWindow(hDlg); RedrawWindow(hDlg,NULL,NULL,RDW_ALLCHILDREN | RDW_UPDATENOW); Edit: I dont works, strange trouble?? The code to do the painting (redrawing) needs to be inside your WM_PAINT handler. The code that calls InvalidateRect and UpdateWindow should be outside WM_PAINT. I also don't think you need RedrawWindow since it does the same, and a little more, and will undoubtedly duplicate your painting - which is bad design - but the functions I mentioned should suffice. xeddiex. Thanks xeddiex, I am work it out,
  10. Quote:Original post by Surg AKA Kunark Not sure if this was only an MFC thing. But we never used InvalidateRect() We just went Invalidate(). That would force the window invalidation though as I said that could be MFC only. Or maybe my memory deceives me and we actually wrote that function ourselves. Anyways I would try it out just to see! Invalidate(); Is MFC my code is pure W32 SDK. But thanks.
  11. Quote:Original post by xeddiex UpdateWindow will not work if your client doesn't have an "invalid region", you must first invalidate the client (or parts of it) for UpdateWindow to force a WM_PAINT message. Call InvalidateRect first, immediately followed by UpdateWindow. xeddiex Like this.? InvalidateRect(hDlg,NULL,TRUE); UpdateWindow(hDlg); RedrawWindow(hDlg,NULL,NULL,RDW_ALLCHILDREN | RDW_UPDATENOW); Edit: I dont works, strange trouble??
  12. First thanks for helping me, but i dont works, maybe i do something rong? The screen blinks on's and the the Video is gone? When I move the sreen wit the mouse there is the videosource and stay there..??This is my source: case IDC_STARTVIDEO: { // start up the still image capture graph if(Capstills()) { // set Video device TRUE bVideoOn = TRUE; // Enable Camera Format button EnableWindow(GetDlgItem(hDlg, IDC_CAMFORMAT), TRUE); // UpDatewindow UpdateWindow(hDlg); InvalidateRect(hDlg,NULL,TRUE); RedrawWindow(hDlg,NULL,NULL,RDW_ALLCHILDREN | RDW_UPDATENOW); } and de WM_PAINT. case WM_PAINT: { PAINTSTRUCT ps; BeginPaint(hDlg, &ps); EndPaint(hDlg, &ps); }break;
  13. Hello, I have a small Video playing function in my code and for some reason it works but it shows a black screen unless you move the window around. Once you move the window it will show the video and play flawlessly. I assume this is because for whatever reason the window isn't being repainted as the movie starts. How can I force a WM_PAINT or something else for redrawing the Dialog Box, It is a Visual C/C++ 7.0 W32 Dialog Box source code. No MFC, thanks for helping me? ps; The trouble begin with my new screen Digital TFT, not with the Analog CRT?
  14. Hello, I am having exactly the same trouble as ChaosPhoenix.. Anybody found a solution? How can I force a WM_PAINT, I have to say when I change the return value in de dialogproc from FALSE to TRUE it works, but I then I have no background on the screen only buttons. It is a W32 Dialog box app with a rectangle as source for the video stream. Thanks and Regards, Yhe question from ChaosPhoenix. I have a small Video playing function in my code and for some reason it works but it shows a black screen unless you move the window around. Once you move the window it will show the video and play flawlessly. I assume this is because for whatever reason the window isn't being repainted as the movie starts. my source: //------------------------------------------------------------------------------ // Name: MainDlgProc() // Desc: Handles dialog messages //----------------------------------------------------------------------------- INT_PTR CALLBACK MainDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam ) { //HRESULT hr; int index=0; int i=0; HWND hSoundBox = GetDlgItem( hDlg, IDC_SOUNDLIST ); switch( msg ) { case WM_INITDIALOG: { OnInitDialog( hDlg ); // init Desktop UI } break; case WM_COMMAND: switch( LOWORD(wParam) ) { case IDEXIT: { //if(bThread) StopThread(); PostQuitMessage( IDCANCEL ); }break; case IDC_GOSHOW: { //InitSound(hDlg); if(!bTimerOn) { SetTimer(hDlg, TIMER_1, 50, NULL); // Set timer 50Hz srand((unsigned)time(NULL)); bTimerOn = TRUE; } if(m_myThread.Work()) { EnableWindow(GetDlgItem(hDlg, IDC_STOPSHOW), TRUE); EnableWindow(GetDlgItem(hDlg, IDC_GOSHOW), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_RESETSHOW), FALSE); //Message(hDlg,"Thread Running"); } } break; case IDC_STOPSHOW: { //StopSound(hDlg); if(m_myThread.GetThreadStatus()) { if(m_myThread.StopThread()) { EnableWindow(GetDlgItem(hDlg, IDC_STOPSHOW), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_GOSHOW), TRUE); EnableWindow(GetDlgItem(hDlg, IDC_RESETSHOW), TRUE); //Message(hDlg,"Thread Stop"); iCnt = m_myThread.iCount; // save current timecode } } if(bTimerOn) { KillTimer(hDlg,TIMER_1); bTimerOn = FALSE; } } break; case IDC_RESETSHOW: { iCnt=0; SetDlgItemInt(hDlg,IDC_TIMERCNT,iCnt,FALSE); }break; case IDC_STARTVIDEO: { // start up the still image capture graph if(Capstills()) { // set Video device TRUE bVideoOn = TRUE; // Disable Camera Format button EnableWindow(GetDlgItem(hDlg, IDC_CAMFORMAT), TRUE); } } break; case IDC_STOPVIDEO: { // start up the still image capture graph if(bVideoOn) { Close(); // set Video device TRUE bVideoOn = FALSE; // Disable Camera Format button EnableWindow(GetDlgItem(hDlg, IDC_CAMFORMAT), FALSE); } } break; case IDC_ABOUT: { DialogBox(g_hInst,(LPCTSTR)MAKEINTRESOURCE (IDD_ABOUT),hDlg,(DLGPROC)AboutDlgProc); }break; default: return FALSE; // Didn't handle message } break; case WM_TIMER: { EventLoop(); } break; // Cleanup everything case WM_DESTROY: { if(bVideoOn)Close(); if(bTimerOn) KillTimer(hDlg,TIMER_1); bTimerOn = FALSE; } break; default: return FALSE; // Didn't handle message } return TRUE; // Handled message } EDIT: Please remember to use 'source' tags! [Edited by - jollyjeffers on February 21, 2006 1:00:45 PM]
  15. I have changing the code but this also dont work I get the same error. Idea?? thanks henk, I want to change my Logitech Webcam ressolution from 352x288 to 640x480 so I want the Logitech dialogbox the source and error.. The ERROR in Debug the source Unhandled exception at 0x583e7666 in Golem.exe: 0xC0000005: Access violation reading location 0x00000000. from here in the code crash..... -------------------------------------------------------------------------------- hr = OleCreatePropertyFrame(NULL, 0, 0, L"Filter", 1, (IUnknown **)&pPin, cauuid.cElems, (GUID *)cauuid.pElems, 0, 0, NULL); --------------------------------------------------------------------------------- The function.. //---------------------------------------------------------------- // void CamFormat() // desc : set size of video //---------------------------------------------------------------- void CamFormat() { HRESULT hr; CComPtr<ICaptureGraphBuilder2> graphBuilder2_; hr = graphBuilder2_.CoCreateInstance( CLSID_CaptureGraphBuilder2 ); IAMStreamConfig *pSC = NULL; // Default Cap device IBaseFilter *pCap; GetDefaultCapDevice( &pCap ); IPin *pPin = NULL; hr = graphBuilder2_->FindPin( pCap, // Pointer to the filter to search. PINDIR_OUTPUT, // Search for an output pin. &PIN_CATEGORY_CAPTURE, // Search for a capture pin. NULL, // Search for a video pin. FALSE, // The pin must be unconnected. 0, // Return the first matching pin (index 0). &pPin); // This variable receives the IPin pointer. ISpecifyPropertyPages *pispp = NULL; hr = pPin->QueryInterface( IID_ISpecifyPropertyPages, (void **)&pispp ); if( !SUCCEEDED(hr) ) { pPin->Release(); //return 0; } pispp->Release(); //hr = pSC->QueryInterface(IID_ISpecifyPropertyPages,(void **)&pSpec); if(hr == S_OK) { CAUUID cauuid; hr = pispp->GetPages(&cauuid); hr = OleCreatePropertyFrame(NULL, 0, 0, L"Filter", 1, (IUnknown **)&pPin, cauuid.cElems, (GUID *)cauuid.pElems, 0, 0, NULL); CoTaskMemFree(cauuid.pElems); } pSC->Release(); } // end CamFormat.