|
In your OnInitDialog() , just before you return you can show the window and it's descendants. Then you can call your Update button handler, as though the user had clicked it.
...
CDialog::OnInitDialog();
SendMessageToDescendants(WM_SHOWWINDOW, (WPARAM)TRUE);
SendMessageToDescendants(WM_ENABLE , (WPARAM)TRUE);
OnUpdate();
return TRUE;
"The folly of man is that he dreams of what he can never achieve rather than dream of what he can."
"If you think education is expensive, try ignorance."
|
|
|
|
|
Anonymous wrote:
I want to call some code after my dialog has been displayed on the screen
There may be other ways, but I would probably do this by calling a thread in your OnInitDialog function. The thread would first sleep for however long you want it to, then update your display before returning. Good luck!
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
I would use a timer.
something like this:
BOOL CDlgXXX::OnInitDialog()
{
CDialog::OnInitDialog();
SetTimer(TIMER_ID, 50, NULL)
return TRUE;
}
void CDlgXXX::OnTimer(UINT nIDEvent)
{
if (TIMER_ID == nIDEvent)
{
KillTimer(TIMER_ID);
return;
}
CDialog::OnTimer(nIDEvent);
}
“Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002
|
|
|
|
|
Greetings All,
I have a CBitmap object and wish to derive a CTiledBitmap from it ?
What do I have to consider:
Do i have to use virtual Constructor/Destructor ?
Can I just have CBitmap as a member of CTiledBitmap ?
Any advice of how-to for derived classes ?
Cheers
If sex is a pain in the ass, then you are doing it wrong!
|
|
|
|
|
An useful question when considering whether you should model your new class as derived from some base class is the following:
A CTiledBitmap is a CBitmap ?
Or put another way:
If I change all occurrences of CBitmap with CTiledBitmap in a preexisting program, will the program still work?
I guess the answer in your particular case is no. Please note that the interface of CBitmap is not virtual, so the class is not designed with derivation in mind. Probably, a better design is to derive your CTiledBitmap from CGdiObject and have CBitmap as a private member.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks
The CBitmap is a class of mine: should probably call it CMyBitmap ?
it has it's own constructor, loader and draw function.
So A CMyTiledBitmap is a CMyBitmap with some extra members (for the tiling info).
So, If I change all occurrences of CMyBitmap with CMyTiledBitmap in a preexisting program, the program will still work, but will have greater resource overhead.
So Why do I make the CMyBitmap constructor virtual ?
Cheers
If sex is a pain in the ass, then you are doing it wrong!
|
|
|
|
|
Hi, I'm having trouble plotting different series in the same mschart, how can I do this if each plot has a differente number of points??
Thanks!
Julihc
|
|
|
|
|
Hi,
I ma currently facing the same problem. Please let me know if you have found any solution.
Thanks!
|
|
|
|
|
As I'm a fairly new MFC programmer, I'm sure there is an easy explaination for my question. I've just run out of ideas on where to find it. I've solved this a different way than I think I should have to, and want to know why I had to.
I have options that I have placed on the file menu. I want those options to grey out if a certain boolean is set/unset. Easy so far. I added UPDATE_COMMAND_UI handlers for those options. My understanding is that each command on the File menu with an UPDATE_COMMAND_UI handler will have that handler called when the user attempts to drop down the file menu. Using breakpoints, I have discovered that this is not the case. The only time one of those handlers is called (or at least in my project) is when the particular option on the file menu is selected, and then it is the update handler for that option only. No, I have not confused COMMAND and UPDATE_COMMAND_UI. I have both, and of course each is mapped to a different function. Using OnInitMenu, I have been able to set the state of all menu items properly, but that seems to be a brute force method rather than the nicer update handlers.
This isn't the only problem menu, either. I have an options menu with a second pop-up menu with 2 options, only one of which should be checked. The update handlers would be perfect... one line of code in each handler. However, they act the same. Only when I PICK one of the options is the update handler called, concurrently with the command handler. So, I have more complex logic in the OnInitMenu function to set their checked states when the menu is opened rather than the nicer update handlers... any help, please?
|
|
|
|
|
duckpuppy wrote:
The only time one of those handlers is called (or at least in my project) is when the particular option on the file menu is selected, and then it is the update handler for that option only.
Last I read, the handlers are called during the processing of WM_IDLEUPDATECMDUI messages. This message is sent after the application has emptied its message queue.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
|
This is a dialog-based app. I figured that had something to do with it... I just wasn't sure what (technically, I'm still not sure... can you enlighten me )
|
|
|
|
|
And I've found it... CWnd doesn't implement the processing of WM_INITMENUPOPUP, CFrameWnd does. So, what is the "appropriate" method of emulating this in a CDialog based class? As I said, I have one way, but am interested in what most people consider the "correct" way of handling it.
|
|
|
|
|
|
I'm writing a program that needs to make some folders, can I do this with createfile? I've been trying to do it this way but I keep erroring out. Am I missing something?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Use CreateDirectory .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
That's it. I must be getting old cuz I just cannot remember all of these API's
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Try ::CreateDirectory() instead.
..
..
if( !CreateDirectory(szDirPath, NULL) )
{
dwError = GetLastError();
if( dwError != ERROR_ALREADY_EXISTS )
return FALSE;
}
..
..
I Dream of Absolute Zero
|
|
|
|
|
On page 170 of Lippman's, "C++ Primer: 3rd Edition", about mid page, it shows this example:
bitset<32> bitvec3(012); Then he shows the output of that sample as:
0000...1010 Having read the passage that explains the expression and its result, I am still at a lost for clarity (because the result seems to be based on position rather than value).
There is no way that 00001010 is 12, numerically, so I set about doing some experiments of my own. I did:
bitset<8> bv012(012);
bitset<8> bv021(021);
bitset<8> bv12(12);
bitset<8> bv21(21); The results of those experiments were:
00001010
00010001
00001100
00010101 The last two (12, and 21) are the correct numeric values for their binary representation, but I am at a lost as to how "012" and "021" can positionally produce the result the computer has shown.
If anybody knows how this is accomplished, I would very much appreciate a clearer explanation than what Lippman has given.
Thanks.
William
Fortes in fide et opere!
|
|
|
|
|
Hey, you got caught by a language oddity coming back from the days of Kernighan and Ritchie: 012 is interpreted to be octal, thus its value is 8. In general, numeric literals beginning with 0 are interpreted to be base-8, much as numeric literals beginning with 0x are hexadecimal. This is one of those useless rarities of the language that everybody sooner or later gets kicked by (if you're in programming long enough, that is.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks for replying.
Octal. Octal. I even hate the mention of it. Little wonder why it never got caught on.
The picture is clear now. Thanks. I appreciate it.
William
Fortes in fide et opere!
|
|
|
|
|
*chuckles* Never caught on?? On the contrary, everyone used octal originally. Hex became popular some years later.
--
-Blake (com/bcdev/blake)
|
|
|
|
|
Blake Coverett wrote:
On the contrary, everyone used octal originally
:-DThat was the time when real programmers, being used to switch in their program, looked down on the assembler-using weaklings, much like the C++-programmers of today look down on the VB-users?
I do not personally remember this time - too distracted learning to walk!
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Does any know some sample code or application
to display the japanse/chinese in OpenGL?
Thanks in advance.
Shin
|
|
|
|
|
How do I list/iterate through all the Exchange servers on a local network? I need to create a list box with all the servers for a installation program.
|
|
|
|