|
i just left work so i cannot check the code out til i get home, but it looks like a pretty straight forward guide Thanks!
todo....
:: insert inpirational text here ::
|
|
|
|
|
static LRESULT CALLBACK HookTeclatLL(int nCode,WPARAM wParam,LPARAM lParam)
{
if (nCode == HC_ACTION)
{
switch (wParam)
{
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
case WM_KEYUP:
case WM_SYSKEYUP:
{
LPKBDLLHOOKSTRUCT p = (LPKBDLLHOOKSTRUCT)lParam;
bool bEliminarPressioTecla = false;
// Paquet de tecles independents (hi hagi o no apretat ALT/Ctrl... s'eliminen de la cua de pressions de tecles).
bEliminarPressioTecla = ((p->vkCode == VK_RWIN) ||
(p->vkCode == VK_LWIN) ||
(p->vkCode == VK_ESCAPE) ||
(p->vkCode == VK_F1) ||
(p->vkCode == VK_F2) ||
(p->vkCode == VK_F3) ||
(p->vkCode == VK_F4) ||
(p->vkCode == VK_F5) ||
(p->vkCode == VK_F6) ||
(p->vkCode == VK_F7) ||
(p->vkCode == VK_F8) ||
(p->vkCode == VK_F9) ||
(p->vkCode == VK_F10) ||
(p->vkCode == VK_F11) ||
(p->vkCode == VK_F12) ||
(p->vkCode == VK_CANCEL) ||
(p->vkCode == VK_RBUTTON) ||
(p->vkCode == VK_PAUSE) ||
(p->vkCode == VK_SNAPSHOT) ||
(p->vkCode == VK_APPS) ||
(p->vkCode == VK_SCROLL));
// En cas que no s'hagi eliminat la tecla fins ara...
if (!bEliminarPressioTecla)
{
// Paquet de tecles amb combinació amb ALT.
if ((p->flags & LLKHF_ALTDOWN) != 0)
{
bEliminarPressioTecla = (p->vkCode == VK_TAB);
}
if ((p->flags & MOD_WIN) != 0)
{
bEliminarPressioTecla = true;
}
}
if (bEliminarPressioTecla)
{
return 1; IMPORTANT! in order to avoid that keystroke to be used...
}
break;
}
}
}
return CallNextHookEx(hHookTeclat, nCode, wParam, lParam);
}
Deleting intermediate files and output files for project 'swkh - Win32 Debug'.
--------------------Configuration: swkh - Win32 Debug--------------------
Compiling...
swkh.cpp
c:\windows\desktop\visualstudio6\myprojects\swkh\swkh.cpp(1) : error C2146: syntax error : missing ';' before identifier 'CALLBACK'
c:\windows\desktop\visualstudio6\myprojects\swkh\swkh.cpp(1) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
swkh.dll - 2 error(s), 0 warning(s)
todo....
:: insert inpirational text here ::
|
|
|
|
|
I've ommitted one thing...
you've to change those lines in stdafx.h (comment the first one as in the sample and add the second one...):
#define _WIN32_WINNT 0x0400
|
|
|
|
|
Thank You Joan Murt, youve been extremely helpful for me.
if (bEliminarPressioTecla)
{
return 1; IMPORTANT! in order to avoid that keystroke to be used...
}
break;
}
}
I also forgot to comment that part
Im going to try to build this .dll later today, i got a few other duties to perform first ill let you know how it goes....
todo....
:: insert inpirational text here ::
|
|
|
|
|
Hello,
I have the name of a variable, let's call it "iCounter", is there any way to set a value to a var when I got only its name?
Sample of what I means:
CString csNameOfVar = "iCounter";
GetTheAdressOfAVarWiththisName(csNameOfvar) = Value_that_I_Must_set;
Does a function that acts as "GetTheAdressOfAVarWiththisName" exists?
thank you in advance.
|
|
|
|
|
That would be fun, but I don't think so... C++ is not symbolic!
but,
One way of doing it, would be to add your variable into a map with the name of the variable as the key; but maybe not!?!?!
Max,
|
|
|
|
|
OK,
first of all let me thank you for your answer.
I'll take a look at the Map classes, but I'm beggining to believe that it won't be what I need, and that I can do it in another way....
I wanted this because:
1. I have created an app that use XML in order to autoconfigure itself.
2. I get access to another language that I use via the variable names.
3. I have only one property sheet embedded inside the main dialog and the property pages get created dynamically depending on the XML file, the user Id and so on...
4. the property pages have a ListCtrl (and other informative controls) in order to alow the user interaction with the other language's variables.
5.I wanted to allow the user to interact with some variables that are placed directly in the Visual C++ code. OK, now that you know why I wanted it, what do you think of this:
I'm beggining to believe that I can inherit from the property pages that I have and for each special one specify the variables that I need.
This will allow me to get rid of all the work of creating all the buttons... and everything else for each variable that the user must be allowed to interact with. And also will allow me to use variables that are in the Visual C++ native code.
Thank you again.
|
|
|
|
|
Not gonna happen in C++.
You need some sort of map/associative array, that can map a string value to an integer value. Then you can get the same effect.
If you are using stl,check out the "map" or "multimap" class. Or the MFC container version is CMap I believe.
Example using map:
map<CString, int> myVariables;
.. then you can insert/extract stuff from the map and use them like variables.
(I'd give more concrete code, but somebody is borrowing my STL book at the momeny. )
Even a broken clock is right twice a day.
|
|
|
|
|
OK,
first of all let me thank you for your answer.
I'll take a look at the Map classes, but I'm beggining to believe that it won't be what I need, and that I can do it in another way....
I wanted this because:
1. I have created an app that use XML in order to autoconfigure itself.
2. I get access to another language that I use via the variable names.
3. I have only one property sheet embedded inside the main dialog and the property pages get created dynamically depending on the XML file, the user Id and so on...
4. the property pages have a ListCtrl (and other informative controls) in order to alow the user interaction with the other language's variables.
5.I wanted to allow the user to interact with some variables that are placed directly in the Visual C++ code. OK, now that you know why I wanted it, what do you think of this:
I'm beggining to believe that I can inherit from the property pages that I have and for each special one specify the variables that I need.
This will allow me to get rid of all the work of creating all the buttons... and everything else for each variable that the user must be allowed to interact with. And also will allow me to use variables that are in the Visual C++ native code.
Thank you again.
|
|
|
|
|
I use a structure which maps a name to a variable address and type
typedef struct
{
const char* name;
void* value;
ParamDataTypes type;
} ParamData;
ParamData paramData[] =
{
"var1", &m_Var1, PT_ULong,
"var2", &m_Var2, PT_Float,
"var3", &m_Var3, PT_String,
};
Then all you need is a function which can loop through the paramData and do the proper conversion from input type to PT_Whatever.
Todd Smith
|
|
|
|
|
Hi
I'm new to this.
I'm debugging a simple Visual C++ 6 single document application and I must have inadvertently set a debug option to step into code other than my own source code. Instead of stepping though the source in my project, it's stepping throught the classes and assembler code that I'm not interested in.
How do I turn this off so I just step through my own code?
Ivor
|
|
|
|
|
you have 2 options
1. Use Shift+F11 (See msdn) to skip the function. This is what most of us are doing.
2. Remove .pdb files for all modules you do not want to see in debug. This option is a very bad option because it could mess up your VC installation, but you still can do it. Try to avoid .pdb for mfc, atl, stl, crt and other MS libraries.
|
|
|
|
|
Thanks
So it's not me then
I couldn't find the option because it's not there
|
|
|
|
|
Need an example on how to dynamically load a dialog from an MFC extension dll?
|
|
|
|
|
Getting this warning when I compile some code that I developed under VC 6:
e:\Microsoft Visual Studio .NET\Vc7\include\useoldio.h(29) : warning C4995: '_OLD_IOSTREAMS_ARE_DEPRECATED': name was marked as #pragma deprecated
I believe I know *what* this warning means... somewhere somebody is including <iostream.h> instead of the more "standard" <iostream>. But I can't for the life of me figure out where this is happening. It has to be deep in some nested include somewhere.
The warning, though, comes up in a Visual header (useoldio.h) and I have no indication of what line in *my* code that is actually including the wrong file. Any ideas on how to figure this out? Of course this isn't life-threatening, but it is a nuisance.
Even a broken clock is right twice a day.
|
|
|
|
|
old standard:
#include <iostream.h> // this is what generated the warning
new standard
#include <iostream>
look for std headers in your project everything which has <[stdheader].h> might be the problem
|
|
|
|
|
Yeah, I know that. I may not have made it clear thouugh - I can't seem to find the old std headers in any of my source files. That means it's buried somewhere, but I don't know any good way of figuring out what's doing it.
Even a broken clock is right twice a day.
|
|
|
|
|
I did:
RECT rect;
GetClientRect(this,&rect);
and got
C:\ATRAIN2\VcDemoResizerTHB\DialogDemo1.cpp(59) : error C2660: 'GetClientRect' : function does not take 2 parameters
though I found:
The GetClientRect function retrieves the coordinates of a window's client area. The client coordinates specify the upper-left and lower-right corners of the client area. Because client coordinates are relative to the upper-left corner of a window's client area, the coordinates of the upper-left corner are (0,0).
Syntax
BOOL GetClientRect( HWND hWnd,
LPRECT lpRect
);
Appreciate your help,
ns
|
|
|
|
|
That is the WIN32 API routine. The MFC routine when used inside of a class method just takes the rect as the single argument.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Got it! So MFC sort of knows which is being used - the API one or thh CWND one.
Appreciate your help,
ns
|
|
|
|
|
use
GetClientRect(&rect);
You must to be ussing the MFC class version.
If you want to use the WINDOW version mas to use
::GetClientRect(this,&rect);
Carlos Antollini.
Pi Five[^]Creator
Sonork ID 100.10529 cantollini
|
|
|
|
|
Finally, you use an & in the argument, and MSDN says just the rect, no &......it compiles either way. Which is right?
Appreciate your help,
ns
|
|
|
|
|
read(anything MSDN, book, C++ standard) about c++ scope resolution operator.
|
|
|
|
|
Depends.
If you use a variable type RECT you must to use & becuase you must to use a long pointer to RECT LPRECT
for example
RECT rc;
::GetWindowRect(hwnd, &rc);
or
LPRECT rc;
::GetWindowRect(hwnd, rc)
Best Regards
Carlos Antollini.
Pi Five[^]Creator
Sonork ID 100.10529 cantollini
|
|
|
|
|
I have a modeless dialog that can be stretched. If I want to know its height and length how do I get this? If I have a button on this dialog and want its dimensions hwo do I ?
I'm reading about GetCLientRect and GetWindowRect but am not sure how the functions know whose dimensions they are getting since both take the rect structure as arhgument but arent told which object they are getting the measurements for....
CWnd::GetWindowRect
void GetWindowRect( LPRECT lpRect ) const;
Appreciate your help,
ns
|
|
|
|