Home | AboutMe | Development | Teaching | Academic | Communications   
Technical Correspondences

With our Readers, Students, and Friends, for privacy, the personal information is omitted.



Subject: Version info article, Date: Friday, August 30, 2002 1:58 PM
Hi Zuoliu:

Thanks a million for the version info article. Worked great. The really neat thing is that I just subscribed to windows developer this month and I, all of the sudden, had a need to find out the version info of a 3rd party dll. How often does that happen. I dropped your code right into my project. Worked even first time.

Thanks again.
Matt



Subject: WDJ article of Nov. 2000, Date: Fri, 26 Jul 2002 05:44:31 -0700
Hello Zuoliu Ding,

I was able to successfully locate your Windows Developer's Journal article in which you had written, "A Multi-Page, Single-Document UI for MFC". It was good reading back then, and it is still good reading now. However, after successfully downloading (and unzipping) the source code from WDJ website, I discarded the '.mak' file since I will be building my own '.dsp' file. But what I'd like to know, is this, "Should I add the 'MpsdDll' files as a separate project to the MpsdSmpl workspace, or do I simply integrate those MpsdDll's files into the current workspace and let everything exist together under one project? IOW, "How do I bring in the MpsdDll folder?

Secondly, "Do I need to enter anything in Project->Settings->Link under 'Object/library modules' (like the directory path where the .lib file is located)?"

Thank you. I appreciate the use of your valuable time in answering my question.

William
Subject: Re: WDJ article of Nov. 2000, Date: Saturday, July 27, 2002 3:28 PM
William:

To answer your questions, I give you a rezipped package MpCodew.zip in the attachment, including both MpsdDll.dsp and MpsdPrj.dsw for SmplMpsd.exe. Try it first in the following way:

a1. Unzip the files by checking Use Fold Names. Suppose you make it under C:\Temp, and then you have two projects under C:\Temp\Articles\Mp\Mpsd\MpsdSmpl and C:\Temp\Articles\Mp\Mpsd\MpsdDll. Just relocate them wherever you want, such as C:\Temp\Mpsd\MpsdSmpl and C:\Temp\Mpsd\MpsdDll
a2. Double click MpsdPrj.dsw to open the project MpsdPrj , which includes the DLL project.
a3. Use context menuitem Set as Active Project to set MpsdPrj active.
a4. Use Project/Settings/Debug tab to set Working directory: C:\Temp\Mpsd\MpsdDll\Debug for Win32 Debug and C:\Temp\Mpsd\Mpsddll\Release for Win32 Release. Make sure to choose MpsdPrj in the left pane when you do this.
a5. Now build MpsdPrj. You should pass compiling and linking, and can run SmplMpsd.exe without any problem.

Obiously, you can only open the MpsdDll.dsp in one project just for making that Dll.

Second, you probably need to include the project MpsdDll into your existing app project. Experiment with the above MpsdSmpl project by deleting the project MpsdDll first that will cause errors in compiling. And then:

b1. Use Project/Insert Project into Workspace to insert MpsdDll, like using C:\Temp\Mpsd\MpsdDll\MpsdDll.dsp.
b2. Use context menuitem Set as Active Project to set MpsdPrj active. (above a3)
b3. Use Project/Dependencies to set MpsdPrj depend on Mpsd.
b4. The same as a4.
b5. The same as a5.

That's all for you without need of setting 'Object/library modules'. But if you want to run SmplMpsd outside VC++ IDE, as directly double clicking the file SmplMpsd.exe, you must copy MpsdDll.dll to the folder where SmplMpsd resides, just as you make an installation product.

Hope these can be help.

Zuoliu Ding



Subject: CTipWnd class, Date: Wednesday, May 29, 2002 2:25 PM
Dear Zuoliu,

