|
All I've ever used is Replace under the Edit menu...
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
In Visual Studio 2005 (codename "Whidbey"), they are adding refactoring. I believe there is a commercial plugin for VS.NET 2003. Just google for "refactoring" and "VS.NET" or something similar.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
hi,
I'd like to write/read the properties of file information in window.
for example, when i have choosen any file, then click the right button. i can see properties in context menu.
generally there are three tabs ( general, security, summary etc)
information of general tab can extract the FileInfo Class.
but i don't have any idea how to extract or write the summary info.
they have information of title, author, description etc.
So how could I deal with this information?
please help!!
thanks.
|
|
|
|
|
see description of StgOpenStorageEx and IPropertyStorage in MSDN
|
|
|
|
|
Hi,
I am really thank your response.
but i'm afraid i cannot find any clue in msdn although i found it.
so. could you give some examples? also i'd like to develop this fuction by c#. is it possible?
|
|
|
|
|
HRESULT FileDocProps::ReadProps(String* fileName, Guid fmtid, IList* props)
{
CStringW swFileName(fileName);
FMTID iidFmtID;
SetGUID(iidFmtID, fmtid);
CComPtr<IPropertySetStorage> spPropSetStg;
CComPtr<IPropertyStorage> spPropStg;
HRESULT hr = S_OK;
hr = StgOpenStorageEx(
swFileName,
STGM_READ | STGM_SHARE_EXCLUSIVE,
STGFMT_ANY,
0, NULL, NULL,
IID_IPropertySetStorage,
reinterpret_cast<void**>(&spPropSetStg));
if (FAILED(hr)) return hr;
hr = spPropSetStg->Open(
iidFmtID,
STGM_READ | STGM_SHARE_EXCLUSIVE,
&spPropStg);
if (FAILED(hr)) return S_OK;
CComPtr<IEnumSTATPROPSTG> spEnum;
bool isANSI = false;
short codePage = 0;
hr = GetCodePage(spPropStg, codePage, isANSI);
if (FAILED(hr)) return hr;
bool isUnicode = codePage == 0x04B0;
hr = spPropStg->Enum(&spEnum);
if (FAILED(hr)) return hr;
STATPROPSTG sps;
while (spEnum->Next(1, &sps, NULL) == S_OK)
{
PROPSPEC pss;
PROPVARIANT pvs;
pss.ulKind = PRSPEC_PROPID;
pss.propid = sps.propid;
hr = spPropStg->ReadMultiple(1, &pss, &pvs);
if (FAILED(hr)) continue;
try
{
String* name = sps.lpwstrName ? new String(sps.lpwstrName) : 0;
Object* v = PropVarToObject(pvs, codePage);
PropInfo pi((int) pss.propid, name, v);
props->Add(__box(pi));
}
catch(...)
{
}
PropVariantClear(&pvs);
CoTaskMemFree(sps.lpwstrName);
sps.lpwstrName = NULL;
}
return S_OK;
}
|
|
|
|
|
Hi
I have strange problem. I want to owner draw my menu.
So i did as written everywhen set propery of all MenuItem.OwnerDraw = true;
I have implemented the MeasureItem, and DrawItem evnets.
Something funny happen , the Top item of the menu the MeasureItem is not called, (but the DrawItem called) so the to item of the menu are draw with witdh of 12 pixels.
All other submenu are drawen normaly both MeasureItem, and DrawItem evnets are called.
Thank you for your help.
|
|
|
|
|
I couldn't make heads or tails of the problem your having and since you didn't provide any code sample to examine either...
All I can do is point you to some articles on CodeProject here[^], here[^], and here[^].
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks I have found my bug. it was the order of setting the properties and events.
But i have encountered another problem.
Is there a way to set for top level menu items diferent fonts, and it will still look good.
I have looked all the examples. None of the examples shows how to set the font of the top level menu item.
Any hints?
|
|
|
|
|
You would have to ownerdraw the MenuItems. But before you actually start drawing, you would check to see what the MenuItem's Parent object. If it actually has one, Parent would return a Menu object representing the current MenuItem's parent. If this was a top level MenuItem, Parent would return Nothing (VB.NET) or null (C#). Then it's just a matter of picking the correct font depending on if Parent returned anything or not.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Dave
I know how the check if menu item is top level.
But even if i set to all menuitem size ( in MeasureItem Method) hard coded values, in drawitem method i get value of the height as Windows Menu default height.
Here small example
public void MeasureItemMenuItem(object sender,
MeasureItemEventArgs e)
{ e.ItemWidth = 32;
e.ItemHeight = 32; // I set to hard coded value
}
public void DrawMenuItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
{
Rectangle destRect = e.Bounds;
destRect.Height; // The value for top level items
// is allways set to windows default (18)
}
|
|
|
|
|
Hi there,
I'm programming a software that will be used in a Server-Based Network using Windows 2000 Advanced Server and 2 DCs.
The software will do the following:
- In the midnight it will copy a files in another computer to this computer.
The problem is that when i try to do this manually it happens, because when my software asked for the file to be copied, windows will try to reach the file, and when he couldn't he will open a dialog with: "Connect As" to enter userid and password, if it's ok, Windows will create a ticket and will allow me to reach the file and choose it.
Now, how could i let my software do this programatically. I can reach Active Drectory, I get the user name and check if the password is ok, but still doesn't allows me to reach the file.
So, How could I reach the file which is in another PC (which means it requires a user/password login) programatically?
rami2k
|
|
|
|
|
If I understand correctly, setting the username/password on your DirectoryEntry should allow you to make the connection :
using (DirectoryEntry de = new DirectoryEntry())
{
de.Path = myLdapPath
de.AuthenticationType =
de.Username = "user";
de.Password = "Secret";
}
post.mode = postmodes.signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
Thanks MrEyes, but this didn't work!
|
|
|
|
|
Your explanation is not easy to understand at all, but here goes...
For what I can figure out, you want to write an application that copies a file from one computer to the local computer, on a set schedule. The problem your running into is that your application is getting asked for a username and password when it tries to open the source file. Correct?
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I know it's very hard to understand, but here again:
- My software will copy files from another PCs in the LAN to my PC.
- My LAN is a server-based using Windows 2000 and Active Directory
- When I'm trying to reach the file in the mid night I need a be authiruzied (i mean my software) to be able to reach the file.
I will explain now some of Active Directory Network Basics:
- When a user trys to connect to any PC, Folder, Resource in another PC in the LAN, a dialog will be showed up to enter UserID and Password, that will allow him to connect to this PC. So the server will create an authorization ticket with X minute(s) (as defined in the server), so after X minutes I need to re-provide the password and userID again to reconnect to the remote resource.
- When I want to reach to remote file programatically, This wouln't be happend, so i need to be authorized programmatically.
How could I do that???
I get to the level of reaching the Active Directory programmatically and verifing userID and password, but this has nothing to do with authorization ticket!
rami2k
|
|
|
|
|
Your ActiveDirectory environment is setup a bit differnet than mine. In mine, I don't have to supply credentials to AD to get access to another machine. We're all Domain admins and have access to any machine whenever we need it.
But, for automated processes, like yours, we created accounts in AD that belong to a group at a CN above all the machine we need the process to talk to. This group is a member of all the machines Administrators group. When I launch one of the apps on my machine, all I do is provide it the userID and Password I need it to use, then the app maps a drive to the target computer share, like \\machine\C$. For a quick a dirty solution to that problem, I just created a WScript.Network object, and used that to map the drive, supplying the entered username and password. Then the app just goes and gets the file off that drive letter and path and unmaps the drive. No messaging around with AD is required, no impersonation. Just done...
You could also P/Invoke the WNetUseConnection, WNetAddConnection2, WNetCancelConnection2 functions to accomplish the same thing.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The best way is to run your application as a Windows Service (see ServiceBase in the .NET Framework SDK). This makes sure that it runs all the time and is independent of an interactive session. You could run this as a NetworkService or another special username that has read permissions on the remote server. This is the best way to do this (believe me, I've done things like this before). Having an interactive program is not a good idea in this case.
Specifying a different user's credentials in .NET is not easy. While impersonation is possible, the .NET FCL (Framework Class Library) does not provide full functionality and forces you to P/Invoke a lot of native methods that you need to understand. Fortunately, the documentation for the WindowsIdentity.Impersonate method contains an example.
Still, though, running this program (rather, re-writing it) as a Windows Service running under a network account is a much better way since it runs entirely in the background and you can always use the SCM (ServiceControlManager ) to send simple codes, or .NET Remoting for more advanced control and monitoring.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello,
I have a windows application made in two formats in C# .net 2003. One is windows client and other is web client. Both communicate with server to get/give the data from/to server.
The windows Application is properly communicating with the server.
In normal senario the program should work in a normal way. i.e. windows client is working in folloing way, first client encrypt the data, send it to server server decrypts it, processes it, encrypt it and send it back where it is decrypted and then used.
But in web application the program communicates with server in diffrent way. It first decrypt the data, where it should have encrypted it and then come series of errors.
My Web.config file looks like below:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<client>
<wellknown
type="RemotingUtility.SecurityClientChannelSinkProvider, RemotingUtility"
url="tcp://localhost:8228/AuthenticateClass.rem"
/>
</client>
<channels>
<channel ref="tcp">
<clientProviders>
<formatter ref="binary" />
<provider type="RemotingUtility.SecurityClientChannelSinkProvider, RemotingUtility"/>
</clientProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
<system.web>
<!-- regular information -->
</system.web>
</configuration>
Can any one suggest what went wrong? Please help! I dont want to say this but, "Its really urgent". We have to complete our college project at the earliest.
Regards,
Rahul.
|
|
|
|
|
We can't really tell you much if you don't give us more information about the errors. What exception(s) are you getting? What's the exception message? Is the data encrypted or not?
Also keep in mind that ASP.NET runs with a set of permissions. Depending on the permission set that ASP.NET is run under, .NET Remoting may not be allowed.
Read Understanding .NET Code Access Security[^] for a good overriew of CAS as well as links to more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Dear Sir,
Thanks for a reply, this is my college project which needed attention desperatly.
Should I send you the complete code?
Please assist!
Rahul.
|
|
|
|
|
If it's your collage project, should you be asking for someone else do you it for you?
Aaron Eldreth
TheCollective4.com
My Articles
While much is too strange to be believed,
Nothing is too strange to have happened.
- T. Hardy
|
|
|
|
|
Dear Sir,
>>If it's your collage project, should you be asking for someone else do you it for you?
I am sorry if you interpreted it like that but its not true. I am new to remoting. More over at my place no books of remoting are availabe. Every body here is living in past vith VB/VC++ 6.0.
Rest, I assure you there is a problem which i am not able to fix. I need just help to fix it. I will make my project myself. Like i have done till date, of course i need help and guidance from experts like you.
Thanks for your concerns,
Regards,
Rahul.
|
|
|
|
|
If you're new, than either you shouldn't have chosen it for your project or you should learn it - part of the point of a project.
There are plenty of books available about .NET Remoting that are for beginning and intermediate developers, and contain concepts for advanced developers as well.
See "Microsoft .NET Remoting" from MS Press[^] and/or "Advanced .NET Remoting" from Ingo Rammer[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Dear Sir,
I have found the solution to the problem. Now, if you can please assist me to put it right.
Please assist...
it goes like this... Program is not reading web.config file. If it is specified at the click event of buttion like
RemotingConfiguration.Configure(@"C:\Inetpub\wwwroot\RemotingClient\Web.config");
the program works fine. How can i fix it?
1. The Url of the config file is not proper. I have tried all possible combinations but it is not working.
2. If second click is performed, even after restarting the page and server it gives an error that channel is already registered.
Please Assist...
Thanks for your kind help and great Example
Regards,
Rahul.
|
|
|
|
|