|
There are some more things that you need to know.
1. Using Capital letters is like shouting. So try avoiding it.
2. Don't use slang's. For example: If you can type "Abt" there is nothing wrong in typing About. doesn't take much of time.
3. Don't just type something, understand the problem.
|
|
|
|
|
abhishekriyer wrote: SO I WANTD 2 KNOW ANY SPECIFIC ALGO I GOTTA USE...
See here.
"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
|
|
|
|
|
If you haven't read the guidelines[^], I'd suggest that you read it now (specifically point numbers 2, 6 and 9).
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
choose a canonical form and normalize
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Well, aside from warnings you are getting from others (apply to them please) I'm getting few ideas:
- in anagram all letters must be used (from source string), and only one time (can't re-use the same letter).
Chack for length (without spaces) it must be equal.
Next you can use source string as matching point, start from first letter and check for existing in trial string. If it exist remove it from both strings, if it doesn't your trial string is not an anagram.Preform that operation until you check all letters. If an empty string is what is left than yours trial string is indeed an anagram.
Hope this helps.
|
|
|
|
|
Hi,
I want to programmacally create an entry under
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run in Vista to make my application to Load at windows start up. But when trying to create an entry RegSetValueEx return Access denied error. How can i add an entry under Run programmatically using VC++. Whether there is any API to get an access right to Vista Registry. I am using Vista Home and VS 2005 to develop my application.
thanks
Nitheesh.
Jose Jo Martin
http://www.simpletools.co.in
|
|
|
|
|
|
Hi Stuart,
thank you for the reply. i will try with this.
thanks
Nitheesh.
Jose Jo Martin
http://www.simpletools.co.in
|
|
|
|
|
Hi there,
I'm having problems getting an HTML element from a CDHtmlDialog.
Here is my scenario:
I need to create a Dialog in which to display a HTML page with some textareas. These textareas need to be filled dynamically from my code. The purpose of this Dialog is somewhat resembling a preview dialog. I need to show the end user how a pdf will look like and allow the user to modify some data just before creating the pdf.
So, I used CDHtmlDialog, I loaded the page using Navigate(fileURL)(please be aware that I cannot store the htmls as resources because I will need to load a relatively large number of them, so I would prefer loading them straight from the disk), and now I want to populate the textareas .
To do that, I used this chunk of code that I found browsing the web:
IHTMLElement* pLinkElement = NULL;
if (GetElement(_T("text_id"), &pLinkElement) == S_OK && pLinkElement != NULL)
{
pLinkElement->put_innerText(text_value);
}
The problem is that GetElement returns an E_NOINTERFACE error message.
This happens when I'm using this code on the OnInitDialog() method, right after using Navigate().
I also intercepted some OnClick messages for a few buttons in my HTML (using the DHTML_EVENT_MAP). If I use the code above on one of those OnClickButton() methods, the code works fine.
Does anyone have an ideea why this would happen?
Thanks in advance,
Paul.
|
|
|
|
|
electric_one2001 wrote: The problem is that GetElement returns an E_NOINTERFACE error message.
This happens when I'm using this code on the OnInitDialog() method, right after using Navigate().
It's been a long time since I tried to hijack the browser to create a user interface but you may have to wait until the browser had built the DOM. There are events it fires like documentComplete or some such thing.
|
|
|
|
|
Thanks a million man! You saved me from a nervous breakdown (and, of course, from a stupid workaround, VERY bug prone) .
Indeed, calling the code in the OnDocumentComplete() did the trick.
I ow you a beer 
|
|
|
|
|
Hello, sorry for the late reply.
I think you should use the OnDocumentComplete method and not use OnInitDialog method because the html element only ready to be used after the document has been fully loaded.
jerryworm
|
|
|
|
|
in MFC application am using JPEG images which are using as background images for my dialogs. fro the am carrying image filtes with my application instead of that can i set imaged into dll and load the images from dll whenever required?
|
|
|
|
|
Yes. Add them into the resource file. I've added an HTML file (contained in the 'res' sub-directory of my project) to my resources using this entry in the resource (.RC) file:
ABOUTDIALOG.HTML HTML "res\\aboutdia.htm"
You could use (for example)
TEST.JPG JPG "res\\test.jpg"
You can then use a code fragment like the following to load a resource into memory:
std::string LoadFileFromResource(HINSTANCE hmodResource, LPCTSTR name, LPCTSTR type)
{
if (!type)
type = ::PathFindExtension(name) + 1;
HRSRC rsrcFile = ::FindResource(hmodResource, name, type);
if (!rsrcFile) return std::string();
HGLOBAL gblFile = ::LoadResource(hmodResource, rsrcFile);
if (!gblFile) return std::string();
DWORD sizeFile = ::SizeofResource(hmodResource, rsrcFile);
if (!sizeFile) return std::string();
LPVOID filePointer = ::LockResource(gblFile);
if (filePointer)
{
std::string contents((char*)filePointer, sizeFile);
::FreeResource(gblFile);
return contents;
}
return std::string();
}
[edit]You'd call that function a bit like this:
std::string loadedJpeg = LoadFileFromResource(resourceDllHandle, _T("TEST.JPG"), _T("JPG"));
std::string might not be the best result type for you, as you're loading a binary file - I've only loaded text files with this...[/edit]
HTH!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
modified on Thursday, April 2, 2009 5:25 AM
|
|
|
|
|
can i load from external dll?
|
|
|
|
|
Yes, so long as you load the DLL with a LoadLibrary call.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
how can i set images in external dll and load into application?
|
|
|
|
|
When you build the DLL, embed the jpeg files in the DLL's resources, as I described before.
In your executable, call LoadLibrary for the external DLL containing the image files. That'll return the HMODULE you need to pass into the LoadFileFromResource function I gave you the source for.
Then you can load the image files from the DLL as desired.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I created MFC dll with JPG images as you explained, but when try to load into exe,
FindResource() returning ERROR_RESOURCE_DATA_NOT_FOUND.
Can you suggest me what to do (I have an application inc which dialogs and contros skinned with jpg images, so am carrying jpg images with my application, for that want to create dll and load images whenever required), what type of Dll(Win32 or MFC) need to build? IF MFC why it is failing to find resource, if win32 how images can add into dll.
|
|
|
|
|
Win32 DLL is fine - just create a Win32 DLL project and add the resources. You might have to export a routine for it to make the DLL.
For the MFC one - have you got the correct HMODULE for the DLL (use LoadLibrary to get the correct one)
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Ya am loading dll using Loadlibrary, but FindResource is failing. How can we know dll contains images or not?
You can see this link Load JPEG images from DLL with LoadResource in Managed C++[^] , here also loading image from dll, the same way i tried but it is failed. any reasons?
modified on Saturday, April 4, 2009 9:06 AM
|
|
|
|
|
kiranin wrote: Ya am loading dll using Loadlibrary, but FindResource is failing. How can we know dll contains images or not?
Open it in Visual Studio - that should show you if it has resources, including images.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi there.
I am setting text for a control using below code...
char buffer[MAX_PATH];
char *message = "Hello";
sprintf(buffer, "%s", message);
....
....
HWND pWnd7 = ::FindWindowEx(pWnd6, NULL, L"TComboBox", NULL);
::SendMessage(pWnd7, WM_SETTEXT, 0, (LPARAM)buffer);
Its setting some text but seems to be some garbage. i tnow its not garbase, but actually we are not able to properly convert buffer into LPARAM type i.e., (LPARAM)buffer).
Please help me on this.
Thanks
PanB
|
|
|
|
|
PankajB wrote: char buffer[MAX_PATH];
char *message = "Hello";
sprintf(buffer, "%s", message);
....
....
HWND pWnd7 = ::FindWindowEx(pWnd6, NULL, L"TComboBox", NULL);
::SendMessage(pWnd7, WM_SETTEXT, 0, (LPARAM)buffer);
What about
TCHAR buffer[] = _T("Hello");
HWND hWnd7 = ::FindWindowEx(hWnd6, NULL, _T("TComboBox"), NULL);
if ( hWnd7 ) ::SendMessage(hWnd7, WM_SETTEXT, 0 , (LPARAM) buffer);
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]
|
|
|
|
|
try
.............
SendMessage(hWnd7, WM_SETTEXT, (WPARAM)strlen(buffer) , (LPARAM) buffer);
...........
|
|
|
|
|