Wednesday, April 11, 2007

Hidden network connections and other usefull shortcuts

Can't find the network connections in the new Vista? They are somewhere hidden in the new start menu,  the fastest way is to type in the search field in the start menu and type ncpa.cpl and you are there!

Some other things you can reach faster :

Ncpa.cpl : network connections

Eventvwr : Event viewer

Diskmgmt.msc : disk management.

Regedit : registry editor

inetmgr : iis manager

services.msc : services panel


If you know others, just let me know
By the way they should also work on XP (and maybe earlier)

Friday, March 23, 2007

Access the clipboard from a visual studio macro

Visual Studio macros can save a lot of time,
automating the workspace,
but when you try to access the clipboard,
the following error pops up :
Current thread must be set to singe threat apartment (STA) mode before OLE calls can be made. Ensure that your main function has STAThreatAttribute marked on it.
Not so nice,

The trick to solve this is create a new thread, have the STA flag set and let that thread access the clipboard.

I created a new macro module modClipboard with the following functions :

Private clipText As String

Public Property ClipboardText() As String
Get
RunThread(AddressOf GetClipboardText)
Return clipText
End Get
Set(ByVal value As String)
clipText = value
RunThread(AddressOf CopyToClipboard)
End Set
End Property

Private Function RunThread(ByVal fct As Threading.ThreadStart)
Dim thread As New Threading.Thread(fct)
thread.ApartmentState = Threading.ApartmentState.STA

thread.Start()
thread.Join()
End Function

Private Sub GetClipboardText()
clipText = Clipboard.GetText()
End Sub

Private Sub CopyToClipboard()
'The second parameter is required
Clipboard.SetDataObject(clipText, True)
End Sub

The module variable (cliptext) is required to transfer the data between the threads.

And now we can call the property in our other functions :
 
Copy to clipboard :
ClipboardText = "Whatever you want"

Get the clipboard data :
  strClipboard = ClipboardText

Monday, March 5, 2007

Lost the menu in Vista?

Can't find the things you want to do in Vista?

The menu gone with the wind?

Don't fear, in most programs, you can just press the Alt key to make the trusted menus visible.

This will not work in all programs,
but it will work in a good number of them (mediaplayer, Internet Explorer, folder windows, ... )
but not in office 2007

Friday, February 16, 2007

Automatic updates bugging you to restart?

Getting tired of having to click away the restart later button every 10 minutes when there is an update? 
I was,  and after some searching I found a solution on the internet,
you can't turn it off, but you can make it appear only once a day 

(that way you can shut down at the end of the day and the next day the reboot is done, 
when you boot the computer)

press Start, run
type in gpedit.msc
at the left side of the screen,  under the Local Computer Policy, choose Administrative Templates,   Windows Components, Windows Update

at the right side of the screen, doubleclick  Re-prompt for restart with scheduled installations

You can disable it (Thanks to Charles : disabled means the default 10 minutes.),
or put a value in the enable field, I put it at the maximum value : 1440, so it will only bug me once per day.

Unfortunatly, this is only active when windows restarts, so you may still have the annoying screen for the moment.

To get rid of that temporarily :
press start, run, services.msc

then right click the Automatic Updates service en choose 'stop', it will now stop bugging you :)
(it is best to leave it at automatic, so it will restart when you reboot your pc, and the other 'fix' is active)

I could only test this on a Windows XP Professional with SP2, 
I don't think the home version has the gpedit.msc tool. If I find something for that I will post it.

Edit: This also works in Vista Ultimate (I tested it on the X64 Ultimate edition), but Vista lets you select to notify only every 4 hours
 

Sunday, February 11, 2007

Welcome to my blog

Welcome to my blog, 
on this page you will find interesting things that I find surfing the internet, 
about programming, vista and other interesting things. 

Have a good read, 

svenM