Timothy

If You Don't Like To Multitask on Your Phones, Then Don't

As has been mentioned in plenty of blogs before, Windows Phone 7 will not support a the traditional experience of multitasking applications.  With the exception of certain bare Windows CE devices, multitasking in PDAs and Phones has never really been like the desktop experience and that's okay.  I don't expect it to act the same.  Basically, the normal multitasking paradigm on these devices is that the app is sent to the background and another app comes to the foreground.  It works really well in Windows Phone Classic (aka Windows Mobile) and Android.  The Apple iPhone takes a different approach.  Each app must save its state and exit when it is 'sent to the background' except the approved built-in Apple apps.  Windows Phone 7 copies this approach, because apparently emulating Apple is the way to win a market (this has worked wonders for Zune, apparently).

To be fair, the WP7 approach is a bit more flexible.  First, apps aren't necessarily closed when put in the background, but they are paused.  Second, apps can request permission from Microsoft to be allowed to continue to operate in the background if they need to.  That actually could be a decent model, as not all apps need to continue to run in the background, but this all hinges on Microsoft allowing you to run in the background if you need to.  That's not a good place to be when you are trying to get investors to believe in your new cutting edge piece of software for this new device.  By a single Microsoft employee's whim alone, your entire app could be neutered.  Great.

I multitask like a crazy fool on my wonderful HTC Touch Pro 2.  I usually have about five or six things open.  I also write a lot of software.  This may come as a shock to some, but in your standard Windows app, if you receive no input, your app does nothing – literally nothing!  This is because Windows apps are message-based.  Your app will block while waiting for a message (0% CPU).  Okay?  It won't do anything.  Nothing!  If you are in the background, you receive no input.  So unless you have a timer or another unblocked thread, your app is effectively paused.  Plus, even if it has a timer or thread, unless you are using it to refresh a UI element, it's probably doing something you think is important.  Finally, if your phone goes to sleep on Windows Mobile, unless you specifically execute a set of functions to keep the device's idle timer awake, your app, along with the entire device, will sleep, timers and all.  So the "battery life" excuse is just that: an excuse!  So what's the point of pausing?  The only "good" purpose is to offer some sort of control over misbehaving applications.  That's a fine gesture.  But, as a power user, how about giving me the control to whitelist apps that I want to be in the background?  Oh, I can't because Charlie Kindel knows what's best for us.  (Queue the halos and angelic chorus.)

So anyway, I've been reading the WP7 apologist posts on various Microsoft forums.  There are a hell of a lot of people who are okay with WP7 not offering a true multitasking experience.  That's fine.  Not everybody computes the same.  Some people run all their desktop apps in full screen, can't stand a second monitor, and hide their task bar.  It feels like trying to compute with two broken wrists to me, but hey, I won't begrudge them.  They had their own choice to use their computer that way.  What is pissing me off are the number of people who claim This Way Is The One True Way and those of us that want to multitask, really don't need it and won't miss it!  Oh hell to the no!  I will definitely miss it.  You want to know how?  Because I'm not completely stupid and I know my computing habits.

As if being forced to have the ugly blue-box "metro" theme be the only home screen available on WP7 wasn't torture enough!

So, to Mr. Kindel and Kindel brown-nosers: If you don't want to multitask on your phone, that's fine.  I mean, really, more power to you!  But can I, and other power users like me, please have this option that would require almost no effort on MS's part to implement?  After all, CE has multitasking built-in.  It takes more effort to stop it from multitasking than to keep it in.  I'm okay with a supposed shorter battery life (snicker).  I just want my control back.  Windows CE is a really cool embedded operating system.  Let's not neuter it with silly Apple-like rules, okay?

Timothy

A Real Future for Windows Phone Classic?

I was searching the Google for information on Windows Phone 7 regarding database support.  There will be no database support.  Interestingly, I found discussion with somebody venting about this (and the other, many, lacking features of Windows Phone 7) and saw an interesting reply from a Microsoft employee.  Quoted in full (sic and all that apply)…

