|
Hi,
I want to develop a keyboard application which assists user to type in a language other than english. User will type using English keyboard. My app will transliterates it to Unicode equivalent of other languages.
But this app should work across windows. I mean user can type in to note pad also using my app.
Any body give me hint how to do that ?
Thanks in advance
|
|
|
|
|
|
RajeshHegde8xp wrote: ny body give me hint how to do that ?
try keyboard hook
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Thanks for reply,
Both anwsers are great. But for my problem keyboard hook seems to be good option.
But i checked examples of Keyboard hooks there we can listen key presses and record it. But i want to listen keypresses and modify key presses as user types.
Thanks again.
Regards
--Rajesh Hegde
|
|
|
|
|
I want to capture the drag or drop operation in the shell(explorer.exe).
What should I do?
|
|
|
|
|
Does anyone know how to get file size, if i work with files using ifstream class?
|
|
|
|
|
<br />
#include <iostream><br />
#include <fstream><br />
using namespace std;<br />
<br />
void main() {<br />
ifstream in("c:/boot.ini");<br />
in.seekg(0, ios::end);
streampos ps = in.tellg();
cout << "File size: " << ps << endl;
in.close();
}<br />
|
|
|
|
|
Thanks a lot!!!
Now i want to read the file into the memory and work with this memory like i worke as with file, i think using istream, but i can't make the istream object...
Here is my code:
<br />
ifstream shapefilef(ShapeFileName.c_str(),ios::binary);<br />
shapefilef.seekg(0,ios::end);<br />
streampos ps = shapefilef.tellg();<br />
int size = ps.seekpos();<br />
char* data = new char [size];<br />
shapefilef.seekg(0,ios::beg);<br />
shapefilef.read(data,size);<br />
istream shapefile(data);
Where is the mistake? I can't compile it... Something in constructor.
|
|
|
|
|
Have a try:
istrstream shapefile(data); // you must #include <strstream>
The istream not constructor like that istream(char* ...)
I think that you need istrstream
|
|
|
|
|
Following should work.
int fh = _open(file name, _O_APPEND , _S_IREAD | _S_IWRITE );<br />
int filesize = _filelength(fh);
Above code needs following header files
1. io.h
2. fcntl.h
3. sys\stat.h
I don't now how can we get file size using ifstream.h. I used above to get it.
We Believe in Excellence
|
|
|
|
|
Or use good old stat()/_stat() Then you won't have to open and close the file. And you don't have to worry about text/binary mode.
|
|
|
|
|
Is there any way to get the object pointer through a pointer to its' member variable?
|
|
|
|
|
If you are within the scope of the class, the object pointer is always available thru keyword "this". If you are outside, then you have used some mechanism to obtain the pointer to the function of an object. This mechanism must have used the object or its pointer, therefore, in that case there is no problem of obtaining the pointer to the object.
|
|
|
|
|
outside the class
and know only one address
|
|
|
|
|
#define CK_CONTAINING_RECORD( PTR, TYP, FLD ) \
( (TYP*)( (byte*)(PTR) - (byte*)(&((TYP*)0)->FLD) ) )
class MyClass {
public:
long m_long;
};
long *lp = ...;
MyClass *op = CK_CONTAINING_RECORD(lp, MyClass, m_long);
...cmk
Save the whales - collect the whole set
-- modified at 0:26 Thursday 16th February, 2006
|
|
|
|
|
but the object is already there
|
|
|
|
|
Not safely. Only if you know the offset in memory of the member variable from the start of the class. Generally though, if you need to do this, you've got a bad design, so fix it.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
It doesn't mean you have a bad design. It can though.
In fact, usign that technique can allow you to create safer versions of such things as std::list which have all sorts of bookkeeping issues in complex system. Systems like this are common in operating systems.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
How to check whether a CArray is empty or not?
For ex: If you have a char x.
You can do if(x==NULL), then print"Error".
How can you do this kind of testing with a CArray? What is used in the place of NULL?
|
|
|
|
|
CArray::GetCount
Regards,
Nish
|
|
|
|
|
You can check it by:
CArray arr;
int i = arr.GetSize();
if(i==0)
AfxMessageBox("Empty Array");
Cheers
Ganesh
hi
|
|
|
|
|
cuteee wrote: You can do if(x==NULL), then print"Error".
what about CArray::GetSize() function
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
CArray::GetSize() function
As per my understanding if i use GetSize, i can check the size of the array. I need to check the contents of the array. How is it possible?
|
|
|
|
|
<blockquote class='FQ'><div class='FQA'>cuteee wrote:</div>CArray::GetSize() function </blockquote>
CArray is just template class... it depends on what datatype you are going to create collection. pls clear you want to check is there any element in the array or not...
Check out CArray::GetUpperBound() ,The condition GetUpperBound( ) = –1 indicates that the array contains no elements.
<p align='right'> <small>"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow</small></p>
cheers,
<a target=_blank href="http://alok.bizhat.com"> Alok Gupta </a>
VC Forum Q&A :- <a href="http://www.codeproject.com/tips/cppfaq10dec04-23jan05.asp" target=_blank>I</a>/ <a href="http://www.codeproject.com/useritems/cppfaq25apr8jun.asp" target=_blank>IV</a>
|
|
|
|
|
Have I gone mad or has the 'this' window been removed from the debug windows you can see in VS.NET2005? Anyone noticed this? Or have a just missed where it now hidden away now.
|
|
|
|