Windows servisi geliştirirken eğer sevisinizle beraber herhangi bir Form uygulaması da varsa ve servisinizin çalışma esnasında bu formun da görünmesini istiyorsanız sevisin özelliklerinden  " Allow service to interact with desktop " seçeneğini aktif yapmalısınız.



Tabi bunu kullanıcının değil de servis uygulamanızın yapması gerekiyor :) Fakat .net bunu yapabilecek bir imkan "henüz" sunmuyor. Bu durumda registry den sevisinizle ilgili Type değerinin 8. bitini 1 haline getirmeniz gerekiyor. Bunun içinde yapmanız gereken Type değerini 256 ile bitsel veya işlemine sokmaktır ki örnek kod aşağıda.

RegistryKey rootKey = Registry.LocalMachine;

RegistryKey subKey = rootKey.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\XXX\",true);
if (subKey != null)
{
    int typeVal = (int)subKey.GetValue("Type") | 256;
    subKey.SetValue("Type", typeVal);
}


 


 
Friday, November 06, 2009 3:28:59 AM (GTB Standard Time, UTC+02:00)
Do you want to buy some sheepskin boots, please come to www.findugg.com.Full range of UGG boots for Men and Women to buy online. Fast and free shipping to worldwide, competitive price, high quality, and efficient service.

Read more:http://www.findugg.com
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

Live Comment Preview