I'm part of the team that supports all Mobile and Phone technologies.  Our team still remains obligated to continue supporting 6.5 and the corresponding Enterprise Business market.

Clearly the target market for Windows Phone 7 is the consumer and its entire architecture has been designed from scratch by the best architects at Microsoft, who left other divisions within the company and converged to brainstorm the specific needs of the consumer, as contrasted with businesses (although there definitely is overlap).

Note that Marketplace for Windows 7 is set up in a way that any app posted there can be downloaded by anybody; it isnt intended for the needs of the Business who wish to deploy an app on the phone that only they are privileged to access.

The needs of the Enterprise Business customers will not go away and their needs must be, and will be, addressed differently. 

For the moment,  the limelight is on the Windows Phone 7 Series, but you will see Enterprise progress and Microsoft's continued support for phones used in business.

Best Regards,
Mark
--------------------------------------------------------------------------------
Mark Chamberlain Sr. Escalation Engineer | Microsoft Developer Support | Windows Phone 7

First, regarding the "best architects" wank wank stuff.  You could have fooled me!  Metro UI was interesting for about a day.  Now it's just ugly to me.  But I'll give it another shake once it's out of beta.  It's not fair to bash on it too hard while it's still in beta.  On the other hand, Mobile Shell 3 and SenseUI are still interesting and I've used both for a while now!

So, according to Mr. Chamberlain, the enterprise customers needs must and will be address differently?  Differently?  As in, not using the draconian Windows Phone 7 model?  Do I dare hope for life of Windows Phone 6.5 beyond 6.5.3?  Do I dare hope for Windows Phone 6.5 to be renamed Windows Phone Enterprise Edition with a new wicked CE7 kernel and updated Compact Framework 4.0 (with Silverlight)?  Do I dare hope for Visual Studio 2010 (and beyond) support?

Do I dare hope for life on the mobile operating system that could easily be modernized and that I've enjoyed using and programming for over the last ten years?

A side note: T-Mobile can't keep the HD2 in stock!  All that on an "outdated" OS.  I could have told you that putting a decent CPU in a HTC SenseUI (aka TouchFlo 3D) powered device would do that.  But nobody listens to me… :-)

Timothy

McCain Won't Cooperate Anymore

John McCain said on a radio interview that the GOP won't cooperate for the rest of the year.  I know, I know.  Eleventy billion people are going to say this in unison,  but I just can't NOT post this!

All together now...  Since when has the GOP cooperated with the Democratic majority in the past two years?

Timothy

Windows Phone 7 Series - Not Too Excited About It

I have always been a huge fan of Windows Mobile.  It is (was?) literally a computer in my pocket.  A barrage of  less-than-spectacular devices combined with long periods between (small) updates left the platform behind its newer competitors -- the iPhone and Android.  Now, I won't get into a deep discussion of what happened in the past, but let's just say that thanks to the efforts of HTC, Windows Mobile/Phone stayed fairly competitive, all things considered.

Now Microsoft has introduced Windows Phone 7 Series.  They want to get back into the game big time.  What initially looked so freaking awesome has turned out to be Microsoft's version of the iPhone -- a heavily locked down device with a supposed "focus on consumers."  Apparently a focus on consumers means telling consumers how they are supposed to enjoy their devices and maybe cutting them a break and giving them some third party apps that absolutely cannot run in the background.  That's the straw that broke the camel's back for me.  As a developer and power user, I can't buy a Windows Phone 7 Series device if I can't tweak the hell out of it like I can my current device, a HTC Touch Pro 2, running Windows Phone 6.5.

So, what few Windows Mobile fanboys still exist out there, read the following article and cry at the end of an era.  And also plan your next Android purchase.  God, I hate Java.  But what can I do?  Microsoft has left me with no choice.

http://www.pcmag.com/article2/0,2817,2361377,00.asp

