|
For your b) question, here's how:
HWND hwnd = ::FindWindow(NULL,"PCTV Vision");
Then you can call PostMessage using hwnd
For alt+f4, you could just use ::PostQuitMessage(0);
I am not sure at all on how to send (i.e: CTRL+M), but if PostMessage(hwnd, WM_CHAR, WPARAM('^'), LPARAM(M)); works, then PostMessage(hwnd, WM_CHAR, WPARAM('!'), LPARAM(R)); would do the job.
One more thing. If you are coding an MFC application, you will need to add ' :: ' in front of your PostMessage's and FindWindow's, since you want to play with HWND values, and not CWnd
Michael
|
|
|
|
|
Where do I start? I'm sure there's some interface or class that does the job...!
Thanks!
---------------
Tired of Spam? InboxShield for Microsoft® Outlook® 2K/2K2/2K3
http://www.inboxshield.com
|
|
|
|
|
(Extended) MAPI, SMTP, and CDO are good places to start.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Are you trying to make a virus, kinda like the one which broke out and literally slowed down the internet, do you believe, THE INTERNET but no it was reworded incorrectly, they probably meant were gonna sue the ass off of the person responsible for this cause we couldn't spam anyone out ... The email servers...
Extra! Extra!
http://www.cnn.com/2004/TECH/internet/01/27/mydoom.spread/index.html[^]
Actual Linux Penguins were harmed in the creation of this message.
|
|
|
|
|
i'm totally lost on this.
How can I access variables from each page at the CPropertySheet level?
I have a modeless CPropertySheet running with 4 pages contained within - all pages really simple.
I have created my own "Save" and "GO" buttons that exist on the CPropertySheet. "Save" is supposed to collect all the values from the pages and fill a class structure visible at CPropertySheet level. "GO" calls save and then performs a function using the values saved in the class structure.
Any Help?
Johnny
Here is a snap-shot of my declarations (abbreviated for space)
class CFilePageDlg : public CPropertyPage
{
public:
bool UpdatePageData(bool bFromPage);
bool GetInputPathname(CString* szPathname); // tried w/o * also
private:
CString m_szInputPathname;
// other class stuff
}
class CConfigPropSheet : public CPropertySheet
{
public:
CFilePageDlg m_FilePage; // page 1
protected:
//{{AFX_MSG(CConfigPropSheet)
afx_msg void OnSaveConfigSettings();
afx_msg void OnGO();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
CButton m_btnGo;
CButton m_btnSave;
};
// sample functions
bool CFilePageDlg::UpdatePageData(bool bFromPage)
{
CString szTemp;
if (bFromPage)
{
UpdateData(TRUE); // update variables from controls
m_editFileInputFilename.GetWindowText(m_szInputPathname);
}
return true;
}
void CConfigPropSheet::OnSaveConfigSettings()
{
CString szTemp;
m_FilePage.UpdatePageData(TRUE);
m_FilePage.GetInputPathname(&szTemp);
}
|
|
|
|
|
When the OK button is clicked, only those pages that were actually created will have valid/changed data on them. Therefore, you should override the OnOK() method in each page's class and do any saving (e.g., file, data structure) from there.
When does CConfigPropSheet::OnSaveConfigSettings() get called. m_FilePage.UpdatePageData(TRUE) relies upon the m_FilePage window to still exist.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Ok, I made the individual page member variables Public and then just accessed directly at the CPropertySheet level -- all worked! but why?
Johnny
class CFilePageDlg
{
Public:
CString m_szInputPathname;
};
void CConfigPropSheet::OnSaveConfigSettings()
{
MessageBox( m_FilePage.m_szInputPathname, "File Page Var", MB_OK );
}
// I also tried making the page's vars STATIC, but
|
|
|
|
|
Hey, folks.
All I wanted to do was...
I have a property page on a wizard, standard login with two edit controls, username and password. We default the username in some cases. The desired behavior is to set focus to the password if the username has text. Since we're in wizard mode, the user can back / next and hit this page multiple times, so calling SetFocus to the password field in OnInitDialog() would be insufficient.
So, naturally, I put it in OnSetActive(). Focus gets reset to username sometime after this function returns. Tried putting SetFocus in OnActivate(). Same results. Grepped the MFC code looking for SetFocus / SetCurSel calls. No dice. Burned incense. Sacrificed chickens. Still, the username (the first field in tab order), gets focus & text is highlighted whenever this page is displayed.
Anyone here fought this battle before? I'm running out of chickens, and nobody here likes my cooking anyway...
Thanks -
Christopher Duncan
Today's Corporate Battle Tactic
Unite the Tribes: Ending Turf Wars for Career and Business Success
The Career Programmer: Guerilla Tactics for an Imperfect World
|
|
|
|
|
Christopher Duncan wrote:
so calling SetFocus to the password field in OnInitDialog() would be insufficient
Hmm.. I think the return value of OnInitDialog() affects which control gets focus. If you create an ordinary dialog and override OnInitDialog(), the following code is emitted in the function body:
return TRUE;
Have you tried returning FALSE?
--
Try walking in my shoes. You stumble in my footsteps.
|
|
|
|
|
Hey, Jörgen.
Jörgen Sigvardsson wrote:
Hmm.. I think the return value of OnInitDialog() affects which control gets focus.
Problem is, since this is a wizard, OnInitDialog does not get called every time the user navigates to this page. It's called only once, when the page is created. Typically, that's what OnSetActive is used for, but in this case even that doesn't work.
However, I think I'll try returning FALSE when I get to the office tomorrow just for the heck of it. Heaven knows I'm running out of ideas here, short of some really ugly hacks...
Thanks, man.
Christopher Duncan
Today's Corporate Battle Tactic
Unite the Tribes: Ending Turf Wars for Career and Business Success
The Career Programmer: Guerilla Tactics for an Imperfect World
|
|
|
|
|
Howbout just calling SetFocus() when and for the control you want the focus on?
|
|
|
|
|
Ernesto D. wrote:
Howbout just calling SetFocus() when and for the control you want the focus on?
Yep, that's what I have in mind. The tricky part is when and where. Typically, you'd do your initialization work in either OnInitDialog or OnSetActive, but focus is set to the first control in the tab order after both of these have returned.
Christopher Duncan
Today's Corporate Battle Tactic
Unite the Tribes: Ending Turf Wars for Career and Business Success
The Career Programmer: Guerilla Tactics for an Imperfect World
|
|
|
|
|
trying to create a CFrameWnd frame window as a child of a mainframe ( like other child frame windows and views )
m_pChildGridFrame->LoadFrame( ID_RESOURCE, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, this );
The frame is created, but not at the same level as the other windows, I can't put my other views on top of that one.
I'm pretty sure the "parent window" is not the good one.
Thanks.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Won't you have to add the WS_CHILD style?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hello, a while ago I planned on programming with c/c++. The problem was the compiler. Now I have one but when I make just a simple program like: "hello world" the DOS screen will apear for just very short. Then it closes itself. I was thinking maybe it was logical because you just tell him to show "hello world" and then it quits by itself. So I made a program were you had to put 2 numbers in variables. I entered 2 numbers and pressed ENTER and the same thing happens. Does anyone know how to solve this?
Thomas
|
|
|
|
|
Hello!
Try to use getch() or _getch() at the end of the code.
This application quits, becuase there is no loop. So either solution is to create a loop.
|
|
|
|
|
Try using getch() after your final input
|
|
|
|
|
it's not a problem...
If you run your application from VC with Ctrl+F5 you will see the message, and then you must to press a button to close it.
When you run your application for example in debug mode, the VC creates the console and close it when the app finish.
If you like, you can run your app from command line, and you will see when the app finish the cursor returns to the prompt...
Carlos Antollini
Do you know piFive[^] ?
|
|
|
|
|
I like to use this (at the very end of your program, before the return of the main function):
system("pause");
Actual Linux Penguins were harmed in the creation of this message.
|
|
|
|
|
or you can add a cin>> at the end like I do
|
|
|
|
|
Is it possbile to add controls to a CDialog based class at runtime? It was easy enough in MC++ with the controls property of a form. Is there something similar for CDialog? Thanks.
- monrobot13
|
|
|
|
|
Hello!
Simply create required wnd class with parent set to the dialog and place it somewhere inside dialog (in order to see the control). See for example CEdit::Create(). Created window may have to be shown by CWnd::ShowWindow()
Tell me if you want more detailed description.
|
|
|
|
|
I sort of understand, but would appreciate a more detailed description, like how would I specify where in the dialog I want the control located (coordinates). Thanks again.
- monrobot13
|
|
|
|
|
// CtesttestDlg message handlers
CEdit *pEdit = NULL;
BOOL CtesttestDlg::OnInitDialog()
{
CDialog::OnInitDialog();
pEdit = new CEdit;
pEdit->Create(WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER, CRect(10, 10, 100, 100), this, 10005);
pEdit->ShowWindow(SW_SHOW);
...
and I know, I know...it should not be a global variable, and should be deleted somewhere, but this is only a sample :P
|
|
|
|
|
Makes sense, I'll give it a go. Thanks for the help.
- monrobot13
|
|
|
|