I am using your CTipWnd class from the Windows Developer's Journal article you wrote, "A Generic Tool Tip Class"(April, 2001) and "An Easy Way to Add Tool Tips to Any MFC Control"(May, 2002). It works great, but I have one problem and I was hoping you could help. I am also using CBitmapButton for some of my buttons because I want to display bitmaps on some of the buttons. If I use CTipWnd on a control that uses CBitmapButton, MFC Asserts because it says it "must not already be in permanent map". I believe this is because both classes subclass the control. Do you have a suggestion to get around this problem.
My code looks like this:
     CBitmapButton m_BT_Dial;
         CTipWnd          m_tip;
         CTipHelper       m_tipHelpers[10];

     // Create bitmap buttons.
         m_BT_Dial.AutoLoad(IDC_BT_DIAL, this, 2); // Subclasses control
 
     UINT uIDs[4] ={IDC_BT_NEW, IDC_BT_MODIFY, IDC_BT_REMOVE, IDC_BT_DIAL};
         for (int i = 0; i < 4; i++)
             m_tipHelpers[i].SubclassDlgItem(uIDs[i], this);   // Also subclasses control.

         m_tip.Create(this, 0);
         m_tip.SetTipBkClr(RGB(255, 255, 0));  // Bright yellow
Thanks,
Kent Stuart
Subject: Re: CTipWnd class, Sent: Thursday, May 30, 2002 12:27 AM
Hi, Kent:

Thank you for your question in using my CTipWnd/CTipHelper classes. What you thought is right. CBitmapButton::AutoLoad() needs subclassing control too. In this case, since you defined the button m_BT_Dial as the type CBitmapButton, it doesn't make sense to call SubclassDlgItem() for another subclassing with this button's IDC_BT_DIAL.

For such controls, you have to make the tip helper class derived from this control's class, rather than from CWnd as CTipHelper did. As for CBitmapButton, just copy CTipHelper in TipHlpr.h and replace CTipHelper with CTipHlprBmpBtn and CWnd with CBitmapButton as follows: (could I consider CTipHelper a template? )
// The Tip Helper for CBitmapButton
class CTipHlprBmpBtn : public CBitmapButton
{
protected:
    afx_msg void OnMouseMove(UINT nFlags, CPoint point);
    DECLARE_MESSAGE_MAP()
};

BEGIN_MESSAGE_MAP(CTipHlprBmpBtn, CBitmapButton)
    ON_WM_MOUSEMOVE()
END_MESSAGE_MAP()

void CTipHlprBmpBtn::OnMouseMove(UINT nFlags, CPoint point) 
{
    MapWindowPoints(GetParent(), &point, 1);
    GetParent()->SendMessage(WM_MOUSEMOVE, nFlags, 
                             MAKELONG(point.x, point.y));
}
Now you can define your m_BT_Dial as the type CTipHlprBmpBtn. In OnInitDialog(), you do nothing with CTipHlprBmpBtn, as the subclassing is done by calling m_btnBmp.AutoLoad(). Only thing left is using SET_TIP_TEXT with a tip text in the dialog's OnMouseMove().

I attached the revised TipDemo's code for your reference. The bitmap button m_btnBmp can be seen at the bottom in TipDemo. Hope this helps and solves the similar problem.

Regards,
Zuoliu Ding
Subject: RE: CTipWnd class, Sent: Thursday, May 30, 2002 8:08 AM
Hi, Zuoliu:

That did the trick. Thanks for taking the time and responding to my email so quickly. We are using the tool tip code in development of our next generation application. This info was very helpful.

Best Regards,
Kent Stuart



Subject: Fascinating piece you wrote; your WDJ article. Date: Mon, 30 Oct 2000 15:50:40 -0800
Hello Zuoliu,

Right up front, I want to say how fascinated I am with the article you wrote for the Windows Developer's Journal, November 2000 edition. If the sample works (because I have not yet tested it), it'll be one of those techniques I just know I shall be using, hundreds of times more in the future.

Apart from being very interesting, the article projects the mindset of someone who is not afraid to venture beyond the boundaries of standard MFC, which means that what people like you do, are inherently off the beaten path that other people wish they could do, and only dream about! I congratulate you, and exhort you not to abandon that kind of progressive thinking. It is the stuff that creativity and enterprise is made of. Your kind is not found among the common marketplace of achievers. Good work!! Good man!!

William



