|
Hi
Use xtreme toolkit can add a outlookbar to single doucment easily;
but I don't know how to add a outlookbar to multipe document?
how to do that?
could you give me a code?
Thanks!
|
|
|
|
|
Hi Everyone,
I'm writing an application that implements an on-screen keyboard (because the Windows on-screen keyboard is extremely small and hard to use) and I'm having problems setting focus to the desired window in which the user wishes to type.
I'm using a few User32 API calls to get the active window handle number and then set the active window once I know what the handle is. This seems to be working OK. However, the window which has focus (the one receiving the typing) flickers as the user clicks on a key.
This is because as the user touches a key to type, it gives the keyboard focus and then immediately sends focus back to the window in which the user is typing, hence the flickering. So...
Question #1:
How can I eliminate the change of focus and always give focus to the desired window so that there is no flickering back and forth between my keyboard application and the window receiving the typing?
Question #2:
This is not just a standalone keyboard, but is a small part of a larger piece of software. Consequently, there are occasions when the user must use this on-screen keyboard to type into a window within it's parent application or into different forms within the app. One form contains a browser control to a company website. When they keyboard is used to type into any text field on a webpage displayed in the browser control, only every other word is sent to that text box. Two key strokes are required to output one letter. What could be a possible cause of this and how might I go about fixing it?
ANY suggestions or help is much appreciated. Code examples in VB.NET, VB 2005, and C# are fine. C++ OK too but only if it's immediately applicable and can be converted easily to VB.NET.
Thanks in advance to anyone who contributes!!!!
Patrick
|
|
|
|
|
Have you tried keeping the active window as your onscreen keyboard, and using SendMessage or PostMessage with WM_KEYDOWN or WM_CHAR to send the appropriate keystrokes to the target window? Or SendInput?
VB.NET, what is that?
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Steve,
Thanks for the reply. I haven't tried that so I'll do some research today and give it a shot. Thank you much!
-Patrick
|
|
|
|
|
Hello,
BYTE pdest;
pdest += sizeof(DLGITEMTEMPLATE);
*(WORD*)pdest = 0xFFFF; // indicating atom value
pdest += sizeof(WORD);
*(WORD*)pdest = (USHORT)m_eTypeControl; // atom value for the control
pdest += sizeof(WORD);
Can you please explain me the syntax of the above code or give me the link
What does *(WORD*)pdest = 0xFFFF; mean ?
Thanks
Prithaa
|
|
|
|
|
prithaa wrote: Can you please explain me the syntax of the above code or give me the link
What does *(WORD*)pdest = 0xFFFF; mean ?
(WORD*) casts the BYTE pointer to a WORD pointer.
The '*' before the cast dereferences the WORD pointer so the "= 0xFFFF" can place a WORD value
at the location pointed to by pdest.
It ends up being the same as:
BYTE pdest;
pdest += sizeof(DLGITEMTEMPLATE);
WORD *pdestWORD = (WORD *)pdest;
*pdestWORD = 0xFFFF; // or pdestWORD[0] = 0xFFFF; // indicating atom value
pdest += sizeof(WORD);
pdestWORD = (WORD *)pdest;
*pdestWORD = 0xFFFF; // or pdestWORD[0] = 0xFFFF; // atom value for the control
pdest += sizeof(WORD);
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello,
That makes for a wonderful explanation but what exactly is atom value.
atom value is character represented in the character set.
pdestWORD[0] = 0xFFFF;.
so is the above statement placing FFFF in the 0th position of pdestWORD .That is the corresponding code of FFFF.
What does DWORD aligned mean?
Prithaa
|
|
|
|
|
Atoms are described here[^].
BYTE pdest;
pdest += sizeof(DLGITEMTEMPLATE);
*(WORD*)pdest = 0xFFFF; // indicating atom value
pdest += sizeof(WORD);
*(WORD*)pdest = (USHORT)m_eTypeControl; // atom value for the control
pdest += sizeof(WORD);
In your case, if the WORD following a DLGITEMTEMPLATE struct is 0xFFFF then the next WORD is an
atom representing the class name of a control. The 0xFFFF is just an indicator to differentiate
between a Unicode string (which could be used instead) and an atom.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello,
Thanks for your help and now the code is getting crystal clear.
So instead of 0xFFFF, I can give any hex such as 0xABFF or only 0xFFFF has to be given.
What is DWORD aligned?
Thanks
Prithaa
|
|
|
|
|
prithaa wrote: So instead of 0xFFFF, I can give any hex such as 0xABFF or only 0xFFFF has to be given.
No. Here's what the docs state:
"If the first element of this array is any value other than 0xFFFF, the system treats the array
as a null-terminated Unicode string that specifies the name of a registered window class. If the
first element is 0xFFFF, the array has one additional element that specifies the ordinal value of
a predefined system class."
prithaa wrote: What is DWORD aligned?
Aligned to a multiple of 4 bytes. sizeof(DLGITEMTEMPLATE) is not a multiple of 4 bytes so read
the docs carefully. The arrays following the struct must be WORD aligned and all the
DLGITEMTEMPLATE structs must each be DWORD aligned. You need to keep track of bytes written and
pad accordingly.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks I got it.
Sometimes it happens that while reading the code I forget the documentation that was read and get intimidated with the hex nos and pure code.
I was behind this code since 2 days but today I got it clearly
Thanks
Prithaa
|
|
|
|
|
I have done C programming now trying to take it OO/C++
I have a general C++ question
I a Class lets say Fruit the base Class which is Apples
If I derive this (apples as a Base Class) hope I am using the right terminology
e.g.
Class Fruit: public Apples
{
Can I add members to the Apples Class
to further qualify this Class
e.g. int GreenApples
int YellowApples
Thankx
|
|
|
|
|
It doesn't make much sense to derive Fruit from Apples. Apples are a fruit so Apples should be
derived from Fruit.
Maybe something like this...
class Fruit
{
};
class Apples : public Fruit
{
};
class GreenApples : public Apples
{
};
class YellowApples : public Apples
{
};
Notice Fruit is the base class. Apples is derived from Fruit. For more specific apple types,
GreenApples and YellowApples are added, both derived from Apples.
Mark
Microsoft MVP - Visual C++
|
|
|
|
|
Thaankx I'm an Assembler MVS/internals programmer
Getting into the OO way thnking will take me a while
so to Add members derive that class into your your class
and add the members/data/functions
thankx for your help
|
|
|
|
|
Members should be added to the appropriate class, and/or, at the appropriate place in the class
hierarchy. Expanding on the example:
class Fruit
{
protected:
int Count;
public:
Fruit() {Count = 0;}
int GetCount() {return Count;}
virtual bool IsCitrus() = 0;
};
class Orange : public Fruit
{
public:
virtual bool IsCitrus() {return true;}
};
class Apple : public Fruit
{
protected:
COLORREF AppleColor;
public:
Apple() {AppleColor = RGB(0x00,0x00,0x00);}
virtual bool IsCitrus() {return false;}
};
class GreenApple : public Apple
{
public:
GreenApple() {AppleColor = RGB(0x00,0xFF,0x00);}
};
class RedApple : public Apple
{
public:
RedApple() {AppleColor = RGB(0xFF,0x00,0x00);}
};
This is a silly example, but notice...
All Fruits can have a count, so I added a Count member variable to the Fruit class. All derived
classes will have this variable as well.
I want to differentiate between citrus and non-citrus fruits so I added a pure virtual method to
the Fruit class. Pure virtual means derived classes HAVE to implement the virtual method. I
went ahead and implemented the virtual method in the derived Apple and Orange classes.
I wanted all Apple classes to have a color, so I added an AppleColor member variable to the Apple
class. All Apple and Apple-derived objects will have this member. Fruit does NOT have this
member because Fruit is not an Apple so it makes no sense for it to have an Apple color. It's
not a great example, since in real-life, you'd probably want all Fruits to have a color.
Hopefully having just color for apples demonstrates why the member is added at that spot in the
hierarchy.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thankx I really appreciate the Lesson is a lot different then procedural programming
Thankx again
|
|
|
|
|
Hey Mark, very nice example. I like this one over the usual Employee / HourlyEmployee / SalaryEmployee examples I grew up with. Guess I just like apples better
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
I first learned from an Animal/Cat/Dog-type heirarchy.
I hope it was a good example for the OP...I'm not sure I answered his actual question.
Cheers!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I just noticed I probably didn't answer your question...
ForNow wrote: so to Add members derive that class into your your class
and add the members/data/functions
Yes. To add members to an existing class you can derive your own class from that class and
add the members
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thankx again your notes were better then any C++ course I could have taken
|
|
|
|
|
URLDownloadToFile dont work in worker thread
how do i make URLDownloadToFile work in a worker thread. because this is a blocking function, i got to use a worker thread when i call it. but unforturnately when i tried to use it in a thread it doesnt even work at all. its LRESULT return value becomes like -29581853 or something like that.
also, the file never shows up in c:\abc.txt
here is the code i used
download_result=URLDownloadToFile(NULL, yahoo_url, "C:\\abc.txt", 0, NULL);
how can i make it work in my worker thread?
ref [url]http://msdn2.microsoft.com/en-us/library/ms918866.aspx[/url]
using vc++6.0
winxp
MFC STYLE
|
|
|
|
|
Maybe you need to call CoInitializeEx() on your worker thread.
awah wrote: its LRESULT return value becomes like -29581853 or something like that.
The exact value, preferrably in hexadecimal, would be much more helpful to us than "something
like".
Mark
Microsoft MVP - Visual C++
|
|
|
|
|
I have an data-acquisition application in which data-logging is
performed constantly and data is stored in a CF Card, which acts as the primary data-storage device for the system.
The Windows CE image that i have loaded has support for automatic
detection of USB mass storage devices.
The User can retrive the data from the system (CF Card) thru USB Drive.
There is no screen or console , it is an industrial Controller.
The data acquistion goes on constantly , and the applicaiton
periodically polls the USB slot to see if the user has inserted any
USB Drive in it.
I am using a 4 m long cable for USB Pen drive. This is unavoidable!
The problem caused due to this is that the Pen Drive is sometimes not detected byt he Win CE system. Once the pen drive is not detected, it is never subsequently detected. I want to know which driver is responsible for this, and how I can trap any errors occuring in the USB detection operation. I know tht in case of any errors, the driver disables this device on tht USB port. But it allows the same device on the second USB port , and detectes it too. I observed this during internal testing,,,there is only one port at the client site though.
I think the bus enumeration feature of the USB Host driver disables this device if it cannot detect it in some number of tries.
I was thinking of a solution in which I could clear any error that occurs on the USB port, so that the USB driver wud re-enable the device and detect it.
How can I detect any errors that occur at the Port? How can i clear these errors?
Regards
-CR
|
|
|
|
|
I have a C++ project with multiple .h and .cpp files and with a .cpp file containing the int main() function.
Where do I declare global variables such that they can be accessed by the methods in the various .cpp files?
I declared the variable before the main() function but there is an "undeclared variable" error.
I tried creating a .h file to store the global variable and added the line: #include "globals.h" in the necessary .h files but there were all sorts of link errors.
|
|
|
|
|
Declare in cpp file where it first time used.And for another use use make it extern
|
|
|
|