|
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
|
|
|
|
|
I guess you are referring to using the "Wizards"? Try deleting files like the "Class Wizard" file and other intermediate files. <projectname>.ncb, .clw if they exist.
Jethro63 wrote: They are all writable.
or
Since they are all writable you could use the Text Wizard.
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
Hi Mike:
Yes, that worked. Thank you.
Suffice to say that this is a bug in Visual Studio?
Mark
|
|
|
|
|
Jethro63 wrote: Suffice to say that this is a bug in Visual Studio?
No... it's a feature designed to make you slow down to increase the quality of your work!
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
Hello guys,
I want to pass specific command line parameters to my application, when user
right clicks on a file(of any type), then selects Open with line and
then selects my application.
Which registry entries do I have to add ?
Thanks.
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
-- modified at 16:11 Tuesday 16th May, 2006
|
|
|
|
|
Giorgi Moniava wrote: In this case the command line parameters I have set in the registry, when I registered the file extension are not passed to my app.
Are you sure they are still in the registry?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
|
Odd. I just created an SDI application, modified the registry entry so that additional command-line parameters were passed in, and ran the application. I ran it once by double-clicking the associated file, and again by right-clicking the associated file and selecting Open With. In both cases, the additional command-line parameters were used.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
|
Giorgi Moniava wrote: ...and then select my application then I get the problem.
At this point right here, do the correct registry entries exist? If they do, I'm not sure what the problem is.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
There is any program from Ms Visual Studio 6 or .. ?
|
|
|
|
|
"graphics" ? Please specify.
VS has a Icon and Bitmap editor. Not all that great but without knowing specifically what you are trying to accomplish.....
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
make my own button "picture" (make a button look as Circle or oval) make the whole window of application another shape than rectangle
|
|
|
|
|
This is a very broad topic. The first part would be to get the graphics themselves. You can download them or create them using the VC bitmap editor or use a third party editor depending on your preferences. It is beyond the scope of these forums to discuss graphics creation.
Your best bet will be to get the graphics in .bmp format. Then browse the button classes on this site there are a whole bunch that will display bitmap buttons and select one for your needs and follow the instructions there.
As for reshaping the window, for Win2K or higher you could use layered windows and a transparent color key or you could use SetWindowRgn to set the window to a specific shape.
|
|
|
|
|
Immunity18 wrote: ...make the whole window of application another shape than rectangle
See here.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
Hi to all...
I want to create a timer in visual c++ (without using the class CWnd)that periodically send a message (for example a string). How is the best solution?
I thought....create a thread that stay in sleep and after this time sleep send the message...
I'll wait for any suggetion..
thanks!!
|
|
|
|
|
see the API CreateTimerQueueTimer
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
My suggestion is to use a waitable timer.
You create a waitable timer with a call to ::CreateWaitableTimer()[^].
Wait for the timer to be signalled with ::WaitForSingleObject() or similar.
If you're using a secondary thread you may want to stop the timer and exit the thread.
I suggest you signal an event for that, created with ::CreateEvent().
Unless you're familiar with multithreading I suggest you read Joe Newcomer's article[^] on the subject to avoid the most common pitfalls, such as avoiding ::sleep() as the plague and never call GUI related stuff from a worker thread.
Hope this helps
--
Roger
It's supposed to be hard, otherwise anybody could do it!
Regarding CodeProject: "resistance is pointless; you will be assimilated"
|
|
|
|