Subject: MFC Tech Tip From WDJ Date: Tue, 25 Apr 2000 20:11:51 EDT
Hello, Zuoliu.

You had an MFC Tech Tip published in the February 2000 issue of Windows Developer's Journal (p. 65). The Tech Tip was in reference to "A Reusable Class for Setting the Default Printer. The download from the www.wdj.com website provided the "defprn.cpp" file, the executable file, and a couple other files, but I need the "afxwin.h" and "resource.h" files to complete my assignment, because my project is due next Tuesday.

Also, do you know of a way to get the program to work with just the defprn.cpp? I want to be able to modify the program, change the color of the dialog box, or maybe change the functionality of the dialog box.

Any assistance or pointers you can give me would be greatly appreciated. Thank you.
Mitchell
Subject: Re: MFC Tech Tip From WDJ Date: Wed, 26 Apr 2000 11:38:51 -0700 (PDT)
Hi, Mitchell:

Thanks for you interest in my article. I attached here files by your request. As you can see, "resource.h" is already in ding.zip from wdj site. But for "afxwin.h", it is a standard MFC header under ..\mfc\include that may be different among the different vc++ versions. You have to use it from your own developing platform's MFC, while the one I sent is vc++ 6.0 that might be not good for you.

The problem mentioned here seems that you couldn't make a DefPrn.exe by vc++ 5. Do the following:

1. Copy DefPrn.cpp, DefPrn.rc, DefPrn.ico and resource.h to a new directory.
2. Set up an empty "Win32 Application" project by File/New.
3. Add source file DefPrn.cpp and DefPrn.rc.
4. In Project/Settings select "Using MFC ...".
5. Build the project to get DefPrn.exe.

That's all. Please refer to MSDN regarding any questions on Visual Studio/VC++. And you surely can do anything you want to make changes. Good luck.
Zuoliu Ding



Subject: Multi-page Single Document WDJ sample. Date: Thu, 30 Nov 2000 14:30:38 -0800
Hello Zuoliu,

I was showing your "Multi-page Single Document" sample (from the WDJ magazine) to a friend last night, and he was completely fascinated with what he saw, particularly when I pointed out to him that your sample was better than the straight SDI, or MDI type of document-view architecture. Your sample, I indicated, offered something of a hybrid of both the SDI and MDI structure, "at the same time," in which someone can have it either (or both) ways "at the same time!!"

Personally, I know I shall be referencing your sample (and showing it to other people) many more times in the future. Both the idea and the technique were very good. You do good work!!

William




Subject: What's your suggestion? Date: Wed, 1 Nov 2000 08:04:20 -0800
Hello Zuoliu,

Thank you for the ".dsp" and the ".dsw" files. I had already created them earlier when I first created the project from the files I downloaded from the internet. However, it's good to have a backup always, and they will serve that purpose, particularly since I intend to recreate the entire project anew.

My reason for wanting to recreate the entire project over, is due to something you stated earlier, which may have caused those compile error messages I received when I first tried to construct the project. It's been something of a habit for me that when creating a project involving dll's, to create two projects, one for the host application and the other for the dll's, then set dependency between them.

However, I got to thinking about this after you had sent me those two files, that maybe, for such a small project, I could simply create one project and add all the dll files into the single project, with all the host program's other files too. Might that be how you had intended for your sample project to be created? Which brings me to another scenario. Suppose I have my own host application, and (as in this case) I have your dll's, then for special features that I might want to bring with me into this project, I happen to have dll's from yet a third party. (As we see, things with these dll's can quickly become a little out of control.) Would it then be advisable to create separate projects for each set of dll, rather than bunch everything into one package? IOW, what's your recommendation when to split files into separate projects, and how should those be done?

What do you think?
Thank you! I appreciate both your time and answer.

William




Subject: your Control Panel Applet article in Windows Developers Journal Date: Wed, 21 Jun 2000 14:25:48 -0500
Greetings Ding,

I read your article "Enumerating/Calling Control Panel Applets" in the May issue of Windows Developers Journal.

