I have a dialog with a bitmap on it (I have inserted it inside a static control). When opening this dialog on a machine with Large Fonts settings, the whole dialog become larger, but the bitmap remains in the same size.
Do you have any idea how I can resolve this? (either make the dialog stay small or make the bitmap enlarge). I will appreciate any hint you may have.
Environment: VC++6.0, Windows NT4.0 Terminal Server Edition
I'm trying to use CDatabase in a CGI for IIS. The CGI runs perfectly from a command line invoked by a user IUSR_HOST. But from a browser, a memory access exception occurs in a IUSR_HOST session.
The exception seems to occur in a OpenEx(...).
Is there anyone who has a similar experience? or has solved the problem?
I am trying to debug some code that works fine on NT4 but crashes on win98. When I call CPropertySheetEx::Create(), the program terminates! If I wrap the call in a try/catch(...) I see an exception is thrown , and looking at the debug output an access violation occurs in comctl32.dll. This appears to be a well known problem and is documented on MSDN (Q158552) - but it says the problem does not occur on later versions of comctl32 (4.7) which I am using (I have got latest comctl32/headers/libraries etc). The resources for the property sheet exist in a seperate resource
I am not at all sure that this is your problem, but is the boundaries between exe and dll get kind of blurred for MFC sometimes and you have to be very explicit when you are using resources that are stored elsewhere. Try this
{ // the braces are necessary for scope AFX_MANAGE_STATE(AfxGetStaticModuleState());
-----Messaggio originale----- Da: Martin Bonner [mailto:[log in to unmask]] Inviato: venerdì 26 febbraio 1999 9.39 A: [log in to unmask] Oggetto: Re: what's the difference between disable debug and maximize spee d..
> -----Original Message----- > From: Richard Pickett [mailto:[log in to unmask]] > > The VC++ optimizing compiler should not generate buggy code Can't argue with that!
> (I've been > trying to tell that to the VC++ team since 4.0, but they > think it is normal for a compiler to generate code that > does not work!). People have been complaining about the Microsoft C optimizer for a LOT longer than that!
Hello , everyone , i'm writing a sdi application .the view is derived from CHtmlView. i want to save the web page showed in the view as a *.mht file . so i overrode the function "OnDocumentComplete" , the code was like this :
void CBrowserView::OnDocumentComplete(LPCTSTR lpszURL) { // TODO: Add your specialized code here and/or call the base class VARIANT varPath;
I have added a OnKeydown function to a CTreeList class in i dialog box. One of the keys I want to process is the spacebar. It work fine but each time I press the spacebar key, my machine plays a beep.
It seems like the CTreeList is searching for a node in the tree that has a name which begin with a space. Since it can't be found, it play a beep sound.
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: EB034927 From: Daniel Ezri <[log in to unmask]> Subj: RE: OnKeydown and CTreeList Date: Sun, 24 Jun 2001 14:34:20 +0200
>I have added a OnKeydown function to a CTreeList class in i dialog box. One >of the keys I want to process is the spacebar. It work fine but each time I >press the spacebar key, my machine plays a beep.
I have a dialog based application, with a picture control. Sometimes the image I draw using "Draw" function of DIB does not draw the picture on the right place (the CDC of the picture control). It is drawn somewhere else on the screen. At OnInitDialog, I get and save a pointer to the CDC and the corresponding CWnd.
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 5D28EEC2 From: D. J. WOODWARD <[log in to unmask]> Subj: Re: bitmaps appear not in place Date: Fri, 15 Jun 2001 07:59:21 -0000
>I have a dialog based application, with a picture control. Sometimes the image >I draw using "Draw" function of DIB does not draw the picture on the right >place (the CDC of the picture control). It is drawn somewhere else on the >screen.
I have an MFC extension DLL. It was originally a class inside my EXE app, but I decided to move it into a DLL. I have included macro at the beginning of all my functions, and havenÂ’t touched the generated DllMain( ) function.
At link time, I get this error:
Linking... LINK : warning LNK4075: ignoring /EDITANDCONTINUE due to /INCREMENTAL:NO specification mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in URLProc1.obj mfcs42d.lib(dllmodul.obj) : error LNK2005: __pRawDllMain already defined in URLProc1.obj mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in URLProc1.obj; second definition ignored mfcs42d.lib(dllmodul.obj) : warning LNK4006: __pRawDllMain
Windows 2000 , Visual C++ 6.0 SP3 Hi, I've been trying to solve some memory allocation problems in my application, and I found that memory seems not to be the only thing that I have to worry about. I've tried the same application in a computer with a lot of Virtual Memory available, and the application shuts down after opening some windows, and I seems to happend every time I open a certain number of windows. I tried to seek some system resources indicators to see if one of them seems to be full, but I didn't find out what
I'm hosting the IE browser control within a Windows application and need to display text and objects in a browser control that cannot be selected and highlighted. At the present time I use JavaScript to do this work. Any MFC solution?
I have an application, that contains resources for multiple languages. The resource, that is loaded at runtime depends on the language setting of the OS. E.g. when country settings are set to English(US), the english(US) resource is loaded, when the settings are set to German, then the german resource is loaded etc.
Question: is there a way to choose the language ( from outside ) only for this application and also for the attached DDLs without switching the country settings ?
IÂ’m using VC++ 6 pro and have a large project that useÂ’s a property sheet that is derived from CpropertySheet. This property sheet is displayed modeless with the Ok, apply and cancel buttons displayed (using the m_bModeless flag within OnInitDialog).
The problem is when I click any of the buttons nothing happens. IÂ’ve overridden the appropriate event handlers for the above three buttons, IÂ’ve even overridden the OnNotify handler to try and trap the messages there but this is not working either (this handler never receives focus).
I had a similiar problem in my Property page...the buttons could not receive mouse messages. my problem was...i created the pages sending them the wrong parent(instead the prop sheet ...i sent the appl dialog). Check your "parent" to the prop page. Hope it helps.
-----Original Message----- From: Steve Beckett [mailto:[log in to unmask]] Sent: Friday, May 25, 2001 10:22 PM To: [log in to unmask] Subject: Modeless Property sheet woes
For Modeless property sheet, you need use Create function to display it other than DoModal function.
Jing
-----Original Message----- From: Steve Beckett [mailto:[log in to unmask]] Sent: Friday, May 25, 2001 4:22 PM To: [log in to unmask] Subject: Modeless Property sheet woes
Env: VC++ 6pro Windows NT4
Hi,
I'm using VC++ 6 pro and have a large project that use's a property sheet that is derived from CpropertySheet. This property sheet is displayed modeless with the Ok, apply and cancel buttons displayed (using the m_bModeless flag within OnInitDialog).
> Env: VC++ 6pro Windows NT4 > IÂ’m using VC++ 6 pro and have a large project that useÂ’s a property sheet > that is derived from CpropertySheet. This property sheet is displayed > modeless with the Ok, apply and cancel buttons displayed (using the > m_bModeless flag within OnInitDialog).
I have a project that is a static library. It has an rc file. I have another project that is a dll. it links to the static library and wishes to use the static libraries resources. What do I do to get this working? I've tried including the rc file in the rc2 of the dll project but although I have got this compiling, the resources are not found so I end up without bitmaps and strings. There are no clashes of resource IDs.
Jeff, The implementation you're describing should work. If it appears not to be working, I'd first try opening the compiled DLL itself in DevStudio for resource editing, and see if your static library's resources are there.
If they are, they're not being loaded correctly at runtime. If the DLL is a regular DLL it could be that it's trying to load the resources from the wrong module. Adding an AFX_MANAGE_STATE(AfxGetStaticModuleState( )) call to each exported function should cure that . If it's an extension DLL that shouldn't happen..
My problem is I have a CGI application, and I cannot find anyway to debug it. I have tried using all the ways I know of, but no use. Does anyone know how should I debug a CGI application?
I am working with MSVC++ 6 SP5 and IIS 5 on a Win2K box. I am using MFC in my application.
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: B5764637 From: PEDRO CORRAL <[log in to unmask]> Subj: RE: How to debug a CGI application Date: Tue, 22 May 2001 20:49:25 +0200
>My problem is I have a CGI application, and I cannot find anyway to debug it.
There is a little tricky. You must run the cgi in the same machine you have your project. So you must have your web server in the same machine. Add as the first line of your program “Sleep(10000);” and then you can attached the MSVC to the cgi program while it is running. Put a break after
Check out http://support.microsoft.com/support/kb/articles/Q58/6/67.asp
1. Create a CGI program that writes all input to a file. This file will be used for debugging in the next step
2. Add a few lines to the beginning of your code (this sample uses POST) _putenv("CONTENT_TYPE=multipart/form-data"); _putenv("CONTENT_LENGTH=10421"); _putenv("REQUEST_METHOD=POST");
For some reason my MFC app has stopped executing my makehelp.bat file even after changes have been made. Where in the Project settings is the command to execute the makehelp.bat file?
Thanks
Steve White www.VirtualMechanics.com www.DHTMLMagic.com www.SVGMagic.com www.IMSWebTips.com
My problem is that I'm not able/have not found the way to add new rtf-files to the projects. makehelp.bat file is only executed when one or both of the standard help files are modified.
Could this be your problem?
--- Jørn Yngve Dahl-Stamnes EDB Teamco, Trondheim [log in to unmask]
> -----Original Message----- > From: Steve White [mailto:[log in to unmask]] > Sent: 18. mai 2001 17:29 > To: [log in to unmask] > Subject: Makehelp not working > > > VC++ 6 Win2000 > > For some reason my MFC app has stopped executing my > makehelp.bat file even > after changes have been made. Where in the
I am aware of that. You should be able to make a minor change to AfxCore.rtf to flag that the help files are rebuilt. But that is no longer happening in my project. You can also rebuild the project directly (and add additional RTF files) through Help Workshop which is part of the VC++ install. My problem is that although the help files get rebuilt and linked, the topic ID's for new resources are not being added so that context help for them does not work. I suspect I can add the ID's myself but I don't have time to
There are two problems. 1. Automatic call for makehelp.bat after the rtf change 2. Adding new resources to help file.
A2. You have probably missed or corrupted makehelp.bat file. The simplest (but not the best) way is to rename you folder with the project, and rename makehelp.bat file there. Create new project with the same name and copy makehelp.bat file to the old folder. Review your newproject.dsp file and compare with the oldproject.dsp file. It will tell you if you have missed link to makehelp.bat file. Delete new folder and rename the old one. The better way is editing your
I can't get a clean compile for a class with an STL "map" member. I used the sample from the MSDN library as a model, but can't get it to work. The sample program, when built by itself, compiles cleanly, but only if I don't use #include stdafx.h. But when I try NOT including stdafx.h in my real project, the compiler bombs because it can't find the precompiled header directive.
I have an application which uses CSocket. I use the Receive(...) method to read from the socket,which is blocking. So my main thread waits till the read is completed. I want to cancel the read operation if it has to wait for more than 5 seconds.
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: B400E91A From: BRIAN HART <[log in to unmask]> Subj: RE: CSocket blocking problem Date: Mon, 14 May 2001 22:42:37 -0500
>I have an application which uses CSocket. I use the Receive(...) method to >read from the socket,which is blocking. So my main thread waits till the read >is completed. I want to cancel the read operation if it has to wait for more >than 5 seconds.
I want to have a class which is inheriting from CWinThread and CSocket. This represents a connection to the server from a client in a separate thread, and this class implements the protocol this connection observes.
Code looks like this...........
class CProtocol : public virtual CSocket, public virtual CWinThread { public:
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 7523D17B From: ROBERTS, BRIAN M <[log in to unmask]> Subj: RE: Multiple inheritance Date: Fri, 4 May 2001 07:12:41 -0500
>I want to have a class which is inheriting from CWinThread and CSocket.
Short answer: Multiple inheritance with MFC classes is not worth the headache. Use a CSocket member variable or some other method instead. Long answer: See "TN016: Using C++ Multiple Inheritance with MFC" to get started. If you're used to Java interfaces, forget all that when using MFC - the MFC class structure just isn't designed that way.
I need to get a video stream frame by frame. (from capture) The filters available, can only write the stream to a file or present it on the screen (preview).
I wrote a render filter (derives from CBaseRenderer), in order to get a hold of the IMediaSample interface. (through the DoRenderSample function in the filter).
Noticed a strange MFC bug yesterday. Took me about 4 hours to figure this one out. I have a property sheet application. Its really a tray program with a property sheet as the only GUI for changing options. I create the propetysheet in the cwinapp myself so that it isn't shown until my tray icon is double-clicked. I had the all the defaults except WS_VISIBLE and then added WS_MINIMIZEBOX. The contextual help "?" icon was there, but couldn't be depressed. I knew all my code was good, even Shift-F1 worked. It drove me crazy and
Question 1. What is the proper way to set and read individual bits int the LPT port from a Windows program using MFC?
I have tried some DLLs that does some magic (for me anyway) to let me directly access IO addresses in the hardware at a low level. This works fine for real ports but doesn't work for USB connected ports, even though I can find an address for it in the properties for the LPT device (and at location 0:408 from a DOS window).
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 8C12633C From: ROBERTS, BRIAN M <[log in to unmask]> Subj: RE: 2 questions, LPT port and close button Date: Fri, 4 May 2001 07:38:20 -0500
>What is the proper way to set and read individual bits int the LPT port from a >Windows program using MFC? > >Is it possible to remove the top right close button from my MainFrame window >without also removing the resizing buttons (as by removing the WS_SYSMENU >style in PreCreateWindow())?
I have sn SDI application where I want to print items from a list such that each item in the list along with its details gets printed on a different page.
In the function of MylstView class, I am setting the number of pages to be printed = the number of items in the list
Running a virgin MFC MDI app (no user code) through the debugger (F5) causes access violation during AfxCreateDC() if HP Deskjet 950C is the default printer.
Execution stops with user breakpoint called from code at 0x77f762e8.
No interruption occurs if the debug version is run outside the debugger.
Changing the default printer to Cannon BJ-230 does not cause the problem.
> Environment: NT4.0 SP6a, VC++5.0 > > Running a virgin MFC MDI app (no user code) through the debugger > (F5) causes access violation during AfxCreateDC() if HP Deskjet > 950C is the default printer. > > Execution stops with user breakpoint called from code at > 0x77f762e8. > > No interruption occurs if the debug version is run outside the > debugger. > > Changing the default printer to Cannon BJ-230 does not cause the > problem. > > Call stack and debug output attached. > Any comments/clues appreciated.
Environment: Visual C++ 6.0 Enterprise Ed. SP5, Windows 2000 Professional SP1
Does anyone there know any way to make a menubar dockable in MFC way, or any other? Or, maybe someone has some piece of code || some places on the web, that has done it.
Thanks in advance
Ehsan Akhgari
Email: [log in to unmask] [log in to unmask] http://www.rooz.net/ http://www.BeginThread.com/Contributors/ehsan/
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 9F272802 From: LUIS ABREU <[log in to unmask]> Subj: RE: Dockable menubar Date: Mon, 30 Apr 2001 11:13:57 +0100
>Does anyone there know any way to make a menubar dockable in MFC way,
www.codeguru.com
===== Digest Separator =====
Mesg: F56ABDEF From: Anastas Ilchev <[log in to unmask]> Subj: Re: Dockable menubar Date: Wed, 02 May 2001 14:06:07 +0300
Look in http://codeguru.earthweb.com/menu/dockmenubar.shtml http://codeguru.earthweb.com/menu/offMenu.shtml http://codeguru.earthweb.com/toolbar/VCMenu.shtml
Well, this particular problem is bugging me for some time now.. ok.. Win98 ; VC 6;
I am developing a Dialog Based Application, which has a Tab Control,( using property Sheet) and a Tree Control in each of the tabs.
Now, the problem is, the program HANGS when I Minimize the Window..... Ok.. here is the Main Problem. The program DOES NOT HANG if I select One of the Tab (first one) and then minimize. BUT, IT HANGS, if I click on the Tree Control, and then minimize.
I have the following problem: when I override PreTranslateMessage() (in order to pre-process keystrokes) in my dialog based app, my tooltips stop working. Other than that, everything works fine (i.e. the keystroke are caught and processed the way they are supposed to, etc.)
I suppose that this is because the tooltip notifications are also caught by the PreTranslateMessage() function and then for some reason they are not forwarded to the system. Maybe it is because the function is fed an MSG structure and not an NMHDR? If this is the case how can
I have couple of 100 lines to be printed from the default printer. My problem is I am not getting how to eject the page after every 70 lines. I tried to use StartPage() and EndPage().
Can anyone please give a code to automatically eject the page.
> -----Original Message----- > From: MFC -- Microsoft Foundation Classes > [mailto:[log in to unmask]]On Behalf Of Feroz > Sent: Monday, April 23, 2001 4:28 AM > To: [log in to unmask] > Subject: How to Eject Page??? > > > Env : WinNT4, VC++(6.0), SP4 > > Hi Dear List, > > I have couple of 100 lines to be printed from the > default printer. My problem is I am not getting how to > eject the page after every 70 lines. I tried to use > StartPage() and EndPage(). > > Can anyone please give a code to automatically eject > the page.
I am part of team developing a modular application where optional functionality is provided by means of DLLS. Each module has the ability to install itself into the application framework. Most modules create CView derivatives in order to display user information.
Up to now we have used "extension" DLLs as MFC does not allow the installation of a CView into the application framework from a non-extension DLL, (all sorts of ASSERTS when we tried). This has been ok up to now but the need to band our resources is becoming a project
I have a dialog hosting a custom OCX. I want to route a message captured by the dialog to the OCX. How can I do it since all I have is the wrapper class generated by the Components and Controls Gallery. Calling SendMessage() on that CWnd derived class does nothing. Maybe I could be able to do something with COleControlContainer and/or COleControlSite but it looks like a dangerous path to me since these classes are undocumented and a bit intimidating. Does anyone has an idea?
Using ATL wizard I am creating the Component(DLL). While adding the new class and trying to compile the program i am getting the following error.
"RegSvr32: DllRegisterServer in .\Debug\Test.dll failed. Return code was: 0x80040154"
I went to error lookup and observed that "It gives UnSpecified error". So I am bit confused, this is not happening all the NT workstations. Some of them have this kind of problem. What could be reason for this.
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: AD2F950D From: NAGI HANNA NAHAS <[log in to unmask]> Subj: Re: Unable to Register the component Date: Thu, 19 Apr 2001 15:50:41 +0200
>Using ATL wizard I am creating the Component(DLL). While adding the new class >and trying to compile the program i am getting the following error. > >"RegSvr32: DllRegisterServer in .\Debug\Test.dll failed. Return code was: >0x80040154" > >I went to error lookup and observed that "It gives UnSpecified error". So I am >bit confused, this is not happening all the NT workstations. Some of them have >this kind of problem. What could be reason
This is an add-onto my previous mail titled "Regarding the attaching of a CView derived view to a frame window".
I changed my configuration to release and the assertion error vanished! Means now everything works out fine.
I am kinda unsatisfied with this situation. Of course I could go on with my work but at the back of my mind I have this feeling things are not all that well. I mean if it works under release mode but asserts under debug mode something's awefully wrong.
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 4864380C From: CURTIS MCKIM <[log in to unmask]> Subj: RE: Amazing finding!!!! Date: Wed, 18 Apr 2001 23:43:21 -0400
>I changed my configuration to release and the assertion error vanished! Means >now everything works out fine.
ASSERTs only execute in Debug builds. The problem that the ASSERT is checking for is likely still there. The point of ASSERTs is to allow you to find and fix problems when testing debug versions before you go to release and the problem becomes hard to repeat/fix. You should continue to try to find the source of the Assertion.
I am writing a program in which I require to have a window to which I need to add a previously unknown number of controls (edit boxes, combos etc.). Initially I thought I'd use a dialog box and then manually add the controls to it. But the problem is that if the number of controls is more than a certain limit I'll need to add scrolling features. Of course I could do this easily by trapping the vertical scroll bar messages.
Hi Dear List, I have a ListBox to which a Horizontal Scrollbar is attached. I have a timer which fills the List with the Current time after every second.
1#> I want the Scrollbar to move to downword when I show the text on the window AUTOMATICALLY.
2#> I want the Window to be updated AUTOMATICALLY to show the last text added.
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 614CC1B3 From: Gabriel Murillo <[log in to unmask]> Subj: Re: Scrolling Listbox Date: Tue, 17 Apr 2001 15:48:08 -0700 (PDT)
>I have a ListBox to which a Horizontal Scrollbar is attached. I have a timer >which fills the List with the Current time after every second. >1#> I want the Scrollbar to move to downword when I show the text on the >window AUTOMATICALLY. >2#> I want the Window to be updated AUTOMATICALLY to show the last text added.
>I have a ListBox to which a Horizontal Scrollbar is attached. I have a timer >which fills the List with the Current time after every second. >1#> I want the Scrollbar to move to downword when I show the text on the >window AUTOMATICALLY. >2#> I want the Window to be updated AUTOMATICALLY to show the last text added.
We have added a resource of type "TEXT" and included a number of txt files we require in a program. However, we receive hundreds of warnings such as the following:
Generating Code... Linking... .\ObjectSearchDB.def : warning LNK4017: export-version statement not supported for the target platform; ignored .\ObjectSearchDB.def : warning LNK4017: filter-query statement not supported for the target platform; ignored .\ObjectSearchDB.def : warning LNK4017: action statement not supported for the target platform; ignored .\ObjectSearchDB.def : warning LNK4017: set-field statement not supported for the target platform; ignored .\ObjectSearchDB.def : warning LNK4017: set-field statement not supported for
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 54355E75 From: CSABA SZELENYI <[log in to unmask]> Subj: RE: #pragma Date: Tue, 17 Apr 2001 08:15:20 +0200
>We have added a resource of type "TEXT" and included a number of txt files we >require in a program. However, we receive hundreds of warnings such as the >following: >.\ObjectSearchDB.def : warning LNK4017: export-version statement not >supported for the target platform; ignored
I'm trying to create a similar behavior to OnNew. When I click on a push button I try to create a new template with a different type of view (see below for the reasons). However when I implemented the following code I receive an Assertion error objcore.cpp line 43...? How can I resolve this in such away that I cancel this error. My application is an MDI and I'd like to declare the code in the CMainframe.
I have experienced some similar problems, but then using CSingleDocTemplate. I have solved these in the following way:
* First let the DocumentTemplate create a document: CDocument* pDoc = (CDocument*) pMyTemplate->CreateNewDocument(); * Then create your new frame: pMyTemplate->CreateNewFrame(pDoc, NULL);
Hope this can work for you
Perry Bruins ([log in to unmask])
> -----Original Message----- > From: ak daniel [SMTP:[log in to unmask]] > Sent: Friday, April 13, 2001 18:38 > To: [log in to unmask] > Subject: Assert valid when creating a new > > All, > > VC++6, WIN95 > > I'm trying to create a similar behavior to OnNew. When > I click on a push
Is there any way to catch the drawing on the title bar in SDI? I want to draw my caption but OnNcPaint doesn't work when I have Modal dialog over the mainframe! 10x!
Another problem of mine: When I run my app in debug mode, in the debug output I see the following output (when I just run my app, and then close it):
Loaded 'C:\WINNT\System32\ntdll.dll', no matching symbolic information found. <snip> Loaded 'C:\WINNT\system32\wininet.dll', no matching symbolic information found. Warning: constructing COleException, scode = DISP_E_MEMBERNOTFOUND ($80020003). First-chance exception in URLBook.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception. Warning: constructing COleException, scode = DISP_E_MEMBERNOTFOUND ($80020003). First-chance exception in URLBook.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception. Loaded 'C:\WINNT\system32\urlmon.dll', no matching symbolic information found. <snip> Loaded 'C:\WINNT\system32\MSDBG.DLL', no matching symbolic information found. Warning: constructing COleException, scode = DISP_E_MEMBERNOTFOUND ($80020003).
-----Original Message----- From: Ehsan Akhgari [mailto:[log in to unmask]] Sent: Wednesday, April 11, 2001 11:47 PM To: [log in to unmask] Subject: DISP_E_MEMBERNOTFOUND ?
Another problem of mine: When I run my app in debug mode, in the debug output I see the following output (when I just run my app, and then close it):
Loaded 'C:\WINNT\System32\ntdll.dll', no matching symbolic information found. <snip> Loaded 'C:\WINNT\system32\wininet.dll', no matching symbolic information found. Warning: constructing COleException, scode = DISP_E_MEMBERNOTFOUND ($80020003). First-chance exception in URLBook.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception. Warning: constructing COleException, scode = DISP_E_MEMBERNOTFOUND ($80020003). First-chance exception in URLBook.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception. Loaded 'C:\WINNT\system32\urlmon.dll', no matching
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 4166D4AF From: Phil Daley <[log in to unmask]> Subj: Re: How to proccess a WM_KEYDOWN in a dialog Application?? Date: Wed, 11 Apr 2001 20:00:38 -0400
>Why are there some keys that don't generate the WM_KEYDOWN message in a Dialog >based application? How can I proccess that message then?
I would like to make the Dialogbar like the one in the Visual C++. If I am using the class CDialogbar I can not implement the "tips" for buttons like the tooltips on the toolbar.
Can somebody say me what to do to have the "tips" for controls on dialogbar?
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: ED06A8C3 From: Oleg Zhuk <[log in to unmask]> Subj: Re: CDialogBar Date: Mon, 9 Apr 2001 11:05:53 +0300
>I would like to make the Dialogbar like the one in the Visual C++. If I am >using the class CDialogbar I can not implement the "tips" for buttons like the >tooltips on the toolbar.
use CToolTipCtrl The CToolTipCtrl class encapsulates the functionality of a tool tip control
BOOL CMyDialogBar::GetToolTip(UINT id, NMHDR *pNMHDR, LRESULT *pResult) { TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR; UINT nID = pNMHDR->idFrom; if (pTTT->uFlags & TTF_IDISHWND) { nID = ::GetDlgCtrlID((HWND)nID); switch(nID){ case IDC_MY_DIALOG_CONTROL1: strcpy(pTTT->szText, "This is the tooltip"); pTTT->hinst = NULL; return(TRUE); break; case IDC_MY_DIALOG_CONTROL2: strcpy(pTTT->szText, "This is another tooltip"); pTTT->hinst = NULL; return(TRUE); break; } }
return(FALSE); }
HTH, Drew
----- Original Message ----- From: Lubomir Kordos <[log in to unmask]> To: <[log in to unmask]> Sent: Saturday, April 07, 2001 9:53 AM Subject: CDialogBar
windows 2000,VC++6.0 Hello, It may be a tough one.How Can I my view class can determine whether user has canceled the print job while printing is in progress(by pressing cancel button)?I saw the MFC code in CView::OnFilePrint in which CPrintingDialog is shown.But Is there any way for my application to know when the user cancels the print job by pressing cancel button in that Dialog. Any Ideas... Thanks Sri.
Hi srinivas, It is possible but I am not sure. I belive it gives a message when the user clicks the CANCEL button. suresh
--- Srinivas Nallandighal <[log in to unmask]> wrote: > windows 2000,VC++6.0 > Hello, > It may be a tough one.How Can I my view class can > determine whether user has canceled the print job > while printing is in progress(by > pressing cancel button)?I saw the MFC code in > CView::OnFilePrint in which CPrintingDialog is > shown.But Is there any way for my application to > know > when the user cancels the print job by pressing >
I am trying to create a new document through the File New command. Everything works fine except I cannot associate a new (or NULL) file with the document. It keeps the name of the last file and overwrites it if I Save (instead of popping up with the Save-As dialog.
I have tried overriding OnFileNew() to call OnNewDocument() or theApp.OnFileNew() or theApp.OpenDocumentFile(NULL); but none of it works. Any suggestions appreciated.
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: F4352E89 From: SHEN LIPING <[log in to unmask]> Subj: Re: Document Name Date: Fri, 30 Mar 2001 08:14:18 +0900
>I am trying to create a new document through the File New command. Everything >works fine except I cannot associate a new (or NULL) file with the document. >It keeps the name of the last file and overwrites it if I Save (instead of >popping up with the Save-As dialog.
I have an exe that has a resource file, I am using a CPropertyPage * returned from another DLL. When I run and I create this object that is a CPropertyPage ptr returned to me I crash and when I trace things down, I see a resource handle issue in CPropertyPage::CommonConstruct with a bad return from AfxFindResourceHandle.
I think this problem is due to a mismatch in resource handles and module states. If the module state is that of the exe and you are trying to invoke a resource that is not in the current module state you will get an invalid handle and hence a crash. This is because by default MFC assumes the module state to be that of the exe(main application) and If you have an exported function in a DLL(in your case the property page in the DLL),the resource template is actually stored in the DLL module. You need to switch the
I have a problem doing a release build of an application containing a CAsyncSocket derived listening socket.
The application is designed to run on two PCs and either one can send information to the other using the socket connection.
The problem is, that when a release build is installed on a 'clean' machine that only has NT on it, the application can create a socket and send data, but will not allow an incoming socket connection. (The client gets a WSAECONNRESET error the first time then WSAECONNREFUSED on subsequent attempts [names may be different as this
Use the Dependency Walker, also called just "Depends". You can usually find this under Start, VC, Tools menu. Note I do not mean the Tools menu within VC -- this is from the pretty Windows Start button. It will list all DLL's required by your EXE. It also lists the version and date of all required DLL's on the current machine, so you can run it on both machines and compare.
In my understanding, when, and only when, one call CMyListBox::AddString(), CMyListBox::MeasureItem() is called.
But, at that time, itemData should be NULL. So, I think, the itemData is nonsense.
What I'd like to do is to modify both itemWidth and itemHeight of an item in CMyListBox::MeasureItem(), according to a length of a string associated with the item.
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: CF7DC86E From: DAVID ELLIOTT <[log in to unmask]> Subj: Re: How one can make use of itemData in CMyListBox::MeasureItem()? Date: Tue, 27 Mar 2001 07:32:21 -0800
In my understanding, when, and only when, one call CMyListBox::AddString(), CMyListBox::MeasureItem() is called. But, at that time, itemData should be NULL. So, I think, the itemData is nonsense. What I'd like to do is to modify both itemWidth and itemHeight of an item in CMyListBox::MeasureItem(), according to a length of a string associated with the item.
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 0B24691F From: pgerhart <[log in to unmask]> Subj: Re: FindFile ? Date: Sat, 24 Mar 2001 18:52:47 -0500
>I'm trying to use the FindFile() function to retrieve the file size and other >info of specific files selected in a CTreeCtrl.
You are confusing two things. CFileFind simply wraps the Win32 FindFirstFile and FindNextFile - search MSDN for WIN32_FIND_DATA for more info. The Win32 function know nothing about your app's TreeControl (or CTreeView).
I have a funny happening between release and debug build. My app consists of an SDI app with a horizontal splitter window dividing the screen into 2 panes. The lower pain has a CListView derived class in it, the upper has a grid class in it. (al la codeproject) The other pane is a CView class. The grid is created as a child of this pane/window. The GetFocus function is written to pass focus to the grid control when the view gets focus.
Is it possible to place a an icon(Bitmap) in the second column in a listControl ?
I have a ListControl(Report style) in a dialog box. I have loaded the Images using SetImageList(). In my first column a normal text is to be set and in the second column an Icon and a text. But always the icon comes in the first column.
I have a problem using the method FindFile of CFtpFileFinder. If I call FindFile with a distinct file name (no wildcards), either with full path or not, the method always returns TRUE, regardless if the file exists on the FTP site or not.
If this is a known behavior of the method then I would need a solution for the task of checking if a single file is on the FTP site.
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 716153B7 From: Phil Daley <[log in to unmask]> Subj: Re: Problem with CFtpFileFind::FindFile Date: Fri, 23 Mar 2001 07:35:05 -0500
>I have a problem using the method FindFile of CFtpFileFinder. If I call >FindFile with a distinct file name (no wildcards), either with full path or >not, the method always returns TRUE, regardless if the file exists on the FTP >site or not.
I removed/deleted two files from a project (.h and .cpp). Since i deleted them I cannot run anymore a project because of this error:
Element.cpp fatal error C1083: Cannot open source file: 'C:\mfc\Element.cpp': No such file or directory Generating Code... Error executing cl.exe.
I was given some help to do the following:
When you look in the directory that holds all the files (using Explorer) there is a .clw file - delete this file. Then, back in VC++, open up the classwizard - you will be prompted to rebuild the class list. Now click on all
In an MFC-based application I am displaying web page titles on a tab (CTabCtrl). When the web page title contains the "&" character, it is displayed as an underscore character (behaving like a menu item's accelerator key). Currently I am using something like this:
This is, and feels like, a kludge. It is not a perfect solution because in other UI controls (like listboxes), "&&" is displayed as "&&". Does anybody know of a style bit that would make Windows not treat "&" characters as some sort
At 21:17 3/19/2001 -0800, Vanvliet wrote: >OS: Win9x, WinNT, Win2k >DEV: VC++ 6.0 SP4 > >In an MFC-based application I am displaying web page titles on a tab >(CTabCtrl). When the web page title contains the "&" character, it is >displayed as an underscore character (behaving like a menu item's >accelerator key). Currently I am using something like this: > > CString csTitle; > ... > csTitle.Replace(_T("&"), _T("&&")); > >This is, and feels like, a kludge. It is not a perfect solution because in >other UI controls (like listboxes), "&&" is displayed as "&&". Does anybody >know of a style
When the user of my application presses the left button, I'm capturing the mouse with CWnd::SetCapture() to get the mouse position whereever it is moved. When I receive a left button up message, I call ReleaseCapture(). Simple, and it works fine most of the time, but there is an exception. If the user presses Alt-Tab to change application during my mouse capture, the new application will receive the left button up message, that I wanted. What should I do?
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: E958D869 From: Wayne Coles <[log in to unmask]> Subj: RE: Capturing the mouse Date: Fri, 16 Mar 2001 11:11:45 -0000
>When the user of my application presses the left button, I'm capturing the >mouse with CWnd::SetCapture() to get the mouse position whereever it is moved. >When I receive a left button up message, I call ReleaseCapture(). Simple, and >it works fine most of the time, but there is an exception. If the user presses >Alt-Tab to change application during my mouse capture, the new application >will receive the left button up message, that I wanted. What
Could anybody tell me how to draw an image or icon in a combo box?
I think it can be drawn in each item in a drop-down list by adding my own code in a DrawItem, but I have no way to do that in a combo box, more precise, in an edit ctrl.
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 3E7E4173 From: Oleg Zhuk <[log in to unmask]> Subj: Re: How to draw an image or icon in a combo box? Date: Fri, 16 Mar 2001 10:44:16 +0200
>Could anybody tell me how to draw an image or icon in a combo box?
use MFC class CComboBoxEx or CommonConrol ComboBoxEx (you can read more in MSDN >> Platform SDK >> User Interface Service >> Windows Common Controls >> ComboBoxEx Controls)
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 5E2F794B From: AJAY K SANGHI <[log in to unmask]> Subj: RE: Detecting memory leaks... Date: Fri, 16 Mar 2001 16:13:56 +0530
>I get following memory leak: >Detected memory leaks! >Dumping objects -> >{15298} normal block at 0x009FA5F0, 12 bytes long. >Data: < | | Pz > 80 7C 9F 00 80 7C 9F 00 50 7A 9F 00 >The memory allocation number in curly brackets and memory address keeps >changing but the data is always same.
I have the MFC ActiveX control, which was originally created in 1998. I've made some minor changes in the drawing methods recently (interface was NOT changed) and I've decided to regenerate the wrapper files, just in case.
Surprisingly, the result files were different from the original wrapper files.
The ODL file (identical for both versions): ...... [id(25)] void AddItem(bool selected, BSTR text);
I am facing a very strange problem with ListView. I have a Mainframe Window splitted into two, Both the views are derived from CListView. But One view shows the list in "LST_LIST" way and the other shows in "LST_REPORT" way...
The first view(LST_LIST styled) should show 20 items in one screen, if the items are getting increased then it should add to the last and there should be a 'Vertical Scrollbar' attached, but here I am getting a problem that the items are should in the columns and the 'Horizontal Scrollbar' is
The MSDN help for CListCtrl explains that this is how LST_LIST works. Change the style of FirstView to LST_REPORT|LVS_NOCOLUMNHEADER to get the effect you want.
----- Original Message ----- From: "Feroz" <[log in to unmask]> To: <[log in to unmask]> Sent: Sunday, March 11, 2001 11:04 AM Subject: Strange ListView display!!!
> Hi List, > > Environment: VC++ 6.0 with SP3, WinNT > > I am facing a very strange problem with ListView. I > have a Mainframe Window splitted into two, Both the > views are derived from CListView. But One view shows > the list in "LST_LIST" way and the other shows in >
I have a question about the File "save as". In the DOC class OnSaveDocument(LPCTSTR lpszPathName), how can I tell it is from the "Save As" message ? I could not find info about this from the MSDN. The reason I need this is I need to save additional data then just the regular data when "Save As" is called. Thanks.
THE POINT: CreateIconFromResource succeeds where both LoadIcon and LoadImage fail. GetLastError returns 0. Maybe somebody has run into this and can explain what's going on (Feng, this means you! ;)
BACKGROUND: Using LoadLibraryEx to load a file as a data file, I build a linked list of resources using EnumResourceTypes and EnumResourceNames. The idea is to ultimately add images to a CImageList for display in a CListCtrl.
Environment: Visual Studio 6.0, sp4, VC++ 6.0, WinNT 4.0, sp6
What is the easiest way to have the view continually scroll as events are added to it so the newest addition is always in view? I haven't seen an example of this although I've seen programs that do this. Does anyone have a code sample that accomplishes this?
Hi! I have a view derived from CListView. It's a simple list (intended to be displayed in the LVS_REPORT style) made of 3 columns. I want all 3 columns to be right justified (they list integers). However, for some reason, only the last 2 columns get formatted correctly - the 1st column remains left justified - regardless of what I do...
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 0202CD0B From: [log in to unmask] (Steve Spencer) Subj: Re: Right-justifying CListView's first column??? Date: Tue, 6 Mar 2001 17:09 +0000 (GMT)
>I have a view derived from CListView. It's a simple list (intended to be >displayed in the LVS_REPORT style) made of 3 columns. I want all 3 columns to >be right justified (they list integers). However, for some reason, only the >last 2 columns get formatted correctly - the 1st column remains left justified >- regardless of what I do...
> -----Original Message----- > From: Daniel Ben-Ezri [mailto:[log in to unmask]] > Sent: 05 March 2001 18:08 > Subject: Right-justifying CListView's first column??? > > I have a view derived from CListView. It's a simple list > (intended to be displayed in the LVS_REPORT style) made > of 3 columns. I want all 3 columns to be right justified.
> I read the MSDN documentation more thoroughly and discovered > that by design "...The leftmost column is always left > justified and contains the small icon and label..."
Environment: VC++ 6.0, sp4, WinNT 4.0 sp6, SDI application without DOC support
Due to user interaction I would like to disable some buttons. My member variable, m_wndToolBar, is of class CToolBar so I did this to disable a button with id = ID_ERASE and the button stayed enabled.
CToolBarCtrl& toolbarCtrl = m_wndToolBar.GetToolBarCtrl(); int what = toolbarCtrl.EnableButton(ID_ERASE, FALSE);
I am facing a very strange problem with ListView. I have a Mainframe Window splitted into two, Both the views are derived from CListView. But One view shows the list in "LST_LIST" way and the other shows in "LST_REPORT" way...
The first view(LST_LIST styled) should show 20 items in one screen, if the items are getting increased then it should add to the last and there should be a 'Vertical Scrollbar' attached, but here I am getting a problem that the items are should in the columns and the 'Horizontal Scrollbar' is
Environment: VC++ 6.0, sp4, WinNT 4.0 sp6, SDI application without DOC support
Due to user interaction I would like to disable some buttons. My member variable, m_wndToolBar, is of class CToolBar so I did this to disable a button with id = ID_ERASE and the button stayed enabled.
CToolBarCtrl& toolbarCtrl = m_wndToolBar.GetToolBarCtrl(); int what = toolbarCtrl.EnableButton(ID_ERASE, FALSE);
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: E91C0E4D From: STKH (STEEN KROGSGAARD) <[log in to unmask]> Subj: RE: CToolBarCtrl member function EnableButton Date: Fri, 2 Mar 2001 11:58:38 +0100
>Due to user interaction I would like to disable some buttons. My member >variable, m_wndToolBar, is of class CToolBar so I did this to disable a >button with id = ID_ERASE and the button stayed enabled. > CToolBarCtrl& toolbarCtrl = m_wndToolBar.GetToolBarCtrl(); > int what = toolbarCtrl.EnableButton(ID_ERASE, FALSE); >The integer, what, is set to 1 (non-zero signifying that the EnableButton >function worked?) but I must be missing something because I couldn't get the >button to
I need to resize window (for example static window) in my dialog according the used font and string. Is there any way how to calculate string width and height. I tried to use: HDC hDC = ::GetDC(hWnd); SIZE size; ::GetTextExtentPoint32(hDC, szCA, nLen, &size); ::MoveWindow(hWnd, 10, 10, size.cx, size.cy, false);
But size.cx is not correct. It is always longer than is needed.
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 3C56C070 From: EHSAN AKHGARI <[log in to unmask]> Subj: RE: String dimensions calculating Date: Sat, 3 Mar 2001 10:48:43 +0330
>I need to resize window (for example static window) in my dialog according the >used font and string. Is there any way how to calculate string width and >height.
try this, maybe it helps...
TEXTMETRIC tm; ::GetTextMetrics(hDC, &tm); /* use tm properties. more info can be found at MSDN. */
I have got some strange results from GetTextExtentPoint if the SIZE was not initialized.
Luis Zinggl
-----Original Message----- From: Petr Dokoupil [mailto:[log in to unmask]] Sent: Donnerstag, 01. März 2001 15:45 To: [log in to unmask] Subject: String dimensions calculating
VC++ 6.0 SP4, WNT 4.0 SP6a
I need to resize window (for example static window) in my dialog according the used font and string. Is there any way how to calculate string width and height. I tried to use: HDC hDC = ::GetDC(hWnd); SIZE size; ::GetTextExtentPoint32(hDC, szCA, nLen, &size); ::MoveWindow(hWnd, 10, 10, size.cx, size.cy, false);
Thank you all, I did have to select the font in the DC before the calculating. But I created the DC from the static vindow with the font already set. So I did not see any reason to select the font into the such created DC. I thought it would be autonaticaly set. My mistake. Now it works fine, and the resulting code looks like this, in case you are interested.
Is it possible to have a popup menu option that is both checked and has a sub-menu? Calling CMenu::CheckMenuItem() seems to be having no effect in this situation. I've failed to find anything in MSDN that says that this is not possible, but I've also not found an app that does it. Can anyone confirm whether this is or isn't possible?
Andrew, this is true that a popup menu CANNOT be checked. No error will occur if you try, it just will not have any effect.
-----Original Message----- From: MFC -- Microsoft Foundation Classes [mailto:[log in to unmask]]On Behalf Of Andrew Johnson Sent: 28 February 2001 13:49 To: [log in to unmask] Subject: Checked menu option with sub-menu?
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 992CA9AA From: CRAIG HENDERSON <[log in to unmask]> Subj: RE: Printing a Bitmap Date: Fri, 2 Mar 2001 10:05:31 -0000
>I tried to print a bitmap by writing an MFC-EXE-Application with SDI, >Doc/View-Architecture, Print and Printpreview. The Preview shows correctly the >text and the bitmap from the View. The printed paper shows only the text, not >the bitmap. On the place, where the bitmap should be, is only a little dot in >the upper left corner.
I created a ActiveX-Control with MFC-ActiveX-Assistant derived from "SysTreeView32". I want to change the font in the TreeCtrl to "Trebuchet MS". Can anyone give me a little code example?
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: EB420C3E From: [log in to unmask] Subj: Re: four way splitters Date: Fri, 15 Oct 1999 08:37:16 +0530
>I am trying to create a 4 way splitter in the OnCreateClient method of my >Frame window. The code that I have is something like this [snip] Although the >splitters are created correctly, the left hand pane width is always zero and >when the window comes up the user has to manually resize it to make it >visible.
I am used install shield for making an installable program for my VC++ application. I have used some active-x controls and RDO (remote data objects ) in this application. When I run the setup.exe for my application on machines with the VC++ installation it works as expected but the same program does not work on machines w/o VC++ installation. I am taking care of registering these Active - X controls using regsvr32 and have taken care of tracing out the dependencies using the depends.exe. More specifically when I call the DoModal API
--- Paradkar Sameer <[log in to unmask]> wrote: > Dear All, > > Environment: VC++ 6.0/ Win NT 4.0 > > I am used install shield for > making an installable program > for my VC++ application. I have used some active-x > controls and RDO (remote > data objects ) in this application. When I run the > setup.exe for my > application on machines with the VC++ installation > it works as expected but > the same program does not work on machines w/o VC++ > installation. I am > taking care of registering these Active - X controls > using
I am using CRichEdit control member function LineScroll() passing the number of line and number of characters. It look like the control scroll vertically but not scroll horizontally. I'm using default edit styles with multilines and horizontal scroll and vertical scroll windows styles. Does anyone have any idea?
Chris Leung Highland Technologies, Inc. http://www.htech.com 301-306-2890 (direct) 301-306-8201 (fax) Email: [log in to unmask]
I have a Custom Control in my Dialog. I Attach a CWnd class to the Customize Control. Now my problem is I want the Control to handle the User Requests... (somthing like the Windows Common Controls).
Can you please suggest me how to workout with handling the User Messages in my Custom Control Class.
Add the standard control that this custom control is based on in your dialog template with the dialog template editor. If it's just a CWnd you can use the picture control (CStatic class), if so edit the properties to suit your needs. The properties sets what styles your control should be created with. For example, change Frame to Rectangle, color to white and extended style to client edge to make it look like an edit box. Also change the ID to something else than ID_STATIC.
In a SDI-Application I have a owner-drawn menu in order to change the font. When the application gets started it displays the default font because "OnMeasureItem()" and "OnDrawItem()" have not yet been called. Clicking a menu-item leads to the call of both methods and the Owner-Drawn Menu is displayed. Does anyone know how I can enforce the call of "OnMeasureItem()" and "OnDrawItem()", so that the menu is displayed right away at the start of the application?
Try to create your menu dynamically and don't load it from resources. Or load menu from resources and replace menu items. In the case OnMeasureItem() and OnDrawItem() must be called.
Andre
From: Schmidt-Ott, Susanne <[log in to unmask]> > Platform: NT 4.0 SP6, VC++ 6.0 SP4 > > In a SDI-Application I have a owner-drawn menu in order to change the font. > When the application gets started it displays the default font because > "OnMeasureItem()" and "OnDrawItem()" have not yet been called. Clicking a > menu-item leads to the call of both methods and the Owner-Drawn Menu is > displayed. Does anyone
I've built an ATL object which is intended to be able to be used in any sort of client. Its working great everywhere that I've tried (VB etc.) except for IIS. I know that it is due to the way that I have had to architecture my control, but can I tell at run time whether I am running in IIS or on a web page or in a "plain" type of client. If I can get this information I might be able to work around my problem.
You can call GetModuleFileName() to see the process you are running in. If this is dllhost.exe or equivalent then you will know it is IIS.
Mike -----Original Message----- From: David Hyde <[log in to unmask]> To: [log in to unmask] <[log in to unmask]> Date: 14 February 2001 02:50 Subject: [MFC] ATL object in IIS
>MSVC++ 6, IIS, winnt4 > >Hi, > >I've built an ATL object which is intended to be able to be used in any sort >of client. Its working great everywhere that I've tried (VB etc.) except >for IIS. I know that it is due to the way that I have had to architecture >my
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 05520021 From: SWADHA BHAT <[log in to unmask]> Subj: Re: Using the Help button in property sheets Date: Wed, 14 Feb 2001 08:55:54 -0800
>I got a dialog sheet with several dialog pages and I whish to use the >Help-button in the dialog sheet to get help about the current dialog page. The >problem is that the Help-button is disabled.
What I needed to do was to add an empty handle in the application class for ID_HELP. I then added a handle for the property sheet for the ID_HELp, which actually handles the Help button. This work great... for the property sheet where I want help.
However, after I added the CMyApp::OnHelp() handle, all property sheets now got the help button enabled. In the constructors for the property sheets where I don't want help, I have added:
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 3B7B76B3 From: BRIAN HART <[log in to unmask]> Subj: RE: Using the Help button in property sheets Date: Fri, 23 Feb 2001 00:43:24 -0600
>What I needed to do was to add an empty handle in the application class for >ID_HELP. I then added a handle for the property sheet for the ID_HELp, which >actually handles the Help button. This work great... for the property sheet >where I want help. However, after I added the CMyApp::OnHelp() handle, all >property sheets now got the help button enabled.
I have an MFC application that can be run either in interactive or batch mode. My question is in batch mode, what functions to call and where to call them to have the app exits gracefully?
if(m_doExit) // set to TRUE if batch input file { // Exit app, but never call ~CMyAppDoc() to clean up allocated memory PostQuitMessage(0); // or // PostMessage(NULL, WM_QUIT, NULL, NULL); } }
if (AfxGetMainWnd() != NULL) { AfxGetMainWnd()->SendMessage(WM_CLOSE); }
Sending the WM_CLOSE windows message to the main window of your MFC program is the proper way to shut down the program. Your application has a main window if, in InitInstance(), the code initializes the m_pMainWnd member to point to a window. If no such code is there, then the only way to exit is to call
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 9832AD5F From: PJ Naughter <[log in to unmask]> Subj: Re: Closing an MFC application Date: Wed, 14 Feb 2001 10:08:40 +0000
>I have an MFC application that can be run either in interactive or batch mode. >My question is in batch mode, what functions to call and where to call them to >have the app exits gracefully?
I have created a User-Interface Thread and called a CWinThread object which inturn calls a CFrameWnd's Create function to create a Frame. But my problem is I want a complete set of Document/View/Mainframe to be called when I run the thread. I have seen MSDN and found that I can do so using the CSingleDocTemplate.......AddDocTemplate. I could able to create the DocTemplate....but when I am trying to call the AddDocTemplate it is giving me error that AddDocTemplate is a member function of CWinApp..
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: FE650C41 From: RANI MUKHARJEE <[log in to unmask]> Subj: Re: CWinThread and Document Templates.... Date: Sun, 11 Feb 2001 12:31:22 +0530
>I have created a User-Interface Thread and called a CWinThread object which >inturn calls a CFrameWnd's Create function to create a Frame. But my problem >is I want a complete set of Document/View/Mainframe to be called when I run >the thread.
I have a ListView in my aplication, which displays a list of items in Report format. While printing, I want to print each item in the List view on a separete sheet of paper.
For this I tried the following, in the function OnPrint()
for(int i=0; i < numListItems; i++) { PrintItem(i, pDC, pInfo); /* where PrintItem() is my function which prints the i-th item of the list. thereafter I try to increment the current page in CPrnitInfo object */
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 3A53FC20 From: Terence Lein <[log in to unmask]> Subj: Re: Changing Page in Printing Date: Fri, 09 Feb 2001 05:38:17 -0500
>I have a ListView in my aplication, which displays a list of items in Report >format. While printing, I want to print each item in the List view on a >separete sheet of paper. [snip] What I want is that after printing one item, >it should go to the next page. It prints all items in the same sheet.
There is a "better" way if you want to use it. Firstly make sure that your print function calls pDc->EndPage to print the current page then set the pInfo->m_bContinuePrinting member of the CPrintInfo to TRUE if you want to print additional pages regardless of the page setting used in OnPreparePrinting.
Richard
[log in to unmask] wrote:
> Moderator's Direct Message/Digest > William Dempsey [log in to unmask] > > Mesg: 3A53FC20 > From: Terence Lein <[log in to unmask]> > Subj: Re: Changing Page in Printing > Date: Fri, 09 Feb 2001 05:38:17 -0500 > > >I have a ListView in my aplication, which displays a list of items
I am facing a problem regarding update of a status bar. I have an exe which owns the main frame and a DLL which has a dialog resource. I have a timer which updates the statusbar periodically. The problem is that when the modal dialog box of the DLL is active, the statusbar update asserts. This is because curently the module state(resource) is that of the DLL (because dialog is active) and the timer tries to update status bar which is not a part of the DLL. I am using AFX_MANAGE_STATE(...) in the DLL.
I'd recommend not worrying about the status bar while the dialog is active. KillTimer before DoModal, then call OnTimer and restart your timer when the dialog returns.
Jeff Nygren
Aneesh P <[log in to unmask]>@LISTSERV.MSN.COM> on 02/05/2001 10:46:45 PM
Please respond to MFC -- Microsoft Foundation Classes <[log in to unmask]>
Sent by: MFC -- Microsoft Foundation Classes <[log in to unmask]>
To: [log in to unmask] cc: Fax to: Subject: statusbar update
I am creating a Modeless property sheet with several dialog. The documentation suggests that the property sheet should be large enough to fit the largest CPropertyPage but in fact the Width is twice the size of the largest page. I can set the size of the property sheet manually with a call to SetWindowPlacement(&wp) or MoveWindow(winRect). This still has two problems. First the right side of the property sheet is Cut as are the Tabs even though I called EnableStackedTabs( FALSE ) in the Create function. Second and more problematic, the new size is only correct for
I'm using a CTreeCtrl with the option: "Check boxes" selected. (from the controls properties). How do I know if the check box of an HTREEITEM is marked? How can I mark it myself? How can I control the color of the check? (I want it gray and not black if not all the sub items were checked too).
hi, You have the member fn. GetItemState and SetItemState to set or get the state of the item.
but, i dont know how to change the color of the check.
>From: Penina Weiss <[log in to unmask]> >Reply-To: MFC -- Microsoft Foundation Classes <[log in to unmask]> >To: [log in to unmask] >Subject: CTreeCtrl >Date: Mon, 5 Feb 2001 08:43:00 +0200 > >Environment: VC++ 6.2, Win NT SP4.0 > >Hi, > >I'm using a CTreeCtrl with the option: "Check boxes" selected. >(from the controls properties). >How do I know if the check box of an HTREEITEM is marked? >How can I mark it myself? >How can I control the
Hi All, In my application I have put a CListCtrl control on a dialog. When the dialog is resized the CListCtrl is resized as well. However, the header of the CListCtrl in the dialog doesn't resizes properly. It stays smaller when the CListCtrl is enlarged along with the dialog. As a result a portion of the CListCtrl doesn't have the header at all. Note: I don't see this problem on my development machine that has VC++6 installed on it. On the target test machine that has only NT4 with SP6 shows the problem. What wrong
Check the version of the common controls DLL (COMCTL32.DLL), which contains the actual list control code. There are many versions of this, with differing features and some with just plain old bugs. It is updated by installations of Internet Explorer, Visual C++, and lots of other software. In the past this was a restricted DLL, but I believe you can now redistribute it with your application. On either www.codeproject.com or www.codeguru.com there is some sample code to check the version of this DLL from within your application.
Summary: An Access 97 table is being created and populated using SQL DDL (data definition language) statements, then opened and read using a CRecordset object. The program behaves as if the CRecordset fetches the data before the DDL statements have executed. I need to know how to synchronize these.
Details: (1) I create an Access table using DDL: CTables tb; The CTables class is from a MS sample pgm, tableset.cpp; it calls the ODBC catalog function tb.m_strNameParam=tempTableName; tb.Open(); pDatabase=tb.m_pDatabase; // the data source used for the SQL connection in Tables strSQL="CREATE TABLE "+tempTableName+" ("+columnNames+")"; pDatabase->ExecuteSQL(strSQL);
I am developing a small SDI VC++ application which I started using VisualStudio MFC AppWizard, including Split view feature and Print/Preview features. Initially I specifid the Derived class for my App's View class as CScrollView. Since I wanted a split view, I did the following in CMainFrame::OnCreateClient(...)
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 880C01A9 From: Brian MacKay Subj: RE: Printing in Split View - Please Help Date: Fri, 2 Feb 2001 09:45:43 -0800
>I am developing a small SDI VC++ application which I started using >VisualStudio MFC AppWizard, including Split view feature and Print/Preview >features. [snip] Now the Framework by default maps File/Print and >File/PrintPreview menu items to only CFirstView and NOT to CSecondView. So >when the focus in on CSecondView, these Menu Items are grayed.
Hi I think the art is again available on MSJ now, "Meandering Through the Maze of MFC Message and Command Routing," Regards Sanjay
[log in to unmask] wrote:
> Moderator's Direct Message/Digest > William Dempsey [log in to unmask] > > Mesg: 880C01A9 > From: Brian MacKay > Subj: RE: Printing in Split View - Please Help > Date: Fri, 2 Feb 2001 09:45:43 -0800 > > >I am developing a small SDI VC++ application which I started using > >VisualStudio MFC AppWizard, including Split view feature and Print/Preview > >features. [snip] Now the Framework by default maps File/Print and > >File/PrintPreview menu items to only
-----Original Message----- From: MFC -- Microsoft Foundation Classes [mailto:[log in to unmask]]On Behalf Of Sanjay Sent: Tuesday, February 06, 2001 11:22 AM To: [log in to unmask] Subject: Re: Printing in Split View - Please Help
Hi I think the art is again available on MSJ now, "Meandering Through the Maze of MFC Message and Command Routing," Regards Sanjay
[log in to unmask] wrote:
> Moderator's Direct Message/Digest > William Dempsey [log in to unmask] > > Mesg: 880C01A9 > From: Brian MacKay > Subj: RE: Printing in Split View - Please Help > Date: Fri, 2 Feb 2001 09:45:43 -0800 > > >I am developing a small SDI VC++ application which
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: F977FAAE From: PROGRAMMER <[log in to unmask]> Subj: RE: ListView Date: Sat, 3 Feb 2001 13:28:55 +0330
>I want to use CListView class insttead of the normal view class which is >derived from the CWnd supplied by the Appwizard. [snip] Problem is I am >getting the column headers but not the data in the list!
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 6243D35C From: B.S.BETAGERI. <[log in to unmask]> Subj: Re: ListView Date: Sun, 04 Feb 2001 10:58:45 +0530
>I want to use CListView class insttead of the normal view class which is >derived from the CWnd supplied by the Appwizard. [snip] Problem is I am >getting the column headers but not the data in the list!
I have tried very hard to find out how to write to the *.ini file instead of the registry for the application profile setting WINAPI GetProfileString() and WriteProfileString().
I have two applications, and they use the same exact GetProfileString() and WriteProfileString(), but one writes to the *.ini, and the other one writes to registry. What is the control to switch them ? I created one, and the other one (write to the *.ini) is from the MSDN sample.
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: B7369248 From: XANH <[log in to unmask]> Subj: Re: Profile .ini or registry profile control Date: Thu, 1 Feb 2001 15:40:08 -0600
>I have tried very hard to find out how to write to the *.ini file instead of >the registry for the application profile setting WINAPI GetProfileString() and >WriteProfileString().
If I remember correctly, there is a key in the registry that tells GetProfileString() and WriteProfileString() to either write to the registry or a file. Anyway, why don't you use WritePrivateProfileString(), and GetPrivateProfileString()? These functions will write to a file whose name is passed in as
I have a problem with CDialog, specifically CFileDialog. I have the flag OFN_ALLOWMULTISELECT added to the dialog creation. when the user selects more than 11 files, the dialog returns IDCANCEL (2) regardless of whether the user clicks OK or Cancel. I read in the MSDN that for multiple sellection, I should have my own filename buffer, by setting the value of m_ofn.lpstrFile, also I should set the number of characters in the m_ofn.lpstrFile string in m_ofn.nMaxFile.
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: B118EBB1 From: Phil Daley <[log in to unmask]> Subj: Re: CDialog problem Date: Thu, 01 Feb 2001 16:27:44 -0500
>I tried to do so by adding the following 2 lines of code after constructing >the file dialog and before calling DoModal on it: > dlgFile.m_ofn.lpstrFile = &osFileBuffer; > dlgFile.m_ofn.nMaxFile = 1000;
What does osFileBuffer look like? char osFileBuffer[1000]; or char* osFilebuffer; osFileBuffer = malloc(1000); ????
I am using ImageLists as a way of implementing Drag 'n' Drop in some controls I am extending. However if I drag an item (say called "Foo") and then drag an item called "Bar" - I can see "Foo" as a ghost like image in the background of the "Bar" item.
I want to start "Windows Imaging" from a SDI-Application. I there an easy way to create the object (Prog-ID: WangImage.Application) in order to be able to use its methods? Thanks Susanne
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 4C481094 From: LAW, NEIL A <[log in to unmask]> Subj: RE: Launching Application Date: Tue, 30 Jan 2001 07:51:49 -0500
>I want to start "Windows Imaging" from a SDI-Application.
The wang image control is an OCX so you create it they way you would any control. Insert into your project (Project | Add To Project | Components and Controls) and create an object. You can create the object by explicit declaration (e.g., CWangCtrl imgControl) or by embedding it into a resource and declaring a member variable.
Do you want to launch the imaging application in a separate process or do u want to load in-process? 1. Separate process Use "CreateProcess" API. You cannot use any of the imaging methods here. 2. In-process Load the imaging DLL or the activeX control or Ocx, thru OLE.
I have a modal dialog box which contains a CRichEditCtrl control. I use the RichEdit control to display text files (read only) which are selected from a ComboBox. The textfiles could be fairly large (a couple of megabytes) so I don't want to load the entire textfile at once while displaying a Wait cursor since it can take up to 10 seconds+ to load the file, at which the user can't select another file or another (cancel) button for the dialog.
I am developing a small SDI VC++ application which I started using VisualStudio MFC AppWizard, including Split view feature and Print/Preview features. Initially I specifid the Derived class for my App's View class as CScrollView. Since I wanted a split view, I did the following in CMainFrame::OnCreateClient(...)
I have developed an ActiveX conrol which acts as an OLE drop target. One of our customers has a container where the control is wrapped in one of their own wrapper controls which is also an OLE drop target. Their intention is that when data is dropped with their proprietary clipboard format their wrapper can take some appropriate action.
I have developed an MFC application using shared MFC DLLs. In order to avoid DLL version problems when distributing it to my friends I have switched to static MFC libs. During linking I now the following (modified) output:
How did you switch from the MFC DLL to static linking? I do this with the Project Setting dialog, General tab, first combo box. Never seen any messages about duplicate definitions or had to use the /FORCE parameter. I suspect that either this change was done incorrectly, or you are also using some MFC extension DLL that requires the MFC DLL.
I modified the constructors and the OnInitDialog, so that CFirstDialog constructor call the CMyDialog's contructor with it's ID, which again call the CDialog constructor. CFirstDialog::OnInitDialog calls CMyDialog::OnInitDialog (which again call CDialog::OnInitDialog). Also the DoDataExchange and BEGIN_MESSAGE_MAP has been modified.
I have a number of routines linked to my aplications OnIdle function. However, I don't get any calls when I am in a modal dialog. What is the easiest way to keep getting these OnIdle calls when a modal dialog has the focus but is idle?
Do I override DoModal() and dispatch my own OnIdle from the dialog message loop?
Override OnEnterIdle(UINT nWhy, CWnd* pWho) in main window of your application.
> I have a number of routines linked to my aplications OnIdle function. > However, I don't get any calls when I am in a modal dialog. What is > the easiest way to keep getting these OnIdle calls when a modal > dialog has the focus but is idle? > > Do I override DoModal() and dispatch my own OnIdle from the dialog > message loop?
To ensure that things like the caps lock and num lock states are kept up to date in the status bar of your main app while a modal dialog has the focus, call SendMessageToDescendants(WM_IDLEUPDATECMDUI, (WPARAM)TRUE, 0, TRUE, TRUE) from within OnEnterIdle() of your main window.
-----Original Message----- From: Andrei Romanov [mailto:[log in to unmask]] Sent: Tuesday, 23 January 2001 10:16 PM To: [log in to unmask] Subject: Re: Continuing OnIdle calls when in modal dialogs
Well, you can not convert any IUnknown interface to IDispatch. You can do it only if your object supports IDispatch. So, the best thing will be to call QueryInterface on your IUnknown interface with the CLSID of IDisaptch as parameter. If you recieve a positive response that's your "Iunknown as IDispatch".
Tommy
-----Original Message----- From: MFC -- Microsoft Foundation Classes [mailto:[log in to unmask]]On Behalf Of Ron Sent: Friday, January 19, 2001 6:43 PM To: [log in to unmask] Subject: IUnknown to IDispatch
> -----Original Message----- > From: Ron [mailto:[log in to unmask]] > Sent: 19 January 2001 16:43 > Subject: IUnknown to IDispatch > > How can I convert an *IUnknown to the corresponding *IDispatch? > QueryInterface (I wonder how many replies saying the same thing this post will generate?)
Does Microsoft have any flavors of MFC Visual C++ on none MS platforms such as Unix and Mac. How much work (open ended question) is involved in a port if MFC is or is not available?
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: B21BC823 From: MIKE MAY <[log in to unmask]> Subj: Re: [MFC] MFC platforms Date: Sat, 20 Jan 2001 06:37:11 -0000
>Does Microsoft have any flavors of MFC Visual C++ on none MS platforms such >as Unix and Mac.
There are two third party products, Mainsoft's MainWin and Bristol Technology's Wnd/U, that allow you to port MFC programs to Unix. (Mainsoft are responsible for porting IE to Solaris, using the Mainsoft toolkit). There was at least one other product out at the time but it may not have made it past beta.
>Does Microsoft have any flavors of MFC Visual C++ on none MS platforms such >as Unix and Mac.
Sorry to but in at the end of the conversation.
There was a Microsoft version of MFC for the Mac. AFAIK, it's been dropped, I believe that it was a healthy subset of MFC not the full class. For instance I'm sure that it didn't support some of the MFC database functionality.
I noticed on my friend's Mac that the very latest MS Office for Mac has all the regular MFC runtime DLLs installed, including mfc42.dll, msvcrt.dll, etc. Even if they don't provide the VC++ (devstudio) IDE on Mac, there must be a way to port MFC apps from PC to Mac using runtime libraries, or else MS is doing some voodoo they won't share with the rest of us.
I have an application where I need to grab every keystroke (both down and up) in a dialog and in a CScrollView derived class in a CMDIChildFrame. When I just overrode OnKeyDown/OnKeyUp/OnSysKeyDown/OnSysKeyUp in the dialog, I captured almost everything except the Windows key (which, by the way, doesn't seem to generate a WM_KEYUP message). By overriding PreTranslateMessage for the dialog and not calling the base class, I even grabbed this key exclusively for my app.
I don't think there is any reasonable way to completely capture the keyboard just using PreTranslateMessage. The keyboard input model in the platform SDK shows keystrokes passing through the keyboard device driver and system message queue before reaching the application message queue. My guess is that the system sends its own messages whenever a windows keydown message is sent to its queue. You might be able to completely capture the keyboard if you used DirectInput, which bypasses the system message queue.
> I have an application where I need to grab every > keystroke (both down and up) in a dialog and in a > CScrollView derived class in a CMDIChildFrame.
In this instance, I'd say a thread specific keyboard filter would be ok (look for SetWindowsHookEx & KeyboardProc). I generally shy away from these hooks because they tend to slow things down. I can't see where even 300WPM would tax a Pentium though :) -SHAWN- "Geek use to be a four letter word. Now it's a six figure one."
If you want to use an easy-to-use 'hook' for all messages throughout your application, check out CWinApp::ProcessMessageFilter. If you do something like the following, you can intercept every message in your app:
BOOL CYourApp::ProcessMessageFilter(int code, LPMSG lpMsg) { if (lpMsg->message == WM_KEYDOWN || lpMsg->message == WM_KEYUP) ... // etc. }
I've used this technique with great success to intercept messages before they are routed anywhere else in your applicaiton. It may or may not be reliable for what you want to do, but it's more efficient than a system or journal hook because it's confined to your application, i.e., it's
Well, after almost four years doing MFC apps, this had to come: I need to make a simple app which should use MFC but don't need nothing like docs and views...
I've started with the MFC Wizard, selected a SDI app and then tryed to modify CMyApp::InitInstance() to remove the doc and view classes and create the CMainFrame, but I don't know how to create the CMainFrame. The docs only say that is possible, but don't give examples nor they explain how to do it...
Have you considered making a dialog-based app? You can add a menu to a dialog, and still use a lot of the other MFC functionality.
David Elliott - [log in to unmask] "I have one right here...!" Visit me at http://www.dcell.com ----- Original Message ----- From: "Mario Pereira" <[log in to unmask]> To: <[log in to unmask]> Sent: Thursday, January 18, 2001 3:03 AM Subject: Dropping out document and view
MFC does support very simple applications, but as you've discovered, it is not clear how. Even the VC6 AppWizard still adds a lot of unnecessary pieces. I learned how to do this from a book called "Programming Windows 95 with MFC" (I think), however I can't remember the author.
The smallest MFC application with a simple window is shown below. Note that there are *many* missing pieces -- but this will display a window with menu, icon, title etc. You can also use a CWnd instead of a CFrameWnd, which is probably more appropriate for your bitmap only needs.
At 07:25 AM 1/22/01 -0600, you wrote: >MFC does support very simple applications, but as you've discovered, it is >not clear how...I learned how to do this from a book called "Programming Windows 95 >with MFC" (I think), however I can't remember the author.
Jeff Prosise (Microsoft Press). A new (1999) edition is called "Programming Windows with MFC" (2nd ed); it's about 300 pages longer.
> come: I need to make a simple app which should use MFC but > don't need nothing like docs and views...
My advice would be to skip MFC altogether in that case. It's VERY doc/view oriented. If you want to use stuff like CString & CRect & all, just include afxwin.h in your .cpp.
I am trying to send formatted text data (with carriage returns, form feeds, ...) to printer driver. The problem I am having here is that the font height is not changing. The document is always printing with standard 12 points.
I have to use Escape() function. Has anyone had any ideas about this problem. Any help would be greatly appreciated.
At 12:40 PM 1/17/01 -0800, you wrote: >I am trying to send formatted text data (with carriage returns, form feeds, >...) to printer driver. >The problem I am having here is that the font height is not changing. The >document is always printing with standard 12 points. > >I have to use Escape() function.
I suggest you not write your printer code using the pass-through (Escape function). Instead, use CreateFont to make the size and typeface you want, then use TextOut calls to print the text. It's much easier, and your code will work with any printer.
Does anyone know how to change the Font of a menu. I have an SDI application with a menu resource and I want to change the Font for the complete menu. A code example would be very helpful.
I'm trying to write a app that talks to a database via Embedded SQL statements. The app is designed to run continuously, looping through a small amount of code. The Problem is that while generating the SQL statements, memory is leaked by Constant Assigned Strings. eg. CString fred = "fred";
> -----Original Message----- > From: Simon Holman [mailto:[log in to unmask]] > Sent: 17 January 2001 05:56 > Subject: Constant Assigned Strings > > > Environment: VC++ 6.0, Windows NT 4.0 > > I'm trying to write a app that talks to a database > via Embedded SQL statements. The app is designed to run > continuously, looping through a small amount of code. > The Problem is that while generating the SQL statements, > memory is leaked by Constant Assigned Strings. > eg. CString fred = "fred"; > > The following code written to check memory usage: > > void CTestSQLStringDlg::OnButton1() {
At 10:27 AM 1/18/01 +0000, you wrote: >> The Problem is that while generating the SQL statements, >> memory is leaked by Constant Assigned Strings. >> eg. CString fred = "fred"; ... >> The Results (irrelevant data removed) were, after two loops: >> mdiff - Total allocations: 18 bytes. >> m1 - Total allocations: 7240 bytes. >> mdiff - Total allocations: 18 bytes. >> m1 - Total allocations: 7258 bytes. >> >> As can be seen, each time through the loop, the Total Memory >> Allocations >> increases by 18 bytes.
Your analysis is flawed. In this function, string is an automatic variable on the stack. As soon as the function exits, it goes out of scope and storage space is deallocated by the dtor. There's no leak at all.
I'm using the class CInternetSession to make a request to a HTTPS site (in the Intranet). But when I use the method OpenURL an error occurs (The certificate authority is invalid or incorrect). I tried to use another functions but the same error occurs. I tried to use the flag INTERNET_FLAG_IGNORE_CERT_CN_INVALID but the error still happens. I'm providing the code below. I hope some help.
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: F51CBD2E From: ENRICO QUERCI <[log in to unmask]> Subj: Re: HTTPS Connection Date: Wed, 17 Jan 2001 10:14:27 -0000
>I'm using the class CInternetSession to make a request to a HTTPS site (in the >Intranet). But when I use the method OpenURL an error occurs (The certificate >authority is invalid or incorrect).
If you define fResp as CStdioFile*, the OpenURL method expects an URL type like "file://something.somethingelse". In order to use an URL like "http://somewhere.somewhereelse", try defining fResp as CHttpFile* !
I don't quite understand the first answer. My C++ may be a little rusty, but I'm pretty sure there's nothing wrong with declaring fResp as a CStdioFile *, as long as you aren't accessing the HTTP-specific members of the class.
David Elliott - [log in to unmask] "I'm equally as famous!" Visit me at http://www.dcell.com ----- Original Message ----- From: <[log in to unmask]> To: <[log in to unmask]> Sent: Wednesday, January 17, 2001 2:14 PM Subject: Re: HTTPS Connection
I have derived a class from CTreeCtrl and want to handle OnBeginDrag() in my class. In the parent (property page) I have included ON_NOTIFY_REFLECT(TVN_BEGINDRAG, OnBeginDrag) and corresponding header and cpp file modifications. I have also made sure that my tree control *DOES NOT* have TVS_DISABLEDRAGDROP and checked with SPY++. I also added COleDropTarget::Register(this) in CMyTreeCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) and it returns TRUE.
Have you called AfxOleInit() in your InitInstance??
----- Original Message ----- From: "Farhan Noor Qureshi" <[log in to unmask]> To: <[log in to unmask]> Sent: Tuesday, January 16, 2001 1:18 AM Subject: OnBeginDrag() of my tree control is not being called
> Hi, > > Env: VC++ 6 SP4, Windows NT 4 SP5, IE 5.5 > > I have derived a class from CTreeCtrl and want to handle OnBeginDrag() in my > class. In the parent (property page) I have included > ON_NOTIFY_REFLECT(TVN_BEGINDRAG, OnBeginDrag) and corresponding header and > cpp file modifications. I have also made sure that my tree control *DOES > NOT* have TVS_DISABLEDRAGDROP
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 0A5AB2FD From: VYTLA, VENUGOPALA KRISHNA <[log in to unmask]> Subj: RE: OnBeginDrag() of my tree control is not being called Date: Wed, 17 Jan 2001 14:20:49 -0800
>I have derived a class from CTreeCtrl and want to handle OnBeginDrag() in my >class. In the parent (property page) I have included >ON_NOTIFY_REFLECT(TVN_BEGINDRAG, OnBeginDrag) and corresponding header and cpp >file modifications. I have also made sure that my tree control *DOES NOT* have >TVS_DISABLEDRAGDROP and checked with SPY++. I also added >COleDropTarget::Register(this) in CMyTreeCtrl::OnCreate(LPCREATESTRUCT >lpCreateStruct) and it returns TRUE. I need to handle the begin-drag inside >the tree.
----- Original Message ----- From: <[log in to unmask]> To: <[log in to unmask]> Sent: Saturday, January 20, 2001 12:52 AM Subject: Re: OnBeginDrag() of my tree control is not being called
> Moderator's Direct Message/Digest > William Dempsey [log in to unmask] > > Mesg: 0A5AB2FD > From: VYTLA, VENUGOPALA KRISHNA <[log in to unmask]> > Subj: RE: OnBeginDrag() of my tree control is not being called > Date: Wed, 17 Jan 2001 14:20:49 -0800 > > >I have derived a class from CTreeCtrl and want to handle OnBeginDrag() in my > >class. In the parent (property
> i dont exactly know how to > compare the window handle > passed in the second parameter > of OnCtlColor() with ONLY the > single control that i want to change.
Any class derived from CWnd has a member, m_hWnd, that is the window handle of the associated Windows window. This is how you can tell what's what:
>>In my application with two dialogs, the second one disappears immediately with >>no user interaction. Why?
The correct answer is that when a dialog is the main window, and it is destroyed, Windows sends a WM_QUIT message to shut down the application. The Wizard generates code makes the first dialog the main window with the statement "m_pMainWnd = &dlg;". Although MS says this behavior is "by design", it seems pretty stupid to me, since you might want to do something after the dialog window is closed (such as process the data!).
I have an FTP application that uses CFtpConnection. When transferring a very large file, the system is unresponsive to the mouse and keyboard, apparently because messages are not being pumped. I tried using CInternetSession::OnStatusCallback, but it doesn't seem to make any calls *during* the file transfer, only before & after. Does anyone know how to make the system respond during a length file transfer with CFtpConnection?
>Environment: VC++ 6.0, Windows 2000 > >I have an FTP application that uses CFtpConnection. When transferring a very >large file, the system is unresponsive to the mouse and keyboard, apparently >because messages are not being pumped. I tried using >CInternetSession::OnStatusCallback, but it doesn't seem to make any calls >*during* the file transfer, only before & after. >Does anyone know how to make the system respond during a length file >transfer with CFtpConnection? >
You can create Hidden Window m_pMainWnd = &(CMyHiddenWindow);
Then Create A thread that will create the first dialog and when u exist the first dialog,let the ExitInstance to send a message to the CWinApp to Create A second Thread that will create the second dialog
And when u want to exit the Application Send WM_CLOSE to CWinApp
I'm using an Access type ODBC database in an MFC application. When the application is installed , the user can select any location for the database file. InstallShield registers the database on the system.
I need to extract the path to the ODBC based database file (Access type) thats installed the system at installation.. I have checked documentation but am unable to find a method. There must be a way to do this since its a system regsistered database. Any help would be greatly appreciated.
I am trying to combine two projects together. What is the best way to combine the resources, since they are most likely using some of the same Resource ID #s?
Most Sincerely, matt
ps: VisualC++6.0,Windows200Pro,all the latest SPacks and SDKs..
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 5443130D From: Phil Daley <[log in to unmask]> Subj: Re: Combining 2 Projects (Resources) Date: Wed, 03 Jan 2001 08:17:16 -0500
>I am trying to combine two projects together. What is the best way to combine >the resources, since they are most likely using some of the same Resource IDs?
Renumber one of the files, either by hand, if it is small, or load it into excel and renumber it with a formula, if it is large. We assign a range of resource ids for each of our projects so that they never conflict.
I think, it can also be done by other than resource id modification. I have two projects in my workspace, one as a static library and other as exe and exe is linked with static library and I am able to use static library resources.
Let us say exe is ProjectA then its resource files are resource.h and resource.hm and projectA.rc, and res directory Let us say library is ProjectB then its resource files are resource.h and resource.hm and projectb.rc and res directory, you can rename your projectB resource header and help ids as projectBres.h( a unique name) and projectBres.hm(
I am using CAsyncSocket class to make Sever/Client TCP/IP link.
As I want to check if the socket connection for the client can be done, I put the Connect function in a "while" loop. I don't want this capture my main thread so I put connect method in another thread. The problem is: when I want to close my Socket object in the main thread, I get to an ASSERT error in "sockcore.cpp" MFC source file. (There is no problem in compile and link). As I traced the error it cannot
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: BE1A2506 From: =?ISO-8859-1?Q?RUBEN_J=F6NSSON?= <[log in to unmask]> Subj: Re: Closing a CAsyncSocket object in another thread Date: Wed, 3 Jan 2001 08:01:11 +0100
>I am using CAsyncSocket class to make Sever/Client TCP/IP link. As I want to >check if the socket connection for the client can be done, I put the Connect >function in a "while" loop. I don't want this capture my main thread so I put >connect method in another thread. The problem is: when I want to close my >Socket object in the main thread, I get to an ASSERT error in "sockcore.cpp"
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: B967AC21 From: Sreejith Sreedhar <[log in to unmask]> Subj: Re: Closing a CAsyncSocket object in another thread Date: Thu, 4 Jan 2001 08:39:26 +0530 (IST)
>I am using CAsyncSocket class to make Sever/Client TCP/IP link. As I want to >check if the socket connection for the client can be done, I put the Connect >function in a "while" loop. I don't want this capture my main thread so I >put connect method in another thread. The problem is: when I want to close my >Socket object in the main thread, I get to an ASSERT error
I have not tried this, but in theory you should be able to call CTreeCtrl::SetImageList(NULL, TVSIL_NORMAL);
Good Luck Craig [log in to unmask]
-----Original Message----- From: MFC -- Microsoft Foundation Classes [mailto:[log in to unmask]]On Behalf Of Rajesh Thattakath Sent: 31 December 2000 03:50 To: [log in to unmask] Subject: Removing images from a tree dynamically
Hi Friends,
Platform: NT 4.0 SP4, VC++ 6.0 SP3
I have a CTreeCtrl derived class in one of my dialog box. The tree has images (Using image list)and text.
I have code in a function called by OnPaint that looks like function m(...args...) { ... CDC maskDC; maskDC.CreateCompatibleDC(pDCSrc); maskDC.SetMapMode(pDCSrc->GetMapMode()); CBitmap mask; mask.CreateBitmap(widthSrc,heightSrc,1,1,NULL); // 1 plane, 1 bit/pixel CBitmap *pOldBitmapMask=maskDC.SelectObject(&mask);
[operations with the bitmap 'mask']
maskDC.DeleteDC(); <------- why is this necessary? return; }
What I have found is that if the maskDC.DeleteDC() is omitted, GDI resources are used up after about 700 calls to function m. If it is included, there is no GDI resource leak. Yet Proise says "If the CDC object to which you attach the DC is created on the stack, deletion is
Hi Peter, I am confused by your observations, but offer my comments in the hope that they will be of use. Try replacing the (apparently unnecessary) line maskDC.DeleteDC(); with maskDC.SelectObject(pOldBitmapMask);
I think I am right in saying that if you do not deselect the image out of the DC then the CBitmap destructor will fail to delete to bitmap and that could be the source of your resoure leak. However, that does not explain why the maskDC.DeleteDC(); removes the resource leak. Like you say, the destructor of the DC, as with all GDI wrapper classes, should destroy the GDI object,
Is there any way to access the Print Preview Buttons Programatically? I want to enable-disable certain buttons and maybe hide others from within my program.
Note, that this code will work properly only during PrintPreview mode! Before and after PrintPreview mode GetDlgItem(AFX_IDW_PREVIEW_BAR) will fail (return NULL).
Env winnt 4.0 VC 6.0 Hi all, I want to create a modeless dialog which always remeains on the top.i.e if word application and my application are running and my application is minimized then dialog should be shown over word application. Is this possible? Thanks in advance Sreejith
Hi Sreejith, We cannot do this with Win98 and higher as MS took this feature out. The following lines of code will do the trick but MS says it does not comply with their UI guidelines. Hence, they will not support it.
#include <winuser.h> if (SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT,0,&dwTimeOut,SPIF_SENDWININICHANGE))
You will have to add these lines depending on the version you are using. #define SPI_GETFOREGROUNDLOCKTIMEOUT 0x2000 #define SPI_SETFOREGROUNDLOCKTIMEOUT 0x2001
Hallo, I've been writing an app, one of the tasks of which is to read images from files or from a grabber and to show them on the screen.
The drawing function of my image class uses the ::StretchDIBits (...) function; with relatively big images (say >= 256 * 256 pix) the screen picture can be seen being redrawn (e.g. while resizing the window), even in release mode .
Hi Stanislav, The difference has to do with the way StretcBlt is invoked. If it is invoked in the paint message then Windows deletes the background with WM_ERASE_BACKGROUND msg and then calls paint msg. In order to prevent that you can put your drawing code into WM_ERASE_BACKGROUND handler. One other thing to watch is the compatability to the device context you are using i.e. the bit depth of your bitmap shoould be identical to those of the DC in use. If you use 256 color mode there is a special technique as to how you can speed (5times) your blitting
To avoid flicker, see Keith Rule's excellent article on Code Project at http://www.codeproject.com/gdi/flickerfree.asp. Check the DC compatibility as well, if StrechDIBits has to resize and colour map, then this will slow the process down. Finally BitBlt works faster when the window is Byte Aligned. It don't know if this is the same for StretchDIBits, but it would be worth a try. Override CWnd::PreCreateWindow() and set the class name to one with CS_BYTEALIGNCLIENT, eg
Platform: NT 4.0 SP4, VC++ 6.0 SP3 I inherited a project that is a tabbed dialog. On two of the dialogs there are Rich Edit controls that load text files that my users are allowed to edit. When I look at the properties of each of these controls they look identical. When my users load a file into one of the controls and then immediately scroll down with the vertical scroll bar they can start to edit the file. In the the other control if they load a file and then scroll down and try to mouse click inside the
> -----Original Message----- > From: Mike Hammar [mailto:[log in to unmask]] > Sent: 20 December 2000 16:22 > Subject: Annoying behaviour of a RichEdit control > > I inherited a project that is a tabbed dialog. On two of the > dialogs there are Rich Edit controls that load text files > that my users are allowed to edit. When my users load a file > into one of the controls and then immediately scroll down > with the vertical scroll bar they can start to edit the file. > In the the other control if they load a file and then scroll
Venturing into automation land for the first time here ... I created a little almost default MFC app and added the bits (appwizard) so the Document class was "automation enabled" (DISPATCH_MAP, INTERFACE_MAP etc).
Then, as a test I tried a couple of javascript programs:
1) CreateObject: var o = WScript.CreateObject("Oea1.Document"); ...
Hi Pnina, I've managed to add ~100 bitmaps to my project. I haven't heard of any limit imposed by VC environment. But if you stumble into a limit (which I presume is pretty big) you can always load bmps from disk. Regards, Stas ----- Original Message ----- From: "Penina Weiss" <[log in to unmask]> To: <[log in to unmask]> Sent: Saturday, December 16, 2000 11:02 PM Subject: Bitmaps
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: 6A796AC5 From: MRITUNJAY KUMAR RAI <[log in to unmask]> Subj: Re: Bitmaps Date: Wed, 20 Dec 2000 09:29:45 +0530
>Does anyone know if there is a limitation to the number of Bitmaps I can add >to the resource of a Dialog based MFC application?
long back(NT4,VC5.0) we were stuck after adding arround 128/258 control on a dialog. So we used splitter window. So in my view the limits on the number of control(be a bitmap,..) on a dialog resource is max 256.
I wonder if anyone can help with this problem (on Visual Studio 6, Windows 98), MFC SDI application.
In my CProjectView::OnDraw() function, I do the drawing by setting a large number of pixels individually, using the CDC::SetPixel() method - I don't do anything else while drawing (which means I never need to select any GDI object into the device context). This works fine when I set the pixels directly in the display device context. However, to improve performance I'd rather set the individual pixels in a memory DC and do a BitBlt into the display DC - and I can't
Moderator's Direct Message/Digest William Dempsey [log in to unmask]
Mesg: F0514882 From: Stuart F Van Weele <[log in to unmask]> Subj: RE: Can't set pixels in memory device context Date: Mon, 18 Dec 2000 10:29:30 -0500
>In my CProjectView::OnDraw() function, I do the drawing by setting a large >number of pixels individually, using the CDC::SetPixel() method - I don't do >anything else while drawing (which means I never need to select any GDI object >into the device context). This works fine when I set the pixels directly in >the display device context. However, to improve performance I'd rather set the >individual pixels in a memory DC
I suspect it is a resource leak problem. From your load snippet, you repeated load the Bitmap from the binary's resource but never seems to free the memory. Load the image once and store the handle in a global variable (even better, create a class a store the handle as a member variable). Use the DeleteObject() Win32 API to destroy the bitmap handle when you are thru.
That is exactly what the problem is. I wrote a poker game about a year ago and had this same problem using GDI bitmaps in an SDI application. So what I did was load the resouce in OnInitialUpdate() and then simply blt the bitmaps whenever i needed to in my drawing methods. This completely eliminated all the assertions. Another thing to note, the reason that I suspected a memory leak was the fact that if I ignored the assertion or simply ran the project in release mode, the bitmaps would start to disappear after about 50 plays. So your best