|
Hi all,
I am writing a fairly simple VS.NET addin (my first). One of the things I need to do: add an item (or a few) to the default context menu in the editor window. My guess is that I need to manipulate some member of the Commandbars collection, but I don't know which (there are about 210) or quite how. Can anyone point me to a good resource? None of the Addin examples I looked at here did this...unless I miss it...which is always possible
Thanks in advance,
Bill
|
|
|
|
|
First, be sure to read the Automation and Extensibility Reference[^] in the Visual Studio .NET documentation if you haven't already.
Second, MSDN[^] has had many good articles in the past about extensibility in Visual Studio. You can find most of them under Extensibility Articles[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Hi !
I search some tutorials for Irda programming with the .NET Framework, i want to write some application to exchange datas with my mobile phone via Irda and my laptop
Thx in advance
Alex
|
|
|
|
|
Any replacement for VB replace function in C#? Thanks. 
|
|
|
|
|
Would you mind elaborating? There's Regex.Replace , String.Replace , and StringBuilder.Replace in the .NET BCL (base class library). I recommend searching the .NET Framework SDK documentation which should be installed on your machine (installs by default with Visual Studio .NET, as by default with the standalone .NET Framework SDK).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
You can call the Vb replace function from C#.
First, add a reference to the Microsoft Visual Basic .Net Runtime componet to your project.
Then call
Microsoft.VisualBasic.Strings.Replace("123456", "234", "789");
--
Aaron Eldreth
|
|
|
|
|
Hmmmm.... The FisherPrice strategy.
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
Colin Angus Mackay wrote:
Hmmmm.... The FisherPrice strategy.
Hey, I like their toys!
--
Aaron Eldreth
|
|
|
|
|
Aaron Eldreth wrote:
I like their toys
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
--
Aaron Eldreth
|
|
|
|
|
Does anyone know how to lock the keyboard and mouse?
I have a sensitive part in my code where I do not want the user to be able to do anything with the keyboard, not just in my application - nothing at all!
Just for a few seconds I want to lock the keyboard and mouse.
Thanks,
Haim.
|
|
|
|
|
Without using a keyboard and mouse hook, this is not possible on XP nor any Windows platform. You should not do this, either. If you want to disable input messages to be handled, set Cursor.Current to Cursors.WaitCursor . This disables input processing for the entire application. This is all you should do, accordingly to Windows programming guidelines.
If your application modifies system state, be sure to tell the user that and that they should wait. Give them a progress bar if possible, and nice friendly wait message.
Also if possible, make your operation atomic. Depending on what you do, you could use transactions to make sure the batch of operations fails or completes as a whole. If your performing database routines, all major RDBMS's support atomic operations. You can futher use transactions in ADO.NET using IDbTransaction implementations like SqlTransaction and OleDbTransaction , etc.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Second, I did found a way to lock the keyboard and mouse on XP (and actually every platform) which is very much supported by microsoft.
Here is the link to the msdn help page:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference/KeyboardInputFunctions/BlockInput.asp[^]
(or you can just look for "BlockInput" function - BOOL BlockInput(BOOL fBlockIt); - this is the win32 version of the function, the win16 version is "lockInput").
Note that I am only using it as part of my company need to make some actions on the user computer without the user intervention, when using a 3rd party application which I have no other control of except using the SendKey function to the other application window. During this time I don't want the user to accidently do some damage. This is highly rare and we are trying to avoid this situation at all cost but ironicly, sometimes this is the best way to actually raise the service quality we give to the users (and yes, we display a progress bar and a message).
Thanks again,
Haim.
|
|
|
|
|
I want to retirieve the password and name of the user who has currently logged in into the system. If possible also let me know how to retieve user details and password of the user who has currently logged into the Portal Server 2003. I am trying to integrate an application which login with the information user has provided to login in to the sharepoint serve.
Thanks in advance
|
|
|
|
|
You can't retrieve the password, unless a network administrator has stupidly enabled plain-text passwords, and that's only for support very old legacy systems. If you could retrieve the password, what's stopping a cracker?
You can retrieve the username but how you do that depends on the context. In ASP.NET if user impersonation and Windows authentication is enabled, you can use the User property you'll find on the Page class and on other classes. This retrieves the IPrincipal , from which you can get an IIdentity that defines the Name property.
Using SharePoint, this would work because SharePoint defaults to NTLM authentication (IIRC, that's all it supports). You shouldn't have to re-authenticate the user, either, so long as the authentication request is to the same domain or forest in an Active Directory network (depending on the network setup).
If you use Kerberos authentication, this authentication should be transparent as well within the same network or forest, depending on the trust model implemented.
It's best you talk to your network administrator to figure out what's possible on your network.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Can i retrieve the login details from a sharepoint portal server?
|
|
|
|
|
Same way I mentioned before. Read about the Page.User property. If you need help specific to SharePoint, I suggest you try a search for "SharePoint" on google[^]. There's many sites full of helpful information. Your problem is not specific to C#.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Thankyou, with ur help i am able to get the details of the user who has logged-in into the portal server. I have another problem. I have a webpart and depending on the user who has logged in, i need to display a webpage. I am unable to do it, any suggestion?
|
|
|
|
|
When I initially started .Net Forms I was gladdened by the provision of the Dock property and used it everywhere in resizable forms. It saved all the layout functionality that used to have be written in the Resize event from VB. However there were occasions when I would have to Dock a Panel in the form with a padding and then dock other controls inside that to get the right look and feel.
So then you look a little closer at the .Net offerings and discover that you can avoid these extra controls by using Anchor instead.
My question is one of developer choice. Is there a preferred method out there that people are using to layout their UI's? Does anyone favour Anchor over Dock?
|
|
|
|
|
I used to prefer anchoring controls (people with a Java background might prefer docking ), but meanwhile mostly converted.
The reason was that with visual inheritance you'll get weird/incorrect results when you anchor a control to the right or lower border of the container and this container is resized in a derived form. That's why I try to use docking now wherever I can.
mav
|
|
|
|
|
You should not base your usage of Dock vs. Anchor on preference, but requirements. Dock and Anchor do two different things, but they can seem similar when you anchor opposing sides. It's the ability to anchor adjecent sides that makes the two unique. If you want a Button to always stay in the lower-right corner, you anchor it to the bottom and right sides. You can't do that with docking. All you can do is dock to the bottom, but that will also work like anchoring it to the left side in addition. What you're left with doing is using a complex hierarchy of controls like the Panel or other container controls to support this. The extra window handles to track - not to mention the extra memory for these controls - is not required.
Also, some container controls allow you to set the padding for docked child controls, but this still doesn't afford you the same level of control for anchoring. You can anchor a control 8 pixels from the left edge of a parent control and 16 pixels from the top, and it will stay there (for example, depending on the anchored sides). With docking, that is much more difficult.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Hi All,
i've a tricky little problem with AutoScroll functionality that i can't seem to overcome. I have a panel with its autoscroll property set to true. On the panel i have several combo boxes which are surrounded by some graphics implemented with GDI+. My problem is as follows .. say a combo box at the bottom of the panel has focus, when i click on the panel i want it to gain focus but not refresh and redraw itself at its initial position i.e. (0,0). In other words when the panel gets focus i still want to be able to view the combo box at the bottom of the panel which had previously been the active control.
Is there any way of preventing the panel from redrawing itself at its initial (0,0) position???
Or is it possible to calculate the autoscroll position prior to giving the panel focus then explicitly setting the autoscroll position to the desired position.
Any ideas and suggestions are very welcome and appreciated!
Thanks,
Paul Griffin
|
|
|
|
|
Simple math and the ScrollableControl.AutoScrollPosition (inheritted by derivative classes like Panel ). Just be sure to read the .NET Framework SDK documentation about when to use client- and screen-based coordinates (which can be easily converted using methods like Control.PointToClient and Control.PointToScreen ).
If you have a ComboBox that is partly hidden and want to make sure that it's completely visible without scrolling it to the client point 0,0 for its container, find out how much is hidden and offset the current AutoScrollPosition by that amount:
int offset = comboBox1.Bottom - this.Height;
Point p = this.AutoScrollPosition;
p.X -= offset;
this.AutoScrollPosition = p; This is only an example, but hopefully gives you some idea. Also, do not simple set AutoScrollPosition.X to something. A Point is a value type - not a reference type - and needs to be copied first before being modified. If you set AutoScrollPosition.X to some offset, you'll notice no change because a copy was made but never assigned to AutoScrollPosition again.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Hi Heath,
thanks for your response! Your suggestion is actually the way i had approached the problem. In the MouseDown event handler for my panel i create a vertical offset from the MouseEventArgs e.Y. as follows:
int offset = e.Y ;<br />
this.myPanel.Focus();<br />
<br />
Point p = this.myPanel.AutoScrollPosition;<br />
p.Y = offset;<br />
this.myPanel.AutoScrollPosition = p;
When i debug the code i see that p does get initialised to the correct value but the assignment to AutoScrollPosition never works. AutoScrollPosition always remains (0,0)???
Any ideas as to what is happening here??
Thanks again!
Paul Griffin
|
|
|
|
|
Your offset isn't an offset at all. You need to off-set the current Point (the AutoScrollPosition ) by a certain amount like I did in my example. What you're doing now would make the Location of your control scroll to the top which would be 0,0 (the position within the container control).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|