SendMessage() w & lparams, string stuff

HWND hWnd = cwindow1.GetSafeHwnd();
::SendMessage(hWnd, WM_KEYDOWN, wParam, lParam);

What do my W and Lparams need to be to achieve the equivalent of a CTRL+L keystroke?

Also, in FindWindow:

The window caption is ever-changing, but the first part of it is always the same.

FindWindow("className", "Application");

Application is always the start of the window handle. I want to be able to retrieve a CWnd pointer to that call to FindWindow regardless of what follows Application.

What should I do?

Thank you!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hope this helps u ?
   wParam = VK_CONTROL
   lParam = 38 which is a decimal value.
Regarding the findwindow i am not clear about the question could u elaborate more on this ?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SuperMarioAuthor Commented:
"Application" is ALWAYS present in the window's caption - it's always right before something else, like

Application - Document 1
Application - Opening File

I need to be able to find the window (meaning that that FindWindow call does not return NULL) even if the word Application has something trailing it. So, basically I need to have some variable in there but I am totally clueless how to go about that.

Thanks in advance,
Maybe you could cycle through them:

here is code which returns the HWND of the window:

HWND hwnd = NULL;
char sWinName[100] = "";

hwnd = ::FindWindowEx(NULL, NULL, "className", NULL);
while (hwnd)
    ::GetWindowText(hwnd, sWinName, 100);
    if (strncmp(sWinName, "Application", 11) == 0)
        return hwnd;
    hwnd = ::FindWindowEx(NULL, hwnd, "className", NULL);

return NULL;

//untested and no guarantees, may require fiddling.

good luck
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

SuperMarioAuthor Commented:
Well what I am really looking for is a wildcard character for use in a string.

Any ideas?

SuperMarioAuthor Commented:
Oh, hey... an asterisk works. How about that.

Akalmani, you're the one who gave me the answer to the first question - that's what I need =)

Please answer.


SuperMarioAuthor Commented:
Nevermind... An asterisk DOESN'T WORK!


I really need to find a wildcard character I can append to the end of a string to denote that it's a wildcard.

My feeling is that there is no such wildcard character, or function which accepts a wildcard character unless you write one.

The closest thing is setting lpWindowName = NULL which will match all window names.

I hope you find what you're looking for.
Use EnumWindows to enumerate all the top-level windows and use GetWindowText to retrieve the window titles and then match them.
SuperMarioAuthor Commented:
Okay... Perhaps I need to rephrase this entirely.

I don't really need to use EnumWindows. I used FindWindowEx() to locate the child window I'm looking for. It's of a class called "Edit" with which I am not familiar. I know it is an edit control, and I need to grasp the Edit control from it.

The wildcard character I took care of a while ago by setting the window name to NULL (because it says in MSDN that it matches all window names with that window class).

Dunno how to use GetEditCtrl() in this context...

That's where I'm using GetWindowText - in an edit window. Right now I have it as a CWnd * .

Thanks in advance... Sorry this is so confusing.

SuperMarioAuthor Commented:
Thank you, Akalmani.

That is all I needed from this question.

The other I am going to post again under a different title because it's currently unfair to the other users.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.