|
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$$>
|
|
|
|
|
|
Hi Mark ...
how to possible in VC++ ??
Thanks
|
|
|
|
|
__interface IFileIO : IDispatch<br />
{<br />
[id(1), helpstring("method GetFile")] HRESULT GetFile();<br />
[id(2), helpstring("method getDirectory")] HRESULT GetDirectory();<br />
};<br />
<br />
class ATL_NO_VTABLE EDCService :public IFileIO<br />
{<br />
public:<br />
EDCService()<br />
{<br />
}<br />
DECLARE_PROTECT_FINAL_CONSTRUCT()<br />
HRESULT FinalConstruct()<br />
{<br />
return S_OK;<br />
}<br />
<br />
void FinalRelease()<br />
{<br />
}<br />
<br />
public:<br />
<br />
STDMETHOD(GetFile);<br />
STDMETHOD(GetDirectory);<br />
}<br />
Hi friends ...
STDMETHOD(GetFile);<br />
STDMETHOD(GetDirectory); these two methods definitions are written main.cpp
i doing so many try's to solve this prob..first i create instance of EDCService.like
EDCService edcobj;
then i create instance of EDCService like
edcobj.CreateInstance(); but showing..
When i compile this code i get the follwing errors i dont know how was solve it
error C2039: 'CreateInstance' : is not a member of 'EDCService'
error C2259: 'EDCService' : cannot instantiate abstract class
Please tell me how to solve this problem ..
*****THANKS N ADVANCE****
Mathen.K
(I WILL TRY MY LEVEL BEST )
|
|
|
|
|
use smart pointers as below;
EDCServicePtr edcobj;
edcobj.CreateInstance(.......);
|
|
|
|
|
Thanks 2 your replay ..
i cant understand ..please tell me briefly and also how to use smart pointers..in my class
*****THANKS N ADVANCE****
Mathen.K
(I WILL TRY MY LEVEL BEST )
modified on Monday, March 3, 2008 1:45 AM
|
|
|
|
|
Can you please keep the subject line of your post descriptive? Anything other than PLZZZ HELP, URGENT HELP REQUIRED, PROGRAM NOT WORKING, etc?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|