|
When run under windows XP, the menu bar on my MFC application has a white background behind the text of the menu names, even though most of the menu bar is a gray color. When the menus are clicked with the mouse, the white portion grows. It's purely a cosmetic problem, but it looks cheesy.
You can see this problem by just generating a generic MFC application using the MFC app wizard, compile it, and run it. I'm using Windows XP pro, with VC++ version 7.
Thanks for any insights.
John
|
|
|
|
|
Does anyone else have this same problem?
|
|
|
|
|
Hello everyone!~
Does any one have any demo/code of a HTML parser in MS VC++ MFC?
I need a HTML parser which can be used in a typical MFC environment.
I have looked through the Microsoft's "walkall" example. However, I find it uses some older version of include files, which is not compatible with StdAfx.h, etc. (in one word, if I "new" a new MFC single document project, I can not incorporate the "walkall" into it.)
What I want from the parser includes:
be able to build a tag tree,
be able to extact the tag text and tag URLs(if a "A" tag).
Since I only do coding in MFC environment (with a lot of MFC class/libs such as CDialog box, CList, CFormView, etc.), I want the code to be very compatible with MFC.
Thanks a lot for any information or suggestion on this.
Have a nice day.
PS: my current walkaround is:
let walkall.exe write the output to a file,
use create process in my MFC program to execute the walkall.exe, and read in the file after that.
Surely it is a bad walkaround.
|
|
|
|
|
You'll find some useful parsing functions in this[^] article.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I want my VC++ (SDI in MFC) program to draw certain graphs and charts. I am totally balnk in this matter.
Firstly I am not finding the controls of it in the toolbar. Suggest me from where I can get them and how to use them. I am also interested in bar charts and straight line graphs.
Plz guide me step by step bcz I don't have much knowledge in it.
Reply me soon
|
|
|
|
|
What do you mean by not finding the controls of it in the toolbar? You mean you cannot find the toolbar with all the controls ?? If so, right-click on the toolbar and check the Controls check-box.
For charting data, you have several solutions: write your own charts classes (wich may take a lot of time), try to find free existing classes (I think there are some of these classes on this site), or buy such a chart. I opted for the last solution and I found something really complete (you can draw pie, lines,... everything you want): take a look at the site www.steema.com for the TeeChart (ActiveX version)!
Hope this helps
|
|
|
|
|
I want to Create a Frame/view/doc structure On a ActiveX Control,but It will be Found Memory leak! And I Found that the
reasons is :
CDocManager* CDocManager::pStaticDocManager;
CPtrList* CDocManager::pStaticList;
How Can I avoid Memroy leak?
the Following is My Code :
BOOL Create()
{
if( m_pFrameWnd )
{
if( IsWindow(m_pFrameWnd->m_hWnd) ) return TRUE;
}
CSingleDocTemplate * pDocTemplate;
pDocTemplate = new CSingleDocTemplate(IDR_MAPTYPE,
RUNTIME_CLASS(CMapDoc),
RUNTIME_CLASS(CMapFrame),
RUNTIME_CLASS(CMapView));
CMapDoc * pDoc = new CMapDoc;
CCreateContext Context;
Context.m_pCurrentDoc = pDoc;
Context.m_pNewDocTemplate = pDocTemplate;
Context.m_pNewViewClass = RUNTIME_CLASS(CMapView);
Context.m_pLastView = NULL;
Context.m_pCurrentFrame = NULL;
CMapFrame * pFrameWnd = new CMapFrame;
m_pDoc = pDoc;
m_pFrameWnd = pFrameWnd;
m_pDocTemplate = pDocTemplate;
CRect rcMap;
GetClientRect(&rcMap);
BOOL ret = m_pFrameWnd->Create(AfxRegisterWndClass(CS_DBLCLKS), NULL, WS_CHILD|WS_VISIBLE, rcMap,this,NULL,&Context);
m_pFrameWnd->ShowWindow(SW_SHOW);
return ret;
}
ZHANGYIFEI
|
|
|
|
|
How to get the last line data of a text file?
the easy is reading from the file oneline by oneline,but it is not the best one!
how to get the best way to do it?
|
|
|
|
|
read the file backwards from the end until you see an eol or the start of the file. everything you have read up to that point will be the last line.
Software is everything. It also sucks. Charles Fishman [^]
Awasu 1.0.2 (beta)[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
I'd like my application to show English text in menus, messages, etc for English-speaking users and Japanese text for Japanese-speaking users. Can I do this with a single version of my application or do I need to make an separate build of my application for each language?
|
|
|
|
|
you don't need to build separate versions for defferent languages.
you can do this via at least 3 ways:
1, make a different resource for each language and load it dynamiclly
2, use .INI file,
3, use XML tech,
|
|
|
|
|
You can use translated resouce DLLS. I personally dislike that solution though becaues it means you have to maintain two sets of resources.
What I've done for i18n (that's short for internationalization) is to take out all strings from the code and resouces, and replace them with identifiers. I then have translated text files that look like this:
(English file)
MessageBoxString=This is a message in English.
...
(Japanese file)
MessageBoxString=This is a message in Japanese.
Very flexible, easy to translate, and easy to add new languages. You just have to make sure all text boxes, etc. are big enough for strings in either language.
One thing to beware of witih Japanese - it is a double-byte character set. So that means your app either has to have MBCS enabled, or use Unicode. If you are running on an English system, your text will look like garbage unless you have Japanese fonts installed.
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
Win32 apps can have multiple languages in a single EXE or DLL. If you look in your .RC file, most have a section like this:
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
You can define similar sections for each of the languages you wish to support. When your application loads resources, Windows will choose the appropriate language section based upon the language settings for the current thread. There are also ways to define 'language-neutral' sections, for things that aren't necessarily language dependent (like icons, for example).
Software Zen: delete this;
|
|
|
|
|
Thank you! This is what I wanted to know.
Is it possible to set up alternate languages through the MSVC++ editor or will I need to edit my .RC file manually?
|
|
|
|
|
Dov Sherman wrote:
Is it possible to set up alternate languages through the MSVC++ editor or will I need to edit my .RC file manually?
In VC6 and VS.NET, select a resource in the Resource View. Then select Insert, and Resource Copy. You'll then be prompted for a language. This inserts a copy of an existing resource, but marked for the new language.
Software Zen: delete this;
|
|
|
|
|
Thank you! That just leaves the question of how to test the internationalization once I implement it. Is there a way to trick my computer into thinking it's French?
|
|
|
|
|
i write a class with VC,but why so many warnings?
i doubt it's come from my virtual class.but why?
see my source code following:
virtual class:
ZDataFile.h:
class ZDataFile
{
public:
virtual void SetSpliter(string strSpliter) = 0;
virtual vector<vector<string> *> LoadData() = 0;
virtual vector<string> LoadLine(int iLinNum) = 0;
virtual vector<string> LoadColumn(int iColNum) = 0;
};
subclass:
#include "ZDataFile.h"
class ZTxtDataFile : public ZDataFile
{
public:
ZTxtDataFile(const char *FileName);
virtual ~ZTxtDataFile();
private:
string Spliter;
vector <vector<string> *> FileData;
ifstream *myfile;
};
.cpp
ZTxtDataFile::ZTxtDataFile(const char *FileName)
{
myfile = new ifstream(FileName);
if(myfile->fail())
{
throw "can not open file!";
}
}
ZTxtDataFile::~ZTxtDataFile()
{
delete myfile;
}
the warning is:
documents\vc\stabctrl_demo\test\zdatafile.h(23) : warning C4786: 'std::vector<std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char
_traits<char>,std::allocator<char> > > > *,std::allocator<std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > *> >' : identifier was
truncated to '255' characters in the debug information
|
|
|
|
|
The compiler doesn't like some STL related stuff. Have a look at http://www.bdsoft.com/tools/stlfilt.html[^]... atleast it helps a little bit.
"was wir auch tun, wohin wir gehen
die illuminaten sind im system
sie kontrollieren überall
und 23 ist ihre zahl!"
23, welle: erdball
|
|
|
|
|
That "identifier too long" warning is harmless, you can turn it off with a #pragma
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
I'm having a really hard time getting this function to properly find a file. I know I'm supposed to use the registry for app initialization info, but I've got an old app and DLL that use an INI file and I need to continue supporting it.
I'm just trying to read from a file called "api.ini" in the same directory as the application. Of course, that directory is not known at compile time. I determine the directory using GetModuleFileName() and append api.ini to the full path. Then I convert all '\' chars to '\\' since that is how the func needs it. This never works!
If I put the api.ini file in the WINNT directory, and only pass "api.ini" as the last param to GetPrivateProfileString(), it properly finds the file. If I hard code the full path ("c:\\program files\\test\\api.ini"), the function finds the file IF the application is run from a different directory (the VS 6.0 dev environment.) However, if I place the app in the c:\program files\test\ directory, then it fails and can't find the file.
Does anybody know why this is not working for me? It seems so simple...I assume I'm missing something really easy. I should be able to just pass the full path to the file and have it read properly. By the way, I have verified that the path I pass to GetPrivateProfileString() is the correct, full path.
Any help would be greatly appreciated.
|
|
|
|
|
Justin Cooke wrote:
Then I convert all '\' chars to '\\' since that is how the func needs it.
You don't need to convert \ to \\, it's only for hardcoded strings you do that.
Try ´not to, and see if it don't help...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Thanks for the suggestion, but it didn't seem to help. It's very odd, now that I'm not modifying the string at all (leaving the single slashes alone), I'm passing the same file path string to GetPrivateProfileString() that I pass to CStdioFIle::Open(). The file opens properly, but GetPrivateProfileString() can't find it (it returns the default value.)
Does anyone have any other ideas? Could it have something to do with the fact that this is MFC?
Thanks.
|
|
|
|
|
Have you debugged the app to see what GetModuleFileName() is returning? It should retrun a fully qualified path (i.e., the filename is included). You have to remove the filename before appending another filename.
char szBuffer[MAX_PATH] = {0};
GetModuleFileName(hInstance, szBuffer, sizeof(szBuffer)); Something like the above will give you C:\My Path\myfile.exe . You'll have to drop myfile.exe before you add the other filename or else you'll get C:\My Path\myfile.exe\api.ini .
Oh, and like it was stated, you don't need to escape the backslash unless it's a string literal (i.e., you're typing it in the code directly).
Jeremy Falcon
"so be it, threaten no more, to secure peace is to prepare for war" - Metallica
|
|
|
|
|
I think the two suggetions mentioned will work for you. That being said, I feel it is my duty to point out one thing: GetPrivateProfileString is EVIL. If you ever run on a 9X box and your INI file gets to be bigger than 64K, it will mysteriously fail, and you will spend a lot of time tracking it down.
I'd personally recommend using an INI clas (I'm sure there's one here on CP - or you can write your own), or write some simple routines to parse a text file and get the info you need.
Yes, it IS more work to do it that way, but you have more control, and aren't subject to 64K limitations.
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
I have an MFC app that links several libs and DLLs. Does it matter how my libs and DLLs were built, whether it is Multithreaded or Multithreaded DLL, as long as they link? I'm just not sure whether everything is totally working yet.
If my app is compiled as "multithreaded DLL", must all my DLLs and libs be compiled the same way to work properly?
In one case, UNZDLL.dll (a dll for unzipping files) doesn't seem to work right when called from a DLL at all, however it is built (I don't know how this one was built). I'm just trying to eliminate some possibilities.
Thanks!
-Aaron
|
|
|
|
|