Otis_69 wrote: Thankyou for uhh... notify'ing me of that Hope it helps... -Nathan --------------------------- Hmmm... what's a signature?
Nathan Blomquist
Posts
-
Making a tray icon -
Making a tray iconCheck out the
[NotifyIcon](http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformsnotifyiconclasstopic.asp)[[^](http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformsnotifyiconclasstopic.asp "New Window")]
class. -Nathan --------------------------- Hmmm... what's a signature? -
How to decide if a Point is on a curveHmmm.... I don't know how to fix that problem right off had. You will have to look through the documentation some more. I am sorry that this did not solve the problem exactly. Please post here again if you find a solution. Sorry, Nathan --------------------------- Hmmm... what's a signature?
-
How to decide if a Point is on a curveHello, The way I have seen this done was in a project I worked on in a group for school. Check out the
Region
andGraphicsPath
classes.Region
is found inSystem.Drawing
andGraphicsPath
is inSystem.Drawing.Drawing2D
. 1.DrawCurve
to screen 2. Create aGraphicsPath
and draw to it. 3. Create aRegion
from theGraphicsPath
. 4. InvokeIsVisible( somePoint )
on theRegion
. In this casesomePoint
would be your mouse point. Hope this helps, Nathan --------------------------- Hmmm... what's a signature? -
System.Security.SecurityExceptionHello, Does your test app access the file system or anything else like that? Running an app from a network share is a security risk. So .NET sandboxes the app and doesn't let it do certain things. If you try copying the application to the harddrive, does it still cause the security exception? To fix the problem of sandboxing you will need to grant the application permissions to run from the network. Hope this helps, Nathan --------------------------- Hmmm... what's a signature?
-
Is there a way to programatically determine if a binary is managed code?I know this function works with managed and unmanaged dlls. You could try it with executables though:
public bool IsManaged(string filePath) { byte[] Data = new byte[4096]; FileInfo file = new FileInfo(filePath); FileStream fin = file.OpenRead(); int read = fin.Read(Data,0,Data.Length); fin.Close(); // Verify this is a executable/dll if ((Data[1] << 8 | Data[0]) != 0x5a4d) return false; // This will get the address for the WinNT header Int32 iWinNTHdr = Data[63]<<24 | Data[62]<<16 | Data[61] << 8 | Data[60]; // Verify this is an NT address if ((Data[iWinNTHdr+3] << 24 | Data[iWinNTHdr+2] << 16 | Data[iWinNTHdr+1] << 8 | Data[iWinNTHdr]) != 0x00004550) return false; Int32 iLightningAddr = iWinNTHdr + 24 + 208; Int32 iSum=0; Int32 iTop = iLightningAddr + 8; for (int i = iLightningAddr; i < iTop; i++) iSum|=Data[i]; if (iSum == 0) return false; else return true; }
Got this from a blog entry here: http://blogs.msdn.com/adam_nathan/archive/2003/10/26/56786.aspx[^] Hope this helps, Nathan --------------------------- Hmmm... what's a signature? -
FileIOPermission also takes away UIPermission?Thanks for all your help. I will just have to deal with them having the ability to Assert to get around it. I think it will stop most people from doing anything stupid... but it won't stop true hackers. Thanks again, Nathan --------------------------- Hmmm... what's a signature?
-
FileIOPermission also takes away UIPermission?Heath Stewart wrote: If you want anyone to be able to extend your application, then you're on the right track. Create an instance of the permission(s) and call Deny on the instance. I would like others to develop plugins so that is why I wanted to deny things around the method calls into that plugin. I don't want plugins to be able to do anything evil and such to the user's computer or via the user's computer. The plugin should get all information from the program and that is it. I have found this to work around the method declaration of the abstract plugin methods.
abstract class plugin { // override this to add functionality protected abstract void OnDoSomething(); [FileIOPermission(SecurityAccess.Deny,Unrestricted=true)] public void DoSomething() { OnDoSomething(); } }
This will stop file accessing. But I found that the plugin derived from this can just do anFileIOPermission.Assert
to get around this. Maybe I am thinking too much and there is no truly safe way to do these plugins. Maybe at some point I have to trust my users... Thanks again, Nathan --------------------------- Hmmm... what's a signature? -
FileIOPermission also takes away UIPermission?Is there and easy way to deny access to all files, but still allow UI to be presented to the user? Basically I am helping to develop a plugin architecture and we need to disable file access and possibly even socket access. So I was looking for something along the lines of:
// psuedo code filePerm.DenyAllAccess(); sockPerm.DenyAllAccess(); myPlugin.DoSomethingClever(); sockPerm.RevertDeny(); filePerm.RevertDeny(); `Thanks, Nathan --------------------------- Hmmm... what's a signature?`
-
FileIOPermission also takes away UIPermission?I was trying to limit some permissions on what certain methods can and cannot access. I wanted to disallow certain methods from accessing files. I found the
FileIOPermissionAttribute
, this seemed exactly what I wanted. But alas, if I use this attribute I cannot call showdialog on a form object.[FileIOPermission(SecurityAction.PermitOnly)] private void button1_Click(object sender, System.EventArgs e) { Form2 fm = new Form2(); fm.ShowDialog(); }
The exception text: An unhandled exception of type 'System.Security.SecurityException' occurred in mscorlib.dll Additional information: Request for the permission of type System.Security.Permissions.UIPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed. Can anyone explain why a UIPermission exception is thrown? -Nathan --------------------------- Hmmm... what's a signature? -
Messageboxes in managed C++leppie, I think his problem is not with strings. Instead it is that the preprocessor sees that MessageBox is defined as either MessageBoxA or MessageBoxU depending on build enviroment. The solution should be something like:
... // this undefines the MessageBox macro #undef MessageBox // This should now work MessageBox::Show(S"Some text",S"Some text 2"); ...
Or maybe I am just on crack or something... Feel free to flame me... -Nathan --------------------------- Hmmm... what's a signature? -
More limited than internal?Sorry about the harsh post... I was in a bad mood yesterday. Also, my first post was a little more (shall I say) abstract than I wanted it to be. -Nathan --------------------------- Hmmm... what's a signature?
-
More limited than internal?Did you completely ignore my post before? Why not make TransactionManager a private class inside Control? Then you can just make Control public and expose only the methods you want to expose. I don't mean to sound harsh.... maybe I am just ignorant of you situation.... --------------------------- Hmmm... what's a signature?
-
String questionsheesh, you beat my by two minutes.... hehe... that's what I get for reading down the page first :) --------------------------- Hmmm... what's a signature?
-
String questionMike Ellison wrote: What is the technical difference between defining a string this way: string s = "this is my string"; and this way? string s = @"this is my string"; Well the first would try to escape certain characters followed by a slash string s = "this is a line \n with a newline embedded"; string s = @"this is a line \n with a slash n embedded"; The @ sign tells the compiler "this is a literal string, don't escape the characters after the slash". Hope this helps, Nathan --------------------------- Hmmm... what's a signature?
-
More limited than internal?You could write a proxy class that sits in between your other classes and your "internal" class. This class would use your "internal" class and only expose those methods you want. -Nathan --------------------------- Hmmm... what's a signature?
-
Problem whit loops :xWhat the compiler is saying, is that "not all code paths return a value". This is because you don't return anything outside the foreach loop. The problem lies in the fact that it is theoritically possible that the queryCollection is empty. If it is empty you bypass the loop and go directly to the end of the method. Return something after the loop and the problem will go away. Also, are you sure you only want to execute the loop once? I mean right when you enter the foreach for the first time you will be exiting the method also. -Nathan --------------------------- Hmmm... what's a signature?
-
STL stringyou could try:
string numText; char data[20]; int a = 100; sprintf(data,"Num is %d",a); numText = string(data); // this copies the char array into the string
-Nathan --------------------------- Hmmm... what's a signature? -
string manipulation for phone numbersCheck out the
String.Insert()
method.... --------------------------- Hmmm... what's a signature? -
C# Windows application and data storeyeah, that is a down side... :( But with the app I am working on, it is a small thing compared to the rest (DirectX 9, MSDE, Framework 1.1)... so hell why not :) --------------------------- Hmmm... what's a signature?