First time here? Check out the site's "greatest hits" or read a post from the archives. Feel free to leave a comment or ask a question, and consider subscribing to the latest posts via RSS or e-mail. Thanks for visiting!
Do you Tweet? Follow me on Twitter @shanselman or learn how to use Twitter!

At the PADNUG meeting last night the question (Lord knows why this always comes up :) on how to make the system "beep" was asked.  Here's two kinds of beeps, and links to some source.

The "PC Beep," including frequency and duration:

using System.Runtime.InteropServices;
class MainClass
{
[DllImport("kernel32.dll")]
public static extern bool Beep(int freq,int duration);

 public
static void Main(string
[] args)
 {
 
Beep(1000,1000);
  Beep(2000,500);
 }
}

The considerably more interesting "MessageBeep" (via BradA) that uses the Wav files that are configured in the Sounds Control Panel.

public enum MessageBeepType
{
    Default = -1,
    Ok = 0x00000000,
    Error = 0x00000010,
    Question = 0x00000020,
    Warning = 0x00000030,
    Information = 0x00000040,
}

[DllImport("user32.dll", SetLastError=true)]
public static extern bool MessageBeep(
    MessageBeepType type
);



.DOT COMMON - A Beat Poem by Scott Hanselman

Posted 2003-07-31 04:24 PM in Gaming.

I woke up at 3am last night and wrote this Poem.  I will probably perform it at the LuvJonz at Ohm on Weds the 6th.


.DOT COMMON

We watch UPN's Fake life via a one way transmission
Oh, Those wacky girlfriends
But you are more than my friend, girl
You are my life, my wife, My only source of strife 

man and wife We fight

 But we make up, and that make-up is a wake up
Calling me to appreciate MY fate, MY life, MY wife
But Fake life calls again, this time it's a two way transmission 

UPN makes way for TCP/IP, U see I see the calls of the green screen and the..chat
You've got mail.
Maybe he's got mail, you don't.  Your male, yo' man, is on-line, on yo' time. 

The internet being a means to facilitate data transmission and exchange
At this rate he/I may be your ex ... change
Is not always for the better

slash slash, I want my HTTP-Stolen-time-back

But this Internet, this new network, isn't about you and me,
It's about me and everyone...but you' 

Xbox Live isn't Livin'
But I am Finding my Solace in the Start Menu
I'm aLive in Windows 95
The C drive affects our sex drive
Letters take my attention
Creates dissention increases contention 

Compete, take a back seat, you retreat in defeat
My computer has become my suitor
The internet my friend
We don't conjugate conjugally
We procreate minimally

And you, my mate, translate to a different state, that of
Roommate - correspondingly lightweight

Bringing together of gentle rank and file
attachments in this Global community

I'm closer to my DOT-PenPal's locale
Than friends
Shall Speak now or forever hold their peace
I'd never risk
This marriage
This earnest Endeavour
With who-so-what-ever
Till Death do us part ways
Death - The time when something ends
Our DOT com-mon law marriage

- Scott Hanselman ©2003



Had a blast at the PADNUG meeting tonight.  The pizza delivery failed so we all went over to the Buffalo Gap, and enjoyed a buffet on the house.  Hung out with Rory Blyth, who is clever in person as well as in the blogosphere.  I mentioned I'd sold three Commodore 64s today (+Drives, Monitors, and a Koala Pad) and we talked about BBSes.  He also was a big BBS'er back in the day and I was completely shocked to hear that he'd heard of my little BBS...I noticed it's listed in the definitive source of BBS info, the PDX BBS List.  Either way, a bloody fine time.



Here's a particularly special bug, because this represents my FIRST experience with MSN Messenger 6.0, which I installed and my friend Adam's urging.  :)   That's Adam in the upper right corner.  What's that in the lower right corner you ask?  Well, that's not me, but a reverse image of my USB TV Tuner.  Apparently Messenger doesn't feel like enumerating the more than one video sources available on my system.  Be aware!