So supposedly in the future multitasking will be available when they figure out how not to impact the user experience (wtf?  never heard of a priority queue?  mutltitasking is not rocket science).  If and when they do, I might be back on board.  Until then, with no unmanaged code, no memory cards, no multitasking, and a load of other "nos" where Microsoft forces us to use our devices their way and not ours, I'm not buying a Windows Phone 7 Series device.  Very sad considering how cool it looks.  I mean Silverlight UI and XNA games?  Hell to the yea!  But it's no longer a minicomputer.  It's just a Zune with a phone.  I'm not interested.

So, I hope their commitment to the 6.5 platform is not lip service, because I'm relying on that while I watch to see what happens with Windows Phone 7 Series.  I'm hoping that by "7.1" it will still look smooth as silk, like it does now, but will be back to being a mini-computer, like its in-spirit predecessors.

Timothy

Eureka Seven: Good Night, Sleep Tight, Young Lovers

Eureka Seven: Good Night, Sleep Tight, Young Lovers is a fast-paced action-packed love story. It has a very different plot from the original Eureka Seven series, so don't expect a sequel!

That said, the plot does parallel the series in several ways. The basic premise of aliens attacking the Earth and humans fighting back remains. Where the series portrayed the aliens as basically misunderstood and unintentionally damaging, the movie portrays them as more generically malicious, even though they did shoehorn some more 'innocent misguided intentions' stuff later in the plot.

Eureka has changed a lot. She's more of a fusion of Eureka and Anenome in the series, including frequently yelling "idiot" at Renton. That took a lot of getting used to for me. Interestingly, Novak and Anenome basically replaced Norb and Sakuya's roles in the story. It will raise a few eyebrows at first, but it worked.

For the first 45 minutes, I was a bit disappointed. Character development seemed forced (probably due to trying to fit a series worth of plot into a two hour movie). However, it won me over at the point when Holland was explaining the Gekko crews' motives to Renton. This was one of my favorite moments because it actually gave a nod to the series! I'm not going to give it away, but it was really cool how they did it. After that, the story seemed much less rushed. It was still confusing at times, but a few characters were also confused by what was happening. So I figure confusion was intentional.

Trapar waves were completely unexplained in the film. So there is no clue what it is or how it works in this universe, but vehicles do use it for lifting, so it's there. Eureka has a sensitivity to light, but that is also never explained. You'll find "unexplained" being a bit of a recurring theme.  lol.

And the ending, ahh the ending! It was truly unique to the movie and it worked! Just like the series, it showed love, sacrifice, maturity, and made up for the more confusing parts.

I love the original series. It is actually not just my favorite Anime, but my favorite story in any form. I love it! On a scale of zero to five, I give it 5/5 easy! However, I can't rate the movie that high. Don't get me wrong, it was a great story. I would give it a solid 4/5 star rating. If you liked the series, you will like the movie, even if just to get a little more of a Eureka and Renton fix. If you are not familiar with the series, you will still like it, but be prepared for a confusing ride.

And now some random notes:

  • They actually give a reason for the "seven" this time!
  • Very few references to the electronica scene this time (disappointing).
  • Moon Doggie can apparently be in a KLF the Gekko at the same time! Plot holes resulting from reused animation cells can be funny. ;-)
  • Baby archetypes can say one word and they tend to say it in an incredibly annoying voice.
  • The final version of Nirvash in the movie kicks even more butt than in the series.
  • The literal translation of the Japanese subtitle is "Pocket Full of Rainbows." I'm not really sure why they changed it to "Good Night, Sleep Tight, Young Lovers" as there were ample references to rainbows throughout the series. Sometimes subtitles are changed because something is lost in translation. Here, I don't know.

Anyway, I really hope Bones returns some day to the original series' universe. I still long for more!! :-)

Timothy

Installing Microsoft Dynamics CRM With Exchange in Another Forest

There is basically no information on Teh Googlez (or Teh Bing!) on this error, so I hope this helps somebody out there.

I was trying to install Microsoft Dynamics CRM 4.0 in our beta environment, which is in its own forest.  Every time I installed it, no matter what settings or tricks I tried, I would get the following error:

image

For the search engines and those who can't read text in pictures, it says…

