|
|
It is an ATL component that fire events. I have asked their vb and vc++ examples on how to use the component.
|
|
|
|
|
Hi,
I am working on a MFC app that basically draws its own controls etc on a view that is maximized.
I am having quite some trouble, it seems, with device contexts. I have drawing code in lots of functions all over the place, e.g. when a mouse click comes in, the OnLButtonUp calls a function in my code that does drawing, and sometimes things do not appear on the screen or appear delayed, weird effect.
I am sure I am making a big mistake drawing things directly in reaction to OnLButtonUp() but I have no clue how to do it better.
If someone could give me a set of just the basic pointers how to organize a program like that, I'd be very grateful. The main problem I am having is drawing my GUI elements (Text, Lines, Rectangles).
TIA
Lutz
|
|
|
|
|
Would you be able to use one of the flicker-free drawing classes (here at CP) instead? That will significantly speed up screen updates, since the screen DC only gets written to once; everything else happens in memory.
|
|
|
|
|
You are right, you shouldn't be drawing in response to any event other than a WM_PAINT message.
Generally speaking, you should draw only in the OnDraw() or OnPaint() methods. If it's a view, the OnDraw() method is provided for you. If it's a dialog, then you need to add a WM_PAINT handler and then draw in the OnPaint() method provided by the handler (and the DC that it provides).
Generally speaking, when you click something and want to update, then you invalidate your window (if possible, only the portions of the window you need to update).
The Scribble tutorial that comes with VC++ should be enough to illustrate this for you. Use the Totorials Luke!
|
|
|
|
|
I recvently split my program into two modules (to save computer memory for unneeded components), but this the code in this dll file for some reason can't load Bitmap resource, the command simply doesn't work.
HELP
Joel
|
|
|
|
|
Hi Joel,
We need details if you want to be helped...
Is the bitmap resource in the same DLL or in the EXE?
What function are you using to load the bitmap?
Paolo.
|
|
|
|
|
Hi,
I think maybe I can help you..
But, I needs more information about your problem..
Could you reply to this thead with detail description?
Regardz
-Ryan
|
|
|
|
|
You need to call AfxSetResourceHandle() and pass the HMODULE
of the dll that has the resources in it, before you attempt
to get any data from the resources in the DLL.
Remember to set the resource handle back to the original
afterwards - so that you can load resources from the original .exe file (the default).
Stephen
|
|
|
|
|
I need to use the BROWSE... button to get just the location path.
Should I user CFileDialog for this?
What parameters do I user to get just the location path?
Thank you.
|
|
|
|
|
I have been meaning to write an article on this. I have some sample code that uses the browse button, and a checkbox to switch between the Browse for folder, and browse for file dialogs.
If you like, I can email that to you later on tonight. (As it is at home, and I'm currently at work). Let me know.
Frank
|
|
|
|
|
You use the SHBrowseForFolder() API. If you need help using it, there are some folder-browsing articles here at CodeProject you can read.
|
|
|
|
|
Hi,
How do I make a FormView window not sizeable, just fixed?
Thanks,
Pedro.
|
|
|
|
|
I'm assuming that you mean that you don't want the MainFrame window sizable. If that's correct, you can check out this page:
http://support.microsoft.com/support/kb/articles/Q133/2/56.asp
Hope that helps,
Frank
|
|
|
|
|
Hi
I have client-server functionlaity set up
I can send normal text strings properly,
BUT
I CANNOT send a class thgough the socket! it is a pointer to a class, and when i say... sizeof(*myclass) it gives 82 which is smaller than an IP packet (i think).
It comes through as gibberish... How can I fix this?
Why does it work for strings, but not custom classes??
Thanks!
|
|
|
|
|
Noite that when I send it, it is of the form:
mp_sConnectSocket->Send(mp_pdu, sizeof(*mp_pdu))
where
mp_sConnectSocket is the connecting socket
mp_pdu a pointer to the class Im trying to send
sizeof(*mp_pdu) gives the size of the object being pointed to
|
|
|
|
|
I have an app where I have decided to use a wave file. I call the wave with...
sndPlaySound("WaveName.wav", SND_SYNC);
I have included the Windows Multimedia Component in
StaAfx.h...
#include MMSystem.h
#pragma comment(lib, "winmm.lib")
Problem: Release build!
The release Build only finds the wav file if it is in the same folder. What I would like to do is make the wave a part of the app just like any other resource, instead of a separate file. I have experimented with the .rc and .rc2 files to no avail. I know it can be done (for example the SpeakN sample app in VC++6.0). Perhaps I'm going about it the wrong way. Any help or suggestions would be appreciated.
|
|
|
|
|
Thats because you have not given the full path along with the filename.Try giving the full path along with the file name.I think that will work fine to play the wave file from any part of the system.
|
|
|
|
|
Hi,
Is there a way to open a child window/dialog FOR a window
from a DLL that's loaded into the parent? I tried to open
a window which was a child of the Visual C++ window, and it
was very strange. It didn't behave like a regular child window. I should mention that my DLL was loaded into VC
using Customize->Add in & Macros.
Thanks.
|
|
|
|
|
Is this a modeless dialog? Are you using MFC? Is the Dialog using MFC? Modeless (and modal, but that's less of an issue) dialogs must call IsDialogMessage in order to process things like tab keys and arrow keys.
What do you mean by "didn't behave like a regular child window"? That's as good as simply saying "It doesn't work".
|
|
|
|
|
I'm trying to create a modeless dialog. Modal dialogs are not a problem. The only way I was able to create a modeless dialog is by creating another thread from my add-in. Once I tried to create a child window. The window was created, but its caption bar was never painted when it was supposed to receive focus. Still, it could be moved around. When it was maximized you could still see its caption bar VC's client area (unlinke regular child windows). So, apparently I was doing something wrong. Any idea how to do it correctly?
Thanks.
|
|
|
|
|
Yes, I'm using MFC. I'm trying to do all this from an add-in project. I'm trying to create a modeless dialog. Modal dialogs are not a problem. The only way I was able to create a modeless dialog is by creating another thread from my add-in. Once I tried to create a child window. The window was created, but its caption bar was never painted when it was supposed to receive focus. Still, it could be moved around. When it was maximized you could still see its caption bar VC's client area (unlinke regular child windows). So, apparently I was doing something wrong. Any idea how to do it correctly?
Thanks.
|
|
|
|
|
I don't understand why you needed to create another thread to create a modeless dialog. That should not be necessary. In any event, it definately sounds like IsDialogMessage() is not being called for your dialog. I'm not familiar enough with add-ins to know how it's messages get processed.
|
|
|
|
|
For some reason, AfxDaoTerm is not being called when I close my database. The database is created using new equated to a member pointer (of type CDaoDatabase*) of my document. When I destruct the document I close the database and then delete it. I then delete some other objects and, then, the destructor terminates. At that point I get an assertion on line 42 of Daocore.cpp which, according to the comment, indicates that AfxDaoTerm is not being called. If I place an explicit call to AfxDaoTerm after deleting the database pointer, I do not get the assertion and my application exits without apparent problem. Any hints as to what might be going on?
Thanks.
|
|
|
|
|
There are a few articles in the MSDN KB that talk about how MFC calls AfxDaoTerm from the ExitInstance of CWinApp, and how this can create problems with DAO objects declared at global scope or in DLLs etc.
Seaching for afxdaoTerm will bring up about 4 or 5 articles that are almost-but-not-quite your scenario.
Calling AfxDaoTerm directly is indeed one of the solutions mentioned.
HTH
|
|
|
|