MFC using pointers to change Dlg items

Hey guys i'm working on a MFC project for school, and i have to have to be able to access a picture control and a text box using pointers from inside another .cpp file. I'm pretty sure that I did exactly what my teacher told me to do, but it is flagging the the ID's that I put in for the DLG items. I am sure that the ID's are correct, so the problem must lie somewhere else. Here is the code for the function that does the modifying.
1
2
3
4
5
6
7
8
bool Location::runEvent (Player& p, CDialog* window)
{
	visited=true;
	CEdit* txtPtr = (CEdit*)window->GetDlgItem(TEXTBOX);
	CStatic* picChange = (CStatic*)window->GetDlgItem(PICTURE);

	return true;
}

Like i said, my compiler is flagging TEXTBOX and PICTURE. Oh, and when i call this function from inside one of my handlers, i am using "this" for the CDialog* window parameter. Any help would be greatly appreciated, thanks!
Last edited on
Your ID's are usually defined in resources.h. Do they exist in there? Also is that h-file included in your c++ file?
Last edited on
Hey, all the id's were in the resource.h, but I didn't include it in my c++ file, and that was the problem. Thanks a lot!
Now I am having a similiar problem while attempting to change the .bmp picture. My compiler is flagging the id of a .bmp that I am trying to using in a static picture control. I know i am using the right id.
1
2
3
4
5
6
7
8
9
bool Location::runEvent (Player& p, CDialog* window)
{
	visited=true;
	CEdit* txtPtr = (CEdit*)window->GetDlgItem(TEXTBOX);
	CStatic* picChange = (CStatic*)window->GetDlgItem(PICTURE);
	picChange->SetBitmap(LOCATION);

	return true;
}


It is flagging "LOCATION", and i can't figure out why...
the error is, "argument of type int is incompatible with parameter of type HBITMAP"

any thoughts?
this project is due pretty soon, so if anyone has knowledge of MFC I could really use some help.
nvm, figured it out...
Topic archived. No new replies allowed.