|
hi all.
I have a service with multi threads and i want to debug a specified thread but not have to wait the others. I'm a new newbie. Please help me with this problem. I've spent much time with it but get no result.
Many Thanks!
|
|
|
|
|
Hi!
Are your threads executing the same piece of code or are you using different threads for different tasks?
Anyway, if you attach VS to the service process and have a breakpoint at the appropriate position, it should work. In addition, you can make breakpoints conditional, so perhaps you can tell VS to break only for a given ThreadID...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I need a function that launches a text file in the users default text editor. It would be easy enough to launch notepad, but notepad is horrid. How to I grab the executable that is used for the .txt extension. I assume this is a registry thing, and I have avoided the registry in the past.
Thanks.
*****************
"We need to apply 21st-century information technology to the health care field. We need to have our medical records put on the I.T." —GW
|
|
|
|
|
You use Process.Start and pass it the path to your txt file. It's probably going to open notepad.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi, if you pass a .txt file as the command to Process.Start() it will be opened by
whatever app is associated to the .txt extension (which could be Notepad of course).
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Both of you THANKS! and DUH on me.
Many users will have notepad, but I know the particular user I am dealing with uses textpad. I wanted it to just call whatever is associated.
Thanks again.
*****************
"We need to apply 21st-century information technology to the health care field. We need to have our medical records put on the I.T." —GW
|
|
|
|
|
I'm so new to AD it's not even funny What I'm trying to do is export all the users and there information to my application and then use that information to create accounts in another app. First question, is the directory in XP the same as Server? I ask this because if I'm righting this app in XP can I test it there (again so new to AD)? Next, I have checked for some examples of how to do this but just don't understand the LDAP connection at all. Could anyone lead me to some very VERY simple examples that would work with XP? Even some books that you would recommend is good too. Thanks so much!
|
|
|
|
|
I never worked with AD before about 2 weeks ago, and got thrown into a somewhat similar task. It is actually very easy to work with once you get the concepts down. Let me find the links to the resources I used. They were very simple, and good for a self starter, as they had some complex problems in there that can be picked up quickly. I'll modify this post once I find them
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Oh thank you so much man! I'll wait
|
|
|
|
|
I am having a hard time finding the articles. I'm still looking, but here is a couple simple code snippets. Maybe they will give you somewhere to get started.
This code will get a Full name for a user from ADS.
public static string getFullName(string sUserAndDomain)
{
string u = sUserAndDomain.Replace('\\', '/');
try
{
DirectoryEntry e = new DirectoryEntry("WinNT://" + u);
return (string)e.Properties["FullName"].Value;
}
catch (Exception)
{
return null;
}
}
But to get that you need the User & Domain name of the logged in user. Below is the code
public static string getCurrentUsernameAndDomain()
{
WindowsIdentity user = WindowsIdentity.GetCurrent();
return user.Name;
}
I normally don't like giving out code like that, and I'm sure some people frown upon it. But, it's pretty simple and maybe that will get you headed in the right direction. If I can find those articles I'll post here. Hope that gets you started!
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
I would like my form not to be "prone" for such shortcuts like win+d or win+m or any other minimize action.
When all other programs are minimized I would like my form stay visible on the desktop.
How can I do it? I've tried on other forums but noone could help me :-/
//sorry for my english but I'm not native english
regards
Y.
|
|
|
|
|
There's an onWindowStateChanged event, which fires after the window has been minimized / restored / maximized. If it gets minimized you can just restore it again imediatly.
Although your window may minimize them maximize straight away, rather than just staying where it is. Im not sure, you should check it out.
Wait... did i just imagine this event... i can't seem to find it... oh well, the location changed event catches minimizing too, use that
Oh, and your english is just fine.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
Thanks indeed.
I'm going to try this.
But it can be visible when form is "returning" from minimize state. But this may be the only way to solve this problem...
|
|
|
|
|
Infact, i've just remembered a much more reliable way of stopping your window from minimizing / maximizing / whatever. You can override the message in WndProc:
protected override void WndProc(ref Message m)
{
switch(m.Msg) {
case 0x112:
if(m.WParam == (IntPtr)0xF032 || m.WParam == (IntPtr)0xF020)
m.WParam = (IntPtr)0xF122;
break;
}
base.WndProc(ref m);
}
That should disable any such resizing of your form, whether it be by clicking, shortcuts, or magical powers, of course if you want to maxmimize the form, just take out the first part of the IF statement.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
That's it!
Thanks
//edit:
that code doesn't work with win+d. When I press win+m all windows are minimizing and my form is still on the desktop. But when I press win+d all windows hide. But when I click any window on the taskbar (eg. IE, mozilla or any) my form is visible again.
Any idea?
Maybe I should catch event of pressing win+d and restore my form again...?
//edit2:
Option in the taskbar context menu "Show Desktop" affects my form too. It's the same as pressing win + d :/
-- modified at 11:33 Tuesday 16th October, 2007
|
|
|
|
|
Same issue here. I'm trying to figure out how to prevent Win+D or "Show Desktop" from working on a specific form. In other words, I need a form that is unhidable.
|
|
|
|
|
Found it! This will disable minimization and "hiding" for a form by attaching it to the desktop (or progman, technically). Here's the code in C# (should be easy to adapt)
<br />
[DllImport("User32", SetLastError = true)]<br />
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);<br />
<br />
[DllImport("User32", SetLastError = true)]<br />
private static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);<br />
<br />
public static void AttachFormToDesktop(Form frmToAttach)<br />
{<br />
IntPtr desktopHandle = FindWindow("Progman", null);<br />
IntPtr result = SetParent(frmToAttach.Handle, desktopHandle);<br />
}<br />
One problem I've encountered so far, though, is that I can no longer set the TransparencyKey property on a form that's been attached to the desktop.
Hope this helps someone!
|
|
|
|
|
hi.
i create an application that user can save a file with .mnm extension.
now i want to when user double click on this file, my application run and show the file content.
such as a .txt file , that user double click on it, "note pad" run and show the content.
my problem is that user click on a file can not get file's path.
how can get file path ?
tanks
|
|
|
|
|
If you have set up an association with a particular file type for your application, Windows will pass the file name to it as a command line argument when a file is selected.
In the static void main(string[] args) method for your application, the file name can be referenced using args[0] .
If you need to set up the file association programmatically, there is an article here on CodeProject[^] that explains how to do it.
Paul Marfleet
|
|
|
|
|
|
Hi,
I am trying to print my Outlook contacts to a checkelistbox I am trying to get only the Fullname and the phonenumber fields. The code below pops up a message box and give s me the nubmer of the contacts I have.
try
{
Outlook.Application oApp = new Outlook.Application();
// Get the NameSpace information.
Outlook.NameSpace oNS = oApp.GetNamespace("mapi");
// Log on by using a dialog box to choose the profile.
oNS.Logon(System.Reflection.Missing.Value, System.Reflection.Missing.Value, true, true);
// Get the default Contacts folder.
Outlook.MAPIFolder oContacts = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts);
// Get the Items collection from the folder.
Outlook.Items oItems = (Outlook.Items)oContacts.Items;
// Get the first contact item in the Items collection.
//Outlook.ContactItem oCt = (Outlook.ContactItem)oItems.GetLast();
Outlook.MAPIFolder foldercontacts = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts);
Outlook.Items searchFolder = foldercontacts.Items;
int counter = 0;
foreach (Outlook.ContactItem foundContact in searchFolder)
{
counter = counter + 1;
//foundContact.FullName.ToString();
}
MessageBox.Show("You have" + counter + "contacts" );
Any help, to print the contacts to a listBox..
Thanks
|
|
|
|
|
s3rro wrote: Any help, to print the contacts to a listBox..
Maybe I don't understand what you mean. From what I think you are trying to say, can't you just do a listBox.Items.add(youritem); ?
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Hy,
I have 3 pictures in a project resource, a picturebox and a button.
I want when I press the button to change dynamic the pictures from picturebox.
Can anybody help me?
thx
|
|
|
|
|
Sure, we woyld love to help. Where are you at on the task right now? Where are you stuck at?
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
It's not a task is for my knowledge.
I want to place random image from the project resource to my picturebox.that's it
|
|
|
|