|
Hi,
I have noticed that some programs can get the contents of a selection, and do something with it one a global hotkey is pressed.
Some of them are spell checkers that will spellcheck the selected word in almost any application, some of them are telephony applications that will try to dial the selected text as a telephone number.
Does anybody know how to do this?
I have tried to get numerous samples, including the PC Magazine Robotype, but this program only knows which text that has been written.
Any help would be greatly appreciated!
Thank you for reading this far
Christian Skovdal Andersen
|
|
|
|
|
To get HWND, use GetForegroundWindow (not GetActiveWindow). Then, you can check if it's edit or richedit control, and if this is the case, grab the text with EM_GETSEL.
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
Glad to see your response. I have been looking for an answer to a similar question for a while! Can you tell me how to get to the selected text if the foreground window is not itself a edit control or richedit control but contains such controls? What about accessing a selected text in IE browser? Would appreciate very much your answers to these questions!
Gene Yu - gene4yu@yahoo.com
|
|
|
|
|
Hi!
I need to know the font's the user has set (Desktop - Right Mouse Button ->Properties->Third tab from left... I'm doing a custom control and need the font's to share the common appearance
|
|
|
|
|
Something like :
<br />
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);<br />
hFont = CreateFontIndirect(&ncm.lfCaptionFont);<br />
There are other fonts in ths struct, I don't know which one you need.
|
|
|
|
|
Hi
anybody can help me figuring out how to learn the scroll bars "arrow buttons" size? I need to use these and user paint ALL the stuff in between as well as handle all the mouse input. How can I get the exact size of these arrow?
Thanks
|
|
|
|
|
SystemParametersInfo() should give you that information. Probably the SPI_GETNONCLIENTMETRICS action.
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
GetSystemMetrics()
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I'm trying to show an Open File dialog but it won't show and i can't figure out what i'm doing wrong, here's the code:
{
OPENFILENAME ofn;
char szFileNames[(MAX_PATH+1)*1000+2];
const char szFilter[] = "MP3 Files (*.mp3)\0" "*.mp3\0";
szFileNames[0] = 0;
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = ghWnd;
ofn.lpstrFilter = szFilter;
ofn.lpstrCustomFilter = (LPSTR)NULL;
ofn.nFilterIndex = 1;
ofn.lpstrFile = szFileNames;
ofn.nMaxFile = sizeof(szFileNames);
ofn.lpstrFileTitle = NULL;
ofn.lpstrTitle = (LPSTR)NULL;
ofn.Flags = OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_ALLOWMULTISELECT | OFN_EXPLORER;
ofn.nFileOffset = 0;
ofn.nFileExtension = 0;
ofn.lpstrDefExt = "mp3";
GetOpenFileName(&ofn);
Thanks in advance
-Rune Svendsen
|
|
|
|
|
The dialog shows O.K. for me. The only diference was I tested it with hwndOwner set to NULL. Is the owner window (ghWnd) valid and displayed window?
Sonork 100.15206;PavelK
|
|
|
|
|
I'm making a little program using VC++.net these days. But when I run my program(.EXE) on a computer without VC++.net installed, it asks for msvcr70.dll, so that I have to put this DLL together with that program. This troubles me a lot. The Property Sheet of my project has been checked carefully, what else could I do?
Thanks a lot for any hint.
Tiny Flying Elephant loves flying...
|
|
|
|
|
Well, they have to have .NET framework installed. It can be downloaded from Microsoft[^]
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|
|
You can deploy your program using the Deployment Wizard in Visual Studio, then merge the VC++ Redistributable Merge Module with you setup files.
|
|
|
|
|
The Visual C++ merge module can be found in \Program Files\Common Files\Merge Modules
There you choose the vc_crt.msm file (200KB)...
|
|
|
|
|
:|I am still having trouble trying to print in landscape. Below is my latest code which does not print or change the page to landscape. Any suggestion would be appreciated. I think I feel like a mouse going around in circles.
The code seems to give me a new device context but it does not seem to print.
void CLogbookView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
{
pDC = SetLandscape(pDC);
pDC->TextOut(100,100,"test");
}
CDC* CLogbookView::SetLandscape(CDC* pDC)
{
BOOL bStdSetUpDlg = TRUE;
CWnd *pWnd = this;
CPrintDialog pPrintDialog(bStdSetUpDlg,PD_USEDEVMODECOPIES ,pWnd);
pPrintDialog.GetDefaults();
LPDEVMODE pDEVMODE = pPrintDialog.GetDevMode();
pDEVMODE->dmOrientation = DMORIENT_LANDSCAPE;
pDC->m_hDC = pPrintDialog.CreatePrinterDC();
return pDC;
}
Desmond Mardle
|
|
|
|
|
Take a look at my article www.codeproject.com/printing/printerselect.asp
It covers switch landscape/portatit mode and a host of other features
If your still stuck, e-mail me direct.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
I have
_variant_t tempkeyValue = new _variant_t[20];
but when I go to do
delete[] tempkeyValue;
I get the error:
C:\Trainer\DB2\DbClass.cpp(204) : error C2440: 'delete' : cannot convert from 'class _variant_t' to ''.Ambiguous user-defined-conversion.
How can I get rid of the pointer fter I'm through with it?
Thanks,
ns
|
|
|
|
|
You need a pointer variable :
_variant_t *tempkeyValue = new _variant_t[20];
Sonork 100.15206;PavelK
|
|
|
|
|
Oops!So I did. The weird thing is. my code actually worked without declaring it a pointer, except for the delete.
Now I have:
_variant_t *tempkeyValue = new _variant_t[20];
*tempkeyValue = m_pRecordset->Fields->GetItem (key)->Value;
strcpy(keyValue,(char *) (_bstr_t)*tempkeyValue);
AfxMessageBox((char *) (_bstr_t)*tempkeyValue);
AfxMessageBox((char *) (_bstr_t)m_pRecordset->Fields->GetItem (key)->Value);
delete[] tempkeyValue;
which is fine, but I had:
_variant_t tempkeyValue = new _variant_t[20];
tempkeyValue = m_pRecordset->Fields->GetItem (key)->Value;
strcpy(keyValue,(char *) (_bstr_t)tempkeyValue);
AfxMessageBox((char *) (_bstr_t)tempkeyValue);
AfxMessageBox((char *) (_bstr_t)m_pRecordset->Fields->GetItem (key)->Value);
and it gave the right values in both messageboxes.
Is that to be expected or some weird coincidence?
Apprecite your reply tremendously. I was starting to thing _variant_t varaiables were a different beast as far as delete goes...
ns
|
|
|
|
|
This is a side-effect of conversions (1 argument) constructors and conversions operators...
A _variant_t can be converted to a VARIANT * implicitly by the defined conversion operator and this allows some misuse to go undetected...
Conversion operators are cool in general but very dangerous particulary when the returns pointers to internal data.
Philippe Mori
|
|
|
|
|
a how can I respond Enter Event in a editbox?
I have a editbox,and I want to make it do sth. like this: when the Enter key was press,other controls in the dialog can get the value in it,then the editbox clean up the value,nd wait the next input.
how can I make this ? Anyone can give me a clear answer?Thanks.
YES, I am here.
|
|
|
|
|
Here is one solution.
-create editbox
-add a button
-set button as default button
-when the user presses Enter, the button is press
-now you can do whatever you want including clear editbox
Kuphryn
|
|
|
|
|
I know this solution,but that's it,I don't want to add a button.I just want to respond the Enter Key.so...
YES, I am here.
|
|
|
|
|
You can derive your own edit control from CEdit and overide handling of keyboard messages. Then You can send a custom notification message to the parent window (dialog, form). See the edit control section here at CP for inspiration.
Sonork 100.15206;PavelK
|
|
|
|
|
Hello, the codegurus around the world.;)
This is one of the famous questions in MFC.
If you push Enter key, the dialog will be closed.
One solution is that you can trap Enter key message by PreTranslateMessage
before Enter Key message sends to the dialog.
And you can check if EditBox actually get the input focus in PreTranslateMessage.
Also, Paul Deliacia(?) posts his article in this question in MSDN magazine.
Please, don't send me your email about your questions directly.
Have a nice day!
Sonork - 100.10571:vcdeveloper
-Masaaki Onishi-
|
|
|
|