|
Maxwell Chen wrote: But when I issue color FF, it resets to system color!
Both BG and FG cannot be the same. Try FA or 2F and then FF . Nothing happens.
Use Color without any parameters to restore to default.
Nibu thomas
Software Developer
Faqs by Michael dunn
|
|
|
|
|
Nibu thomas wrote: and then FF. Nothing happens.
You're right!
Maxwell Chen
|
|
|
|
|
#include <string>
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
using std::string;
int main()
{
string s;
cout << "Enter your name: ";
cin >> s;
cout << endl << "Your name is " << s << endl;
cout << "Press enter to end this wonderful journey";
cin >> s;
}
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
I'm after C++ examples of how to allow the user to record mouse and keyboard events inside an application. The recorded events can then be saved to a file so that they can be play-back at a later date. A macro facility in other words. Can anyone help me with this? I'm using Visual C++ 6. .
Thanks lots.
Choppa
|
|
|
|
|
Chopper Dang wrote: I'm after C++ examples of how to allow the user to record mouse and keyboard events inside an application.
It's a long story. Take a look at WH_JOURNALRECORD and WH_JOURNALPLAYBACK . Kyle Marsh has written an interesting article on Hooks . Look up that in MSDN .
Chopper Dang wrote: then be saved to a file so that they can be play-back at a later date
Well I am not sure about saving it to file!
Nibu thomas
Software Developer
Faqs by Michael dunn
|
|
|
|
|
Thanks for your reply Nibu. I'm actually looking for events within my own application (very much like in MS Office apps). WH_JOURNALRECORD and WH_JOURNALPLAYBACK seem to record every event that happen within the system, and I dont know how to filter them out.
|
|
|
|
|
Chopper Dang wrote: I'm actually looking for events within my own application (very much like in MS Office apps).
Maybe you can tweak them a bit to suit your needs.
Or try these functions to find out what's happening and log these into a file and later through code play them back...
GetCurrentMessage
PeekMessage
GetQueueStatus
Nibu thomas
Software Developer
Faqs by Michael dunn
|
|
|
|
|
I have a CFormView (IDC_FORM_VIEW) and I have a CStatic resource
which I call m_boundingFrame.
I have a screen full of information in a dialog resource (IDC_CONTENT1).
How can I make that dialog resource appear in the boundingFrame of
the CFormView?
I can do this if its a propertysheet and then put in propertypages,
but I just have a single dialog resource which I want to display
in that boundingFrame. Im stumped on getting it to actually work.
My code for the propertysheet is below, but I cant figure out to
modify that code to work with the dialog resource that I have.
CWnd* pwndPropSheetHolder = GetDlgItem(IDC_PLACEHOLDER);
m_pPropertySheet = new CView10PropertySheet(pwndPropSheetHolder);
if (!m_pPropertySheet->Create(pwndPropSheetHolder, WS_CHILD | WS_VISIBLE, 0))
{
delete m_pPropertySheet;
m_pPropertySheet = NULL;
return;
}
// fit the property sheet into the place holder window, and show it
CRect rectPropSheet;
pwndPropSheetHolder->GetWindowRect(rectPropSheet);
m_pPropertySheet->SetWindowPos(NULL, 0, 0,
rectPropSheet.Width(), rectPropSheet.Height(),
SWP_NOZORDER | SWP_NOACTIVATE);
Please, any response any one can give me will be greatly appreciated.
Sincerely,
Danielle Brina (an overworked graduate student)
|
|
|
|
|
DanYELL wrote: I have a screen full of information in a dialog resource (IDC_CONTENT1).
How can I make that dialog resource appear in the boundingFrame of
the CFormView?
Well you can load the dialog resource using the CDialog class or a subclass of CDialog and set this dialog as a child of the CFormView . Remove the caption bar , system menu and make it look like a group box. Don't make it a popup but a simple child window.
Nibu thomas
Software Developer
Faqs by Michael dunn
|
|
|
|
|
OK, My boss wants me to do this thing where I find a specific browser window and then force it to load a new web page.
Is this possible?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
I think it's possible. Can you be a bit clearer? For example what's specific about the "a specific browser window"?
Steve
|
|
|
|
|
Here's the scenario:
(1) you come to our website via web browser.
(2) you download and install our software.
(3) software starts up, wizard runs...
Upon completion of the wizard, he wants the browser window from step 1 brought to the front directed to load another page from our site.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
-- modified at 0:25 Wednesday 17th May, 2006
|
|
|
|
|
I just developped a directshow source filter which can decode 3gp songs. My question is that how to register this source filter so that windows media player can recognize 3gp files, and play the song directlly? Thanks.
|
|
|
|
|
Hello everyone,
this is a sounds-so-simple gray hair maker. Please help out:
A single line edit control on my dialog contains So far nothing complicated. Now:
On an event I would like to add some long text at the cursor position, give the edit box the focus, select the whole text of the edit control ***AND** I would like to see the beginning of my long selected text ...
CEdit *pEdit = (CEdit *)GetDlgItem(IDC_EDIT1);
pEdit->ReplaceSel("This is some long and rather useless test text");
pEdit->SetSel(0, -1);
pEdit->SetFocus();
The problem is that the SetSel scrolls the edit box to the end of the selection. Is there a way to scroll to the beginning without loosing the selection?
If you know the length of the selection, you may do both .SetSel(Start, End) or .SetSel(End, Start) but always the caret and the scroll will be at the end of the selection.
WM_HELP
Thomas
|
|
|
|
|
Thomas Blenkers wrote: pEdit->SetSel(0, -1);
pEdit->SetFocus();
SetSel has one more parameter which is a default one. Does that help you? Look up the docs.
Nibu thomas
Software Developer
Faqs by Michael dunn
|
|
|
|
|
Thanks, Nibu,
yes I do read docs before asking The third parameter is called bNoScroll and according to the docs it should scroll or not the caret into view. But this is not the point, since I tried both versions. Both get the same result: the edit box is completely selected with the end portion of the text being shown.
My guess is that the problem lies in the line of code before the SetSel:
CEdit *pEdit = (CEdit *)GetDlgItem(IDC_EDIT1);
pEdit->ReplaceSel("This is some long and rather useless test text");
pEdit->SetSel(0, -1);
pEdit->SetFocus();
The ReplaceSel will put the caret to the end of the edit windows and scrolls the text to the end. Already I have played around with the edit box scrolling functions to no avail. As I said, its making you gray hairs!
Regards
Thomas
|
|
|
|
|
Thomas Blenkers wrote: CEdit *pEdit = (CEdit *)GetDlgItem(IDC_EDIT1);
pEdit->ReplaceSel("This is some long and rather useless test text");
pEdit->SetSel(0, -1);
pEdit->SetFocus();
CEdit *pEdit = (CEdit *)GetDlgItem(IDC_EDIT1);
pEdit->SetSel(0, -1);
pEdit->ReplaceSel("This is some long and rather useless test text");
CString csText;
pEdit->GetWindowText(csText);
pEdit->SetWindowText(csText);
pEdit->SetFocus();
This should help although it doesn't look good.
Unless another suitable option is found you can use this.
Nibu thomas
Software Developer
Faqs by Michael dunn
|
|
|
|
|
Nibu,
once again, thanks and great work. This will work as long as indeed I choose to select all of the edit box.
In my real application I'm doing some autocompletion so I want a first part of the edit text not selected while my recenty added text is selected.
Maybe its my fault that my given lines of code were too much siplified to express this contraint. If you have further ideas, I would be really happy.
Regards
Thomas
|
|
|
|
|
Thomas Blenkers wrote: In my real application I'm doing some autocompletion so I want a first part of the edit text not selected while my recenty added text is selected.
So no problem. You first do whatever replacement or other stuff that you wish to do.
Then do GetWindowText and SetWindowText . I know that's not a natural solution.
But here are some other functions that I would like to bring to your notice...
SetCaretPos --> CWnd
PosFromChar --> CEdit
I tried these two but the caret didn't move. But you can try. Maybe you can make it work.
Nibu thomas
Software Developer
Programming Tips[^]
|
|
|
|
|
I'm developing some code to use the OLE automation features of Outlook and at runtime I'm getting an exception of 'Member Not Found'. Oddly this is occurring when I call the method GetCount() on a _Items class object. Now Intellisense and the .h/.cpp files tell me that such an animal exists, but since it is happening at runtime, I'm thinking I've ventured down DLL hell somehow. The offending code is
_Folders olFolders = olNs.GetFolders();
long nFolderIndex = 1;
long nFolderCount = olFolders.GetCount();
for ( ; nFolderIndex < nFolderCount; nFolderIndex++ )
{
_Items olItems = olFolders.Item(COleVariant(nFolderIndex));
long nItemsIndex = 1;
long nItemsCount = olItems.GetCount();
for ( ; nItemsIndex < nItemsCount; nItemsIndex++ )
{
_MailItem olMessage = olItems.Item(COleVariant(nItemsIndex));
...
Anybody got some thoughts on what to investigate here. Thanks.
Oh and if anybody has some pointers to informative websites that have examples of Outlook Automation in C++, those would be much appreciated.
Chris Meech
I am Canadian. [heard in a local bar]
The America I believe in has always understood that natural harmony is only one meal away from monkey burgers. [Stan Shannon]
GOOD DAY FOR: Bean counters, as the Australian Taxation Office said that prostitutes and strippers could claim tax deductions for adult toys and sexy lingerie. [Associated Press]
|
|
|
|
|
I've never used outlook automation, but wouldn't olFolders.Item(...) return a _Folder object? You might need to do something like:
_Folder olFolder = olFolders.Item(COleVariant(nFolderIndex));<br />
_Items olItems = olFolder.GetItems();<br />
Just a thought...
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Thanks, Steve. You could be right about that. I'll give that a go.
Chris Meech
I am Canadian. [heard in a local bar]
The America I believe in has always understood that natural harmony is only one meal away from monkey burgers. [Stan Shannon]
GOOD DAY FOR: Bean counters, as the Australian Taxation Office said that prostitutes and strippers could claim tax deductions for adult toys and sexy lingerie. [Associated Press]
|
|
|
|
|
I tested things out and interestingly, there is no class _Folder declared. However there is a declaration of a class MAPIFolder which I used in it's place and at the moment all my code is compiling and running fine. I'm still struggling in getting to process some _Message items, , but that's another exercise I guess. Thanks for the assistance, though.
Chris Meech
I am Canadian. [heard in a local bar]
The America I believe in has always understood that natural harmony is only one meal away from monkey burgers. [Stan Shannon]
GOOD DAY FOR: Bean counters, as the Australian Taxation Office said that prostitutes and strippers could claim tax deductions for adult toys and sexy lingerie. [Associated Press]
|
|
|
|
|
Greetings:
I am writing an application with Visual Studio 2003. I am using an C++ MFC Single Document Interface. My work has come to a dead stop because Visual Studio is not allowing me to add an event handler to the CMainFrame class.
It started when I added a push button to the apps main CFormView window. I wanted CMainFrame to handle it. I get an error message from Visual Studio:
"Add/remove of the function is impossible, because the parent class code is read only."
I have also tried adding a Windows message handler to CMainFrame (like WM_SIZE). Same complaint.
The "MainFrm.h" and "MainFrm.cpp" files are NOT read only. I checked their properties under Windows Explorer. Also, if I load either of these files into my editor and make a small change to them, they are saved without complaint. In fact, absolutely NONE of the files associated with this project, including sub-directories, are read only! They are all writable. I have also checked and verified that none of my source or project files have been inadvertently loaded into some other editor application.
Could somebody tell me what is going on?
Thank you,
Mark
|
|
|
|