|
I modify my MainView style as follows:
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{ if( !CMDIFrameWnd::PreCreateWindow(cs) )
return FALSE;
cs.style = cs.style | WS_MAXIMIZE;
return TRUE;
}
and it works fine.
Hope it helps
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Hi,
I have MFC code written on VC6 platform.Now im trying to build the same code in VS2005 platform.Im getting following linking error.
Error 1 error LNK2005: "public: char const * __thiscall std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >::c_str(void)const " (?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ) already defined in MyCtrl.obj MY_FileIO.lib
Where MyCtrl.cpp is in the application project and MY_FileIO is a project for DLL used by application.
Whats the cause and whats the solution for the same?
|
|
|
|
|
Probably you are trying to use both iostram library and std library.
Your dll and application should use same type of libraries.
If your dll uses MFC then modify the project setting accordingly.
I have not used VS 2005, but here is the way to set application use MFC in VS 6.0
Project > Settings > General tab. "Select Use MFC in Shared Dll"
|
|
|
|
|
Verify that both your dll and axecutable use the same run-time library. For that, open the project properties -> "C/C++" and verify that "Runtime Library" is the same for both projects.
|
|
|
|
|
My Application and DLL has "Multi-threaded Debug (/MTd)" setting set in RunTime library.Still it has the linking error.
|
|
|
|
|
is
#include "stdafx.h"
writed on the top of that file ?
Russell
|
|
|
|
|
and / or
#pragma once
?
Russell
|
|
|
|
|
Even it had #pragma once statement in the corresponding .h file.
|
|
|
|
|
Yes.
#include "stdafx.h" statement is included in the .cpp file.
I tried setting "configuration Property->General->use of MFC" to "Use MFC in shared DLL ".It gave me many more linking errors (like RegSetValueEx is not defined.)
i red this link http://support.microsoft.com/kb/148652.Even this didnt helped me much.
|
|
|
|
|
Hello everyone,
I am using Windows API open (create) a new file by CreateFile,
http://msdn2.microsoft.com/en-us/library/aa363858.aspx
the return value is HANDLE, if I use fwrite to write content to the file, since fwrite requires FILE* as parameter. I think HANDLE is not the same as FILE*, right?
Are there any ways (or methods) to transform HANDLE to FILE*?
I have tried that passing HANDLE directly to fwrite (forcely convert from HANDLE from FILE*) will cause access violation exception. I think the reason is HANDLE is not the same as FILE*, is that correct?
thanks in advance,
George
|
|
|
|
|
You should be using WriteFile() with CreateFile().
|
|
|
|
|
As already suggested by Jonathan Wilkes: "you should be using WriteFile() with CreateFile()".
Alternatively you can use fopen to open the file and then fwrite to write into the file itsef. Bottom line: be consistent.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
It seems easier to convert from FILE * to HANDLE :
#include <io.h>
#include <fcntl.h>
FILE * f = . . .;
HANDLE h = (HANDLE)_get_osfhandle(fileno(f));
The other conversion looks longer:
HANDLE h = . . .
FILE * f = _fdopen(_open_osfhandle((intptr_t)h, _O_RDONLY), "rb");
I hope this works. I am not sure mixing of operations with FILE * and HANDLE cannot be avoided.
|
|
|
|
|
Viorel. wrote: I hope this works. I am not sure mixing of operations with FILE * and HANDLE cannot be avoided
In fact the mix can usually be avoided (and should be avoided, at least to maintain the code coherence). There are, of course, exceptions...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi Friends ...
I have to install the dll build in VS2005 ? It is giving error to install that dll? I installed Framework2.0 on the same machine still there is problem exists.
I have also copied mfc71.dll in sytem32 folder?
What should I do to register my dll?
Please help me ...
Thanking You...
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
|
Thanks Mark.
But still the problem exists there.
I am still not able to register DLL.
Installed patch required for the same.
I also tried the INstallers way...but not getting the result.
I dont know wht i am missing please help me.
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
When the error occurs:
1) What exactly are you doing (or trying to do)?
2) What is the exact error message?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I am using the CImageList::Add(CBitmap* pbmImage,COLORREF crMask) to add a bitmap to the ImageList. The problem is that, this API will change the background color in the supplied bitmap to black. But as per my requirenment it should not be happened since I have to use the bitmap again.
So how can I retain the bitmap?
Thanks in advance.
- NS -
|
|
|
|
|
You didn't correctly initialize your image list.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
My code looks like this...
HIMAGELIST hImageList = ImageList_Create( stBitmapsize.bmWidth, stBitmapsize.bmHeight, ILC_COLOR32 | ILC_MASK, 0, 2 );<br />
m_ImageList.Attach( hImageList );<br />
m_ImageList.Add( &bitmap, clrTransparent_i );
Could you please tell me whether there is any problem?
- NS -
|
|
|
|
|
As John mentioned...
Use the ILC_MASK flag when creating your image list if you want masked bitmaps.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
But it is already there.
From the MSDN documentation of CImageList::Add, crMask parameter:
"crMask
Color used to generate the mask. Each pixel of this color in the given bitmap is changed to black and the corresponding bit in the mask is set to one."
Does it mean that the given bitmap will be modified? It happens so.
- NS -
|
|
|
|
|
Add the flag when you create the image list.
When you add the bitmap, the color will be used to generate the mask, but the image list has
to be created to use a mask.
See CImageList::Create() nFlags parameter.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I think my code just like that you said.
HIMAGELIST hImageList = ImageList_Create( stBitmapsize.bmWidth, stBitmapsize.bmHeight, ILC_COLOR32 | ILC_MASK, 0, 2 );<br />
m_ImageList.Attach( hImageList );<br />
m_ImageList.Add( &bitmap, clrTransparent_i );
Could you please tell me whether there is any problem?
- NS -
|
|
|
|