A picture named msn60camerabug.JPG



I’ve got a small C# Security Application that I’m writing an Editor for.  I was hoping to let the user run the application as whoever they choose to, and then use LogonUser to create a WindowsImpersonationContext and log them in as SOMEONE ELSE to do the DPAPI Encryption (because it will be that other use that will be decrypting the data.)

 

I’m using DPAPI with a User Store, not a Machine Store.  I’ve got a managed wrapper for DPAPI that works fine.  I’ve got a Managed “ImpersonateUser” function that returns a WindowsImpersonationContext and internally users LogonUser and also works fine.  

 

The psuedocode/gist is be basically:

 

Load App

            Do some stuff

            Load XML File

            Call ImpersonateUser (someotherguy) [succeeds and WindowsIdentity.GetCurrent().Name changes to reflect the change

            Call DPAPI to Encrypt Element Context (this works fine if I DON’T IMPERSONATE...)

                        ERROR: Win32 Marshal.GetLastWin32Error() reports “The System couldn’t find the file specified”

            Save File

            Call ImpersonationContext.Undo

Exit App

 

Apparently this is either utterly stupid of me, or noone has ever tried it.   All the doc on DPAPI is either highly theoretical “how it works internally” or very trivial “here’s how I used the Machine Store from ASP.NET  The doc on WindowsImpersonationContext is even worse.

 

Am I going to just make the user to a “RunAs” to launch my app? (which works fine, BTW)  It just would have been so nice to have a "Run As" menu item...thoughts anyone?




Contact

Sponsors

Hosting By

Hot Topics

Tags

Calendar

<August 2003>
SunMonTueWedThuFriSat
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456

Archives

November, 2009 (5)
October, 2009 (19)
September, 2009 (11)
August, 2009 (12)
July, 2009 (21)
June, 2009 (26)
May, 2009 (16)
April, 2009 (13)
March, 2009 (17)
February, 2009 (17)
January, 2009 (18)
December, 2008 (32)
November, 2008 (17)
October, 2008 (22)
September, 2008 (16)
August, 2008 (14)
July, 2008 (25)
June, 2008 (19)
May, 2008 (17)
April, 2008 (17)
March, 2008 (26)
February, 2008 (21)
January, 2008 (28)
December, 2007 (19)
November, 2007 (17)
October, 2007 (31)
September, 2007 (39)
August, 2007 (37)
July, 2007 (43)
June, 2007 (37)
May, 2007 (32)
April, 2007 (38)
March, 2007 (29)
February, 2007 (46)
January, 2007 (31)
December, 2006 (27)
November, 2006 (31)
October, 2006 (32)
September, 2006 (39)
August, 2006 (34)
July, 2006 (40)
June, 2006 (18)
May, 2006 (31)
April, 2006 (34)
March, 2006 (30)
February, 2006 (38)
January, 2006 (44)
December, 2005 (19)
November, 2005 (34)
October, 2005 (24)
September, 2005 (37)
August, 2005 (20)
July, 2005 (24)
June, 2005 (33)
May, 2005 (16)
April, 2005 (22)
March, 2005 (34)
February, 2005 (15)
January, 2005 (37)
December, 2004 (28)
November, 2004 (30)
October, 2004 (34)
September, 2004 (22)
August, 2004 (34)
July, 2004 (18)
June, 2004 (64)
May, 2004 (49)
April, 2004 (21)
March, 2004 (29)
February, 2004 (29)
January, 2004 (36)
December, 2003 (25)
November, 2003 (24)
October, 2003 (59)
September, 2003 (42)
August, 2003 (24)
July, 2003 (44)
June, 2003 (29)
May, 2003 (21)
April, 2003 (30)
March, 2003 (27)
February, 2003 (47)
January, 2003 (50)
December, 2002 (31)
November, 2002 (38)
October, 2002 (44)
September, 2002 (15)
May, 2002 (2)
April, 2002 (4)

Google Ads