|
Daaave wrote:
How do I create a CFont object for that font?
You can't. "MS Shell Dlg" is not a real font; it is a special name recognized only by the OS code that parses dialog templates. To get the font used for dialogs, call GetStockObject(DEFAULT_GUI_FONT)
--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
|
|
|
|
|
Sweet thanks man
|
|
|
|
|
I have a Web Browser control and want to download external files like images, *.css, *.js and etc.
The SRC attribute of <IMG> <LINK> <SCRIPT> can contains absolute and relative URLs. How to correctly obtain full URL for these files? May be there is a ready system function to download such files? I tried URLDownloadToFile, may be I must try URL monikers?
Thanks!
|
|
|
|
|
window.location.href is the actual URL. Just parse this, and add your resource name.
sometimes it helps to look at the IL generated code
a MS guy on develop.com "answering" .NET issues
|
|
|
|
|
Well, I finally got a hold of Visual Studio .NET and now I'm trying to rebuild my DLLs which contain a bunch of MFC-based classes. I'm getting tons of errors, the first of which I don't have a solution for.
I have a string class which derives from CString and uses the old m_pchData protected member from 6.0. So now since apparently it's no longer in CString, I get a 'm_pchData' : undeclared identifier error.
What should I do? My class needs the equivalent of this member variable.
Thanks,
Alvaro
Insanity: doing the same thing over and over again and expecting different results. - Albert Einstein
|
|
|
|
|
|
Unfortunately the MFC7 CString uses STL : typedef ATL::CStringT< TCHAR, StrTraitMFC< TCHAR > > CString; .
You may just as well extract the CString implementation from the MFC6 classes.
(afx.h + strcore.cpp)
sometimes it helps to look at the IL generated code
a MS guy on develop.com "answering" .NET issues
|
|
|
|
|
why were you trying to use a protected member?
for read, CString has an LPCTSTR operator, and for write you can GetBuffer() to get an LPTSTR pointer. You should use those, because that is the designed interface of CString.
Signature space for rent. Apply by email to....
|
|
|
|
|
Hi,
I've got direct CD installed on an SOE environment, and I would like to automate the formatting of CDRW's using the tool provided, but it looks like it's a shell extension.
Has anyone got any snippets of code which demonstrate the capture of a shell extensions function??
OR .
Is there a better way to format these discs.. I've looks at the UDF article here, but the app just doesn't seem to want to work with these disks/writers.
Please help
|
|
|
|
|
hey all, in my message map i catch and process ON_MESSAGE(WM_SETCURSOR, onSetCursor) and all the onSetCursor does is this:
if (waitCursor)
SetCursor(LoadCursor(NULL, IDC_APPSTARTING));
else
SetCursor(LoadCursor(NULL, IDC_ARROW));
when compiled in debug version everything works fine, but when compiled in release mode whenever the mouse goes over the app, therefor calling WM_SETCURSOR the program just crashes. Anyone got any ideas on how to fix this? thanks
Luke.
|
|
|
|
|
Sorry i forgot to mention that when i comment out ON_MESSAGE(WM_SETCURSOR, onSetCursor) release mode works fine and that why i'm pretty sure that it is that stuffing it up.
Luke.
|
|
|
|
|
Change ON_MESSAGE to ON_WM_SETCURSOR. The OnSetCursor handler must have the prototype BOOL OnSetCursor(CWnd*, UINT, UINT), whereas ON_MESSAGE describes a handler that has a prototype LRESULT MyHandler(WPARAM, LPARAM).
When the function is called, it is expecting a different number of parameters, and so the stack is getting screwed up - because of the different ways that the stack is managed in debug and release modes, this generally only shows up in a release build.
Dave
|
|
|
|
|
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
|
|
|
|