|
|
Thanks Ansuman, Chandrasekharanp
French is the language of love, for everything else there is c++ ...(anonymous)
|
|
|
|
|
strcmp Example [^].
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 )
|
|
|
|
|
<br />
if(strcmp(strHello,_T("Hello")==0)<br />
{<br />
cout << _T("SAME");<br />
}<br />
is same as
<br />
CString strHello(_T("hello"));<br />
if(strHello.Compare(_T("Hello"))==0)<br />
{<br />
cout << _T("SAME");<br />
}<br />
in MFC
|
|
|
|
|
dubeypankaj wrote: Can i get any example to utilize strcmp() in MFC.
Heck, you're asking for example in MFC, so I'm giving you the MFC solution :
have a look at CString::Compare and CString::CompareNoCase
This signature was proudly tested on animals.
|
|
|
|
|
I have a VC++ application which supplies the values. I draw chart using a VB EXE which has to get dynamic values from the VC++ EXE.
So I want to share memory between the 2 EXE's VB6 and VC6.
If it is possible, Pl. provide me with some sample code and step by step approach to do this.
Thanks in Advance
|
|
|
|
|
You could use memory mapped files.
Refer to these APIs
CreateFile<br />
CreateFileMapping<br />
OpenFileMapping<br />
MapViewOfFile<br />
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
manohar_balu wrote: If it is possible, Pl. provide me with some sample code and step by step approach to do this.
The WM_COPYDATA Message[^] might be the easiest method for you. There is an MSDN article which can give you a step by step approach.
How To Pass String Data Between Applications Using SendMessage[^]
This technique can be used to pass data between a VB and C++ application provided that both applications have a window message pump.
Best Wishes,
-David Delaune
|
|
|
|
|
Hi,
We have a pretty extensive application that is written and maintained in VC++ v6. I am trying to add a new dialog box & class and suddenly I am getting an error that I can't seem to correct.
Here is the steps that have always worked... and now... don't....
- I created a new DIALOG with the INSERT DIALOG option under RESOURCES
- I hit the CTRL-W to open the CLASS WIZARD.
- I entered the name TESTDIALOG and picked the CDialog base class
- When hit OK, I get this error
Unable to open files (C:\MYPROG\TESTDIALOG.H, C:\MYPROG\TESTDIALOG.CPP) for class "TestDialog"
It adds the files to the directory, adds the class to the CLASS VIEW tab of the workspace, but it does not add it to the CLASS WIZARD. I can try to add a class through the class wizard off of ANY baseclass and get the same results.
I also have tried to recreate the Workspace and Class Wizard DB by deleting the NCB and CLW files. That doesn't help either.
Any suggestions?
Thanks
|
|
|
|
|
PBrama wrote: - When hit OK, I get this error
Unable to open files (C:\MYPROG\TESTDIALOG.H, C:\MYPROG\TESTDIALOG.CPP) for class "TestDialog"
Sometimes the temporary files (e.g., .aps, .opt, .ncb, .clw) get messed up. Close VS and delete them. They get re-created as necessary.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Tried that... didn't help
|
|
|
|
|
well I have been working on an assigment and it states::
A program has to be developed, and coded in C language, to decipher a document written
in Italian that is encoded using a secret key. The secret key is obtained as random
permutation of all the uppercase letters, lowercase letters, numbers and blank space. As
an example, let us consider the following two strings:
Plain: “ABCDEFGHIJKLMNOPQRSTUVXWYZabcdefghijklmnopqrstuvwxyz0123456789 ”
Code: “BZJ9y0KePWopxYkQlRjhzsaNTFAtM7H6S24fC5mcIgXbnLOq8Uid 3EDv1ruVGw”
The secret key modifies only letters, numbers, and spaces of the original document, while
the remaining characters are left unchanged. The document is stored in a text file whose
length is unknown.
The program has to read the document, find the secret key (which by definition is
unknown; the above table is just an example and it is not the key used for preparing the
sample files available on the web course) using a suitable decoding algorithm, and write
the decoded document to a new text file.
And I know that I have to upload an English dictionary into the program but I don't why it has been asked.(may be not in that statement but I have to dO THAT). My question is , while I can do that program using simple encryption/decryption algorithm then what's the use of uploading the english dictionary in our program? So is there any decryption algorithm that uses a dictionary to decrypt an encrypted file? or can somebody tell me what approach or algorithm should I use to solve that problem???
An early reply (and also authentic one) will be highly appreciated from you.
Thank you guys.
|
|
|
|
|
Piece of cake. There are only 63 factorial different permutations possible, so try each one and see what comes out. OBTW 63 factorial is only 2.0*10^87 and as I remember, there are only 10^80 elementary particles in the known universe, but who's counting.
Dave.
PS: I do love a mystery and cyphers, this being the only reason that I responded to a homework question. If they had writen the message in English, then I could see the English dictionary - a way to see what the possibilities were. But written in Italian? Why just an English dictionary? An English/Italian dictionary, maybe, but English?
I don't know enough about Italian to know is there is a possessive usage or about contractions thus "'s " or "'t " may or may not be useful in determining what the blank might be. Once you can split words up, things get a bit easier.
Just as a wild off the wall guess, have you tried Caesar's cypher?
|
|
|
|
|
quite helpful it is Dave. yeah the blank is represented by w as I have figured it out. so between two w there is a word. And accept my apology, actually the project is same but in 2 languages. so I have to upload an English dictionary if the text is in English and Italian dictionary if the text is in Italian. But I mixed up 2 different things.
So how can I proceed with that?? should I use all the permutations on each word separately??? How can Caesar cipher be helpful in that case?
Actually I am a C programmer but don't know much about cryptography, that's why I am seeking help here. I would be thankful to you if you explain me things how to do it in a simple and detailed way.
Thank you Dave.
HA Lee
|
|
|
|
|
HA,
Well, you have cut that permutation count down to 62 factorial. Good luck.
As with any decryption, you need to know the language it was written in in order to see if the proposed decryption makes any sense. This is why encrypting something twice, with two different algos, is such a bitch to decrypt. The first decryption will give you an intermediate text that is still encrypted so you don't know if the first decrypted correctly until you try to decrypt the second time.
Dave.
|
|
|
|
|
Look into some kind of character frequency analysis (works for simple encryption schemes). That might cut down the computational complexity a bit. And no, I'm not going to tell you how to do it, since it's a homework.
|
|
|
|
|
Hello, I'm not too experienced C coder, so I have a question:
Where I should define those strings I'll be using? In the header or where it's used? If I wrote them in the header, the result would be much like that string pooling flag in the compiler options, right? I'm trying to code a GUI (with WinAPI) and I started wondering this.
Here's an example:
main.h:
const TCHAR g_lpErrorText[] = TEXT("Error!"); main.c:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MessageBox(NULL, g_lpErrorText, g_lpErrorText, MB_ICONEXCLAMATION|MB_OK);
return 0;
}
OR
main.c:
WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MessageBox(NULL, TEXT("Error!"), TEXT("Error!"), MB_ICONEXCLAMATION|MB_OK);
return 0;
}
|
|
|
|
|
I tend to prefer the latter. If combining strings is turned on in the optimizer, which it usually is, it won't matter, though if the instances of using the string are separated, I tend toward a version of the former:
LPCTSTR pErrorText = _T("Error!");
or if you want to make it more obvious:
const TCHAR* pErrorText = _T("Error!");
(For strings that may be localized (translated), I make them resources.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
modified on Sunday, May 3, 2009 8:19 PM
|
|
|
|
|
Joe Woodbury wrote: (For strings that may be localized (translated), I make them resources.)
You actually answered my second question too, which I forgot to ask, hehe. Many many thanks!
|
|
|
|
|
Hi,
I trying to make make my rich edit control wide enought to contain a certian amout of characters
I have read and understand the article on this site by Thales Carvalho
that plays around with the Hieght of the Rich edit control until the
desired width is returned
Howevers since I would ike to display a certain amount characters on a
Line it would be nice to know where I can get the Font used by Rich
edit
I have tried the following code
CFont* fontobject = Myricheditctrlptr->GetFont();
LOGFONT lf;
fontobject->;GetLogFont(&lf);
but get NULLS returned for fontobject
this code lives in My ::onInitDialog rtn after I have created my rich
edit and Used EditStream to populate the edit window
Any insights would be apprecaited ...
|
|
|
|
|
|
thankx
charformat structure only has a Height paramter as rich edit is bottomless and will break up words
woncder I can create CFONT class for this font and get the logfont which would give the lfwidth for this font type
I think I got a better idea of how to get what I want
thankx again
|
|
|
|
|
Hi
I have a MenuBar that is in English and is created using CommandBar::InsertMenuBar. It all works fine but I want to be able to change font of MenuBar main buttons that are shown at bottom. I can change individual menuitems by subclassing the menu but can't seem to be able to change the buttons.
If I could get handle to those buttons, I could subclass them to override font myself.
Also, is there a way to override system font only for my application. I don't want to change it in registry.
-----------------------------
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
New MFC is missing a CMFCListView class that would be able to use the new CMFCListCtrl. The reason for the attempt to use CMFCListCtrl is due to it's new header that does supports nice ordering and other stuff.
I followed the article from here[^] but it looks like it doesn't work if you are using LVS_OWNERDATA.
I created a sample application using the wizard just for this test. There are 4 configuration you can build Debug,Release,Debug-New,Release-New - the ones with new will try to use CMFCListCtrl instead.
Some problems I saw are: the new CMFCListView is that it doesn't receive LVN_GETDISPINFO, the new header is not displayed but if you scroll it will show it. Any hints on this?
The project is located here: http://nusunt.eu/download/mfc/cmfclistview_test_1.zip[^] and to compile and test you need VC2008 SP1+FeaturePack.
Best regards,
Sorin Sbarnea
|
|
|
|
|
How can I configure visual studio 2005 so that if I create a windows API application, it would run on windows xp system that does not have any .net framework installed. With visual c++ 6, this problem does not occur but with visual studio 2005, the application can run only when .net framework is installed on the user's system. How can I configure visual studio 2005 to avoid such problem. Please help.
|
|
|
|