|
I need some more details, but the most common context I assume you're talking about is how to correctly use the SetItemHeight method of CComboBox. Notice that if you use SetItemHeight( -1, .... ), where -1 is the index of the editbox, then you can set the size of the editbox, thus making it show...
/=/=/=/=
Deus
/=/=/=/=
|
|
|
|
|
umm i want to have the ccombobox, but i don't want to show the dropdown arrow on the right hand side
unless the user double clicks the control
Bryce
|
|
|
|
|
Very strange behavior if I may say so... Let me get this straight:
You have a control that looks like a regular editbox. When you double-click on it, a dropdown arrow appears and a dropdown list. Is this correct?
A friend of mine showed me a simple trick to do this: Create a normal editbox, and hook its double-click message. When the event occurs, dynamically create a combobox, with the same size and position of the editbox (so it completely hides the editbox). The user will choose whatever he likes, and when he presses ENTER or loses focus of the control, you xfer the information from the combobox back to the editbox, and destroy the combobox.
To sum things up:
OnDoubleClickOnEditBox:
Create Combobox on top of editbox
On ENTER or Loss-of-focus:
Xfer the data from the combobox to the editbox
Destroy the combobox.
/=/=/=/=
Deus
/=/=/=/=
|
|
|
|
|
I found some cool strings to edit in the registry that affect where the desktop wallpaper is placed. Now, I wrote some code to modify those strings, but I need to showhow force a refresh/redraw on the desktop to get it to use the new settings.
Currently, the only way for the settings to be updated is for me to use the Desktop Control Panel applet and click "Apply", forcing it to redraw the background.
I tried, GetDesktopWindow()->Invalidate() but that didn't work.
I'm using C++/MFC, VC6.0
Any help/ideas people have would be great.
Thanks!
|
|
|
|
|
Have you tried GetDeskTopWindow()->RedrawWindow()??
Don't know if it will work, but it is worth a try.
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
Within you lies the power for good - Use it!
|
|
|
|
|
Try calling SystemParametersInfo() with the SPI_SETDESKWALLPAPER parameter (specify the existing wallpaper if you don't need to change it) and the SPIF_SENDCHANGE flag set.
- Shog9 - Aaah... It's time to relax. You know what that means: a glass of beer, your favorite ergo chair... And of course, The Code Project loaded on your Personal Computer System. So go on, and indulge yourself, put your feet up. Lean back and just enjoy the articles. After all, CP sooths even the savage
|
|
|
|
|
Thank You!
Seems way too easy, now that I know what I need to do.
|
|
|
|
|
How can I launch .hlp files from my application? (IE user clicks "help" button it luanches the help file).
Thanks
|
|
|
|
|
You could try the ShellExecute Win32 API function (see the MSDN docs) - using the path to the help file as the lpFile parameter & "open" as the lpVerb parameter should do the trick - and it also works for pretty much any file you want to open that has a file association (which is nice).
Alternatively (he says, after looking in the MSDN docs), you could try the WinHelp API function - never used it myself.
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
whats the lpDirectory param supposed to be with shellexecute()?
|
|
|
|
|
Hello,
I want to override the really simple stuff in an MDI application. I'd like to override:
File->New
File->Open
Window->New
Is there a way I can find the code that VC++ uses for these commands that come already working in an MDI apllication?
If there is can someone tell me exactly where it is, like a link to the actual code or post it or something.
Thanks so much for the help,
NickOne
|
|
|
|
|
The best way to track these down for yourself is to start with the menu resource. Look at the command ID for the given menu item (such as ID_FILE_NEW). Then do a Find in Files for that ID (match whole words and case to speed up your search). You'll find the message map entry for that command, telling you the name of the function that handles it.
You will find all of these in your MFC\Src directory
Scot Brennecke
Software Developer
VC++ MVP
|
|
|
|
|
I want to close my modeless dialog spawned by a CFormView mDI using the right hand side cross on the title bar, and send a message plus do some housekeeping when the cross is clicked. I put (for testing) message boxes in
1. DestroyWindow()
2. OnDestroy()
3.PostNcDestroy()
None fired when I closed my modeless dlg with the cross (whats is called anyways that cross? )
From my deductions with various combinations I found that closing the modeless with the cross does not invoke any destroy type function. Once spawned (and even if closed thereafter with the x), only when the whole app is closed with the cross, do the messageboxes fire (only for ondestroy and postncdestroy, but not destroywindow))
If I explicitly call destroywindow in the modeless dialog, it of course triggers all three messageboxes.
What needs to be done to override the cross?
|
|
|
|
|
Try overriding OnClose and calling DestroyWindow from there. The cleanup code (particularly a call to delete this if no other part of the code takes care of it) is usually best placed in PostNcDestroy .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thank you,
The WM_CLOSE was the right message sent when the cross is clicked.
|
|
|
|
|
I have some trouble with FTP download. I'd like to make files downloaded from server as current information, but the server seems to use memory cash. Suppose that there's a file called "aaa.txt", and I downloaded. It's OK for the first time. But when the file is changed in the server even though it still keeps the same filename as "aaa.txt", I can't download the new aaa.txt. Instead, the previous aaa.txt keeps being downloaded, although the file was certainly changed on the server. The weird part is that the date of file changed in the local hard drive, so I thought it was updated as the new file at first, but everything(except the date) is same as the previous file.
I just used "GetFile" for downloading.
How can I refresh it and download changed files?
Please give me some advice! Thank you.
|
|
|
|
|
I'm not sure I understand your problem entirely, but could it be that you as user have an -outdated- version of the file in your temp internet files folder, created at the first time you downloaded it?
If that is the case, then you might look at CWebGrab a class by Chris Maunder, which has a force reload function. You can find it here. It is an http download class though, but I think the SetForceReload() function should be helpful.
Regards,
Griffith
Everything you say will be misquoted, ripped out of context and used against you.
|
|
|
|
|
|
Hello!
I want to print the content (CStrings) of a ListBox from a dialogbased MFC-Programm! Can anybody help me?
halloduichbinsnur@web.de
Lucky2002
|
|
|
|
|
|
Hello!
First: Thank you!
But I still have problems with printing from the List Box. Particularly: What do I have to write into the functions: OnBeginPrinting, OnPrint, OnEndPrinting. Must I change something in the Print-function?
Can anybody help me more exactly? I only want to print the content (CStrings) of a ListBox from a dialogbased programm.
Thank you very much!
Have a nice day!
Lucky2002
|
|
|
|
|
For very simple printing, you can leave the OnBeginPrinting() and OnEndPrinting() functions blank. You can do all your printing in OnPrint().
Simply use CListBox::GetText() to get the strings from the listbox, and CDC::DrawText() to print the strings onto the printer. Just be sure to update the rectangle that DrawText() uses so that you do not print all the strings on top of each other. The CPrintInfo::m_rectDraw variable contains the coordinates of the printable portions of the page.
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
Within you lies the power for good - Use it!
|
|
|
|
|
Hello!
I'm sorry, but I still have problem with the printing functions. The member-variable of my ListBox is m_ctrlListBox.
I wrote in the OnPrint(CDC *pDC, CPrintInfo* pInfo)-function:
CString s;
m_ctrlListBox.GetText(0,s);
CRect g(2,2,2,2) ;
pDC->DrawText(s,g,DT_LEFT || DT_TOP);
The problem: My print is empty!
Can anybody help me??
Thank you very much.
Lucky2002
|
|
|
|
|
The first thing that comes to mind is that your CRect g is too small. you are trying to draw the text into a 2x2 pixel area. The second is to make sure that GetText() is actually getting the text and that CString s is not empty.
try CRect (0,0,pInfo->rectDraw.right, pInfo->rectDraw.bottom);
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
Within you lies the power for good - Use it!
|
|
|
|
|
Hello!
Thank you very much, it works!
Now I have the next Problem:
Only the first CString is printed, but I want to print the whole content of the ListBox.
First I made a for statement:
CString test;
int anz=m_ctrlListe.GetCount();
for(int i=0;i<anz;i++)
{
this-="">m_ctrlListe.GetText(i,test);
CRect g( 750,750,pInfo->m_rectDraw.right,pInfo->m_rectDraw.bottom);
pDC->DrawText(test,g ,DT_LEFT || DT_TOP );
}
It is logical, that only the last entry is printed.
How must I update the CRect to print the whole content of the ListBox.
Thank you very much!
Have a nice day.
Lucky 2002
|
|
|
|