|
What both I and Michael Dunn suggested is a common technique used when something has to be done when all dialog controls has been created and initialized. I thought this was your problem since it's quite common.
The last message handled when a dialog is created is usually WM_PAINT. Both WM_SIZE and WM_SHOWWINDOW are sent prior to WM_PAINT.
If it's imperative that your dialog is visible to the user there is no message handler you can override. You have to write code inside the message handler for WM_PAINT, OnPaint().
Like this:
void CShowDlg::OnPaint()
{
static BOOL bShown = FALSE;
if (IsIconic())
{
CPaintDC dc(this);
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
if( !bShown )
{
bShown = TRUE;
}
}
Sorry that I misunderstood your needs. :->
I just haven't encountered a initialization situation yet that actually requires the dialog to be visible and I can't figure out why this would be necessary. It's not necessarily wrong, I'm just curious.
--
Roger
It's supposed to be hard, otherwise anybody could do it!
Regarding CodeProject: "resistance is pointless; you will be assimilated"
|
|
|
|
|
Hello, that's still not quite what i want, maybe i'm going about it all wrong.
The dialog box has a text box inside, and i would like this to display text strings about the status of the program to the user. The whole process needs to be launched by pressing a button, which launches the form, and only then once the form and controls are visible can the program's main function begin as otherwise any realtime messages to the controls won't be visible. I know i could probably do this more efficiently using another thread but i thought it would be much more complex and error prone.
Is there a better way of doing this?
Thanks a lot for all your help btw.
|
|
|
|
|
depends
functions you've overriddened?
Kuphryn
|
|
|
|
|
I haven't overridden anything, that's the problem, i don't know what to override that would work the way i want it to?
Any suggestions?
Thanks
-- modified at 17:28 Thursday 8th June, 2006
|
|
|
|
|
override various functions and add message handlers
not easy determining best point in this case
Kuphryn
|
|
|
|
|
sschilachi wrote: I would like call a function as soon as a dialog is open and visible, but i cannot find a way of telling when this is so.
iS WM_SHOWWINDOW or WM_SIZE message of any help
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
I don't think my query(on C) is directly related to this board..however i post it here cos of urgency...
I wrote:
--------------------------
#include<stdio.h>
void fun(int** x)
{
printf("%d",**x);
}
int main(void)
{
int a[2][2]={1,2,3,4};
fun(a);
return 0;
}
--------------------------
to get '0' as output and not '1',i.e.the 1st element in the array.
I ran this on TC 2.01.
Help me if this is buggy.
Thanx!
|
|
|
|
|
ramamaru wrote: to get '0' as output and not '1',i.e.the 1st element in the array.
How are you expecting to get '0' as an output. The array has four elements, none of which are '0'.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
first your initializing the array incorrectly
it should be [int a[2][2] = {{1,2},{3,4}};]
??to get '0' as output and not '1' you set the first element to 1 so what
are you asking there.
|
|
|
|
|
ramamaru wrote: to get '0' as output and not '1',i.e.the 1st element in the array.
but there is no zero In Array Inisialization List!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
oh my God..i told that i got 0 as output...and not 1...Why? Thatz it
|
|
|
|
|
In case you still need help:
I recommend reading this article which answered all my questions
on arrays in the past. Statically- and dynamically-allocated arrays
are stored differently - keep this in mind and it will help you to find
the solution to your problem.
Good luck, Sebastian
-------------------------------------------
My website: http://www.hartwork.org
|
|
|
|
|
how do i create a control in win32 application avoiding m_pCtrlSite error.
thnx
Kanchana
|
|
|
|
|
I'm not sure.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
hmklakmal wrote: how do i create a control in win32 application avoiding m_pCtrlSite error.
Are you using Microsoft Form Control 2.0?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Yeah.
But i want to add shockwave flash object to my win32 app.
how should i do it.
Cant add activex control to app in win32?
I can add it as atl object but how can i set its properties?
I need Help.
Kanchana
-- modified at 17:51 Friday 9th June, 2006
|
|
|
|
|
Hi. I badly need help. Am not able to link a HTML Help file in either Win32 or Visual C++. Could anyone please help me!!
|
|
|
|
|
And the error message from the linker would be?
Chris Meech
I am Canadian. [heard in a local bar]
The America I believe in has always understood that natural harmony is only one meal away from monkey burgers. [Stan Shannon]
GOOD DAY FOR: Bean counters, as the Australian Taxation Office said that prostitutes and strippers could claim tax deductions for adult toys and sexy lingerie. [Associated Press]
|
|
|
|
|
adiilah wrote: Am not able to link a HTML Help file...
With/to what?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
You could use ShellExecute to open the html file with the associated application, which would tpyically be the default browser.
ShellExecute(m_hWnd, "open", "my_help.html", "", "", SW_SHOW );
Is that what you're asking?
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
adiilah wrote: Am not able to link a HTML Help file in either Win32 or Visual C++
actually what problem are you facing?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi all,
I want to use GetThreadId in my application but when I want compile and run application i get this error
of course i dont get error View - 0 error(s), 0 warning(s) but i get this error and my program dont run.
View.exe- Entry Point Not Found
The procedure entry point GetThreadId could not be located in the dynamic link library KERNEL32.dll
my class is CDialog
Thank you
|
|
|
|
|
Based upon this[^], I'd say your are not running on Vista.
Chris Meech
I am Canadian. [heard in a local bar]
The America I believe in has always understood that natural harmony is only one meal away from monkey burgers. [Stan Shannon]
GOOD DAY FOR: Bean counters, as the Australian Taxation Office said that prostitutes and strippers could claim tax deductions for adult toys and sexy lingerie. [Associated Press]
|
|
|
|
|
I use XP is it possible run in xp this function
|
|
|
|
|
Did you not see the link that Chris provided? It clearly states what is required.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|