|
I am working win WinAPI (not MFC!). Created RichEdit control and it works fine except one small problem. If user select some text in RichEdit control and hit Ctrl+C - nothing goes to clipboard.
Here is creation code:
if (SearchPath(NULL, "RICHED32.DLL", NULL, sizeof(sBuf), sBuf, &s)>0) {<br />
hRE_Lib = LoadLibrary("RICHED32");<br />
} else if(SearchPath(NULL, "RICHED21.DLL", NULL, sizeof(sBuf), sBuf, &s)>0) {<br />
hRE_Lib = LoadLibrary("RICHED21");<br />
} else {<br />
hRE_Lib = NULL;<br />
}<br />
if (hRE_Lib == NULL) {<br />
MessageBox(NULL, "Can not find RichEdit library!", "Error!",<br />
MB_ICONEXCLAMATION | MB_OK);<br />
return 0;<br />
}<br />
<br />
hRichEdit = CreateWindowEx(<br />
WS_EX_CLIENTEDGE,<br />
"RICHEDIT", "",<br />
WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL |<br />
ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN | ES_READONLY,<br />
1,1,50,100,<br />
hwnd, NULL,<br />
(HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE),<br />
NULL);<br />
<br />
if(hRichEdit == NULL) {<br />
MessageBox(NULL, "Rich Edit Creation Failed!", "Error!",<br />
MB_ICONEXCLAMATION | MB_OK);<br />
return 0;<br />
}<br />
SendMessage(hRichEdit, WM_SETFONT, (WPARAM)hFont, (LPARAM)TRUE);<br />
Right now, I am thinking about using
SendMessage(hRichEdit, EM_SETEVENTMASK, (WPARAM)NULL, (LPARAM)ENM_KEYEVENTS);
with some code in WndProc which would wait for Ctrl+C and send selected text from RichEdit to clipboard. But may be problem can be fixed more easy?
BTW Ctrl+A already works in my RichEdit control, so I do not understand why Ctrl+C do not work by default. There is only simple text. I am adding it by command SendMessage(hRichEdit, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)TextBuffer);
|
|
|
|
|
Hi Folks,
I have a little problem..
I created an MFC app wizard application and ran it successfully...
The problem is when i add some header (.h files) along with their implementatio files(.cpp) to the project while compiling follwing error message is displayed...
indicating error in implementation files...
fatal error C1010: unexpected end of file while looking for precompiled header directive
MapNode.cpp
I have seprately compiled and tested these files successfully.. but the problem occurs when i add these files to my project....
Waiting for your response...
Regards,
JinBaba
|
|
|
|
|
|
|
Hi,
Can anyone tell me if it is possible to check if a program is running remotely ( using remote desktop ) or locally.
Is there any win32 API calls to detect this?
regards,
Easen.
|
|
|
|
|
BusaBird wrote: Can anyone tell me if it is possible to check if a program is running remotely ( using remote desktop )...
Sure. Once you have access to the other machine's desktop, simply open Task Manager.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Can a program detect this automatically?
I ve written a program to be used only locally. I want to detect if someone try to start it using remote desktop. If this is the case, the program must show an error message and close it self.
I know that there are ways to do it using the Windows 2003 access settings. But I need the program to detect it automatically.
-- modified at 4:54 Monday 17th April, 2006
|
|
|
|
|
I do not currently know of a way for a program to detect if it is running locally or from within Remote Desktop.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
When Visual Studio creates a Dialog Based C++ program it creates projectDlg.cpp and projectDlg.h.
How can a global function call a member function of the projectDlg class?
The glogal function is defined in projectDlp.cpp.
Thanks,
Kevin
|
|
|
|
|
EW_dude wrote: How can a global function call a member function of the projectDlg class?
get an instance of that object type, or make the member function static .
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
I tried the static approach. static void disp();
But to get the global function to compile I had to type
projectDlg::disp(); Got it to compile.
But now disp() doesn't see any of the variables of the class. I get "illegal reference to non-static member" when I try to set a variable.
Any ideas?
|
|
|
|
|
EW_dude wrote: But to get the global function to compile I had to type
projectDlg::disp(); Got it to compile.
Of course. This is how static member functions work.
EW_dude wrote: But now disp() doesn't see any of the variables of the class.
Because they are not static . Read up on what static means in a class.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
EW_dude wrote: Any ideas?
give your global function a pointer to the dialog. the very simplest way to do this is to just create a global variable to hold that pointer, then have your dialog set it (maybe in the dialog's constructor - and be sure to set that pointer to NULL when the dialog goes away)
then you can do:
CMyDialog *g_pDialog = NULL;
void MyGlobalFuncion
{
if (g_pDialog)
g_pDialog->memberFunction();
}
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
No matter what types of project (dialog based, Doc/View ...) you are working or what types of tools (VC++, C++ Builder, ...) you are using, you are using the C++ Language. Everything just follows the rule of the C++ Language.
So you may just search for where the auto variable of type class CProjectDlg is. And then you know what to do.
For example:
void g_MyGlobalFunction(CProjectDlg* p) { }<br />
CProjectDlg* g_pTheDlg = NULL;<br />
BOOL CProjectApp::InitInstance(void)<br />
{<br />
CProjectDlg dlg;<br />
g_pTheDlg = &dlg;<br />
dlg.DoModal();<br />
}<br />
Maxwell Chen
|
|
|
|
|
Is there a way to move a file to a different folder based on its file extension only? I want to move by the file's extension is because the program I wrote in C++ will create a file with the current date and time as its filename. I was wondering if any C++ functions would do that or any other alternatives.
Thanks in advance!!!
Lynniz
|
|
|
|
|
|
I actually figured out an alternative way. I am using the Gdal Library with C++. Instead of declaring a name for the file at the beginning, I directed the file to the destination folder first and then named it. It might sound little confusing since I am not using straight C++.
I would still like to know if there is a way to move the file by extension only in C++.
Thank you,
Lynniz
|
|
|
|
|
Lynniz wrote: I would still like to know if there is a way to move the file by extension only in C++.
I concur with Chris' suggestion.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Thank you guys, I will try that method too.
Lynniz
|
|
|
|
|
|
Just upgraded to VS2005 from VS 2002. What an ugly, distracting environment - but I'll get used to it.
Right now the one thing I'm stuck on are the "expand/contract" icons that appear in the source code. They are eyesores. But I can't figure out how to turn them off - does anyone know?
Thx
|
|
|
|
|
You mean Code Outlining?
Try Tools / Options / Text Editor / 'C/C++' / Formatting and then turn off 'Enter Outlining Mode When Files Open'
Gavin Taylor
w: http://www.gavspace.com
|
|
|
|
|
In VS, go to Tools -> Options. Select Text Editor -> C/C++ -> Formatting. Uncheck "Enter outlining mode when files open".
You can close and reopen VS to reset outlining in all open docs, if you want.
Remember that you can toggle outlining for the current document with Edit -> Outlining -> (Stop Outlining) or (Start Automatic Outlining).
--
I've killed again, haven't I?
|
|
|
|
|
Thanks to all for the replies. Turns out the correct option is the "Selection Margin", which makes no sense to me (I had already turned off all of the other suggested options)
|
|
|
|
|
Actually, the "Selection Margin" option controls just that--the selection margin. In addition to removing the outlining controls (which lie in the selection margin), removal of the selection margin also removes the selection margin itself.
The presented solutions remove just the outlining controls as requested.
--
I've killed again, haven't I?
|
|
|
|