|
Rickard Andersson wrote:
You article for example... Can I use it over the Internet?
Yes. You can.
Rickard Andersson wrote:
So you mean, that example application from "Sams Teach Yourself VC++ in 21 days" will work if I put the server on a computer with Internet acces
I never saw that book, but I expect it to work
Nish
p.s. I am surprised that a 21 day VC++ book has a chapter on winsock!!! or were they teaching CSocket stuff?
My miniputt high is now 29
I do not think I can improve on that
My temperament won't hold
www.busterboy.org
|
|
|
|
|
Nish [BusterBoy] wrote:
p.s. I am surprised that a 21 day VC++ book has a chapter on winsock!!! or were they teaching CSocket stuff?
Well, it talks about CAsyncSocket class and how to create a simple Client/Server app to send messages etc.......
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
I have created a simple MDI application with the MFC class wizard. At the moment I have only one view and one document. The view has CListView as a base class. I have disabled the new file option on startup by using
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
The user can either call a add menu option that displays a dialog box with which they can add data to the database, or they can pick a view menu option which will allow them to view all the data added on that particular day. My problem is calling the view from the mainframe menu option. I have read several articles but they all deal with adding documents and views and then swopping between them. I know I'm probably being very dense but have tried the whole of yesterday with no success. .
This is the code I'm using to initialize the List view in myView::OnInitialUpdate.
DWORD dwExStyle;
CRepPartDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
//CActionsApp *pApp = (CActionsApp*)AfxGetApp();
CListCtrl& m_List = GetListCtrl();
dwExStyle = m_List.GetExStyle();
dwExStyle |= LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES;
m_List.SetExtendedStyle(dwExStyle);
m_List.SetBkColor(RGB(255, 255, 255));
ASSERT(m_List.GetBkColor() == RGB(255, 255, 255));
m_List.InsertColumn(0,_T("Share"),LVCFMT_LEFT,160);
m_List.InsertColumn(1,_T("Status"),LVCFMT_LEFT,90);
m_List.InsertColumn(2,_T("Action Date"),LVCFMT_LEFT,90);
m_List.InsertColumn(3,_T("Book Date"),LVCFMT_LEFT,90);
m_List.InsertColumn(4,_T("Comment"),LVCFMT_LEFT,160);
Someone has suggested calling OnFileNew() from my menu handler but no success. Please help! Any suggestions will be more than I have already!
Grasp it but you cannot get it!
It's name is memory..
|
|
|
|
|
Who has used the regexp object in system32\vbscipt.dll to parse the text string. I have tried it and make it work!
But i don't know why i can get only one match(that is the matches.GetCount()==1), even there are many exist. The next is my code:
void CInetSessionDlg::ParsePage(CString szPattern, CString szContent){
try{
if(m_regExp.CreateDispatch(__uuidof(RegExp)) == FALSE)
{
AfxMessageBox("CreateDispatch Failed!");
return;
}
m_regExp.SetIgnoreCase(TRUE);
m_regExp.SetPattern(LPCTSTR(szPattern));
if(m_regExp.Test(LPCSTR(szContent)))
{
ISubMatches matches = m_regExp.Execute(szContent);
for(long i = 0; i < matches.GetCount(); i++)
{
IMatch2 match = matches.GetItem(i);
CString strLink = match.GetValue();
m_cbHref.AddString(strLink); }
}
}
catch(_com_error& e)
{
AfxMessageBox("Com Error occurred!" + e.Description());
return;
}
}
in this implementation file's header file:
i defined the RegExp(copied from the file RegExp.tlh got from vbscript.dll)
struct __declspec(uuid("3f4daca4-160d-11d2-a8e9-00104b365c9f"))RegExp; // [ default ] interface IRegExp2
Why? Who can tell me how to use vbscript.dll in VC++ 6.0
thanks a lot!
Sincerely, Davidlou
davidlou68@hotmail.com
|
|
|
|
|
Please use the <pre> tags
Nish
My miniputt high is now 29
I do not think I can improve on that
My temperament won't hold
www.busterboy.org
|
|
|
|
|
Who has used the regexp object in system32\vbscipt.dll to parse the text string. I have tried it and make it work!
But i don't know why i can get only one match(that is the matches.GetCount()==1), even there are many exist. The next is my code:
void CInetSessionDlg::ParsePage(CString szPattern, CString szContent){
try{
if(m_regExp.CreateDispatch(__uuidof(RegExp)) == FALSE)
{
AfxMessageBox("CreateDispatch Failed!");
return;
}
m_regExp.SetIgnoreCase(TRUE);
m_regExp.SetPattern(LPCTSTR(szPattern));
if(m_regExp.Test(LPCSTR(szContent)))
{
ISubMatches matches = m_regExp.Execute(szContent);
for(long i = 0; i < matches.GetCount(); i++) {
IMatch2 match = matches.GetItem(i);
CString strLink = match.GetValue();
m_cbHref.AddString(strLink);
}
}
}
catch(_com_error& e)
{
AfxMessageBox("Com Error occurred!" + e.Description());
return;
}
}
in this implementation file's header file:
i defined the RegExp(copied from the file RegExp.tlh got from vbscript.dll)
struct __declspec(uuid("3f4daca4-160d-11d2-a8e9-00104b365c9f"))RegExp; // [ default ] interface IRegExp2
Why? Who can tell me how to use vbscript.dll in VC++ 6.0
This time, i have tried to use
and hope it will work.
Thank u two friends!
Sincerely, Davidlou
davidlou68@hotmail.com
|
|
|
|
|
ROTFL - this is EXCELLENT
Try putting returns between your lines of code. Does it appear more readable to you like this ?
I'm sorry, I can't answer your problem, but anyone who can will be more likely to if your post is easy to read IMO.
Good luck.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
ROTFL - this is EXCELLENT
Try putting returns between your lines of code. Does it appear more readable to you like this ?
I'm sorry, I can't answer your problem, but anyone who can will be more likely to if your post is easy to read IMO.
Good luck.
Oh, I used an & and lt or gt to get < >, by typing in <pre>, you coloured the bottom of your post. If you use stuff that looks like HTML tags, check the 'display this message as is' option, or they get stripped as HTML, and in this case, used. OTherwise, use & lt and & gt without the space to do < and >.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
Thanks a lot!
Now it looks some better!
Sincerely, Davidlou
davidlou68@hotmail.com
|
|
|
|
|
Nish is not solving your problem, he's tells you to use <pre> ... </pre> to wrap your code so it is readable.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
Hi,
I am reading the book Programing Windows with MFC,but the example(The Hello Application) that it gave in chapter 1 cannot be compiled in the vc++ 6,it shows the informations below:
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
libcd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Hello.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
Did the codes the book gave wrong? Or I should do anymore?
the codes are listed below:
Hello.h
class CMyApp : public CWinApp
{
public:
virtual BOOL InitInstance ();
};
class CMainWindow : public CFrameWnd
{
public:
CMainWindow ();
protected:
afx_msg void OnPaint ();
DECLARE_MESSAGE_MAP ()
};
Hello.cpp
#include <afxwin.h>
#include "Hello.h"
CMyApp myApp;
/////////////////////////////////////////////////////////////////////////
// CMyApp member functions
BOOL CMyApp::InitInstance ()
{
m_pMainWnd = new CMainWindow;
m_pMainWnd->ShowWindow (m_nCmdShow);
m_pMainWnd->UpdateWindow ();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////
// CMainWindow message map and member functions
BEGIN_MESSAGE_MAP (CMainWindow, CFrameWnd)
ON_WM_PAINT ()
END_MESSAGE_MAP ()
CMainWindow::CMainWindow ()
{
Create (NULL, _T ("The Hello Application"));
}
void CMainWindow::OnPaint ()
{
CPaintDC dc (this);
CRect rect;
GetClientRect (&rect);
dc.DrawText (_T ("Hello, MFC"), -1, &rect,
DT_SINGLELINE | DT_CENTER | DT_VCENTER);
}
//I am sorry to interrupt you but I am a beginner,so if you know the answer,please tell me,thanks.
YES, I am here.
|
|
|
|
|
You need to link with the MFC library [either statically or dynamically]
Nish
My miniputt high is now 29
I do not think I can improve on that
My temperament won't hold
www.busterboy.org
|
|
|
|
|
If you're writing this from a blank project, you need to read carefully how to set it up. I've learned what all the bits the wizard gives me do, but I've never started a project except through the wizard - it just makes more sense to me to let the compiler generate boiler plate code, although, as I say, I've also had a good dig through it and can do a lot of the wizard stuff by hand if I want/need to.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
Christian Graus wrote:
If you're writing this from a blank project, you need to read carefully how to set it up
There is not much to setting it up actually
1. Include the MFC headers
2. Link with MFC [statically or dynamically]
That's all...
Nish
My miniputt high is now 29
I do not think I can improve on that
My temperament won't hold
www.busterboy.org
|
|
|
|
|
Fair enough, but obviously the book would have told him how to do that and he's missed it.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
Christian Graus wrote:
Fair enough, but obviously the book would have told him how to do that and he's missed it.
Yeah, that sounds highly probable.
Nish
My miniputt high is now 29
I do not think I can improve on that
My temperament won't hold
www.busterboy.org
|
|
|
|
|
The problem is your project settings are set to link with the single-threaded C runtime. MFC requires the multi-threaded version (as indicated by the fact that it's trying to find thread-related functions).
Click Project->Settings, C++ tab, Code Generation category, and set the Use runtime library setting to Debug Multithreaded (for the debug config) or Multithreaded (for release).
--Mike--
Rollin' in my 5.0
With the rag-top down so my hair can blow.
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
thanks everybody answered this question.
yes,in the end of the chapter,the writer gave the step on how to build it.I have not read it.now everything is ok,thank you.
YES, I am here.
|
|
|
|
|
Hi,all
When I used ClassWizard to add the message handlers,VC++ 6.0 displayed the warning:
"ClassWizard was unable to rename file D:\DOCUME~1\Alpha\LOCALS~1\Temp\mfc78.tmp to F:\Program\MyProjects\vcpp32\ex14a\ex4aView.cpp. You may be able to rename this file by hand and prevent loss of data.Some updates may still be lost."
What's wrong with it? I remember that when I used classwizard to add message handlers of menu items,vc++ always shown this warning.Can anyone tell me the reason?
Thanks!
YES, I am here.
|
|
|
|
|
If that happened to me, I'd be deleting all my temporary files, uninstalling VC and reinstalling it. This is NOT normal.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
Hello,
I am tring to write a simple .exe that can show or hide another running exe.. for example I want to be able (from my dialog box) toggle (show,hide) a running instance of notepad.
Any ideas?
Rob
|
|
|
|
|
Never mind.. I figured it out..
|
|
|
|
|
How do I programmatically get the name of the computer a user is using to log into the network? If some one knows the regular way and the .net way I would REALLY appreciate it. Thanks chums!
... OK, let's try that again. What I meant was not a local call, but one over the network, where I know someone's login id and that they are logged into the domain, but want to know what computer they are using to get on the network.
|
|
|
|
|
|
I have placed a List Control into a small area of a scrollview, among other controls. The control is in Icon view with small icons and text lables.
When I call CreateDragImage the image I get is the small icon and a black rectangle where the text would be. How can I get around this? Either to make the text visible or to just have the image.
Happy programming!!
|
|
|
|