Image gallery-OpenCV

Hello everyone..
I am writing program for 3d reconstrucion from 2d images..
And I have a problem when i want to show those 2d images in a form of gallery, for example i show image no.1 and when i press "page up" key image 2 should appear, or when i press "page down" previous image appear, when i press "end" last image appear, and "home" first image appear..
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//in header file is iplimage array
IplImage *m_Input[50];

//In main prog

int v=1;
CString ff;
ff.Format ("%d",v);
const TCHAR* cstr = (LPCTSTR)ff;
ShowImage(cstr,m_Input[v]);
do{
if(GetAsyncKeyState(VK_END))
{ 
cvDestroyWindow(cstr);
v=50;
ff.Format ("%d",v);
const TCHAR* cstr = (LPCTSTR)ff;
ShowImage(cstr,m_Input[v]);
}
if(GetAsyncKeyState(VK_HOME))
{
cvDestroyWindow(cstr);
v=1;
ff.Format ("%d",v);
const TCHAR* cstr = (LPCTSTR)ff;
ShowImage(cstr,m_Input[v]);
}
if(GetAsyncKeyState(VK_PRIOR))
{
cvDestroyWindow(cstr);

if (v=50) 
{
v=1;
}
if(v<50) 
{
v++;
}
ff.Format ("%d",v);
const TCHAR* cstr = (LPCTSTR)ff;
ShowImage(cstr,m_Input[v]);
}
if(GetAsyncKeyState(VK_NEXT))
{
cvDestroyWindow(cstr);
if (v=1)
{
v=50;
}
if (v > 1) 
{
v--;
}
ff.Format ("%d",v);
const TCHAR* cstr = (LPCTSTR)ff;
ShowImage(cstr,m_Input[v]);
}
if(GetAsyncKeyState(VK_ESCAPE))
{
break;
}

}while(true);	

The problem is next: page up and page down doesn't work, when i press page up it puts variable v=2 and if i press again it is still v=2, and for page down it is similar v=11, and again v=11. Home and End works good.
And another issue is that the program displays only blank image window without the real image,
and when i press escape it breaks while loop, and then displays image of the last value of v variable. Can anyone help me, i am out of ideas...
This if (v=50) and this if (v=1) are assignments not comparisons.

You need to write if (v==50) and if (v==1)
Yes that is it..Now it works.. thank you
Only one problem left, that is blank image window. I have been reading on the net and I learned that is because i have endless loop in program so it has no time to update the images, and I found something called WM_KEYDOWN message handler. I think i can make my gallery by that method, but i am new to this and dont know how to use it, does anyone have an example of this method or something that can be helpfull. Please anyone..
Topic archived. No new replies allowed.