|
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.
|
|
|
|
|
MSDN states:
"While it is normal to derive your own dialog classes from CDialog, you do not typically derive your own class for a dialog bar. Dialog bars are extensions to a main window and any dialog-bar control-notification messages, such as BN_CLICKED or EN_CHANGE, will be sent to the parent of the dialog bar — the main window."
I am able to create the control-notification messages handlers, however that is all. I cannot get the buttons activated, I cannot set checkboxes, I cannot set the text in a text box....etc. How is this supposed to be done without a derived class?
Thanks, John
johnu@micromotion.com
ps - If anyone has a simple app that uses a dialog bar with a few controls, like buttons, text boxes, etc, and they are willing to share, it would be greatly appreciated.
|
|
|
|
|
could somebody help me get some piece of "C" code which would convert from Big Endian to Little Endian byte orders ?
The situation is that I am reading a Solaris binary file which has Big Endian format. When I fread() it in a NT machine,I need to convert it to Little Endian for it make sense.
PS :
1. We could always use the winsock functions like htons or htonl but I do not want to link the entire wsock32 dll to my dll
just for these functions.
2. No .Net APIs please ! pure "C" - preferably platform independent
Thanks !
Retish
|
|
|
|
|
long t = 55;
SwabLong(&t);
void SwabLong(void* lp)
{
BYTE* cp = (BYTE*) lp;
int t;
t = cp[3]; cp[3] = cp[0]; cp[0] = t;
t = cp[2]; cp[2] = cp[1]; cp[1] = t;
}
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Just use the bitwise and shift operators:
unsigned short s1, s2 = 0x1234;
s1 = (s2 & 0xFF) << 8 | (s2 & 0xFF00) >> 8; I'm not sure of the operator precedence there (since I rarely write expressions like that, I don't know the precedence off the top of my head), but that should be enough to get you started.
--Mike--
http://home.inreach.com/mdunn/
Sometimes, arming yourself with a big pointy stake just won't do you any good.
|
|
|
|
|
chris and michael,
thanks a ton to both of you ! ur code is wonderful ! it works GREAT !!
thanks
Retish
|
|
|
|
|
Are there any good articles (with examples) on how to use the tab control? I have seen the few articles posted under tab controls here but they look like customized tab controls and I don't even know how to use the basic MFC tab control. Any suggestions?
Thanks,
Rob Jones
|
|
|
|
|
How do i turn a basic_string into a CString, or get the contents from one to the other??
Thanks,
|
|
|
|
|
basic_string<TCHAR> bs;
CString cs;
cs = bs.c_str();
bs = (LPCTSTR) cs;
--Mike--
http://home.inreach.com/mdunn/
Sometimes, arming yourself with a big pointy stake just won't do you any good.
|
|
|
|
|
I'm not sure about basic_string but for string I usually use
CString cstrText = strText.c_str();
the c_str() function does the trick...
|
|
|
|
|
Hello!
I am interested in getting SQLAnywhere 5.5 database switches (EngineName, Start, etc.) via ODBC using VC++. I can create these using SQLConfigDataSource(), but can't figure out how to retrieve them.
Any ideas?
Thanks,
Derek
|
|
|
|
|
Try SQLGetConfigMode(...) or SQLGetInfo(...)
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
I have created a dlgbox where i put edit box and button. In one of the edit box, i have attached a COleDateTime variable to it. So, the variable is initialized with GetCurrentlyDate, and keep this value all the time whatever i do to change it, it recognizes only the today date and just this date. It's problem for me because i want to be able to change the date and to use this new date for others parts of my application. How could i do that?
thanks in advance
gerald
|
|
|
|
|
I'd recommend using the date time picker control rather
than an edit box.
"das leid schlaft in der maschine" -Einstürzende Neubauten
|
|
|
|
|
Ok.
But how can i initialize a date to the date time picker control ?
|
|
|
|
|
I've been doing a bit of text-to-speech stuff using the Microsoft Speech SDK V5.0. What I'd like to do now, is distribute my app with the text-to-speech capabilities. However when installed, the installation program will also have to install the text-to-speech engine. I don't want to distribute the whole 110M worth of Speech SDK, so looking at the redistribution details, I need to install sp5ttint.msm, and spcommon.msm.
I can't actually find these two files. I've look on my system, and in the SDK cab file, and can't find them. I may just be thick, or blind, but does anyone know either how to install the text-to-speech engine, or where I can find these files please?
Thanks
|
|
|
|
|
I'm trying to add a tooltip for a listview control using SDK style programming. I want to display the tooltip based on the data displayed in the rows..I can't seem to find any code samples in achieving this process..
|
|
|
|