|
Don't cry man
Are you doing your stuff before or after calling the default CDialog::OnWindowPosChanged implementation?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Now that you have an alternative solution, this is of limited interest, but I felt like posting it here. Today I finally could do some testing with my VStudio, and found WM_PAINT is an appropriate place to insert the launching of the second dialog:
void CMyDlg::OnPaint()
{
if (IsIconic())
{
...
}
else
{
CDialog::OnPaint();
if(m_bFirstTime){
m_bFirstTime=FALSE;
...
}
}
} Regards.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
You could post a message to the dialog from
OnInitDialog(). <br />
<br />
<font size="1pt" color="#D5EAFF">--------</font><br />
<p style="font-family: "Palatino Linotype", "Comic Sans MS", Arial, sans-serif; font-size: 10pt; line-height: 0.9em; margin-top: 0; margin-bottom: 2px">And we die young.<br />
Faster we run.</p> <p align="right" style="font-size: 6pt; margin-top: 0; margin-bottom: -2em">Alice in Chains, We Die Young</p>
|
|
|
|
|
Shog9,
I used the method that you suggested and it works well. Thanks!
|
|
|
|
|
No problem. It should be noted, Ravi did an excellent job of explaining what i alluded vaguely to
--------
And we die young.
Faster we run. Alice in Chains, We Die Young
|
|
|
|
|
Try Shog9's approach. Just do this somehere in OnInitDialog() :
PostMessage (WM_COMMAND, IDC_SHOW_LOGIN_DIALOG);
In your handler for the IDC_SHOW_LOGIN_DIALOG command, do this:
CLoginDialog dlgLoginDlg (this);
long nStatus = dlgLoginDlg.DoModal();
if (nStatus == IDOK) {
if (dlgLoginDlg.IsLoginValid()) {
return;
}
}
AfxMessageBox ("Login failure - exiting...");
OnCancel();
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
i want to know if there is any way to drag and drop a bitmap around a window,
if at all there is a way, can somebody help me out
Ashok Singh
<west end="" india="">
|
|
|
|
|
Did you paint the bitmap to the window?
Handle the WM_LBUTTONDOWN and WM_MOUSEMOVE messages to determine the position of the mouse, and the offset for which the mouse has been moved, and repaint the bitmap yourself.
As long as you are doing this in just one window, it should be fairly simple. If you want to drag and drop between to applications it will be more difficult.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hey all. I'm just starting the adventure of learning Windows graphics programmnig and I was wondering if there were any GDI / Bitmap manipulation tutorials that you would recommend. Any suggestions would be greatly appreciated. Thanks!
-Mike
|
|
|
|
|
GDI Bitmap Tutorial Chris Becke,
DIBSection Class Chris Maunder,
Do a search on the articles, you will find many more.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
The reason why I posted this today was because Chistian Graus mentioned about a WM_IDLE message. I searched MSDN for the message and could not find it.
I have a owner-data list that displays a live data feed. The only way I can update the screen is to use 'SetItemCount' function - but this redraws the entire list (for the part that is visible). If I did this on every update, the processor usage significantly shoots up. So, I decided to use a timer and a boolean variable (that gets set when an update occurs) and is reset when the painting is done in the timer.
Is there a better way to do this? I am just looking for alternatives that might be better. Due to some unknown reason, I am not satisfied with this solution.
Would the idle message be a good place to do this? and if so, how do I use it?
Thank you.
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
In MFC there is and OnIdle handler that MDC generates for you.
How long do your updates take? I think the method that you have devised is perfectly acceptable. It is simple, and it would also be easy to change the update rate by changing the timer rate. Except, do you have multiple threads, because it may not be neccesary to flag your control as needing an update if you only have one thread.
If you are using teh SDK, there is a way to generate your own IDLE handler by using PeekMessage instead of GetMessage, and callng your handler whenever the queue does not have any messages. then you will have to insert a WaitMessage function when the message queue is empty to prevent the loop from spinning endlessly.
If you choose to do the idle handler, I would suggest that you put a limit on how often your list can update, because idle updates can happen quite frequently.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
The painting is fast and actually, I do not have any problems with it. I was just wondering whether the timer is the correct or atleast the most acceptable way to do it.
I do have multiple threads that change the data. Also, I did not want to paint unnecessarily when there is no change in data.
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
I get around the update flicker by updating (not repopulating) the list control. This works quite well. I do the update in the WM_TIMER handler. If you want to see it in action, check out the Time Tracker tool of my product FooBar.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Does the update have a difference on owner-data, custom drawn list controls? The parent window gives the data to the control on LVN_GETDISPINFO notification. So, to initiate a paint, I call only the SetItemCount() or SetItemCountEx() function.
Btw, I am downloading the foobar. Looks great from the site.
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
No, it shouldn't matter. Btw, to update the control, I just set the item text for the changed rows/columns.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Using the following:
VC++ 6.0/sp5
Win2K, Win95, and Win98
Our app uses some proprietary file formats and of course, the appropriate file types are associated with our app. However, when I double-click an associated file type, I get a message that is generate by windows that reads:
Cannot find the file "full path/name of file I clicked on" or one of it's
components. Make sure the path and filename are correct and that all
required libraries are available.
The path\filename are correct, and all of the required libraries are available. In fact, if I just load the app and open the very same file from within the app, it opens fine. Similarly, if I pass the desired filename in on the commandline, it opens fine. I can also drag a file onto the app window, and it will open without complaint.
At the top of OnInitInstance(), I have added the following code:
CString sCmdLine = ::GetCommandLine();
AfxMessageBox(sCmdLine);
The resulting string shows this (including all quote marks shown):
"D:\path\myprogram.exe" "
When I manually pass the filename in on the commandline, the same string shows this:
"D:\path\myprogram.exe" "D:\path\myfile.xyz"
What the heck is wrong here?
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
|
|
|
|
|
these are dumbass suggestions so dont yell at me for them being so
filename has no quote marks or wierd stuff in it?
filepath likewise?
situations to avoid #37: "good morning ... how many sugars do you take in your coffee ... and what was your name again?"
coming soon: situations to avoid #38: "...and the dog was there too?"
|
|
|
|
|
Everything looks good on the paths and filenames (as they show up in explorer).
Could something be funky in the registry?
Hmmmm....
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
|
|
|
|
|
maybe the file association links got trashed?
situations to avoid #37: "good morning ... how many sugars do you take in your coffee ... and what was your name again?"
coming soon: situations to avoid #38: "...and the dog was there too?"
|
|
|
|
|
John
How are you doing the association - and does the error happen with files with spaces in the name ?
If so the
shell\open\command default value might be this
<your app="" path=""> %1
try this
<your app="" path=""> "%1"
ensures that the spaces are treated as one full string instead of multiple files
also try
"<your app="" path="">" "%1"
if that doesn't work
|
|
|
|
|
Sorry that last message did't work quite right
John
How are you doing the association - and does the error happen with files with spaces in the name ?
If so the
shell\open\command default value might be this
<your app path> %1
try this
<your app path> "%1"
ensures that the spaces are treated as one full string instead of multiple files
also try
"<your app path>" "%1"
if that doesn't work
|
|
|
|
|
The problem may be in the registry. Look at the default value under HKEY_CLASSES_ROOT\.xyz (the value is noted <the_value> below).
Then look at the default value of the following key, that may be the cause of the problem:
HKEY_CLASSES_ROOT\<the_value>\shell\open\command
May be this string is just wrong (messed up quote or something).
I hope this helps,
David Defoort
|
|
|
|
|
I'm using Wise 9.1 for instalations, and for some reason, it's translating this:
"%MAINDIR%\myapp.exe" "%1"
to this (showing as it appears in the registry):
"D:\program files\mycompany\myapp\myapp.exe" "
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
|
|
|
|
|
adding another "%" to the original line fixed the basic problem, but I'm still getting this
Cannot find the file "full path/name of file I clicked on" or one of it's
components. Make sure the path and filename are correct and that all
required libraries are available.
weird.
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
|
|
|
|