|
No no no....software for schools!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
With LVS_ICON (80*80 icons), I add checkbox style in this way:
m_lst.SetExtendedStyle(LVS_EX_CHECKBOX);
Then checkbox appear at the left of the icon,
any way to make it appear at the left of the label, which is below the icon?
Thanks.
|
|
|
|
|
MSDN tells me only EditControl class windows provide the means to manipulate text strings displayed in their client area. EG, EM_SETSEL, EM_REPLACESEL, messages.
Which is fine, but I need a more general solution. I need to access a text string displayed in a non-EditControl type window's client area.
It's obvious such code exists, because if I double-click text string T in a text-enabled but non-EditControl class window A of arbitrary app A, T will be highlighted in most if not all cases. When I press Ctrl-C, T will be copied to the clipboard.
Some code, no doubt Windows code, located the string of highlighted characters, grabbed a copy of it, and stuck it onto the clipboard.
My question is: What do I need to know in order to write code that does the same thing under my control of my pgm? Or is such code available somewhere that I could adapt, and if so, how can I acquire it? Sometimes there are undocumented Windows routines that are available - maybe something I can use?
What do you think? Is there a simple answer I'm too inexperienced to realize - possibly as I'm a win32 intermediate newbie at best.
I've looked and looked but can't find anything helpful.
Any information, suggestions, clues, references, etc, will be very much appreciated.
Big thanks!
/glyfyx
|
|
|
|
|
Are you looking for the WM_GETTEXT message?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks for the response David.
But doesn't WM_GETTEXT only return the text of the windows title - that is, for non-EditControl class windows?
glyfyx
|
|
|
|
|
There's no built in Windows code to get text from a window AFAIK (maybe some specialized APIs that do OCR,
I thought I saw one mentioned once but I could have dreamed it).
For your non-edit control window text example, there's code written which is called by the window procedure
for the window to handle the double click message, draw the text highlighted, handle the keystroke messages for ctrl-c,
and place the selected text on the clipboard.
That's the same for an edit control. The edit control's window procedure code just happens to be written for you.
Once text is on the screen, it's just pixels, unless the software that rendered the text tracks what text is where,
or you use OCR to convert those pixels back to text.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks a lot Mark!
I understand what you're saying - that once text is onscreen, it's just pixels. I still wonder how, for example, context sensitive help works.
Suppose I have 50 pages of source code available onscreen in my IDE and I place the caret on a string *anywhere* in the code and press F1. I will get help related to the string near/on the caret. The F1 support code must somehow obtain the ansi/unicode/whatever equivalent of the onscreen string in order to lookup and return information related to the string.
The only way I imagine F1 support code can accomplish this is either:
1 - to maintain an internal text copy of the entire source code and use the caret's x,y point to map into its text-copy to the exact text equivalent of the screen's image of the string;
2 - or as you suggest, the F1 code must ocr the pixels in the immediate vicinity of the caret to decifer its string equivalent.
Somehow, neither sounds very appealing. Especially alternative 1 - wow - can you imagine having to keep the internal copy in synch with the myriad screen operations possible? Your ocr suggestion seems more reasonable (in comparison.)
Could it be that the text-entry part of an IDE is the client area of an EditControl class window, permitting F1 code to use EM_* msgs? What about all the other text-oriented applications, text editors, WPs, publishing apps, IDEs, spreadsheets, email, etc, are they all EditContol client areas?
Hmm.. maybe I should write some code to find out what are the various window classes currently running in my machine. I assume there are API calls that'll supply this information? There must be one that does that.
At any rate, I'm very happy to receive your answers even if they're not ones I'd been hoping for - much appreciated!
glyfyx
|
|
|
|
|
glyfyx wrote: 1 - to maintain an internal text copy of the entire source code and use the caret's x,y point to map into its text-copy to the exact text equivalent of the screen's image of the string;
Doesn't sound appealing but that's pretty much always the way it's done. Even the edit control does it that way.
With a fixed-pitch font, it's pretty simple. But try developing a word processor like Microsoft Word!
Just moving the caret through a variable-pitch font could be quite a programming task.
Luckily, the system provides some help with functions like GetGlyphOutline(), GetTextExtentPoint(), GetCharABCWidths() etc.
See Font and Text Functions[^]
Speaking of Microsoft Word....almost all the functionality of Word is available in the later versions of the Rich Edit Control, which
is available for us to use
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am new to threading concepts in C++/CLI.
I have a button and a label in the form and here is some code for that:
private: System::Void button1_Click(System:bject^ sender, System::EventArgs^ e) {
Form1^ f = gcnew Form1;
Thread^ myThread = gcnew Thread(gcnew ThreadStart(f, &Form1::test));
myThread->Start();
}
void test()
{
this->label1->Text = "Hi";
this->label1->Update();
}
But this code dosent update the Label.. WHY???
I have also used [MTAThreadAttribute] in my main file as:
[MTAThreadAttribute]
int main(array<System:tring ^> ^args)
{
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application:etCompatibleTextRenderingDefault(false);
// Create the main window and run it
Application::Run(gcnew Form1());
return 0;
}
Also how to call threads in other classes??
Somebody please help..
|
|
|
|
|
Try to post your question to the right forum (the Managed C++/CLI one).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
ptr2void wrote: Thread^ myThread = gcnew Thread(gcnew ThreadStart(f, &Form1::test));
That line compiles?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
The code looks as follows:
<br />
for()
{<br />
for()
{<br />
if(condition)<br />
{<br />
}<br />
}<br />
for()
{<br />
}<br />
for()
{<br />
}<br />
}<br />
If the condition is false I want to iterate the main loop without running following for loops.
How to do this?
Best Regards,
Suman
|
|
|
|
|
Just put the continue keyword if the condition is true:
if (condition)
continue;
This will go to the next iteration of the current loop.
|
|
|
|
|
Hi Thanks for the help,
continue is iterating the current loop but not the main (outer) for loop.
break will just break the current for loop but other loops following it will be executed.
The "goto" is working, if its standard way I want use it.
Thanks,
Suman
|
|
|
|
|
You can use also goto in the following manner.
:loop1 for()
{
for()
{
if(condition)
{
goto Loop1;
}
}
for()
{
}
for()
{
}
}
|
|
|
|
|
Hi, Thanks for the help!!
Presently, I am using the "goto".
"goto" seems smarter than checking the same condition in all for loops and "break"ing from them.
With Thanks,
Suman
BTW,
GauranG Shah wrote: :loop1 for() //main for loop
Did you mean "loop1: for()", the colon after label?
|
|
|
|
|
rp_suman wrote: Presently, I am using the "goto".
"goto" seems smarter than checking the same condition in all for loops and "break"ing from them.
Not really. The goto statement should rarely be used. It could be used when your application is really time critical. In any other case you should try to use condition.
for()
{
for()
{
if(condition)
{
}
}
if(!condition)
{
for()
{
}
for()
{
}
}
}
codito ergo sum
|
|
|
|
|
Hi,
Thanks for the help!!
I will try this method..
Best Regards,
Suman
|
|
|
|
|
Hello everyone,
skipws works for both char based and wchar_t based string stream? I have not found formal clarification from MSDN.
http://msdn2.microsoft.com/en-us/library/98bsd5x4.aspx
thanks in advance,
George
|
|
|
|
|
Did you try it ?
I would imagine that if nothing is said specific to that, it would be supported for all formats.
spaces are spaces are spaces.
|
|
|
|
|
Thanks Maximilien,
I have tested that it works! Cool!
A further question, L"\n" or L"\r" or L"\t" has the same meaning and function in UNICODE compared with ANSI peers "\n" or "\r" or "\t"? Or we should use other terms to represent "\n", "\r" and "\t" meaning of ANSI in UNICODE?
regards,
George
|
|
|
|
|
Deal experts,
I have some doughts on DLLs.
1) who will load the dependent dll in windows?
2) Do we need to specify any thing in our library to help auto dependent library loading?
3) Does the application needs to specify anything about all dependency libraries?
4) If some loader is doing this job, how it will get the dependent libs information?
5) Does OS will do any job in this regard?
6) what are the data structures used for this automatic dependent libraries loading?
Please explain me the mystry behind this automatic dependent libraries loading in windows? who will do which job and what are datastructures?
thanks in advance,
Ravinder Are
Are
|
|
|
|
|
In an exe/dll, there will be sections called Import address table, Import directory table etc which will be holding the information about the depended modules and the functions of it. The loader reads this information while loading the exe and loades the dependend modules. if you want learn more, study the structure of Portabel Executale( PE ). Here is a good article An In-Depth Look into the Win32 Portable Executable File Format[^]
|
|
|
|
|
hellow everybody!!
can u help me to solve my stuff
/******this code convert BMP file into Single page TIFF file***/
CImage image;
image.Load(_T("C:\\BitmapPrntPages\\film.bmp"));
image.Save(_T("C:\\BitmapPrntPages\\tiff_image1.tif"),ImageFormatTIFF);
/*************************************
i want to convert Bitmap(*.bmp) files into multiPage TIFF file
share your thoughts.
regards
vmthiru
VmTHiru
Software Engineer's
|
|
|
|
|
VmTHiru wrote: i want to convert Bitmap(*.bmp) files into multiPage TIFF file
do you want convert single image in multiple tiff image
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|