|
How can I convert the standard MRU file list in menu File
to a popup submenu in menu File in a MDI application ?
Manosza.
|
|
|
|
|
Hi,
I want to add a password at a document level. I have an MDI app. My idea is to add a password variable, allow the user to create a password and archive it during serialization. Then, whenever the user opens that file, during the onopendocument process, I want to open a modal dialog box, get a password from the user, check it against the one that was saved during serialization and then decide to open the document or not. I tried doing domodal on a dialog box during serialization and during the onopendocument functions in CDocument, but neither would work, it kept throwing exceptions. Also, once I get the password and check it against the saved one, how can I abort the opening of the document? Any ideas on how I can do this? Thanks.
Arnold Kempt
|
|
|
|
|
do all of this work before actually loading the file; you can do a lot of things before calling serialization.
you first do a "pre-read" (hidden from the user ) to see if the document is protected, then if it's not protected, you load it, if it's protected, read the password, compare it with the one in the document, if password is ok, read the file.
or simply ask for the password, then call the serialization and check there if the password is valid, and exit from the serialization.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Great, thanks for the ideas. I realized that I have some code in my main app's file that opens the last open document. It seems this is causing the problem. I'll try to work it out. Thanks for the help.
|
|
|
|
|
Hi Arnold,
checkout the LockNote[^] project at SourceForge. It's open-source and it does exactly what you want to do. So dig into the sources and you'll surely find many answers for your problems.
regards,
mykel
If they give you lined paper, write the other way!
|
|
|
|
|
Is it possible using plain C to compact and repair a MS Access Database trough ODBC?
I'm trying the following code, found it in the WEB:
void CompactAndRepairDB ()<br />
{<br />
RETCODE retcode;<br />
int subscrp;<br />
<br />
CHAR szDriver[] = "Microsoft Access Driver (*.mdb)";<br />
CHAR *szAttributes2[] =<br />
{"REPAIR_DB=db.mdb\0\0",<br />
<br />
"COMPACT_DB=db.mdb db2.mdb General\0\0"};<br />
<br />
for (subscrp = 0; subscrp <= ((sizeof szAttributes2 / sizeof(UCHAR *)) - 1); subscrp++)<br />
{<br />
retcode = SQLConfigDataSource (NULL, ODBC_ADD_DSN, szDriver, szAttributes2[subscrp]);<br />
if (retcode != TRUE)<br />
{<br />
for(int i=1;i<=8;i++)<br />
{<br />
DWORD dwcode = NULL;<br />
WORD wlen = 0;<br />
char szerr[SQL_MAX_MESSAGE_LENGTH] = {0};<br />
if (SQLInstallerError((WORD)i, &dwcode, szerr, SQL_MAX_MESSAGE_LENGTH-1, &wlen) == SQL_SUCCESS)<br />
printf ("Code: %u %s\n",dwcode,szerr);<br />
}<br />
}<br />
}<br />
}
After creating the new compacted file I copy it over the old file.
Though when I run the compacting program I get the following error:
Driver's ConfigDSN, ConfigDriver, or ConfigTranslator failed.
I'm not using an ODBC datasource, only using filenames.
Thanks in advance,
Anfernius
-- modified at 12:21 Tuesday 24th January, 2006
|
|
|
|
|
Hi guys,
I hope I do not have overlooked something small in my code, or you probably will make fun of me:
I have a function that determines if a critical error has occured in really old code which just returns a list of structs containing error information. Someone already added a std::string containing the error-message to these structs, and I can simply get that one.
I need to ignore a certain error message (which virtually always occurs), so I wrote the following code:
<br />
std::string noRecords = "no records found";
for (int i = curr.numberOfElements(); i > 0; --i) <br />
{<br />
if (std::string::npos != curr.currentElement.info.find_first_of(noRecords))<br />
{<br />
return true;<br />
}<br />
curr.setToPreviousElement();<br />
}<br />
return false;<br />
<br />
which is supposed to return true ("a real error occured") if there is any other error than "no records found" and false otherwise (i.e. "just noRecords errors").
As mentioned before, I cannot change the implementation of the errorList. Just ignore the naming, please, as I had to "obfuscate" a little.
Well, the result: obviously "no records found" is a part of "unexpected end of file". Thats what currElement.info (the std::string) contains.
I also tried the following comparisons:
curr.currentElement.info.find_first_of(noRecords) < 0
curr.currentElement.info.find_first_of("no records found") < 0
curr.currentElement.info.find_first_of("no records found") != std::string::npos
but to no avail. I tried over 100 info strings with the above function, it never got inside the conditional.
I HOPE that this is really simple (that means, I messed up somewhere). find_first_of actually IS the string::find_first_of(), I double-checked that.
GNAH.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
-- modified at 11:25 Tuesday 24th January, 2006
|
|
|
|
|
First of all, this is the wrong approach. You should fix the bug, not hide it.
find_first_of will find the first char in your string which is one of the chars in the string you passed in. I think you want string::find.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
First of all, I know, but there is nothing I can do about it.
And, BUMMER, I totally misunderstood the MSDN. Another problem if you're not a native speaker and just "taking a glance" at the docs.
Of course, find() is what I have to use.
Thank you very much, Christian.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
I understand that the equivalent for __gc in VC++ 2005 is ref keyword. Similarly can anyone update me on the equivalent for __gc* in VC++ 2005.
Thanks in advance
Thanks and Regards
Madhu
|
|
|
|
|
|
Thanks for the intimation. I have also posted the message in VC++/CLI forum
Thanks and Regards
Madhu
|
|
|
|
|
toxcct wrote: i'm sure Mr sivakumar will be a good help over there...
LOL - seeing as he's one of only three people worldwide using this stuff ? :P
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
And me as of the last couple of days, so that makes four
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hello,
I created with Visual C++ 2003 - a Beta 2 Version - an dialog based application. I inserted a menu in the Resourccen view.
In VC6 I clicked onto the Dialog, said in proberties dialog "IDR_MENU1". That's all. But here in VC NET how can I connect these both (dialog & menu) ? Because if I run the App I don't see anything.
Thank You for help!
|
|
|
|
|
|
Hello,
I use Vc NET 2003. The way you described is the way by using VC6.0. I already know it. But in VC NET there is no Property of the dialog where I set to the menu ID...
|
|
|
|
|
sure there is one, but it simply have not the same look... it is a docked tabed window, in which the proterties are exposed as an array...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|
Yes, right, there is the property window with 6 small buttons and a combobox. In the combobox I select the IDD_MyDlG (Dialog). The 6 small button with names "kategory", "alphabet", "properties", "Messages", "Control-Events", "PropertiesSites"
Only the button "Messages" is enabled, the others are not enabled. If I click the button "Messages" I see a list of:
"WM_ACTIVATE"
"..."
"..."
That's all. I think because of the BETA VERSION of VC NET the game is over here for me?
|
|
|
|
|
|
Yes I did. Which other properties did you mean? The list of the "Messages" is very long:
"WM_ACTIVATE"
...
...
...
"WN_WINDOWSPOSCHANGING"
"WM_INICHANGE"
|
|
|
|
|
the windows messages are not what you must look for...
open the dialog box in design editor, then select the dialog, right-click on it, choose Properties, then you should have a property called Menu...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|
Yes, I did it. But nothing with "menu". I think the Beta Version doesn't have it!
Or this is the bug, therefor it is a BETA.
|
|
|
|
|
Thank you for help!
I think I 'll better go back to DevC++ go on console
To much bugs in this IDE! It's just aborted...
|
|
|
|
|
can't you get a release version of the IDE ?
it's been 3 years that is released, and now, Visual Studio 2005 is released too !!!
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|