|
It seems you are doing two things in the while() loop. Why not separate the "add images to list" and "add items to control" into two while() loop? If that is not feasible, then you might want to consider a secondary thread for this so that the UI remains responsive.
Another thing to try would be to call SetRedraw(FALSE) before the "add items to the list" code.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Because by seprating, the mapping of file and image is a little hard to find when I forgot the code.
SetRedraw(FALSE) might be a good try.
Thanks for you suggestion.
|
|
|
|
|
this is part of my code.
and i am making some drawing line.
first, i put my left_mousebutton then point is displayed,
but the line don't draw~
it is good if i delete "WM_LBUTTONUP".
can you tell me why this happen?
HDC hdc;
PAINTSTRUCT ps;
static TCHAR str[200] ;
int len;
static int x = 100;
static int y = 100;
static bool b_start = false;
case WM_LBUTTONDOWN:
x = LOWORD(lParam);
y = HIWORD(lParam);
b_start = true;
return 0;
case WM_MOUSEMOVE:
if(b_start == true)
{
hdc = GetDC(hWnd);
MoveToEx(hdc, x, y, NULL);
x = LOWORD(lParam);
y = HIWORD(lParam);
LineTo(hdc, x, y);
ReleaseDC(hWnd, hdc);
}//b_start == true
case WM_LBUTTONUP:
b_start = false;
return 0;
}//iMessage
return (DefWindowProc(hWnd, iMessage, wParam, lParam));
}//LRESULT
Thank you everyone~
|
|
|
|
|
|
Perhaps you forgot to put a 'return 0':
case WM_MOUSEMOVE:
if(b_start == true)
{
hdc = GetDC(hWnd);
MoveToEx(hdc, x, y, NULL);
x = LOWORD(lParam);
y = HIWORD(lParam);
LineTo(hdc, x, y);
ReleaseDC(hWnd, hdc);
}//b_start == true
// <----------------------------------- H E R E
case WM_LBUTTONUP:
b_start = false;
return 0;
Only fools rush in. Foo!
|
|
|
|
|
it is working when i put return 0, ~
thank you~~
Thank you everyone~
|
|
|
|
|
Hello. I've been tasked with getting data off of a web page. Thanks to CodeProject I've made great strides, but I now seem to have hit an impasse. When I get to my URL I get the body of the document with the following code:
hr = pHTMLDocument2->get_body( &pElem );
if ( hr == S_OK && pElem != NULL )
{
pElem->get_innerText(&bstr);
CString strInnerText = bstr;
ScrapeFuturesSettlementData( strInnerText );
}
strInnerText has all of the data I need, but I can't break it down into specific rows and, what's worse (I've got a workaround for that issue) some of the data has no delimiter between entries, so I don't know where one entry begins and the other ends. Has anybody encountered anything similar? Thanks.
Tom Paronis
|
|
|
|
|
Did you see my link on your previous question?(I think it was before December )
|
|
|
|
|
Yes I did and it's what's gotten me as far as I am now. Thanks again! Now I'm trying to wrestle with a great mass of HTML data. Part of the problem is that I'm a HTML neophyte, but I think I'm getting pretty close to what I want. What I'm doing is sort of cumbersome C++ parsing and I was wondering if there was some easy way to just pluck the rows I want instead of iterating through the whole document. If there is I haven't found it yet, despite lots of searching.
Tom paronis
|
|
|
|
|
hi,
i would like to use exception handling as a non local goto mechanism so i can implement tail calls, but its very slow (msvc 7.1, release build).
can anybody tell me why, whether this is a blind alley, and how to speed things up if it isn't?
cheers
jono
day-one.com
code follows:
====================================================================================
#include <iostream>
enum{SZ=1000};
int integers[SZ];
using std::ostream;
using std::cout;
struct Continuation
{
Continuation(int cont)
:cont_(cont)
{}
int cont_;
};
ostream &tail_call_helper(ostream &os, int &i)
{
os << integers[i++] << ' ';
if(i < SZ)
{
throw Continuation(i);
}
else
{
// do nothing
}
return os;
}
ostream &tail_call_(ostream &os)
{
int i = 0;
while(true)
{
try
{
tail_call_helper(os, i);
}
catch(Continuation c)
{
i = c.cont_;
continue;
}
break;
}
return os;
}
int main(int argc, char* argv[])
{
tail_call_(cout);
return 0;
}
|
|
|
|
|
Hi,
the first exception when running under Visual Studio is extremely slow.
All others are just slow, because they need to create an exception object (which includes
a stack traceback), then scan the stack for a matching catch.
After all, exceptions are intended to take care of the exceptional case;
for normal cases yes they are a blind alley.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
thanks for that Luc.
so, any suggestions then? i seem to recall doing something similar to this with setjmp and longjmp a few years ago, but i'd be loath to try it with my boost heavy code.
i'd be interested in any good resources on tail calls in C++. i've found one or two online, but after the first paragraph the discussion degenerates into 'real' languages like lisp & scheme, lol.
cheers
jono
|
|
|
|
|
pretty simple question, I got the following error message when linking. any one can help on it?
Linking...
mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in Reset.obj
mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in Reset.obj; second definition ignored
Creating library Debug/Reset.lib and object Debug/Reset.exp
Debug/Reset.dll : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
this is a MFC DLL. If I want to change the link order, the error message only gives me "mfcs42d.lib" and "Reset.obj", doesn't give me the 2nd lib file from "Reset.obj". what shoudl I do? thanks a lot!
modified on Wednesday, December 05, 2007 6:21:19 PM
|
|
|
|
|
I just tried to comment the DllMain() in my cpp file. it passes the link, but I'm not sure it's correct or not. any one can help on it? thanks a lot!
|
|
|
|
|
|
|
I am trying to remove a dll from my project.
There are no more linkages to it within the code. However, if I remove the DLL it bitches when I try to run it. I know I don't need the DLL anymore because I even removed all the exports from the problematic dll and the app still runs.
When I first start to debug it give me the line Loaded symbols for ".....mydll.dll"
I would assume it is just the debugger trying to be cute and load up debug information for my project. Is there a way to clean out its need for this dll?
This is all done with Visual Studio 6 and written in C++.
|
|
|
|
|
After four hours of banging I figured it out.
In the project settings under the Debug tab switch the category to Additional DLLs.
Once that category is selected the list of dlls that get loaded at the beginning of a debug session is listed.
I don't know if I put those lines in there or if the system did, but upon them everything seemed fine. In what file do these settings reside? I looked through the .dsp via text editor and saw nothing of this.
Thanks
|
|
|
|
|
thats why, i prefer the pragma for including dll!(Statically linkage)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
Is the format of the map files produced by Visual Studio documented anywhere? I'm working on a program to find dead code by analyzing map files, and am discovering that there is not much information describing some of the entries. for instance, entries in the address section of the file that start with ? are decorated C++ function names. Entries that start with ??, however, seem to be something different.
|
|
|
|
|
In a bigger project I found a strange behavior between GDI and GDI+. Drawing some lines with the same coordinates the GDI+ -lines where drawn a little bit lower than the GDI-lines. You can see this after a big zoom (5000 x), see OnInitialUpdate().
I created a MFC-C++ project with a single ScrollView to check this.
If you want to check my project or you have an answer, please send me a mail to
Johannes.Swida@t-online.de
thanks
Code:
void CgdiPlusTestView::OnDraw(CDC* pDC)
{
CgdiPlusTestDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
// draw some lines and a rectangle with alfa-components
SolidBrush cBrush(Color(128, 192, 192, 192));
Pen cPen(Color(255,255, 0, 0),1);
int ii,i;
Point cP[5];
HDC hdc=pDC->m_hDC;
// GDI+
Graphics graphics(hdc);
ii=graphics.SetPageUnit(UnitDisplay);
cP[0].X=295250; cP[0].Y=-506212;
cP[1].X=506559; cP[1].Y=-53058;
cP[2].X=493441; cP[2].Y=-46941;
cP[3].X=282132; cP[3].Y=-500095;
cP[4]=cP[0];
// GDI+ lines and rectangle are together
ii=graphics.FillPolygon(&cBrush,cP,4,FillModeAlternate);
for(i=1;i<5;i++) ii=graphics.DrawLine(&cPen,cP[i-1].X,cP[i-1].Y,cP[i].X,cP[i].Y);
// GDI lines are moved ???
for(i=1;i<5;i++) {
pDC->MoveTo( (int)cP[i-1].X, (int)cP[i-1].Y);
pDC->LineTo( (int)cP[i ].X, (int)cP[i ].Y);
}
}
void CgdiPlusTestView::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
CSize sizeTotal;
// TODO: Gesamte Größe dieser Ansicht berechnen
sizeTotal.cx = 1485000;
sizeTotal.cy = 1050000;
SetScrollSizes(MM_HIMETRIC, sizeTotal);
}
|
|
|
|
|
I'm trying to compile some code that uses _vsnprintf, and I'm getting errors from the compiler about :
1>regerror.c
1>c:\program files\microsoft visual studio 9.0\vc\include\stdio.h(358) : error C3163: '_vsnprintf':
attributes inconsistent with previous declaration
1> c:\program files\microsoft visual studio 9.0\vc\include\stdio.h(350) :
see declaration of '_vsnprintf'
I have _CRT_SECURE_NO_DEPRECATE, _SCL_SECURE_NO_DEPRECATE, and _CRT_NON_CONFORMING_SWPRINTFS defined.
The code uses it like so:
va_init_list(args, (char* )fmt);
n = vsnprintf((char* )buf, bufsize, (char* )fmt, args);
va_end(args);
where "vsnprintf" is actually a macro defined as :
#define vsnprintf _vsnprintf
To the best of my knowledge this has worked fine with *all* previous compilers MS C++ compilers, so I'm stumped at what to do here.
Bah!! Turns out there is now a vsnprintf function, so it's a non-issue - I just needed to comment the #define out for VC9 compilers.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
modified on Wednesday, December 05, 2007 11:33:23 AM
|
|
|
|
|
Jim, how have you solved it ?
what was the problem actually ?
|
|
|
|
|
I am developing an application that is trying to backup (BackupRead, BackupWrite) a file from the network. The process has SE_RESTORE_NAME and SE_BACKUP_NAME privileges set. Creating the backup file is successful but I'm having problems restoring it. When I try to use GetFileAttributes on the folder in whitch I'm trying to restore the file, it fails and GetLastError returns ERROR_INTERNAL_ERROR (1359) for a network share with full access to everyone and returns ERROR_PATH_NOT_FOUND (3) if the share is mounted as a mapped drive. I also cannot create files from my program, but I can create them in windows explorer.
Are there more privileges that I need to set? Am I doing something wrong?
Please help
|
|
|
|
|
Hi All,
What I'm trying to do is implement in c++ a routine that loads another programs icon without loading that program. What api does windows explorer use to do it?
Any help would be greatly appreciated
Regards
RichardS71
|
|
|
|
|