none
Why Messagebox class have fixed LpClassName? RRS feed

  • Question

  • Hi All,

    I am using Platform Invoke services of .Net Framework.

    I found that Messagebox class have fixed LpClassName(i.e. #32770) but, if we make normal windows form and we check LpClassName we get something like  "WindowsForms10.Window.8.app.0.bf7d44". and every time we build the application it will changed.

    So my quetion is Why there is diference between Messagebox class and other class?            

    Is there any specific reason for fixed LpClassName of MessageBox class?


    ENjoy ThE WorLD Of COdE


    • Edited by Nans11 Wednesday, January 9, 2013 11:33 AM
    Wednesday, January 9, 2013 11:33 AM

Answers

  • "After reading your reply, I am curious why they use win32 messagebox instead of .Net windows form?"

    Why reinvent the wheel?

    "I know that MFC classes uses win32 API, but I am not sure Which lib used by windows forms?"

    Win32 too. After all many WinForms controls are actually Win32 controls, for example TreeView and ListView.

    • Marked as answer by Nans11 Wednesday, January 9, 2013 1:26 PM
    Wednesday, January 9, 2013 1:22 PM
    Moderator

All replies

  • In Win32 programing it's normal to create the window class yourself and when doing that you have to specify a name for it. In most cases developers use fixed names for their window classes.

    In frameworks like WinForms, WPF and even native ones like MFC the window class creation is usually hidden by the framework and happens automatically. Since the developer doesn't usually get to specify a window class name the framework auto-generates one like the WindowsForms10... you have show.

    Wednesday, January 9, 2013 11:57 AM
    Moderator
  • Hi Mike Danes,

    Thanks for your nice explanation.

    I understand that in Win32 programing it requires classname and as you say developers use fixed names for their window classes,  but MessageBox class is .Net Implementation.

    So, Why they need fixed LpClassName for MessageBox class?

    I think they have some concreate reason to do so. I want to know that reason if any.

    once again I appriciate your efforts to help me.

    Thanks!

    Nans11


    ENjoy ThE WorLD Of COdE

    Wednesday, January 9, 2013 12:31 PM
  • "but MessageBox class is .Net Implementation."

    It isn't, it just PInvokes Win32's MessageBox function.

    Wednesday, January 9, 2013 12:37 PM
    Moderator
  • Hi Mike Danes,

    once again, thanks for your information.

    After reading your reply, I am curious why they use win32 messagebox instead of .Net windows form? (I think its better idea..clean and Managed)

    So many people make there own MessageBox class for there application.

    I know that MFC classes uses win32 API, but I am not sure Which lib used by windows forms?

    If you have any related document or article, Please share with me.

    Thanks!

    Nans11


    ENjoy ThE WorLD Of COdE

    Wednesday, January 9, 2013 1:20 PM
  • "After reading your reply, I am curious why they use win32 messagebox instead of .Net windows form?"

    Why reinvent the wheel?

    "I know that MFC classes uses win32 API, but I am not sure Which lib used by windows forms?"

    Win32 too. After all many WinForms controls are actually Win32 controls, for example TreeView and ListView.

    • Marked as answer by Nans11 Wednesday, January 9, 2013 1:26 PM
    Wednesday, January 9, 2013 1:22 PM
    Moderator