|
Hi,
Use GetLastError() to find the error code. Use the error code in error lookup tool to find the description. It may be a bad path error.
Bye,
Cool Ju
Dream Ur Destiny
|
|
|
|
|
I have a popup dialog. The user selects 1 of 3 checkboxes.
I want to transfer which checkbox the user selected back
to the point where I popup the dialog.
I have this:
CExampleDlg dlg;
if (dlg.DoModal())
{
int num = dlg.GetNum();
}
But I get an error ASSERT(::IsWindow(m_hWnd)) on the
dlg.GetNum() command which is:
int GetNum()
{
if (c_check1.GetCheck())
return 1;
else
return 0;
}
The error is on the line if (c_check1.GetCheck()). The
control c_check1 almost doesnt exist anymore.
Any idea what Im doing wrong. Please, any response any
one can give me will be greatly appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
Why not just assign a value variable to the control on the dialog then pass that value? Also, if "GetNum()" appears exactly as you typed it, it has not been associated with the CExampleDlg class.
|
|
|
|
|
Can you give me an example of how to pass the value? Please, please.
The GetNum() is in the CExampleDlg class.
|
|
|
|
|
|
Hi DanYELL,
Declare CExampleDlg dlg;
in the function or in the class(Is it public)
|
|
|
|
|
DanYELL wrote: The user selects 1 of 3 checkboxes.
Shouldn't these be radio buttons instead?
In the dialog's OnOK() method, save the state of the buttons in a member variable. Then you can access that member variable after DoModal() returns.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
hi,
i got an .NET web application using C#,
that app talks to a C++ DLL that is using DAO,
when the first line get executed it throw an exception
, it only executes this line
CDaoWorkspace workspace;<br />
workspace.Open();
does any body have a clew, I know its not recommended to use DAO in any multithreaded application even on the desktop, but this is an legacy application and we want the minimum modification
Thanks
Lakani
|
|
|
|
|
What is the error text in the exception object?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Its something about DAO can’t initialize, the error code is AFX_DAO_ERROR_ENGINE_INITIALIZATION , I can recall that we have to put something like initialization function before starting using DAO, is that right, but I can’t remember the syntax
|
|
|
|
|
Did you call AfxDaoInit() in your C++ code before you tried to use DAO?
Remember to call AfxDaoTerm() during your shutdown as well.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
It throws the same exception when I tried to do so,
I know that DAO is not working well in multithreaded environment, but I heard that this is fixed if I turn my DLL to UNICODE version, which I‘ve done, but still not working.
thanks Ryan,
|
|
|
|
|
Hi
am developing activex control, and in the OnDraw method i want to draw a round rectangle and fill it with gradient color
can you help me in that
thaks alot
Tarek Jabri
|
|
|
|
|
Try something like this:
------------------------
COLORREF Rainbow(int x)
{
enum
{
maximum = 255, // Range of x is from 0 to this value.
h1 = maximum/4,
h2 = maximum/2,
h3 = 3*maximum/4,
};
const double m = 255/h1;
BYTE red;
if ( x<=h1 )
{
red = 255;
}
else if (x>=h2)
{
red = 0;
}
else
{
red = static_cast<BYTE>(-m*x+510.0 + 0.5);
}
BYTE green;
if (x<h1)
{
green = static_cast<BYTE>(m*x + 0.5);
}
else if (x>h3)
{
green = static_cast<BYTE>(-m*x+1020.0 + 0.5);
}
else
{
green = 255;
}
BYTE blue;
if (x<=h2)
{
blue = 0;
}
else if (x>=h3)
{
blue = 255;
}
else
{
blue = static_cast<BYTE>(m*x-510.0 + 0.5);
}
return RGB(red, green, blue);
}
Steve
|
|
|
|
|
i am using the code below which i copied from somewhere for an application which uses a vertical scrollable child. now i realise my application need a horizontal scroll also.....can i use back the same code ?
void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
int nDelta;
int nMaxPos = m_rcOriginalRect.Height() - m_nCurHeight;
switch (nSBCode)
{
case SB_LINEDOWN:
if (m_nScrollPos >= nMaxPos)
return;
nDelta = min(max(nMaxPos/20,5),nMaxPos-m_nScrollPos);
break;
case SB_LINEUP:
if (m_nScrollPos <= 0)
return;
nDelta = -min(max(nMaxPos/20,5),m_nScrollPos);
break;
case SB_PAGEDOWN:
if (m_nScrollPos >= nMaxPos)
return;
nDelta = min(max(nMaxPos/10,5),nMaxPos-m_nScrollPos);
break;
case SB_THUMBTRACK:
case SB_THUMBPOSITION:
nDelta = (int)nPos - m_nScrollPos;
break;
case SB_PAGEUP:
if (m_nScrollPos <= 0)
return;
nDelta = -min(max(nMaxPos/10,5),m_nScrollPos);
break;
default:
return;
}
m_nScrollPos += nDelta;
SetScrollPos(SB_VERT,m_nScrollPos,TRUE);
ScrollWindow(0,-nDelta);
CDialog::OnVScroll(nSBCode, nPos, pScrollBar);
}
|
|
|
|
|
Yes you do as same way in OnHScroll handler.
But ratio would be different so you have to calc it.
Enjoy
|
|
|
|
|
sorry i have to ask this...but how do i calculate it ?
Thanks
|
|
|
|
|
there are several way to calc it. it depends on what kind of coordinate system you are using. you have to consider whether absolute or relative, whether integer or float, whether zoom in/out feature will be added or not, and etc.
scrollbar control has its absolute coordinate like 'range' like 0~255 or 0~32767. this is physical coordinate. So your logical coordinate in your mind has to be matched to physical coordinate as correct ratio. for example, if the maximum size of logical map is 327680 pixel and physical scroll range is 0~32767, then current pixel position to draw to screen has to be scrollbar position * 10. so if the scrollbar position is 16384 (1/2 of range), then current map position is 16384 * 10 = 163840.
and you also have to consider view window width, height.
anyway, scroll bar controling is a little complex and i'd like to suggest you to research formal way. there are lectures on the internet.
Enjoy
|
|
|
|
|
hello i want to make an overload of the assignement operator in C++ but it generated this error ... someone help please
thank you!
this is the code:
friend CMot& operator = (const CMot); --> in CMot.h
CMot& operator = (const CMot m) --> in CMot.cpp
{
return m;
}
C++ Beginner
|
|
|
|
|
>hello i want to make an overload of the assignement operator in C++ but it generated this
>error ... someone help please
>thank you!
>this is the code:
>friend CMot& operator = (const CMot); --> in CMot.h
>CMot& operator = (const CMot m) --> in CMot.cpp
>{
>return m;
>}
>C++ Beginner
It's been a while since I've dealt with this but my guess would be that "friend" indicates an external function or class. Since the only entitity you're dealing with is the object itself, both as object and returned value, you don't need the "friend" designation. It puts it outside the class.
Lilith
|
|
|
|
|
operator= must be a member function. Make you code look this this:
<code>
class CMot
{
CMot& operator = (const CMot);
}
CMot& CMot::operator = (const CMot m)
{
return m;
}
Steve
|
|
|
|
|
Close
class CMot
{
CMot & operator = (const CMot &);
};
CMot &CMot::operator = (const CMot &m)
{
this->member_variable = m.member_variable;
return *this;
}
You may be right
I may be crazy
But it just may be a lunatic you’re looking for
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
|
I'd recommend making the return value const. Otherwise you'll find some nitwit that does this:
(mot1 = mot2) = mot3; Having to debug that can cause an enormous amount of hair loss
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Enabling chaining is why operator= returns a reference to itself. This kind of usage is common:
int x, y, z;
x=y=z=1;
Personally I'd think twice before diabling such usage, but to each his own.
Steve
|
|
|
|