|
Rama Krishna wrote:
I get correct values all the time.
::Throwing Tantrum::
::Feet Stumping::
::Purple Face::
That's not fair, I just get zeros!
So, they code you use and actual get a value is the same as I showed in the last post?
Rocky Moore
|
|
|
|
|
Here is the code as it is:-
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication2
{
public class Form1 : System.Windows.Forms.Form
{
private System.ComponentModel.Container components = null;
[System.Runtime.InteropServices.DllImport("User32.dll")]
extern static IntPtr GetDesktopWindow();
public Form1()
{
InitializeComponent();
IntPtr hwnd = GetDesktopWindow();
System.Diagnostics.Debug.Assert(hwnd != IntPtr.Zero);
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.Size = new System.Drawing.Size(300,300);
this.Text = "Form1";
}
#endregion
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
}
|
|
|
|
|
That worked, must be something in the code around it that is causing the problem. At least now I can look in the right direction.
Thanks for the test! I should have thought to test it in a different project first
Rocky Moore
|
|
|
|
|
Again, Try a IsWindow(hWnd) on the return value; it can't be assumed that it returns anything consistent, including null. The docs just do not specify null is or is not an invalid value.
|
|
|
|
|
Are you calling any other unmanaged function before?
|
|
|
|
|
Rocky Moore wrote:
As you have noticed from other posts, the GetDesktopWindow() does not actually return (0).
Sorry Rocky, if I sounded insulting, but I have explained my reasons for smiling in my reply to Neil Van Note. It was the irony caused my MS that made me smile.
Hope it's okay now
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Nish [BusterBoy] wrote:
Sorry Rocky, if I sounded insulting, but I have explained my reasons for smiling in my reply to Neil Van Note. It was the irony caused my MS that made me smile.
Hope it's okay now
Wasn't taken that way, I am not a softy like others here I truly appreciate any help I get, and Lord knows I need a lot at times
I still do not know why it was returning zero but I have done a bit of rewriting all around it and it seems to be working. One of those strange things, just glad I can finally move on. Now if I can just figure a way to get rid of the 'add a new row' row in the DataGrid that is using a dataset bound to the datasource instead of a dataview, my life would be much easier..
Thanks again!
Rocky Moore
|
|
|
|
|
Nish [BusterBoy] wrote:
but I have explained my reasons for smiling in my reply to Neil Van Note
The smiles where not the reason I thought you sounded insulting. It was the fact they
are surrounding what you said, I quote...
Nish [BusterBoy] wrote:
Yeah, When he got the 0, he thought it was an error
Either way, I am dropping it...
Regards
|
|
|
|
|
Neil Van Note wrote:
Either way, I am dropping it...
Thanks
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Hi all,
I'm starting learning C# and I would apreciate very much if you, C# gurus, can tell me the name of the best books available on this topic. I do have MSDN .NET but I would like also to have some books.
TIA
|
|
|
|
|
The second edition of my Inside C# book is now out and receiving extremely complimentary reviews. There are also a few people here on the site that have personally used the book and can attest to its helpfullness.
Cheers,
Tom Archer
Author - Inside C#, Visual C++.NET Bible
|
|
|
|
|
For learning C# itself I recommend Tom's Inside C#. I've only read the 1st edition, but the 2nd edition almost doubles the page count.
Having not read the 2nd edition I don't know what it covers that was missing in 1st edition; but you'll probably want another book to cover the .NET class libraries and how to use them.
For Windows Forms, Charles Petzold's Programming Windows with C# seems to be the book for that.
James
Simplicity Rules!
|
|
|
|
|
"... you'll probably want another book to cover the .NET class libraries and how to use them."
Any book name for learning about .NET class lbraries and how to use them ?
Thank you very much,
Thomas
|
|
|
|
|
The only one I have is Charles Petzold's book, but that focuses on Windows Forms.
The second edition of Inside C# covers a bit more; but I don't see the table of contents on Amazon so I'm not sure what the new material is. Without being able to see a table of contents for the other books I can't be sure what is in them, but it look like Jeffery Richter's Applied Microsoft .NET Framework Programming.
Sorry I can't be of more help.
James
Simplicity Rules!
|
|
|
|
|
I definitely don't cover Windows Forms as that's way outside the scope of Inside C#. I do cover some .NET classes, but those that I feel most programmers would logically associate with a language (regardless of where they're actually supported in .NET). The classes in include things like file streaming, strings, reg expressions, and security.
By the way here is the table of contents.
Cheers,
Tom Archer
Author - Inside C#, Visual C++.NET Bible
|
|
|
|
|
Table of contents of Inside C#
Disclaimer : The author of the book is a friendy guy and if you ask directly to him any doubt , I sure he will be answering you.
Cheers,
Joao Vaz
Addicted C++ programmer
|
|
|
|
|
*grin* Thanks Don't know why I didn't think to go to Microsoft Press' website.
James
Simplicity Rules!
|
|
|
|
|
Don't worry man, it can happen to the best C# MVCPP (Most Value Code Project Profissional ) , don't you think ?
Cheers,
Joao Vaz
Addicted C++ programmer
|
|
|
|
|
Joao Vaz wrote:
it can happen to the best C# MVCPP
Yeah, but what about me? [By the way, thanks ]
Actually I do know the problem, its me visiting and trying to make intellectual posts when I'm dead tired. In fact, I should probably give up nowk and go to bed z z.
James
Simplicity Rules!
|
|
|
|
|
|
Your welcome , but I only said the truth (all the truth and nothing more than the truth), so you don't need to thank me .
Cheers,
Joao Vaz
Addicted C++ programmer
|
|
|
|
|
Jeff Prosise's book is for that. In fact, at MS Press we tried very hard to make sure that the entire line up (Richter, Prosise, Petzold and mine) all complimented one another with a miniumum of overlap.
Therefore:
- Jeffrey Richter - .NET programming (mainly low level with lots of internals)
- Jeff Prosise - Programming with the .NET class library
- Tom Archer - Specific to C# with a few basic .NET classes (file streaming, strings, regular expressions, security, exception handling, etc.)
- Charles Petzold - WinForms and UI
Cheers,
Tom Archer
Author - Inside C#, Visual C++.NET Bible
|
|
|
|
|
Here's the Amazon Review of the 2nd edition:
I thoroughly enjoyed the first edition, but as another reviewer stated, it was a one-time read where you could easily absorb everything in one sitting and not have much need for it again. This edition simply rocks. I don't know if it was Mr Archer learning more about the language or adding Mr Whitechapel. What I do know is that this book as some incredible content.
Where do I begin? The chapters on attributes, delegates and interfaces are excellent. Finally, someone that explains what these are, why they exist, how to use them and how they work internally! From there, my favorite chapters are the ones on file streams, strings and regular expressions and security...
Finally, the COM interop chapters are the best I've read any place. This has become *the* definitive book on C#. A definite recommended buy!
--------------------------------------------------------------------------
I advise you to buy this one , and complement with Petzold Programming Windows with C# . These 2 definitely are a great pair ...
The inside C# leads properly with the language and it's internals and some complementary .Net Framework stuff and Programming Windows leads with Windows Forms , GDI + , Graphical user interfaces ... you get the point ...
For Asp.NET , I personnally don't know any good introductory book, but if you want a intermediate/Advanced level book then definitely you should go to ASP.NET Unleashed.
Cheers,
Joao Vaz
Addicted C++ programmer
|
|
|
|
|
Joao Vaz wrote:
I advise you to buy this one , and complement with Petzold Programming Windows with C# . These 2 definitely are a great pair ...
I definitely like the idea that Amazon thinks enough of my book's potential to couple with Charles Petzold's book - especially since they work great together.
Cheers,
Tom Archer
Author - Inside C#, Visual C++.NET Bible
|
|
|
|
|
Tom Archer wrote:
Amazon thinks enough of my book's potential to couple with Charles Petzold's book
Yeah, Amazon despict some minor issues on his search engine , have some intelligent guys backing it up
Cheers,
Joao Vaz
Addicted C++ programmer
|
|
|
|