|
Hello all,
When I migrated from visual studio 6.0 to visual studio 8.0 and compiled my project which was built in visual studio 6.0, I got following errors. Can you tell me what might be the problem.
1>Linking...
1>HTTPRequesttry.obj : error LNK2019: unresolved external symbol __imp__gethostbyname@4 referenced in function "unsigned long __cdecl GetHostAddress(char const *)" (?GetHostAddress@@YAKPBD@Z)
1>HTTPRequesttry.obj : error LNK2019: unresolved external symbol __imp__send@16 referenced in function "void __cdecl SendString(unsigned int,char const *)" (?SendString@@YAXIPBD@Z)
1>HTTPRequesttry.obj : error LNK2019: unresolved external symbol __imp__closesocket@4 referenced in function "int __cdecl SendHTTP(char const *,char const *,unsigned char *,unsigned long,struct HTTPRequest *)" (?SendHTTP@@YAHPBD0PAEKPAUHTTPRequest@@@Z)
1>HTTPRequesttry.obj : error LNK2019: unresolved external symbol __imp__recv@16 referenced in function "int __cdecl SendHTTP(char const *,char const *,unsigned char *,unsigned long,struct HTTPRequest *)" (?SendHTTP@@YAHPBD0PAEKPAUHTTPRequest@@@Z)
1>HTTPRequesttry.obj : error LNK2019: unresolved external symbol __imp__connect@12 referenced in function "int __cdecl SendHTTP(char const *,char const *,unsigned char *,unsigned long,struct HTTPRequest *)" (?SendHTTP@@YAHPBD0PAEKPAUHTTPRequest@@@Z)
1>HTTPRequesttry.obj : error LNK2019: unresolved external symbol __imp__htons@4 referenced in function "int __cdecl SendHTTP(char const *,char const *,unsigned char *,unsigned long,struct HTTPRequest *)" (?SendHTTP@@YAHPBD0PAEKPAUHTTPRequest@@@Z)
1>HTTPRequesttry.obj : error LNK2019: unresolved external symbol __imp__socket@12 referenced in function "int __cdecl SendHTTP(char const *,char const *,unsigned char *,unsigned long,struct HTTPRequest *)" (?SendHTTP@@YAHPBD0PAEKPAUHTTPRequest@@@Z)
1>HTTPRequesttry.obj : error LNK2019: unresolved external symbol __imp__WSAStartup@8 referenced in function "int __cdecl SendHTTP(char const *,char const *,unsigned char *,unsigned long,struct HTTPRequest *)" (?SendHTTP@@YAHPBD0PAEKPAUHTTPRequest@@@Z)
1>.\Debug/HTTPRequesttry.exe : fatal error LNK1120: 8 unresolved externals
1>Build log was saved at "file://e:\ProgramFiles2\Microsoft Visual Studio\myprojects\HTTPRequesttry\Debug\BuildLog.htm"
1>HTTPRequesttry - 9 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Thanks for Prompt reply.
Dhaval
|
|
|
|
|
Add wsock32.lib to the libraries that are linked into your project.
Phil
|
|
|
|
|
I have already included the include file and the lib file in the project. Then also it is showing this error.
Can you please tell me why ?
I have just migrated from VIsual studio 6.0 to visual studio 8.0 that's why this problems are coming in manier projects.
Thanks for prompt reply.
Dhaval
|
|
|
|
|
Hi All,
I have just migrated from VS 6.0 to VS 8.0. Now I want to include some windows files like winsock2.h. I dont know how to do it in VS 8.0 . I searched the toolbar, but didnt get it. Can anyone tell me.
Thanks for prompt reply
Dhaval
|
|
|
|
|
LPCTSTR lpszPathName;
CFileDialog fileDlg(TRUE);
fileDlg.m_ofn.lpstrTitle="Open";
fileDlg.m_ofn.lpstrFilter="BMP Files(*.bmp)\0*.bmp\0\0";
if(fileDlg.DoModal()==IDOK)
lpszPathName=fileDlg.GetPathName();
else
return;
CFile file;
if (!file.Open(lpszPathName, CFile::modeRead | CFile::shareDenyWrite))
{
AfxMessageBox("File open failed");
return;
}
Is there something wrong in the codes up?
Thankks~
|
|
|
|
|
The messagebox appears~
|
|
|
|
|
Did you use of debugger for see value of lpszPathName is it correct and valid?
|
|
|
|
|
I want to open a file named "aa" in path C:\Documents and Settings\示例图片\aa
I saw the debugger and the content is "C:\Documents and Settings\示例图片\葺葺葺葺葺葺葺葺葺葺葺葺?"
Why~?
|
|
|
|
|
Here is an example of opening a file open dialog box - hope this helps
void CFileProc1Dlg::OnOpenBtn()
{
// TODO: Add your control notification handler code here
this->UpdateData();
CFile f;
char strFilter[] = { "Files (*.dat)|*.dat|All Files (*.*)|*.*||" };
CFileDialog FileDlg(TRUE, ".dat", NULL, 0, strFilter);
if( FileDlg.DoModal() == IDOK )
{
if( f.Open(FileDlg.GetFileName(), CFile::modeRead) == FALSE )
return;
CArchive ar(&f, CArchive::load);
ar >> m_sample;
ar.Close();
}
else
return;
f.Close();
this->UpdateData(FALSE);
}
-- modified at 0:58 Saturday 14th April, 2007
|
|
|
|
|
The problem has been settled.Thanks a lot!
|
|
|
|
|
It seems your problem solved.
|
|
|
|
|
I have created a mesh_model.x file that is just the texture and material-
I been looking for an example of animating a mesh- the 3d model is a woman and I know I need to add a bone structure and attatch it to the mesh...
any ideas on how to do this - most books on 3d I have read leave this part out.. I guesing for good reason...
can you sugest a web page or a good book on how to do this?
or an example?
thanks in advance..
-- modified at 22:07 Friday 13th April, 2007
|
|
|
|
|
Hi,
Do any of you know how to make a progress dialog? I am writing out my data in my CDocument class. I have a menu and a toolbar icon called "process and write out data". I want the progress dialog to update the progress ctrl as work is finished. I was hoping that the right way to do this is to manage the progress dialog updates in my cdocument, since that is where all my data is. Can you give me a little pseudocode that explains how this would work? Or should I be doing it another way?
Thanks,
Max
|
|
|
|
|
Most peoples gut reaction to progress bars is something like this...
m_wndProgress.SetRange32(0,500);
m_wndProgress.SetPos(0);
for (int i=0;i<500;++i) {
Sleep(50); // Just to slow this down for demo
/*
do work here
*/
m_wndProgress.SetPos(i);
}
However, if you drop this code into a button click handler in a dialog with a progress bar, you'll notice the dialog becomes unresponsive to any user actions such as closing the dialog.
If processing your work takes enough time to require a progress bar, then it probably should allow the user to cancel or abort the activity. The easiest way to perform some lengthy processing while leaving the GUI thread free to respond to the user is to perform the processing in a separate worker thread. The worker thread then can post messages to the GUI thread to allow it to update the progress bar. This allows the GUI's message loop to process in a normal fashion. When we had the GUI thread performing the work as in the snippet above, message processing for the dialog had to wait for the loop to finish. Unresponsive GUI's are a good recipe for short tempers.
Look up AfxBeginThread() for MFC threading
Not quite pseudocode but I hope it helps get the wheels turning.
|
|
|
|
|
|
I'm incerting the OnKeyDown function to catch keyboard events.. Problem is it never makes it to the function..
void MyDlg::OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags )
{
AfxMessageBox(L"Got a key stroke"); <-- never pops up
CDialog::OnKeyDown( nChar, nRepCnt, nFlags );
return;
}
I've got an OnMouseWheel funtion in that works perfectly.. So I have OnKeyDown set in the same way.. Any Ideas?
|
|
|
|
|
Do you have a WM_KEYDOWN entry in the window class' message map?
The WM_KEYDOWN will go to the window with keyboard focus. In a dialog this may be one of the
controls in the dialog.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
yes I have ON_WM_KEYDOWN() in the message map..
hmmmm.. the function is just not hitting..
|
|
|
|
|
Then the window whos class your catching it in doesn't have keyboard focus.
Try using SetFocus() to set the keyboard focus to the dialog and see if it starts to work.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I must be overiding the keyboard somewhere because I've used SetFocus(), and my OnMouseWheel works to proove it focus.. Looks like I'll have to hunt for the block..
Thanks Mark..
|
|
|
|
|
I must be overiding the keyboard somewhere because I've used SetFocus(), and my OnMouseWheel works to proove it's focus.. Looks like I'll have to hunt for the block..
Thanks Mark..
|
|
|
|
|
Hmm.. still having trouble with this one...
I've started a whole new dialog that I can open child dialogs within..
OnKeyDown() works until I add an object to the parent dialog or open a child dialog..
I've tried SetFocus() every which way possible.. It's just not happening..
There must be a way...
|
|
|
|
|
There is an extreme push towards .NET, but no clear way to go with traditional MFC application.
Would be interesting opinion of Micrrosoft guru on that.
Just woundering, is there any way to convert MFC application to C# app or C++/CLI (rewrite option is not acceptable)?
And how traditional MFC MDI application have to be migrated/mutated towards .NET?
I'll appreciate any opinions/suggestions.
Thanks.
|
|
|
|
|
To go to C# would be a rewrite - different framework, different language.
C++/CLI is the only language that allows you to mix unmanaged code with managed code.
While this is powerful, it also adds to the complexity. Going back and forth between managed and
unmanaged code is tricky at first - there's a learning curve there.
If you want to hold on to your MFC-based codebase, and still take advantage of the rich .NET
framework, then C++/CLI is the only way to go. From my experience this works well.
My 2 cents.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hello,
I have a dialog with edit fields. and i store the data entered into them into MS SQL. Now, for data validation for CString fields, I use simple tes like
If(str=="")
{
Messagebox(something);
}
but for integer fields, VC++ 6.o automatically gives a message "please enter an integer" ,if the integer field is left blank . I get a first chance exception "0xE06D7363: Microsoft C++ Exception." and a messageBox "Please enter an integer." I guess that is because when I call UpdateData(true), there is no value for DoDataExchange. But Is there any way of disabling this message and allow me to display my own message as my application starts behaving unexpectedly after it encounters this exception. Also Could you tell me how to catch this exception thrown because of UpdateData. I could not catch it with normal CExeption * e.
Please help.
|
|
|
|