|
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..
|
|
|
|
|
I'm not sure if this is what you want, but this is what I've used for my listviews:
const int LVS_EX_LABELTIP = 0x00004000;
ListView_SetExtendedListViewStyle(m_libraryPlans,LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP);
Hope this helps!
Derek
|
|
|
|
|
Hi, I have been creating a band object for IE starting from a base created with the band wizard here: http://www.codeproject.com/atl/rbdeskband.asp
To the class created i have added a CWindowImpl derived class (CMainWindow) which replaces the default window object created by the wizard (HWND m_hWnd). This class is used as a container to handle the command messages created by a toolbar. This toolbar is a member variable of CMainWindow. There are a few things i wish to sort out but am unsure how:
Firstly if i close IE with my band still visible, when i load IE up again the band is still there as it should be however the toolbar is not loaded (or at least not visible nor clickable). The toolbar creation code is handled in the OnCreate method of the CMainWindow (which does get executed everytime, i checked). Has anyone else come across this? perhaps the code should be elsewhere.
Secondly I am wondering how to get a handle to the parent rebar that my band object is in so that I can add chevrons to my band (or is there a different way of adding chevrons?).
Thankyou in advance.
Mat.
|
|
|
|
|
You could be having drawing problems because of the threading model you are using. If you are using my old wizard, there was a bug in it that the threading model was not getting set and thus you could only have one instance of the band at any time. Setting the threading model to apartment will fix this. You would look for this in the *.RGS file of your project.
As for the cheverons, the code in the SetSite method implementation gets the parent window handle that will allow you to do cheverons or what have you. This code is produced by the wizard by default and is near the middle of the function just before the call to RegisterAndCreateWindow. The parameter passed into the R&CW method is the handle to the rebar window.
Cheers,
-Erik
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My thoughts are my own and reflect on no other.
|
|
|
|
|
How can I check for timer's existance?
I can create a flag, set it with SetTimer and reset with KillTimer, but is the easier way exist? I'm using a pure API.
With the best regards, Vitaly.
|
|
|
|
|
I don't think there's any documented way of doing this. The funny thing is that if you create a second timer with given ID, the function returns TRUE, and GetLastError returns 0.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hello guru's
I've a interessting problem, and probably the most will say: please don't do that because of the extra headache
OK..
Because the fact I've a MDI application on which each doc/view can expect a lot of input. This input is no user input, but trace events read from TCP-socket. The communication handling for TCP/IP is already done it it's own thread, only passing data to the document when there's something to write. Also: I've a fast way of writing to the view, but some times the main application is very very slow in responding (moving/menu/toolbar etc) when more than 3 documents are handled with a lot of data. The problem is that all the doc/view handling is done under the hood of the applications main thread. This is the reason for wanting each doc/view in it's own thread.
Now I've read sometime somewhere that someone had put each doc/view in its own thread. The question is: how to do this for a MDI application
This is maybe also a very good article to store in CodeProject library.
Thanks in advance..
EiSl
|
|
|
|
|
I've a MDI application on which each doc/view can expect a lot of input.
What kind of input it is?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Tomasz,
Sorry I'wasn't complete
I've already updated the initial story.
The input is not from user, but Trace Events from a TCP-socket. A separate thread (launched by the doc) forms a complete protocol handler and connects to a device. When a trace-event is received, a string passed to the doc which updates the view.
It's also possible for the user to select a line in the view, and than press a button to add some comments. But this is rarely used, so: no user input to view.
Hopes this completes the story,
EiSl
|
|
|
|