I got a little problem that i have some code written in a function that should display some pictures on a board, and i can see the pictures only after the whole function finishes. Here it is:
(in the following code, pictures
is an array of PictureBoxes
)
void static paint_path(ArrNode* node)
{
list<int> head=(NG->game->getboard()).getcolored();
int place=-1;
while(head.size())
{
place=head.back();
head.pop_back();
if(node[place].color == white)
pictures[place]->ImageLocation = "white-.bmp"; /*THIS LINE*/
else if(node[place].color == black)
{
pictures[place]->ImageLocation = "black-.bmp"; /*AND THIS LINE*/
}
}
}
I need those 2 lines /THIS LINE/ /and THIS LINE/ to be performed in time, and not only after the function finishes. In fact, the pictures are really shown only after the function that called to a function that called to this function returns. Why is that?!
Thank you
EDIT
I progressed by including Windows.h
in stdafx.h
, and stdafx.h
in Form1
.
Now, as ScottMcP-MVP suggested, i'm trying to use UpdateWindow().
I read that UpdateWindow()
takes a variable of type HWND. So i defined the following in my function: (definition taken from another thread)
HWND hwnd = ::CreateWindowA("STATIC","dummy",WS_VISIBLE,0,0,100,100,NULL,NULL,NULL,NULL);
::SetWindowTextA(hwnd,"Window!");
and called UpdateWindow(hwnd);
But i keep getting an error:
Error 15 error LNK2028: unresolved token (0A00001D) "extern "C" int __stdcall UpdateWindow(struct HWND__ *)" (?UpdateWindow@@$$J14YGHPAUHWND__@@@Z) referenced in function "private: static void __clrcall GUI::Form1::paint_path(struct b_node *)" (?paint_path@Form1@GUI@@$$FCMXPAUb_node@@@Z) C:\...\GUI.obj
Any further help?
Thanks in advance