Action Microsoft.Crm.Setup.Server.AddIncomingServerToPrivUserGroup Action failed.  There is no such object on the server.

If you click Retry, it won't work.  If you click Ignore, you get a few more errors and then the installation fails at the end.  If you click Abort, you save yourself some time and it just quits right there.  At this point you may have to manually undo parts of the CRM installation.  Start with running the uninstaller, of course.  Then check to make sure the CRM databases are deleted off your SQL server and the Active Directory objects got deleted as well.

At this point, I looked at the logs to see if I could gleam what happened.  Unfortunately, the logs did not provide any more help as they just repeating what was in the error box above.  Here's a snip.

18:07:17|  Error| Install exception.System.Exception: Action Microsoft.Crm.Setup.Server.AddIncomingServerToPrivUserGroupAction failed. ---> System.DirectoryServices.DirectoryServicesCOMException (0x80072030): There is no such object on the server.

   at System.DirectoryServices.DirectoryEntry.CommitChanges()
   at Microsoft.Crm.Setup.Server.Utility.ADUtility.AddAccountToGroup(String accountName, DirectoryEntry groupEntry)
   at Microsoft.Crm.Setup.Server.AddIncomingServerToPrivUserGroupAction.Do(IDictionary parameters)
   at Microsoft.Crm.Setup.Common.Action.ExecuteAction(Action action, IDictionary parameters, Boolean undo)
   --- End of inner exception stack trace ---
   at Microsoft.Crm.Setup.Common.Action.ExecuteAction(Action action, IDictionary parameters, Boolean undo)
   at Microsoft.Crm.Setup.Common.Installer.Install(IDictionary stateSaver)
   at Microsoft.Crm.Setup.Common.ComposedInstaller.InternalInstall(IDictionary stateSaver)
   at Microsoft.Crm.Setup.Common.ComposedInstaller.Install(IDictionary stateSaver)
   at Microsoft.Crm.Setup.Server.ServerSetup.Install(IDictionary data)
   at Microsoft.Crm.Setup.Server.ServerSetup.Run()
18:07:17|   Info| Microsoft Dynamics CRM Server install Failed.
18:07:17|   Info| Microsoft Dynamics CRM Server Setup did not complete successfully.

Action Microsoft.Crm.Setup.Server.AddIncomingServerToPrivUserGroupAction failed.
There is no such object on the server.

15:40:56|   Info| === Setup bootstrap logging started 1/27/2010 3:40:56 PM ===
15:40:56|   Info| Bootstrap version: 4.0.7333.3.
15:40:56|   Info| User: Administrator.
15:40:56|   Info| Managed Setup exited with code -2.
15:40:56|   Info| === Setup bootstrap logging ended 1/27/2010 3:40:56 PM ===

It turns out that the problem is the fact that my Exchange server is in another forest.  This is mentioned essentially nowhere that I can find, but a call to Microsoft Support pinned the issue down.  The two domains in the two forests have a two-way trust, but the installer is still not happy.

So what do you do?

Well, it's not that bad.  First, run the installer, but do not put in a mail server when it asks.  Ignore the email server warning and proceed anyway.  The installation will succeed this time.  Huzzah!  Now, we need to add in the Exchange server manually.  Go to the CRM OU you created in Active Directory, open the properties of the PrivUsergGroup and manually drop in the Exchange server computer object (from whatever domain you want) to the list of members.  Done!

Some extra notes…

Make sure you are installing as a local forest domain admin.  If you install using an admin from another forest, you may get this error:

image

Similar to the previous error, this occurs because the installer can't seem to cross forest boundaries when populating the PrivUserGroup group.  For the search engines and those who can't read text in pictures, it says…

Action Microsoft.Crm.Setup.Server.AddCurrentUserToPrivUserGroup Action failed.  There is no such object on the server.

The solution is to use a local forest domain admin (one contained in the same forest as the CRM installation) for running the CRM installer.

Conclusion

