|
Copy the .dsw file. It is VERY VERY important.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
One day when I splitted horizontally a single .cpp file to code, the caret got crazy (I pressed BACKSPACE for the intension to delete line one, and some other characters far away at line six got eaten). Just that specific project happened to this strange condition, all other projects of mine were still normal. Therefore, I deleted the .dsw file, and everything got normal again finally... All the project settings of this project were still there, like : preprocessor definitions, imported modules, optimization options... Nothing got lost!
I read MSDN after having read your msg, MSDN says dsw has the relation with SourceSafe. I don't use it... And MSDN says dsw stores the project settings.
But I doubt it after testing. You may define some preprocessor definitions like _MY_DBG, save the settings, and then delete .dsw. When you reopen the project, you see _MY_DBG still is there!
Maxwell Chen
No code is good code.
|
|
|
|
|
By the way, if your app loads some external files dynamically, as .dll, .AVI, .MP3, .BMP, .JPG.... You must keep them!
And if you import some others DLL statically, you need that .H and .LIB to compile and link. Keep that .LIB and .DLL also.
Maxwell Chen
No code is good code.
|
|
|
|
|
Thx
It works, but I left the .dsw, since it is a little file .
The inline autocomplete-sh*t works fine, though.
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
frisco wrote:
The inline autocomplete-sh*t works fine, though.
You mean CompleteWord found in the menu Edit->CompleteWord ?
That works fine...
Maxwell Chen
No code is good code.
|
|
|
|
|
It didn't work anymore after I had copied the project to another machine, although the option was still enabled.
Now it works. So I guess you can't copy too much files.
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
I am porting an application from Unix to Windows NT. The complete
application consists of one executable built with FORTRAN source code and
Unix shell scripts. I have already built a console application with the
FORTRAN source code and the Unix shell scripts have been converted to Perl
scripts.
Problem : The original shell scripts is setting some environment variables,
which are looked for by the executable. One of the variables is set to
the value returned by a Unix utility 'tty'. This utility on Unix displays
the terminal name. The problem I am facing is that the Fortran
executable is opening with the filename specified as this terminal name. The
subsequent READ and WRITE statements using the Unit
pecifier,( specified with the open statement while opening this terminal)
are now directed to this terminal. Since there is no such utility as 'tty'
on Windows, what I need to work out is same logic in which the open
statement should open a unit directed to CONSOLE. The following subsequent
READ and WRITE statements with the Unit specifier, as specified in the
open statement while opening file directed to CONSOLE, should now
read and write on the CONSOLE.
What I have tried : I have already tried the following.
Given open statements with File name specified as 'CON', 'USER',
'CONOUT$' and 'CONIN$'. While the subsequent WRITE statements are
successful for the first three and the READ statements are failing, the READ
statements are successful for the last one and WRITE statements fail.
Please let me know how can I work out a solution for this. How can I achieve
the similar functionality for the application when ported to Windows NT.
Nitin Shukla
|
|
|
|
|
I don't know any FORTRAN (hence, I don't know the details of the READ and WRITE statements you speak of), but in a console app on Windows STDIN and STDOUT is the console being used to run the app (unless not called from the console, but that's another story). You can perform any read/write operation you need to.
Jeremy L. Falcon
"You do not know the power of the dumb side."
<nobr>
Homepage : Sonork = 100.16311 Maybe my mangling might misguide malicious miscreants momentarily?
|
|
|
|
|
Hi!
Recently I have started learning API/WIN32 from a certain book .
I m very unpleased from the way Threads are explained.
not so clear.
I would like to get a recommandation for a good and comprehensive book/tutorial
on this subject
Thank You so much !
Eynat S
Have a good day!
|
|
|
|
|
|
|
Dear Friends,
I would like To Send my "Case" Object From One Client To Any Other Clients (whom I would Target To) Through My Server.The Server is to be Multithreaded.I would like to Use CSocketFile Class to make the Transfer from Client To Server And Then ,from Server To Other Client(s).
I am Presenting My "Case" Class , to enable you to help me better.I would like to know which Classes I need To Build and where.I am very new to Socket Programming,I need the Architecture.
Class CCase
{
protected:
char CaseID[10];
char CaseName[20];
int ConsultationCount;
public:
char* GetCaseID();
void SetCaseID(char NewCaseID[10]);
char* GetCaseName();
void SetCaseName(char NewCaseName[20]);
int GetConsultationCount();
void SetConsultationCount(int NewConsultationCount);
};
Also, Apart From the Above declarations,my Case Class Also Contains some objects (of Other Classes,I used) as members.
Just Have A Look At My Code :
*************************************************************
//Case.cpp
IMPLEMENT_SERIAL (CCase,CObject,1)
void CCase::Serialize(CArchive& ar)
{
CObject::Serialize (ar);
if(ar.IsStoring ())
{
ar.Read (this->CaseID ,20);
ar.Read (this->CaseName,20);
ar.Read ((void*)this->ConsultationCount,100) ;
ar.Flush ();
}
else if(ar.IsLoading())
{
ar.Write (this->CaseID,20 );
ar.Write(this->CaseName ,20);
ar.Write ((void*)this->ConsultationCount,100 );
ar.Flush ();
}
}
char* CCase::GetCaseID()
{
return this->CaseID ;
}
void CCase::SetCaseID(char NewCaseID[10])
{
strcpy(this->CaseID ,NewCaseID);
}
char* CCase::GetCaseName()
{
return this->CaseName ;
}
void CCase::SetCaseName(char NewCaseName[20])
{
strcpy(this->CaseName ,NewCaseName);
}
int CCase::GetConsultationCount()
{
return this->ConsultationCount ;
}
void CCase::SetConsultationCount(int NewConsultationCount)
{
this->ConsultationCount =NewConsultationCount;
}
CCase::~CCase()
{
}
*************************************************************
//MyServer.cpp::InitInstance()
:
:
:
if (!ProcessShellCommand(cmdInfo))
return FALSE;
CSocket ServerSocket;
BOOL Created;
BOOL ListenStatus;
int nConnectionBacklog=5;
BOOL AcceptClientRequestStatus;
Created=ServerSocket.Create (20248,SOCK_STREAM,"200.200.200.44");
if(Created==FALSE)
{
AfxMessageBox("Could NOT Create ServerSocket!!!");
return FALSE;
}
AfxMessageBox("Successfully Created ServerSocket!!!");
ListenStatus=ServerSocket.Listen (nConnectionBacklog);
if(ListenStatus==FALSE)
{
AfxMessageBox("Unable To Listen On Port!!!");
return FALSE;
}
AfxMessageBox("Listening On Port 20248!!!");
CSocket ReceiveRequestSocket;
AfxMessageBox("Successfully Constructed Socket For Receiving Client Requests!!!");
AcceptClientRequestStatus=ServerSocket.Accept (ReceiveRequestSocket);
if(AcceptClientRequestStatus==FALSE)
{
AfxMessageBox("Could NOT Accept Client Connections!!!");
return FALSE;
}
AfxMessageBox("Successfully Accepting Client Requests!!!");
CSocketFile file(&ReceiveRequestSocket);
AfxMessageBox("Successfully Constructed File For Storing/Loading Client Requests!!!");
CArchive arIn(&file,CArchive::load);
AfxMessageBox("Successfully Constructed Archive Object For Loading The Socket File!!!");
CArchive arOut(&file,CArchive::store);
AfxMessageBox("Successfully Constructed Archive Object For Storing The Socket File!!!");
CCase theCase;
CCase *pCase;
theCase.SetCaseID ("CASE1");
theCase.SetCaseName ("STOMACACHE");
theCase.SetConsultationCount (10);
arOut.WriteObject((CObject*)&theCase);
AfxMessageBox("Case Object Sent!!!");
arOut.Close();
pCase=(CCase*)arIn.ReadObject(RUNTIME_CLASS(CCase));
AfxMessageBox("Case Object Received!!!");
// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
*************************************************************
//MyClient.cpp::InitInstance()
:
:
:
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The one and only window has been initialized, so show and update it.
CSocket ClientSocket;
BOOL Created;
BOOL Connected;
Created=ClientSocket.Create();
if(Created==TRUE)
{
AfxMessageBox("Client Socket Created!!!");
}
Connected=ClientSocket.Connect ("200.200.200.44",20248);
if(Connected==TRUE)
{
AfxMessageBox("Connection Established With The Server!!!");
}
CSocketFile file(&ClientSocket);
CArchive OB_IN(&file,CArchive::load );
CArchive OB_OUT(&file,CArchive::store);
CCase theCase;
CCase *pCase;
OB_OUT.WriteObject((CObject*)&theCase);
AfxMessageBox("Case Object Sent!!!");
pCase=(CCase*)OB_IN.ReadObject(RUNTIME_CLASS(CCase));
AfxMessageBox("Case Object Received!!!");
AfxMessageBox(pCase->GetCaseID());
AfxMessageBox(pCase->GetCaseName());
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
*************************************************************
Thanking You Very Much!!!
Warm Regards,
G.V.Bhaskar
|
|
|
|
|
Dear Friends,
I would like To Send my "Case" Object From One Client To Any Other Clients (whom I would Target To) Through My Server.The Server is to be Multithreaded.I would like to Use CSocketFile Class to make the Transfer from Client To Server And Then ,from Server To Other Client(s).
I am Presenting My "Case" Class , to enable you to help me better.I would like to know which Classes I need To Build and where.I am very new to Socket Programming,I need the Architecture.
Class CCase
{
protected:
char CaseID[10];
char CaseName[20];
int ConsultationCount;
public:
char* GetCaseID();
void SetCaseID(char NewCaseID[10]);
char* GetCaseName();
void SetCaseName(char NewCaseName[20]);
int GetConsultationCount();
void SetConsultationCount(int NewConsultationCount);
};
Also, Apart From the Above declarations,my Case Class Also Contains some objects (of Other Classes,I used) as members.
Just Have A Look At My Code :
*************************************************************
//Case.cpp
IMPLEMENT_SERIAL (CCase,CObject,1)
void CCase::Serialize(CArchive& ar)
{
CObject::Serialize (ar);
if(ar.IsStoring ())
{
ar.Read (this->CaseID ,20);
ar.Read (this->CaseName,20);
ar.Read ((void*)this->ConsultationCount,100) ;
ar.Flush ();
}
else if(ar.IsLoading())
{
ar.Write (this->CaseID,20 );
ar.Write(this->CaseName ,20);
ar.Write ((void*)this->ConsultationCount,100 );
ar.Flush ();
}
}
char* CCase::GetCaseID()
{
return this->CaseID ;
}
void CCase::SetCaseID(char NewCaseID[10])
{
strcpy(this->CaseID ,NewCaseID);
}
char* CCase::GetCaseName()
{
return this->CaseName ;
}
void CCase::SetCaseName(char NewCaseName[20])
{
strcpy(this->CaseName ,NewCaseName);
}
int CCase::GetConsultationCount()
{
return this->ConsultationCount ;
}
void CCase::SetConsultationCount(int NewConsultationCount)
{
this->ConsultationCount =NewConsultationCount;
}
CCase::~CCase()
{
}
*************************************************************
//MyServer.cpp::InitInstance()
:
:
:
if (!ProcessShellCommand(cmdInfo))
return FALSE;
CSocket ServerSocket;
BOOL Created;
BOOL ListenStatus;
int nConnectionBacklog=5;
BOOL AcceptClientRequestStatus;
Created=ServerSocket.Create (20248,SOCK_STREAM,"200.200.200.44");
if(Created==FALSE)
{
AfxMessageBox("Could NOT Create ServerSocket!!!");
return FALSE;
}
AfxMessageBox("Successfully Created ServerSocket!!!");
ListenStatus=ServerSocket.Listen (nConnectionBacklog);
if(ListenStatus==FALSE)
{
AfxMessageBox("Unable To Listen On Port!!!");
return FALSE;
}
AfxMessageBox("Listening On Port 20248!!!");
CSocket ReceiveRequestSocket;
AfxMessageBox("Successfully Constructed Socket For Receiving Client Requests!!!");
AcceptClientRequestStatus=ServerSocket.Accept (ReceiveRequestSocket);
if(AcceptClientRequestStatus==FALSE)
{
AfxMessageBox("Could NOT Accept Client Connections!!!");
return FALSE;
}
AfxMessageBox("Successfully Accepting Client Requests!!!");
CSocketFile file(&ReceiveRequestSocket);
AfxMessageBox("Successfully Constructed File For Storing/Loading Client Requests!!!");
CArchive arIn(&file,CArchive::load);
AfxMessageBox("Successfully Constructed Archive Object For Loading The Socket File!!!");
CArchive arOut(&file,CArchive::store);
AfxMessageBox("Successfully Constructed Archive Object For Storing The Socket File!!!");
CCase theCase;
CCase *pCase;
theCase.SetCaseID ("CASE1");
theCase.SetCaseName ("STOMACACHE");
theCase.SetConsultationCount (10);
arOut.WriteObject((CObject*)&theCase);
AfxMessageBox("Case Object Sent!!!");
arOut.Close();
pCase=(CCase*)arIn.ReadObject(RUNTIME_CLASS(CCase));
AfxMessageBox("Case Object Received!!!");
// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
*************************************************************
//MyClient.cpp::InitInstance()
:
:
:
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The one and only window has been initialized, so show and update it.
CSocket ClientSocket;
BOOL Created;
BOOL Connected;
Created=ClientSocket.Create();
if(Created==TRUE)
{
AfxMessageBox("Client Socket Created!!!");
}
Connected=ClientSocket.Connect ("200.200.200.44",20248);
if(Connected==TRUE)
{
AfxMessageBox("Connection Established With The Server!!!");
}
CSocketFile file(&ClientSocket);
CArchive OB_IN(&file,CArchive::load );
CArchive OB_OUT(&file,CArchive::store);
CCase theCase;
CCase *pCase;
OB_OUT.WriteObject((CObject*)&theCase);
AfxMessageBox("Case Object Sent!!!");
pCase=(CCase*)OB_IN.ReadObject(RUNTIME_CLASS(CCase));
AfxMessageBox("Case Object Received!!!");
AfxMessageBox(pCase->GetCaseID());
AfxMessageBox(pCase->GetCaseName());
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
*************************************************************
Thanking You Very Much!!!
Warm Regards,
G.V.Bhaskar
|
|
|
|
|
Hi there,
To allow the server app to forward received objects to other clients, you first need
to expand your server to allow multiple clients to connect. Just call ServerSocket.Accept() in a loop and store the returned CSocket (or derived) objects, one for each connected client, somewhere (you could use a CList for this).
I guess the easiest way to handle client requests is to derive a class from CSocket and pass instances of these objects to Accept(). By overriding the OnReceive() method (see CSocket's base class CAsyncSocket in the online docs), you can cause code to be executed then data is received from a client. Just receive the object like you did in your example and forward it to all other connected clients using the socket objects you stored.
You should also override the OnClose() method to remove socket objects from the socket list if the connection is being closed.
As an aside, you could change your CaseId and CaseName member variables of CCase to CStrings, which allows you to (de)serialise them using the << and >> operators, ie.
ar << CaseID << CaseName << ConsultationCount;
Hope this helps (and works )
Alwin
|
|
|
|
|
I need some information about the Media Player control (msdxm.ocx) which is about to be embedded in a MFC application.
Where should i look for it?
rechi
|
|
|
|
|
I believe that's related to DirectShow in MSDN.
|
|
|
|
|
Hi Ive got through those errors and made me files.
both named here
test.h
test1.h
Now I got everything ready i think. I tried to compile it, but it says this
[b]Cannot Compile the file 'C:\Windows\Desktop\Orbiternew\Orbitersdk\include/test.h';no compile tool is associated with the file extention.[/b]
Thats what it says, now i think i know im so close to compiling this file, andI would really like to finish it, can anyone please tell me what this means?
Thanks!
Kevin
================================================== I'm Almost ready to make my DLL, woohoo!
==================================================
|
|
|
|
|
You can't compile a header file, only a .cpp file. You can compile a project which includes a class all in a .h file, but not a .h file by itself.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
I was just wondering if there is an easy way of adding a tool bar in a dialog based Visual C++ program. I am wanting to code an FTP file browser program. Well not exactly an FTP file browser, but that is the only program that has already been produced by other people that I can compare it to so that you could possibly help me a bit.
Now from what I have seen of an SDI or MDI is that it would not be that suitable to what I am wanting to achieve. But the dialog based approach seems to be able to do everything that I will be needing, apart from a tool bar that I have found. Or maybe I am wrong and an SDI or MDI approach would be more suitable. Any help would be appreciated. Thanks
|
|
|
|
|
|
Hi,
my camera doesn't work with VidCap32 . It says
Device not properly installed.. What do i do..
Can i use Directx for taking a Shot from my
PC Camera.. Please help
I have to develop an app. to capture a shot from
my PC Camera (LG LPC-UC35)
Sameer
|
|
|
|
|
Hello!
I have a class called Process and each object of class project has two integer private data member variables:
priority and processID
I want to create a priority queue from the STL made up of Prcoess objects. How do I sort them according to their priority data member? I have a function called getPriority that all it does is 'return priority' of the object.
typedef priority_queue< Process, greater<process> > aQueue;
|
|
|
|
|
Overload the operator< function for your class. This function should calculate the result based on the priority member of your class.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
This is the code to display my fakemenu:
BOOL CXPMenu::ShowMenu(int nOrient,BOOL bFromKey, int x, int y,/*HWND pParentW*/CWnd* pParent, HMENU hMenu)
{
ASSERT(hMenu);
//pParent->m_hWnd=pParentW;
HideMenu();
//m_pToolbar=pToolbar;
m_pMenu->m_hMenu = hMenu;
mmenu = m_pMenu;
m_pParent=pParent;
m_nSelectedItem=-1;
//m_bMouseInMenu=FALSE;
//m_nOrient=nOrient;
CString strClassName = ::AfxRegisterWndClass (
CS_SAVEBITS,
::LoadCursor(NULL, IDC_ARROW),
(HBRUSH)(COLOR_BTNFACE + 1), NULL);
DWORD dwStyle = WS_POPUP;
PlayPopupSound();
if(!CreateEx(0,AfxRegisterWndClass(CS_SAVEBITS,LoadCursor(NULL,IDC_ARROW),(HBRUSH)CBrush(GetSysColor(COLOR_BTNFACE))),NULL,WS_POPUP,x,y,100,100,*pParent,0))
// if (!CreateEx(0,strClassName,NULL,dwStyle,CRect(x,y,100,100),pParent))
{
return FALSE;
}
m_pParent->SendMessage(WM_ENTERMENULOOP,FALSE);
SetCapture();
int cx=0,cy=0,n;
CSize siz;
CRect rect;
CDC& dc=*GetDC();
// Revised by Zhenxin Li.
// Change the font to the default menu's font.
dc.SelectObject((HFONT)GetStockObject(DEFAULT_GUI_FONT));
// dc.SelectObject(m_pToolbar->GetFont());
GetClientRect(rect);
CString tmp;
LPCTSTR q;
cy=4;
m_rectItem.SetSize(0);
m_accelList.SetSize(0);
for(n=0; n < (int)m_pMenu->GetMenuItemCount(); n++)
{
m_pMenu->GetMenuString(n,tmp,MF_BYPOSITION);
//DrawMenuItem(n,dc,m_rectItem[n],FALSE,TRUE);
for(q=tmp; *q; q++)
{
//CString str(_T("Test"));
//dc.DrawText(str,m_rectItem[n],DT_LEFT|DT_SINGLELINE);
if(*q=='&')
{
int s=m_accelList.GetSize();
m_accelList.SetSize(s+1);
m_accelList[s].nKey=toupper(*(q+1));
m_accelList[s].nId=m_pMenu->GetMenuItemID(n);
break;
}
}
siz=DrawMenuItem(n,dc,rect,FALSE,FALSE);
m_rectItem.Add(CRect(4,cy,0,cy+siz.cy-1));
if(siz.cx>cx) cx=siz.cx;
cy+=siz.cy;
}
cy+=4;
cx+=8;
ReleaseDC(&dc);
for(n=0; n<m_rectitem.getsize(); n++)
="" m_rectitem[n].right="cx-4;
/*" if(m_norient="=POP_MENU_RIGHT)" x-="cx;
" else="" y-="cy;
" int="" ncount="(int)m_pMenu-">GetMenuItemCount();
*/
MoveWindow(x,y,cx,cy);
ShowWindow(SW_SHOWNOACTIVATE);
//SetFocus(); // Must have focus to get keyboard events
if(bFromKey) m_nSelectedItem=0;
return TRUE;
}
and after this i call the OnPaint() but..
void CXPMenu::OnPaint()
{
------
int nMenu = m_pMenu->GetMenuItemCount();
for( int p = 0; p < nMenu; p++)
DrawMenuItem(p,dc,m_rectItem[p],FALSE,TRUE);
if(m_nSelectedItem!=-1)
DrawMenuItem(m_nSelectedItem,dc,m_rectItem[m_nSelectedItem],TRUE,TRUE);
}
when i call the GetMenuItemCouny() i can't get the number of items, this is why the menu information is not saved, see the first code, in the firs line appear:
m_pMenu->m_hMenu = hMenu;
where the hMenu is the menu that is chose with this command
ShowMenu(0,0,int x,int y,CWnd* pParent, HMENU hMenu)
wht's wrong with this?
|
|
|
|
|
I used
hhook = SetWindowsHookEx(WH_MOUSE,MyHookProc,MyDLL,NULL);
but It's response only mouse over my app and nothing when outside
hhook,MyHookProc,MyDLL != NULL
Something wrong in my dll ?
Please Help me
Thank you so much
|
|
|
|
|