Solved

microsoft visual c++ 6.0 correct way to remove items from resources

Posted on 2009-05-20
2
437 Views
Last Modified: 2012-06-22
i would like to know the correct way to remove items from a form or a dialog.

I´ve been asigned to transform a visual 6 proyect and i wold like to know how to delete a hole group of buttons. What Ì´ve done is just hide them:
      GetDlgItem(IDC_STATIC1)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_LBL1)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_LBL8)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_LBL6)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_LBL7)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_STATIC_TURNO)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_EDIT_PLAYA)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_DTPICKER_FECHA)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_DTPICKER_HORA_DESDE)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_DTPICKER_HORA_HASTA)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_EDIT_TURNO)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_LBL3)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_COMBO_PEAJISTA)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_TIPO_VEHICULO)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_TIPO_VEHICULO2)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_COMBO_TIPO_VEHIC)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_STATIC_IMPORTE_TRANSITO)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_IMPORTE)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_GRID_LIGEROS)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_COMBO_ID_PEAJISTAS)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_LBL2)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_COMBO_VIA)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_BUTTON_GENERAR)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_STATIC2)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_GRID_RESULTADOS)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_GRID_TOTAL_RESULTADO)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_LOGO_CONCESIONARIA)->ShowWindow(SW_HIDE);

but now i cant redesign from the resource view because its full of these itmes, and if i delete them i get an error from the oninitialupdate MFC function.

0
Comment
Question by:perezthomson
[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 Comments
 
LVL 2

Expert Comment

by:Gregdo
ID: 24437145
If you want to actually delete these items, then remove any code that refers to them:

1. Delete all the GetDialogItem() function calls above and any other code that refers to the controls that you want to delete.
2. Using the resource editor, remove the controls that you no longer need.

Check that it still builds and works.

3. Clean up the Resource.h header (or other header containing all the #defines) by removing the definitions for all the controls that you deleted.  Be aware that sometimes the same #defines can be used for multiple resources, so even though you removed them from this dialog, the #define might still be needed by another.
0
 
LVL 2

Accepted Solution

by:
Gregdo earned 125 total points
ID: 24437167
I should also add that if my understanding of what you are doing is correct, the reason that you get the error in OnInitialUpdate() is that you removed the controls from the resource, but your code still refers to them.  Once you remove them from the dialog, you can no longer call GetDlgItem() as they are not there and will get errors.

If physically removing them is what you really want (not just hiding them), then the procedure above should fix the problem.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

729 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