I see from your byline that you have been working on wireless connectivity development. and I wonder if you would be interested in writing a book about wireless development for Windows applications, or perhaps some other book you might conceive based on your work with Windows.

I am the acquistions editor for CMP Books, R&D Developers Series. We are another operating division in the same publishing company and share office space with Windows Developers Journal.

CMP Books is the new logo of the former R&D Books. We have been publishing books aimed at the same experienced readers as WDJ for ten years. Some recent books in this area include Chris Cant's Writing Windows WDM Device Drivers and John Swanke's series of books Visual C++ MFC Programming by Example, VC++ MFC Extensions by Example, and COM Programming by Example.

There is a pressing need for good Windows programming books that show how to achieve practical results. Have you ever considered writing a book length project on Windows development issues?

Berney Williams
Bernard O. Williams, Ph.D.
Acquistions Editor, CMP Books/R&D Developers Series




Subject: Re: For Word/AutoCorrect Date: Fri, 19 Nov 1999 20:21:43 -0800
Hi, Shikuan:

I have found the file you want as follows:

1. AutoCorrect uses normal.dot to save the contents. For Office 2000, this file under the directory like: x:\Windows\Application Data\Microsoft\Templates For Word 6.0 under x:\Msoffice\WinWord; Wherever it is, use Find to search it.
2. Don't worry about your lost normal.dot. In that case WinWord will automatically re-generate it.For Office 2000, this regneration based on the contents of the last time. For Word 6.0 it is based on the original product.
3. Unlike other dot files, normal.dot can't be read or edited in Word, so I use binary tools to check it. Moreover for Office 2000, the file date seems unchanged when you add new corrections.

Zuoliu Ding




Subject: Control Panel Applets Date: Wed, 6 Jun 2001 11:33:06 -0500
Hi Zuoliu Ding:

I am Tuan Phan. I have been trying to find a way to automate adding a modem entry in the Modems in Control Panel and fill in the required information (for example, COM port, modem speed and modem driver etc...). I read your article published in Windows Developer Journal (May 2000) -- Enumerating/Calling Control Panel Applets. I wonder if you came accross such issues or if you happen to know how to solve the issue I have.
Thanks,

Tuan Phan

Subject: Re: Control Panel Applets Sent: Thursday, June 07, 2001 6:14 PM
Hi, Tuan Phan:

I am not familiar with modem programming. But to be helpful, I would like to talk about the similar work I did for Print Applet. When I created a print monitor WLSMON (see my "A Print Monitor Setup Utility", WDJ, Jan, 2000), I had to add a port entry to the Print Applet. Windows provides AddPort() in print API to let both of you and the Applet call it.

So in order to solve your problem, I guess you need to search MSDN to see whether there is such a set of functions in communication APIs that can fit your use, or try .inf file like installing. It seems no other easy ways to programmatically do it. Best wishes.

Zuoliu Ding




Subject: Re: Changing default printer port Date: Tue, 12 Jan 1999 10:00:42 -0800
Hi Zuoliu,

I read your article in the Dec issue of Windows Developer's Journal regarding changing the default printer port. I tried the program and it works, unfortunately, I would like to do the opposite task -- to change the port in the registry and then have the result displayed in the Printers applet ports dialog. Is there a way to do this without having to reboot the system in NT 4.0?

Thanks,
Tiffany




Subject: print monitor Date: Wed, 29 Dec 1999 16:40:40 -0500
Hi Zuoliu,

I'm sure you have already received a ton of emails so I will keep this short. I've been wanting to write a print monitor and was happy to see the titles on this months developer's journal. Unfortunately I am simply trying to write something that notifies a program when printing is occuring through a particular printer that is already setup on the system. Can you point me in the right direction for resources on this?
Thanks!

Adam




Subject: NT Printer request for help Date: Tuesday, August 10, 1999 5:34 AM
Hi, Zuoliu. Ding

I read your Tech Tips in the August '99 Windows Developer's Journal. You seem to be quite familiar with manipulating printers under Window's NT, so I hope you can help me with my dilemma. I hope that this request is not too intrusive or demanding.

