listbox - What do I put in "GetDlgItem()" when initializing CListbox -


hi hoping you'd me.

i have form, mainform.h, listbox(among other things). i'd add item listbox file. declared clistbox don't know use inside getdlgitem(/in here/) because don't know listbox's id. here's how initialized listbox in other cpp file call "actionlogbox":

clistbox* actionlogbox = dynamic_cast<clistbox*>(getdlgitem(/*no idea put here*/)); 

here mainform.h listbox called "actionlogbox":

#pragma once # include "stdafx.h" # include "addbase.h" # include "serial.h" #include "base_station.h"  namespace wcm {      using namespace system;     using namespace system::componentmodel;     using namespace system::collections;     using namespace system::windows::forms;     using namespace system::data;     using namespace system::drawing;      /// <summary>     /// summary mainform     /// </summary>     public ref class mainform : public system::windows::forms::form     {     public:         mainform(void)         {             initializecomponent();             //             //todo: add constructor code here             //         }      protected:         /// <summary>         /// clean resources being used.         /// </summary>         ~mainform()         {             if (components)             {                 delete components;             }         }     private: system::windows::forms::menustrip^  menustrip1;     private: system::windows::forms::toolstripmenuitem^  filemenuitem;     private: system::windows::forms::toolstripmenuitem^  expdatadirmenuitem;     private: system::windows::forms::toolstripmenuitem^  uploaddatamenuitem;     private: system::windows::forms::toolstripmenuitem^  exitmenuitem;     private: system::windows::forms::toolstripmenuitem^  editmenuitem;     private: system::windows::forms::toolstripmenuitem^  prefmenuitem;     private: system::windows::forms::toolstripmenuitem^  helpmenuitem;     private: system::windows::forms::toolstripmenuitem^  aboutmenuitem;     private: system::windows::forms::toolstrip^  toolstrip1;     private: system::windows::forms::toolstripdropdownbutton^  addbasebutton;     private: system::windows::forms::toolstripmenuitem^  scanportsmenuitem;     private: system::windows::forms::toolstripmenuitem^  addbasemenuitem;     private: system::windows::forms::toolstripdropdownbutton^  addnodesbutton;     private: system::windows::forms::toolstripmenuitem^  nodediscmenuitem;     private: system::windows::forms::toolstripmenuitem^  addnodemenuitem;     private: system::windows::forms::toolstripseparator^  toolstripseparator1;     private: system::windows::forms::toolstripbutton^  nodesinfobutton;     private: system::windows::forms::toolstripbutton^  nodesconfigbutton;     private: system::windows::forms::groupbox^  bottombox;     private: system::windows::forms::listbox^  actionlogbox;     private: system::windows::forms::listbox^  basestationbox;     private: system::windows::forms::groupbox^  sidebox;     protected:      private:         /// <summary>         /// required designer variable.         /// </summary>         system::componentmodel::container ^components;      #pragma region windows form designer generated code         /// <summary>         /// required method designer support - not modify         /// contents of method code editor.         /// </summary>         void initializecomponent(void)         {             system::componentmodel::componentresourcemanager^  resources = (gcnew system::componentmodel::componentresourcemanager(mainform::typeid));             this->menustrip1 = (gcnew system::windows::forms::menustrip());             this->filemenuitem = (gcnew system::windows::forms::toolstripmenuitem());             this->expdatadirmenuitem = (gcnew system::windows::forms::toolstripmenuitem());             this->uploaddatamenuitem = (gcnew system::windows::forms::toolstripmenuitem());             this->exitmenuitem = (gcnew system::windows::forms::toolstripmenuitem());             this->editmenuitem = (gcnew system::windows::forms::toolstripmenuitem());             this->prefmenuitem = (gcnew system::windows::forms::toolstripmenuitem());             this->helpmenuitem = (gcnew system::windows::forms::toolstripmenuitem());             this->aboutmenuitem = (gcnew system::windows::forms::toolstripmenuitem());             this->toolstrip1 = (gcnew system::windows::forms::toolstrip());             this->addbasebutton = (gcnew system::windows::forms::toolstripdropdownbutton());             this->scanportsmenuitem = (gcnew system::windows::forms::toolstripmenuitem());             this->addbasemenuitem = (gcnew system::windows::forms::toolstripmenuitem());             this->addnodesbutton = (gcnew system::windows::forms::toolstripdropdownbutton());             this->nodediscmenuitem = (gcnew system::windows::forms::toolstripmenuitem());             this->addnodemenuitem = (gcnew system::windows::forms::toolstripmenuitem());             this->toolstripseparator1 = (gcnew system::windows::forms::toolstripseparator());             this->nodesinfobutton = (gcnew system::windows::forms::toolstripbutton());             this->nodesconfigbutton = (gcnew system::windows::forms::toolstripbutton());             this->bottombox = (gcnew system::windows::forms::groupbox());             this->actionlogbox = (gcnew system::windows::forms::listbox());             this->basestationbox = (gcnew system::windows::forms::listbox());             this->sidebox = (gcnew system::windows::forms::groupbox());             this->menustrip1->suspendlayout();             this->toolstrip1->suspendlayout();             this->bottombox->suspendlayout();             this->sidebox->suspendlayout();             this->suspendlayout();             //              // menustrip1             //              this->menustrip1->items->addrange(gcnew cli::array< system::windows::forms::toolstripitem^  >(3) {                 this->filemenuitem, this->editmenuitem,                     this->helpmenuitem             });             this->menustrip1->location = system::drawing::point(0, 0);             this->menustrip1->name = l"menustrip1";             this->menustrip1->size = system::drawing::size(638, 24);             this->menustrip1->tabindex = 0;             this->menustrip1->text = l"menustrip1";             //              // filemenuitem             //              this->filemenuitem->dropdownitems->addrange(gcnew cli::array< system::windows::forms::toolstripitem^  >(3) {                 this->expdatadirmenuitem,                     this->uploaddatamenuitem, this->exitmenuitem             });             this->filemenuitem->name = l"filemenuitem";             this->filemenuitem->size = system::drawing::size(37, 20);             this->filemenuitem->text = l"file";             //              // expdatadirmenuitem             //              this->expdatadirmenuitem->name = l"expdatadirmenuitem";             this->expdatadirmenuitem->size = system::drawing::size(190, 22);             this->expdatadirmenuitem->text = l"explore data directory";             //              // uploaddatamenuitem             //              this->uploaddatamenuitem->name = l"uploaddatamenuitem";             this->uploaddatamenuitem->size = system::drawing::size(190, 22);             this->uploaddatamenuitem->text = l"upload data";             //              // exitmenuitem             //              this->exitmenuitem->name = l"exitmenuitem";             this->exitmenuitem->size = system::drawing::size(190, 22);             this->exitmenuitem->text = l"exit";             //              // editmenuitem             //              this->editmenuitem->dropdownitems->addrange(gcnew cli::array< system::windows::forms::toolstripitem^  >(1) { this->prefmenuitem });             this->editmenuitem->name = l"editmenuitem";             this->editmenuitem->size = system::drawing::size(39, 20);             this->editmenuitem->text = l"edit";             //              // prefmenuitem             //              this->prefmenuitem->name = l"prefmenuitem";             this->prefmenuitem->size = system::drawing::size(135, 22);             this->prefmenuitem->text = l"preferences";             //              // helpmenuitem             //              this->helpmenuitem->dropdownitems->addrange(gcnew cli::array< system::windows::forms::toolstripitem^  >(1) { this->aboutmenuitem });             this->helpmenuitem->name = l"helpmenuitem";             this->helpmenuitem->size = system::drawing::size(44, 20);             this->helpmenuitem->text = l"help";             //              // aboutmenuitem             //              this->aboutmenuitem->name = l"aboutmenuitem";             this->aboutmenuitem->size = system::drawing::size(107, 22);             this->aboutmenuitem->text = l"about";             //              // toolstrip1             //              this->toolstrip1->items->addrange(gcnew cli::array< system::windows::forms::toolstripitem^  >(5) {                 this->addbasebutton, this->addnodesbutton,                     this->toolstripseparator1, this->nodesinfobutton, this->nodesconfigbutton             });             this->toolstrip1->location = system::drawing::point(0, 24);             this->toolstrip1->name = l"toolstrip1";             this->toolstrip1->size = system::drawing::size(638, 25);             this->toolstrip1->tabindex = 1;             this->toolstrip1->text = l"toolstrip1";             //              // addbasebutton             //              this->addbasebutton->displaystyle = system::windows::forms::toolstripitemdisplaystyle::image;             this->addbasebutton->dropdownitems->addrange(gcnew cli::array< system::windows::forms::toolstripitem^  >(2) {                 this->scanportsmenuitem,                     this->addbasemenuitem             });             this->addbasebutton->image = (cli::safe_cast<system::drawing::image^>(resources->getobject(l"addbasebutton.image")));             this->addbasebutton->imagetransparentcolor = system::drawing::color::magenta;             this->addbasebutton->name = l"addbasebutton";             this->addbasebutton->size = system::drawing::size(29, 22);             this->addbasebutton->text = l"add base";             //              // scanportsmenuitem             //              this->scanportsmenuitem->name = l"scanportsmenuitem";             this->scanportsmenuitem->size = system::drawing::size(129, 22);             this->scanportsmenuitem->text = l"scan ports";             //              // addbasemenuitem             //              this->addbasemenuitem->name = l"addbasemenuitem";             this->addbasemenuitem->size = system::drawing::size(129, 22);             this->addbasemenuitem->text = l"add base";             this->addbasemenuitem->click += gcnew system::eventhandler(this, &mainform::addbasemenuitem_click);             //              // addnodesbutton             //              this->addnodesbutton->displaystyle = system::windows::forms::toolstripitemdisplaystyle::image;             this->addnodesbutton->dropdownitems->addrange(gcnew cli::array< system::windows::forms::toolstripitem^  >(2) {                 this->nodediscmenuitem,                     this->addnodemenuitem             });             this->addnodesbutton->image = (cli::safe_cast<system::drawing::image^>(resources->getobject(l"addnodesbutton.image")));             this->addnodesbutton->imagetransparentcolor = system::drawing::color::magenta;             this->addnodesbutton->name = l"addnodesbutton";             this->addnodesbutton->size = system::drawing::size(29, 22);             this->addnodesbutton->text = l"add nodes";             //              // nodediscmenuitem             //              this->nodediscmenuitem->name = l"nodediscmenuitem";             this->nodediscmenuitem->size = system::drawing::size(157, 22);             this->nodediscmenuitem->text = l"node discovery";             //              // addnodemenuitem             //              this->addnodemenuitem->name = l"addnodemenuitem";             this->addnodemenuitem->size = system::drawing::size(157, 22);             this->addnodemenuitem->text = l"add node";             //              // toolstripseparator1             //              this->toolstripseparator1->name = l"toolstripseparator1";             this->toolstripseparator1->size = system::drawing::size(6, 25);             //              // nodesinfobutton             //              this->nodesinfobutton->displaystyle = system::windows::forms::toolstripitemdisplaystyle::image;             this->nodesinfobutton->image = (cli::safe_cast<system::drawing::image^>(resources->getobject(l"nodesinfobutton.image")));             this->nodesinfobutton->imagetransparentcolor = system::drawing::color::magenta;             this->nodesinfobutton->name = l"nodesinfobutton";             this->nodesinfobutton->size = system::drawing::size(23, 22);             this->nodesinfobutton->text = l"load node information";             this->nodesinfobutton->tooltiptext = l"load nodes information";             //              // nodesconfigbutton             //              this->nodesconfigbutton->displaystyle = system::windows::forms::toolstripitemdisplaystyle::image;             this->nodesconfigbutton->image = (cli::safe_cast<system::drawing::image^>(resources->getobject(l"nodesconfigbutton.image")));             this->nodesconfigbutton->imagetransparentcolor = system::drawing::color::magenta;             this->nodesconfigbutton->name = l"nodesconfigbutton";             this->nodesconfigbutton->size = system::drawing::size(23, 22);             this->nodesconfigbutton->text = l"configure nodes";             //              // bottombox             //              this->bottombox->controls->add(this->actionlogbox);             this->bottombox->location = system::drawing::point(0, 281);             this->bottombox->name = l"bottombox";             this->bottombox->size = system::drawing::size(638, 119);             this->bottombox->tabindex = 3;             this->bottombox->tabstop = false;             this->bottombox->text = l"action log";             this->bottombox->enter += gcnew system::eventhandler(this, &mainform::groupbox1_enter);             //              // actionlogbox             //              this->actionlogbox->anchor = static_cast<system::windows::forms::anchorstyles>(((system::windows::forms::anchorstyles::bottom | system::windows::forms::anchorstyles::left)                 | system::windows::forms::anchorstyles::right));             this->actionlogbox->backcolor = system::drawing::systemcolors::window;             this->actionlogbox->forecolor = system::drawing::systemcolors::inactivecaptiontext;             this->actionlogbox->formattingenabled = true;             this->actionlogbox->items->addrange(gcnew cli::array< system::object^  >(1) { l"--- ready ---" });             this->actionlogbox->location = system::drawing::point(6, 17);             this->actionlogbox->name = l"actionlogbox";             this->actionlogbox->size = system::drawing::size(626, 95);             this->actionlogbox->tabindex = 0;             this->actionlogbox->selectedindexchanged += gcnew system::eventhandler(this, &mainform::actionlogbox_selectedindexchanged);             //              // basestationbox             //              this->basestationbox->backcolor = system::drawing::systemcolors::window;             this->basestationbox->forecolor = system::drawing::systemcolors::inactivecaptiontext;             this->basestationbox->formattingenabled = true;             this->basestationbox->items->addrange(gcnew cli::array< system::object^  >(1) { l"(add base station)" });             this->basestationbox->location = system::drawing::point(6, 19);             this->basestationbox->name = l"basestationbox";             this->basestationbox->size = system::drawing::size(128, 199);             this->basestationbox->tabindex = 5;             this->basestationbox->selectedindexchanged += gcnew system::eventhandler(this, &mainform::basestationbox_selectedindexchanged);             //              // sidebox             //              this->sidebox->controls->add(this->basestationbox);             this->sidebox->location = system::drawing::point(6, 52);             this->sidebox->name = l"sidebox";             this->sidebox->size = system::drawing::size(134, 225);             this->sidebox->tabindex = 6;             this->sidebox->tabstop = false;             this->sidebox->text = l"base station controller";             //              // mainform             //              this->autoscaledimensions = system::drawing::sizef(6, 13);             this->autoscalemode = system::windows::forms::autoscalemode::font;             this->clientsize = system::drawing::size(638, 400);             this->controls->add(this->sidebox);             this->controls->add(this->bottombox);             this->controls->add(this->toolstrip1);             this->controls->add(this->menustrip1);             this->mainmenustrip = this->menustrip1;             this->name = l"mainform";             this->startposition = system::windows::forms::formstartposition::centerscreen;             this->text = l"wireless controll manager";             this->load += gcnew system::eventhandler(this, &mainform::mainform_load);             this->menustrip1->resumelayout(false);             this->menustrip1->performlayout();             this->toolstrip1->resumelayout(false);             this->toolstrip1->performlayout();             this->bottombox->resumelayout(false);             this->sidebox->resumelayout(false);             this->resumelayout(false);             this->performlayout();          } #pragma endregion     private: system::void addbasemenuitem_click(system::object^  sender, system::eventargs^  e) {         addbase^ add_base = gcnew addbase();         add_base->showdialog();     } private: system::void groupbox1_enter(system::object^  sender, system::eventargs^  e) { } private: system::void mainform_load(system::object^  sender, system::eventargs^  e) { } private: system::void basestationbox_selectedindexchanged(system::object^  sender, system::eventargs^  e) { } private: system::void actionlogbox_selectedindexchanged(system::object^  sender, system::eventargs^  e) {     actionlogbox->items->add("blue") /*test*/  } }; } 


Comments