|
Digging further into stdlib.h of VS2003 saw
#ifndef _CRTIMP
#ifdef CRTDLL
#define _CRTIMP __declspec(dllexport)
#else /* CRTDLL */
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* CRTDLL */
#endif /* _CRTIMP */
So _CRTIMP is a #define which tells whether the function is exported from or imported to the C library.
_Check_return_
Return value must not be ignored by callers of this function.
|
|
|
|
|
rupeshk_p wrote: So _CRTIMP is a #define which tells whether the function is exported from or imported to the C library.
Spot on
rupeshk_p wrote: _Check_return_
Return value must not be ignored by callers of this function.
That's right - but as I said, it's only used by Microsoft's static analysis tool - the compiler sees nothing for that
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
On building the SAME CODE for both VS2003 and VS2008 I found the following
1) For VS2003 during the build the linker outputs as
Searching c:\...\test.lib
.
.
.
Searching C:\MSSDK\Lib\amd64\libcmtd.lib:
No error comes up and build succeeds.
2) For VS2008 the linker outputs as
Searching c:\...\test.lib
.
.
.
Searching C:\\Program Files\\Microsoft Visual Studio 9.0\VC\lib\amd64\libcmtd.lib:
libcmtd.lib(strtol.obj) : error LNK2005: strtoul already defined in test.lib(string.obj)
So we see that the libcmtd.lib gets linked after test.lib in both cases.
The libcmtd.lib of both VS2003 and VS2008 has the definitions of strtoul.
But the build fails in VS2008.
Does /MT or /Mtd option of linking has anything to do with this error?
|
|
|
|
|
rupeshk_p wrote: The libcmtd.lib of both VS2003 and VS2008 has the definitions of strtoul.
But the build fails in VS2008.
That is because the VS2008 build pulls in strtol.obj out of libcmtd.lib (that's what libcmtd.lib(strtol.obj) means), whereas the VS2003 build doesn't.
Object code libraries aren't really single units - they're a bit like zip files, in that they're made up of lots of different files internally. What this means is that if nothing requires a symbol that is only found in libcmtd.lib(strtol.obj), libcmtd.lib(strtol.obj) will not be looked at by the linker. This is what happens with the VS2003 build.
The VS2008 build, however, needs a definition of _strtol - that must have been added to the C run-time somewhere. Now, _strtol is only found in libcmtd.lib(strtol.obj). So, the linker adds the object file libcmtd.lib(strtol.obj) to the build. However, when it then comes to tie all the object files together, it finds two definitions of _strtoul - the one in libcmtd.lib(strtol.obj) and the one in your code. It does not (cannot) know which to use, so it raises a fatal error.
rupeshk_p wrote: Does /MT or /Mtd option of linking has anything to do with this error?
I doubt it, but you could try.
What you have encountered however, is the reason that you shouldn't do things like redefine standard functions - some completely unrelated change in the Microsoft libraries has broken your build!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
One question Stuart.
How to find in detail( similar to the explanation you gave about the VS2003 and VS2008 difference ) about the functioning of VS 2008 or previous versions in depth.
|
|
|
|
|
Hello . I am a beginner in craft , but I like this class CCrypto , used in one of my project , to crypt a pass string into registry ,where goes perfectly and now I want to use in a MDI arhitecture , to encrypt a CRichEditCntrItem class , but I don't know how to do that .... can you help me ? Because I made a Serialize method in CMyCntrItem , and here I try to acces Encrypt method of CCrypt , but this method call again Serialize method of CMyCntrItem .... and looping never end ...
here is code sample :
void CMyCntrItem::Serialize(CArchive &ar)
{
if(ar.IsStoring())
{
CCrypt crypt;
CByteArray arrBytes;
crypt.DeriveKey("123456");
if(crypt.Encrypt(*this,arrBytes) == true) /// and here begin to loop forever ...
ar << arrBytes;
}
else
{
/// Loading code ... ?!
}
}
If you say , I will attach my all attempt project........
|
|
|
|
|
mesajflaviu wrote: if(crypt.Encrypt(*this,arrBytes) == true) /// and here begin to loop forever ...
So, you're asking us to help you solve a bug in code that we've not only never seen, but the only person who has seen it is you? I know we're good here, but we're not *that* good. (Except Rajesh)
All I can think of is that you break this in to three steps:
1/ Work out how to get the rich edit controls data,
2/ Work out how to set the rich edit control,
3/ Put in your encryption code.
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Firs of all , I want to say that I'm very sorry because I write so little about my problem ( my mistake !! ) , I should say more , so , in fact , it's about probably something simple :
I intend to use CCrypto from Dave Kerr , take from here :
A simple MFC class to encrypt data with the Crypto API[^]
and crypt a CRichEditCntrItem ....I don't know where put next code ( sampled by Dave ) :
// Now I want to encrypt my applications document object.
CDocument* pDoc = GetDocument();
if(crypto.Encrypt(*pDoc, arBytes) == true)
{
// Store the byte array in a file, the registry, whatever.
}
|
|
|
|
|
OK, you still need to break your problem into bits.
It looks like the CCrypto object has an encrypt and decrypt function that call (I guess from your first post) the CMyDocument::Setialize method to put the data in / out of the document. Feel free to use your debugger to see if I'm telling the truth.
BUT,
A CRichEditCtrl is a UI item, and would either be part of a CRichEditView. You would have to add a handler to the view which would fire every time it changes (ie, ON_EN_UPDATE) and save the text from the rich edit control to a CString (or std::string, or whatever you like) in the document. Then you can archive that.
As for decryting, that article has a good example of that. After decrypting the text, it will be deserialized into your documents text string. Call CDocument::UpdateAllViews, and add code to CMyView::OnUpdate to put that text into the rich edit.
In a similar thought, if you're in an MDI enviroment, you might have multipler views pointing at one document. You'll need to keep that in sychronisation with each other.
I hope that gives you something to think about,
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Thank you for your answers , I will try what you said and let you know if I make it !
|
|
|
|
|
Hy.I hope to follow this track , because I try to solve my problem in the way that you said , but CRichEditCntrItem item could be an other things than characters ( a .jpg item for sample ) so how to save that in a CString ? And to be sure that I understand how to solve problem : I create a CMyView CString member variable , to save characters item on CMyView::OnUpdate handler , and from here archive that in CMyDocument class ? I understand well ?
modified on Monday, May 4, 2009 6:51 AM
|
|
|
|
|
Hi,
i am looking for a function/class which allows to load a region of a JPG/PNG file ... so i need a function like:
LoadImageRegionFromFile(LPCTSTR lpFilename,int x,int y,int width,int height)
to extract a image rectangle with <width> and <height> dimension from the file <lpfilename> at the point (x/y) ... it's not important for me if i get the result as a new file or as a byte array ...
More important: portable code (so pure C/C++ is welcome)
I searched here in CP but found nothing ... ... has anybody a hint for me?
Thanx!
Frank
|
|
|
|
|
Probably you should:
- load the image from file.
- Get the proper region data.
- Write a new image file with region data.
For step (1),(3) you need a JPEG portable library.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
You can do it with CImage class.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hai!
Acutually i am developing an dialog based application in eVC++ 4.0 for a Pocket PC device. I actually have to display .jpg and .jp2(.jpg2000) images in my dialog. i was searching through net for simplest code but in vain.
Finally i copied some code that converts .jpg to .bmp, As i am able to display .bmp images i started using that code, but it uses CopyImage()
that is not supported in eVC++,
Can you suggest me
1. Simple code in eVC++ that displays .jp2 &.jpg images
or
2. How to easily convert .jp2 and .jpg images to .bmp
or
3. Function similiar to CopyImage() in eVC++;
I have posted the 1st doubt in Code project recently, i have even got good response
"http://msdn.microsoft.com/en-us/magazine/cc301454.aspx"
but i am uanble to use it??
Assuming that both .jpg and.jp2 file are present in :
C:\Documents and Settings\MyFolder
Now can you please code me how to display the images , I tried but not successful!
thanks!
|
|
|
|
|
kapardhi wrote: but i am uanble to use it??
Why?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: Why?
Bcoz i couldnot figure out what he was describing!
I think he was explaining two different logics.
Can u please explain in short using code snippets what he meant ?
Thanks!
|
|
|
|
|
He uses COM to load the image. You may use MFC CImage , instead (if available in embedded VC++). BTW: why don't you ask in the Mobile Development forum [^]?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
have a look at [SHLoadImageFile^], [SHLoadImageResource^] this is supported from Windows CE .NET 4.0 and later so you must be able to use in evc++, if you are planning to use higher version (WCE 5.0) try using Imaging API there is a sample in SDK path.
|
|
|
|
|
Hi everybody,
if I display the MainFrame (at the start) in fullscreen. The user cant access the taskbar, which is in autohide mode.
Normally if the user places the mouse at the bottom of the screen, the taskbar slides up and is available. In this case, the taskbar even dont appear.
If i restore the MainFrame to the Non-Fullscreen-Mode the taskbar is still not accessible.
Only if I switch to another application and re-switch on my application, then I can access the taskbar correctly.
Big thanks for any suggestions.
Greetings
|
|
|
|
|
hi,
i get the following errors when i run the NggolekiGinambaran program. i use
jbig.lib
j2000.lib
cximage.lib
demo.lib
Jpeg.lib
.............
Error 1 error LNK2019: unresolved external symbol "public: bool __thiscall CxImageRAW::Decode(class CxFile *)" (?Decode@CxImageRAW@@QAE_NPAVCxFile@@@Z) referenced in function "public: bool __thiscall CxImage::Decode(class CxFile *,unsigned long)" (?Decode@CxImage@@QAE_NPAVCxFile@@K@Z) c:\Documents and Settings\tasmin\Desktop\Ref Projects\CBIR\NggolekiGinambaran\cximage.lib 1 NggolekiGinambaran
Error 2 error LNK2019: unresolved external symbol "public: bool __thiscall CxImageMNG::Decode(class CxFile *)" (?Decode@CxImageMNG@@QAE_NPAVCxFile@@@Z) referenced in function "public: bool __thiscall CxImage::Decode(class CxFile *,unsigned long)" (?Decode@CxImage@@QAE_NPAVCxFile@@K@Z) c:\Documents and Settings\tasmin\Desktop\Ref Projects\CBIR\NggolekiGinambaran\cximage.lib 1 NggolekiGinambaran
i got the NggolekiGinambaran program from the following link ....
"http://www.codeproject.com/KB/graphics/cbir.aspx?display=PrintAll&fid=9137&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=26&select=1079489">Finding Similiar Images[
please help.....
tasmin
modified on Thursday, April 23, 2009 7:52 AM
|
|
|
|
|
tasmin iqbal wrote: NggolekiGinambaran
This sounds like something H. P. Lovecraft could have cooked up.
|
|
|
|
|
|
tasmin iqbal wrote: i use
jbig.lib
j2000.lib
cximage.lib
demo.lib
Jpeg.lib
Did you add those libraries (or at least the CXImage.lib) to your project settings ?
|
|
|
|