Yet another modern sloppy Microsoft installer with an overly verbose log that tells you abso-fricking-lutely nothing useful about the installation error!  Ever since about SQL Server 2005, the installers for MS products have become less and less reliable – even on virgin servers!  The worst I've encountered so far is TFS 2005 (server side, that is – client side is a breeze).  SQL 2008 is a very close second.  Hopefully Microsoft will start making better installers soon.  (Or, at they very least, not requiring end users to burn a support case on an installer issue.)

Timothy

Gators Pwn Cincinnati

So is Cincinnati really overrated or is the SEC just that damn good?  The Gators destroyed the Bearcats tonight in the Sugar Bowl.  I'm a Gator fan so I'm happy!  I did not understand the BCS rating the Gators #5 after losing to Alabama in the SEC championship.  And tonight I was vindicated.  The Gators should have been the #3 team in the polls.  Just because you are undefeated does not mean you are that good

Not that it matters much because the net result would have been the same (Sugar Bowl invitation).  It's just another example of how the Bowl system is broken and we need a playoff system in I-A college football!  If we had a playoff system, I bet you anything it would have been an Alabama / Florida rematch.

And finally, I have to give a big thumbs down to the Fox game commentators.  There was about a total of 12 minutes where they actually called the game.  The rest of the time they spent talking about football inside drama and politics.  They spent about an entire quarter talking about whether or not Tim Tebow will be any good in the NFL (my prediction: he will become a dominant QB after a few years when he finally gets a chance).  It was the worst called bowl game I've ever watched!

But no matter.  The Gators won 51-24.

Timothy

AT&T Sucks

AT&T sure hates the fact that their 3G coverage sucks and Verizon is pointing it out.  The latest ad (been out for a while, actually) says that only AT&T allows you to talk and download at the same time.  Big deal if you can't get 3G service!

I hate AT&T.  I have to have them for local phone service because I use DSL and their monopoly makes them the only game in town -- and a very expensive option at that.  Cable is better for internet, but Time Warner is even lower on the scale of "good companies" in my book.  Better of the two evils -- so AT&T wins.  Thankfully, my actual DSL provider is a local company (Portbridge) and they are very good.  It's still AT&T's loop and I have to have local phone service, but at least AT&T is getting the least money possible from me.  I hate monopolies. 

I thought deregulation was supposed to fix all this?

Of course not!  Deregulation never helps the consumer.  Well I've derailed from my original point.  So, in conclusion, fuck AT&T and fuck Time Warner!

And Happy New Year!  :-)

Timothy

President War Hawk

