|
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 ?
|
|
|
|
|
yes i did add them to my project
|
|
|
|
|
Help. Please. How can I solve DirectShow issues.
unresolved CLSID CLSID_CaptureGraphBuilder2. I can not find this in the registry either.
hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC,
IID_IGraphBuilder, (void **) & g_pGraph);
fails.
I am using Win XP, VS 2005
MS SDK February 2003 SDK Release
Microsoft DirectX SDK (August 2007)
Is there a version mismatch.
Samples do not compile either.
Thanks in advance.
|
|
|
|
|
ICaptureGraphBuilder2 is an interface not the object, shall be refered as IID_ICaptureGraphBuilder2 as in ,
CoCreateInstance( CLSID_CaptureGraphBuilder,
NULL,
CLSCTX_INPROC_SERVER,
IID_ICaptureGraphBuilder2,
(void**) &pCaptureGraphBuilder)
ICaptureGraphBuilder2 is exposed by CaptureGraphBuilder (There is no CLSID_CaptureGraphBuilder2)
|
|
|
|
|
Thanks for the reply. I guess I am too new to this. Still many samples from CP are not compiling. So it is not even my code.
Thanks,
|
|
|
|
|
I've got an assignment that I've been struggling with all day, and after re-doing the program several times I believe I've narrowed down my problem to this:
#include <stdio.h>
#include <stdlib.h>
int random;
int guess;
char play = 'y';
int game = 1;
int main()
{
while(game == 1)
{
if(play == 'y')
{
random = 1 + rand() % 1000;
printf("\nI have a number between 1 and 1000.\nCan you guess my number?\nType your first guess:");
play = 'v';
}
scanf("%i",&guess);
if(guess == random)
{
printf("\nExcellent! You guessed the number!\nWould you like to play again?(y/n)");
scanf("%c",&play);
if(play == 'n')
{
game = 0;
}
}
else
{
if(guess < random && guess != random)
{
printf("\nToo low, try again!");
}
if(guess > random && guess != random)
{
printf("\nToo high, try again!");
}
}
}
return 0;
}
</stdlib.h></stdio.h>
When I enter the if(guess == random){} block and answer the (y/n) question, the program falls apart. No matter what I seem to do, it'll shut down, stop functioning, or repeat that block once more before it moves on to what it's supposed to do. I don't understand what I'm doing wrong.
|
|
|
|