|
furthermore to your question, how do I specify format (bold, italic, font, size, color, etc ...) of text I add by program ?
DD
|
|
|
|
|
hey, i have a hook procedure which catches the creation of menu windows... but it only works sometimes and for some menus
for example, the right-click menu in the caption bar always gets caught, and the top menus sometimes get caught
is there a way to catch the creation of ALL menus, like an example or something?
thanks
- Roman -
|
|
|
|
|
I want my application to start without creating an empty new document, but I still want it to load a document if specified on the command line. I remember that it is something in the CWinApp::InitInstance, but can't remember what.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
CCommandLineInfo cmdInfo;
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
ParseCommandLine(cmdInfo);
if (!ProcessShellCommand(cmdInfo))
return FALSE;
|
|
|
|
|
It does not work because if a file is specified on the command line, it sets to FileNothing anyway. But you put me on the track. I did the following:
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
cmdInfo.m_nShellCommand = (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew) ? CCommandLineInfo::FileNothing : cmdInfo.m_nShellCommand;
Tx
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Im using a CEdit to display a bunch of text.. is there a way to set the font so that it is fixed width? like this website, how all of the text lines up in set spacing no matter how thin or thick each character's width is..
i've tried:
BOOL CTextViewer::OnInitDialog()
{
SetWindowText(m_strTitle);
CDialog::OnInitDialog();
CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT1);
CFont font;
font.CreatePointFont(120,"FixedSys",NULL);
pEdit->SetFont(&font, TRUE);
return TRUE;
}
this seems to make the text bold, and it looks really strange when highlighting, but its not fixed width.. im having similar problems when printing as well..
ive tried using the print class from CP A Simple Printing Mechanism which is supposed to print lines in fixed width, but that doesn't work for me.. anyone see whats wrong with it?
BOOL CPrinter::StartPrinting()
{
DOCINFO info;
::ZeroMemory(&info, sizeof(info));
info.lpszDocName = AfxGetAppName();
SetPrinterFont();
dc->StartDoc(&info);
docStarted = TRUE;
TEXTMETRIC tm;
dc->GetTextMetrics(&tm);
lineHeight = tm.tmHeight + tm.tmInternalLeading;
pageVMargin = dc->GetDeviceCaps(LOGPIXELSY) / 2;
pageHMargin = dc->GetDeviceCaps(LOGPIXELSX) / 2;
pageHeight = dc->GetDeviceCaps(VERTRES);
pageWidth = dc->GetDeviceCaps(HORZRES);
Y = pageVMargin;
return TRUE;
}
void CPrinter::SetPrinterFont()
{
CFont f;
f.CreateStockObject(ANSI_FIXED_FONT);
dc->SelectObject(&f);
}
basicly i am trying to write a little dialog which shows text and prints the text in fixed width fonts.. any one tried the other simple print classes on here for fixed width?
thanks!
-dz
|
|
|
|
|
try using the standard fixed-width font: Courier New . it's easier on the eyes and easier to program than trying to force a proportionally-spaced font into evenly-spaced locations.
-c
30% of your base are belong to the IRS!
|
|
|
|
|
ive tried putting different font names into the font.CreatePointFont(120,"Impact",NULL); command, and i've tried passing CEdit->GetDC() instead of NULL, but the font always looks the same, and is not fixed width..
notepad uses fixed width inside of what I assume is a CEdit control, and it prints with fixed width.. i must be doing something wrong, or explaining myself wrong..
thanks!
-dz
|
|
|
|
|
Courier New is a fixed width font... unless you're using it wrong, there's no way for it not to be fixed width... post a screenshot and we'll help you from there
- Roman -
|
|
|
|
|
screen shot
and here is the code that i have currently..
BOOL CTextViewer::OnInitDialog()
{
SetWindowText(m_strTitle);
CDialog::OnInitDialog();
CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT1);
CFont font;
font.CreatePointFont(120,"Courier New",NULL);
pEdit->SetFont(&font, TRUE);
return TRUE;
}
i guess maybe i should take the time to look into CEditView (i guess thats whats in notepad).. but im still kinda confused on how to popup a window with a view in it..
-dz
|
|
|
|
|
I'm trying to debug the commandline in an MFC application. I want to load a file with a file assocation to my program. This program will then load the file to open. Just like double clicking a .txt file and opening up in notepad. Any ideas,
Thanks
|
|
|
|
|
I'm not sure what you mean, but you've got commandline support for free in a SDI or MDI MFC project (check the corresponding InitInstance .) Maybe you can start from there.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Are you trying to pass command line arguments to the program.
Project->Settings Debug Tab specify the name of the file you want to load in the "command line arguments" field. This way you can debug the stuff.
|
|
|
|
|
I want to load a file with a file assocation to my program.
Try ftype /? in NT5+. For NT4 and Win32c (aka Win9x) I think you need to edit the registry.
|
|
|
|
|
I was trying to use the ADO transaction mechnasim but had some problems. It appears that when I call the BeginTrans method, for whatever reason I can't terminate this transaction which ends up affecting calls after the tran.
This is my code essentially:
m_pConnection->BeginTrans(&nLevel);
bRet = DeleteObject(....)
if(bRet)
{
}
else
{
m_pConnection->RollbackTrans();
}
Essentially, if I get an error and try to rollback, it appears that the lock remains and I can't do anything else. Any ideas?
|
|
|
|
|
within the if(bRet) , do you commit?
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Hello,
I am attempting to read data from a file which is in numerous types. The data contains chracters, and data of type integer. float and double. I need to read this data off so that it remains in these correct data typse, that is the floats need to be read in as a float and the doubles must be read in as doubles. The data is in big-endian format and once it is read in I will be doing a byte reordering to convert the data to little-endian, which is why it needs to be read in as its saved data type. Thanks for the help.
Josh
|
|
|
|
|
Unless you've got additional info, you're in big trouble. Please note that any sequence of bytes can be interpreted as chats or floating point value. The format of the file somehow must allow you to interpret what kind of data comes next. As for the little-endian big-endian issue, in this post of mine I provide a small routine to do the conversion.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
How can we see the memory used by the DLL which is again used by the exe?
|
|
|
|
|
Is there a way to create an Access database programmatically without having access installed?
Please help!!
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
ADOX.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
I have a thread which launcher another application using ShellExecuteEx(). The problem is, the calling thread is NOT wating till the new Process gets launched.
Is there any way to delay the calling thread until ShellExecuteEx() finishes its job? Or is there any other solution for this???
Thanx in advance.
|
|
|
|
|
Srini Kella wrote:
Is there any way to delay the calling thread until ShellExecuteEx() finishes its job?
WaitForSingleObject()<br />
WaitForSingleObjectEx()<br />
WaitForMultipleObjects()<br />
WaitForMultipleObjectsEx()
Jeremy L. Falcon<nobr>
Homepage : Sonork = 100.16311
"It was a blind man who taught me how to see." - Aerosmith
|
|
|
|
|
The Wait* functions are not going to work because, once the ShellExecute returns, the corresponding new process will already be in non-signalled state.
I got a work around:
My new process has a got window. So, I delayed the calling thread using EnumWindows() in a loop. EnumWindows() checks for the new window!!
Anybody has got a better solution for this, Please!!
|
|
|
|
|
It will work depending on what you want to do. If you are waiting for the process to finish, then use...
WaitForSingleObject(hProcess, INFINITE); // INFINITE = -1
When the process terminates, it'll return. -1 means it'll wait indefinitely. I thought that's what you wanted, but if you only care about having the window created in the new process then see if this works...
WaitForInputIdle(hProcess, INFINITE); // INFINITE = -1
Jeremy L. Falcon<nobr>
Homepage : Sonork = 100.16311
"It was a blind man who taught me how to see." - Aerosmith
|
|
|
|