|
Yes,
it is like you described !
Superman posted me this code (after the last include) :
------------------------------------
#include <condefs.h>;
#include <windows.h>;
#include <stdio.h>;
#include <string.h>;
int main(int argc, char **argv)
{
HANDLE notepad = FindWindow(0, _T("Untitled - Notepad"));
HANDLE dialog = FindWindowEx(notepad, 0, 0, _T("Open"));
HANDLE edit = FindWindowEx(dialog, 0, _T("EDIT"), 0);
::SetWindowText(edit, _T("ABRACADABRA"));
return(0);
}
------------------------------------
but the compiler show me this error : [C++Error] provaIndiano.cpp(11): Call to undefined function '_T'.
|
|
|
|
|
i think above steps may be not enough for your requirements, if you have the same requirements as i mentioned above reply then following steps are enough for your goal.
1. FindWindowEx to find the notepad mentioned above.
2. Use SetCursor and mouse_event APIs to create a automated click on the menu File.
3. Generate anotherClick to get open from the menu.
4. GetWindowFromPoint API to get the handle of the open Window.
5. Get the handle of open window, from which you can find Edit for file input.
6. Get the handle of the edit as mentioned above code and set text to the edit as mentioned above code.
Величие не Бога может быть недооценена.
modified on Thursday, October 22, 2009 7:04 AM
|
|
|
|
|
Adam Roderick J 09 wrote: 2. Use SetCursor and mouse_event APIs to create a automated click on the menu File.
Using what coordinates?
"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
|
|
|
|
|
Coordinates are the offset from Notepad's ( top , left ) till Menu "File". Which is a fixed value for all the notepad's.
Величие не Бога может быть недооценена.
|
|
|
|
|
Adam Roderick J 09 wrote: Which is a fixed value for all the notepad's
Assuming a certain screen resolution and font size.
"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
|
|
|
|
|
1. YES
2. NO, on the menu "Formato" (i don't know what is the english equivalent - in italian language 'Formato' mean for 'format')
3. YES
5. YES, but for the edit-field 'type of character'
6. YES
Tnx !
|
|
|
|
|
Adam Roderick J 09 wrote:
2. Use SetCursor and mouse_event APIs to create a automated click on the menu File.
3. Generate anotherClick to get open from the menu.
4. GetWindowFromPoint API to get the handle of the open Window.
That sure sounds like alot of work. Here is how I would have recommended opening the second menu item in Notepad:
HWND pWnd;
pWnd = ::FindWindow(NULL, "Untitled - Notepad");
if(NULL != pWnd)
{
::PostMessage(pWnd, WM_COMMAND, MAKEWPARAM(2,0), 0);
}
Best Wishes,
-David Delaune
|
|
|
|
|
Yes i support this answer.
I suggest to use answer from Randor, which is more accurate.
Величие не Бога может быть недооценена.
|
|
|
|
|
|
|
Hi,
I am wondering if you have a derived CDialog
Class and call the default CDialog class thru a
intializer list passing the nidTemplate would
that create a Window handle ...m_hWnd and in that case the only reason to call
::Create is to make it modless
Thankx
|
|
|
|
|
Unless i misunderstand your question: no, it wouldn't.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
ForNow wrote: the only reason to call
::Create is to make it modless
The CDialog class constructor does not create any windows. Windows are not created until you Create them.
Best Wishes,
-David Delaune
|
|
|
|
|
Please correct I am wrong
The CDialog constructer with no paramters e.g. CDialog() is meant for modeless
Later The Create with the nidTemplate Creates the or Attaches the Window
for Modal the CDialog Constructer with the resource id Creates or Attaches the Window
the Window is alive DoModal just Displays
thankx
|
|
|
|
|
Hi ForNow,
ForNow wrote: The CDialog constructer with no paramters e.g. CDialog() is meant for modeless
The empty CDialog() constructor is not "meant for modeless". The CDialog could potentially be modal if DoModal() is called. Modality is not directly related to the constructor.
ForNow wrote: Later The Create with the nidTemplate Creates the or Attaches the Window
Yes, this is correct.
ForNow wrote: for Modal the CDialog Constructer with the resource id Creates or Attaches the Window
the Window is alive DoModal just Displays
No, this is incorrect. Take for example:
<pre>CDialog Dlg(IDD_ABOUTBOX,this);</pre><br />
<br />
All you are doing here is allocating the CDialog object and assigning the template resource ID. The window handle will be NULL until it is created.<br />
<br />
Best Wishes,<br />
-David Delaune
|
|
|
|
|
|
Okay, I need to apologize to people who I have given a bad time and I truly regret it because I need your help with problems with the project that I can rely on you guys to help.
I have been trying to get this to work but its giving me nightmares. I am trying get the Win32 client to launch into full screen but I don't know where in the source code I need to place it exactly.
I know the code is:
<br />
SetWindowPos(..)<br />
GetSystemMetrics(SM_CXSCREEN / SM_CYSCREEN)
It's just finding the place on the source code to place it.
Thanks
Andrew McIntyre
|
|
|
|
|
MrMcIntyre wrote: It's just finding the place on the source code to place it.
You need to put this in your OnCreate() procedure, i.e. where you handle the WM_CREATE message.
|
|
|
|
|
I don't get it.
So the full screen code should go where the WM_CREATE message is.
Andrew McIntyre
|
|
|
|
|
MrMcIntyre wrote: I don't get it.
Look, Andrew, you are never going to make any progress with this until and unless you sit down with some study materials and learn how Windows programs work. None of this stuff is hugely difficult once you get to understand things like Windows handles, messages, callbacks, user interaction etc. But, there is a learning curve, and unless you follow that route most of the answers you get here will be meaningless. And, believe me, everyone who answers these posts has had to go through that learning and hard work, to get to where they are now.
A little pain now will pay huge dividends in the long term.
|
|
|
|
|
Hi Richard,
It's just one slight problem with the display of the full screen.
<br />
hwnd = CreateWindowEx(<br />
WS_EX_CLIENTEDGE,<br />
g_szClassName,<br />
"My Project",<br />
WS_POPUP,<br />
CW_USEDEFAULT, CW_USEDEFAULT, 1062, 735,<br />
NULL, NULL, hInstance, NULL);
Andrew McIntyre
|
|
|
|
|
MrMcIntyre wrote: CW_USEDEFAULT, CW_USEDEFAULT, 1062, 735,
You are specifiying a fixed window size of 1062x735. If your screen is bigger than this (as mine is) then it does not fill it. Leave these values at the default and just change yor ShowWindow call to
ShowWindow(hWnd, SW_MAXIMIZE);
|
|
|
|
|
Take a look at this sample[^] which may help you in your quest. Note carefully the suggestions when you run the program and use them. Remember that all the tools suggested are there to help you succeed in your quest, but nothing comes without a cost. And when you have mastered all these arcane subjects please remember to share them with future generations.
|
|
|
|
|
Richard MacCutchan wrote: A little pain now will pay huge dividends in the long term.
Don't lie to me like that, Richard. I'm still waiting...
"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
|
|
|
|
|
Okay, I need to apologize to people who I have given a bad time and I truly regret it because I need your help with problems with the project that I can rely on you guys to help.
I have been trying to get this to work but its giving me nightmares. I am trying get the Win32 client to launch into full screen but I don't know where in the source code I need to place it exactly.
I know the code is:
<br />
<br />
SetWindowPos<br />
<br />
<br />
|
|
|
|