|
thanks that stoped it from crashing at startup, but now it works fine but when i exit the program then it brings up the this program has crashed message. any ideas?
Luke.
|
|
|
|
|
I know you can sort listboxes ascending with the LBS_SORT style but is there anyway to sort them descending?
Thanks.
- monrobot13
|
|
|
|
|
There's a "descending" style you can use. Not sure what it is, but you can find it out by selecting "descending" in the resource editor and looking at the .rc file.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
As far as what I've seen (I just checked the resource editor) you can only select a descending order in a CListCtrl , but I haven't seen anything for a CListBox . If there isn't one that's just fine but if there is that would be great.
- monrobot13
|
|
|
|
|
Argh! I need more sleep! Sorry, I was thinking CListCtrl . Hmm, now that it's been mentioned, why not use it instead of CListBox ?
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Ravi Bhavnani wrote:
Hmm, now that it's been mentioned, why not use it instead of CListBox?
To tell the truth I'm not really sure of the difference between the two so I just chose the listbox since all I need to do is display a list of items.
- monrobot13
|
|
|
|
|
A CListCtrl is a much more powerful form of CListBox . I prefer it over the circa Windows 3.1 list box implementation.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Alright I guess I'll switch the conrol over to a CListCtrl
Thanks!
- monrobot13
|
|
|
|
|
I'm not aware of any in MFC6. If you want anything other than the default sort (i.e. alphabetic, ascending), then you need to implement an owner drawn list box and write a custom OnCompareItem method.
|
|
|
|
|
Alright sounds good. Thanks for the info.
- monrobot13
|
|
|
|
|
How can I can force the control to send itself a WM_MEASUREITEM message each time it is resized...?
Currently default implementation only fires off a WM_MEASUREITEM at the time of creation and thats it...I need it to fire whenever the control is resized...???
I have the following code (from which I stole from Changing Row Height in an owner drawn Control
By Uwe Keim ) inside my CListBox::OnSize()
CListBox::OnSize(nType, cx, cy);
CRect rc;
GetWindowRect( &rc );
WINDOWPOS wp;
wp.hwnd = m_hWnd;
wp.cx = rc.Width();
wp.cy = rc.Height();
wp.flags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER;
SendMessage( WM_WINDOWPOSCHANGED, 0, (LPARAM)&wp );
Invalidate(FALSE);
However when the code executes I get an exception:
First-chance exception in Timeline2.exe (KERNEL32.DLL): 0xC00000FD: Stack Overflow.
Any ideas as to why this is happening...? Or atleast another way of forcing the control to receive WM_MEASUREITEM on control resizes...?
Thanx a million!
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Well, you'll keep recursing if you send yourself WM_WINDOWPOSCHANGED , as it will trigger OnSize() to be called again, which will send the message again, etc. etc.
What's worked well for me in the past is not bothering with triggering additional WM_MEASUREITEM messages. Instead, move the code from WM_MEASUREITEM into a generic routine (say, CalcItemHeight() ) that will calculate the size of an item. Call this routine from WM_MEASUREITEM , and then also loop in OnSize() , calling CalcItemHeight() and SetItemHeight() (non-MFC: LB_SETITEMHEIGHT ) for each item.
Example:
void CCustomListBox::OnSize(UINT nType, int cx, int cy)
{
SetRedraw(FALSE);
const int nCount = GetCount();
for (int i = 0; i < nCount; i++)
{
int nHeight = CalcItemHeight(i, cx);
SetItemHeight(i, nHeight);
}
SetRedraw(TRUE);
Invalidate(FALSE);
CListBox::OnSize(nType, cx, cy);
}
Shog9
------
Crazy lady with the shiny shoes, where are you?
Kick your feet and calm the space that makes you hollow
Live, Insomnia And The Hole In The Universe
|
|
|
|
|
Hey Shog I haven't really read your answer fully, but I have full confidence in your answer, so again I give you my thanx!!!
I really appreciate this one...not that I didn't appreciate past help, but this makes a huge difference in my control for user friendliness and I just got sooo trying to figure out what was going on...you've saved me countless hours of grief here.
Thanx again!!!
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
if i press ctrl+alt+delete then control should go my own created procedure not to operating system services
r00d0034@yahoo.com
|
|
|
|
|
You cannot do that.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
But you can, just rewrite the GINA.dll, online MSDN has good samples of that, but be aware that u could lock ur system if u did something wrong
Search for gina on msdn!
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
how to log off and login user from the system remotely(from server to client)
what is procedure .
r00d0034@yahoo.com
|
|
|
|
|
Have a look at impersonate api calls they allow user to login and logoff user remotely.
Hope that would help
- Nilesh
|
|
|
|
|
I am trying to establish a RAS-connection from a service with
the following code:
//read entry parameters
BOOL password;
RASDIALPARAMS params;
memset(¶ms, 0, sizeof(RASDIALPARAMS));
params.dwSize = sizeof(RASDIALPARAMS);
lstrcpyn(params.szEntryName, name, sizeof(params.szEntryName));
m_error = ::RasGetEntryDialParams(NULL,
¶ms, &password);
LOG(3, "RAS::RasGetEntryDialParams\n"
" name=%s\n"
" phone=%s\n"
" callback=%s\n"
" user=%s\n"
" pass=%s\n"
" domain=%s\n"
" error=%d\n",
params.szEntryName,
params.szPhoneNumber,
params.szCallbackNumber,
params.szUserName,
params.szPassword,
params.szDomain,
m_error);
//try to connect
m_error = ::RasDial(NULL, NULL, ¶ms, 0, NULL, &m_hras);
if (!m_error)
return true; //success
This works just fine if code runs as "normal" executable, but
cannot read dial-up entry parameters from service under
"LocalSystem" account, i.e. LOG prints entry name only.
What security settings am I missing?
Thank you,
Alexey
|
|
|
|
|
how to halt mouse and key board
what is procedure
r00d0034@yahoo.com
|
|
|
|
|
Read up on system hooks, thats prolly a good place to start!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
can u provide the related link about that?
r00d0034@yahoo.com
|
|
|
|
|
|
Hi.
In an MFC project, is better to implement multithreadingusing AfxBeginThread() or a normal create-thread function such as _beginthread() and CreateThread()? I remember Jeff Prosise recommending AfxBeginThread() for MFC. I would like to get more inputs.
Thanks,
Kuphryn
|
|
|
|
|
To paraphrase the docs, any thread that uses MFC must be created by MFC. So if the new thread uses any MFC features (or access MFC objects), you'd better use AfxBeginThread() .
--Mike--
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|