|
I've searched through a lot of forums and found a lot of clues to my problem, but I'm still a bit in the dark about it. I need to screen keyboard input to determine if it is a valid sequence, or if it is a repeated entry. After doing some research, I decided that a system-wide hook may fit my needs. Here is an example of the specific problem I am trying to tackle:
Forklift drivers log onto their system (win xp tablet pc with an internet explorer based mainframe emulator) using a keyboard, then scan the loads they move. All of the input comes in through the keyboard, since the barcode scanner is spliced into the ps2 port. The problem is, if they are supposed to log on with '55555', and they enter '54556', the mainframe terminal lets them, and they don't get credit for doing any work until they log in correctly; or they may scan the same barcode twice in a row, creating a duplicate entry. I can't get to the mainframe app to add error checking and error messages, so I want to manipulate the input before it's posted to the terminal window, disregarding it and issuing an error message box so the forklift driver can enter the correct data.
I've done a lot of reading about hooks, and starting working on a low level keyboard hook (WH_KEYBOARD_LL) in a dll, and got it to work, although it doesn't do anything other than return success. I'm relatively new to Windows API programming, and I think I need a little bit of direction. Here is what I want to do:
Hold the data in some type of field (array, string, etc), and check it against a list of valid data. I suppose I could do this by checking the keydown event for vk_return, but then how would I erase the bad data from the terminal window? Can I hold all the data somewhere until enter is pressed, check it, then dump it or let it pass to the active window? I've read several articles and forum posts about this, but most of them have to do with trapping single keys. If there is a better way to accomplish this than a system wide hook, that's ok, since I'm trying to solve a problem more than learn a new technique. Any advice or thoughts would be helpful. Just ask if any further clarification is required. Thanks!
|
|
|
|
|
Hi everyone,
Anyone knows of a way to host Visio 2000 in IE. I only came across Visio Viewer control, but I want to be able to create visio drawings also.
Thanks,
pankaj
/**
I'm the one who's gonna have to die
When it's time for me to die
So let me live my life
The way I want to
- Jimi Hendrix
*/
|
|
|
|
|
Is there any particular reason why the following code won't compile? Thats very basically what I have got. I'm only doing this as a quick hack, so I'm not at all concerned with code design, but it really intrigued me as to why it won't let me declare a namespace within a class? All the things I've read on the internet deal only with class declarations within a namespace but not visa versa. Just wondering whether this the c++ standard leaves it up to the compiler or whether its officially illegal code? Seems a bit silly to me, but maybe theres a reason for it? Just wondered if anyone's knows what it is?
<br />
class Outcome<br />
{<br />
public:<br />
enum Type<br />
{<br />
kHalt,<br />
kMove,<br />
kJump,<br />
};<br />
<br />
Type m_type;<br />
<br />
namespace halt<br />
{<br />
void Low(void);<br />
void Medium(void);<br />
void High(void);<br />
};<br />
<br />
namespace move<br />
{<br />
void Low(void);<br />
void Medium(void);<br />
void High(void);<br />
};<br />
<br />
namespace jump<br />
{<br />
void Low(void);<br />
void Medium(void);<br />
void High(void);<br />
};<br />
};<br />
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
At what point do you get the compiler error? The line Type m_type; is invalid. You'd have to scope it with Outcome::Type m_type;
Bob Ciora
|
|
|
|
|
I changed it to this but I still get the same error message from gcc :
"error: parse error before `namespace'"
Do you think its a compiler bug or is it just not supposed to be supported? Its a bit weird don't you think considering that a class is essentially a namespace and you can have nested class declarations and nested namespace declarations, but not this way round?
class Outcome
{
public:
enum Type
{
kHalt,
kMove,
kJump,
};
namespace halt
{
void Low(void);
void Medium(void);
void High(void);
};
namespace move
{
void Low(void);
void Medium(void);
void High(void);
};
namespace jump
{
void Low(void);
void Medium(void);
void High(void);
};
Outcome::Type m_type;
};
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
You do not have to qualify type with the name of the class since it is declared inside the class. The original declaration of the Type enumerated variable was fine.
Shawn
|
|
|
|
|
Namespaces can contain classes, but classes cannot contain namespaces.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I'm guessing its because namespace functions have global linkage within the namespace but by default functions in a class only have local linkage via an object?
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
Alan Chambers wrote:
functions in a class only have local linkage via an object?
member functions of a class receive the this pointer, which allow the functions to point directly the object that is using the function. a particular point is the static member functions -> no this pointer as implicit parameter
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I can think of one reason.
Many classes can belong to one namespace. So by giving 'using namespace' you have access to all the classes that are contained in that namespace.
If what you mentioned is possible, then by giving, let's say, 'using namespace jump', you cannot create an object of class Outcome because all members of the class does not belong to that namespace.
« Superman »
|
|
|
|
|
Hi All,
I am launching many applications from my application in background. Say I launched MS Word. Now, I want the handle of the launched application. I have the handle to the mainframe window of newly launched application. I am able to get the menu pointer using CWnd::GetMenu() from the mainframe pointer. But this works only with the applications like Notepad and Adobe Reader where menu is the intigral part of the mainframe. Applications like MS Word and MS Excel have seperate docking windows for menu. At this time I am not able to get the menu from mainframe.
For such applications what I do is I enumerate all child windows of the mainframe and call GetMenu function on all child windows but still none of them returns me the menu pointer.
I get the handle of the docking menu bar window (This handle is the same I can see using spy++). I call CWnd::FromHandle() funtion to get the CWnd pointer to that window and then call GetMenu() of using that CWnd pointer but it returns me NULL;
Any clues?
--------------
Vaibhav...
|
|
|
|
|
You could try to use GetWindow instead of GetMenu.
« Superman »
|
|
|
|
|
Hey, I want menu handle not the window handle.
|
|
|
|
|
I want to get the handle of the menu and not of the window.
So how GetWindow() will not help me.
--------------
Vaibhav...
|
|
|
|
|
Okay let me tell you why I am doing all these.
We are developing a software which migrates the application specific
properties.
Per say I want to migrate all settings of MS Word from my pc to another pc.
i.e. all those preferences which I have set in my MS Word applications like,
spellings and grammer check, library, languages, margine settings, rulers etc
will get captured through my application and will migrate the same settings
onto another computer.
Now all of these settings are stored either into registry or into some
files. So I want to capture all such registry items and files. But my program
does not know the registry location for a particular application. Most of the
application specific data are stored under
HKLM/Software/Appliication_specific_key. But there is no gurantee that this
Application_specific_key is exactly as the name of the application. So how do
I capture identify the location in the registry which I need to capture. So
what I am doing is I am continuously monitoring registry and filesystem using
regmon and filemon utilities and hitting all menu items which will change
preferences of my application. Because all such preferences would be
accessible through menu only. I dont see any other way of editing the
preferences.
So this is how I go about it. If you have any better suggestion to achieve
the same goal, let me know.
Your help is appreciated in this regards.
--------------
Vaibhav...
|
|
|
|
|
How to automate autocad with VC++
which one to choose MFC/ATL,Autolisp/VC,ObjectARX/any other?
Please Help
|
|
|
|
|
Automation is just a limited part of COM so any programming language will suffice. It all depends on the rest of the application.
Johannes
|
|
|
|
|
I'm trying to use some Excel COM from Visual C++, but am having difficulty calling certain functions. For example, take the WorkSheets.Add method. The function declaration is as follows:
LPDISPATCH Add(const VARIANT& Before, const VARIANT& After, const VARIANT& Count, const VARIANT& Type);
By looking in the Excel VBA Help, I can get documentation for this method:
Add Method (Worksheets Collection)
Creates a new worksheet. The new worksheet becomes the active sheet. Returns a Worksheet object.
Syntax
expression.Add(Before, After, Count, Type)
expression Required. An expression that returns a Worksheets object.
Before Optional Variant. An object that specifies the sheet before which the new sheet is added.
After Optional Variant. An object that specifies the sheet after which the new sheet is added.
Count Optional Variant. The number of sheets to be added. The default value is one.
Type Optional Variant. The sheet type. Can be one of the following XlSheetType constants: xlWorksheet, xlExcel4MacroSheet, or xlExcel4IntlMacroSheet. The default value is xlWorksheet.
Remarks
If Before and After are both omitted, the new sheet is inserted before the active sheet.
OK, now for some example code. I can add a new worksheet quite easily using the following code:
COleVariant VOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);<br />
ws.Add(VOptional, VOptional, VOptional, VOptional
The problem is that this default usage inserts the sheet before all current sheets in my workbook, but I want to insert it after all the other sheets. In Excel VBA, I can do this by simply running:
Worksheets.Add.Move after:=Worksheets(Worksheets.Count)
However, I'm having real trouble finding what the data type of the 'After' argument needs to be in C++ and I can't find any sample code anywhere! I have found hundreds of examples passing numbers or strings, but not objects! Can anyone supply some sample code?
Using the _Worksheet.Move method would also accomplish the same thing, but I have the same problem, so any help would be greatly appreciated!
|
|
|
|
|
Just in case anyone needs to do this, I figured out how to do it. The 'after' parameter needs to represent the IDispatch pointer of the worksheet you want to add the new sheet after. So you have to do something like this:
COleVariant var;<br />
var.vt = VT_DISPATCH | VT_BYREF;<br />
var.ppdispVal = &(objSheet.m_lpDispatch);
// Add the new sheet AFTER the sheet referenced in 'matt'
NewSheet = objSheets.Add(VOptional, var, VOptional, VOptional);
|
|
|
|
|
Hello,
I need to check if a given machine exists on LAN or Not, the only information I can use to call the function is Machine Name nothing else.
Pls Help.
Thanks n Regards.
RuchirDhar Dwivedi
Software Engineer
Windowmaker Software Pvt.Ltd.
Baroda, India.
|
|
|
|
|
you have to make your function that will check for existance of Machine in Network
you can these api to enumerate the Machine on network:-
Use <code>WNetOpenEnum</code> to Open Handle then do
Enumertation by <code>WNetEnumResource</code> finally close
it by <code>WNetCloseEnum</code>
"I Think this Will Help"
[Vote One Here,.....]
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
I copy a .rc file to my program.
However, my funciton could not load the resource.
Such as string,loadstring() return 0.
Where should I reset?
|
|
|
|
|
Did you copy the associated resource.h file also?
« Superman »
|
|
|
|
|
|
the string table of the resource editor associate an ID to a string ; BUT :
.rc file :
IDS_MY_STRING "Hello World\n"
resource.h file :
#define IDS_MY_STRING 1018
(for example)
-> SO, if the ID is not #define d, the resource table don't know it.
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|