|
thnx a lot. its now working. 
|
|
|
|
|
I used CDaoDatabase in my App.
the App is not working (database error) when I installed it in a clean PC.
If I install VC6 on the clean PC, the App works fine.
I think I need some extra files (such as DLLs) from VC6 for the App's installation.
do you know what they are?
thanks
|
|
|
|
|
includeh10 wrote: I think I need some extra files (such as DLLs) from VC6 for the App's installation.
do you know what they are?
You need to install vcredist.exe[^] on the target computer.
So, what is vcredist.exe?
Vcredist.exe is a self-extracting executable file that installs the latest version of the Microsoft Visual C++ run-time files and operating system components that are required by most projects created with Visual C++ 6.0.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Thanks.
I downloaded vc6redistsetup_enu.exe then extracted to vcredist.exe then run vcredist.exe.
I still have same problem:
Error: CDaoException
SCODE_CODE=340
SCODE_FACILITY=4
SCODE_SEVERITY=1
ResultFromScode=-2147221164
What is that?
|
|
|
|
|
vcredist.exe has got nothing to do with this.
You have a different problem and you need to give more information to get an answer. Hint: Look at the sticky post at the top of this page, which says "How to get an answer to your question".
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Default DAO version for MFC 6.0 that comes with VC6 is 3.5 although it can support 3.0 and 3.6, too.
I think, you should install DAO 3.5 as well on target machine.
To determine its existence, look for DAO350.dll in "\Program Files\Common Files\Microsoft Shared\DAO" folder.
DAO 3.5 also comes with earlier MS Office versions (i think, Office 97).
|
|
|
|
|
Here is an interesting bit of code:
<br />
void f(const int& i)<br />
{<br />
int* ip = (int*)(&i);<br />
(*ip)++;<br />
}<br />
int main()<br />
{<br />
int i = 0;<br />
<br />
cout << "i in main before f() is: " << i << endl;<br />
f(i);<br />
cout << "i in main after f() is: " << i << endl;<br />
return 0;<br />
}<br />
and even more interesting is:
<br />
int main()<br />
{<br />
const int i = 0;<br />
<br />
int* ip = (int*)&i;<br />
(*ip) = 65418;<br />
<br />
cout << "Address of i = " << &i << endl;<br />
cout << "Address ip points to = " << ip << endl;<br />
cout << "Value of i = " << i << endl;<br />
cout << "Value ip of the address ip points to = " << *ip << endl;<br />
return 0;<br />
}<br />
<br />
The question is, what's happening? I'm still looking into this. Just thought I'd toss is out to see what others thought.
Also, this makes for an interesting security question. If you are given pre-defined function declaration such as: void f(const int& i) or a constant reference to a struct, what keeps the coders from changing information internally.
Cheers!
|
|
|
|
|
You can do anything you want to a const value, the const modifier is simply a keyword the compiler can use to optimize code, it's still just a memory address, plain and simple.
|
|
|
|
|
frozenkore wrote: f you are given pre-defined function declaration such as: void f(const int& i) or a constant reference to a struct, what keeps the coders from changing information internally.
Nothing prevents and I agree with you: that is, IMHO, a C++ weirdness. Of course it is only my personal opinion.
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
|
|
|
|
|
frozenkore wrote: The question is, what's happening?
You're using C-style casts to tell the compiler that it's safe to ignore the const qualifier of the parameters. It would be better to use the C++ const_cast operator to make your intentions clearer, or use static_cast if you actually don't want to change the constness.
|
|
|
|
|
frozenkore wrote: what keeps the coders from changing information internally
Nothing, but there's a risk of breaking the app. For example:
void f(const int& i)
{
(int&)i = 321;
}
void somefunc()
{
int i = 123;
f(ci);
static const int ci = 123;
f(ci);
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
here is the SQL:
//========================
update [MY_TABLE]
set REMARK = 'hello',
SET_TIME = '05/06/2008 10:47:27'
where TAB_ID = 17605
and LOG_ID = 20061
and USER_ID = 'ME'
and SET_TIME = '5/6/08 10:37:28 AM'
error info is:
Data type mismatch in criteral expression (3464)
//============================
If I delete last line, the SQL is executed correctly:
update [MY_TABLE]
set REMARK = 'hello',
SET_TIME = '05/06/2008 10:47:27'
where TAB_ID = 17605
and LOG_ID = 20061
and USER_ID = 'ME'
//==============================
I open the table, all data:
where TAB_ID = 17605
and LOG_ID = 20061
and USER_ID = 'ME'
and SET_TIME = '5/6/08 10:37:28 AM'
are there.
could you find why?
thanks
|
|
|
|
|
includeh10 wrote: and SET_TIME = '5/6/08 10:37:28 AM'
Have you tried SET_TIME = '05/06/20008 10:37:28 AM' instead?
PS: Please do not annoy by repeatedly posting the same stuff. If nobody replied, that could most probably mean that you haven't given enough information. Try rephrasing the query or explaining it better instead of reposting it several times. Reposting/Cross-posting will get you ignored fast.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
what about if you remove the "AM" from the literal ?
BTW, we have a SQL forum, if you don't mind
|
|
|
|
|
Hi,
Wondering if anyone has any good ideas here...
I have written a custom CStatusBar control which basically updates
some panes in color as the mouse cursor is moved around. The panes
were flickering due to the amount of redrawing required so I added
some code that uses double-buffering to draw the panes off-screen
first, then blits to screen. I used a well-known piece of code from
Keith Rule on CodeProject in the CMemDC class for this
(http://www.codeproject.com/KB/GDI/flickerfree.aspx?msg=2531592#xx2531592xx).
Here's the code for that:
***********************************************************************************
<br />
class CMemDC : public CDC {<br />
private:<br />
CBitmap m_bitmap;
CBitmap* m_oldBitmap;
CDC* m_pDC;
CRect m_rect;
BOOL m_bMemDC;
public:<br />
<br />
CMemDC(CDC* pDC, const CRect* pRect = NULL) : CDC()<br />
{<br />
ASSERT(pDC != NULL);<br />
<br />
m_pDC = pDC;<br />
m_oldBitmap = NULL;<br />
m_bMemDC = !pDC->IsPrinting();<br />
<br />
if (pRect == NULL) {<br />
pDC->GetClipBox(&m_rect);<br />
} else {<br />
m_rect = *pRect;<br />
}<br />
<br />
if (m_bMemDC) {<br />
CreateCompatibleDC(pDC);<br />
pDC->LPtoDP(&m_rect);<br />
<br />
m_bitmap.CreateCompatibleBitmap(pDC, m_rect.Width(),<br />
m_rect.Height());<br />
m_oldBitmap = SelectObject(&m_bitmap);<br />
<br />
SetMapMode(pDC->GetMapMode());<br />
<br />
SetWindowExt(pDC->GetWindowExt());<br />
SetViewportExt(pDC->GetViewportExt());<br />
<br />
pDC->DPtoLP(&m_rect);<br />
SetWindowOrg(m_rect.left, m_rect.top);<br />
} else {<br />
m_bPrinting = pDC->m_bPrinting;<br />
m_hDC = pDC->m_hDC;<br />
m_hAttribDC = pDC->m_hAttribDC;<br />
}<br />
<br />
FillSolidRect(m_rect, pDC->GetBkColor());<br />
}<br />
<br />
~CMemDC()<br />
{<br />
if (m_bMemDC) {<br />
m_pDC->BitBlt(m_rect.left, m_rect.top, m_rect.Width(),<br />
m_rect.Height(),<br />
this, m_rect.left, m_rect.top, SRCCOPY);<br />
<br />
SelectObject(m_oldBitmap);<br />
} else {<br />
with<br />
m_hDC = m_hAttribDC = NULL;<br />
}<br />
}<br />
<br />
CMemDC* operator->()<br />
{<br />
return this;<br />
}<br />
<br />
operator CMemDC*()<br />
{<br />
return this;<br />
}<br />
};<br />
***********************************************************************************
Applying this code requires overriding the OnPaint & OnEraseBkgnd
methods in the custom CStatusBar as follows:
<br />
void MyStatusBar::OnPaint()<br />
{<br />
CPaintDC dc(this);
CRect rect;<br />
GetClientRect(&rect);<br />
CMemDC memDC(&dc, &rect);<br />
<br />
DefWindowProc(WM_PAINT, (WPARAM)memDC->m_hDC, (LPARAM)0);<br />
<br />
}<br />
<br />
BOOL MyStatusBar::OnEraseBkgnd(CDC* pDC)<br />
{<br />
return TRUE;<br />
<br />
}<br />
<br />
This reduces the flickering, but now the pane borders don't get drawn
at all - they just appear as blank white areas. I have tried
overriding the OnNcPaint function to avoid the call to
CControlBar::EraseNonClient(). No effect. I have also tried calling
DrawBorders explicitly with likewise no effect.
Does anyone have any idea what I'm missing here?
Any suggestions would be much appreciated.
Best,
Bruce
|
|
|
|
|
blamond wrote: // Fill background
FillSolidRect(m_rect, pDC->GetBkColor());
replace this statement in CMemDC to
HBRUSH hbrBackGrnd = (HBRUSH)GetClassLong(pDC->GetWindow()->GetSafeHwnd(),
GCL_HBRBACKGROUND);
::FillRect(GetSafeHdc(), &m_rect, hbrBackGrnd);
|
|
|
|
|
Rajkumar gets large quantities of kudos...
Your fix did the trick, and saved me a few hours of head-bashing no doubt.
Thanks very much!
Bruce
|
|
|
|
|
In our application, we would like to update our view based on the user's selection in a combo box like office 2007 does to change font size. We notice that when you highlight a font size from the combo box, you can preview the size change without the need to hit "Enter" or any other "Apply" trigger. How can we do that? Does the combo box of new version of Visual Tools have the event trigger automatically? Thank you very much!
|
|
|
|
|
|
Is there a way to detect if a view is in print preview mode without using a Device Context or CPrintInfo?
I am using MFC Doc/View
modified on Monday, May 5, 2008 4:59 PM
|
|
|
|
|
void CViewDerivedClass::OnPrint(CDC* pDC, CPrintInfo* pInfo)
{
if(pInfo->m_bPreview)
{
}
}
CPrintInfo structure is passed as a parameter to all printing related functions of a CView derived class.
modified on Monday, May 5, 2008 4:58 PM
|
|
|
|
|
My bad. I forgot to indicate the "without DC" thing better.
Is there a flag or method outside of any particular view to allow one to determine if the the app is in print preview mode?
By the way, thanks for taking the time to help. Sorry I didn't state my problem clearer the first time.
|
|
|
|
|
You can keep track of it yourself via overriding following function.
virtual void CFrameWnd::OnSetPreviewMode(BOOL bPreview, CPrintPreviewState* pState);
|
|
|
|
|
|
I'm trying to print the contents of a web browser control using the web browser's ExecWB method as follows:
m_ctrlWebBrowser.ExecWB(OLECMDID_PRINT, 1, NULL, NULL);
Everything works great in debug, but in release an exception is thrown.
I have no idea how to determine what the problem might be, and searching online I haven't been able to find anyone else who's had this problem, or any other info about what else I might need to do besides just calling ExecWB().
Any ideas greatly appreciated! I'm kind of a newbie, so please include as much detail as possible.
(I'm using Visual C++ 5.0 / MFC, by the way... and IE 6.0)
Thanks much
|
|
|
|