[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2000-02-21
5
Medium Priority
?
1,498 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 600 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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. …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

834 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