As usual, The Rude Pundit is right.  President Obama never promised to not escalate the war/occupation in Afghanistan.  I knew this voting for him.  And yes, Rude is also right that I made that little platform negotiation in my head (I'll trade war for health care, etc.).  However, one point I think Rude is a bit wrong on is on how Obama's liberal plans are panning out.  Aside from Gitmo, I think he's done a good job advocating liberally.  It's not that he's just waffling on liberal issues because he doesn't believe strongly in them.  He's doing it because he has absolutely no choice. 

The fact is, despite an overwhelming majority of Democrats, we do not have a liberal -- let alone socialist (I LOL every time I hear a winger say that) congress.  We have a center-right congress.  For every Al Franken, Bernie Sanders, and Brad Miller, we have nearly as many Blue Dogs, Republicans, and Conservadems.  That's not even including the truly "moderate" Democrats (conservative Democrats are not moderate, by definition).  That makes it very difficult for a progressive agenda.  But if there is one thing the majority of congress agrees on, it's killing foreigners!  Especially if they have brown skin or happen to be of the Islamic faith.  Show me any federal politician (except a very small handful) and I'll show you a war hawk!  So when Obama proposes his Afghan strategy, expect much rejoicing at our country's ability to wag its gigantic military penis at everybody else.  Oh, sure, Republicans will whine about how they don't like it.  But it won't be because they are anti-war.  Hell to the no!  It will be because it's not hawkish enough!

So, I don't see any reason to blame Obama about this American Empire Building Adventure or, by contrast, the watered down nature of his liberal promises.  He's just delivering what he can within the best of his abilities and a stubborn congress.  And that just happens to favor the righties more than us lefties.  Although, I do think he should take a stronger stand on Gitmo.  But that's just my opinion.

So what can you do to stem the hawkishness if you are anti-war, like myself?  Well, one way is to invoke the other great fear that the conservative (Democrat and Republican) hawkers have: taxes.  You probably thought I was going to say deficit and/or debt.  Nope.  Oh, sure, they say they are all against rising deficit and debt.  But that's a complete load of campaign trail sales pitch BS.  The Clenis (aka Uberliberal Circa Nineteen Hundred and Ninety Two – according to hawks) left us a freaking budget surplus!  Fiscal Conservative Reagan?  No.  Fiscal Conservative Bush The Smarter?  No.  Fiscal Conservative W?  No.  Now, it's easy to just blame W for the squandering of the surplus.  But remember, he wasn't the enabler.  He needed congress to do it, and boy howdy, did they ever!   And who was at the center of it all?  The "tax and spend" liberals?  No.  The "fiscal conservative" (heavy irony quotes) war hawks were.  So, anyway, yea, you can't fight them by complaining about how it adds to the deficit.  They just do not care. 

But the hawks can hear when you mention a tax!  Have you seen the outrage of Rep. David Obey's proposition that our wonderful adventures in Afghanistan actually be paid for like healthcare?  The hypocritical outrage is absolutely laughable.

So that's why I absolutely, 100%, support a special tax on wars.  In fact, there should be constitutional amendment requiring that all foreign military adventures (whether or not they are officially declared "war" by congress) be paid for by a special progressively increasing income tax (structured similar to the standard federal income tax, but without any exemptions or limitations to those not in poverty).  It's time the rest of us feel a teensy tiny pinch while military families and families in the areas we are attacking are literally torn apart.  Wars should simply not be allowed to be funded by deficit dollars.  Budget neutral!  End of story.  How on earth could a real fiscal conservative disagree with that?

But that will never happen because the majority of our current congressional representatives care more about getting reelected than following their stated principals, let alone doing good for simple the sake of doing good.  Remember that when you are voting for your representative and senators.  I am not a pessimist.  We can change this.  Obama's campaign (not Obama himself) proved this.  All politics are local, etc.

So do something, already!  Write your reps.


Post-Obama Speech Update (8:41PM): I don't want to deeply analyze what he said or get all pundity here, so I'll leave that to the professionals.  I do, though, want to comment on Obama's timeline.  He said in 18 months after the January "Afghanistan Surge" we will begin bringing troops home.  Now, I don't want to imply that he said everybody will be home in June, 2011 -- that's not the case.  But I was honestly shocked that in a mere three Friedman Units, he thinks we can get this under control and to some degree successful and secure enough to where even moderate war hawks can be happy with drawing down forces.  I'm still anti-war, but I would be extremely pleasantly surprised if that ends up being the case.  I'm a bit skeptical this timeline will not be extended, though.  That said, I am much more confident than any time anybody from the previous administration, or Little Tommy Friedman himself, proclaimed all will be well in just six more months.  Whether or not you agree with Obama's approach, at the very least, the adults are back in charge.  President Chimpy certainly left a lot to be desired in that respect.

Timothy

Quickly Dimming an Arbitrary Bitmap in Compact Framework for VB.Net

I had a need to directly manipulate the bytes in a bitmap for my VB.Net app for Windows Phone.  I found quite a few articles with The Google on how to do this in C#, using the unsafe keyword.  That's a perfectly fine way of doing it for C# users.  However, VB.Net does not have anything like the unsafe keyword, so there is no way to run unsafe (unmanaged) code blocks.  Philosophically, this might be a "good" thing to Managed Code purists.  I'm actually neutral on the issue.  Still, just because you can't do arbitrary pointer and memory manipulation in VB.Net does not mean you can't do this very simple thing (dimming the color brightness of each byte of a bitmap).  It's pretty easy and I can't believe nobody out there has posted how to do it this way VB.Net or C#.  I came up with this code for the Compact Framework for Windows Phone specifically, but it will also work in the big Framework for big Windows.  It will work in both VB.Net and C# just fine.

The key to this method is using the Marshal.Copy method.  This copies a block of memory from an IntPtr to various types of arrays and then back again.  Whereas the unsafe method directly manipulates the bytes in the bitmap, this code block copies the unmanaged bytes to an array, manipulates them, then copies them back to the unmanaged buffer.  Using the 'unsafe' method is likely a hair faster, but in real world performance metrics, even on Windows Phone you would be hard pressed to see any noticeable difference between the two.  Copying blocks of memory is a very fast operation.

This code adjusts the brightness of a bitmap, dimming it by half (a bit shift of >>1 for each color component of each pixel).  Windows Phone natively uses 16bit bitmaps ('565' format, as in RRRRRGGGGGGBBBBB).  The below code block can be adjusted to work with 24 and 32 bit bitmaps as needed.  It's actually easier to use 24 and 32 bit bitmaps as you just manipulate the brightness of  individual Byte primitives without needing to break apart the Int16 (short) using bit masks, as below.  However, the act of converting the 16 bit bitmap to a 32 bit bitmap on Windows Phone seems to cause a significant a performance hit!  So don't do that on Windows Phone.  Stay with the 16-bit bitmap and use bit masks, as I did below.  For big Windows, you will want to use 32 bit bitmaps, not 16 bit bitmaps.

Private Sub DimBitmapByHalf(ByRef bmp As Bitmap)
  Dim bmd As Imaging.BitmapData = bmp.LockBits(New Rectangle(0, 0, bmp.Width, bmp.Height), Imaging.ImageLockMode.ReadWrite, Imaging.PixelFormat.Format16bppRgb565)
  Try
    Dim bufLen As Integer = (bmd.Stride * bmd.Height) / 2 ' Because bmd.Stride and bmd.Height are in units of 8-bit bytes
    Dim buf(bufLen - 1) As Short
    Dim r As Short
    Dim g As Short
    Dim b As Short

    System.Runtime.InteropServices.Marshal.Copy(bmd.Scan0, buf, 0, bufLen)
    For i = 0 To bufLen - 1
      '                              RRRRR GGGGGG BBBBB
      r = (buf(i) >> 1) And &H7800 ' 01111 000000 00000
      g = (buf(i) >> 1) And &H3E0  ' 00000 011111 00000
      b = (buf(i) >> 1) And &HF    ' 00000 000000 01111
      buf(i) = r Or g Or b
    Next
    System.Runtime.InteropServices.Marshal.Copy(buf, 0, bmd.Scan0, bufLen)
  Finally
    bmp.UnlockBits(bmd)
  End Try
End Sub

Blog

Search Posts

Recent Comments

  1. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    ptbNPA: That should have been *ID 810*, not 820

  2. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    ptbNPA: For anyone else coming across this in the future and have an ID 820 error: For some strange reason...

  3. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    Timothy: Sorry, I don't have any other insight. I'm sure you ran into all the same articles I did about the error...

  4. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    ptbNPA: FYI, after posting the issue on technet + windows-noob.com with no replies I decided to do a fresh Windows...

  5. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    ptbNPA: Hi and thanks for your post. I originally installed SQL 2016 with SP1 on a Windows server 2016 and got...

  6. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    Timothy: Update Rollup 2.

  7. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    Catwiesl: You write "Microsoft System Center Data Protection Manager (DPM) officially supports SQL 2016 with U...

  8. Re: PowerShell: Quickly Finding the Oldest and Newest Files in a Folder
    Neki: i would like to compare a local file with a remote file and download the remote file if its newer than...

  9. Re: RD Tabs: Tabbed Windows Remote Desktops
    lukas: Fantastic software though I am having issues saving passwords. As soon as I kill the program the setting...

  10. Re: Easy Way to Change Permissions on the Windows Server Scheduled Tasks Folder (C:\Windows\Tasks)
    George: From another server, using an admin account, I opened \\SERVER\c$\windows in Windows Explorer. Tasks...

Archive

Tag Cloud