.NET and other Stuff
Just some rough notes on my ventures in .NET
Thursday, October 14, 2004
Thursday, October 07, 2004
Longhorn Desktop Visual Styles
Check out my new desktop look :)
You can get these visual styles from:
www.windowsx.org
and the MSN Messenger skins from:
http://www.rolandunderg.net/
enjoy!
GMail Drive !
Check this out..the GMail Drive shell extension..
http://www.viksoe.dk/code/gmail.htm
You can use your never ending 1 Gig to store files online. Its a little buggy but still..its really cool..
Wednesday, October 06, 2004
.NET Books Sample Chapters
Srinivasa Sivakumar has compiled this huge list of links to .NET Book Sample Chapters. And by huge I mean 500+ sample chapters !! Check them out here..
http://www3.brinkster.com/webguru/Sample.Asp
Monday, October 04, 2004
P/Invoke (Platform Invoke) links and resources
Let's admit it - P/Invoke is inevitable. Even with the extensive BCL (Base Class Library), there's more than once that we've had to resort to Win32 API calls. Then there are 3rd party dlls and legacy code. However, the .NET framework does make it quite a bit easier to interop with unmanaged code - P/Invoke being one of the techniques (apparently, interop seems to have been improved a lot more in .NET Framework v2.0 - so look out for that). P/Invoke is used to execute unmanaged DLL functions (exported functions). There are several good resources on P/Invoke but of course you wouldn't expect them to be all at one place, would you? To make it easy on my weak little brain and for others who might stumble across this post looking for P/Invoke stuff, I thought I'd consolidate whatever I've gathered into one blog post. So here you go...
First place to start would be MSDN:
MSDN Interop Link:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconInteroperatingWithUnmanagedCode.asp
This has extensive information on general interop techniques including samples, walkthroughs, etc
MSDN Consuming Unmanaged DLL Functions with P/Invoke:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconconsumingunmanageddllfunctions.asp
This one is specific to P/Invoke - has samples, etc. Gives you a fair idea of how to go about calling an exported function with all the semantics that are involved. Good place to start off..
One of the most important aspect of P/Invoke is Marshalling Data Types across the Managed-Unmanaged boundary. Its very important to match up the data types between the managed and unmanaged worlds or else you could end up in a lot of misery !
MSDN Marshalling Data with Platform Invoke (this link is on the page pointed to by the previous link):
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconmarshalingdatawithplatforminvoke.asp
Definitely read up on this one or else you're going to have a hard time figuring out what data type to use when trying to write your API prototype. There are lot of links from this page - the ones under 'In This Section' are particularly important. This reading will save you a lot of time especially if you're going to be using P/Invoke a whole lot.
Platform Invoke Cheat Sheet
This is an excellent resource for P/Invoke. It has a lot of articles, tutorials, other links, etc. It also has information on P/Invoke for the Compact Framework(which I'm totally oblivious to). Should be very helpful..
Here's a blog you would want to read up on - Adam Nathan's Interop-Centric CLR Blog:
http://blogs.msdn.com/adam_nathan
He's a test lead on the CLR team and knows almost anything you could think about interop between managed and unmanaged code. In fact, he even wrote the book:
.NET and COM: The Complete Interoperability Guide
If you're into a quite a bit of interop, then this book is for you..
Here's one of his articles on interop as well:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/manunmancode.asp
Here's another site I think is very interesting -
N/Direct - The .NET Interoperability Resource Center
It is what it says..resource for .net interop...excellent site with good information P/Invoke and Interop in general. It's got good samples and examples especially ones that are otherwise hard to find on other interop resources (eg. marshalling variable length structures, marshalling a structure containing an array of structures, etc etc) Pretty good stuff..maintained by a guy named Mattias Sjögren who's a real master on interop..definitely check it out..
Having a hard time figuring out how to declare prototypes for Win32 APIs? Need the signature in VB.NET and/or C#? Then this one's for you...www.pinvoke.net. Its got signatures for tons of Win32 APIs grouped by which library they belong to (kernel32, user32, etc) and since its a wiki site, people keep updating it as time goes by with VB.NET/C# signatures for more and more Win32 API functions. Some of them also have sample code which should give you a head start. Now, they also have a Visual Studio Add-In so you can directly get the signature for a particular API from within the VS.NET IDE - pretty cool, isn't it? You can submit signatures/samples either from the website or from within the IDE with the Add-In.
That's about all I've got right now on P/Invoke...I'm sure I've missed some..I'll keep adding more as and when I remember more resources on this. If you've got some that I've missed, feel free to add them to the comments and I can add it to this post - of course, including courtesy
Tuesday, September 28, 2004
VB is here to stay :)
Here's what S. Somasegar (Vice President of the developer division at Microsoft) had to say about the future of VB (and all the comparisons goin' on between VB.NET and C#):
http://blogs.msdn.com/somasegar/archive/2004/08/01/204540.aspx
A breather, huhn ;-) ??
Monday, September 27, 2004
All you wanted to know about late binding in VB.NET (and probably more than that)
I came across this blog post by a former Visual Basic Compiler developer which talks all about how late binding is accomplished in Visual Basic as it happens now in .NET.
http://blogs.msdn.com/cambecc/archive/2004/06/01/145309.aspx
Revealing, isn't it? yeah..I thought so too (although at first it was more confusing than revealing :-S) It does give a pretty good insight into what goes on (which apparently is a whole lot!) behind late binding in Visual Basic. From there I was led to this blog post:
http://blogs.msdn.com/cambecc/archive/2004/06/27/166868.aspx
Here, Cameron Beccario - the guy who wrote the first blog post as well - lays out an abstract specification for Visual Basic late binding. Its kinda big but I guess it makes sense since that's what the purpose of the post is - to lay out in detail a specification for various late binding scenarios. Beware - might take a while to get through the whole thing :)
After reading both these posts, you can pretty much tell why late binding incurs such a performance hit as compared to early binding. Gives you something to think about when using late binding..Ofcourse, with Option Strict On, VB.NET throws up a compile time error when using late binding which does help a lot. It would be an issue only with Option Strict Off.
Monday, September 20, 2004
A9 - Search by Amazon
Checkout the new search site by Amazon - www.a9.com I think its going to give google a run for its money..what do you think?? Some of the features on A9 are pretty cool..First of all - it saves all the searches in the form of a history which gives you quicker access to what you've already search instead of trying to remember each search you make..Also, you can just drag the links from the search results page itself (yes - drag and drop :)) and drop it into the bookmarks frame..The best part - you can access the history and bookmarks from any computer ! Atleast I find that really useful - many a time I'm searching something say at work and find something really useful after a long hard search which I'd want to access from home for a further look only to realize that I've forgotten the search keywords I used and all the links that I went through to get to that useful website :-( I could email the link to myself but as you might've already guessed I'm awfully lazy and I wouldn't want to work for something any more than the task rightfully deserves - it just doesn't seem right to be emailing myself everytime I want to use a bookmark that I saved at work from home or vice versa. Anyway..looks like we're drifting away from the subject of this blogpost :-) Its got a few other features such as Discovery (something similar to google's adsense but this works more generically rather than targeting commercial websites), Diary (take down notes for a particular website and save it with the website - haven't used this feature though) and your standard toolbar more or less like google's. I love the column feature too - you can view different results/views in columns - gives you access to more information on a single page. Overall, I really like A9. Note one thing - the search engine behind the scenes (for web and images) is google itself ! http://a9.com/-/company/whatsCool.jsp
I had gotten so used to google that I thought there could be no search engine so good that could make me move away from google...but looks like I could be way off the mark :)
Online .NET Framework Object Browser (sort of)
Its sort of a namespace/class hierarchy viewer for the .NET base class library. Here's the link for framework v1.1:
http://www.vb2themax.com/dotnetbrowser/showassemblies.aspx?ver=11
and here's the link for framework v2.0 beta:
http://www.vb2themax.com/dotnetbrowser/showassemblies.aspx
Its pretty good - its also got a search feature (haven't tried it out though). The good thing for v2.0 beta is that it lists what is new in v2.0, what has changed since v1.1, what has been deprecated from v1.1, etc. That should definitely save some time for people moving from v1.1 to v2.0. Check them out..
Sunday, September 19, 2004
More on the Garbage Collector and Collection
These are the actual links that I had in my previous post (just for completeness):
http://msdn.microsoft.com/msdnmag/issues/1100/GCI/
http://msdn.microsoft.com/msdnmag/issues/1200/GCI2/default.aspx
Also check out this blog post by Chris Lyon (A Tester at MS for the .NET Garbage Collector):
http://blogs.msdn.com/clyon/archive/2004/09/14/229477.aspx
Its got a very comprehensive list of links to more information about the garbage collector and/or collection. I haven't had the time to go through all of them but I think those would probably be the most interesting ones to read through about this stuff.
Saturday, September 11, 2004
Garbage Collection Internals
Ever wondered what's the whole fuss about Garbage Collection? Ever confused what the Garbage Collector actually does and how it does what it does?!? Yeah - I've been there too. I found these 2 excellent articles on MSDN on GC (actually just one - in 2 parts) which gives a significant insight into the workings of GC. I found them pretty interesting - learnt quite a bit out of them. At first, you usually don't care about GC and stuff - you're more concerned about your syntax, that your program compiles and actually does what you are expecting it to do :) However, further down the road, its always good to know a little bit more which'll give you a better idea of exactly whats going on. Here are the links:
Part 1 of the article
Part 2 of the article
Hope you like them as much as I did..or else..well..you can curse me for wasting your precious time ;-)
Tuesday, August 24, 2004
My first Vs 2005 bug (and probably the last!!)
Since everyone's digging into Whidbey looking for bugs, I thought let me get one of my own :) Here is what I found. Ok..Ok.. I know its kinda little tacky..but oh what the heck.. I'm pretty sure I ain't finding any significant bug so might as well settle for a cosmetic one :)) The only thing that concerns me is that I hope MS doesn't slap the bug back on my face before anyone even visits the link from this blog :( I should consider sending this out to my friends and family. On Second thought - maybe not - probably even my eight year old nephew will laugh out loud if he finds out I submitted such a cheesy bug :-S
Tuesday, August 17, 2004
Subclassing in VB.NET
I must confess that I have no experience whatsover with subclassing and windows hooks in VB 6. However, reading this introduction, it looks like it would've been a while before I got a good hold of these techniques; Win32 API calls over the place - definitely not my cup of tea :) Ofcourse, that was in Visual Basic 6. DotNET seems to have made subclassing a lot easier - atleast subclassing and hooking onto windows messages in ones own application. You can read a brief introduction of how this can be accomplished here. DotNET eliminates the need of using Win32 APIs to a great extent atleast as far as subclassing is concerned. DotNET relies on, among other things, inheritance to achieve this. The Control class has a protected overridable WndProc which is in a sense the DotNET version of the Win32 API CallWindowProc. However, unlike CallWindowProc which took in 4 parameters, WndProc takes in just one - the message - which encapsulates all the parameters in a single structure. So, if one wants to modify the default behaviour of any control (including the form which eventually is inherited from the Control class), one can override the WndProc (in the left combobox in the code window, select the '(Overrides)' section and then you can select the WndProc from the right combobox) and then perform any action based on the message received.
What was MS thinking ??
This is what I came across when installing the MSDN for VS 2005 Beta 1.
What was Microsoft thinking?? How much of a rush were they in with the beta :)??
Thursday, August 12, 2004
Some difference between VB and VB .NET
During the day, I work as a VB programmer. By the night, I'm messing around with VB .NET. I started this trend probably a month and a half back. Seemed to have picked up a little speed on the .NET side. Just for the heck, I penned down a few of the more obvious differences between VB and VB .NET. Not that its going to be awfully useful to anyone and ofcourse everyone's (or atleast the VB programmers moving to VB .NET) going to learn that somehow, but....
Anyway, this list is quite small since I stopped doing it after a while - kinda got boring and too much work :)
Click here to get the word document. Ofcourse, I could update the doc based on suggestions which are always welcome :)


