|
Yes thank you! I was playing with those in the static derived class - I need to be able to forward those messages in a similar manner and form as the BS_CLICKED message. In other words, the View handles the message in the following fashion:
ON_CONTROL(BN_UNCLICKED, ID_BUTTONx, OnButtonUnClicked)
afx_msg void OnButtonUnClicked(UINT nID)
Now if I can only find the parameters in the SendMessage function to send such a message above...
|
|
|
|
|
If the button stays "in" after it has been clicked, it sounds as though you need to look at BN_PUSHED and BN_UNPUSHED .
If that won't work, you may have to use the BS_OWNERDRAW button style and the DRAWITEMSTRUCT structure for this task.
"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 David, Thank you for replying. BN_UNPUSHED was the first thing I tried, yet I wouldn't get the notification. I suspect that notification isn't sent for static controls like it is sent for button controls.
Regards,
Paul
|
|
|
|
|
Did you set the "Notify" style on the static control?
If you vote me down, my score will only get lower
|
|
|
|
|
Hi Roger - Really appreciate your articles, I've learned quite a few things from reading them!
The static controls are created dynamically; I specify the following as the style: #define DEFAULT_STATIC_STYLE ES_CENTER|WS_BORDER|BS_NOTIFY
I do get the BN_CLICKED notifications, but not the BN_UNPUSHED notifications. Is there another flag that I need to set? I don't believe so, I suspect the CStatic control doesn't send that type of notification.
Thank you,
Paul
|
|
|
|
|
I want to convert HTML file to txt file with cut all HTML tags.
It look like Save as (*.txt) in the Internet Explorer software.
Have anybody found some functions or articles that support this issue?
Please advise.
Thanks you
|
|
|
|
|
Why don't you try libcurl library.there are many examples in the download file.maybe can help you...
|
|
|
|
|
hello, i'm using vc++ 6 , in my app i need to do some things when the spin control is released, but in vc++6 there is only two events for this control: UDN_DELTAPOS and NM_OUTOFMEMORY, no events for control released, i've been reading that in .net 2003 there is a event NM_RELEASEDCAPTURE in order to do this, but how can i do this in VC++6?
|
|
|
|
|
From commctrl.h:
#define NM_RELEASEDCAPTURE (NM_FIRST-16)
See if you get this notification with ON_NOTIFY
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
>Nothing is free in the universe.<
|
|
|
|
|
I'm not sure to understand what you mean, perhpas because I'm newbie .
I looked for ON_NOTIFY and the unique reference is:
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN1, OnDeltaposSpin1)
no references for NM_RELEASEDCAPTURE,of course inside of commctrl.h
i can find this line that you posted:
#define NM_RELEASEDCAPTURE (NM_FIRST-16
but I don't know what to do with this, can you explain a little more?
|
|
|
|
|
Try this:
ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SPIN1, OnSpinReleasedCapture)
The OnSpinReleaseCapture method should look the same as OnDeltaposSpin1 , am not sure how it looks in VS6 anymore, something like this probably:
void OnSpinReleaseCapture(LPNMHDR lpNMHDR, LRESULT *pResult) . Am not sure you will get this called but it is worht a try i guess.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
>Nothing is free in the universe.<
|
|
|
|
|
Thanks for your answer, ok I've trying, I did this:
In the header file CalibracionDlg.h
afx_msg void OnDeltaposSPIN1(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnReleasedCaptureSPIN1(NMHDR* pNMHDR, LRESULT* pResult);
In the source file Calibraciondlg.cpp
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN1, OnDeltaposSPIN1)
ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SPIN1, OnReleasedCaptureSPIN1)
and the methods
void CCalibracionDlg::OnDeltaposSPIN1(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
}
void CCalibracionDlg::OnReleasedCaptureSPIN1(NMHDR* pNMHDR, LRESULT* pResult)
{
GetDlgItem(IDC_SPIN1)->EnableWindow(FALSE);
}
the compiler doesn't show any erros, but when I execute , nothing, when the control is released nothing happens. may be i forgot something?
|
|
|
|
|
I have VS2003, i did a quick dialog based app and used the event handler wizard (right clicked the spin and selected 'add event handler') to add a handler for NM_RELEASEDCAPTURE, it generates the same code as you used (except for the custom parts of course) so it should be correct, however the event handler never seems to fire. Confusing... it says here[^] too that it is -suposedly- sent. Maybe this requires a deeper googling act.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
>Nothing is free in the universe.<
|
|
|
|
|
Ok, thanks a lot for your time, yes it's easier in VS2003, but is not my choice to use VC6 , i have to, so i gonna keep searching.
|
|
|
|
|
This might be re-inventing the wheel but try this:
class CMySpin: public CSpinButtonCtrl
{
protected:
DECLARE_MESSAGE_MAP()
afx_msg void OnCaptureChanged(CWnd *pWnd);
};
and the implementation:
BEGIN_MESSAGE_MAP(CMySpin, CSpinButtonCtrl)
ON_WM_CAPTURECHANGED()
END_MESSAGE_MAP()
void CMySpin::OnCaptureChanged(CWnd *pWnd)
{
CSpinButtonCtrl::OnCaptureChanged(pWnd);
if (pWnd != this)
{
NMHDR NMHdr;
NMHdr.code = NM_RELEASEDCAPTURE;
NMHdr.hwndFrom = m_hWnd;
NMHdr.idFrom = GetDlgCtrlID();
GetParent()->SendMessage(WM_NOTIFY, NMHdr.idFrom, (LPARAM)&NMHdr);
}
}
use a CMySpin as a control variable for your spin button in your dialog. (You might need to modify the code to compile under VS6, don't know what has changed since VS6)
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
>Nothing is free in the universe.<
|
|
|
|
|
Ok, sorry if my questions are too basics, so I already add the class CMyspin to the proyect as you decribed, and i added a control variable " m_Spin1" of CMySpin type to the spin 1 control , compiled with no errors, so wich is the next step? how can i catch the event of control released?
|
|
|
|
|
thanks for your time Code-o-mate , finally google and 5 hours of work give me the solution, one of them at least. This how it looks now:
Header file
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
Source file
Message map
ON_WM_VSCROLL()
And handler
void CCalibracionDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
if(SB_ENDSCROLL == nSBCode)
{
if(pScrollBar->m_hWnd == m_Spin1m_hWnd)
{
AfxMessageBox( _T("Termino el Spin1!!!") );
return;
}
if(pScrollBar->m_hWnd == m_Spin2.m_hWnd)
{
AfxMessageBox( _T("Termino el Spin2!!!") );
return;
}
}
}
|
|
|
|
|
Yaay for google!
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
>Nothing is free in the universe.<
|
|
|
|
|
Yeey for google!
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
>Nothing is free in the universe.<
|
|
|
|
|
Without using typedef, what is the syntax for dynamically allocating a pointer to an array? I tried the following, but can't get it to work:
long (*const val)[16] = new long()[16];
long (*const val)[16] = new long[16](); This is a question for the sake of curiosity, as I am actually using a typedef in the code to make it more clear. Thanks,
EDIT:
I actually can't figure out how to do this even when using typedefs I have tried the following:
typedef long *myType[16];
myType *val = new myType(); Any help with or without typedef's is appreciated. Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
modified on Monday, November 29, 2010 3:27 PM
|
|
|
|
|
A pointer to an array is simple -
long* ptr = new long[16];
What you've done above is to create an array of pointers.
So you actually have 16 pointers.
|
|
|
|
|
I simplified my example. I am actually trying to dynamically create a 2D array, where one dimension is known (the unknown dimension needs to be consecutive in memory), hence I have:
long *var[16];
However, I would like to create a value for "var" in a function, and return it. Hence I have:
long *(&myFunc())[16] {
long *(*rval)[16] = new ?????;
...
return *rval;
}
Then I declare my variable as a reference and delete it at the end of the code
long *(&var)[16] = myFunc();
...
delete &var; Is there some better way to go about this? I could just make it doubly-dynamic, but feel like I should retain known dimensions for the sake of readability. Any ideas? Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Here is how it can be done, but its real ugly -
#define FIXED_SIZE 16
void allocate(long (**ptr)[FIXED_SIZE])
{
*ptr = new long[10][FIXED_SIZE];
}
int _tmain(int argc, _TCHAR* argv[])
{
long (*ptr)[FIXED_SIZE];
allocate(&ptr);
delete [] ptr;
return 0;
}
The clean and recommended way is to use a standard container - std::vector<std::vector<long>> longArr;
|
|
|
|
|
I guess the answer is, "you can't allocate a single pointer to an array without the new[] operator" (with brackets). So, to allocate a single pointer to an array you have to do:
long (*val)[16] = new long[1][16];
...
delete[] val; Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
This is a single pointer to an array -
long* ptr = new long[16];
delete [] ptr; Now I'm not sure what you're looking for.
|
|
|
|