|
That might be it.. I am actually doing this inside a WindowHook, after handling a hooktype of CBT_CREATEWND. I think that may mean that its before a WM_CREATE message has been posted for that window and thus the hWnd is not valid yet. Could that be it?
And that implies I am doing this too soon, and should be handing a different type of windows hook, that of WH_CALLWNDPROC.
Does that sound right?
|
|
|
|
|
DllImport("user32", CharSet=CharSet.Auto)]
public static extern int SetWindowLong (IntPtr hWnd, int nIndex, int dwNewLong);
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
I don't understand. The docs define it as taking a long as the 3rd parameter and returning a long, not ints in those cases. I must be missing something here?
|
|
|
|
|
MFC LONG is defined as a 32-bit integer, not a 64-bit integer as in the case of .NET long
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
Hi,
I thought I saw an article on an implementation of an XP sytle App Crash Report util. That allows your app users to send in a report of a crash.
Anyone know if an article exsist like this.. I can't find it.
Thanks@
Amber Star
|
|
|
|
|
amberstar wrote:
Anyone know if an article exsist like this.. I can't find it.
SOrry I dont know of one, but have a look at Application.ThreadException. You can dig around in Reflector.NET as well, he uses such a system. Unfortunately no source. But that is what he uses.
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
leppie wrote:
he uses such a system. Unfortunately no source. But that is what he uses.
Who is "he"?
Nick Parker
The only man who never makes a mistake is the man who never does anything. - Theodore Roosevelt
|
|
|
|
|
Nick Parker wrote:
Who is "he"?
Lutz Roeder: http://www.aisto.com/roeder/dotnet/[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
|
David Stone wrote:
I update whenever he comes out with a new version.
In other words every week?
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
Hi everyone,I'm a newbie of C# and I want to ask the meaning of the line in a sample code.
Here is the code,
namespace HashExample {
// A library contains a list of books.
class Library {
public Hashtable bookList;
public Library() {
bookList = new Hashtable();
}
}
// Books are placed in the library
class Book {
public Book( string t, int n) {
Title = t; ISBN = n;
}
public string Title;
public int ISBN;
}
class ClassMain {
static void Main(string[] args) {
Book b1 = new Book("Programming Microsoft Windows with C#", 0735613702 );
Book b2 = new Book("Inside C#", 0735612889 );
Library myReferences = new Library();
myReferences.bookList.Add(b1.ISBN, b1);
myReferences.bookList.Add(b2.ISBN, b2);
Book b = (Book) myReferences.bookList[0735612889];
Console.WriteLine( b.Title );
Console.WriteLine("\nPress Enter to quit");
Console.ReadLine();
}
}
}
I understood the hash tables.However this line doesn't make any sense on me
Book b = (Book) myReferences.bookList[0735612889];
What is the function of "(Book)" here?What does this mean?
Kind Regards,
-
kromozom
-
|
|
|
|
|
kromozom wrote:
What is the function of "(Book)" here?
Every Book is an Object, since by design in .NET all classes derive explicitly or implicitly from the Object class.
But not every Object is a Book, hence the need to cast.
That said, casting is mostly unsafe, and may produce an exception at run-time.
The best way to avoid casting is to either derive a specialization of HashTable (like the specialized string arrays derive from ArrayList), or use generics when it's supported (.NET 2.0 release).
|
|
|
|
|
Thanks for kind and fast reply .S.Rod.
I understood some parts of you have written in your reply. However there are some uncertain parts in my mind, could you give me more explanation about this or a web adress that I can find info about this.
I mean why --> Book b = (Book) myReferences.bookList[0735612889];
and what's wrong with this --> Book b = myReferences.bookList[0735612889];
Thanks again,
-
kromozom@msn.com for MSN messenger
-
|
|
|
|
|
When retrieving a value from a Hashtable you are given a System.Object as the return type, so it always needs to be cast to the Object type you need. A Hashtable works by boxing your values when added, and it's up to you to un-box them when retreiving them.
In your case you need to cast it to a Book object, however if it were string values in your Hashtable you would need to cast it to a System.String object, if it were double values you would need to cast it to double, and so on and so forth..
|
|
|
|
|
Thanks a lot Furty.
I understood this is because un-boxing and .Net wants to know which type we want to un-box it.
Thanks again.
-
kromozom
-
|
|
|
|
|
is it possible to get a "text" in a listbox from a mouse point.. im trying to make it so when the user hovers the mouse over a item in the list box that item becomes selected. Is it possible to do this ?
Thanks Alot.
Jesse M
The Code Project Is Your Friend...
|
|
|
|
|
jtmtv18 wrote:
is it possible to get a "text" in a listbox from a mouse point.. im trying to make it so when the user hovers the mouse over a item in the list box that item becomes selected. Is it possible to do this ?
public class ListBoxEx : ListBox
{
protected override void OnMouseHover(EventArgs e)
{
SelectedIndex = IndexFromPoint(PointToClient(MousePosition));
base.OnMouseHover(e);
}
}
That should do it
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
thanks alot leppy... i needed to do a lil work to get it to work...but the direction you gave was Dead On...thanks alot.
Jesse M
The Code Project Is Your Friend...
|
|
|
|
|
Hi, all!
Would you like to help me, plz?
Have the folow:
I want to create COM+ component with help c#, so, it will use the external(usual) dll-file(my.dll), where contents some logic (com-objects).
This dll good work in usual application, when add it as reference - all ok.
(a have not source for this dll file)
But when i try to link up it in my developed com+ app., - got folow answer from compiler:
"Assembly generation failed -- Referenced assembly 'name of my.dll' does not have a strong name"
is it have not 'strong name'????
i try the next:
al /out:my.dll "?" /keyfile:my_dll.snk
but it don't want to work... i do not understand want is this "?"
and is it right way to solve this problem? and what i must do in this case?
in any case thx.
|
|
|
|
|
Can someone point me in the right direction in creating translucent MenuItems?
I'd rather not get into a debate about why its not advisable, suffice it to say I have a unique tool that really would benefit from it.
I have tried creating a class that derives from MenuItem and overriding OnDrawItem, and then using the Handle to call several Win32 functions that set the window layered property and alpha, but it doesn't seem to work.
I admit I'm a bit lost because I'm not very familiar with Windows Forms.
Thanks so much,
Mattingly
|
|
|
|
|
Ok, I have created a form with nothing on it but a tab page with a single tab, that is marked to anchor to all sides ("top/left/right/bottom"). I then run the app, and size it back and forth, noticing a huge amount of flicker on the label for the single tab page. Additionally, anything I put on the tab page that sizes with it (ie, a Web browser control, a Rich edit box, etc) all flicker terribly as well when sizing.
I've seen other apps that manage to size tab controls without excessive flicker, what do I need to do to eliminate this flicker under C#/.net?
Thanks,
Saren
|
|
|
|
|
SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
in your contructor mite help, also try not to invalidate the form too much.
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
I've tried that and it doesn't seem to make any difference. How would I avoid invalidating the form? Thus far this is just a single control on a form without any additional code.
|
|
|
|
|
I would appreciate to let me know how I can pause the application run for some time (For example 1 second).
Regards,
Sassan Komeili Zadeh
|
|
|
|