|
Without attachments but with To,CC, subject and body:
ShellExecute(NULL,"open","mailto:doctorpi@codeproject.com?cc=doctorpi@home.com&subject=Information&body=about opening default mail client",NULL,NULL,SW_SHOWNORMAL);
Peter Molnar
|
|
|
|
|
You do have the grasp on this; only you need to re-read your own message again: when you push something into a vector, a copy of whatever you push gets created. In your case, that is a copy of the pointer, not a copy of the object pointed to.
The offending delete call destroys the object, causing subsequent attempts to use the (now) stale pointer from the vector to go haywire.
Solution: Do not store the pointer to the object but the object itself; or store the pointer and make sure to delete as and when appropriate. That is, delete exactly once after the last use of the object in question.
Good luck,
Bernd
|
|
|
|
|
Right, you "copy" the pointer, but you don't copy what the pointer points to. If you call delete on pImageDisplay, then it deletes the CImageDisplay object, thus causing pImageDisplayVector[i] to point to unallocated memory. In other words, don't call delete until you're done with pImageDisplayVector. Just let pImageDisplay go out of scope. Then, in the destructor of whatever object pImageDisplayVector is part of, iterate through pImageDisplayVector calling delete on each item. This will destroy everything that's suppose to be destroyed.
|
|
|
|
|
Your responses really explained the situation! I was quite confused, thinking I had made a copy of the image itself, not just the pointer.........so actually deleting the vectorElement[i] will take care of freeing the memory on the heap since both were pointing to the same thing.. Many thanks for the clarification,
ns
|
|
|
|
|
Hello everbody. I have a strange problem. When I compile my dll (with Visual Studio .NET 2003) in Release the compiler give me those strange errors in linking:
error LNK2005: ___CppXcptFilter already defined in msvcrt.lib(MSVCR71.dll)
error LNK2005: ___xc_a already defined in msvcrt.lib(cinitexe.obj)
error LNK2005: ___xc_z already defined in msvcrt.lib(cinitexe.obj)
error LNK2005: ___xi_a already defined in msvcrt.lib(cinitexe.obj)
error LNK2005: ___xi_z already defined in msvcrt.lib(cinitexe.obj)
error LNK2005: __amsg_exit already defined in msvcrt.lib(MSVCR71.dll)
error LNK2005: _atoi already defined in msvcrt.lib(MSVCR71.dll)
error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup
The project property is the same that in debug. I don't know what is the problem. The fact is also more strange because if I compile in Release with another PC the compilation will succeed. The version of the Visual .NET is the same, but I don't know what are the differences.
Can you help me ?
Thank you very much for any answer.
|
|
|
|
|
Interesting.
Recheck project properties and make sure the DLL is set for multithreading and for dynamic linking.
Kuphryn
|
|
|
|
|
In order to link your project with any library I would reccomend you to use
#pragma commment(lib,"yourlib");
instead of adding libraries over Project/Properties/Linker/Additional dependencies, because #pragma's apply to both release and debug build settings, and therefore there is less chance that you forget to link with libraries in either build.
Peter Molnar
|
|
|
|
|
Thank you very much for the answer. I find the problem. I have a library linked to my dll and, in Release, it was too old. After a rebuild, all work right.
Thanks
|
|
|
|
|
Hello all,
I want to notify thread1 to end by itself. I don't like to use the function TerminateThread() to do this job. But thread1 is a worker thread not a UI thread so it doesn't have a message queue. I can't send some messages to it.
How can I do?
Thanks a lot
|
|
|
|
|
Well, if the worker thread waits for an event with WaitForSingleObject then
add one more event for quit event and then set that event by using SetEvent.
The thread should wait for signal from one of the both events by using
WaitForMultipleObjects API.
|
|
|
|
|
Thanks Dudi, I get an idea now.
|
|
|
|
|
Further to a recent discussion thread, I can now stream RGB type formats across a propriatory link and render the image remotely. This proves the concept, however RGB encoding is large so have shifted to H263 encoding and decoding. But of course it isn't generating a picture at the other end :-/ !!
The other end uses Graphedit with the appropriate decoder in place.
When I send the IMediaSample from the sending end I used to just send the sample length and the sample itself, I now also send the Synch , Preroll, discontinuity and Start Stop Reference times to ensure the MediaSample I generate at the other end is representative, ie prior to going into the H263 decoder... but no joy.
Has anyone attempted the same thing and had problems with H263 (have also tried H261) or got any ideas?
Many Thanks
Loz
|
|
|
|
|
hi all,
am stuck with a crucial and interstng problem.
if anyone can help in solving TSP(Travelling sales person) problem using the Branch and Bound Algorithm.?
thanks
Deepesh Dhakad
Indian Institute of Information Technology,Allahabad
India
|
|
|
|
|
Have you seen:
http://www.math.princeton.edu/tsp/
http://www.cs.rutgers.edu/~chvatal/tsp.html
http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=traveling+salesman&btnG=Google+Search
http://www.nist.gov/dads/HTML/travelingSalesman.html
http://www.cis.ohio-state.edu/~gurari/course/cis680/cis680Ch20.html
http://www.idsia.ch/idsiareport/IDSIA-09-02.pdf
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hello folks.
I'm currently porting TCP/IP server program from UNIX framework. It uses classical scheme "one connection - one child process". Here's the code snippet:
retval=select(backend+1,&rfds,NULL,NULL,&tv);
if(retval>0) {
if(FD_ISSET(backend,&rfds)) {
if(peer=accept(blablabla)==0) {
if((pid=fork())!=-1) {
/* this is the child */
/* and he processes
* the request */
}
/* father skips the above section and fetches the next connection */
}
How do I implement this in Windows ?
fork() is absent, only spawn() which is
unusable here. Doing everything in single
process (even threaded) is not an option for me. How's the classical Windows internet server works ?
Max.
|
|
|
|
|
You don't: in *nix, this is a common practice, but in Windows, this is horrible, because processes have a overhead much greater than threads. So, in Windows we don't fork(), we CreateThread().
IOW, you won't see lots of httpd running on a Windows web server machine, you'll see a single inetinfo.exe.
Actually, if you need to port a *nix application to Windows, I strongly suggest you to use the free Cygwin, which, among other things, will give you fork().
On MSDN website there's an article series somewhere with guidelines and tips on porting *nix programs to Windows. I strongly suggest you to read it.
Trying to make bits uncopyable is like trying to make water not wet.
-- Bruce Schneier
By the way, dog_spawn isn't a nickname - it is my name with an underscore instead of a space. -- dog_spawn
|
|
|
|
|
The very highest performance Windows server applications don't create a thread for each request, they use a pool of pre-created threads which wait for requests to arrive. This can be done using the completion port API.
I suggest consulting Jeffrey Richter's book Programming Server-Side Applications for Windows 2000.
|
|
|
|
|
Mike Dimmick wrote:
The very highest performance Windows server applications don't create a thread for each request, they use a pool of pre-created threads which wait for requests to arrive
In the same way highest performance *nix servers don't fork() a CGI on every request and keep a pool of pre-forked processes.
Trying to make bits uncopyable is like trying to make water not wet.
-- Bruce Schneier
By the way, dog_spawn isn't a nickname - it is my name with an underscore instead of a space. -- dog_spawn
|
|
|
|
|
One other and probably worse way than writing as a windows process is to use the POSIX library MS has for Windows NT Systems which allows you to use your existing Unix code to create and run applications.
|
|
|
|
|
Hello everyone!
I'm a college student I'm writing a program for my faculty, and I meet with some bottleneck here:
it's a demonstration of some particles moving around, and I do it like this: a timer call InvalidateRect every 50ms, and in OnPaint, I call a function updates the particles' positions and redraw the whole scene, it was ok, but after I add some texture mapping on the experiment devices, the speed becomes unbearably slow, I think redrawing the whole scene rapidly cost much resource, but I wonder how those 3D games make it? For examp, in a tank game, when a tank fires a bullet out, don't it need to redraw the whole scene?
So I need some help to boost my program's performance here ...
Thank you ahead!
|
|
|
|
|
Try using DirectDraw is perfect and easy to use for animations. And it goes fast because it draws directly on mem of graphical card. You can load all different bitmaps on the graphical card mem and just blit them where you want them. No need to redraw the whole bitmap every time.(The MSDN library contains all help needed to start drawing with DirectDraw component...).
Check out double buffering too in order to prevent flashing of the screen and have a more smooth animation(actual drawing happens in background)...
Greetz,
Davy
PS:when tank fires bullet only the minor part where the bullet was and where the next position of the bullet is is redrawn, not the whole scene!! Would indeed be an enormous speed loss if the whole scene would be redrawn...
|
|
|
|
|
I think it's too late for me to turn to DirectX, but next time I'll try it. Thank you all the same!
|
|
|
|
|
Hi All
does ne1 know the ascii code for the "Return Key" or where
i could find a list of ascii codes
thanks
simon
|
|
|
|
|
VK_RETURN is defined as 0x0D
You can check out the Winuser.h file which has a list of virtual keys defined, not
just return key..
Greetz,
Davy
|
|
|
|
|
Search in the index of msdn for "ascii character codes chart" and it will display both charts for ascii 0 - 127 and 128 - 255.
|
|
|
|