Solved

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

Posted on 2000-02-21
5
1,326 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
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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
windows 10 how make picture as desktop background 2 64
dog bark java program 15 98
wordmultiple challenge 12 136
Way to decrease size of apk file 9 72
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

825 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