|
So that phenomenon is suppose to be normal? Thanks for your efforts, if some other ideas come up, please let me know. I will really appreciate it.
|
|
|
|
|
No, it should be like that.
What you write in the OnPaint should stay in the dialog until a update window, update region, update dialog, erase background, resize the window/dialog, change between apps... any message that implies a refresh of the screen.
So if your text is not showing I guess you are calling unvoluntarly one of that messages just after your OnPaint, or not calling the OnPaint fter on of those messages.
Use the Step by Step in debugging and take a look on your code executing.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Thanks for your effort. I will look into it.
|
|
|
|
|
jazy1 wrote: The text should not disappear even if the OnPaint returns right?
Right!
Something else is going on that you haven't shown...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I found out what was wrong, the generated code by the VS2005 for painting the toolbar and status bar(OnCreate) kept repainting the client area, thats why it wasn't visible... I think this may not be the fix, but at least I got the string to show... Thanks for your efforts guys.
P.S. I still don't think this is the fix since it is a generated code, it is suppose to work properly... Post please if you have any idea.
|
|
|
|
|
I have a MDI project, now I want to print the interface. So I saw this article:
http://support.microsoft.com/kb/q186736/
Then I try to apply to my project, just create a menu item or button, do like this:
ON_COMMAND(ID_PRINT_PRINTALL, &CMyDlg::PrintGUI)
afx_msg void PrintGUI();
void CMyDlg::PrintGUI(){
CWnd* a = AfxGetMainWnd();
PrintWindowToDC(*a);
}
But when I run, nothing happen.
Have anyone ever tried the similar thing? Please helpppppppp !!!!!!!!!!
|
|
|
|
|
here in the CP there are articles to print a screen capture, to print from a dialog, to print using or not using MFC... I strongly recommend you to have a look into that section.
IMHO the best articles are from Roger Allen, Chris Maunder, Joseph M Newc...
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
I am trying to convert the c file for some other compiler to MS VC++ .Net compiler.
In the c file, there are some value specified like 031bH which means 0x031b.
I want change all of them using Regular Expression,
Using the R.E. "[0-9]^3[a-fA-F0-9][H]" in "Find what" and "0x\0" in "Replace with" the value is coming like 0x031bH.
How can I remove the H in a single step while prefixing with "0x"?
--
"Programming is an art that fights back!"
|
|
|
|
|
Try this (it works in VI for me, but your mileage may vary depending on which RE tool you are using - regardless, it should be enough to get you running in your environment):
Search string: "\([0-9a-fA-F]\{1,4\}\)H"
Replace string: "0x\1"
Note that the above will only parse hex constants in the form you mentioned with 1-4 hex digits preceding the 'H' suffix.
|
|
|
|
|
Hi
Thank you very much for the help!!
I will try this..
Regards,
Suman
--
"Programming is an art that fights back!"
|
|
|
|
|
|
Take a look three messages below this one. The question is asked and answered with some links.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
I've found it since. What I was looking for was:
void CWinApp::RegisterShellFileTypes(BOOL bCompat)
Bram van Kampen
|
|
|
|
|
Hi,
Well, the question 3 lines below covered the same topic, but did not cover what I was after. I was looking for the Name of: CWinApp::RegisterShellFileTypes(); (I could at the time not think of the Name, and was not sure of the class it belonged to). The business part of this resides in CDocManager. I am now doctorring that code to register critical extensions in my setup program.
Thanks anyways for the Interest you showed in my question.
Regards,
Bram van Kampen
|
|
|
|
|
|
I've found it since. What I was looking for was:
void CWinApp::RegisterShellFileTypes(BOOL bCompat)
Thanks
Bram van Kampen
|
|
|
|
|
Hi Mark,
My question was a bit more subtle. I never use the Document Interface, but actually what I was looking for (and since found) was 'CWinapp::RegisterShellFileTypes()'
I am hacking that now in order that my instalation program sets file asociations for rarely used utilities. For example, many european ISP's do not allow DLL's EXE's etc to be send as an e-mail attachment. No Problem, I wrote a utility which converts the binary into a text file, which I gave the extension say '.QXP' I also include in the release, a program that silently (no UI if things go Right) converts the QXP file back. The idea is also that double clicking by the usr on a 'QXP' file should start the conversion back
All this works, and fails gracefully on error. There is one issue remaining, and I'm running out of computers to test it, and that is, what does 'CWinApp::EnableShelOpen()'actually do.( This is subject to another posting).
Regards
Bram van Kampen
|
|
|
|
|
I want to print some icons. Here is my code:
CDC* m_PrintDC;
CPoint point(10, 10);
HICON aIcon = AfxGetApp()->LoadIcon(IDI_ICON_CHECKEDBOX);
m_PrintDC->DrawIcon(point, aIcon);
Here IDI_ICON_CHECKEDBOX is a icon ID that I draw.
But it doesn't work, I don't know why?? I can print some text with DrawText(...).
Anyone know what's wrong here? Thank you in advance.
|
|
|
|
|
What's the dpi on the printer DC?
A 32x32 icon will be pretty small on a 1400dpi printer
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yes, without other mapping,
about 0.023 inch per side.The final rendering software may pass that off as noise and decide to print a blank page.
Regards
Bram van Kampen
|
|
|
|
|
thank you for your reply!
my printer is HP LaserJet 3052, with 1200dpi.
So do you have any idea what I should do in this case?
|
|
|
|
|
Create a New Bitmap of fixed dimensions of your choice, Bitbuild your Icon in it, using stretch mode, and then print this new bitmap.
Regards,
Bram van Kampen
|
|
|
|
|
I have a visual c++ program and I am trying to get the value of an environment variable using the getenv function. Seems pretty simple but when i call it in the debugger I get the message "Please enter path for libcpd.pdb." Does anyone know why this happens on this function?
Note: The program compiles and builds witjh no errors. Only when I run it I get the problem
Here are my includes (although I dont think it has anything to do with this):
stdio.h
stdlib.h
iostream.h
cstdlib.h
windows.h
Rock
|
|
|
|
|
rocktx wrote: ...I get the message "Please enter path for libcpd.pdb."
See here.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|