|
Another idea:
could anybody give me examples on commercial MFC applications? And Win32?
And if anybody knows about on line tutorials....
Thanks!
|
|
|
|
|
|
Maybe I didn't make myself clear. Of course I know how to go to google and type 'MFC Tutorial'. I've done it hundreds of time, only about MFC and VC++. What I meant was rather something like: have you found ANY tutorial on the web that you consider good and useful. Can you PERSONALLY recommend me / direct me to one in particular?
I'm telling you: even though when you type 'MFC Tutorial' in google, you get a lot of links, none will take you to a decent TUTORIAL (maybe one, that is: I've only found one). Most of them are an introduction to MFC programming. Thet usually deal with the Visual Studio IDE, the wizards, the 'Hellow World!' application and little more. A tutorial is something more, mind you.
The one I found was by Kate Gregory about VC++ 6, and it's pretty complete (though not advenced at all). It's the only decent one I've found.
Has anybody found any other?
Thanks for all your replies!
-- naradaji
|
|
|
|
|
hi,all
I write a COM Dll in Visual ATL . And I refer the COM dll in VB environment. The vb program runs well except when the program exit, the error dialog occur. The error info are such as "the address can't read ..." . Is it concerns with
the c++ pointer ??? But how can I find the actuall false??
Are there any tools to help to debug the com dll??
The problem disturb me for very long time .
Ask for your help , please !
Regards.
|
|
|
|
|
Leesen wrote:
Are there any tools to help to debug the com dll??
Sure, just debug the DLL inside the Visual C++ debugger. Set the DLL's project as the "Active" one and then in the Settings, use your VB app as the "Executable for the debug session".
When your app exits, the debugger should take you to where the problem is occurring.
Good luck!
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
thx . It really do well accroding to your suggestion .
But when I am in debug mode . I press "F5" to debug , the error dialog show "User breakpoint called from code at 0x77f9f9df",then the vc code change into assemble code . And in that way I can't debug further.
And how ??
|
|
|
|
|
debug your ATL com with VC++ degugger and point ur executable as your vb program
* * * Code the dreams * * *
|
|
|
|
|
hi,
thx.
I can debug the com dll following your advice.
Because just when my vb program exit the errors occurrs,
I set breakpoints in destructor function . Then when I exit the vb program ,it seemed the program did not execute the destructor code. It did not pause on the breakpoints,instead there showed a error dialog "Unhandled exception in P2P.exe : Access Violation".
If I direct run the vb program without the debug mode , when I exit the vb program I will receive such error message"the memory address can't be read..."
why?? I am exhausting now after so much try.
thx.
regards.
|
|
|
|
|
Hi !
Like in Mike's example, I use the SHBrowseForFolder to prompt the user for a directory, but i don't seem to get it. My app is a MFC Dialog, and here is the code :
LPBROWSEINFOA lpbi= new BROWSEINFOA;
LPSTR hello;
int g;
CWnd *tmp=AfxGetMainWnd();
lpbi->hwndOwner=tmp->m_hWnd;
lpbi->lpszTitle="Directory choice";
lpbi->pszDisplayName=hello;
lpbi->iImage=g;
lpbi->ulFlags=BIF_DONTGOBELOWDOMAIN;
lpbi->lpfn=NULL;
lpbi->pidlRoot=NULL;
SHBrowseForFolder(lpbi);
CSettingsDlg dlgSettings;
dlgSettings.DoModal();
break;
Ok. So the dialog opens properly but i get an error when i want to close it . What's wrong with it ?
Thanks a lot.
~RaGE();
|
|
|
|
|
Firstly
TCHAR rootPath[MAX_PATH];
BROWSEINFO bi;
LPITEMIDLIST pidl;
LPMALLOC pMalloc;
if (SUCCEEDED(SHGetMalloc(&pMalloc)))
{
ZeroMemory(&bi,sizeof(bi));
bi.hwndOwner = NULL;
bi.pszDisplayName = 0;
bi.pidlRoot = 0;
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT;
pidl = SHBrowseForFolder(&bi);
if (pidl)
{
if (SHGetPathFromIDList(pidl,rootPathOfRip))
{
m_startDir = rootPath;
UpdateData(FALSE);
}
pMalloc->Free(pidl);
pMalloc->Release();
}
}
Thats the code I've used before for using the SHBrowseForFolder before and its seemed to work. Give that a quick try to see if it works, changing the variables and stuff of course. Other than that you could try doing a Step Into debug of it to see where it really craps out. Post back with more details if you can.
|
|
|
|
|
It works perfectly fine (well, the m_startDir is not defined and rootPathOfRip is rootPath , but i guess that's the cut&paste ), thanks a lot. Maybe you should mail this one to Mike, so that he gives it as example in the FAQ, because i do not think it is trivial.
~RaGE();
|
|
|
|
|
I have a rebar with a checkbox (all to br created in code). To make the view catch the message when the box is checked, the book said to add:
afx_msg void OnClick;
There was no association of this messagehandler with the object that emitted it. So I guess I was wondering if I had two checkboxes and wanted two different functions to run when they are checked, how would it know which one to run if I just do the afx_msg OnClick1 and OnClick2.
I note that when you write a handler for clicking a real button drawn from the toolbox onto a CFormView, the code generated by Visual Studio does associate the emitter of the messsage when it adds the relevant code. But here in this example from the book there is no such code to be added where the checkbox is associated with the clicked message.
HOpe its clear - my confusion.
Thanks
Appreciate your help,
ns
|
|
|
|
|
Why are my MFC toolbars very very UGLY?
They use some who-knows-what colours always.
In every other app, the toolbar is a fine gray/what my theme is, but in my app... it's some ugly white on the left(the grabbing thingy?) and rest some grey, but with another theme(darkish), its some weird looking dark grey with a VERY white on the left, but other programs are a good looking light gray(except the funky-toolbar ones of course)
|
|
|
|
|
Dear All, I have created buttons inside the list ctrl. First of all tell me the approach that I have followed is correct??.
Secondly, I have created Successfully but due to the header resizing option I am facing the button redrawing problem. As when the horizontal scroll is used the buttons are creating problem.
is there is any one help???
Natasha
Software Engineer.
|
|
|
|
|
Hello,
I am declaring a class within another class. In VC 7.0 the inner class has access to protected members of the enclosing class, but in VC 6.0 it does not. Here is the example:
#include <iostream>
class Big
{
protected:
static const int CONST_VALUE;
class Inner
{
public:
Inner ();
int x;
};
public:
Inner in;
};
const int Big::CONST_VALUE = 2;
Big::Inner::Inner ()
{
x = Big::CONST_VALUE;
}
int main ()
{
Big big;
std::cout << big.in.x;
}
Can anyone tell me if there is a bug in the(se) compiler(s)?
Thanks!
Best regards,
Alexandru Savescu
P.S. Interested in art? Visit this!
|
|
|
|
|
I can't tell for certain, but it appears to me as a bug in the VC7 compiler. I could be wrong, of course, since VC7 is supposed to be more compliant -- I don't have the ARM with me. But it just seems to me like protected means that it's accessible to derived classes. There's no provision for it being accessible to nested classes.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
You've declared the Inner class as protected. declare it as public and you'll get it to work!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
class Big
{
protected:
static const int CONST_VALUE;
class Inner
{
public:
Inner ();
int x;
};
<font color=red> friend class Inner;</font>
}; Add the friend declaration, that should do the trick.
--Mike--
Friday's GoogleFight results: Britney Spears 2,190,000 - Erica Weichers 23
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hello,
I know that if I declare Inner as friend it works on VC 6.0. My problem is: Which compiler's bug is this?
Best regards,
Alexandru Savescu
P.S. Interested in art? Visit this!
|
|
|
|
|
But it is not a compiler bug!
Protected members can ONLY be accessed through inheritance.
Do it piblic or as Dunn said friend.
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Rickard Andersson wrote:
Protected members can ONLY be accessed through inheritance.
I understand that perfectly. My problem is why my sample compiles in VC 7.0!
Best regards,
Alexandru Savescu
P.S. Interested in art? Visit this!
|
|
|
|
|
Alexandru Savescu wrote:
My problem is why my sample compiles in VC 7.0
That's a bug... or something... weird!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Alexandru Savescu wrote:
Which compiler's bug is this?
That, I don't know. Needing the friend declaration just seemed like The Way It Was Done. You should probably consult the C++ spec for the definitive answer.
--Mike--
Friday's GoogleFight results: Britney Spears 2,190,000 - Erica Weichers 23
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
To all specialists,
i wrote a MFC programm which starts Microsoft Word, creates a document, adds a table to the document and saves the document.
I used the msword9.olb to add the needed classes to my project.
The only thing that bothers me is that i have to find out what values to pass to function by "try and error".
For example i want to create a table with the autofitbehavior set to "FitToContent".
The tables.add function is defined as:
Tables::Add(LPDISPATCH Range, long NumRows, long NumColums, Variant* DefaultTableBehavior, Variant* AutoFitBehavior)
What value does this function expect in "AutoFitBehavior" to set the table to "FitToContent"?
As i said, i fond out by "Try and error". But there must be a better way because there are a lot of functions where this approach will definitely not work.
If anybody knows where to find some documentation like:
"Set AutoFitBehavior to '2' to get 'FitToContent'" i would be glad if he could let me know.
Thanks in advance.
|
|
|
|
|
I added a band with a checkbox with this:
m_reabr.AddBar(&m_check, "On the bar", NULL, RBBS_BREAK|RBBS_GRIPPERALWAYS)
APparently RBBS_GRIPPERALWAYS means that "sizing wrinkles" are present. WHen I ran my code I wasnt able to resize the rebar.
ALso I couldnt move it around. For this do I need to do some docking code?
Thanks
Appreciate your help,
ns
|
|
|
|