|
I have one VB object and one VC object.
This VB object will create one ADO Connection object.
To share the same connection, it is need to pass the connection
from VB to VC object.
Is it possible?
If yes, how can it be done?
Thanks.
|
|
|
|
|
Does anybody here know what this can be translated to in the win32 api?
AfxGetThreadState()->m_lastSentMsg;
i know it has something to do with the message queue, but i want to know what its API equivelent is
|
|
|
|
|
I image you could just declare a global MSG variable, and each time your window procedure gets called, just store the messages information.
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
I use the getline function to retrieve lines from files. The problem is I have some files where lines are ended with a Carriage Return "\r" and some that are ended with a New Line "\n". How can I satisfy both without reading and checking every character?
|
|
|
|
|
Usually it's either \r\n or just \n.
What I do is totally strip any \r i come across and just
process the \n.
|
|
|
|
|
Is there a way to create a new Dao database using VC++? I know that this requires long answer, so if someone could provide a link to any help, it would be greatly apperciated.
Richard
|
|
|
|
|
yes, Using the CDaoDatabase::Create();
CDaoDatabase pdaodb;
pdaodb.Create("C:\\Mydb.mdb", dbLangGeneral, dbVersion30);
Cheers!!!
Carlos Antollini.
|
|
|
|
|
Hi,
Would someone kindly help me out of this 6 hour long struggle.
I have an SDI app with a RichEditView. I don't need the RTF functionality, so I want to serialize text only. I've searched everywhere (even the MS Newsgroups) for a sample on how to serialize using streamin and streamout.
I understand that I have to set m_bRTF to false in order to save / load in text only, but for the life of me I can't find a sample that shows how.
An explanation or sample code would be great.
Thanks,
Frank
|
|
|
|
|
I'm not typing from much eperience here, but this is what a standard sample CMyAppWizCreatedRichEditDoc::Serialize does:
void CEditDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
}
else
{
}
CRichEditDoc::Serialize(ar);
}
CRichEditDoc::Serialize gets a pointer to the CRichEditView type object and calls serialize on that - and yes, if I don't set m_bRTF false some files fail to get read in.
If you are not using a CRichEditDoc, I would think you could fake it with a call to the view, but not sure what then happens to m_bRTF.
You can look in ...\MFC\SRC\VIEWRICH.CPP to see all the fun Stream stuff. The above code comes from the App Wizard if you select CRichEditView for your view class.
|
|
|
|
|
Thanks for the info Tim. My app is a basic appwizard generated sdi mfc app that uses RichEditDoc, and RichEditView. The serialize function in my app is exactly what you've listed in your example.
However, Where do I go from here? Ah the humanity! Where's the tylenol.
Frank
|
|
|
|
|
Hmm... I just use the Open... and Save stuff... however, I do notice that if I don't set the m_bRTF it will only show (the text of) files with the .txt extension...
Oh - and I think there's some tylenol in that white metal box with the red cross on it on top of the water cooler...
later...
CRichEditDoc::m_bRTF = FALSE;
CRichEditDoc::Serialize(ar);
|
|
|
|
|
Thanks again Tim.
I found some Excedrin...so now I'm on a major caffiene high! Woohoo!
Frank
|
|
|
|
|
GREETINGS
Could somebody help me with CheckListBox?
I can create it with .Create function, but it's useless. I need to attach it to ListBox control on the dialog.
Thank you!
LOVE & PEACE to everyone
|
|
|
|
|
Simply do what you usually would do to associate a litbox with a variable, and then substitute CListBox for CCheckListBox.
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
Thank you Ben .
I tried it, but there occures an error when i start the program...
Is there any way do do it with either SubclassDlgItem or something else?
Thank you very much!
LOVE & PEACE to everyone
LOVE & PEACE to everyone
|
|
|
|
|
Opps... forgor two important parts;
1) the listbox must be owner draw fixed.
2) the 'Has Strings' style must be enabled.
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
GREETINGS
Thank you Benner, it turned out that it is so easy! Thank you very much!
Good luck!
LOVE & PEACE to everyone
LOVE & PEACE to everyone
|
|
|
|
|
I had the following working OK up until I split the class up into two classes.
static const UINT SomeVariable = ::RegisterWindowMessage("SomeString");
ClassA::Method()
{
...
...
PostMessage(SomeVariable, 0, (LPARAM)pSomething);
...
}
BEGIN_MESSAGE_MAP(ClassA, CComboBox)
ON_REGISTERED_MESSAGE(SomeVariable, OnAddItem)
END_MESSAGE_MAP()
ClassA::OnAddItem(WPARAM, LPARAM)
{
...
...
}
I began to realize that I needed to split the class up, because I was starting to develop ClassB, ClassC, and etc.. and it was only the Member ::Method() that was going to be different. So I split up the class like this
static const UINT ClassA::RegisterWndMessage = ::RegisterWindowMessage("SomeString");
BEGIN_MESSAGE_MAP(ClassA, CComboBox)
ON_REGISTERED_MESSAGE(ClassA::RegisterWndMessage, OnAddItem)
END_MESSAGE_MAP()
ClassA::OnAddItem(WPARAM, LPARAM)
{
...
...
}
ClassB::Method()
{
...
...
PostMessage(ClassA::RegisterWndMessage, 0, (LPARAM)pSomething);
...
}
ClassC::Method()
{
...
...
PostMessage(ClassA::RegisterWndMessage, 0, (LPARAM)pSomething);
...
}
Only now each implementation must inherit from Class A. The member Method() is declared as NULL in class A, so that each inheritor must implement Method(). When I use the class now, each instance of Method() is executed, but the method ClassA::OnAddItem() is never executed. I've probably forgot to wire something about the message maps in order to get this to work, but I can't see it. Anybody got a suggestion. Thanks.
Chris
|
|
|
|
|
Following a rebuild all of the project, it's an extension DLL and a rebuild all of the other projects that use it, things are working as I would have expected. Possibly because of the many virtual functions within these classes changing, I needed to do a complete rebuild of not only my DLL project but all of the the other projects that compiled/linked with this library. Thanks for reading anyway.
Chris
|
|
|
|
|
I want to be able to drag a folder into the view of an SDI application. What I get so far is an "Access to [folder name] denied" error. I can drag individual files into the view but not a file folder. Can anyone point me in the right direction?
Kevin Ranville
|
|
|
|
|
Iam Getting Access Voilation Exception When Using
CWinThread::AfxBeginThread can Any One Help me
bgpandey,
|
|
|
|
|
I have a UserDefined Class named CMyProj and A dialog box class,CMyDlg.
The dialog box has a ListBox control placed in it.
with m_Listbox as member variable of type CListCtrl.
I want to acess the following function of
list box from my class (ie)CMyProj
m_ListBox.AddString()
For This I have created an Object of class CMyDlg
some thing like this
CMyDlg *pDlg
pDlg->m_ListBox.AddStriing("Some String");
On Compiling this application Iam getting Asset Voilation exception
Can Any one help me to solve my problem
bgpandey,
|
|
|
|
|
Where does the Assert occur? If it is in IsWindow(m_hWnd) more than likely, the framework can't find the listbox to addd the string.
You'll have to get a valid pointer to the listctrl after its created. Also, make sure that the member variable defined in your Dlg class is defined public. Other than that...sorry i cant be more help.
I fight with this every time I use a ctrl class. Unfortunately, I don't have a solution. A few days ago I posted a similar question.
Good luck (to both of us).
Frank
|
|
|
|
|
There's got to be more to your code than you're telling!
>> CMyDlg *pDlg
>> pDlg->m_ListBox.AddStriing("Some String");
There must be something more between these two lines
You can't just start using an uninitialized pointer
lime that!
It would help if you could copy all the relevant
code segments instead of just jotting down ( complete
with typos ("AddStriing" with two i's) a few lines
that you think may be relevant.
Do you ever create an instance of CMyDlg?
If so what do you do with m_ListBox in the
constructor of CMyDlg?
Do you invoke the Dialog? ( DoModal() )
Also "AddString()" is not a member function of
CListCtrl - it's a member of CListBox. Is m_ListBox
really of type CListCtrl? or is it actual of type
CListBox?
Give a bit more info and I'll try to help a bit
more.
Steve T.
|
|
|
|
|
Well, first it should be CMyDlg dlg; dlg.m_ListBox.AddString("..."), but like a previous reply stated, if it fails on the m_hWnd its because the ListBox hasn't been created yet and then you should think about maybe passing it as a parameter to the constructor of the dialog.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|