|
Don't worry about it. If an assembly reference is not used when the project is compiled, it is not included as an assembly dependency in the generated assembly. You could, for example, add every single assembly on your machine as an assembly reference, compile your project, and still only the assemblies that are actually used will be referenced in the assembly manifest. The same goes for imported namespaces (which is really just a language feature that makes programming easier - it doesn't matter when linking the assembly).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have been working on getting user control embedded in IE, unfortunately I have ben unsuccessful. So far I have written the control, replaced the system colors with standard colors (web colors black and silver). I have gone to the server and using the .NET wizards trusted the assembly, I have also tried using the configuration to trust the assemblies, I have signed the assemblies, and tried not signing. I have added full trust to the intranet (the control won't even load on the local machine). Here is a message I sent asking for help and the response I got (much appreciated by the way if you have any more ideas I'm all ears )
--------------
Hi, I've been trying to get my embedded user controls working for a couple days now and have not had any success. The problem I'm having is that instead of anything showing, I get the image loading icon in a recessed object. I have followed three tutorials including one from 4guysfromrolla, the .NET SDK sample, and your tutorial. I have even downloaded source of projects that definately work and have had the same results. Is there a setting on my server that I may have missed? I have included a screenshot of the results I get just to be clear on my error. I have also included the line from my logs that I recieve when someone accesses the page. Any advice you can offer would be much appreciated.
Either you haven't given that URL the necessary permissions using the Microsoft .NET Framework Configuration snap-in in the Control Panel->Administrative Tools (or use caspol.exe), or you're forgetting that system colors cannot be used by your control or any other controls within your control, and so on.
Code access permissions are important to remember. If you don't grant the necessary permissions based on the evidence (and only host evidence and the strong name evidence are gathered when embedded a control in IE), the control won't run. This is a "sandboxed" environment, remember.
The problem with system colors I've never been able to figure out, and despite my relationship with Microsoft no one there can give me a straight answer either.
--------------
Anyway, thanks in advance for anymore help that anyone can offer.
Yolan
|
|
|
|
|
The client has to trust the assembly, not the server. You must use the Microsoft .NET Framework Configuration MMC snap-in on the client machine to trust the URL of the assembly, or use caspol.exe (the command-line utility). The server doesn't need to trust the assembly - it's only hosting the control and not executing it. Assemblies need to be trusted on the machines on which they'll run.
As I mentioned in my email before, you should read Understanding .NET Code Access Security[^] for a better understanding.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I had also configured it locally to trust the dll(forgot to mention that, sorry). I used Runtime Security Policy->Machine->Code Groups->All_Code and added a new code group for my source. I used the full_trust option, but it still had no effect.
|
|
|
|
|
Yes, but which membership condition did you use? As I mentioned in my email, only host evidence and strong name evidence are supported by IEExec.exe, the runtime CLR host for Internet Explorer. Other evidence is not gathered.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I used strong name and URL. When I used strong name I used import to select the dll.
|
|
|
|
|
If you're using both membership conditions currently, only use one. I recommend the URL mebmership condition, using an asterisk (like http://www.mydomain.com/dir1/*) if your assembly depends on other assemblies located in the same directory).
Also, make sure you go through every single Color property in your entire control - not just the control itself, and make sure you're not using system colors.
Other than that, I don't know what to tell you. I've embedded many user controls this way as have other people.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi!
I am doing an innovative P2P app in C# with .NET 1.1
The Peer I'm working on has a few threads to manage the I/O.
The Peer has the port number 11 000 to listen for request.
This port is manage by code that is used as -pardon my my analogy!- a pimp for incoming requests.
When another Peer(client) connects to your Peer(server), it connects to port 11000 and ask
the pimp for a socket to pursue communication. The pimp sends back a socket number and
tell another part of the p2p app -the bookie- to create the port and wait the client.
Now, the problem is very simple
The bookie is high, and he does not creat and open the right port -he uses a ramdom one apparently!
Right now the code for the client and the server is running on the same machine.
So my question is: How can I have the bookie create the port that the pimp asked him for ????
Thank!
ps.: sorrhy for the bad analogies :they work
|
|
|
|
|
Hi,
two questions: First, is there a limitation on the textbox in terms of capacity, e.g. how much text can I put into? Second, is there a way to "add" text to a textbox without loading the complete text using the Text property? Cool would be some kind of WriteLine(string) function. Can this be done? I'd like to create something like the output-window in various IDE's, where it seems that text is added to at the end whenever certain events occur.
Thanks in advance,
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
www.emvoid.de
|
|
|
|
|
The limit for a TextBox control .NET is available memory, IIRC. The "usable" limit is machine, and user, dependent. By this, I mean when you add or remove text, that operation takes longer the more text you have in the TextBox control already and what your doing.
There is no way to get around the Text property. You can use the TextBox 's AppendText method to add to the end of the text string, but this will also cause the .NET Framework to copy the current contents of the Text property to a new string, appending the new text from AppendText , then dropping the original string. This is true for ANY modifications to the Text property of the TextBox .
If you wanted to control how much information you display in the TextBox , you'll have to write some code to remove the lines at the start of the Text property. Probably searching for the first occurance of the NewLine characters and removing the text up to and including that point in the string.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hai there,
i developed a small business application. in my application,one of a win form contain panel control. i am dynamically creating few label controls and placing into it.
Here we can say the different label controls that i placed in panel denotes different stages of a same process.
Ok we can get into my issue.I need to highlight individual process stages into different color code or some thing.apart from this these controls(denoting process) need to blink when ever i am working with that perticular form.
to be consice : in excel if we copy a cell it will get blinked and will remain until you past somewhere. here i need that blinking facility to my label controls which is dynamically added into that panel. And need to be there until i dispose the form.
any idea ?
|
|
|
|
|
You would have to create your own control to do this. You could inherit from the TextBox or Label controls and add a Timer to it that fires off an event and signals your control to change, say, the background color on each Tick event of the timer.
BTW: Excel doesn't "blink" anything when you copy, you get the marching ants box around the selection you copied.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I want to change the color of a colomn if I click on the colomnheader. I don' t know how to do this. Can someone help me please.
|
|
|
|
|
You can change the background colour of the sub-items in this column:
<br />
private void listView_ColumnClick(object sender, ColumnClickEventArgs e) {<br />
<br />
foreach(ListViewItem item in listView.Items){<br />
item.SubItems[e.Column].BackColor = newColor<br />
}<br />
<br />
}<br />
|
|
|
|
|
thank you for your reply. I tried what this code but the background of the listview take the color but not only the subitems, so the whole listview is colored, do you know maybe why??
|
|
|
|
|
What Corinna said would only apply to the background for items, obviously. If you want to color the entire column for a ListView , I suggest you take a look at the article here on CodeProject: C# List View v1.3[^]. It requires that you P/Invoke certain native APIs (like SendMessage ) and handle windows notification messages, since the ListView merely encapsulates the List-View common control (most controls in Windows Forms encapsulates Windows common controls, actually).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Often, having created some project (commercial software, shareware) developers have troubles with creation of protection of their products from hackers. So they create some protection themselves or look for ready-made tools for this purpose.
If you need to protect your software from crackers click here http://www.softcomplete.com to find more info
|
|
|
|
|
P*ss off Spammer!
There's no way your going to protect anything from a determined hacker anyway...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ban this idiot plz!
Yes, I program in VB, but only to feed my addiction to a warm place to sleep and food to eat!
Visit my Code Project blog (Mobile Audio project)[^]
|
|
|
|
|
Is it possible from C# to hide the windows taskbar?
And how do I change the DPI settings?
(I want to force 96 DPI, Small Fonts).
Thanks
Regards
Thomas
|
|
|
|
|
No, you can't hide the task bar. Start/Run "gpedit.msc" to open up the policy editor, then select User Configuration/Administrative Templates to see everything you can do to the Desktop/Start Menu/Task Bar/System/...
The settings for the video card shouldn't be messed with by your application. Changing these will affect all the users of a machine, not just one.
You would have to change these settings in the Registry first, then retart the machine for them to take effect. See HKLM\SYSTEM\CurrentControlSet\Hardware Profiles\Current for the settings.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Actually, you can using by P/Invoking the SHAppBarMessage function and sending ABM_SETSTATE . You can turn on it's auto-hide feature, which Internet Explorer does when you switch to full-screen mode (which I love for certain purposes).
I agree about the DPI, though. Changing the resolution (when necessary, like for a full-screen game or kiosk) is one thing, but the DPI is another.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath Stewart:
I am new to windows programming.
Can you show me how to use the SHAppBarMessage function via P/Invoke?
Regards
Thomas
|
|
|
|
|
You should first read about P/Invoke. See Consuming Unmanaged DLL Functions[^] in the .NET Framework SDK. Just jumping into something without understanding is never a good idea.
You can P/Invoke the SHAppBarMessage like so:
[DllImport("shell32.dll")]
[return: MarshalAs(UnmanagedType.SysUInt)]
private static extern IntPtrSHAppBarMessage(
[MarshalAs(UnmanagedType.U4)] int dwMessage,
APPBARDATA data);
[StructLayout(LayoutKind.Sequential)]
public struct APPBARDATA
{
[MarshalAs(UnmanagedType.U4)] public int size;
public IntPtr handle;
[MarshalAs(UnmanagedType.SysUInt)] public IntPtr callbackMessage;
[MarshalAs(UnmanagedType.SysUInt)] public IntPtr edge;
public RECT rc;
public IntPtr lParam;
}
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
} In order to pass the right messages, read about the SHAppBarMessage[^] API.
There is also an example on CodeProject you can take a look at. Read C# does Shell, Part 3[^].
To get the HWND for the task bar, you'll need to also P/Invoke FindWindow and search for the window class "Shell_TrayWnd". That'll give you the IntPtr to assign to the APPBARDATA.handle field.
You can find more P/Invoke signatures for common Windows APIs at http://pinvoke.net[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Can someone kindly tell me how to get the date part(dd/mm/yyyy) and also time part (hh:mm:ss) from the DateTime object in C#
I have tried but I dont get the format as I want it
Tanx
ormore
|
|
|
|