|
VC7.1 you mean? VC7 can't for christs sake even handle PTS!
|
|
|
|
|
Mike Nordell wrote:
VC7.1 you mean? VC7 can't for christs sake even handle PTS!
I reckon I should know what PTS is but ...???
Is there such as beast as VC7.1?
STL, Boost, Loki et.all are all wonderfull stuff for our toolkit, but without compilers that are able to use them all we can do is sit and drool and wait impatiently.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
I reckon I should know what PTS is but ...???
Partial Template Specialization. For instance:
template <typename A> class MyTemplateClass{...};
template <> MyTemplateClass<int>{...};
template <typename A> MyTemplateClass<A *>{...};
Is there such as beast as VC7.1?
This is an internal version codenamed Everett (I think) which allegedly supports PTS. MS says it'll be released by February 2003.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
I reckon I should know what PTS is but ...???
Partial Template Specialization. For instance:
Yes of course. I knew it would be something obvious.
Joaquín M López Muñoz wrote:
Is there such as beast as VC7.1?
This is an internal version codenamed Everett (I think) which allegedly supports PTS. MS says it'll be released by February 2003.
I thought the folks working on Loki at Sourceforge had a complete imlementation for VC7, and I thought Loki required PTS, but it seems like I'm wrong somewhere along the line.
It is really surprising that a company the size of MS is taking so long to get issues like PTS handled in their compiler.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
The group on Sourceforge is working on porting Loke to VC6 --take a look at the project CVS respository. I don't know how much has been ported so far.
Some of the concepts discussed in Loki are implemented under various forms in Boost, notably functors. I think Boost is a more reliable library to use: continuous support, has been ported to many more platforms, appears more stable.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Last time I looked only a very small part of Loki had been implemented for VC6 and I was told that their wasn't much more they could do because of the VC6 compiler limitations we all know about.
I bought "Modern C++ Design" a few months back and got quite excited reading it, only to be let down by the inability to actually use it.
It sure would be great if someone would write a nice big reference + examples book for Boost.
I'll follow your suggestion and focus on Boost, and I guess STLPort.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
Forgive me if this is a dumb question I am very new to thread programming.. I have read a bunch of the articles here on code project about threads.. I want to do the following in a thread but the problem is that I need to pass the thread or start the thread with 3 vars "CString strPath, CString strDns, int nPort"... heres the snip of code that I am using to send a file.
I have tried to create a thread to do the following but it crashes every time..
Anyone have any ideas how I can do the following inside a thread??
CFile myFile(strPath, CFile::modeRead | CFile::typeBinary);
CSocket sSocket;
sSocket.Create();
int iConnect = sSocket.Connect(strDns,nPort);
if(iConnect == SOCKET_ERROR)
{
AfxMessageBox("Communication Error!");
}
else
{
CSocketFile sf(&sSocket);
CArchive ar(&sf, CArchive::store);
DWORD length = myFile.GetLength();
char *data = new char[length];
myFile.Read(data, length);
ar << myFile.GetFileName();
ar << length;
ar.Write(data,length);
myFile.Close();
delete[] data;
}
Thanks!
|
|
|
|
|
I do not see where you create a worker thread. Where does the thread begin?
Use a worker thread.
Kuphryn
|
|
|
|
|
I have tried a few different ways to create the thread but all result in the same type of errors.. here is one example that i used, but i cant pass the thread any variables.. I can just start it and stop it..
Header..
static UINT run(LPVOID p);
void run();
volatile BOOL running;
void CMyView::TransferFile()
{
running = TRUE;
AfxBeginThread(run, this);
}
UINT CMyView::run(LPVOID p)
{
CMyView * me = (CMyView *)p;
me->run();
return 0;
}
void CMyView::run()
{
running = FALSE;
}
|
|
|
|
|
Consider a global thread function. Otherwise, make run() a static function.
Kuphryn
|
|
|
|
|
If I make run() static.. how can I access member functions from CMainFrame? Or is that a "no-no"?
|
|
|
|
|
You may access the static member function via :: operator.
Kuphryn
|
|
|
|
|
This looks ok to me and is the sort of thing I do in ED. I wouldn't have called both functions run though, but that is besides the point. Also don't use the old C style casts in C++. I assume the view exists for the duration of the thread function. Where precisely does it crash?
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
it crashes on the Create() of the CSocket object.. I just implemented a CWinThread class and I am trying to do the same thing with in that class because someone stated that I need a UI thread instead of a worker thread.. I guess CSocket needs a Message Pump.. but now I am still having the same problems it still crashes on the Create function.. I posted another question in the forum because I changed the code so much.. I have a feeling that the CSocket needs to be attached to the thread but I am having no luck.. Any ideas?
|
|
|
|
|
I'm afraid I can't help much with CSocket as I've never used it. That said if you look in the debugger at the error it should give you a very good idea of what the problem is. Looking at the MFC code my guess is something in CAsyncSocket::AttachHandle() is ASSERTing.
I'd be surprised if there wasn't code which used CSocket in a thread here on CP. Maybe spend some time looking at the articles in the relevant section.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
Thanks for all the suggestions.. I am going to trace the error codes for CSOcket and see what type of error i am getting from the create function.. I tried to create the socket in my main thread and pass the handle to the thread but the socket in the thread gives me a invalid socket.. anyway, I'll do some more testing, its probably just something dumb on my part..
Thanks!
Rob
|
|
|
|
|
// setowner.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream.h>
#include <windows.h>
#include <tchar.h>
#define ErrorHandler(s) _ErrorHandler(s, __FILE__, __LINE__)
void _ErrorHandler(LPCSTR lpszLocation, LPCTSTR lpszSrcFile, UINT nSrcLine)
{
LPVOID lpMsgBuf;
DWORD dwError = GetLastError();
FormatMessageA(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
dwError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPSTR) &lpMsgBuf,
0,
NULL );
// Process any inserts in lpMsgBuf.
cout<<"ERROR @ "<
|
|
|
|
|
ive seen a lot of application create .exe from the main application, and not just one, i mean after a serie of choices u can do that.
To make myself clear, im not talking about adding a single exe to the ressource and reading it than writing it in a .exe file.
I meant after a series of tests or choices i want to be able to generate a custom .exe
Hope this is clear enough, and thanks in advance for any tip or help!
Johnny
|
|
|
|
|
See this[^] for informations about PE file format (Win32 exe).
Pavel
Sonork 100.15206
|
|
|
|
|
Thanks a lot, ill read through it!
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Hello,
I am using a function called IDiscMaster::GetPath(). This function is returning the OS path like for CDRom its \Device\CDRom0. How can I find out that this path is mapping to which drive. Like I want to findout whether this \Device\CdRom0, is mapping to drive A:\,B ... so on.
Please, help if someone has any idea.
Thanks,
|
|
|
|
|
QueryDosDevice. Though, I think you can only use a drive letter to get an NT object name, meaning you'll have to loop all drive-letters until you find a match.
|
|
|
|
|
I want to receive some bitmap from client with socket. How i can start?
|
|
|
|
|
Start developping the Client server first, then u can just read the bitmpap file and send it to the server and its the job of the server to rewrite the bitmap file !
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
This is answered in this forum before, you can try search the forum!
But, to send a bitmap you just read the bitmap file in binary mode and then simply send(bitmap_data,...) !
or something!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|