|
You want to capture video of a window, which is not visible ?
No - a window that is not visible is not being painted, so there's nothing to capture.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks for fast reply.
Then is there some way to paint this to a 'magical' spot that cant be seen and take the image capture from their?
thanks.
|
|
|
|
|
I dunno what would happen if you moved the window outside the bounds of the screen, but it would be a failure on the part of windows if it was painted there. I very much doubt it's easily achieved. If you could pass a DC to the paint event of the control, perhaps it would draw on it, but that would only be the client area, and it's just an idea, I dunno if it would work.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi again, fast response good. This solution seems to work:
<br />
Private Declare Function PrintWindow Lib "user32.dll" (ByVal _<br />
hwnd As IntPtr, ByVal hdcBlt As IntPtr, ByVal nFlags As _<br />
UInt32) As Boolean<br />
Dim screenGrab As Bitmap<br />
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click<br />
Me.SendToBack()<br />
screenGrab = New Bitmap(Me.Width, Me.Height)<br />
Dim g As Graphics = Graphics.FromImage(screenGrab)<br />
Dim hdc As IntPtr = g.GetHdc<br />
Me.PrintWindow(Me.Handle, hdc, Nothing)<br />
g.ReleaseHdc(hdc)<br />
g.Flush()<br />
g.Dispose()<br />
screenGrab.Save("C:\please.bmp", System.Drawing.Imaging.ImageFormat.Bmp)<br />
End Sub<br />
havent tested if thouroughly, but seems ok, howd anyone else run this?
|
|
|
|
|
OK - looks like the Windows API exposes this ability ( to force a paint event ). Cool.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Here is another method.
If you're using .NET 2.0, then you can call the new Form.DrawToBitmap() function.
|
|
|
|
|
thanks for another response, unfortunately cant test this out on .net 1.0.
How would I convert the previous code to remove the Title bar from that captures?
|
|
|
|
|
What you want is just the "client" area inside of the window. I don't know what managed calls you can make to access the handle of the client window.
I've found this on the Internet. Perhaps this will do the trick?
http://www.vbdotnetheaven.com/Code/Jul2003/2128.asp[^]
|
|
|
|
|
thanks, using screenGrab = New Bitmap(Me.ClientSize.Width, Me.ClientSize.Height) i do get the smaller area, but it cuts the bottom and right side area off rather then all edges.
|
|
|
|
|
I've just tried the code sample from the link I gave you. It works. It's only capturing the client area. Are you not using that code?
If you're calling your form's CreateGraphics() method like in the code sample, then it should only capture the client area and not the whole form.
|
|
|
|
|
I thought I tried it, if the window is hidden, didnt that just capture whatever else was ontop for the same region?
|
|
|
|
|
You're right. The code I gave you isn't going to work in this case.
Perhaps the thing to do is once you've got the captured image of the whole window, you could then copy only the inside portion to another bitmap. You already know how to get the client area's width and height. You can get its top/left position using the following code.
Dim clientOffsetPoint As System.Drawing.Point
clientOffsetPoint = Me.PointToClient(New System.Drawing.Point(Me.Left, Me.Top))
clientOffsetPoint.X *= -1
clientOffsetPoint.Y *= -1
|
|
|
|
|
|
Can anyone tell me how to Send/Read/Manage Email with VB 6.0? without any other dll or ocx, only with api function!!
|
|
|
|
|
No, but Google can
One search, first page.
http://www.freevbcode.com/ShowCode.Asp?ID=109[^]
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
My Blog[^]
|
|
|
|
|
Hi guys,
I try to find some informations for creating bitmap regions for forms in vb .net, but with no results! Only in C#: www.codeproject.com/csharp/bmprgnform.asp
So, I need little help from everyone who knows this in vb .net!
Thanx in advance..
|
|
|
|
|
It's the same in VB.NET, they both use the .NET framework, you just need to convert the code.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanx for reply Christian...but I am beginner...so, I need help to translate. Help me if you can..or anyone else..
|
|
|
|
|
There are automatic tools to do this, but it really is a trivial task, I convert VB.NEt to C# from time to time, and I don't know VB.NET at all. I'd suggest it's probably an excellent exercise for you. In C#, we use { } instead of endif to define a scope, and we end lines in a ;.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
Does anyone know how to deploy an application/project in VB.Net?
thanks.
|
|
|
|
|
|
Thanks bro!
|
|
|
|
|
|
Hi Everyone
I am trying to do a authentication of username and password from Excel application with LDAP server as most of our users are having userid configured to LDAP server
I am trying to query the LDAP server(iPLANET) through VB(ADSI) to get the username and facing connection issues.
Here is the Code :
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim Command
Set conn = CreateObject("ADODB.Connection")
conn.Provider = "ADsDSOObject"
conn.Open "ADs Provider"
Set com = CreateObject("ADODB.Command")
com.ActiveConnection = conn
com.CommandText =
" <LDAP://kuwait.ccs.com/OU=9000,OU=Associates,DC=dir,DC=ccs,DC=net>;
(uid=" & uid & ");cn;subtree"
Set rs = com.Execute
I am getting "Table does not exits" error at Set rs = com.Execute line .
My LDAP server name is kuwait.ccs.com
My Dn is dc=dir,dc=ccs,dc=net
The uid is =19990001
This uid is inside OU = Associates->9000.
Should I give the DC values as DC=kuwait,DC=ccs,DC=net or the way I gave is right? I have also tried changing the sequence of OU=Associates first and OU=9000 next in the query line,but still I have problem. Also I tried giving the server IP address instead of servername,but still no use. Is that I need to setup something in VB tools other than for ADODB connection and something to be configured in LDAP server like CDO to accept the connection .
Also when I see the log created in the LDAP server is like this :
[19/Jan/2006:16:54:03 -0500] conn=90971 op=-1 msgId=-1 - fd=37 slot=37 LDAP connection from 172.24.37.97 to 166.86.124.73
[19/Jan/2006:16:54:03 -0500] conn=90971 op=0 msgId=268 - SRCH base="" scope=0 filter="(objectClass=*)" attrs="subschemaSubentry dsservicename namingContexts defaultnamingcontext schemanamingcontext configurationnamingcontext rootdomainnamingcontext supportedControl supportedLDAPVersion supportedldappolicies supportedSASLMechanisms dnshostname ldapservicename servername supportedcapabilities"
[19/Jan/2006:16:54:03 -0500] conn=90971 op=0 msgId=268 - RESULT err=0 tag=101 nentries=1 etime=0
[19/Jan/2006:16:54:03 -0500] conn=90971 op=1 msgId=270 - BIND dn="" method=sasl version=3 mech=GSSAPI
[19/Jan/2006:16:54:03 -0500] conn=90971 op=1 msgId=270 - RESULT err=14 tag=97 nentries=0 etime=0, SASL bind in progress
[19/Jan/2006:16:54:03 -0500] conn=90971 op=2 msgId=271 - BIND dn="" method=sasl version=3 mech=GSSAPI
[19/Jan/2006:16:54:03 -0500] conn=90971 op=2 msgId=271 - RESULT err=49 tag=97 nentries=0 etime=0
[19/Jan/2006:16:54:03 -0500] conn=90971 op=3 msgId=272 - BIND dn="" method=128 version=3
[19/Jan/2006:16:54:03 -0500] conn=90971 op=3 msgId=272 - RESULT err=0 tag=97 nentries=0 etime=0 dn=""
[19/Jan/2006:16:54:03 -0500] conn=90971 op=4 msgId=273 - SRCH base="ou=9000,ou=associates,dc=dir,dc=ccs,dc=net" scope=0 filter="(objectClass=*)" attrs="objectClass"
[19/Jan/2006:16:54:03 -0500] conn=90971 op=4 msgId=273 - RESULT err=0 tag=101 nentries=0 etime=0
[19/Jan/2006:16:54:03 -0500] conn=90971 op=5 msgId=274 - UNBIND
[19/Jan/2006:16:54:03 -0500] conn=90971 op=5 msgId=-1 - closing - U1
[19/Jan/2006:16:54:04 -0500] conn=90971 op=-1 msgId=-1 - closed.
It seems to be the method of communication is SASL where as this service is not configured in the LDAP server. Is this the reason it is failing? I have gone through the tips from most of the forums and tried all the possibilites but still I am facing this error.
Please help me. Thanks for the help in advance.
Regards
Vivek
8046145735
-- modified at 15:47 Thursday 26th January, 2006
|
|
|
|