Can you tell me or direct me to some documentation on how to programmatically change the default printer on a Windows NT 4.0 machine? I've searched all over (MSDN, MS Knowledge Base, various tips sites, Win32 & NT API books, etc.) and I can't seem to find this documented anywhere. I found out how it is done on Windows '95, but that technique doesn't seem to work with NT.

The application is for a web based document repository. The documents are in PDF format. We need the ability for the web server to print selected documents to user's choice of any one of a fixed group of printers on our network. With Adobe Acrobat, the relevant DDE or COM based print commands will only print to the default printer.

Any insights or references you can provide are greatly appreciated. Thanks in advance for your reply!

Joseph




Subject: WDJ Article Date: Mon, 4 Dec 2000 12:13:58 -0800
Dear Mr. Ding,

I read your article in November's WDJ issue with interest and wanted to explore your sample application. But I was unable to successfully get the batch file to work.

When I tried running the batch file by simply double clicking on it, I got an error message stating that the file "nmake.exe" was missing. I found that file on my hard drive and moved it into the directory where the batch file was located. I was then missing the file "cl.exe". I also copied that into the same directory but then got a message that a certain .dll file was missing.

Am I supposed to run the batch file from within the VC++ IDE? I'm new to MFC programming (I just finished the Beginning MFC extension course at UC Irvine) so I may not yet be clued in on some basic techniques VC++ programmers use (like using batch files to build a program).
Thanks.

Tom

Subject: Re: WDJ Article Sent: Tuesday, December 05, 2000 11:14 AM
Hi, Tom:

Thanks for your interests in WDJ and my MPSD article.

Regarding your question of four compiling problem, I believe that is simply because of the project settings. Before run .bat, you have to set VC++ three environment variables correctly, PATH, LIB, and INCLUDE. You usually can do that by running Vcvars32.bat under x:\Program Files\Microsoft Visual Studio\Vc98\bin or manually set them. Please take a look at Vcvars32.bat.

The other problem I think you will meet is related to MpsdDll, an MFC Extension DLL. I suggest that you can refer to the VC++ documentation for details. If you are a beginner for MFC, I hope you don't use dll, and instead, combine all together in one App project.

The reason why .bat file is available in the downloadable archive is that WDJ editors require it to get a quick build without using VC++ IDE. If you open two .mak files as text, you can know settings used by it, the same as those by IDE.

The other easy way to start your work fast in VC++ IDE might be:
1. Create a New Project of MFC AppWizard (dll) with Extension DLL.
2. Delete any .cpp, .h, .rc files from the project created by wizard.
3. Insert downloaded four .cpp and four .h files into the project.
4. Compiling should be Ok.

Hope the above would be helpful to you. Good luck.

Zuoliu Ding

Subject: Re: WDJ Article Date: 12/06/00 08:56AM
Thanks for your detailed response, Mr. Ding.

I'll try the different ideas you suggested to see what works.

So do you plan on sticking with MFC after the next release of Visual Studio? It's a confusing time right now for those new to VC++ like myself, trying to figure out what to focus on. But maybe it's always been that way.

Thanks again.
Tom




Subject:Printer Pooling Date: Sun, 9 Apr 2000 11:54:33 +0800
I am a reader of WDJ. I read your Nov. article "A Print Monitor Setup Utility". In that, you mention that you are developing Port Monitor. I am developing a language monitor for our network printer. I hope you can help me to solve my problem.

My problem is, The printer is connected into more than one port(Printer Pooling). In Windows NT documentation says, if any one of the physical port having the problem then language monitor can indicate to spooler that the particular port having problem by using SetPort function. After the indication, the spooler will not send any print job into the indicated error port until the error to be clear. The spooler will send the job into other available good port.But, I did this and it is not working. For example, my printer is connected to LPT1 and LPT2. I set the LPT1 has problem. Immediately, the spooler displays the dialog box and asking that Retry | Cancel. If I select Retry, the spooler again trying to send the print job into the same error port(LPT1) which it has been schedule first, instead of sending to the good port (LPT2). If I select Cancel, then it deletes the job.

Please let me know if you need any clarification. Thank you,

Bala