|
I use the following code (which works as well)
COleVariant vSend = sMessage;
m_pMSComm->SetOutput( vSend );
You will have to watch out with the GetInput function though! I noticed there can be a huge memory leak if you use the variants the wrong way. You shouldn't not do it like this:
COleVariant vInput = m_pMSComm->GetInput();
CString sBuffer = vInput.bstrVal;
but like this:
COleVariant vInput.Attach (m_pMSComm->GetInput());
CString sBuffer = vInput.bstrVal;
Structured programming vs. chaotic mind boggling
|
|
|
|
|
Thanks alooooot, i found some good notice in your message.
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Do anyone know of any library that can load different file formats like TIFF, JPEG etc. I need that urgent in my appl
|
|
|
|
|
There's a free source code library at http://www.paintlib.de/paintlib/. I've succesfully used it in an MFC/Visual C++ project. Hope this helps.
- Peter H. Helmers
phelmers@rochester.rr.com
|
|
|
|
|
And if you want Targa, we wrote that for paintlib ages ago, but they seem to be slow in version releases nowadays. The mailing list also seems to have died. A shame, because it was very good, it still does a lot of stuff GDI+ does not do natively ( although as I wrote a lot of the filter classes especially ( also not in, if you want 3x3 spatial, gamma, colour, contrast, email me )), although I don't expect it will be too hard to write my own in GDI+.
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 am developing a project and is not decided what Database connectivity to use. ODBC or ADO. Can anyone tell me the pros and cons of both..
I am an amatuer and would like help in this.
|
|
|
|
|
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 .
|
|
|
|