|
Thanks that helped i will try and protect that .opt file by moving it into sourcesafe.
|
|
|
|
|
This is no good. This is a VS6 bug, and I had to surrender with it. Now I divide a workspace into subprojects when I want to have my classes separated/grouped.
Regards,
BB
|
|
|
|
|
Hi,
I wanted to use the RTF/CRichEditCtrl as a kind of report system, where the reports are generated from templates of rtf files. Consider a simple application, that needs to fill out a predefined form with some application dependant values.
A first simple solution would be to search and replace Tags within the RTF file with the computed values.
A better solution would be to use the field tag from the RTF specification directly. For example the author field from a word document would look like:
{\field{\*\fldinst
{ AUTHOR \\* MERGEFORMAT }}{\fldrslt {Dirk}}}
where fldinst is the specific field instruction and fldrslt is the latest evaluated result.
Unhappily the CRichEditCtrl does not evaluate internal fields (like author) either, and I couldn't find any Interface in the ITextDocument specification to access the fields of the document.
Does anybody know how to reevaluate the contents of fields programmatically? Something like a callback function with the fied instruction (fldinst) and the return value is the evaluated result? Another possibility would be to reparse the complete document again and aply the evaluated values into the result field (fldrslt) and then feed the document back to the Ctrl.
Any ideas / code?
Thanks
Dirk
|
|
|
|
|
Hi,
does somebody know how to rename an existing project??
Thanks, Mark
|
|
|
|
|
Make a search for vsrename here on CP.
[edit]
Ouuahh connection is fast today, so you will even get a link
Click here[^]
[/edit]
~RaGE();
|
|
|
|
|
Do you realy want to change the project name of just the .exe name? If just the .exe name then (1)select project settings (2)select like tab (3)change the output file name for both debug and release versions (4)change the name(s) in version info. resource and any where else where is might be stored (such as your about box and string table, etc...)
I just did the above today, since the internal project name was not acceptable for a released .exe name.
|
|
|
|
|
Hi.
Got a little question, i need to change the m_pszHelpFilePath member to another value.
Let's assume i have a dialog where i can click english or dutch help file.
If english, m_pszHelpFilePath = appname.HLP
if dutch, m_pszHelpFilePath = appnameD.HLP
(path need to be the path where the exe file is executing)
Does anyone know how to do this?
Greetings
Jens
|
|
|
|
|
Try this (MSDN):
free((void*)m_pszHelpFilePath);
m_pszHelpFilePath=_tcsdup(_T("d:\\somedir\\myhelp.hlp"));
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
yeah i found that too, but how can i know the current directory where the application is running?
And can i access this member everywhere?
|
|
|
|
|
This will give you the current directory where the application is running.
GetModuleFileName ( NULL, strPath, MAX_PATH );
m_pszHelpFilePath is a public member of CWinApp so you can access this member anywhere this way:
AfxGetApp()->m_pszHelpFilePath
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
yeah i've been trying it out:
char path[256];
GetModuleFileName(NULL, path, 256);
CString strFilePath = path;
int idx = strFilePath.ReverseFind( '\\' );
strFilePath.SetAt( idx, '\0' );
AfxMessageBox(strFilePath);
displays "c:\source\myprogram\debug"
free((void*)app->m_pszHelpFilePath);
app->m_pszHelpFilePath=_tcsdup(strFilePath);
it doesn't work .. he still takes the normal path but i think there is a problem with the '\'
i think he has to display "c:\\source\\myprogram\\debug"
Am i right, and so yes how can i easily fix this problem?
...
AfxMessageBox(strFilePath);
strFilePath += "\\MYPROGRAMF.HLP";
AfxMessageBox(strFilePath);
Why doesn't he add "\\MYPROGRAMF.HLP" to the CString????
i totally don't get it anymore
|
|
|
|
|
strFilePath in your program is the path the exe file. If your help file is there two then you don't really need the whole path. strFilePath = "helpfile.hlp". But if you want to proceed with the exe path then you need c:\source\myprogram\debug\helpfile.hlp". In your program all you have is c:\source\myprogram\debug.
Also check CWinApp::WinHelp
char szPath[ MAX_PATH + 1 ];
GetModuleFileName( NULL, szPath, MAX_PATH );
CString strPath = szPath;
int idx = strPath.ReverseFind( '\\' );
length_of_exe_file = 10;
if( idx != -1 )
{
strPath.Delete( idx+1, length_of_exe_file );
}
strPath += "helpfile.hlp";
AfxMessageBox( strPath );
free((void*)AfxGetApp()->m_pszHelpFilePath);
AfxGetApp()->m_pszHelpFilePath=_tcsdup(strPath);
JensB wrote:
it doesn't work .. he still takes the normal path but i think there is a problem with the '\'
i think he has to display "c:\\source\\myprogram\\debug"
\\ is a way for the compiler to read '\'. '\' is called an escape sequence I think. I might be wrong about the name.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
yes, this is a debug-build
i've put my HLP files compiled alsoo in the debug folder where the .exe file is executing.
But i still have the problem that "helpfile.hlp" is NOT added to the CString .. although AfxMessageBox() doesn't show it well
AfxMessageBox(strPath); //output: c:\myprogram\debug\
strPath += "helpfile.hlp";
AfxMessageBox(strPath);
//output: c:\myprogram\debug\
so "helpfile.hlp" isn't added to the string!?!?
any idea?
|
|
|
|
|
uhm i solved it like this: the file name (standard) was something like 'myproject.HLP' and the other file i changed name to 'myprojectF.HLP' .. and he loads the correct file now
still one question left
-> i wanted to use the member function Insert (CString::Insert(..) but when i compile, the compiles gives an error and says Insert(..) isn't a member of the CString class.
Code (bit messy)
----
CString strCurrPath;
strCurrPath = (CString) (AfxGetApp()->m_pszHelpFilePath);
int idx = strCurrPath.ReverseFind('.');
CString strRechterGedeelte, strLinkerGedeelte,strFull;
strRechterGedeelte = strCurrPath.Right(strlen(strCurrPath)-idx);
strLinkerGedeelte = strCurrPath.Left(strlen(strCurrPath)-strlen(strRechterGedeelte));
strFull = strLinkerGedeelte + "F" + strRechterGedeelte;
free((void*)AfxGetApp()->m_pszHelpFilePath);
AfxGetApp()->m_pszHelpFilePath=_tcsdup(strFull);
|
|
|
|
|
In your source code (in one of your previous postings ) you had something like:
strExePath.SetAt( idx, "\0" );
If you try to add a string to strExePath, you won't be successfull because the string will be added after the null character so you will never be able to se it. That's why I used Delete in the example that I gave you. But anyways, you found your own solution which is very good.
Now going back to your Insert question, I don't see you using it in your source code. How are you using it?
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
yes, i wanted to use the insert member function of CString because then i will be able then to delete three CString variables (strRechterGedeelte, strLinkerGedeelte, strFull) because they are then useless.
This doesn't work:
CString strCurrPath;
strCurrPath = (CString) (AfxGetApp()->m_pszHelpFilePath);
int idx = strCurrPath.ReverseFind('.'); //returns position of '.'
//Now i want to add the char 'F' at that position
int iLength = strCurrPath.Insert(idx, 'F');
AfxMessageBox(strCurrPath);
// error C2039: 'Insert' : is not a member of 'CString'
//!!!!Insert(..) is a member function of CString class
which is alot shorter then (but it works too):
CString strCurrPath;
CString strRechterGedeelte, strLinkerGedeelte,strFull;
strCurrPath = (CString) (AfxGetApp()->m_pszHelpFilePath);
strRechterGedeelte = strCurrPath.Right(strlen(strCurrPath)-idx);
strLinkerGedeelte = strCurrPath.Left(strlen(strCurrPath)-strlen (strRechterGedeelte));
strFull = strLinkerGedeelte + "F" + strRechterGedeelte;
AfxMessageBox(strCurrPath);
and btw, i work with Visual C++ 5
Greetings Jens
|
|
|
|
|
Hi,
I am trying put one rectangle in MemDC and bring to screen.
Here is the code:
CDC MemDC;
CClientDC mydc(this);
MemDC.CreateCompatibleDC(&mydc);
MemDC.Rectagble(&myrect);
MemDC.SelectObject(&mybrush); /////myrect and mybrush I created before
MemDC.FillRect(&myrect,&mybrush);
mydc.BitBlt(0,0,1024,768,&MemDC,0,0,SRCCOPY);
But I am not finding any output.
Help me.
Thanks
Satya
|
|
|
|
|
This can't work...you have to construct a compatible bitmap and select it into the memory DC. At the moment, you are simply drawing on "nothing"...and "nothing" is what you are bitblitting.
greets,
Jason
|
|
|
|
|
Hi,
Where I have to include that Compatible Bitmap??
That means I have to draw the things on the bitmap and move this to memory and bitblt to screen??
Can U please give some explanation,
Regards
Satya
|
|
|
|
|
>CDC MemDC;
>CClientDC mydc(this);
CBitmap bmMem;
>MemDC.CreateCompatibleDC(&mydc);
if (bmMem.CreateCompatibleBitmap(&mydc, nWidth, nHeight))
{
CBitmap* pOldBM = MemDC.SelectObject(&bmMem);
>MemDC.Rectagble(&myrect);
>MemDC.SelectObject(&mybrush); /////myrect and mybrush I created before
>MemDC.FillRect(&myrect,&mybrush);
>mydc.BitBlt(0,0,1024,768,&MemDC,0,0,SRCCOPY);
MemDC.SelectObject(pOldBM);
}
|
|
|
|
|
Hi,
Yes that should do it!
|
|
|
|
|
//Looks like you want to do flicker free drawing
//Which is the only reason for doing this
CDC MemDC;
CBitmap bmp;
CClientDC mydc(this);
MemDC.CreateCompatibleDC(&mydc);
bmp.CreateCompatibleBitmap(&mydc,1024,768);
CBitmap* pOldBmp = MemDC.SelectObject(&bmp);
// Draw rectangle
CBrush* pOldBrush = MemDC.SelectObject(&mybrush);
MemDC.Rectangle(myrect);
MemDC.SelectObject(&pOldBrush);
//TODO: Draw other things
//Blit to client DC
mydc.BitBlt(0,0,1024,768,&MemDC,0,0,SRCCOPY);
//Clean up
MemDC.SelectObject(&pOldBmp);
MemDC.DeleteDC();
Doing all of the above when you receive a WM_PAINT message is the slow way, but it works.
Find the article "Do a flicker-free drawing using MFC methods" here at codeproject. I have not read it but it should provide you with your answers.
Trust in the code Luke. Yea right!
|
|
|
|
|
Thank U all for the replies
I got it.
Regards
Satya
|
|
|
|
|
I need to create a new system level environment variable in my MFC code ..Is there any API for it ..
I think putenv() changes only the process level environment varaible .But GetEnv() retrives the system level environment variable !!!!
Help required for the above situation...
|
|
|
|
|
In Win2k/XP, global environment variables come in two flavors: system and user. For lack of a suitable API, you can directly access them via the registry at
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment and
HKEY_CURRENT_USER\Environment respectively.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|