|
Thx a lot!!
I've downloaded the source code of the URLdownload and WebGrab! It seems quite useful for my project! I will take a look within these days! Thx again!
|
|
|
|
|
There is yet another way.
Look up the article "Internet Downloading Using Asynchronous Monikers". Deriving a class from MFC's CAsyncMonikerFile class is a very easy way to get a URL off the net.
|
|
|
|
|
Hi Milke,
I have tried to build the exe from the source code of URLdownload, however, it shows there is a link error "mfc42ud.lib". I just know it is a unicode library but how can I fix this error? Otherwise, I can't trace the flow of the program.
Looking forward to your reply! Thanks a lot!!
Regards,
Dig
|
|
|
|
|
You're building the Unicode debug configuration, but you didn't install the Unicode files when you installed VC. Switch to the (regular) debug build instead. If you really want the Unicode build, you'll need to rerun the VC setup and install the Unicode libraries.
--Mike--
http://home.inreach.com/mdunn/
Is history an illusion caused by the passage of time, or is time an illusion caused by the passage of history?
|
|
|
|
|
Thanks Micheal.
However, I get another question.
You are using worker thread to handle the downloading process in the program, however, you declared that this is not good. Then do you know how to avoid using thread to handle the downloading process?
Thanks for your valuable advice!
|
|
|
|
|
No, what I did wrong was pass a CWnd object between threads. The proper way to do it is to pass the dialog's HWND between threads. From the worker thread, you can then do the UI updates with SendDlgItemMessage() calls.
--Mike--
http://home.inreach.com/mdunn/
Time is an illusion; lunchtime doubly so.
|
|
|
|
|
What I got from your sentence is that it was not good to pass the pointer "this" in the pParam, right?
If I want to do the handle passing properly, is that I need to change the pParam to this->GetSafeHwnd()? Besides, what I need to modify in the related functions apart from this?
pWorkerThread = AfxBeginThread ( gThreadProc, this,
THREAD_PRIORITY_NORMAL, 0,
CREATE_SUSPENDED );
I am sorry that I am a beginner in Visual C++ and MFC so that I need to ask such kind of question! Thanks for your advice a lot!
|
|
|
|
|
In the worker thread (specifically CCallback::OnProgress() ), you'll need to update the UI (progress bars, static text controls) with SendDlgItemMessage() instead of calling the ProgressUpdate() function in the dialog class.
Alternatively, you can package up the info sent to ProgressUpdate() into a struct, and send a custom window message to the dialog. The dialog's handler would read the data from the struct and update the UI.
--Mike--
http://home.inreach.com/mdunn/
Time is an illusion; lunchtime doubly so.
|
|
|
|
|
Besides, since actually I am doing my project for those question, can I make wholly use of the class you'd written "BindStatusCallBack.h"? Since I know it concerns with the copyright, so that I have to ask for your permission beforehand.
Thx!
|
|
|
|
|
Does anyone know where to find a good
tutorial for DirectX 8 programming?
Thanks in advance,
Gregor Schuster
|
|
|
|
|
Download the documentation with DX8. It is commonly accepted that there are no great books on DX, and that the best source of info is the online documentation. I personally used the Microsoft DX and D3D books as a starting point, but remember, they relate to DX5.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
How do I disable Alt-F4 so that my app doesn't exit on this shortcut?
|
|
|
|
|
If you don't want to close at all handle the WM_CLOSE message and do nothing.
If it is just ALT+F4, try overriding PretranslateMessage() (Assuming you're using MFC)
Christian Skovdal Andersen
|
|
|
|
|
How can deal with PreTranslateMessage to
disable Alt+F4?
|
|
|
|
|
Take a small, blunt knife (for example a butter knife) and lift the key 'caps' for 'Alt' and 'F4' out of the keyboard. Then pour quick setting resin in the spaces and leave for five minutes.
Now you have disabled Alt+f4 . You may like to add this method to your readme file so any end users know as well.
|
|
|
|
|
You can disable closing of the window by disabling the close item in the system menu. (This also disables the close gadget and Alt-F4).
if ((WS_CAPTION|WS_SYSMENU) & GetStyle())
{
CMenu *pSysMenu = GetSystemMenu(FALSE);
if (NULL != pSysMenu)
{
pSysMenu->EnableMenuItem(SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);
}
}
|
|
|
|
|
I wish to get the coordinates for the upper left corner of a control derived from a control class, for example CButton. The coordinates should be relative to the uppper left corner of the parents client area.
I've seen that one possible way is to use GetWindowRect, but then I must know the size of the non-client area. How can I get that, or is there a better way to do this?
|
|
|
|
|
You might look at the CWnd::ScreenToClient() method:
void CNewFormView::OnButton2()
{
RECT buttonRect;
CButton* cb = (CButton*)GetDlgItem(IDC_BUTTON1);
cb->GetWindowRect(&buttonRect);
ScreenToClient(&buttonRect);
}
|
|
|
|
|
That was a smart one. I had already solved it, but this cuts my code with 4 rows.
|
|
|
|
|
I installed Microsoft Visual C++ 6.0 but when I click HELP then SEARCH I get following message "MSDN collection not found. Please re-install MSDN". What can I do?
|
|
|
|
|
Try to go into Tools - Options, and select the tab "Help System", in there you can select what MSDN Collection you want to use...
If that does not work, reinstall MSDN...
- Anders
|
|
|
|
|
Imagine we have a CView object and we want to save the screen of the window it handles to a bitmap file or print it out. Any suggestions?
|
|
|
|
|
CWindowDC dc(m_hWnd) will give you a DC that contains your current window. Now CBitmap* pScreen = dc.GetCurrentBitmap(); will give you a CBitmap to play with to your hearts content. There is no point building a DIB, the image is clearly already devive dependant.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
When I go to File/Print, a print dialog box pops up. At the bottom, the user can change the paper size options. How can I reduce the paper size options to just letter (8 1/2 x 11) and legal (8 1/2 x 14) size paper? How can I eliminate all the other paper size options?
Please, any response any one can give me will be greatly appreciated.
Sincerely,
danYELL
|
|
|
|
|
Doing this will be difficult, since you'd have to either disable print setup or chase all the proprietary printer setup dialogs.
Here's an option that traps the wonky paper size before printing starts, and localizes things in OnPreparePrinting:
BOOL CSDITestView::OnPreparePrinting(CPrintInfo* pInfo)
{
BOOL retval;
while(1) {
retval = DoPreparePrinting(pInfo);
if(retval) {
DEVMODE *dm = pInfo->m_pPD->GetDevMode();
if(dm->dmPaperSize != DMPAPER_LETTER && dm->dmPaperSize != DMPAPER_LEGAL) {
if(IDCANCEL == MessageBox("Paper size is yada yada...", "Prepare printing...", MB_OKCANCEL)) {
retval = FALSE;
break;
}
else {
continue;
}
}
else {
break;
}
}
else {
break;
}
}
return retval;
}
You don't necessarily have to send the user back to the print setup, as this does. Not very friendly, really.
Check the docs for DEVMODE for lots of other good things you can check.
BTW this is not to say you can't alter the print dialog - if what you want to do is add something, rather than disable something, check out Al Stevens article in the December Dr. Dobbs for one approach.
|
|
|
|