|
Code:
#include "dao.h"
void main()
{
COleVariant m_var;
LPCSTR m_str;
try
{
CDaoDatabase *base = new CDaoDatabase;
base->Open("c:\\biblio.mdb");
CDaoRecordset *rst = new CDaoRecordset(base);
rst->Open(dbOpenDynaset, "select * from authors");
for(int i=0; i<3; i++)
{
m_var = rst->GetFieldValue("Author");
m_str = (LPCSTR) m_var.bstrVal;
printf("%d, %s\n", i+1, m_str);
rst->MoveNext();
}
rst->Close();
base->Close();
}
catch(CDaoException e)
{
}
}
the header file includes stdio.h and afxdao.h.
Everthing is ok but after print out the first three records in the database, a dialog box appeared with the following message:
Debug Assertion Failed!
Program: C:\WINDOWS\DESKTOP\DATABASE\0041\DEBUG\DAO.EXE
File: daocore.cpp
Line: 39
What's wrong?
|
|
|
|
|
What does line 39 in daocore.cpp look like? Usually from that you can tell what the problem is.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
I couldn't find the file 'daocore.cpp', somebody knows what or where it is?
|
|
|
|
|
MFC source
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Could someone gimme some direction on how to create a specialized menu for each view in a splitter window? I want the menu to be drawn inside each of the CViews inside the splitter wnd.
-JT
|
|
|
|
|
you mean like dropping down from the splitter bar at the top of each splitter view? hmmm ... would a right-click pop-up menu for each pane not be good enough? i know it would sure be a lot easier to code
situations to avoid #37: "good morning ... how many sugars do you take in your coffee ... and what was your name again?"
|
|
|
|
|
The problem here is that menus are attached to frames. The views in a splitter windows share the same frame so I don't see how you can do this without an awful lot of work.
IDEAS)
1) I did something similar to what you need to do except that I used a dialog bar on one side that contained a tree view and I didn't allow the dialog bar to be undocked. The view on the right side was then a listview. This enabled me to define an CMDIChildWnd-derived frame window and attach a toolbar to it. That frame was then used in the creation of the view's doctemplate.
2) About 15 years ago, I wrote a similar thing in OS/2. This was long before the days of having classes to do the work for you. What I did was to create 3 MDI windows. The first two were my views. The third was a "splitter window". It was simply a window that was defined as being so narrow that only its borders were viewable. Therefore, it looked just like today's splitter. I then handled that window's WM_MOVE message and resized the other windows accordingly. The overall impression to the user was that of using a splitter to view different amounts of each window. This *might* do what you want as with each view you could create your own frame and attach a menu to it.
I know these aren't the answers you were looking for. However, sometimes if someone talks about similar problems/solutions, it can jog ideas of your own that will solve your particular problem.
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
Hey Everyone,
Anybody got a good recommendation for a regular expression parser that will work relatively well with STL strings, in Visual C++? I hear MS has one they are giving away, but don't know if there are any other ones that are decent.
Thanks,
Aaron
|
|
|
|
|
Hi all,
Is it possible to send email from VC++6.0 without using any email client?
Thanks,
Sunny
|
|
|
|
|
Yes, as long as you have the dlls. I do not know how usefule this link is, but someone wrote a component on codeproject that may get you started. http://www.codeproject.com/internet/xymailclient.asp.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
The most common ways of doing this are:
A) Use the MAPI interface. MAPI is a bloated interface and can't be used by NT services, I would avoid it.
b) Use SMTP to talk directly to the email server. This is very simple to use but requires a third party library. It works with NT services too. You can buy a library that does this or use a public domain version. I think PJ Naughter has some public domain classes for this.
Chris Hafey
|
|
|
|
|
Chris Hafey wrote:
b) Use SMTP to talk directly to the email server. This is very simple to use but requires a third party library.
Actually, you can use MFC sockets support to send the SMTP verbs to the server.
I personally prefer MAPI as it's much easier to use.
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
Does anyone know how to set the background color of:
- a radio button
- date picker control (spin view)
Thank you
|
|
|
|
|
I have a problem with the function CreateProcessWithLogonW(). The right header files are included, but i always get a compiler error:
error C2065: 'CreateProcessWithLogonW' : undeclared identifier
CreateProcessWithLogonW() is declared in WinBase.h and implemented in Advapi32.lib!!! Both are included!!! What is wrong with them ??
|
|
|
|
|
Don't panic, i got it!!!
Please, stop answering, the time is over!!
And the solution is .....
#define _WIN32_WINNT 0x0500
... must be declared before includinge WinBase.h in Win2000!!!
Here's the manual for each OS:
Windows NT 4.0 _WIN32_WINNT>=0x0400
Windows 98 _WIN32_WINDOWS>=0x0410
Windows 2000 _WIN32_WINNT>=0x0500
Windows Me _WIN32_WINDOWS=0x0490
Windows XP and
Windows .NET Server _WIN32_WINNT>=0x0501
|
|
|
|
|
Consider the following file in a C++ program:
fstream employees(ios::in|ios::out|ios::binary);
This file is going to be a random access file in the program. The user will be allowed to read and write records. Records are based upon the following struct:
struct emp
{ int empId;
char empName[20];
long empSalary;
chat smpDept[4];
}
The question is as follows: Is the file required to be a binary file, or can the ios::binary clause be omitted? Can anyone explain this to me?
Loli10
|
|
|
|
|
unless you're converting that long to text when you output, then yes, the file has to be binary. otherwise, you will end up with a bunch of unprintable characters.
-c
Civilization is the limitless multiplication of unnecessary necessities.
Mark Twain
|
|
|
|
|
|
I was just wondering if you can open VS 7 projects and workspaces [does it still use workspaces] in VS6???
<centre>
Now taking suggestions for a new sig. please email me all suggestions.
|
|
|
|
|
No.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"But there isn't a whole lot out there that pisses me off more than someone leaving my code looking like they leaned on the keyboard and prayed that it would compile.
- Jamie Hale, 17/4/2002
|
|
|
|
|
ok. thanks
<centre>
Now taking suggestions for a new sig. please email me all suggestions.
|
|
|
|
|
I have a question about debugging in VC6.
When the IDE breaks at a location and you look at the variables window for the "Value" of a class if the class is descendent of a CObject you'll see the class name ex: {CMyObject} but for a CString, CRect, CPoint, etc. you'll see the value(s) of the most important member(s) of the class, CString - the actual string, CPoint - the X and Y coordinate.
So my question is: Is there a way to control the text in the value column or the variable window of the IDE for a class or is it the IDE that decides what to display?
For example if I created a CMyString class that's a descendent of a CObject class. When I debug in the "Value" column I only see {CMyString}, I always have to click on the "+" sign to see the value of the CMyString class. I would be very useful to have control on what the IDE would display for a value of a class.
But if the IDE decides what members is displayed for certain class, then I guess I would kind of be impossible to do...
Thanks...
Serge R
|
|
|
|
|
You have to edit this file:
(wherever you installed Visual)\Common\MsDev98\Bin\Autoexp.dat
Add a line like this:
CMyString=<membervariable>
Fortunately, there are (should be) some instructions within this file that explain exactly what you can do. I'd recommend closing down Visual before editing this file.
No generalization is 100% true.
Not even this one.
|
|
|
|
|
take a look here:
http://www.codeguru.com/tips/CustomizingDebug.shtml
|
|
|
|
|
I'm writing this code to control a mechincal syring and I keep getting this error when I try to build it.
header file: int pl32ComClose(void);
call fn in .cpp: pl32ComClose();
error recieved: myc32.obj : error LNK2019: unresolved external symbol "int __cdecl pl32ComClose(void)" (pl32ComClose@@YAHXZ) referenced in function _main
How do I go about fixing this? I'm using a predefined .lib and .dll file for the functions. Am I not linking correctly to the files? Am I calling it incorrectly?? Any help would be greatly appreciated.
|
|
|
|