Solved

How to get rid of the #32770 Dialog class name ?

Posted on 2000-02-21
5
1,285 Views
Last Modified: 2013-11-20
Codebits :

in CWinApp::Initinstance :

WNDCLASS wndcls;      
      ZeroMemory(&wndcls, sizeof(WNDCLASS));
      wndcls.style                  =  CS_HREDRAW | CS_VREDRAW;
      wndcls.lpfnWndProc          = AfxWndProc;
      wndcls.hInstance          = AfxGetInstanceHandle();
      wndcls.hIcon                  = ::LoadIcon(wndcls.hInstance, MAKEINTRESOURCE(IDR_MAINFRAME));
      wndcls.hCursor                  = ::LoadCursor(wndcls.hInstance, IDC_ARROW);
      wndcls.hbrBackground      = (HBRUSH)(COLOR_WINDOW + 1);
      wndcls.lpszMenuName            = NULL;
      wndcls.lpszClassName      = "G2Diktatie";
      
      // Register name, exit if it fails
      if (!AfxRegisterClass(&wndcls))
      {
             AfxMessageBox( _T("Failed to register window class!"),
                   MB_ICONSTOP | MB_OK );
             return FALSE;
      }

in CDialog::PrecreateWindow :

cs.lpszClass = "G2Diktatie";


This doesn't seem to work though, not for CDialog anyways.
Anyone got a better idea ?
(I think this is "hard")

NooGie
0
Comment
Question by:noogie6
  • 2
  • 2
5 Comments
 
LVL 1

Expert Comment

by:jhattingh
Comment Utility
Have you tried SetWindowLong() using the GWL_EXSTYLE ?


The SetWindowLong function changes an attribute of the specified window. The function also sets a 32-bit (long) value at the specified offset into the extra window memory of a window.

LONG SetWindowLong(
  HWND hWnd,       // handle to window
  int nIndex,      // offset of value to set
  LONG dwNewLong   // new value
);


0
 
LVL 11

Accepted Solution

by:
mikeblas earned 200 total points
Comment Utility
All dialogs in Windows have the class "#32770". That's because they're dialogs.

Remember--among the things that Windows associates with the window class is the window procedure. Windows provides the default Window procedure for _all_ dialogs, and that procedure turns around and calls your dialog proc.

That's not the way regular, user-classed windows work. But dialogs need to work that way so Windows can supply all the functionality the Dialog Manager brings.

It's a complete mystery to me why you'd want to remove the class name from your dialogs, by the way. Are you just trying to make it easy for some other application to find your dialog?

If you really need to do this, your only alternative is to create a popup window and set its styles to make it look like a dialog. But that makes your window procedure responsible for doing all the dialog things--translating arrow keys and tab order, managing the template, handling focus, and so on. It's quite a bunch of work to do it right.

..B ekiM

0
 
LVL 11

Expert Comment

by:mikeblas
Comment Utility

 jhattingh> Have you tried SetWindowLong() using the GWL_EXSTYLE ?

Why would he try that?  That changes the extended style _bits_ on the window--like WS_EX_TOPMOST or WS_EX_STATICEDGE. Your suggestion does nothing for the window class name, and the window class name is what noogie6 is asking about.

..B ekiM
0
 
LVL 1

Expert Comment

by:jhattingh
Comment Utility
Relax Mike - EE is a place where people help out. I was helping out. Doesn't mean I'm always right.
0
 
LVL 12

Expert Comment

by:migel
Comment Utility
Hmm
you must have strong reason to change dialog class.
In general you must set CLASS member in the dialog template and have already registered Window class before this dialog being created.
Also this Window class must reference to the window procedure that will call DefDlgProc by default instead DefWindowProc and have additionall Wnd bytes that is
wndclass.cbWndExtra = DLGWINDOWEXTRA.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now