|
Does anyone know of a way to detect what shortcut key was used to invoke a .Net Macro?
I'm trying to take different actions based on CTRL-key vs CTRL-SHIFT-key.
Thanks,
Jim
|
|
|
|
|
Hi all
I am in college , and we are not spending a lot of time on the framework
We are mostly staying on the basics of coding, structures, etc.
I wanted to pick up a solid book on the framework, 1.1 or higher
Any suggestions
Thanks
Paul
|
|
|
|
|
"Applied Microsoft .NET Framework programming" by Jeffrey Richter is a very good book that deepely covers both the framework and the CLR from a general point of view (strings, events, assemblies, GAC, Garbage collector, ..), it uses C# and IL to show some code snippet, there's nothing about windows forms, XML, ADO.NET and so on.
paco
|
|
|
|
|
Hi,
I am trying to list out the domains on the server using System.DirectoryServices. It gives domains, but list contains only one domain name. Our server has more that 3 domains and subdomains.
The code which i am using is as follows:
<br />
private StringCollection GetDomainList() <br />
{ <br />
StringCollection domainList = new StringCollection(); <br />
try <br />
{ <br />
DirectoryEntry en = new DirectoryEntry("WinNT://"); <br />
DirectorySearcher srch = new DirectorySearcher("objectCategory=Domain"); <br />
SearchResultCollection coll = srch.FindAll(); <br />
foreach (SearchResult rs in coll) <br />
{ <br />
ResultPropertyCollection resultPropColl = rs.Properties; <br />
foreach( object domainName in resultPropColl["name"]) <br />
{ <br />
domainList.Add(domainName.ToString()); <br />
} <br />
} <br />
} <br />
catch (Exception ex) <br />
{ <br />
Trace.Write(ex.Message); <br />
} <br />
return domainList; <br />
} <br />
Is it the correct way to list the domains? It is giving only the domain name in which i am a user and i log in with this user. This domain has subdomains and also along with this other domains are also there.
Can you please help out?
Thanx
Iftach
|
|
|
|
|
Imagine the following scenario:
A shared member variable "TheResult " is null .
A worker thread sets this variable with the result of its computation (and terminates).
Another frequently running thread checks for this variable beeing null or not. If it is not null , it assumes the worker thread has assigned a valid object to it and uses it.
Do I need to monitor the access to that variable, i.e. use lock in C#? Or in ohter words, can the assignment "TheResult = TempResult " be preempted, so that "TheResult" is neither null nor a valid object reference? Is the assignment of an object an atomic instruction that cannot be interrupted?
Thank for any hints.
|
|
|
|
|
Assigning a reference is atomic, AFAIK. But I think you need to declare "TheResult" volatile, as you are modifying its value from a different thread while frequently checking it for null value. If it is not volatile, there is a chance that checking thread reads null even *after* the worker thread sets it to the correct value.
Regards
Senthil
My Blog
|
|
|
|
|
Thanks Senthil,
I would have missed "volatile " without your hint (although missing the result wouldn't have been a big problem in my context). I probably will have to use Interlocked.Exchange , just to be sure it is atomic, because I don't find a guarantee.
Gerhard
|
|
|
|
|
If moving a 32 bit value is atomic, then setting a reference is. I think it should be atomic in x86 processors, as it can written as a single
mov ax, val
assembly instruction. And processor instructions are atomic, AFAIK.
Regards
Senthil
My Blog
|
|
|
|
|
In Windows Forms the ListBox class has a GetItemText method, but lacks a GetItemValue method. How to retrieve the associated value of any specified item? There is a SelectedValue property. That does not work for me because I need to get the value for any item without changing the selection of the listbox.
Actually I was using the checkedListBox class. At a certain point in the program I want to get the associated values for the items the user put a check mark on.
Thanks for your help
|
|
|
|
|
Hi everybody,
When I put a DataGrid control at the MDI parent window(VS.NET), I can use form.show() to display the Child window (after I call the show function, there is nothing at the MDI client area).
Does anybody know how to solve the problem. I really want to keep the datagrid control at the parent window, and meanwhile let the Child window show out.
Please help me!!!
Thank for any help in advance!
Alan Shen
Alan Shen
MCAD for .NET Version
^~^~^~^~^~^~^~^~^~^~^
Great idea is the beginging of success!
|
|
|
|
|
i am unable to remove assemblies from GAC even after Uninstallation and when i try to installer newer version of dll ,it doesnt reflect changes
how could i resolve this?
-adnan
|
|
|
|
|
Hello,
this might be a stupid question, but i haven't found an answer on either this forum or the MS knowledge base, so here is my problem:
On a PocketPC 2003 and using the Compact Framework, I want to create a copy from an image (an embedded resource 24bpp png), modify that copy and use it in subsequent redraws of a control (a class deriving from Forms.Control and overriding OnPaint ).
For this I use the copy-contructor of the Bitmap class (dstImage is a member of the control):
dstImg = new Bitmap(srcImage);
This seems to be a valid copy of the source image, dstImage.GetPixel returns color values identical to srcImage.GetPixel throughout, and the Width and Height properties show the expected image size. However, when I render that image to the control with
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.DrawImage(dstImg, 0, 0);
e.Graphics.DrawImage(srcImage, dstImage.Width + 1, 0);
}
then the image is only about a quarter in size of what it should be. It is not truncated (and small enough to fit in the control entirely), but scaled down. Using srcImage in the above code does not exhibit this unwanted scaling. Please note that there is code ensuring that dstImage is only attempted to be drawn when its production is finished (omitted for brevity).
I've also tried to use different means of contructing dstImg , like
dstImg = new Bitmap(srcImage.Width, srcImage.Height, PixelFormat.Format24bppRgb);
Graphics g = Graphics.FromImage(dstImg);
Rectangle r = new Rectangle(0, 0, srcImage.Width, srcImage.Height);
g.DrawImage(srcImage, r, r, GraphicsUnit.Pixel);
g.Dispose();
A final note: this problem is specific to the compact framework. If I paste the above snippets in a 'full' framework app and run it, both original and copy show correctly. I suspect this behaviour might result from some mismatch of the DPI settings, however you can't seem to access these members (HorizontalResolution and VerticalResolution ) in the CF? What am I missing/doing wrong?
Any help and subtle pointers to possible stupidity on my part would be appreciated,
Georg
|
|
|
|
|
I hear about we can run .Net on Win98 but I just worry about the performance.
And Howabout Run .Net on Win95?
Because I have a hundred of client PCs (Pentium100, Ram32) and I love .NET, I don't want to build vb6 application for this new project.
wait for suggestion...
Thank you.
Regards,
------------------------------
Mr.Wigrom Sakonlapahb
.NET Application Developer
------------------------------
|
|
|
|
|
|
I am new to using Hooks, and am trying to write a process that will run through all processes that are running on a particular computer and for each one determine if there is a visible window and if that window has the focus. I am pretty sure that I will need to use a "Hook" to do this, however I have no clue where to begin. Does anyone have any suggestions as to where to start/what methods will be useful in determining this? Also, will this be possible using the Process class?
|
|
|
|
|
Jeffrey Richter wrote a program to enumerate running processes and return information on them in his book, "Programming Applications for Microsoft Windows". The application was called ProcessExplorer, and was written for Windows 2000 (pre-.NET). You could use the same methods and do it all with Platform Invoke.
|
|
|
|
|
Hell!
I'm a student of computer who liked C,C++ very much so,in order to preogram under windows selected MFC C++,however not long after I got more familier with VC++ 6, I heard news about .NET.
I started looking at it's best languages including C# and Managed C++.
But Most of them disapointed me! I belive most of them are more like "Borland Delphi" to C++.
I wanted to ask code project programmers following questions: will all others move to .Net? Will "MFC like" programming die? Is Microsoft going to lose her C++ programmers?
I know it's too late to ask these questions:zzz: but it's late because I was trying to learn at least one PL from .Net and now I see it's not a lovely work!
Hamed
|
|
|
|
|
Hamed Mosavi wrote:
I belive most of them are more like "Borland Delphi" to C++.
That's not surprising - Microsoft hired the guy that created Delphi to create C#
Hamed Mosavi wrote:
will all others move to .Net?
Not all, no. Althought I think that many people will still make the move.
Hamed Mosavi wrote:
Will "MFC like" programming die?
I don't understand what "MFC like" programming is. MFC (Microsoft Foundation Classes) is a framework that sits on C++ that allows you to create various types of applications. The .NET Framework is similar but it is used by managed languages, such as C#, VB.NET or Managed C++, that allows you to build various types of applications.
Hamed Mosavi wrote:
Is Microsoft going to lose her C++ programmers?
No. There are many things that cannot be written in a managed language. There are many applications that have been evolving for years in C++ that won't be re-written for C# as C# has various interop abilities in order to allow legacy applications to integrate.
Hamed Mosavi wrote:
I was trying to learn at least one PL from .Net and now I see it's not a lovely work!
It depends on your point of view. I switched in 2001 to .NET and I love it. I love the ease that I can create applications. I love that it allows me to integrate with older software. I love the fact that writing code that queries databases is so much easier that it was.
Cada uno es artifice de su ventura
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums
|
|
|
|
|
I totally agree. For all its problems, .NET shines because of the BCL. It simply lets users program at a higher level. It's been very well designed too. The number of times I've expected a method to be in a certain class, only to find it precisely there with the same name, it's really stunning.
Regards
Senthil
My Blog
|
|
|
|
|
Hi,
Thanks alot for your answers.
I think my weak English once again made some problems,Sorry!;P
When I say "MFC Like!!" I mean : when I want to write a new app, I go towards New MFC Project, Select the type (Single Doc,...) and have a template to work on.
one more thing: You mentioned that you moved to .Net because it's easier. "I love the ease that I can create applications"
Could you tell me please how is it easier when there is not any editor for creating dialogs, any single doc or multiple doc template, however I found "form creator template".
Finally if you want the fact, the reason that I didn't move to Delphi when I started learning a Visual Language was that I hated Delphi, and that was one of the best reasons I selected VC++! Now!!
once again I appreciate you for your acswers and excuse me if my english is very bad!
|
|
|
|
|
Hamed Mosavi wrote:
Could you tell me please how is it easier when there is not any editor for creating dialogs
There is an excellent editor for creating dialogs, they are called Forms now. You can have it act as a dialog by using ShowDialog() instead of Show() when you are ready to display it to the user.
Hamed Mosavi wrote:
any single doc or multiple doc template
.NET doesn't have this structure, however there is nothing to stop you from building it. You can create your own set of control classes that can operate like the old View classes and you can create your own document class to hold the data. However, you do have to do a little more work. But, since moving to .NET I've never found that I missed the old Document/View structure at all. In fact, I've found that the new flexibility that .NET offers to be much better as it doesn't constrain you into one way of thinking.
Hamed Mosavi wrote:
the reason that I didn't move to Delphi when I started learning a Visual Language was that I hated Delphi
That's fine. I don't like Delphi either.
Hamed Mosavi wrote:
and that was one of the best reasons I selected VC++! Now!!
I'm not sure what the "Now!!" means at the end of that statement.
Hamed Mosavi wrote:
excuse me if my english is very bad
Your English is actually quite good - I've seen worse written by people who are supposed to have English as a first language.
Cada uno es artifice de su ventura
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums
|
|
|
|
|
Hi Mr. Colin Angus Mackay
Thank you so much , you gave me alot of very good information and ofcourse more confidence to move to .Net.It's extremely kind of you, and I can't find the appropriate world to express my thanks.
For the last question in this conversation(from my side!!;P), could you tell me please, as you seems to have lots of experiences in .Net, witch language do you prefer?
Moving to C# and starting from the start!!, or moving to Managed code (or C++/CLI).
I must thank you once again for your nice patiance(you would be like to me now!!)
Best regards, Hamed Mosavi
|
|
|
|
|
|
Thanks alot Mr. Colin Angus Mackay
for your nice answers.
It was all very helpfull.
Best regards
|
|
|
|
|
Un belivable?
Did you know this?!!
Visual C++ has always been the best language for creating high-performance applications for Microsoft Windows and the World Wide Web.
This is from MSDN , while tring to compare programming languages!! (MSDN 2004, Programming Languages)
Is it tring to say that it's still the best one?
|
|
|
|
|