|
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!
|
|
|
|
|
No, if indeed you are a student, do your own homework. No one here is going to send you source code for anything.
The wonderful thing about the Darwin Awards is that everyone wins, especially the members of the audience.
|
|
|
|
|
ok. so I do it by myself, thank you reply.
|
|
|
|
|
You *could* try and get your money back as you clearly haven't learned anything.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
thanhkhanhcntt wrote: But I don't know how to write
That's why this[^] wonderful site was developed, just enter the kind of code you want and you email address and they do the rest!....free no less!
|
|
|
|
|
|
What is not working ? Compilation errors/warnings ? wrong values ? crash ?
Is it a typo that your first include line is commented out ?
Watched code never compiles.
|
|
|
|
|
no the code is compiling in visual studio but it got stuck i am working on this from past 2 days and ots not working that the producer is producing but consumer is not consuming and according to logic it must be random but when producer produces 10 times code get halt and no consumer work i am very new to this language if you can help then it will be appreciated....
please help
|
|
|
|