|
I am building an sdi app with a static splitter. I want to add a command so that when the user selects it from the menu, some controls are enabled in one of the views.
To accomplish this I manually added member variables to refer to the controls in the view class for one of the split windows. However, if I add a member variable using the GUI of vs.net, I can only add it to the original view class (that mfc appwizard created). How can I get the GUI to add them to my new view classes?
Thanks!
|
|
|
|
|
Don't - why would you want to ? Open the file and add them manually, as you say you have done.
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
Well, i have no use for the original view class anymore... though I don't really understand what happens to it when one uses a static splitter (sometimes when I resize the window and it flickers, it seems like the old view is still under there?). I am just curious how the GUI decides where to put the member variable, if it determines it from the code or if it is just some obscure setting somewhere that it set when the appwizard generates the project.
|
|
|
|
|
I really need example code to help me with accessing a control that is in a dialog bar from the main window. I have not found any examples or tutorials on the internet.
-- Steve
|
|
|
|
|
How can I get the my program "Tray Icon position" in Desktop window without any clicking message from icon?
|
|
|
|
|
|
Does anyone out there have any information about how to mix a MFC EXE that uses CString with a DLL that uses ATL CString?
They are related but won't link together as-is.
Any clues or news out there?
P.S. I am not looking for alternatives to CString, but am looking for information about how to make these slightly different CString's talk to each other.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
Santa Cruz Networks
|
|
|
|
|
For completeness, I'll share what I've learned.
Though first, I'll say, that everytime I think MS is getting their act together, you run into to something totally weird...
If your MFC program wants to call a DLL that uses CString in it's API's -- they will only work if the DLL is MFC too. ATL CString will screw it up with name clashes....
I fixed my problems by using AtlCString -- which the ATL CString is a typedef of.
there's no documentation for this at all.....
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
Santa Cruz Networks
|
|
|
|
|
This isn't specific to visual C++, but hopefully someone can help me anyways
I have a vector full of objects... I wish to sort this vector by the return value of one of the object's methods.
IE
----
vector<dog> dogs;
//load vector with random dogs...
----
I wish to sort the dogs by their age, int dog.get_age();
Is there a simple way to do this?
Thanks!
Greg
|
|
|
|
|
You could simply use a map with the key the dog's age and that's that. Or for a vector use the sort algorithm: sort( dog.begin(), dog.end() ). You'll need to read up on sort().
Note that there is an STL/ATL/WTL message board which you should have used.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Greg23234 wrote:
I have a vector full of objects... I wish to sort this vector by the return value of one of the object's methods.
You might want to have a look at the documentation for the std::sort that takes a predicate, where your predicate is something like
bool predicate(const dog& a, const dog& b)
{
return a.fn() < b.fn();
}
|
|
|
|
|
Okay I understand that in the regular C++, programs start at main() and run thru each line until it finishes. And that in MFC everything is controled by a message map. So If I want to run a function, without an event calling it like for a button, then I need to create a message map and call it.....right?
I mean why can't there be an easier way to call a function outside of events.
So my problem is that I've read the docs on messaging on CP and went thru the steps but every time I create a message map I get and error unresolved external symbol. Am I missing something?
My issue is this. I want to have me main dialog window come up. Then I want a function to run. My problem is that my function runs first then the main dialog window comes up. So how can I by pass this?
Is there an easier way of doing this?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Tom Wright wrote:
So If I want to run a function, without an event calling it like for a button, then I need to create a message map and call it.....right?
No not right. If your function is not an event handler, then y do u need to use message maps for it? u can simply call it like any other function in C++.
Tom Wright wrote:
My problem is that my function runs first then the main dialog window comes up. So how can I by pass this?
To make sure that your dialog comes up first and your function is called next. Call your function in InitDialog() function after the call of base class InitDialog function call,instead of constructor for CDialog.
cheers
Muhammad Shoaib Khan
http://geocities.com/lansolution
|
|
|
|
|
Sorry I didn't mention that I am calling my function in the OnInitDialog() function, but my main windows still does not come up because it won't until after it hits the return TRUE.
Thanks anyway
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Sorry I didn't mention that I am calling my function in the OnInitDialog() function, but my main windows still does not come up because it won't until after it hits the return TRUE except that it hits my function call first.
Thanks anyway
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Where do you call this function? If you call it from OnInitDialog() then it will be executed before your dialog shows up. Post a message (WM_APP+number) at the end of OnInitDialog() to your app and do all your initialization in the event-handler of the WM_APP-message. This message will be received by your app directly after the dialog shows up.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Okay Mike Dunn told me the same thing.....but I have no idea what you are talking about. Can you give some more info on this?
For instance in my OnInitDialog() before the return TRUE, I put PostMessage(WM_APP+1);
After this you lost me. I have a clue as to what you are saying.
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Tom Wright wrote:
For instance in my OnInitDialog() before the return TRUE, I put PostMessage(WM_APP+1);
correct.
I haven't tested the next steps, but it should work:
Create a WindowProc for your CDialog-derived dialog with the class-wizard.
You could then check if the message is WM_APP+1. If it is, you simply call your function you want to execute. Example:
LRESULT CFavToHTMLDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_APP+1:
YourFunction();
break;
}
return CDialog::WindowProc(message, wParam, lParam);
}
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Can you guys recommend a good book that describes messaging in windows?
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Programming Windows by Charles Petzold writen .I am studying now.
I am like programing!
|
|
|
|
|
Hello all,
Could someone please direct me to where I can get information (or better yet, sample code) on how to apply different time zones to system time (without changing the actual system time, of course).
I've looked at MSDN, but found nothing useful.
I also didn't find any way to obtain the list of time zones along with countries/cities that Windows itself uses for regional settings.
Any help greatly appreciated,
Thank you in advance,
MCP, MCSD
|
|
|
|
|
I had to do something similar at one time with software on an aircraft that could traverse multiple time zones, although limited to those in the US. Since the computer itself had only one time zone within which it lived, we always knew the time within its own zone. This can be found with a CTime object and the member function GetCurrentTime(). This CTime object can be formatted with the member function Format(), and the time zone can be parsed out, if needed.
Based on that known time zone, I made a drop-down list of US time zones by name that converted into hour offsets from the computer's zone. If they wanted local time to be referenced in Eastern Time, which they selected from the drop-down list, then this converted to adding 2 hours to the computer time before displaying.
It was fairly cheap and easy, but it did the job.
Good luck,
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
Yes, I understand that approach, but what I need is to go International
That's the problem - if I choose to implement it this way, then where can I get a list of all major countries/cities with their times zones?
Or is there another approach?
Anyway, thank you for replying,
MCP, MCSD
|
|
|
|
|
Sorry, without knowing any details, I couldn't give you EXACTLY what you wanted.
Is there any way you could let the users select an offset from GMT, rather than by selecting a city? If so, then you know your difference from GMT and could add their difference and come up with local time for them (?).
If not, I guess it would be nice to have a scrolling world map that they could select their area, similar to setting the clocks on the PC. I'm surprised there isn't one of those available as an ActiveX control.
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
David Chamberlain wrote:
Is there any way you could let the users select an offset from GMT, rather than by selecting a city?
That would be too easy...
Unfortunately, for most of my users, this will be too hard of a task - it's not a major part of my program, just a small nice addition I want to bring in. Besides, most people won't really know what time zone they're in, and even if they do know about their own time zone, they probably won't know about another zone of the world (for example to watch time in New York, Sydney and Kuwait).
David Chamberlain wrote:
scrolling world map that they could select their area
I've searched around, but didn't find such a control... That would be really nice though.
Thank you for replying,
MCP, MCSD
|
|
|
|