|
I ran FxCop over my assembly and got the warning about not indirectly exposing methods with LinkDemands (CA2122 help link). The original code was like this (Marshal.GetLastWin32Error is the method with the LinkDemand):
Dim extendedStyle As Integer = NativeMethods.GetWindowLong(hwnd, GWL_EXSTYLE)
If extendedStyle = 0 Then
Throw New System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error())
End If
I then moved the exception throwing into a method on the NativeMethods class and the code now looks like this:
Dim extendedStyle As Integer = NativeMethods.GetWindowLong(hwnd, GWL_EXSTYLE)
If extendedStyle = 0 Then
NativeMethods.ThrowWin32Error()
End If
<SecurityPermission(SecurityAction.Demand, UnmanagedCode:=True)> _
Friend Module NativeMethods
Friend Sub ThrowWin32Error()
Throw New System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error())
End Sub
End Module
As expected, the original method is no longer flagged by FxCop. I expected the new NativeMethods.ThrowWin32Error to be flagged, but it is not. Neither the NativeMethods class nor the method have any attributes. Does anyone know more about LinkDemands or this warning that could provide an explanation for why this is not flagged? (EDIT: I am getting the FxCop warning now without the attribute.) Is applying a SecurityPermission attribute the right way to deal with that warning?
I am getting the same message for the serialization constructors of Exceptions that call GetObjectData, and I assume that whatever I end up doing for this situation will need to be done for them too.
modified on Thursday, September 17, 2009 1:51 PM
|
|
|
|
|
Hi Guys,
I have a service running under a restricted access user (say - AppUser) that is not related to the user who is currently logged in to windows (say - JSmith).
I'm trying to get the user name of the currently logged in user (JSmith) from an application running under AppUser.
How would i go about doing this?
Regards
Tris
-------------------------------
Carrier Bags - 21st Century Tumbleweed.
|
|
|
|
|
Hello,
I'm trying to change background color of some line in a .cs file.
MSDN seems pretty straightforward regarding custom colorization: one has to define custom colorizer, and probably some font items. But the idea behind it is adding new language highlighting rather than modification of predefined one.
------
It could be a wrong forum, however answer is:
IVsTextLineMarker should be used in this case. For more details see: MSDN forums[^]
Best Regards,
Sergiy
modified on Wednesday, September 16, 2009 1:32 PM
|
|
|
|
|
Most simple code to unzip folder in vb.net
|
|
|
|
|
nicetohaveyou wrote: Most simple code to unzip folder in vb.net
Why, that's phrased like a contest
You could use the DeflateStream [^] that comes with the Framework, or the GZipStream [^].
If you can use third-party libraries then you have, again, two choices;
* DotNetZip[^]
using (ZipFile zip = ZipFile.Read(sourcePath)
{
zip["myFile.dll"].Extract();
} Or;
* #ZipLib[^]
using ICSharpCode.SharpZipLib.Zip;
FastZip fz = new FastZip();
fz.ExtractZip("myFile.dll", "C:\TEMP", "");
I are Troll
|
|
|
|
|
hi forum,
My question is that is there any method to control the webcam settings such as contrast, brightness, etc. in vb.net?
|
|
|
|
|
Raj Jayaswal wrote: My question is that is there any method to control the webcam settings such as contrast, brightness, etc. in vb.net?
The simple answer is NO.
VB.Net does not has any supporting API/class for webcamera. But you can try to look at the internet, there are quite a number of open source libraries which do this.
Good Luck.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Good day,
Today i took the MCTS 70-536 exam with flying colors, but unfortunately i heard the secretary saying that she "thinks" that the Microsoft .NET certificates expire after two years.
I googled for prove but i couldn't find anything on that topic.
I'm specificly asking for the "MCTS: .NET Framework 3.5, Windows Forms Applications" certificate
Best regards, Hris
|
|
|
|
|
Not sure but even if they do it still does no harm to list them on your CV/Resume. Technically MCSDs have been superseded by MCTS but employers who value certs still also value MCSD. There's not really a distinction.
Kevin
|
|
|
|
|
Kevin McFarlane wrote: Technically MCSDs have been superseded by MCTS
No they have not.
only two letters away from being an asset
|
|
|
|
|
Please enlighten me. I thought MCTS was merely the .NET 3.5 version of .NET 2?
Kevin
|
|
|
|
|
"The Microsoft Visual Studio certifications offer you choices and simple paths to achieve your goals. These certifications—Microsoft Certified Technology Specialist (MCTS) and Microsoft Certified Professional Developer (MCPD)—are designed to validate your skills in Visual Studio 2008 and the Microsoft .NET Framework 3.5."
http://www.microsoft.com/learning/en/us/certification/cert-vstudio.aspx[^]
only two letters away from being an asset
|
|
|
|
|
So MCTS and MCPD are upgrades to MCSD and MCAD.
Kevin
|
|
|
|
|
MCTS exams are stepping stones toward MCSD, and MCPD is a higher level than MCSD. If you read through the website you will see the list of exams necessary to attain each certification and see that both MCSD and MCPD have prerequisites of MCTS exams
only two letters away from being an asset
|
|
|
|
|
It's not that they expire. As newer technologies come along, older exams get retired because they aren't as relevant.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
So they actually don't have an "Expiration date" ?
They only become obsolete because of new technologies ?
|
|
|
|
|
That's not limited to the MS certs;
I still got an old cert that says "Advanced MS-DOS". It's not that it's invalidated, but no-one uses DOS anymore. It always helps to add them to the resume, as it shows that one was already active and learning.
I are Troll
|
|
|
|
|
Correct.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Thank you all for your kind answers!
Best of luck , Hris.
|
|
|
|
|
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
<asp:CheckBox id="CheckBox1" runat="server" AutoPostBack="True" />
private void Page_Load(object sender, System.EventArgs e)
{
HttpCookie htCoockie = Request.Cookies["username"];
if(htCoockie !=null)
{
TextBox1.Text=htCoockie.Value;
}
}
private void CheckBox1_CheckedChanged(object sender, System.EventArgs e)
{
if(CheckBox1.Checked)
Response.Cookies.Add(new HttpCookie ("username",TextBox1.Text));
else
TextBox1 .Text="";
}
|
|
|
|
|
what is the problem with the code?
|
|
|
|
|
Hi friends
I am developing my windows application project in .net framework 2.0 and c#.I need to use custom buttons which have great look .I want similar buttons like we use in Windows Vista..
Can you suggest me some links to get custom buttons and menu controls.
Thanks
Shashi.
|
|
|
|
|
|
Hi
Thanks for your help..Can I have custom menus,forms,panels and other controls.
I want to give elegant look to the form so I need to use more custom controls.
Please suggest reference links.
|
|
|
|
|
You can find cool custom menus here[^].
Here[^] is a cool vista style progress bar.
There are lots of cool custom controls in CP. You can find almost anything you need here[^].
BTW: And don't forget to use Google. It's your friend!
I hope this helps!
Regards
Nuri Ismail
|
|
|
|