|
hi,
it may be cause of fault in encoding of lines endings in Your source file, ie. from any reason at end of line instead of standard windows CRLF code ('\x0D','\x0A') appear the CR code ('\x0D'). Debugger counts line endings and if any encoding of line end differs from the other it may results in wrong line highlighting. To eliminate this problem You can use any text tool that can re-encode the line endings in Your source file to standard windows encoding or You can use Visual Studio editor feature "Save With Encoding" into "Save File As..." dialog. I would try first in VS do "Save File As..." -> Unix/Macintosh and next "Save File As..." -> Windows.
modified on Tuesday, August 25, 2009 9:28 AM
|
|
|
|
|
You know I have a switch statement like this:
switch (keyCode)
{
case 0x10:
maybe it's somehow recognising the 0x10 as a new line return. That makes sense becuase it's only after this switch statement that the error occurs
|
|
|
|
|
ed welch wrote: You know I have a switch statement like this:
switch (keyCode)
{
case 0x10:
maybe it's somehow recognising the 0x10 as a new line return.
No, not possible.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
The code after that switch statement is giving the error, so it definately looks like it to me
|
|
|
|
|
Sorry for my mistake, proper hex values of CRLF are: '\x0D' for CR and '\x0A' for LF. Values which I wrote earlier are related decimal values 13 and 10 respectively. I was thinking about hex values but wrote decimal it happens. In Your switch condition there is actually decimal value of 16 but not 10 as You expected. So, it not may be the cause of problem.
|
|
|
|
|
Hi all,
i have create a Tree by derived my class from TreeView.
please tell me how can i add menu on right click of tree,and how can handle menu item over tree.
please help me for this if possible please exaplin me with any example.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
You need to go through a few steps...
1/ Add a handler for NM_RCLICK.
2/ Get the mouse position (annoyingly, this is not a field in NM_RCLICK)
GetMessagePos is your friend.
3/ Maybe use TVM_HITTEST to work out which item you're on top of...
4/ Make / load a popup menu.
5/ TrackPopupMenu(Ex)
6/ Do something with the result.
I've seen you here a while, so I hope that should be enough to steer you in the right direction!
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Thanks ,its done
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Hi ,
I want to convert a BSTR into a character array , I am having string containing alphanumeric character of 30 character . i want it to convert them into a character array..can you please help me in resolving this..
|
|
|
|
|
I use the _bstr_t class for this.
_bstr_t has an overloaded char* operator.
So all you need to do is create an _bstr_t object and typecast it as char* .
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
|
Let's presume your BSTR is called bstr .
UINT len = SysStringLen(bstr);
int bytesNeeded = WideCharToMultiByte(CP_ACP, WC_DEFAULTCHAR, (LPCWSTR)bstr, len, 0, 0, 0, 0);
char* buffer = new char [bytesNeeded + 1];
int bytesNeeded = WideCharToMultiByte(CP_ACP, WC_DEFAULTCHAR, (LPCWSTR)bstr, len, buffer, bytesNeeded, 0, 0);
buffer[bytesNeeded] = 0;
That should create a suitably sized character array and translate your BSTR into it.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks a lot ...Article is really good
|
|
|
|
|
Hello Friends
my task is to append icons to menu (ie .ico), it is very easy to add bmp file to menu, but in order to need transparency i have to use icons only not bmps.
There are lots of programs for this in MFC , but i need to do it in Win32 API
using VC++
Any help is greatly appreciated
|
|
|
|
|
Aabid wrote: There are lots of programs for this in MFC , but i need to do it in Win32 API
Knowing that MFC is just a thin wrapper around the Win32 API, you should be able to look at the MFC code to tell what MFC is doing, and pick out the relevant parts.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi david can u guide me how to convert this function to Win32 API,
ie how can i handle this function as message
void CMainFrame::OnInitMenu(CMenu* pMenu)
{
#if _MFC_VER < 0x0800
#undef __FUNCTION__
#define __FUNCTION__ "OnInitMenu()"
#endif // _MFC_VER < 0x0800
AfxTrace(_T(__FUNCTION__) _T(": %#0x\n"), pMenu->GetSafeHmenu());
MENUITEMINFO minfo;
minfo.cbSize = sizeof(minfo);
for (UINT pos=0; pos<pMenu->GetMenuItemCount(); pos++)
{
minfo.fMask = MIIM_FTYPE | MIIM_ID;
pMenu->GetMenuItemInfo(pos, &minfo, TRUE);
HICON hIcon = GetIconForItem(minfo.wID);
if (hIcon && !(minfo.fType & MFT_OWNERDRAW))
{
AfxTrace(_T("replace for id=%#0x\n"), minfo.wID);
minfo.fMask = MIIM_FTYPE | MIIM_BITMAP;
minfo.hbmpItem = HBMMENU_CALLBACK;
minfo.fType = MFT_STRING;
::SetMenuItemInfo(pMenu->GetSafeHmenu(), pos, TRUE, &minfo);
}
else
AfxTrace(_T("keep for id=%#0x\n"), minfo.wID);
// ::DestroyIcon(hIcon); // we use LR_SHARED instead
}
}
We Have To Conert it into case WM_INITMENU:
|
|
|
|
|
See here. Googling for such will also turn up dozens of examples.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi all,
I have a thread in my application.
When the thread is running its eating up the CPU.
My thread code is like:
ThreadProcess(LPVOID)
{
while(TRUE)
{
if(flag==true)
{
ExecFunc();
}
}
}
If the flag is set then it will execute the function.This flag is set in other function.
So I want to keep this thread idle until the flag is set.
How can I do it.Please help me.
Regards,
Sunil Kumar
|
|
|
|
|
|
Don't use a boolean but use an event instead (and use the WaitForSingleObject[^] function). There's also a good tutorial about threads here[^]
|
|
|
|
|
If you expect the wait time to be relatively long, then use one of those WaitFor... functions. If the wait time would be very low, then a spin loop is an ideal candidate.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi All
i have got article of write data in excel from code project.But it's give one exception error.Error is
An unhandled exception of type 'System.NullReferenceException' occurred in WEDLL.dll
Article link http://69.10.233.10/KB/mcpp/automate_Excel_in_C__.aspx[^]
How to solve that problem.
Plz help me.
|
|
|
|
|
|
Hi all,
I want to get process ID for my dialog based application, when i close my process..
How can i get it...
Thanks in advance
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|