|
I don't know what you are trying to do here (there a lot of missing information to understand your problem and your code). Anyway, if you need to sort CTime objects, you can use the comparison operators[^], that will probably be much better then trying to do it yourself.
|
|
|
|
|
thanks.. have implemented that. Still it is not sorting correctly.
Also modified the thread with additional information.
Priya Sundar
|
|
|
|
|
By googling a bit (yeah, you can do that too you know ), I found this article[^]. Check also the comments.
And this behavior was in fact explained in the documentation[^].
EDIT: by the way, I don't think the solution provided in the article is the correct way to go, but I posted it so that you can see where your problem is. Check some of the comments and you'll find better way to manage it.
|
|
|
|
|
Hai Cedric,
Actually that article and the links in the article really helped a lot.
And i solved my problem as said in the article - "The function CListCtrl::SortItems(...) is only usefull if we store a pointer in the 32-bit associated value and we want to sort the items by some value that comes from that pointer. "
And I too first google, if i still didnt find the solution, then i post it as a thread.
Then i guess in this case it might help if you suggest me the keywords you used to search this article. That will be a lot of help in future.
Thanks once again!
Priya Sundar
|
|
|
|
|
I just used CListCtrl and SortItems. I think I searched on codeproject too (that's why I found the article). So, if you have a problem, you can google for it and search on the CP articles (there is a lot of good stuff here you know ).
|
|
|
|
|
|
Don't forget the developer's best friend: your debugger. Using it in that situation would immediately reveal that there's something wrong with the parameters that are passed to your callback function.
|
|
|
|
|
Hello All,
I am trying to insert a BMP image in to picture control.
I have added Microsoft common dialog control Ver6 ActiveX control.
IDC_COMMONDIALOG1 Type :- CcommonDialog1 Member:- m_com
Picture Control:-
IDC_STATIC1 Type :- CStatic Member:- m_st1
I have show button in the dialog, when the we click on that we can select a BMP file and show the same file in the Picture control in the dialog.for that i have used the below code.
void CImageAppDlg::OnShow() <br />
{<br />
<br />
<br />
<br />
CString file;<br />
file.Empty();<br />
m_com.ShowOpen();<br />
file=m_com.GetFileName();<br />
file.TrimRight();<br />
<br />
<br />
if(m_hBmpNew != NULL )<br />
DeleteObject(m_hBmpNew);<br />
sourcex=sourcey=0;
if(file.IsEmpty())<br />
AfxMessageBox("Please Select a picture file");<br />
else{<br />
if(file.Right(3)!="bmp")<br />
AfxMessageBox("Please Select a .bmp file");<br />
else<br />
{<br />
m_hBmpNew = (HBITMAP) LoadImage(<br />
AfxGetInstanceHandle(), <br />
file, <br />
IMAGE_BITMAP, <br />
0, <br />
0, <br />
LR_LOADFROMFILE); <br />
if( m_hBmpNew == NULL ){<br />
AfxMessageBox("Load Image Failed");}<br />
<br />
else{<br />
m_st1.GetClientRect( &rectStaticClient );<br />
rectStaticClient.NormalizeRect();<br />
m_size.cx=rectStaticClient.Size().cx;<br />
m_size.cy=rectStaticClient.Size().cy;<br />
m_size.cx = rectStaticClient.Width();
m_size.cy = rectStaticClient.Height();
<br />
<br />
m_st1.ClientToScreen( &rectStaticClient );<br />
ScreenToClient( &rectStaticClient);<br />
<br />
m_pt.x = rectStaticClient.left;<br />
m_pt.y = rectStaticClient.top;<br />
GetObject( m_hBmpNew , sizeof(BITMAP), &m_bmInfo );<br />
VERIFY(m_hBmpOld = (HBITMAP)SelectObject(m_dcMem, m_hBmpNew ) );<br />
<br />
offsetx= m_pt.x;<br />
offsety=m_pt.y;<br />
if(m_bmInfo.bmWidth<=m_size.cx)<br />
{<br />
if((m_size.cx-m_bmInfo.bmWidth)==0)<br />
offsetx= m_pt.x;<br />
else<br />
offsetx= m_pt.x+((m_size.cx-m_bmInfo.bmWidth)/2);<br />
<br />
}<br />
else<br />
if(m_bmInfo.bmHeight<=m_size.cy)<br />
{<br />
if((m_size.cy-m_bmInfo.bmHeight)==0)<br />
offsety= m_pt.y;<br />
else<br />
offsety= m_pt.y+((m_size.cy-m_bmInfo.bmHeight)/2);<br />
}<br />
else<br />
<br />
InvalidateRect(&rectStaticClient);<br />
}<br />
}<br />
}<br />
<br />
}<br />
code has no errors but in the run time i am getting this error
Microsoft VC++ Debug Library
Debug Assertion Failed Error
Can u please tell me what is cause for the error ??
Thanking you ...
Pruthvi R.
|
|
|
|
|
You can use of LoadImage for load your bmp file or CImage class for other foramats and then use of SetBitmap(HBITMAP).
|
|
|
|
|
Hi Hamid,
Thanks for the response.
I have used the LoadImage function only, but still i am getting the run time error. can u please tell me what is the cause.. ?
|
|
|
|
|
Can you show your code now :
HBITMAP h=(HBITMAP)LoadImage(...);
m.SetButton(h);
Does your code like this?
|
|
|
|
|
Hamid i am unable to understand , can u please have a look at my first post where i have posted my complete code ?? and please let me know what changes i have to make.
|
|
|
|
|
Ok run this code did you see any thing on the monitor
//header file
#include "atlImage.h"
CStatic m_Static;
m_Static.Create(NULL,WS_VISIBLE|WS_CHILD|SS_BITMAP,CRect(0,0,100,100),this);
CImage m;
m.Load(_T("d:\\1234.bmp"));
m_Static.SetBitmap(m.Detach());
|
|
|
|
|
|
Hi,
I'm using MFC Visual C++ and encountered a problem using OnKeyDown() function. The problem is that I don't get response from keyboard even if I included all the requirements.
MyDlgClass.cpp
......
......
ON_WM_KEYDOWN
......
......
void CMyDlgClass::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
................
CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
I think, the problem is that the focus wasn't on the dialog but on other objects. If I'm correct how can I possibly shift focus to the dialog or get response from the keyboard?
Hope somebody can help me, thanks.
}
|
|
|
|
|
Do you have any controls on the dialog?
|
|
|
|
|
Hamid. wrote: Do you have any controls on the dialog?
Yes, CButtons and CEdit controls.
|
|
|
|
|
So you can use of PreTranslateMessage.
|
|
|
|
|
Ok, Thanks a lot.
I'll try this.
|
|
|
|
|
You can use of those events,but you dont have any control on the dialog. 
|
|
|
|
|
Using a Microsoft Spy++, I can identify a "Class Name" of any application.
For example, the class name of Notepad.exe is "Notepad".
At this moment, I want to modify a "Class Name" of some applications.
Is it possible or not? If possible, how can I modify a class name?
Thanks!
|
|
|
|
|
what weird hacking are trying to achieve here sir ?
|
|
|
|
|
The question is nothing but a question.
If there are open ways, it is no more weird.
|
|
|
|
|
Wormhole5230 wrote: The question is nothing but a question.
Black Hat intern, Huh?
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
You need the "little hacker guide" for the purpose.
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
|
|
|
|