|
Hi,
I'm using a C++(native) in VS2005. And when I manually add some member variables or methods the intellisence can't handle this and when I'm trying to build the application(MFC executable) it crushes the VS2005 IDE.
After that I've to manually delete the intellisence database file (*.ncb) and open solution for compilation again.
The question is:
- Is there any way (some hot key or IDE macro) to enforce manually intellisence update from the VS2005 IDE?
This would solve my problem.
Thanks,
Oleg.
|
|
|
|
|
Hey Friends
I rememeber we had a way by which we can monitor changes in a folder.
I even implemented it long time back.
i do not remember anything about it now
Any idea of the api / way ?
Regards
|
|
|
|
|
Check out FindFirstChangeNotification() and ReadDirectoryChangesW()
|
|
|
|
|
Brilliant
Thanks
|
|
|
|
|
vikrant kpr wrote: I rememeber we had a way by which we can monitor changes in a folder.
ReadDirectoryChangeW[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
|
Hello,
I have to find how change the menu background color (menubar and menuitems), but nothing yet.
On true, I want to change my dialog based app background color (I am using SetDialogBkColor() method), but the menu (I have a menu in the dialog too) continue with the default system background color.
So, I only want to change the menu background color (same color of my dialog background).
Could anybody help me?
Thanks,
Cris.
|
|
|
|
|
Cris wrote: SetDialogBkColor
... is obsolete. Handling WM_CTLCOLOR is a better choice into the future.
For the menus, maybe take a look at deriving a class from CMenu and making the menu owner drawn.
See here[^] for lots of examples.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Hi,
I need to convert TCHAR to char*.
TCHAR buff[512]={NULL};
char tempBuff[512]={NULL};
CString strTemp;
_stprintf(buff, _T("Hello World"));
strTemp = buff;
buff = strTemp.GetBuffer(strTemp.GetLength());
but buff seems to be null.
I'm unable to convert from TCHAR to char*. Using VC++6.0/MFC. UNICODE VERSION.
Thanks in Advance.
Rajesh
|
|
|
|
|
Rajesh_Parameswaran wrote: buff = strTemp.GetBuffer(strTemp.GetLength());
You can't convert a TCHAR* to a TCHAR[512] so that assignment won't work.
What are you trying to do? Do you need to convert the contents of the
TCHAR array to an array of char or just cast the pointer to the array to a different type?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I didn't notice your tempBuff variable, so I assume you want something like this:
TCHAR buff[512]={NULL};
char tempBuff[512]={NULL};
_stprintf(buff, _T("Hello World"));
strcpy(tempBuff, CT2CA(buff)); Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Use an ATL conversion macro:
CString s = _T("Hello world!");
const char* p = T2CA(LPCTSTR(s)); More here[^] and here[^]
|
|
|
|
|
Mike,
That doesn't work on VS 2005 which is why I coded my example like I did (besides
trying to fit the OP's code).
How does one force the macros to work old-style like you've shown?
Thanks,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
What about it doesn't work in VC8? Does CT2CA work instead?
|
|
|
|
|
|
I found it - need a macro.
USES_CONVERSION;
CString s = _T("Hello world!");
const char* p = T2CA(LPCTSTR(s));
That's better
To recap:
USES_CONVERSION;
CString s = _T("Hello world!");
const char* p1 = CT2CA(LPCTSTR(s));
const char* p2 = T2CA(LPCTSTR(s));
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark/Micheal,
Thanks for the response.
I'm still having problem in using the macro USES_CONVERSION.
I'm not using ATL in my project.
Could you let me know an alternative solution with VC++6.0 / MFC?
thanks in advance,
Rajesh
|
|
|
|
|
Hi Rajesh,
Michael's solution should work for VC++ 6. It will NOT work on VC++ 8, so you may want to keep
that in mind if you ever plan to migrate to a new version of C++.
*EDIT* Actually, it WILL work, but you'll need to add the USES_CONVERSION macro in VC++ 8.
Sorry for my confusion
Mark
Last modified: 1hr 10mins after originally posted --
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I found the code on [http://www.wincli.com/?p=72].
These two functions is what you need:
<br />
int wstrlen(_TCHAR * wstr)<br />
{<br />
int l_idx = 0;<br />
while (((char*)wstr)[l_idx]!=0) l_idx+=2;<br />
return l_idx;<br />
}<br />
<br />
char * wstrdup(_TCHAR * wSrc)<br />
{<br />
int l_idx=0;<br />
int l_len = wstrlen(wSrc);<br />
char * l_nstr = (char*)malloc(l_len);<br />
if (l_nstr) {<br />
do {<br />
l_nstr[l_idx] = (char)wSrc[l_idx];<br />
l_idx++;<br />
} while ((char)wSrc[l_idx]!=0);<br />
}<br />
nstr[l_idx] = 0;<br />
return l_nstr;<br />
}<br />
|
|
|
|
|
Hi, I'm a begginer in this programming stuff, and I learn visual C++ from the book "teach yourself visual c++ in 21 days". anyway I am on the 6th day now and I have a small problem with the menu code. here is the listing:
1.CMenu *m_lMenu;
2.CPoint m_pPoint;
3.m_pPoint = point;
4.ClientToScreen(&m_pPoint);
5.m_lMenu - GetMenu();
6.m_lMenu = m_lMenu->GetSubMenu(0);
7.m_lMenu->TrackPopupMenu(TPM_CENTERALIGN + TPM_LEFTBUTTON, m_pPoint.x, m_pPoint.y, this, NULL);
now when I compile my project ( ofcourse there is other code which works just fine), compiler gives me 2 warnings:
D:\C\projects\menus\menusDlg.cpp(203) : warning C4552: '>>' : operator has no effect; expected operator with side-effect
D:\C\projects\menus\menusDlg.cpp(204) : warning C4700: local variable 'm_lMenu' used without having been initialized
this code is copied from the book so if there is error then the error is in th book.
So my question is what is the problem? my guess is that there is something wrong with line 5 (m_lMenu - GetMenu()) make's no sense right? or is the problem in something other?
I tried even with -> and .
|
|
|
|
|
|
Looks like line 5 should have used the = operator instead.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
This text is your translation from %LANGUAGE% into english?
Do you have a compiler error number (four digits with a 'C' or 'L' prefixed)?
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Never mind - my own stupidity is the source of this "problem"
|
|
|
|