|
for ( int i = 0 ; i < m_cmb.GetCount() ; ++i )
{
CString sText;
m_cmb.GetText( i, sText );
int nIndex = sText.Find( _T("ABC") );
if ( nIndex >= 0 )
{
// Found it - do something
break;
}
}
Dave
|
|
|
|
|
Hello,
I have just been writing an application in VC++.Net Standard on Windows XP Professional, and have decided to use the latest version of HtmlHelp for the help facility. I have just installed HtmlHelp, and according to the instructions I have put htmlhelp.lib under
"C:\Program Files\Microsoft Visual Studio .NET\Vc7\lib" directory, and htmlhelp.h under the similarly named include directory.
I have written the following API code to invoke the Help system:
void CMainFrame::OnCallHlp()
{
::HtmlHelp((HWND)GetDesktopWindow(),
"C:\\C++Proj\\LPSEmail\\LPShlp\\html\\LPSEmail.chm::
/afxFoldersAdd.htm", HH_DISPLAY_TOPIC,NULL);
}
However, when I compile I get the following link error:
LPSEmail error LNK2019: unresolved external symbol _HtmlHelpA@16 referenced in function "public: void __thiscall CMainFrame::OnCallHlp(void)" (?OnCallHlp@CMainFrame@@QAEXXZ)
I would be very grateful if someone could tell me how to make the programme link correctly. I presume the problem is because it cannot find the external HtmlHelp API library??
All help appreciated,
Trimtrom
|
|
|
|
|
You may need to link with a dll. I don't know the HTMLHelp API, but unless it comes standard in .NET, it might be good to check that. Also, are you sure that it's not under some namespace. With a different API like that, it could be a namespace different than std::.
|
|
|
|
|
Brandon,
Thanks for the answer. In the SDK docs there is no mention of a DLL.
I am not very experienced and so would not know how to check for a namespace. How would you do that??
Would it help if I deleted the pch files under the Debug directory, if there is some inherited problem?
|
|
|
|
|
You need to include HtmlHelp.lib in your Link|Library modules project setting.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Neville,
I have been looking under Tools, Options, Project folder. (This is very different to VC++ 6 which I was used to.)
Is there any where else I should check?
Trimtrom
|
|
|
|
|
I don't have VC7 so I can't help with that. Gotta be there somewhere. Linker Options should be part of the project setup. At least that's how it is in VC6.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Project menu -> Properties -> Linker -> Input -> Additional Dependencies.
easier way is to use a #pragma preprocessor directive
#pragma comment (lib, "htmlhelp.lib")
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
You need to link with htmlhelp.lib which is provided with the Microsoft HTML Help Workshop.
Dave
|
|
|
|
|
|
I got there first on the previous one
Dave
|
|
|
|
|
I have a project that I need to have a class A with a member pointer to a class B; class B has a member pointer to class A. How do I mess with the header files are whatever to do this?
I would also like to know how most people do their header files #includes. Is it like MS with one header file including every other header file and every source file includes that with #ifndef and #endif around every header file? Sorry, that sounds confusing. One main header file that #include's every header file, classes and such. Then every header file with a class declaration has #ifndef, #endif around it so it won't include more than once. Lastly, all source files only #include the main header file, nothing else. If this is the best way to do it, does it matter to #include one header file before another?
Coming back to my original question, I'm sure you can do preprocessor directives like console function declarations with classes. But where would I put those?
|
|
|
|
|
You need a forward declaration of one of the classes that tells the compiler that the class exists, but you'll define it later:
class A;
class B
{
private:
A *m_Ptr;
};
It is wise to always put a #ifdef round every header file, but personally I would only include a header file where you need - needlessly including every single header file will just create a big spaghetti mess. Keep it clean and include as much as you can in the source files, and whatever is needed in the header file to compile the class. Otherwise as soon as you start changing one header everything falls apart
|
|
|
|
|
class1.h
#if !defined(__CLASS1_H__)
#define __CLASS1_H__
// Forward declaration
class Class2;
class Class1
{
Class2* m_pClass2;
// Other stuff
};
#endif
class2.h
#if !defined(__CLASS2_H__)
#define __CLASS2_H__
// Forward declaration
class Class1;
class Class2
{
Class1* m_pClass1;
// Other stuff
};
#endif
Then include both of the header files in the implementation of these classes.
Dave
|
|
|
|
|
brandon1879 wrote:
I have a project that I need to have a class A with a member pointer to a class B; class B has a member pointer to class A. How do I mess with the header files are whatever to do this?
You need to forward declare class b. eg.
class b;
class a { ... class b* m_b; }
class b { ... class a* m_a; }
For a good discussion on #includes I recomend "Large Scale C++ Software Design" by John Lakos. published by Addison-Wesley.
Bottom line is that you should only include the minimum number of #includes that you need. Using a #include that #includes a set of include files is a bad idea. You need to minimimize dependencies so files aren't recompiled unnecessarily.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
brandon1879 wrote:
I would also like to know how most people do their header files #includes. Is it like MS with one header file including every other header file...
The practice of having a single header files that includes all header files has been obsolete for about 20 years now. But there are two reasons why people still do it -- 1. some people never learn, and 2. precompiled headers files. The biggest problem with using a header file that includes everything is that if you change one thing in one header file, every file must be recompiled. In the case of precompiled header files, only files that never (or almost never) change should be included.
|
|
|
|
|
Hi all,
I am using Embedded Visual C++ 3.0 and MFC dialog mode for implementation. Firstly, if I want to read one line each time from a .txt file in Pocket PC, can I use the following code?
char* data;
data = NULL;
fp=fopen("\\sip.txt","r");
while((!feof(fp)) && (fp != NULL))
{
fscanf(fp, "%s", data);
// Process the data here
}
fclose(fp);
Then, if I want to get the typed message from an edit box in a MFC dialog box and write/ append it into the file each time a line, should I do this?
CString asip;
GetDlgItemText(INPUT_ASIP, asip);
fp=fopen("\\sip.txt","a");
fprintf(fp, "%s\n", asip);
fclose(fp);
But I encounter a problem that the output file “sip” contains only the first character of the CString asip. How can I solve this?
It’s really urgent as I have to hand the program before 26/3/2003 so please kindly help me.
Many thanks!!!
Wil
|
|
|
|
|
The ICM 2.0 documentation seems to indicate that ICM can work with any valid ICC color profile. These profiles can specify non-sRGB color spaces, such as CMYK and CIE LAB. Does anyone know if it's actually possible to use Windows color management to work in CIE LAB space or CMYK space?
This is relevant because I am really interested in being able to print to my printer's complete color gamut, not only the part that overlaps with sRGB. (The default sRGB color space that windows uses is really lousy at representing saturated yellow, orange, and cyan colors that standard printers can represent very nicely).
|
|
|
|
|
I created Edit, Combo, Button, Calendar, Tab, Main Window... but all of them have similar problem: Captions (Window Text) of all Control written by BOLD font >> Weight = 700
>> I want to SET FONT for all control back to NOT BOLD >> Weight = 100 (THIN)
I have a solution: use CreateFont() with para Weight=100 then SelectObject(ControlDC, CreatedFont) then write Caption (Window Text) in to its DC but this way seem too long...
Can you have a short way ?
Help me please....
thanks alot
I use non-MFC programming
|
|
|
|
|
If you're not using MFC, there may not be another solution. Are you using C++ ( as opposed to C ) ? If so, you should encapsulate the behaviour of setting a font into a class and use that class to create edit box instances.
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
hi
i'm just a newb to vc++ and the articles on this site were kind very unclear. i created a dialog app with the mfc appwizard. created a button on the dialog to open the modeless window.
an example of the code.
void CMyAppDlg::OnHitMe()
{
// TODO: Add your control notification handler code here
// Display the modal dialog box
pdlg = new CNoteDlg;
pdlg->Create(IDD_NOTEDLG,this);
}
i have the private:
CNoteDlg * pdlg;
in my myappdlg.h
and my dialog resource is named IDD_NOTEDLG
and myappdlg.h #include's notedlg.h i've been fiddling with this for a while and its really confusing. if anyone can give some assistance it is appreciated
|
|
|
|
|
You need to also make the dialog visible (this is not automatic for modeless dialogs). Either set the Visible style in the resource editor, or add this after the Create() call
pdlg->ShowWindow ( SW_SHOW );
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"Which comes first, the bug or the stress?" -- Chris Maunder
|
|
|
|
|
and don't forget to delete this in the PostNcDestroy notification in the modeless dialog
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
adding that gives me this error when i build & run:
Debug Assertion Failed!
Prgram :...\yadayadayada\myapp.exe
File: winocc.cpp
Line: 301
|
|
|
|
|
Instead of pdlg->Create(IDD_NOTEDLG,this);
try
pdlg->Create(CNoteDlg::IDD);
And check if (pdlg != NULL) .
regards
modified 12-Sep-18 21:01pm.
|
|
|
|