Solved

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

Posted on 2000-02-21
5
1,371 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 1

Expert Comment

by:jhattingh
ID: 2543113
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
ID: 2543356
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
ID: 2543358

 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
ID: 2543378
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
ID: 2549652
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…

705 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