|
The MSDN doc's [^] give a list of cases where the compiler can't inline, even if you specify forceinline.
The two of note are :
- default debug builds
- virtual methods
In either case the compiler will generate a normal function call.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Hi!
I've created an SDI application with MFC. I want to add a splash screen during the loading of my program, to hide the main frame while loading and show it when the application has finished starting.
In my App class InitInstance function, I've deleted the two following lines:
<br />
m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);<br />
m_pMainWnd->UpdateWindow();<br />
But my main frame is still visible. How to hide it while my application is starting?
Thks in advance!
Appstmd
http://www.appstmd.com
|
|
|
|
|
Check Mike Dunn's C++ FAQ[^] question 7.6, maybe it is applicable to your case.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
you could call your splash screen before the main frame is displaed
you could place this at the start OnNewDocument() function
si
|
|
|
|
|
|
Hi guys
There is a limit in the number of controls in a dialog?
There is a way to pass this number?
I was making a copy apste until the paste had less controls than the copy, then I thought that it was a limit
Best regards
Dr.pi
|
|
|
|
|
What's the point ?
~RaGE();
|
|
|
|
|
Practical answer: No, there is no limit.
Real answer: There are limits, but they're BIG ones.
A dialog box is just a window. Controls on the box are just child windows. So the limit is the
upper limit on HWNDs imposed by windows. As I remember, Win95 had a limit of 8 or 16 thousand.
Windows NT (which 2000 and XP are, despite the names) are only limited by memory. So you can have
a few million if you like.
There are earlier practical limitations though...
1) You have to be able to see them. 1 pixel x 1 pixel controls help noone. So you are generally limited
to several hundred by the screen.
2) You have to able to design it. The resource editor may well have limitations. You could use a
text editor instead, but do you have that much patience?
3) You have to be able to identify most of the controls. Window ID numbers are not infinite...
(GetDlgCtrl (UINT id)...)
The mind boggles as to WHY you care about the upper limit. Usability will kill your design
long before windows does.
Iain.
|
|
|
|
|
Hi Iain
Then maybe the limitation is more in the resource editor than in the Visual C++?
Best Regards
Dr.Pi
|
|
|
|
|
Last I knew, this limit was 255 (or 256). There is no limit when creating the controls dynamically, however. If you've the need for that many, it's better to consider a tabbed-dialog.
|
|
|
|
|
I am opening a document with a password, and attempting to save it without a password. I keep getting a type mismatch on the vtFileFmt parameter in the SaveAs function. The documentation that I have found says that the format can be one of these:
typedef enum {
wdFormatDocument = 0,
wdFormatTemplate = 1,
wdFormatText = 2,
wdFormatTextLineBreaks = 3,
wdFormatDOSText = 4,
wdFormatDOSTextLineBreaks = 5,
wdFormatRTF = 6,
wdFormatUnicodeText = 7,
wdFormatEncodedText = 7,
wdFormatHTML = 8
} WdSaveFormat;
so I'm setting the second parameter to 0. So why doesn't this work!?
_variant_t vtFileToOpen(lpszPath);
_variant_t vtTrue(VARIANT_TRUE);
_variant_t vtFalse(VARIANT_FALSE);
_variant_t vtPwd("MYPASS");
<br> <br>
Word::_DocumentPtr doc = app->Documents->Open(&vtFileToOpen, &vtTrue,
&vtFalse, &vtTrue, &vtPwd);
<br> <br>
doc->put_Password(_bstr_t(""));
_variant_t vtPwdNew("");
<code>_variant_t vtFileFmt(0);</code>
<br> <br>
if (SUCCEEDED(doc->SaveAs(&vtFileToOpen, <code>&vtFileFmt</code>)))
{
doc->put_Saved(VARIANT_TRUE);
doc->Close();
}
Also, why can't I just use put_Password(_bstr_t("")) then SaveAs with just the file name? It asks for a password the next time I open it. This works when I use SaveAs to set a password elsewhere in the app.
Sometimes I'd like to strangle whoever made OLE. Oh, and don't forget the guy who makes the documentation for this stuff. He's gonna get it too.
Jason Henderson I bleed orange.
|
|
|
|
|
My Word Automation looks a tad different than yours:
CString strFileName;
_Application app;
Documents docs;
_Document doc;
COleVariant vtOptional((long) DISP_E_PARAMNOTFOUND, VT_ERROR),
vtFalse((short) FALSE),
vtTrue((short) TRUE),
vtDoc((short) 0),
vtText((short) 2),
vtRtf((short) 6),
vtHtml((short) 8);
if (app.CreateDispatch("Word.Application") == TRUE)
{
strFileName = "SomeFile.doc";
docs = app.GetDocuments();
doc = docs.Open(COleVariant(strFileName), vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional);
strFileName.Replace(".doc", ".doc1");
doc.SaveAs(COleVariant(strFileName),
vtDoc,
vtOptional,
vtOptional,
vtOptional,
vtOptional,
vtOptional,
vtOptional,
vtOptional,
vtOptional,
vtOptional);
docs.Close(vtFalse, vtOptional, vtOptional);
app.Quit(vtOptional, vtOptional, vtOptional);
}
|
|
|
|
|
I'm opening a word document in a SDI container. It looks better than the embedded word examples I've found, but the only way to open the document into the container is by using OleCreate or OleCreateFromFile (that I have found anyway). Using these functions to open a document with a password really screws things up. Another copy of word opens up.
I'll try your vtOptional method.
Thanks
Jason Henderson I bleed orange.
|
|
|
|
|
hi there
sorry for this newbie question
is it possible to create a cdialog derieved class without using the resource editor?
|
|
|
|
|
I don't see why not.
Just create a new .h file as follows
class CMyDlg : public CDialog
{
};
and put the functionality in the corresponding .cpp file.
Maybe I did not get your question.
-Melwyn
|
|
|
|
|
this was my first try
after this i tried to
CMyDlg dlg;
dlg.DoModal() ... failed
dlg.Create(...) (derieved from cwnd...) but failed...
i also tried to overwrite methods like domodal ... initdialog, ....
and last but not least....the template thing
but nothing of them worked...
|
|
|
|
|
flaffy wrote:
sorry for this newbie question
Its OK. We all had to start somewhere. At least you aren't asking how to write a network packet sniffer
two days after opening your "learn C++" book...
In answer to your question, YES.
Unless you are a masochist, you will use the Resource Editor to create the actual resource for the
dialog (dialog size, title, child controls and their IDs). You can make this up by opening your
RC file as text and typing, but that is only for obscure needs.
Once you have a dialog resource, just make a .H file for the definition, and a .cpp file for
the implementation. You can take CAboutDlg in your project as a simple example. Include them
in your project, and away you go.
Once you've got used to not using ClassWizard, you won't go back. Its WAY too limited for anything
except trivial dialogs.
Iain.
|
|
|
|
|
i also tried this a "dummy" dialog
but after i edit the dialog my way ... visual studio dont want to be my friend anymore
... the question about the packet sniffer will be created in the off topic
|
|
|
|
|
How to find a file in a folder whatever the type is by last modified type.
ex: i want to find *.txt with last modified today
AND
How to delete all file in a folder without delete the folder it self ?
Thank for helping
|
|
|
|
|
Krisna Adityawan wrote:
How to find a file in a folder whatever the type is by last modified type.
ex: i want to find *.txt with last modified today
Are you wanting the newest .TXT file in a given folder? How about this pseudocode:
set lastmod to 0
for each .txt file in folder
if file's last mod date > lastmod
set lastmod = file's last mod date
save name of file
end
next
Krisna Adityawan wrote:
How to delete all file in a folder without delete the folder it self ?
SHFileOperation() should do it.
|
|
|
|
|
Hi all,
I am writing a program that requires deleting a file stored in the disk programmatically .I am wondering if we can do that?
Could somebody help me on this.
Regards.
|
|
|
|
|
|
Thanks a lot Jens,
I solved my problem.
|
|
|
|
|
You also have SHFileOperation() at your disposal.
|
|
|
|