|
How come you think it's a bad design?
|
|
|
|
|
The answer really depends on whether it is reasonably easy for you to develop your application using it, and whether it will satisfy your needs, in terms of finished product. And if you really want MDI then Doc/View is probably your best option. I have used it in the past and found it produces very usable programs.
|
|
|
|
|
Doc/View is probably not quite as good as MVC (it's ambiguous where UI commands should be handled) as used and promoted in Qt[^], but all of these architectural styles rely on your detailed design and implementation not violating the qualities implicit in thm.
So, in the case of DocView, make sure the Doc class is entirely unaware of any of the views. It should provide methods sufficient for the view to display the document and modify the document, should you choose to handle the UI commands outside the document class.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
thank your for your informative reply. But MVC is not used in C++ is it? I thought it was for web applications only. Do you know of any documents that describe the Doc/View architecture in a way that's not MFC/wxWidgets-specific?
|
|
|
|
|
Jan Sommer wrote: MVC is not used in C++ is it?
It's not language specific - no architectural design patterns are, really, apart from those low-level design patterns that are more about getting around deficiencies in some languages.
DocView (IMO) is basically a Microsoft derivation (and simplification, which loses some of the purity) of MVC. Have a look at the Wikipedia page on MVC[^] - although it talks a lot about web stuff, the history section shows that it is definitely NOT web specific. I don't really know of any Document/View documentation that isn't MFC/wxWidgets related.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Jan Sommer wrote: Do you know of any documents that describe the Doc/View architecture in a way that's not MFC/wxWidgets-specific?
I don't know of any specific documents, but I would expect that MSDN contains a lot of the information you need to utilize the Doc/View architecture, including sample code.
|
|
|
|
|
Hi all,
I have migrated my application(vs-2003 developed) into vs-2008 to be worked on vista machine.I got the .exe and working successfully when i enter a valid username and valid password but fails when i enter a wrong password/username......I am using SYBASE for my aplication,so it comunicates with some SYBASE dlls to get the access.
the code looks like below
(I am providing login details from other dialog)
int DBInterface::LoginSequence (BOOL bFirstLogin)
{
CString user_name;
char dbver[16];
CString srvrname, dbname;
char uname[33];
char upwd[33];
UINT msg;
if (bFirstLogin)
{
dbinit ();
dbsetlogintime (8);
dbmsghandle ((MHANDLEFUNC) msghandle);
dberrhandle ((EHANDLEFUNC) errhandle);
}
int rv = 0;
while (Ops.m_bAutologin && bFirstLogin)
{
if (CSD_DdeReqUserName (uname) == 0)
break;
if (CSD_DdeReqUserPassword (upwd) == 0)
break;
srvrname = App.GetProfileString (INI_SEC, _T("DBServer"), "");
if (srvrname.IsEmpty ())
break;
dbname = App.GetProfileString (INI_SEC, _T("DBDatabase"), "");
if (dbname.IsEmpty ())
break;
strcpy (_loginfo.dbid, uname);
strcpy (_loginfo.dbpwd, upwd);
strcpy (_loginfo.dbsrv, srvrname);
strcpy (_loginfo.dbdb, dbname);
_dbproc = dbConnect (&_loginfo, "Phoenix");
if (_dbproc == NULL)
break;
rv = 1;
TRACE0("Phoenix: successfully logged in using LOGPARMS from anotherapp...\n");
break;
}
CLoginDlg dlg;
while (rv == 0)
{
if (dlg.DoModal() != IDOK)
{
PostQuitMessage(0);
return 0;
}
else {
lstrcpyn(_loginfo.dbpwd, dlg.m_csPassword, 31);
lstrcpyn(_loginfo.dbid, dlg.m_csUser, 31);
lstrcpyn(_loginfo.dbsrv, dlg.m_csServer, 31);
lstrcpyn(_loginfo.dbdb, dlg.m_csDatabase, 31);
}
_dbproc = dbConnect (&_loginfo, _T("Phoenix") );
if (_dbproc != NULL)
break;
msg = (::GetKeyState (VK_CAPITAL) & 0x0001) ?DS_ERR_LOGINFAILEDCAPS : IDS_ERR_LOGINFAILED;
if (AfxMessageBox (msg, MB_OKCANCEL | MB_ICONHAND) == IDCANCEL)
{
PostQuitMessage(0);
return 0;
}
}
In the abobe code from dbconnect()(bold code) it is calling some SYBASE dll and it is not getting the return value when i enter wrong password/username.......
Is there any problem with the dll or anyting else?????
Since i have migrated the code i am thinking that the dll is not compatiable,but this is just an assumption....!
So can anybody help me to solve this issue......
Thaks in advance.
modified on Saturday, October 3, 2009 8:48 AM
|
|
|
|
|
|
GetCurrentHwProfile()
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
How can I change the text color of an edit control? I want it to change to red when its contents aren't correct.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
See CWnd::OnCtlColor [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
How do I trigger this message to be sent? Should the code be something like
bool m_bRedColorFlag [= false];
...
void OnCtlColor()
{
if (m_bRedColorFlag){
}
else {
}
}
...
m_bRedColorFlag = true;
GetDlgItem(IDC_EDIT)->InvalidateRect(NULL);
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Hi Friends,
I made a desktop and audio(mike) capture GRF in graphedit.
On some systems audio recording stops after 30 sec but video recording has no issue.
I did all things in source code(c++ application) tracked IMediaEvent, but as audio recording stopeed in between no error event is fired.
Note: problem occur only on some laptop pc till now it has not occured in any desktop PC
Laptop "qasf.dll" version is 10.0.03802
I tried with differnt versions of same dll but all in vain on the laptop.
System configuartion is below:
RAM - 1790MB
CPU - Intel(R) Core (TM)2 duo CPU 1.83Ghz(2 CPU)
GRF file is stored at below link
http://www.fileflyer.com/view/uiqJXB1[^]
Thanks,
Subhash
|
|
|
|
|
What controls the hovering expansion of MFC menus?
Or what controls which choices are shown before hovering on the little arrow to expand the rest of the menu?
A. The feature is called Personalized Menu Behavior.
The wizard code for it is in CMainFrame::OnCreate()
modified on Friday, October 9, 2009 6:48 PM
|
|
|
|
|
See here[^]
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks. Really though I know this is a stupid question or maybe its just me but I haven't been able to find it in the help because I can't think what the feature is called to be able to search for it in the MFC docs or code. When I google "Menu Expansion" I get 7500 hits that all seem to have to do with web development, java, of C#.
|
|
|
|
|
It's all right there in the help. There is a link to a sub page about menu programming considerations which has a section on menu messages, creating menus and modifying menus. It really is too big a topic to fully explain in a forum post.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Personalized Menu Behavior
|
|
|
|
|
Hello,
I'm new to C++. I grasp it, having read through a number of articles and chapters of books
and done a bunch of console examples.
I have my Visual C++ and the latest Windows SDK for Windows 7.
So, I want to skip ahead and start creating simple GUI's using png, jpeg or gif files as well as vector drawing.
So, If anyone can offer some guidance, I will appreciate it.
What is the most CPU efficient, smallest file size method to create a GUI incorporating png files? Cross platform or windows. A WYSIWYG editor would be nice, but most important to me is to have solid, professional code, so I want to focus my research on methods that develop good GUI's, even if it requires more time.
I have used software with GUI's that load in a clumsy fashion and are buggy. That is what I want to avoid. I want my apps to run smoothely.
So any programmers willing to point me in the right direction?
Thanks,
-Matt
|
|
|
|
|
Bitmap Basics - A GDI tutorial[^], is a good place to start; fairly basic but makes it easy to grasp the concepts. You should always take a look at Microsoft's GDI+[^] for the latest functionality. And when you feel comfortable with all that, then this article[^] teaches some really cool stuff.
Good luck!
|
|
|
|
|
Thanks,
So I'm looking at Win 32 development, and I need to work with the libraries there.
Windows GDI and GDI+, and maybe others like Direct 2D, I guess. Thats plenty to learn about for awhile.
|
|
|
|
|
Hi. Well... I'am trying to develop some simple game. This game has map of CButton objects and a marine that is a CButton object too. I have to make someway that marine go over other button. But as soon as i draw them marine is left behind the map. I tryed to make another transparent window and collocate marine there. It worked, but... in OnInitDialog i write:
MarineDlg.Create(IDD_MARINEDIALOG,this);
theApp.CreateLvl(this, STARTPIXELX, STARTPIXELY, FIELDSIZE);
and it's all cool, BUT if i write
theApp.CreateLvl(this, STARTPIXELX, STARTPIXELY, FIELDSIZE);
MarineDlg.Create(IDD_MARINEDIALOG,this);
marine is left behind and i need to create level first because my marine use it's properties.
Any hint? Some way to solution?
Pls. I already lost 1 day in it with no result.
|
|
|
|
|
I found the answer. Function SetWindowPos change Z-pos of an object in the dialog, but... it dosen't work. When you create CButton.Create(bla-bla-bla,pParentWindow,WS_CHILD) it dosen't matter. Later you have to put CButton.SetParent(pParentWindow). Only after that it starts to work. Cool.. i love vc++ i lost 2 days... in nothing.
|
|
|
|
|
Suppose something like this:
[code]
<span class="gugugug">1</span>
<span class="krakaka">enchanted</span><span class="gagaga">chocolate bar</span>
<span class="gugugug">2</span>
<span class="krakaka">very remarkable</span><span class="gagaga">flavored cookies</span>
<span class="gugugug">3</span>
<span class="krakaka">fascinating</span><span class="gagaga">strawberries</span>
(...)
<span class="gugugug">254</span>
<span class="krakaka">amazing</span><span class="gagaga">pineapples</span>
(...)
[/code]
And it goes on.
I need to extract the numbers and words between the <span> and </span> tags ("1", "enchanted", "chocolate bar", "2", "very remarkable", and so on) and put it in a bidimensional array. But what piece of code do I need in order to extract from between the tags?
I'm imagining it's something easy, but I'm completely new, whereas you guys are extremely good, so please help. 
|
|
|
|
|
Have you checked out MSXML? It will parse the xml and let you deal with through an object model.
|
|
|
|