|
|
Thank you all for the great links you've supplied me with.
David
|
|
|
|
|
Hi,
I'm using PreTranslateMessage to intercept the RETURN key on a CEdit control in a modeless dialog. To prevent the RETURN key from triggering the default button I've made the CEdit control multiline and made it "Want Return".
On PreTranslateMessage I SetFocus() on the parent window. This also triggers the CEdit KillFocus() which processes the edited text.
However, this produces a Windows error beep. Perhaps this is because the edit control is out of focus before the keydown message reaches translation. How can I avoid this?
Many thanks,
Simon
|
|
|
|
|
it might sound like a clunk but the easiest way i ever found of doing what u are trying to do is to have another button on the dialog that is hidden and set that to the default button ... of course its handler does nothing
"there is no spoon" biz stuff about me
|
|
|
|
|
Is it possible to port C++ applications using MFC to machines that do not have C++ installed by transporting specific dll's.
|
|
|
|
|
TallAndyB wrote:
Is it possible to port C++ applications using MFC to machines that do not have C++ installed by transporting specific dll's.
Have a read of for VS.NET[^]
or
here for VC6[^]
Michael
CP Blog [^]
|
|
|
|
|
porting ? or compiling ? or executing ?
on same OS ? different OS ?
I would say no at first, but I'm mut sure what you want to do.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Did you really mean port? I think from your question you ment something completely different.
Port means take your application running on Windows (or any other computer platform), and make it run on something else like the Mac. (UNIX, VMS, mainframe, cell phone). If this is what you ment, not easially, you will need a C++ compiler that targets that computer (it doesn't have to run on that computer, just know how to compile for that computer), and a library that runs on that platform. Attempts have been made to port MFC to other systems, you can google for them, but most have had little success. I'm told that it is easy to port MFC to wxWidgets, but your milage will varry.
If you ment you want to run your MFC app on a different windows machine, then of course you can do this. Start reading up on installers, (like installshield) and make one work for you. You can create one from scratch, or use one to help you out. Many people have done this with MFC (not me though) so it should be easy to get help once you ask the right question.
|
|
|
|
|
OK, If I have read correctly to be able to take a single executable file from the development environment and us it on another Windows based machine I need to statically link with the MFC dlls. I appreciate that this will make it a more cumbersome .exe but it keeps my customer happy. As a final check I will not need any additional dlls to permit database access since I accomplich that using the MFC CRecordset classes.
Thanks for the pointers as to where to look and correcting my loose terminology.
AndyB
|
|
|
|
|
Hi,
i am using crystal reports 9.2.xxx that comes with visual studio 2003,
we are developing an application with a maximum of 20 concurrent users
i was wondering the following:
(1)what are the licensing and features limitations of this version of crystal reports?
(2)are we free to distribute to as many users as we like royalty free?
Thanks In Advance
|
|
|
|
|
How can i diable / enable any tabpage in a Tab control?
any help?
Tariq
|
|
|
|
|
Hi everyone,
I have a byte array of 1000 bytes and it is supposed to have a static content. What I want to do is put a whole string of hex values into it all at once rather than do something like:
byte[0] = 0x95;
byte[1] = 0x78... and so on..
Is it possible to initialize it at once with all the content?
Thanks,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
You can set the values when you declare byte
char byte[1000] = {0x95, 0x78, ...};
NOTE, ... means and so forth for all 1000 bytes.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Antony M Kancidrowski wrote:
char byte[1000] = {0x95, 0x78, ...};
NOTE, ... means and so forth for all 1000 bytes.
That sounds like real fun!
better him then me
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
Pankaj
Without struggle, there is no progress
|
|
|
|
|
V. wrote:
That sounds like real fun!
Um quite!, not the most productive thing to do either
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Thanx!
Without struggle, there is no progress
|
|
|
|
|
Hi,
i want to create a dll to call some functions i was using in one of my progs.. the linker gives me following errors:
Linking...
nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in Test.obj
nafxcwd.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in Test.obj; second definition ignored
Creating library Debug/Test.lib and object Debug/Test.exp
nafxcwd.lib(timecore.obj) : error LNK2001: unresolved external symbol __mbctype
nafxcwd.lib(apphelp.obj) : error LNK2001: unresolved external symbol __mbctype
nafxcwd.lib(filelist.obj) : error LNK2001: unresolved external symbol __mbctype
nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv
nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc
Debug/Test.dll : fatal error LNK1120: 3 unresolved externals
Any ideas ?
"Just looking for loopholes." W. C. Fields American actor, 1880-1946, explaining why he was reading the Bible on his deathbed.
|
|
|
|
|
By looking at the included libraries, it seems that your DLL is using MFC, linked statically.
You cannot, and I repeat, cannot use DllMain as the DLL entry point when using MFC. Instead, I suggest you create a whole new DLL project, this time by using the MFC DLL Wizard which comes with Visual Studio. It creates a skeleton project for you, indicating places where you should add code by inserting comments.
As for the other errors, it seems that your linker input libraries are missing something. For a general rule of thumb, create a new project and copy/paste relevant code over the new skeleton.
The reason why you cannot use DllMain is because MFC already offers this function in it's core libraries. This is, by Microsoft's words: "Behaviour by design". MFC's DllMain will query for an external CWinApp object, which is exported by the main code module of your project (Usually defined as C<Project name>App theApp ). It will then call the InitInstance function of your class to start the DLL's execution.
So, all in all, create a new project by using the MFC DLL Wizard. This will solve 99% of the problems you listed, although moving the code from the current project into the new skeleton project may be quite difficult.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hi there,
I have a CFormView that has several custom controls layed in it. My question is how to make those controls inform CFormView of certain events without using SendMessage? Is there any way(s)?
All comments and suggestions welcome.
Much obliged for taking the time,
David
PS: Can you also let me know of what the (valid) range of user WM messages are?
|
|
|
|
|
I'm sure using the Speech API will not help ..
Joke aside, have a look at the observer pattern; or simply override the controls to directly call the formview.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Hi! and thanks for the quick reply.
There is just something I don't quite understand...
have a look at the observer pattern
What do you mean exactly by "observer pattern"?
Also, can you give me an example of how I could override a control which calls one its own virtual functions (when an event occurs) and therefore make it alert CFormView?
This is really killing me...
Again thanks a lot.
David
|
|
|
|
|
If the "events" belong to the category of "Standard Windows events", such as a button click, then you can use the ClassWizard/"Add Event Handler" -wizard to add a handler for the event. Because the CFormView is the parent of all the controls, it will be the class which will contain the handlers.
However, a more important question I have to ask: why wouldn't you use SendMessage ? Everything in Windows(r) is messages, so a few more messages won't crash the system
As these are custom controls, I assume that you have a class for each control which determine it's behaviour. Now, inside these classes, if you create ON_WM_* macro entries into the message map, you can capture any type of WM_* messages, no matter what they are. When you capture this message, and wish to notify the parent (in this case, the CFormView ), you can use the CWnd::GetParent function of the control's class (every MFC control derives from CWnd , thus it has GetParent ). This will give you a pointer to the CWnd-class of the class hiearchy. Then use DYNAMIC_DOWNCAST macro to cast down into your CFormView-derived class. Now, you can use the pointer to, for example, call a function of the derived class. Here is a concrete example:
BEGIN_MESSAGE_MAP(CMyButton, CButton)
ON_WM_LBUTTONDOWN()
END_MESSAGE_MAP<DIV>
.
.
.<DIV>
void CMyButton::OnLButtonDown(UINT uiPos, CPoint point)
{
CWnd* pParent = this->GetParent();<DIV>
CMyFormView* pForm = DYNAMIC_DOWNCAST(CMyFormView, pParent);<DIV>
VERIFY( pForm != NULL );<DIV>
pForm->AnyGivenFunction( param1, param2 );
} If you don't understand this concept, then you should quickly brush up your skills in object-oriented programming, and more importantly, in pointers to classes in a class hiearchy. Any C++ book is a good place to start, and the thing to look for is 'polymorphism' and 'dynamic_cast'. Search MSDN with the latter one for a few excellent examples.
Hope this will help you out..
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Antti Keskinen wrote:
use DYNAMIC_DOWNCAST macro to cast down into your CFormView-derived class. Now, you can use the pointer to, for example, call a function of the derived class. Here is a concrete example:
Antti, thanks a million!!! DYNAMIC_DOWNCAST ===> that is what I was looking for!
And yes, you are absolutely right! I have only started programming in MFC for a month or so, which consequently doesn't make me an expert on the subject.
But thanks to your brilliant explanation, I have learnt a bit more.
Thank you very much indeed.
David
|
|
|
|
|
Antti, I have another question for you (or anybody else who would like to have a go...):
Assuming I opt to use a Messaging system to make objects communicate with each other and also assuming I use RegisterWindowMessage to make sure I will have valid message IDs (not in use already), how would I inform the parent window (or whatever) of the message IDs they should be listening to?
Moreover, how do I inform the parent window receiving the message(s) of who is sending it? Should I include that in one of the PARAM args?
Do you have any suggestions you want to share with me?
Again, thanks a lot,
David
|
|
|
|
|