|
Hi,
In my SDI application, I have two different FormViews separated by a splitter window. I want the document class to handle the shared data between the two views.
How do I add the new view to the existing document class.
How the data among the two views is shared by the single document?
Please give an example.
Thanks
Binayak
|
|
|
|
|
>> add the new view to the existing document class.
In a member function of your document class:
CDocument::AddView(...)
>> How the data among the two views is shared by the single document?
Any way you want to in your design of your CDocument derived class. You can also say, the two views share their data using the document class.
"No matter where you go, there your are..." - Buckaoo Banzi
-pete
|
|
|
|
|
I'm adding a record to an Access database via ADO and then trying to query for that record based on the date:
m_addTime = COleDateTime::GetCurrentTime();
...
VARIANT v;
VariantInit(&v);
V_VT(&v) = VT_DATE;
V_DATE(&v) = m_addTime;
pRS->Fields->Item[_variant_t((long)1)]->Value = v;
This works fine, but querying for the time value has me stumped:
CString sql;
sql.Format("SELECT id, dtTime FROM tblSample WHERE dtTime = %f", (double)m_addTime);
pRS = m_pDB->ExecuteRS_ReadOnly(sql);
...returns no rows.
dtTime is a Date/Time value in the access table.
Any clues would be appreciated
|
|
|
|
|
>> CString sql;
>> sql.Format("SELECT id, dtTime FROM tblSample WHERE dtTime = %f", (double)m_addTime);
did you try taking the SQL string resulting from your concatenation and running it in Access?
"No matter where you go, there your are..." - Buckaoo Banzi
-pete
|
|
|
|
|
Good point. Yes, and it doesn't return a record either. I made sure that the field isn't defaulted or filtered in any way, just in case. I also tried this:
sql.Format("SELECT count(*) FROM tblSample WHERE dtTime = %f", (double)m_addTime);
this also returns a 0 in the resulting recordset. Next, I cleared the table, wrote a single record, read it back in (select *), and the before and after values were identical, yet the original sql still returns 0 records. This leads me to believe that there is a formatting problem, like somehow my double value is being truncated. I tried "%0.9f" with the same results.
thanks
|
|
|
|
|
Additionally, I am seeing this behaviour:
(field 1 is time field in previous sql)
COleDateTime dtTime(GetVariantDate(m_pRS->Fields->Item[_variant_t((long)1)]->Value, (DATE)0));
double dTime = GetVariantDouble(m_pRS->Fields->Item[_variant_t((long)1)]->Value,0);
dtTime.Format("%a, %m/%d/%Y") returns "Sat, 12/30/1899"
The original record in Access reads: 9/2/2003 4:31:24 PM
dTime reads: 0.68847222222222 (huh?)
NOTE: the GetVariant methods simply return the requested variant type or the default value which is the second argument.
Help!
|
|
|
|
|
You need to format your query time differently. You know it's implemented and stored as an 8-byte IEEE floating point, but Access won't admit it.
Try asking "SELECT id FROM tblSample WHERE dtTime = 'YYYY-MM-DD hh:mm:ss'" instead.
You can use VariantTimeToSystemTime to convert from the original value.
However, you should note that some databases (like SQL Server) will truncate at milliseconds, so it might be an idea to use VariantTimeToSystemTime, and convert back (SystemTimeToVariantTime), which ignores milliseconds, before inserting the value. This will prevent any off by a small fraction of a second errors.
Steve S
|
|
|
|
|
Steve,
Thanks that solved my problem. Just the change before the update did the trick!
daug
|
|
|
|
|
hello all..
i need some help to solve my problem..
i'd tried so many times to test this program...
it works very well if i did not include the FOR LOOP into my program.
i hope you guys can have a look at my program and figure out
what mistakes i did..thanks..
COLORREF OriginalPixelValue;
COLORREF NewPixelValuesss;
int PixelCount=0;
CoX=0; //coordinate-X
CoY=0; //coordinate-Y
for(int abcde=0; abcde<48; abcde++)
{
OriginalPixelValue=PixelValue(CoX,CoY);
NewPixelValuesss=(OriginalPixelValue | Data_0[PixelCount]) & Data_1[PixelCount];
GoWatermark(NewPixelValuesss,CoX,CoY);
PixelCount+=1;
if(CoX<m_bminfo1.bmwidth)
{
="" cox+="1;
" }
="" else
="" coy+="1;
" cox="0;
" <b="">}
COLORREF CThongThongThongDlg::PixelValue(unsigned int cox, unsigned int coy)
{
m_pixelvalue=GetPixel(m_dcMem1, cox, coy);
return m_pixelvalue;
}
BOOL CThongThongThongDlg::GoWatermark(unsigned long ValueValue, int CoordinateX, int CoordinateY)
{
NewSettedPixelValue=m_dcMem1.SetPixel(CoordinateX, CoordinateY, ValueValue);
UpdateData(FALSE);
return TRUE;
}
please take note at those lines in [B]BOLD[/B] .. when i put in this lines..to loop... the function does go..(i mean..the results i got is nothing...not working).. but if i delete those lines(those loops)..the function will run properly.. i really need to loop..its very important..
this is a school project.. where i need to read the bits values inside the 24-bit BITMAPS and do some modification of its RGB LSB.. i really need help.
thanks a lot.
thong
twh81@tm.net.my
...
|
|
|
|
|
Is this a "deliberate" typo?
if(CoX {<br />
CoX+=1;<br />
}
Shouldn't it be
if(CoX)<br />
{<br />
Cox += 1;<br />
}<br />
else<br />
{<br />
CoY+=1;<br />
CoX=0;<br />
}
It is amazing what you can accomplish if you do not care who gets the credit. - Harry S Truman
|
|
|
|
|
His code is actually:
if(CoX < m_bmInfo1.bmWidth)
{
CoX+=1;
}
else
{
CoY+=1;
CoX=0;
}
|
|
|
|
|
Thanks, that is not what I see on IE6!
Perhaps he could give a link to the source code? I could not see anything obviously wrong. But it could have been screwed durin cut/paste.
It is amazing what you can accomplish if you do not care who gets the credit. - Harry S Truman
|
|
|
|
|
I don't see it either. Looks like IE6 swallowed the "<" as an HTML tag. He needs to wrap his sample code with <code></code> tags.
|
|
|
|
|
I can see two things that the for loop might affect.
1) the incrementing of PixelCount . This is used in the dereferencing of Data_0 and Data_1 . Are the arrays large enough?
2) the incrementing of CoX and CoY . Those are used by PixelValue() and GoWatermark() . Can those functions handle values greater than 0?
|
|
|
|
|
Hi all,
i've posted this question before and still no reply.....
when i create a new snap-in project (MMC) , the default menu in the menu bar is "Action, View, Favourties" i want to remove the "Favourites" menu item
i don't know how to do that. i know it is possible, i saw that sql server enterprize manager (which is a snap in object) removed it....so it is possible
can any1 help this time???
thanks in advanced
yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
error C2440: '=' : cannot convert from 'struct cell ** ' to 'struct cell *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
sortset.obj - 1 error(s), 0 warning(s)
The error appear to be in this line
temproot = (cmp_res < 0) ? &temproot->left : &temproot->right;
Anyone have a clues on how to fix this?
thank you very much ^_^
|
|
|
|
|
mmmm, smells like homework
Try removing the ampersands, assuming that temproot and the left and right nodes are of type "cell *"
For an explaination why, consult someone who can be bothered to explain pointers
--
Ian Darling
If I was any more loopy, I'd be infinite.
|
|
|
|
|
Hello, Can I add my aplication in Internet Explorer Rebar, How??
Visual C++ MFC
|
|
|
|
|
i create a font in the usual way :
first i set the properties (fontname, height, weight, angle, ...) in a LOGFONT struct,
then
myFont.CreateFontIndirect(&logfont);
then
pDC->SelectObject(&myFont);
then i call pDC->GetTextMetrics & pDC->GetTextExtent to to get some useful values
(total height, height of the ascent & descent parts), ... With these values i known exactly the boundaries of the text.
Problem : for a same height specified in the LOGFONT struct, the height values returned by GetTextMetrics vary with the angle of the text.
More precisely : if the angle is precisely 0 or 90 or 180 or 270°, the height is correct : if a draw a rectangle with the width & height computed from these values, it will perfectly fit around the text.
For any other values of the angle, the height is about 10 % too big.
|
|
|
|
|
how do you allocate memory in C? (not C++)
"new" is not supported in C.
|
|
|
|
|
Hi,
try malloc(), realloc() and free()
Greetings,
hph
|
|
|
|
|
In ansi C you allocate memory with
malloc();
and after usage you free the allocated memory with
free();
|
|
|
|
|
erm ...
look at malloc and free ( and associated function, calloc, realloc, ... )
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
loud and clear. doing it as we speak.
|
|
|
|
|
For example:
..... // Create 2 threads and save their handles to hThread1, hThread2
rgHandles[0] = hThread1;
rgHandles[1] = hThread2;
while (TRUE)
{
dwIndex = ::WaitForMultipleObjects(2, rgHandles, FALSE, INFINITE);
dwIndex -= WAIT_OBJECT_0;
...... // farther process at here
}
When the thread1 is terminated, the state of thread1 is set to signaled,
then WaitForMultipleObjects() returns the index 0 of the array.
But when the thread2 is terminated, the WaitForMultipleObjects() still returns
the index 0 not index 1.
I want WaitForMultipleObjects() to return the correct index, so I can process for this terminated thread.
who can help me?
Thanks a lot
|
|
|
|