|
Mark Salsbery wrote: If you truly need the char character type in a Unicode build, you can use
CStringA.
Ah, thanks!
Marc
|
|
|
|
|
My C++ is rusty, about the last time I did C++ stuff was with VS7. So here I am with VS9, doing pure MFC/C++ (none of the CLR crap).
So, I've got a "lib" project and a console "test" project. The linker can only find functions that are inline'd in the header file. It can't find functions defined in the lib.cpp class!
What happened? And actually, why can't I find the lib.dll file? It creates lib.dll.embed.manifest, but no foo.dll!
In fact, I think I just answered my first question: I'm not referencing lib.dll in my test project, so it's only resolving inline functions. Why am I not getting a lib.dll lib? How do I get one?
Do I add a path to the Linker\General "Additional Library Directories" or do I add it under Common Properties "Framework and References"?
This used to be so much easier.
[edit] Ummm. Why is the output going to a project in my solution that is excluded from the build and not even referencing the lib project? Why isn't it going to the folder specific to the project itself? WTF has MS done!!! [/edit]
[edit2]The output file property in the Librarian was using (OutDir) rather than (IntDir). WTF? Why would it do that? [/edit2]
Marc
modified on Saturday, July 12, 2008 11:45 AM
|
|
|
|
|
Marc Clifton wrote: This used to be so much easier.
And this was when?
|
|
|
|
|
bob16972 wrote: And this was when?
Like, 7 years ago, the last time I touched C++ with VS6.
Marc
|
|
|
|
|
Well I still use VC5.0, No problems with that there either. Works Nifty, Produces my code quite proficciently, The features VC5.00 misses are quite easily written by myself, I personally am not writing for the Chineese or Japaneese market, so why should I be bothered with the Unicode efford.
My advise is: 'Downgrade'
Regards
Bram van Kampen
|
|
|
|
|
It seems it has been very long time since you did C++. There are two types of libraries in VC++ - Static lib and dynamic lib. "lib" project buids a static library and only produces a .lib file whereas "dll" project build a dynamic library and produces a .dll and .lib.
Marc Clifton wrote: The output file property in the Librarian was using (OutDir) rather than (IntDir).
Because output file should go into *output* (OutDir) directory and not intermediate (IntDir) folder.
Marc Clifton wrote: Do I add a path to the Linker\General "Additional Library Directories" or do I add it under Common Properties "Framework and References"?
You should add the path in additional libraries directories and you should specify the import library at Linker -> Input -> Additional Dependencies.
-Saurabh
|
|
|
|
|
Saurabh.Garg wrote: Because output file should go into *output* (OutDir) directory and not intermediate (IntDir) folder.
I would expect each project to output to it's own Debug folder. At least, that's what it does in C#. It seems with a C++ solution, it sets the output to the first project created. I saw no place where I could change that setting once it was made.
Saurabh.Garg wrote: Static lib and dynamic lib. "lib" project buids a static library and only produces a .lib file whereas "dll" project build a dynamic library and produces a .dll and .lib.
Yeah, I finally figured out I wanted a static lib.
Saurabh.Garg wrote: You should add the path in additional libraries directories and you should specify the import library at Linker -> Input -> Additional Dependencies.
Adding the project as a reference also worked, though I'll definitely look at your suggestion.
Thanks so much for the feedback!
Marc
|
|
|
|
|
I don't do much C# so I am not sure how it sets the folder for a project but in VC++ it is like this.
"Configuration Properties" -> "Output Directory" : Sets the output directory for the entire project. By default it is set to $(SolutionDir)$(ConfigurationName) so the Release or Debug folder is created in the folder where solution file is located.
"Configuration Properties" -> "Intermediate Directory" : Sets the intermediate directory for the entire project. By default it is set to $(ConfigurationName) so the Release or Debug folder is created in the folder where project file is located.
Now if I have a solution with following organization:
FooBar
FooBar.sln
Project1
Project1.vcproject
Project2
Project2.vcproject
Project3
Project3.vcproject
I configure each project like this:
OutDir = $(SolutionDir)\Bin
IntDir = $(SolutionDir)\Temp\$(ProjectName)\$(ConfigurationName)
Note: If you want both debug and release binaries the add D to the debug configuration, otherwise this setting will only contain binaries from the last build.
Having said this, in VC++, you can configure path of each file produced separately. So if for some reason you wany PDB files in some other folder then go to "Configuration Properties" -> C\C++ -> Output files and set "Program Datbase file name" to any thing you want.
Also check out macros when setting a path, there are lots of useful folders defined as macros.
Setting project as reference works as well but well thats not how native developers do it
-Saurabh
|
|
|
|
|
Saurabh.Garg wrote: "Configuration Properties" -> "Output Directory"
I think sometimes I purposely don't see the obvious. Thanks again!
Marc
|
|
|
|
|
By the way sooner or later in the debug build you are going to encounter "LNK1000: Internal error during IncrBuildImage". To fix this install KB948127[^].
-Saurabh
|
|
|
|
|
Saurabh.Garg wrote: To fix this install KB948127[^].
Will do! Thanks so much!
Marc
|
|
|
|
|
Hello,
I use EVC++4 for ARMV4I device. I have come across a situation where I find difficult to figure out few things.
I store data in a file like:
1+Oper 1+1+Dept 1+12+2+1.0+2+2.0+3.5+1+3.5
-------- ----------- - --------- ---------
Obj 1 Obj 2 S Obj 3 Obj 3 S-> # of objects stored of Obj 3 type
Now I am reading the file & I want data in a form where value of 1 from Obj 2 is against all the values of Obj 3. So,
1 Obj 3
Obj 3
For this I believe I should have a CArray in a CMap. The CArray can contain all Obj3 & value remains as the key of the CMap.
I am not able to make out how do I declare the CArray & the CMap. I am getting errors of CArray: no operator = ....
Can anyone help me create CArray & CMap respectively & also show how to add contents in the array & map rexpectively.
While reading file, I might need to access the saved CArray & add more if I come across the same number again.
I am using EVC so please provide only MFC or general C/C++ solutions - No std, ATL, etc. Evc doesn't support CArrayEx & CMapEx.
Help is highly appreciated.
Thanks
Terry
|
|
|
|
|
Well, part of the solution to your problem would be to serialize your CArray. To understand how to do that please have a look into Xavier John's Address Book[^]. If that isn't help you a lot please to MSDN page: Serialization in MFC[^].
Best regards,
Mihai Moga
|
|
|
|
|
Well Mihai, I also like Serilization, but EVC+ with +WinCE is giving a tough time with serialization. All proper code yet write & Read serialized objects is not supportive. So I have to take the long route. WinCE also doesn't support AfxAPI SerializeElements for CMap.
If ypu can give other solution, world be really helpful.
Thanks
Terry
|
|
|
|
|
Hi all,
I have an SDI type project i m also want to create another SDI type project inside it.
I want to call second SDI type project in First SDI type project.
How can both are working at same time and both are call from one project to another.
Please tell me how can i do this.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Have you taken a look into shellexecute?
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
|
|
Hi,
i used InvalidateRect();
Please look in the small code
Many thanx
Coc
|
|
|
|
|
This is the code from the doc:
CString CON_UPDATE_DEMODoc::ChangeText()
{
CRect MyRect(0,0, 100, 100);
CObject* pHint = (CObject*)&MyRect;
m_cstrAusgabe = " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \r\n\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER";
m_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \r\n\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER";
m_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \r\n\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER";
m_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \r\n\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER";
m_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \r\n\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER";
UpdateAllViews(NULL, 1, pHint);
return m_cstrAusgabe;
}
and this from the view:
void CON_UPDATE_DEMOView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
CMainFrame *pMF = DYNAMIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
CON_UPDATE_DEMODoc *pDoc = DYNAMIC_DOWNCAST(CON_UPDATE_DEMODoc, pMF->GetActiveDocument());
m_Rich.SetWindowText(pDoc->m_cstrAusgabe);
if (pHint != 0)
{
InvalidateRect((CRect*)pHint, TRUE);
m_Rich.SetWindowText(pDoc->m_cstrAusgabe);
return;
}
m_Rich.SetModify(TRUE);
CView::OnUpdate(pSender, lHint, pHint);
}
|
|
|
|
|
CrocodileBuck wrote: m_Rich.SetWindowText(pDoc->m_cstrAusgabe);
Since m_Rich is a CRichEditCtrl , why not just derive your view from CRichEditView ? Or, you can derive it from CFormView and add a CRichEditCtrl to it. Otherwise, the way you rare going about this is all wrong.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i have a project from VC++ 6.
i converted it to vc++.net 2005.
when i rebuild the program an error appears : "string table error"
i have the last version compiled and its work fine.
do you have any idea why this error occurs?
sometimes 0 can be 1
|
|
|
|
|
I think you should ask this question in the NET forum.
regards
Bram van Kampen
|
|
|
|
|
Dear All,
I have some problem in displaying the Cbitmatbutton during the SetFocus and KillFocus event. Interestingly, if I disable the bitmapbutton and load the bitmap then it is working fine. If I didnt use the Enablewindow method then the bitmap is not loaded correctly.
But when I use the Enablewindow method in PreTranslateMessage() I have some other problem, that is I need to change the bitmap when pressing the Enter key in the button. If I disable the window and change means it is working but the keyboard event is not accepted after I disble and enable after pressing the enter key. This means that I cannot use the keyboard inputs after pressing the enter key. Please refer the below code:
My exact requirement is that, I need to change the bitmap of the button on Lostfocus, Killfocus and while pressing Enter key.
BOOL CdfdgDlg::PreTranslateMessage(MSG *pMsg)
{
if((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_RETURN))
{
CWnd* pWnd = GetFocus();
int CtrlID = pWnd->GetDlgCtrlID();
if(CtrlID==IDC_BUTTON4)
{
m_button4.EnableWindow(false);
m_button4.LoadBitmaps(IDB_BITMAP4,IDB_BITMAP4,NULL,NULL);
m_button4.EnableWindow(true);
return TRUE;
}
}
return CDialog::PreTranslateMessage(pMsg);
}
void CdfdgDlg::OnBnKillfocusButton4()
{
m_button4.EnableWindow(false);
bool val=m_button4.LoadBitmaps(IDB_BITMAP1,NULL,IDB_BITMAP1,NULL);
m_button4.EnableWindow(true);
}
void CdfdgDlg::OnBnSetfocusButton4()
{
m_button4.EnableWindow(false);
bool val=m_button4.LoadBitmaps(IDB_BITMAP2,NULL,IDB_BITMAP2,NULL);
m_button4.EnableWindow(true);
m_button4.SetFocus();
}
|
|
|
|
|
1. If your dialog is modal, PreTranslateMessage doesn't work[^].
2. You don't need to disable and then re-enable the button just to change its bitmap. Instead, do something like this:
m_button4.LoadBitmaps(IDB_BITMAP1,0,IDB_BITMAP1,0);
m_button4.Invalidate();
m_button4.UpdateWindow() Your disable/enable calls have a side effect of getting the button to repaint. Unfortunately, they also change the state of the button twice, which creates a lot of ugly flicker.
3. In your OnBnSetfocusButton4() handler, you call SetFocus on the button that you're being notified has received the focus. That's not going to do anything useful.
|
|
|
|