|
actually i worked with multibyte and if now i change it there is so many error comes.
|
|
|
|
|
If you are not changing your application to unicode than use
GetDlgItemTextW and CStringW.
May be this will solve your problem.
I believe in LOVE AT FIRST SITE...
Bcoz I have loved my Mother...
even since I opened my eyes...(ICAN)
|
|
|
|
|
Hi There,
Recently I'm trying allegro game programming library. I wanted to implement a multi-threaded program using allegro. But when I try to compile it, it give me an error "conflicting declaration 'typedef struct tagBITMAP BITMAP'". When I remove the Header file windows.h, this error message is not displayed. So that mean I can't use windows.h and allegro.h same time.
Please give me a comment regarding this problem.
Thank you verymuch
Thil
|
|
|
|
|
|
Thank you very much Andrew. I did it. but I couldn't find a solution. That's why I posted that question.
Thanks again. If you have a solution please let me know.
Thil
|
|
|
|
|
|
I find some code to set it.
But there no image appear in the CListCtrl's column.
HDITEM headerItem;
headerItem.mask = HDI_FORMAT;
CHeaderCtrl* pHeaderCtrl = GetHeaderCtrl();
if(iColumn != m_iCurrentSortItem) {
pHeaderCtrl->GetItem(m_iCurrentSortItem, &headerItem);
headerItem.fmt &= ~(HDF_IMAGE | HDF_BITMAP_ON_RIGHT);
pHeaderCtrl->SetItem(m_iCurrentSortItem, &headerItem);
m_iCurrentSortItem = iColumn;
m_imlHeaderCtrl.DeleteImageList();
}
if(iColumn >= 0 && pHeaderCtrl->GetItem(iColumn, &headerItem)) {
m_atSortArrow = atType;
HINSTANCE hInstRes = AfxFindResourceHandle(MAKEINTRESOURCE(m_atSortArrow), RT_BITMAP);
if (hInstRes != NULL){
HBITMAP hbmSortStates = (HBITMAP)::LoadImage(hInstRes, MAKEINTRESOURCE(m_atSortArrow), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADMAP3DCOLORS);
if (hbmSortStates != NULL){
CBitmap bmSortStates;
bmSortStates.Attach(hbmSortStates);
CImageList imlSortStates;
if (imlSortStates.Create(14, 14, ILC_COLOR32 | ILC_MASK, 1, 0)){
VERIFY( imlSortStates.Add(&bmSortStates, RGB(255, 0, 255)) != -1 );
(void)pHeaderCtrl->SetImageList(&imlSortStates);
m_imlHeaderCtrl.DeleteImageList();
m_imlHeaderCtrl.Attach(imlSortStates.Detach());
}
}
}
headerItem.mask |= HDI_IMAGE;
headerItem.fmt |= HDF_IMAGE | HDF_BITMAP_ON_RIGHT;
headerItem.iImage = 0;
pHeaderCtrl->SetItem(iColumn, &headerItem);
}
|
|
|
|
|
Check this link->[^]
I believe in LOVE AT FIRST SITE...
Bcoz I have loved my Mother...
even since I opened my eyes...(ICAN)
|
|
|
|
|
Isn't imlSortStates going out of scope? I would make that object a member of the dialog.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
I use the Shell_NotifyIcon(NIM_ADD, &m_nidIconData) to add a tray icon for my application. The Icon is added. but when Mouse moved over this icon, the icon disappear. Is there any other statements needed to write?
modified on Monday, January 24, 2011 9:33 PM
|
|
|
|
|
Sounds like the application that installed the icon is no longer running and didn't remove the icon. Explorer realises something's wrong when you interact with the icon and it attempts to communicate with the controlling procress (and fails).
Steve
|
|
|
|
|
Is your application running ? Make sure that your application is running when icon disappears.
|
|
|
|
|
Yes, My application is running when tray icon appear and disappear.
|
|
|
|
|
OK, so you say the process that installed the icon (by calling <a href="http://msdn.microsoft.com/en-us/library/bb762159%28v=vs.85%29.aspx">Shell_NotifyIcon</a>[<a href="http://msdn.microsoft.com/en-us/library/bb762159%28v=vs.85%29.aspx" target="_blank" title="New Window">^</a>] ) is still running. This would suggest that the window handle (the hWnd member of the NOTIFYICONDATA[^] structure) you passed when adding it is no longer valid (the window has been destroyed).
Steve
|
|
|
|
|
Right. I agree with Stephen. Please check with the window which registered for tray icon. As notification goes to that window, if the window doesn't exists the notification icon also will be removed.
|
|
|
|
|
|
This problem resolved. I set the wrong parameters to the m_nidIconData. One parameter needed to set the hWnd of Dialog. But I didnot set it.
Thanks for your reply.
|
|
|
|
|
i have a code from one of my past papers n it was asked to put the reason that what was wrong with that code. i looked on it very much but didnt find any problem. following is the code, kindly tell me even if there is any efficiency or any other drawback in this code.
class A {
int *pi;
public:
A() { pi = new int; }
};
|
|
|
|
|
int *pi; instead of int* pi;
{ pi = new int; } no parentheses, no return.
Short meaningless names? Unaligned braces? Not enough whitespace? No pre tags? I dunno.
|
|
|
|
|
You never delete the memory allocated with new .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
1) Add a destructor
~A() { delete pi; }
2) Either
A) Initialize the pointer to 0 first
A()
:pi(0) {
pi=new int;
}
B) Initialize the pointer (preferred in this case since it is highly unlikely the memory allocation will fail)
A()
:pi(new int) {}
|
|
|
|
|
My original comment was misplaced.
I suspect that the real problem may be that the variable pi is private and thus can never be accessed outside the class. So creating an object of class A serves no real purpose as you cannot set or get the value of pi .
I must get a clever new signature for 2011.
modified on Sunday, January 23, 2011 8:32 AM
|
|
|
|
|
Aside from the fact that the code doesn't do anything useful, the really serious problems with this class are:
- It will leak in normal operation (I use the term "operation" loosely here as the class doesn't do anything)
- It isn't exception safe or neutral
To fix these you're going to need a destructor, a copy constructor (or a private declaration of a copy constructor) and a swapping assignment operator (or a private declaration of an assignment operator).
In addition (ignoring the questionable sanity of storing an int like that) the implementation could be tightened up to use an initialiser list.
The idea here is to make a class that behaves like a object of a type built into the language. The structure your class needs to achieve this is known in some circles as "The Orthodox Canonical Form" and the first place I saw it mentioned and explained properly was in "Advanced C++: Programming Styles and Idioms" By Jim Coplien back in the early 90s. Other authors have picked up the term since then so a search for it might give you some more background.
Cheers,
Ash
|
|
|
|
|
I support this answer, this is more reasonable.
Величие не Бога может быть недооценена.
|
|
|
|
|
Oh, sure, if you want to get all technical.
|
|
|
|