|
Hello
i love for some help with my project in C++ BUILDER
i have a previous and next button and a form for my images above with a starting image
i want when a click on the next button to show the next image
and for the previous the previous image
something like a slide show
thanks a lot it's really urgent!!
|
|
|
|
|
When is the assignment due?
|
|
|
|
|
thanks for caring
it;s a whole project but i;m stack here!
it's till friday
|
|
|
|
|
Handle the click event of the buttons and load the appropriate images. Until you post your program here we probably can't help much.
|
|
|
|
|
I did that, since i;m new in programming i'm kind of confused
i have to create a loop so that in each click it;s uploads a new image?
thanks anyway
|
|
|
|
|
The loop you mentioned is not needed. The event handlers are called only when the event happens.
You need to maintain a list for all the images, and an index marking the current image. When the event handlers are called, change the index accordingly, and call the image loading routine.
|
|
|
|
|
You know how to display an image ?
I assume you should have documentation and/or course texts to help you do that ?
depending on how you images are stored, you need an array of something (image path, bitmap data, ...), and an index that will be increased/decreased with the next/previous button and that the index will loop back when at the first/last valid value so you will not access the array out-of-bound
anyway, think a little bit about it and come back to us with specific questions.
M.
Watched code never compiles.
|
|
|
|
|
taouki wrote: i want when a click on the next button to show the next image
and for the previous the previous image
So what do you need help with: responding to a button click, or displaying an image?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
hello everyone
i think i find it finally
thanks everyone for all help !!
|
|
|
|
|
Hey everybody
I have a YES/NO dialog, which the buttons are windowless controls.
I want to click YES or NO buttons programmaticly.
Does does anyone have any idea how to do that?
btw, I don't mean sending VK_RETURN message...
Thanks a lot in advance!
p.s.
If you want to see what I mean, open a "print" dialog in your office and use spy++ to check out the controls.
You'll notice most controls don't have HWND.
Thanks again!
|
|
|
|
|
Hello,
Use SendMessage() Win32 API. This will solve your problem.
Happy Programming.
|
|
|
|
|
When you spy on a button, for instance the Print button on a print dialog, you will see a field called Window Handle. This will have a value.
But when doing it programmatically, we usually use the Control ID field.
Here is what you can do to send a click on a button -
PostMessage(WM_COMMAND, MAKELONG(ID_BUTTON, BN_CLICKED), reinterpret_cast<LPARAM>(GetDlgItem(ID_BUTTON)->m_hWnd));
I'm assuming ID_BUTTON to be the button id.
Replace that with the actual ID of the button.
I'm assuming you're using MFC.
|
|
|
|
|
Hey,
Thanks for you help!
But the thing is that the control DOES NOT have a dialog item ID.
If it had a dialog item ID, than it would have an HWND (which I could get using GetDlgItem()).
About the Spy, if you use Spy++ on the print dialog in office, you will see that the buttons (or the combobox) will not have an HWND at all (only the RichEditBoxes have HWNDs in that dialog).
|
|
|
|
|
Try if IDOK works for the OK button.
|
|
|
|
|
Doesn't work...
I'll try to expand the problem even a little bit more, what if I want to know what is written inside the button, or the combobox (in the print dialog). I am not sure it is even possible...
|
|
|
|
|
You can't do this. "Windowless" means it's not a windows control so it doesn't have a window handle so you can't use APIs to interact with it. It's been created by code within the application to look and function as a button but it's not a Windows button.
|
|
|
|
|
Hey, Thanks !
Yeah, I knew all that, but I was hoping someone will come up with a technique I didn't think of.
Currently I am using the x,y of the window OR using spy++ to see if there is another message being sent because of my click (some kind of WM_COMMAND or WM_USER+k).
Anyway, thanks again.
|
|
|
|
|
I try to embed the window of my program in the desktop.The window is under the desktop icons without covering them!
I have tried the following method.
As far as I know,the desktop consists of four sub-layers.Using spy++,I find the first three layers--1.SysListView32 2.SHELLDLL_DefView 3.Program Manager.
I tried to put my window on top of the second layer.
BOOL CTestDialogDlg::OnInitDialog()
{
CDialog::OnInitDialog();
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
HWND tmpHandle = ::FindWindow("Progman",NULL);
tmpHandle = ::GetWindow(tmpHandle,GW_CHILD);
CWnd* pWndDesktop = CWnd::FromHandle(tmpHandle);
this->SetParent(pWndDesktop);
tmpHandle = ::GetWindow(tmpHandle,GW_CHILD);
::SetWindowPos(tmpHandle, HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW|SWP_NOSIZE);
return TRUE;
}
However,this method dosen't work.Does anybody have some guidance on how to do this?
|
|
|
|
|
hi all
how can i set print area in a SDI project?
indeed i want to see specific view of my document in print preview(on any page setup).
regards
|
|
|
|
|
Hi i want to serialize a class in c++. I got main class CElementy and other subclasses like CZamow it gives error like this:
Error 2 fatal error LNK1120: 1 unresolved externals
Error 1 error LNK2019: unresolved external symbol "protected: __thiscall CZamow::CZamow(void)" (??0CZamow@@IAE@XZ) referenced in function "public: static class CObject * __stdcall CZamow::CreateObject(void)" (?CreateObject@CZamow@@SGPAVCObject@@XZ) Elementy.obj
I think it is some kind of problem with inheritance the code goes like this:
Elementy.h
class CElementy : public CObject
{
DECLARE_SERIAL(CElementy)
protected:
COLORREF m_Color;
CRect pz;
int m_Pen;
public:
virtual ~CElementy();
virtual void Draw(CDC *pDC, CElementy* pElement=0) {}
virtual void Move(CSize& aSize){}
virtual void Serialize(CArchive& ar);
CRect Prst();
protected:
CElementy(void);
};
class CZamow :
public CElementy
{
DECLARE_SERIAL(CZamow)
public:
~CZamow(void);
virtual void Draw(CDC* pDC, CElementy* pElement);
virtual void Serialize(CArchive& ar);
CZamow(CPoint Pc, CPoint Kn, COLORREF aColor);
protected:
CPoint m_PunktP;
CPoint m_PunktD;
CZamow(void);
};
Elementy.cpp
#include "stdafx.h"
#include "VSM1.h"
#include "Stale.h"
#include "Elementy.h"
#include "math.h"
IMPLEMENT_SERIAL(CElementy, CObject, VERSION_NUMBER)
IMPLEMENT_SERIAL(CZamow, CElementy, VERSION_NUMBER)
CElementy::CElementy()
{
}
CElementy::~CElementy()
{
}
...
void CElementy::Serialize(CArchive& ar)
{
CObject::Serialize(ar);
if (ar.IsStoring())
{
ar << m_Color
<< pz
<< m_Pen;
}
else
{
ar >> m_Color
>> pz
>> m_Pen;
}
}
..
CZamow::CZamow(CPoint Pc, CPoint Kn, COLORREF aColor)
{
m_PunktD = Kn;
Pc = (m_PunktD.x + 100, m_PunktD.y + 80);
m_Color = aColor;
m_Pen = 1;
pz = CRect(Kn, Kn);
pz.NormalizeRect();
}
CZamow::~CZamow(void)
{
}
..
void CZamow::Serialize(CArchive&ar)
{
CElementy::Serialize(ar);
if (ar.IsStoring())
{
ar << m_PunktP << m_PunktD;
}
else
{
ar >> m_PunktP >> m_PunktD;
}
}
|
|
|
|
|
You didn't define (i.e. implement in source file) CZamow class default constructor.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
thanks it works now strange everything worked without it :P
|
|
|
|
|
Hi
The question looks simple...
I m using splitter window with various forms in right hand view(CFormView)
In One of the Form i have created a funtion.
I need to call this function in another FormView.
I m tryin the following way
"
CForm1 Frm1;
Frm1.Functionname();"
But i get error as Cannot access protected Class
Can anyone help me...
|
|
|
|
|
Hi
actually i m tryin to insert a treecontrol values.
Thats the error now showin
|
|
|
|
|
I'm a student of a university in Viet Nam. I'm working my project which is my home word. My teacher request me write a program as Total commander. But I don't know how to write. If you know or you have it, can you share for me ?
Help me. please. thanks!
|
|
|
|