|
Just a couple of thoughts...
DAO is only capabale of connecting directly to a particular set of PC-oriented databases, while ODBC is a complete architecture for connecting to different databases no matter the size.
Ususally, DAO is more efficient at accessing the native file formats it supports that ODBC when accessing the same data through the appropriate driver. ODBC is more efficient than DAO when trying to access a remote server that isn't available through DAO directly.
DAO connects to databases. ODBC connects to data sources. A DAO program would have to be written to be configurable before you could change the database you were working with. Using ODBC, users of your program could reconfigure the data source without any trouble at all.
|
|
|
|
|
Hi artee
ADO would be better if u want ease of use (coding) with the database.
But ODBC would be difficult but with a API layer less so less overhead.
Its upp to you,,but considering the problems i had to face in ODBC i would recommend ADO.
(Am i missing something?)
|
|
|
|
|
Thank you for the reply. As I see till now ODBC connectivity is quite easy as there r only object with Open, Close and Update function etc. But I was seeing ADO and it had some complex coding in it..
Is this true or am I getting something wrong. Please comment..
|
|
|
|
|
Hi,
I'm using LineDDA function, everythin work and its fine,,
but there's a problem,,
i like to veiw all the points that the LineDDA passes to my callback function..
so i wrote the foolwing codes,, but it doesn't work.
void CEdgeView::LineDDAProc(int X, int Y, LPARAM lpData)
{
CDC* pDC = (CDC*) lpData;
ofstream outfile("points.out");
outfile << X << "," << Y <<"\n";
pDC->SetPixel(CPoint(X,Y), RGB(0,0,255));
}
it only prints the center point to the outfile..
anyone knows hwo to fix it,,
the reason is that, i have to get the pixel intensity of every point along that line.
so i need to wrok with those points.
Thanks
Ehsan
Ehsan Behboudi
|
|
|
|
|
Hi Ehsan !
You should make outfile variable either global or a member of View class. Currently the file you want to log recreated any time you call this function.
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor_soukhov@yahoo.com | ICQ:57404554 | http://siv.da.ru
|
|
|
|
|
Hi, I'm trying to complete a little program using the Visual Studio interface, but I still have a problem. I have one View (I used SDI) and one CResizingBar. In my view, I've insert a dialog with an activeX graph. My problem is when I'm dragging the splitter (changing size of my ResizingBar) the view and my bar always repaint. I can't use the double-buffering00 trick because my view and my bar don't have the same size. So... flicker!
I would like to do the same thing in Visual, update only when the drag is finished. I would like to have the same effect of turning off option, in control panel->display->effects-> show window contents while dragging.
Someone can help me please?
Thanks.
Martin Paradis
|
|
|
|
|
You need to paint and erasebackground on condition of a flag, set when you start a drag of the splitter.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I hope this is a simple question for everybody here :
I have given a string, e.g.
"C:\games\hl.exe +connect(ip):27015"
how can I search for the text "(ip)" and replace it with another string?
thanks in advance
|
|
|
|
|
It's very simple.
If you want find the string "(ip)" you must use the Method Find and Replace of the CString Class.
Carlos Antollini.
|
|
|
|
|
Thanks!
It works fine
|
|
|
|
|
Must I create new pen everytime I need to change its color ?
I have to draw number (thousands) of lines and every line must be drawn in different color. The problem is that I don't know how to alter pen color without necessarily creating new pen and selecting it into device context. Everyone will agree that it is waste of memory. Also, creating and deleting pen repeatedly would cause memory fragmentation. I'm stuck here. Please help!
|
|
|
|
|
You can't change the color of the existing pen. Are you sure that *every* line you draw must have different color?
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Why it is not possible?
I work on a math grapher, which can draw any number of math functions (limited only by the memory) together on the screen. The user is allowed to set different color for every function, moreover he can set distinct color for every "x" value.
You can imagine that (f(x), f(x + delta)) makes one line. So I have thousands of lines on the screen and every line may have different color.
How to deal with this?
|
|
|
|
|
> Why it is not possible?
This question should be adressed to Microsoft, not to me
> The user is allowed to set different color for every
> function, moreover he can set distinct color for every
> "x" value.
And every function has its own color settings for every x value? In this case, the only solution to make things faster is calling API functions directly instead of CPens - I'm assuming your app uses MFC.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Yes it uses MFC, but it is not so important. I can use API calls as well, but what? I searched MSDN and no such API function is out there. In API you create pens as you do in MFC, there is no difference. MFC does a lot of work for you, of course, but there's no real difference. I experimented with CDC::EnumObjects for OBJ_PEN, however this function can only read pen information and there is no function to store color or style or width into existing pen. I cannot create thousands of pens. I would be a fool if I did.
|
|
|
|
|
> In API you create pens as you do in MFC, there is
> no difference.
There's a big difference if you create thousands of them. MFC uses maps to associate GDI entities with its own C++ objects, and this takes time/memory.
> I cannot create thousands of pens.
You don't need to create thousands of them *at once*.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
OK, there is difference. Yet, the internal GDI object is created regardless you use MFC or not. And it takes time and memory. I don't want to do "create and delete" system, because it would be slow and inefficient.
|
|
|
|
|
> I don't want to do "create and delete" system, because it
> would be slow and inefficient.
Before you call something 'slow and inefficient', try to *measure* its performance. On my old 333MHz box it takes less than 120 msec to perform this:
for (int j = 0; j < 10000; j ++)
{
HPEN hp = CreatePen(PS_SOLID, 1, RGB(j % 255, j % 255, j % 255));
SelectObject(hdc, hp);
MoveToEx(hdc, j, 0, NULL);
LineTo(hdc, j, 1);
SelectObject(hdc, GetStockObject(NULL_PEN));
DeleteObject(hp);
}
It's roughly 83300 pens per second. Are you sure that pens are *real* bottleneck in your program?
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Doesn't every single CreatePen, DeleteObject pair fragment memory?
I suppose it does.
BTW 120 ms is pretty long time .
|
|
|
|
|
> Doesn't every single CreatePen, DeleteObject pair fragment
> memory?
I doubt there's any significant performance hit. Many programs create and destroy pens/brushes during each WM_PAINT processing. GDI must deal with this.
> BTW 120 ms is pretty long time
For 10000 cycles? I don't think so. How much time does it take to compute data points you're going to visualize?
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I'm not very certain about this, but I believe there's no memory fragmentation,
because Windows allows a fixed number of GDI resources (am I right ), so there must be an efficient way of handling them. I don't think the system allocates and frees memory every time you create a pen.
Any comments?
|
|
|
|
|
Wow - this is quite a lengthy conversation you two have had. My 2 cents worth, which is just over 1 cent, US.
1/ You *can* use DrawSolidRect and pass in a colour to draw a line without creating a pen, but the API will just create one internally.
2/ There is *no* way that 'thousands' of different line colours will be visible to the naked eye unless they form a gradient and the interaction between them is the point. The only other reason to do this would be colour keying
3/ MFC is a thin wrapper for the API - look at the code and it more often than not calls an API function directly. CPen is just a wrapper that helps prevent memory leaks.
4/ Windows does have finite GDI space, and you will find that unless you are careful handling all these pens and deleting them properly you will find your system will go down. I strongly recommend running the resource meter while you work on this code. This is also why I would not recommend pre-creating your pens in memory.
5/ The other option if you feel so strongly about it is to grab a DIBSection wrapper to help you get access to the bits and set the pixel data yourself. No CPens or HANDLEs needed, just an implimentation of the Bresenham algorithm, which is pretty simple stuff.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
You could try using GDI+, its in beta 2 and not too long before is public release.
It requires only 1 DLL to be deployed with your application.
It is supported on all operating systems apart from Win95.
You'll coverage in Februarys 2001 Platform SDK.
I've started implementing GDI+ in my commercial applications which are due out in last quarter 2001, thats how much faith I have in GDI+.
Hope this helps
Norm
|
|
|
|
|
Is it "must pay"?
Where it can be obtained and how it can be used in my application?
Thanks.
-Mato
|
|
|
|
|
Nope, you can redistribute free of charge.
heres a snippet of GDI+
Pen blackPen(Color(255, 0, 0, 0), 5);
graphics.DrawRectangle(&blackPen, 10, 10, 100, 50);
See Christian Graus's article on GDI+, they should tell you everything need to know to get started.
|
|
|
|