|
No worries - I should have realised. The answer is the same - floating toolbars, doc/view, etc, all useful for a more complex app, but a CFormView allows you to mix that with designing a window full of controls in the resource editor.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
thank you!
|
|
|
|
|
I want to have a line in 80th column of my view which is derived from CView. This is to be used as an 80th column marker. I will be grateful to you if anybody can help me in solving this problem.
|
|
|
|
|
You're going to have to draw it in the erasebackground call, the issue is figuring out where it is, if you have a non-fixed width font.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Sir,
I cannot find anything called erasebackground function anywhere in vc++. Can you suggest me a similar function which i can use with my view which is derived from CView. My exact problem is like this. Suppose, I am drawing a line at 80th column, and if I am increasing the font size, the line comes to some 30th or 35th column and not 80th column. This I want to update on change of the font size. I have a function OnChangeFont() which will be executed when user changes the font.
Thank You and expecting a positive reply.
Krishna Raj.
|
|
|
|
|
WM_ERASEBKGRND, from memory.
You'll need to measure the string to figure out where to draw your line, and as I said, that will not always be 80 columns because different characters have different widths, all you can do is shoot for an average.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
How to correctly implement subj?
|
|
|
|
|
Hi,
I want to use map<string,string> in my program but I don't want it sort for me and I would like to have a NoCase comparation. Can I do that? how?
Thanks
|
|
|
|
|
No. A map is always sorted.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
error C2065: 'MIIM_STRING' : undeclared identifier
Why am I getting this error? I didn't before, but suddenly all my system-tray projects do. I've got WindownXP and I've installed the Microsoft Platform SDK (May 2002). Is there something wrong with my VC++ settings, since MIIM_STRING should exist since Windows98 or something. I am also experiencing other weirdnesses like this:
'DialogBoxParamA' : cannot convert parameter 4 from 'long (struct HWND__ *,unsigned int,unsigned int,long)' to 'int (__stdcall *)(struct HWND__ *,unsigned int,unsigned int
This error suddenly came up in one of my projects which previously compiled just fine. The param is a DLGPROC which is declared (and the definition is similar) like this:
INT_PTR CALLBACK ConfigDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
This is correct according to the Platform SDK Documentation. INT_PTR is a long obviously but DialogBoxParamA wants it to be an int. What's up?!
And I'm sure there are other things; I haven't bothered opening up all my old projects just to check...
Please help me. I'm desperate
Sprudling
|
|
|
|
|
For some reason neither the VC++ SP5 upgrade or the Platform SDK install managed to setup the correct include and lib directories in VC++.
Sprudling
|
|
|
|
|
Hello,
simple question:
Can i make a shadow in my custom cursor, like the standard cursor's ?
OS : Win2000
Marco
|
|
|
|
|
Hi, i'm using VC++ 6.0 I have add the file "myprogram.exe" to my project's resource and the file's ID is "IDR_FILE1" I want a program with a button that, when pressed, will copy the file "myprogram.exe" to the targeted directory of my chosen, for example "c:\\test " What code should I write in the on button pressed function to make this work.
thank you so much for your help.
|
|
|
|
|
Check the codeproject MFC FAQ for code allowing to choose a directory. Then CopyFile(oldfilename,newfilename,FALSE); .
Hope this helps...
~RaGE();
|
|
|
|
|
I try do a webbrowser with WebBrowser2 control but I get some errors or uninstpected behaviour. I cannot find any tutorial how to use WebBrowser2 with MFC.
Do you know about any?
My main problem is, that when I press back button and there aren't any more back .html pages. A message box pops up from nowhere. How can I handle this?
|
|
|
|
|
I need to supply a data structure to a new thread as parameter when a create it. How can I do that ??
I have declared the thread as:
DWORD WINAPI CopyFolder(void* p_pvThreadParameter)
and I create it using the following instruction:
l_hCopyFolderThread = CreateThread(NULL, 0, CopyFolderThread, this, 0, &l_dwThreadId);
As fourth parameter, as you can see, I have supplied "this": so the tread can used public members of the class that has created it. This methods work correctly but i don't like it !!!! I prefer to supply to each thread its parameters !!!
I have tried to supply a point to a data structure (casting it to void). But this doesn't work !!!!
How can I do ??
Thank you very much !!!
Cristiano Galeazzi
|
|
|
|
|
I have tried to supply a point to a data structure (casting it to void). But this doesn't work !!!!
Why does it not work? It should.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
This solution compiles and runs but...
if I put a break-point inside the thread function and I check the
content of the supplied structure I find that its is empty or it
contain not valid data !!!!
Cristiano Galeazzi
|
|
|
|
|
I guess the problem is that the data you're passing is allocated on the stack instead of the heap, something like:
MyDataStructure data;
CreateThread(...,&MyDataStructure,...); The problem with this approach is that data is destroyed as soon as your function existis from the scope the variable is declared in. You will need to allocate the structure in the heap with new (and don't forget to make the thread delete it when no longer needed.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thank you very much!!! It works as you says!!!
Cristiano Galeazzi
|
|
|
|
|
The usual solution is to allocate a struct on the heap and pass this as the thread param. However, going C++ you could do this things much more comfortable and even create your thread directly as a member function. This is demonstrated in my article Use member functions for C-style callbacks and threads - a general solution here at CodeProject. The provided header file allows you to write code like the following:
#include "win_adatpter.h"
struct DATA { int foo; double bar; };
class MyClass
{
public:
MyClass()
{
DATA data = { 4711, .0815 };
m_hThread = win::beginthreadex( this, &MyClass::ThreadStart, data );
}
protected:
DWORD ThreadStart( const DATA& data )
{
printf( "Hello, I'm a Thread and got some params: %d and %f\n", data.foo, data.bar);
return 0;
}
HANDLE m_hThread;
};
Hope this helps
--
Daniel Lohmann
http://www.losoft.de
|
|
|
|
|
Hello,
I can't get rid of error LNK2001: unresolved external symbol _errno. I asked for help concerning this last week and got some answears, thanks a lot for them , but unfortunately they didn't help.
So, at the moment the situation is like this. The starting point of my program is main() and it uses a library, that is written in C and supports MFC. The file where main is is a .c -file. Besides that file I have a few files for GUI, the library and a couple of .c -files written in C.
I should use makefile, but I'm trying to get this working first with project/settings -options and then I'll export a makefile. I have set "Use MFC in a static library" from Project/Settings/General, "Multithreaded" from Project/Settings/C/C++/CodeGeneration/Use run-time library, "Automatic use of precompiled headers through header stdafx.h" from .../C/C++/Precompiled headers. I have also forced the program to be compiled with an option /TP. I also had to deny usage of two default libraries with linking options /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib", because they conflicted with the library licmtd.lib.
The result is, that I get "LNK2001: unresolved external symbol _errno". The place where I get it from is inside the library written in C, that I'm using. If I used libc.lib and denied the usage of two others I would get 66 unresolved externals instead of errno and if I used only libcmt.lib, I would get 45 unresolved externals including errno.
I have the source code of that library, but I can't modify it. In that file, where I get this error from header errno.h is included, but it is inside #ifndef _INCLUDE__STDC__. Could this be the reason why errno is unresolved? The calling convention that I'm using is __cdecl, from .../C/C++/CodeGeneration/Calling convention. I tried using stdcall, but I only got some more linking errors.
I've also tried using extern "C" with all the headers written in C, and it didn't help. What I concluded, is that libc.lib includes the definition of errno, but libcmt.lib and libcmtd.lib don't.
What should I do? Would making a dll help.
-Janetta
|
|
|
|
|
As far as I can see the problem is, that the multithreaded versions of the CRT do not define errno, because it would not fit into a multithreaded environment, but you import a .lib that was linked against the single threaded CRT and therefore expects errno to be defined somewhere.
(The MT version do not define it because using a single errno variable for multiple concurrent running threads is not a really good idea).
You have to link all parts of your project (all .lib files you create on your own and the .exe) again exactly the same version of the CRT, so you got no linking conflicts. Using /nodefaultlib is only a "hack solution" and leads to problems like yours.
--
Daniel Lohmann
http://www.losoft.de
|
|
|
|
|
Thanks a lot! It works now!
It wasn't a big thing to do and now it seems obvious, but earlier it didn't.
-Janetta
|
|
|
|
|
I am facing problem of finding from where exceptions are coming. For this I started to look mapfiles generated by /MAP option in the link tab of Visual Studio editor of MSDev. But could not understand fully. I am using Dlls also with Exe file and when exception comes from Dll then its not clear how to locate the exception in mapfile using the address of exception we have gotten from execution and addresses given in mapfile
Actually my project contains one exe and 3 dlls. Now map files are there for exe and dlls as well. When exe gets exceuted there are times when exception comes from dlls. While looking map files for dlls, there is some calulation required to get the at least function name from where exception came. This caculation is needed because preferred base address given in the dll map file is different than where dll was actually loaded while executing the program. Crash address is in respect to where dll was loaded while addresses in the map file are with respect to preferred base address.
Arvind Kumar Maurya
|
|
|
|