|
You may need to install the latest DirectX runtime[^].
I'm not sure the managed DirectX stuff comes with Vista.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Without installing anything, references to the Managed DirectX libraries are available in VS2008 on Vista. I then installed the latest DIrectX SDK, but nothing changed.
No, I dont think its underlying technology is VFW. As far as I know, that evolved into DirectShow.
Is there any other way, which as easy as using the DirectX managed libraries to get the duration of an AVI file? Any harder solutions are also welcome ...
Thanks for your replies.
Daniel
|
|
|
|
|
AFAIK, managed DirectX isn't supported anymore but it is still
included as "extras" with the redistributable end-user run time.
If you can post the code that fails (it's just one missing interface, right?)
I will test it on the latest DirectX extras on Vista.
dwg1986 wrote: I dont think its underlying technology is VFW
No, it's not. DirectShow works with WDM drivers and can work with
legacy VFW devices.
dwg1986 wrote: Is there any other way
You can always parse the AVI info yourself... AVI RIFF File Reference[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for your reply. The code fails at runtime in the underlined line of code below:
using System;
using System;
using System.Windows.Forms;
using Microsoft.DirectX;
using Microsoft.DirectX.AudioVideoPlayback;
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Test()
{
double dDuration = 0;
try
{
Video video = Video.FromFile("C:\\Test.avi");
dDuration = (video.Duration / 60);
}
catch (DirectXException dxEx)
{
MessageBox.Show(dxEx.Message);
}
}
}
The underlined line of code is where the DirectXException described in my original question is thrown.
Thanks again,
Daniel
|
|
|
|
|
I can confirm the error.
I can't confirm that Managed DirectX is supported on Vista.
It's not included in the latest DirectX SDK or the latest Platform SDK.
Do you have any links to info stating it's still supported?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Just for the heck of it, I tried the code on a WMV file...
It worked fine.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Wow, true.. it worked on a WMV.
I found a link which might hint some Managed DirectX issues on Vista: http://www.thezbuffer.com/articles/470.aspx[^], and other sites also hinted similar incompatbilities due to DirectX 10.
There is also mention of MDX.. but I have not yet a clue what it is exactly.
Still its strange it works on a WMV and not on an AVI.
|
|
|
|
|
I saw that link too. Not much mentioned about it during the
last year or two.
dwg1986 wrote: MDX.. but I have not yet a clue what it is exactly.
MDX == Managed DirectX I suppose
dwg1986 wrote: Still its strange it works on a WMV and not on an AVI.
Yeah - I wish I had the source code to see what the Video
class is using and what's missing on Vista!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Oh yeah.. MDX, Managed DirectX. *slaps himself* Damn was I tired.
So my options till now are:
1. Convert AVI library to WMV. No sense there.
2. Resort to some other third party SDK. (which I still have not found after hours searching)
3. No idea.
I'll post back if I get any success.
Thanks for all your help.
|
|
|
|
|
|
My Project required that I have to load the image from resource.
using Gdiplus::Bitmap::FromResource function , so I have to save the image in BMP format and it doesn't support alpha channel.
Are there anyway I can access the internal data of image after loading it so I can add alpha=0 to pixel that has particular color?
something like this psuedo code
for(int i=0;i<totalpixel;i++){>
if(pixel[i].r == pixel[i].g == pixel[i].b == 0){//if the pixel is black
pixel[i].a = 0;
}
}
thank in advance
modified on Friday, September 26, 2008 7:27 AM
|
|
|
|
|
Load the bitmap
Create a new Bitmap object with pixel format PixelFormat32bppARGB
Create a Graphics object from the new bitmap
Draw the original bitmap on the Graphics object
Use Bitmap::LockBits on the new bitmap to get direct access to the
pixel bits (the BitmapData struct has all the info you need to iterate
through the pixels)
Loop through the pixels setting alpha channel values as desired
Call Bitmap::UnlockBits on the new Bitmap
Dispose the Graphics object and the original bitmap
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thank for your answer , I will try it
|
|
|
|
|
Is there also a way to loop through the pixels in VB?
Thank you
Michael
|
|
|
|
|
hello
tried to make a screencapture of a panel with controls on it and "connections" at the background (created using paint() procedure). DrawToBitmap does only the visible part of the panel, so i came up with the following code after a while. problem is that the invisible part of the panel turns up black in the resulting jpeg picture. Does anyone have any suggestions for me?
public static void CreateScreenCaptureFile(Control ctrl, string path)
{
// get dimensions (part may be invisible)
int w = 0,h = 0;
foreach(Control c in ctrl.Controls )
{
if(c.Left + c.Width > w) w = c.Left + c.Width + 100;
if(c.Top + c.Height > h) h = c.Top + c.Height + 100;
}
if(w == 0) w = ctrl.DisplayRectangle.Width;
if(h == 0) h = ctrl.DisplayRectangle.Height;
// create bitmap
IntPtr hwnd = ctrl.Handle;
Bitmap b = new Bitmap (w, h);
Graphics bg = Graphics.FromImage (b);
IntPtr bgdc = bg.GetHdc ();
SendMessage(hwnd , WM_PAINT, (int)bgdc, 0);
SendMessage(hwnd, WM_PRINT, (int)bgdc, (int)(
DrawingOptions.PRF_OWNED |
DrawingOptions.PRF_CHILDREN |
DrawingOptions.PRF_CLIENT)
);
bg.ReleaseHdc();
bg.Dispose ();
// save the result jpeg file
b.Save(path, ImageFormat.Jpeg);
b.Dispose ();
}
|
|
|
|
|
jVersteegen wrote: the invisible part of the panel turns up black
There's no way to get "invisible part" because it doesn't exist.
Invisible parts, by definition, are invisible - they don't get drawn.
Why are you sending a WM_PAINT message? You can't do that - the system
should send that message, not you, and it's not doing anything useful
in your code.
What if you add the PRF_NONCLIENT drawing option to your WM_PRINT message?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Sorry for the late reaction, i had given up hope on any reactions....
adding PRF_NONCLIENT does not change anything.
is there any way to change the background color to white?
thanks!
|
|
|
|
|
joost.versteegen wrote: is there any way to change the background color to white?
Paint white on bgdc before doing the WM_PRINT.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thanks! I will try later, time to go home now...
have a nice weekend!
cheers
|
|
|
|
|
joost.versteegen wrote: have a nice weekend!
Thank you! You too!
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hi,
i have drawn a cube in tao framework in c#.i want to draw a big container(truck) and some small packages(boxes ).These boxes will be packed in the big container.The color of the boxes should be of different colors pertaining to a particular customer.Plz help me out.
regards
aurosikha
|
|
|
|
|
hi all.
i have some problem in using directx to show 3d model in windows.
1.I loaded some .x file in c# and want to rotate them.but there is some problem .when a object rotate some of it's side disappear.
2.problem is that how can i set center of my object for rotate object around it not around Coordinate System .
3.when i assign some bitmap on my object it repeat many time on object surface.
i want to it cover all of my object no tile on it.
its code:
device.Transform.World =
Matrix.Scaling(handle.XScale, handle.YScale, handle.ZScale) *
Matrix.RotationZ(Geometry.DegreeToRadian(handle.ZRotate)) *
Matrix.RotationY(Geometry.DegreeToRadian(handle.Yrotate)) *
Matrix.RotationX(Geometry.DegreeToRadian(handle.XRotate)) *
Matrix.Translation(handle.X, handle.Y, handle.Z);
for (int i = 0; i < handle.MeshMaterial.Length; i++)
{
device.Material = handle.MeshMaterial[i];
device.SetTexture(0, handle.MeshTexture[i]);
handle.mesh.DrawSubset(i);
}
handle is my object that contains my 3d info.
sepel
modified on Wednesday, September 24, 2008 3:18 AM
|
|
|
|
|
anyone have links, magazine articles, book titles, or open source project references
question 1:
what are some algorithms available to simulate how ms word draws each page as i scroll through 1000+ page document. Assuming the whole document cannot be loaded+drawn in memory all at once. How does the buffering work?
Realistically i'll be rendering a printed circuit board that might have many circles, rectangles using filled polygons. If the user zooms in, a given polygon might border the canvas and outside region. how would this partially on screen object be drawn? Should i send my canvas containing perspective+coordinate to all the objects and have the actual objects draw themselves to the canvas. Each shape will need to know how to partially render itself.
are there any advanced articles in this subject?
question 2:
what are some algorithms for
snapping to grid,
when connecting components how auto route lines (shortest route + no overlapping.)
thanks,
-lm
|
|
|
|
|
I need some 3D Models ( cars, people, trees etc. )
Where can I download them from and use them LEGALLY in my applications.
My applications are non-commercial. But I may upload them in codeproject.
Thanks in Advance.
|
|
|
|
|
I forgot to mention. I don't want to pay for the models.
|
|
|
|