Posts

Showing posts from 2006

blog moved

althoug I really like the functionality of blogger my blog moved to a new location: http://vb-magazin.de/forums/blogs/janm/ vb-magazin is a large Visual Basic / Visual Basic .NET community which I contribute to.

WPF: Binding updates

Whenever you offer a Cancel Changes command you need to delay updates to the Source until the user Accepts Changes e.g. by clicking OK or Save. Although WPF's two way bindings update the source immediately you can delay the update by adding UpdateSourceTrigger=Explicit to your binding expression. {Binding Path=Text, UpdateSourceTrigger=Explicit} The Source won't be updated until you call BindingExpression.UpdateSource .

Custom Chrome in WPF

Image
Some of you may have wondered who the creators of Microsoft Max did the Chrome. Although this breaks one of the Top 10 Vista rules I will show how to create a WPF window with custom chrome. You can't get there by simply setting the border of a WPF Window to None because always a thick border remains. You have to do a work around and create an empty Win32 window and fill it with your own WPF controls. You can use the HwndSource object to do this. This object is intended to place WPF controls into Win32 Applications but you can also use it to place a WPF control onto your Windows Desktop which is also a Win32 application. HwndSource will call the native function CreateWindowEx and create the window for you. Dim params As HwndSourceParameters = New HwndSourceParameters("CustomChrome 1", 400, 300) Dim hwnd As HwndSource = New HwndSource(params) hwnd.RootVisual = New Page1 This code will create a default window for you. The HwndSourceParameters 's constructor sets the

VB LINQ updated for VS 2005 RTM

LINQ Visual Basic 9.0 has been updated to support Visual Studio 2005 RTM VB LINQ Homepage http://msdn.microsoft.com/vbasic/Future/default.aspx MSDN TV: Visual Basic Futures: Latest Developments in the LINQ Project http://msdn.microsoft.com/msdntv/episode.aspx?xml=episodes/en/20060112VBasic AS/manifest.xml

Capture WebCam with WinForms2

I was asked whether it is possible to capture a webcam's output in Windows Forms 2.0 so I did a bit researching. First I thought I would have to do this in DirectX but then I found some API calls for VB6 and translated them to VB .NET 2. In fact it is very easy to capture the output. You simply need a Control and it's handle. I chose a PictureBox named PictureBox1 to do so. You have to define the Win32 API calls first. We will need two API functions SendMessage and capCreateCaptureWindow . Private Declare Auto Function SendMessage Lib "user32" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer Const EM_LINEFROMCHAR As Integer = &HC9 Const EM_LINEINDEX As Integer = &HBB Private Declare Auto Function capCreateCaptureWindow Lib "avicap32.dll" (ByVal lpszWindowName As String, ByVal dwStyle As Integer, ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, ByVal nHeight As Inte

InstallShield Applications on Vista 5270

I just tried to install a InstallShield Application on Windows Vista Dec CTP 5270. The installer crashed with the message. Could not initialize IKernel. The parameter is incorrect. After browsing InstallShield Knowledge Base I found a soultion. The InstallShield Setups can't install InstallShield's IKernel on Vista. You can install them manually. Manual & Setup

Where did the Loading Event go?

In earlier Versions of WPF Pages and Windows provided a Loading Event. I used to placed all my data initialization code that affects databinding here. Since this event is gone I placed the code into the Loaded Event. This is very uncompfortable because the page is displayed before this code is executed. I also tried to put some code into the constructor but this wasn't a good idea because it is not guaranteed that all controls are initilized at that moment. So I searched the MSDN for that issue and found the Initialized Event as a solution. When this event is fired all controls are initialized but the page is not yet displayed! You can perform any databining related actions there and the user will only see the result. Besides this is more performant than putting the code into the Loaded event because WPF doesn't need to set and render all databinding fields twice!