|
Thanks for your prompt reply!
The console application is full screen because it is being exec'd by a legacy application that must run in a full-screen console window. (This legacy system will be replaced by something being written in .NET from scratch in a year or 2, but until then I'm stuck with this as an interim solution).
I am able to switch tasks with no problems if the windows are not full-screen mode windows. I am only having problems if the console window is in full-screen mode.
I don't really want to simulate Alt-Tab. I only mentioned it because Alt-Tab has no problems switching to a full-screen window, so I know there is a way I can do it too. I just want the console application to give itself focus and maximize itself back to full-screen after the windows application has done its thing.
I will go ahead and read up on that documentation, and see if it solves my problem.
|
|
|
|
|
Is it possible to create an assembly with both C# files and MC++ files?
I have MC++ code that I need it to be private but the code uses it is in C#.
I am open to other suggestions. (ie making the MC++ assembly such that it can only be used by a specific assembly)
Thanks!
Orhun Birsoy
|
|
|
|
|
If you want your MC++ assembly to be used only by another assembly, then use a StrongNameIdentityPermissionAttribute at the assembly level. This also means you should sign your assembly, which is a good idea anyway. To generate a key pair, use:
sn.exe -k KeyFile.snk Use this key pair for all your assemblies or for assemblies for a product. For more information about the benefits of signing an assembly (to give it a strong name), see the .NET Framework SDK documentation.
Then use the file path (relative to the target directory or an absolute path) in the [assembly: AssemblyKeyFileAttribute] for your projects.
Assuming your C# project is called MyCSharpAssembly.dll with version 1.0.0.0 and a public key (you can get this by running sn.exe -Tp MyCSharpAssembly.dll , using the larger number), add an assembly-level attribute to your MC++ assembly like so:
[assembly: StrongNameIdentityPermission(
SecurityAction.RequestMinimum,
Name="MyCSharpAssembly",
Version="1.0.0.0", // Optional
PublicKeyToken="0123456789abcdef...........")] The public key token is very long. You can copy this and concatenate lines yourself. See the documentation for the StrongNameIdentityPermissionAttribute in the .NET Framework SDK for more information and a sample or two.
If MC++ can compile a .NET module (the module contains type metadata and the IL), which I don't remember off hand, you can compile a module and then add it to the C# assembly (along with the module containing the IL from the C# source files) using the csc.exe command-line compilers along with the /addmodule switch.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for the info!
I know about signing and security but couldnt find the attribute I am looking for. (StrongNameIdentityPermissionAttribute is exactly what am looking for).
But to iterate the problem, what if I want to use the MC++ assembly (or any other assembly which I want limited use) to be used by some additional assemblies? If I understood your answer I must change(recompile etc) MC++ assembly for each assembly that uses it.
...Reading MSDN....
OK i do not have to provide a Name, but still all the assemblies that uses this limited access assembly had to be signed with the same public-private key, am I correct? Although for my current problem this is perfect, this might not be the case in my future problems .
I will still investigate compiling a mixed language assembly, but I am almost sure that you can not do it with VS IDE.
Orhun Birsoy
|
|
|
|
|
If you want the MC++ assembly to be only used by your assemblies, use the StrongNameIdentityPermissionAttribute but only specify the public key that is paired with a private key you use to sign all your assemblies. This is actually done for several classes throughout the .NET Framework Class Library (.NET FCL) as well.
If you want to use the MC++ assembly with multiple assemblies, then use this approach instead of adding it as a module to other assemblies. It's a waste of size and will be a pain to maintain.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi
When I select control in Visual Studio designer,it draws specific line around a control. Can anybody tell where I can find this pen or brush, or which styles to use to create it. thanks
Salut!
|
|
|
|
|
DO you mean SystemPens class?
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
Hi I'm new to C# & .Net and the wonderful world of web services so forgive me if this is a simple and/or stupid question
The WebService we are writing needs to determine which user is using it. We are using Digest Authentication (thus handled by Windows before it hits the service) so the user/password login prompt is already taken care of. But how do we determine the user from within the code after this. I tried using,
System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString()
but this just returned NT AUTHORITY\SYSTEM which is of no real use when I know I typed in TEST1 as the username.
Any help would be gratefully received - Thanks in advance
Brian
|
|
|
|
|
You must set up impersonation in your Web.config file. See the documentation on the <identity> config section in the .NET Framework SDK.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
In you case I think windows has Authenticated your user and it is using NT AUTHORITY\SYSTEM to run your code.You have to use impersonation so that when you use that code line you will get correct user.
Second solution could be to implement IPrincipal and explicitly set user information.
Education is no substitute for intelligence. That elusive quality is defined only in part by puzzle-solving ability. It is in the creation of new puzzles reflecting what your senses report that you round out the definition. Frank Herbert
|
|
|
|
|
Hi thanks for your reply.
I seem to have found a solution by using Context.User.Identity.Name which returns the userid I was expecting of it
Thanks once again
|
|
|
|
|
is there a way to hide the email address in a multiple To: textbox. i wish to send emails to groups of people but i dont want the recipients knowing each other email addresses?
|
|
|
|
|
use BCC (Blind Carbon Copy)
not To..
(this should no be sent in the C# forum)
|
|
|
|
|
yes it took me an hour to figure it out. many thanks
|
|
|
|
|
I want to use the:
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
}
what do I add in the #region Windows Form Designer generated code
private void InitializeComponent()
{
}
Something like:
this.OnClosing += new System.Windows.......
Thanks
Thomas
|
|
|
|
|
Open the form in design mode.
Select the form and pull up the property window.
In the top of the property window you will see a lightning bolt; click it.
Now all events for the form are visible.
Locate Closing, place cursor in open box, double-click.
Your method signature and your delegate registration is done for you.
______________________________
The Tao gave birth to machine language.
Machine language gave birth to the assembler.
The assembler gave birth to ten thousand languages.
Each language has its purpose, however humble.
Each language expresses the Yin and Yang of software.
Each language has its place within the Tao.
Beauty exists because we give a name to C#.
Bad exists because we give a name to COBOL.
|
|
|
|
|
Hi,
I am beginner in .NET world. may you give the right address of such "lightning bolt" ...
I have VS.NET 2003, where can I find such thing?
Thanks
Fari
|
|
|
|
|
I am using VS.NET 2003 as well. But the directions remain the same regardless of version.
Just as I said:
Open your form and select it in the designer window.
Select the properties page.
Click the icon at the top that is a lightning bolt.
There is no address per se.
|
|
|
|
|
OnClosing is marked as virtual . The framework code calls it when the form is closing. There is nothing to monkey with in the Designer section since it will be called whether you override it or not.
|
|
|
|
|
The event is Closing and the delegate type is CancelEventHandler . Without using the VS.NET, you add a line like so:
this.Closing += new System.ComponentModel.CancelEventHandler(MyMethod);
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am developing an application that is primarily keyboard not mouse driven. Navigation is very difficult within some controls (list boxes, radio groups etc) unless the focus rectangle is visible. When an application starts the focus rectangle for a control is never visible and only becomes visible once the TAB key is pressed. After that everything works OK. In a list box I have looked at the ChangeUICues event of the control and there is a read only property ShowFocus which indicates if the focus rectangle will be displayed. Is there a way to set this to yes? Ideally what I need is if I have a form with one list box control, with say 10 items listed, that it starts with the focus rectangle around the first item without having to press TAB.
Any help greatly appreciated.
Regards
Stephen
|
|
|
|
|
I just built a simple app with a listbox in it and kept playing with what was needed to accomplish what you want. I ended up with
this.listbox1.Selected();
This put the focus rectangle inside the listbox.
______________________________
The Tao gave birth to machine language.
Machine language gave birth to the assembler.
The assembler gave birth to ten thousand languages.
Each language has its purpose, however humble.
Each language expresses the Yin and Yang of software.
Each language has its place within the Tao.
Beauty exists because we give a name to C#.
Bad exists because we give a name to COBOL.
|
|
|
|
|
Thanks for your reply.
I could not get your suggestion to work. I created a new project. Dropped a list box on the form. Created 5 items using the items collection in the IDE. Put
this.listbox1.Selected() in the load form event first and then the list box enter event. In both cases I got the items displayed with no focus rectangle until I press TAB.
Where did you put the this.listbox1.Selected() statement?
Regards
Stephen
|
|
|
|
|
It is in my Load logic. But I am using Select() not Selected()
______________________________
The Tao gave birth to machine language.
Machine language gave birth to the assembler.
The assembler gave birth to ten thousand languages.
Each language has its purpose, however humble.
Each language expresses the Yin and Yang of software.
Each language has its place within the Tao.
Beauty exists because we give a name to C#.
Bad exists because we give a name to COBOL.
|
|
|
|
|
Thanks again for your help.
I was also using Select() in my form load event.
Can you email your project? I must be doing something wrong or maybe you are using a different version of VS.Net. Are you doing this in a Windows or Web form?
Regards
Stephen
|
|
|
|