|
A member variable that needs to be initialised can be done like so
(in .h )
class Blah
{
SomeType m_st;
(in .cpp)
Blah::Blah() : m_st("initialisiation values"
{
etc.
However, for you to have a reference, it needs something to reference to. Is it a class variable, or a global ( in a namespace of course ).
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
I was considering a class variable. So it seems like a big limitation that we cant declare class members that are a reference. I think I've seen stuff like
local function
{
someType xyz;
someType &abc;
abc=xyz (not abc=&xyz right?)
I have a locally declared & variable and wanted to use it in another function....
|
|
|
|
|
If it's a class variable I'd have thought it would work if you used an initialiser list as in my first reply.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
To declare a pointer to a type, use '*' instead of '&'.
for example:
long *mLongVar;
To make it accessible to everybody put it under 'public:'
|
|
|
|
|
Thats what I ended up doing....so thank you very much for confirming that my approach was correct.
ns
|
|
|
|
|
Hi all
I need to get server side system time from my computer
how to do this?
Thanks
|
|
|
|
|
u could use http://www.codeproject.com/internet/ndk.asp
for client server.
Then ask gently from the server to send its time, and server has to respond with its time into a CString for example
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Use the command
net time \\server</font> where server is the name of the server from which you want to retrieve the time. This call can also be easily embedded into a program.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Use NetRemoteTOD
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
I have a problem that I think might get sorted out if I forcibly make the OnItemChanged handler of my listctrl execute. Thing is if I called it like: myListCtrl.OnItemChanged( ...), I have no clue what to pass in in the argument list. How can one trigger the OnItemChanged event to run, if you "selected" (highlighted) an item with code, instead of by pressing on it? To select the key i used:
m_list1.SetItemState( 0,LVIS_SELECTED | LVIS_FOCUSED , LVIS_SELECTED | LVIS_FOCUSED);
This apparently doesnt run the OnItemChanged function....
Please help!
Thanks,
ns
|
|
|
|
|
I could do
pView->SendMessage(LVN_ITEMCHANGED, IDC_MYLISTCTRL,0) just guessing. ????
|
|
|
|
|
You can format the message yourself & send it, (don't forget, it takes a pointer to a return value!) but why trouble yourself unnecessarily? If all you're doing is checking for a change in selection, just create a separate method that gets called both from OnItemChanged() and directly when you change the selection programatically.
Shog9
--
Maybe Java is kind of like God, it "works in mysterious ways". It seems like your apps are running slowly, because in the backgroud Java is solving world hunger, or finding the cure to cancer.
- Ryan Johnston, Don't die java!
|
|
|
|
|
Hi,
I would like to have the small help button (the one that appears in the upper right of a dialog if its context property is set to true) take the user to a page in my help file that is relevant to the dialog they working with. Is there any way that the default "turn into a question mark pointer" function can be overridden to acheive this??
Thanks in advance!
Is it football season yet???
|
|
|
|
|
I'm trying to display the contents of list box from a dialog box in print preview. I'm having trouble implementing this. Can some one point me in the right direction.
Thanks
|
|
|
|
|
for each item in the list, get the string and use CDC::TextOut to draw it to the print preview DC.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
Is it OK to use it? When is the object actually destroyed?
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Is it OK to use it?
Yes, though it is not common.
When is the object actually destroyed?
At the very moment delete this is executed. This has an important implication, namely that after this line the member function can no longer reference the object or any of its members.
The most common use of this idiom is for cleaning up modeless dialog boxes in PostNcDestroy .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Michel Prévost wrote:
Is it OK to use it?
Yes.
Michel Prévost wrote:
When is the object actually destroyed?
When the delete statement is executed. When did you think it would happen
It's an idiom used commonly in reference counting situations. The dtor is usually protected, or private, so that users cant delete the object themselves and therefore the object decides when it's time to die.
If you see a line that says 'delete this' then be concerned if you see any access to an object's variables after that line and before the end of the function...
Len Holgate
www.jetbyte.com
The right code, right now.
|
|
|
|
|
Hi All!
I have an Access database in which I have a list. Since I don't have Access on my computer I can still load the list into a C++ app and view the list through a CListView, for example.
Now, I want to print this list CListView doesn't do a good job because I have no control on the formatting (title, sub-title, etc). I could create an html from the data and use CHtmlView... but if you print a long html list the html view doesn't repeat the column headers on each page for example. I could create a report in Access but it costs a lot (Crystal Reports is also costly)!!!
Does someone have a solution to this?!? I want pretty printing with images at the top and column headers that get printed on each page!
Thanks for your time,
----------
Hyakugei
|
|
|
|
|
Why is it that sometimes when I type the control name and a dot I get a drop down with all the functions in the class and others (same control type) I get nothing.
How can I get this to work for all function?
Thanks
|
|
|
|
|
i think it's because VC's autocompletion stuff is broken - sometimes it works, sometimes it doesn't. i recently installed VisualAssist (www.wholetomato.com) because it has a more-reliable system than the built-in stuff.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
Hello,
Usually when a user types something in to a combo box and leaves it (e.g., types TAB), the combo box will translate whatever was typed into something in the drop-down list.
Which windows message to I use to get the value of the combo box's edit area AFTER this translation has been done? I tried using the KillFocus Windows message, but the subsequent UpdateData(TRUE) fills the member variable with what the user typed, not the combo box's tranlation.
Any ideas? Thanks!
JennyP
|
|
|
|
|
Maybe overriding CBN_SELCHANGE ?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Where did you learn how to code Winsock, or in MFC CSocket. I would like to learn how, but I don't know where to start. Any pointers to where I should look?!?!?!
Thanks
-Ken Mazaika
|
|
|
|
|
Warreng Young's Winsock Programmer's FAQ is a valuable resource, and includes some links to tutorials.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|