|
The closest thing you get is the color dlg. For your application you'll need to create one.
|
|
|
|
|
I started off trying to use CSocket but then read that this doesnt call the callback functions OnAccept and OnConnect, because it simulates a blocking socket. So Instead I used CAsyncSocket which is a non blocking socket. My socket now connects (to a web server if this is relevant), but still my OnConnect function just doesnt get called. (i have overriden the virtual functions with a MessageBox - code below, would REALLY appreciate some help with this:
AfxSocketInit();
if( !m_Sock.Create() )
AfxMessageBox("Failed to create!");
else
{
if( !m_Sock.Connect( "www.loucoll.ac.uk", 80 ) )
{
itoa( m_Sock.GetLastError(), Buff, 10 );
AfxMessageBox( Buff );
}
}
and connection function:
void CConnectSocket::OnConnect(int nErrorCode)
{
AfxMessageBox("Connected!");
CSocket::OnConnect(nErrorCode);
}
thanks
|
|
|
|
|
I want to make a program that has an interface similar to Sub7 where you click a button and instead of opening a new dialog window, it changes the view inside that dialog....kinda like another dialog inside of the main dialog! Anyone understand my drift? Help would be appreciated!
Thanks
Ashman
|
|
|
|
|
Look at PropertySheet and PropertyPages?
|
|
|
|
|
I am currently having a problem with access to files on a dual processor machine that has a anti-virus scanner installed. The anti-virus scanner is Innoculate-IT from Computer Associates. CA advice is set the scanner to scan incoming only or add the file extension to the excluded list. Has anybody here had a similar problem and does anybody know of any other workarounds.
Thanks for any information you can provide.
Steve.
|
|
|
|
|
ok i have used the wizard to make an mfc windows explorer skeleton, but am lost as to where to put the tree forming code and document opening code, and saving code and other bits, please help cos i'm on work experience and thinking of finding bill gates ans custard pieing him - anything like an mfc source code for the windows explorer would be great -i've been hunting but no found any.
|
|
|
|
|
add a tool tip to a button?
pliz post some code...
thanks
|
|
|
|
|
I would like to know if someone could explain me wht is the cause of this debug error:"abnormal program termination ".
thanks in advance
gerald
|
|
|
|
|
SYMPTOMS
When creating a temporary object and then re-throwing an exception, as demonstrated in the sample code in the More Information section of this article, the application terminates abnormally.
RESOLUTION
See the More Information section for the sample code and the workaround.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Visual C++ version 5.0.
MORE INFORMATION
Sample Code:
class aClass
{
public:
aClass(const char*){} ;
~aClass(){} ;
} ;
void push(const aClass& val)
{
}
void main()
{
int a = 5 ;
try
{
try
{
throw a ;
}
catch(int)
{
//Workaround: uncomment the following 2 lines
//aClass aObj("ABC") ;
//push(aObj) ;
//Comment the line below
push("ABC") ;
throw ;
}
catch(...)
{
}
}
catch(...)
{
}
}
Read the MSDN!
|
|
|
|
|
This seems a depressingly typical problem with learning MFC. All the examples of changing view, of course, assume you're doing it in the frame window, in response to a message. I'm trying to do it from the CDocument (switching to an errors list if the incoming document fails to validate). How the devil do I find my way to the frame window object from there? I suppose, if I get really desperate, I can store a pointer to my frame window in a global inside it's constructor but please tell me there's a better way than that.
This seems to be part of a pattern with MFC. Object instances are created inside MFC methods and hidden away from the programmer in undocumented and unsupported members. Persnally I think that the whole thing would be much better if the CRuntimeClass stuff had never been dreamed up.
|
|
|
|
|
You could get a pointer to the first view, and then call myView->GetParentFrame(). There may be a more acceptable way, but this is the one I thought of first.
|
|
|
|
|
Hi all,
I added an ActiveX to my resource ...
Now, i want to remove that ... how can i do that ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
select it and press 'delete'.
|
|
|
|
|
Hi all,
Q1. I want to connect to database in server, for do that i must use Database path (\\ServerName\ShareName\Test.MDB) or i must use of Connection string (DSN = ldap; User ID = sa; Prodiver = and ....) ???
Q2. What is CDaoWorkspace performance ?
Q3. What is different between Data Link (UDL) and DSN ???
Thanks for helps,
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I know how to do this normally, but I don't seem to be catching any WM_CTLCOLOR messages in my controls using WTL. Can anyone tell me how to go about this ?
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
Christian,
I've got an WTL app now that catches WM_CTLCOLORSTATIC messages for my static controls with no problems. Are you working with a standard form view app or something else?
|
|
|
|
|
I'm working in a dialog box that is WTL, the main project is a plain Win32 window. I am trying to catch WM_CTLCOLOREDIT for my edit box and it is never called.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
I put up a dialog box in WTL and found that I caught WM_CTLCOLOREDIT like so:
BEGIN_MSG_MAP(CMyDlg)
MESSAGE_HANDLER(WM_CTLCOLOREDIT, OnCtlColorEdit)
END_MSG_MAP()
LRESULT OnCtlColorEdit(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
ATLTRACE("OnCtlColorEdit\n");
return 0;
}
|
|
|
|
|
Ah.. I was trying to capture it in the alternate message map for the edit control. How do I then change two edit controls to have different colours on the same dialog - by checking the wParam against the HWND ?
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|
My typical handler looks something like:
LRESULT OnCtlColorEdit(...)
{
// This next line assumes that you've wrapped your edit controls with
// one of WTL's control wrappers in atlctrls.h.
// i.e. CEdit m_Edit1; m_Edit1.Attach(GetDlgItem(IDC_MY_EDIT_CONTROL));
if ((HWND)lParam == m_Edit1.m_hWnd)
{
::SetTextColor((HDC)wParam, RGB(0,0,255)); // blue
return ::GetSysColor(COLOR_WINDOW);
}
else if ((HWND)lParam == m_Edit2.m_hWnd)
{ ... etc.
}
return 0;
}
|
|
|
|
|
Sup.
I have an existing text\HTML file, made by an ofstream obj, and
I want to find a char' stream in the file and set the 'eof()' right there.
e.g.:
ofstream of("moo.txt");
of << "La la la \n And la la la some more, "
"A cow does moo, and some other stuff";
// The file after "match & cut" of the string
// "A cow does moo, and some other stuff"
// will look like:
// "La la la \n And la la la some more, "
Take your best shot
10x.
|
|
|
|
|
I think you have to use the fd function to get a handle to the file descriptor. Then use read() to search for your character and then seek() with -1 and write() once you've found it.
|
|
|
|
|
I have a CDialogImpl-based class, implementing a modeless dialog. My application can have a number of such dialogs, so I'm using this code to create one:
CMyDialog *pDlg = new CMyDialog;
pDlg->Create(NULL);
pDlg->ShowWindow(SW_SHOW); When user will press the close-button in the upper right corner of my dialog - I must destroy the object and the window, so I'm using DestroyWindow(); in WM_CLOSE handler and delete this; in OnFinalMessage().
The problem is that the program falls with ASSERT(pThis->m_pCurrentMsg == &msg) in atlwin.h, line 2281. Btw, if I close the main application - these dialogs are destroying without any ASSERTs...
How can I delete the class after the window have been destroyed?
With the best regards, Vitaly.
|
|
|
|
|
Surely if you've called DestroyWindow then that is all you need to do. Have you traced back to see what was called to cause the ASSERT? I'm betting on delete this.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
I don't think that DestroyWindow() is enough. Cause my destructor is not called in such case.
With the best regards, Vitaly.
|
|
|
|