|
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.
|
|
|
|
|
Your last post solved it... I just can't allocate a SINGLE pointer to an array of pointers without dynamically allocating an array of 1 pointer to the array. For example:
long *(*val)[16] = new ???;
...
delete val; There is nothing I can put in the "???" area to make the above code valid, because there is no valid syntax to dynamically create a single pointer to array using operator new(). I must do the following instead:
long *(*val)[16] = new long*[1][16];
...
delete[] val; In short, you have answered my question. Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
|
Hi,
I restricted my SDIapplication to resize usin
m_pMainWnd->ModifyStyle(WS_MAXIMIZEBOX|WS_THICKFRAME,0);
But a thick border is coming around the window. how to remove that?
|
|
|
|
|
That's the default for resizable dialogs, why do you want to change that ?
|
|
|
|
|
I dont want resize proprty, how to restrict it.
I need fixed size dialog.
|
|
|
|
|
Which window styles remain now after removing those? Some styles imply WS_THICKFRAME, like WS_TILEDWINDOW.
Maybe have a look here[^] to find out which style does what.
modified 13-Sep-18 21:01pm.
|
|
|
|
|
Hello All,
I've one application which loads a dll into process using VirtualAllocEx, WriteProcessMemory and CreateRemoteThread, Now when the runtime library is selected as "MultiThreaded Debug /Mtd" it works fine in local computer but i can't run the application in other computer as it gives error regarding the configuration of file, To make this work i change the runtime library as /Mt (Multi Threaded) which actually works in any computer when i stop my antivirus, else the antivirus deletes the exe as soon as i build it.. How can i make this work.
Thanks.
|
|
|
|
|
Hi, I am trying to develop a win32 dialog based application.
When I tried to build my application, I am getting the following error.
error PRJ0003 : Error spawning 'cmd.exe'
Can anybody tell me a way to resolve this issue.
Thanks in advance
msr
|
|
|
|
|
|
Hi All,
How can i convert a char array into CString?
I have one array like this
char charr[1000];
....
drwFile.Read(charr,500); //reading some characters from the file
CString str;
how to store the charr array in to str?
i m try this CString str(charr);
but when i display a message box with str value its display only first character of charr.
please help me for this.
thanks in advance.
|
|
|
|
|
if this CString str(charr); doesn't work, then the problem may be with your character array. Does it contain what you expect?
|
|
|
|
|
Check the encoding used in file.
|
|
|
|
|
As already suggested by Rejeesh.T.S if your text file contains wide characters and your application doesn't use the UNICODE charset then the output posted is the expected result.
Hence either make a UNICODE build or use MFC/ATL conversion macros in you project.
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]
|
|
|
|