|
Hi Micheal. Thanks. I will try this.
|
|
|
|
|
Hi Michael.
I tried this. I ended PUT ALL the functions insides the template itself all in the header file. But it is still the same Link 2001 unresolved external symbol error. I can't understand it. I never had to put all the functions in the template in the heade file if it is not derived from it. It works fine.
I am really confused now as to what is actually the problem. It must be syntax. Right now I just want to change it to this class and its derived class to a template. I am not actually using the <class X> part yet meaning it should still work as before without the template declarations.
Any other ideas? Appreciate your help through this
|
|
|
|
|
I include a gif resource into my project but every time I build it the gif becomes 0 kb and when I try to view it in windows it says no preview available. I am using MS VC++ 6.0 w/ service pack 5. Anyone else with this problem?
|
|
|
|
|
http://www.wintellect.com/forum/topic.asp?TOPIC_ID=1132
so im creating this System Wide Keyboard Hooking Function, and i thought it would catch everything , but this group is having a discussion about it, and one says a SWKH will not catch a Ctrl-Alt-Delete, is that true??
todo....
:: insert inpirational text here ::
|
|
|
|
|
Of course not. The whole point of C+A+D is that it's secure - when you press it, only the OS responds to it.
--Mike--
I'm bored... Episode I bored.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Believe me:
if you want to catch Ctrl+Alt+Del you must do one of this things:
1. Create a Gina DLL.
2. Get a Gina DLL from somewhere.
the reason is clear:
In order to be secure its forbidden to get acces directly from an app to the Login part of the OS.
You've got to do it via a GINA that must be installed in the OS copying it somewhere and giving it's right path in the registry.
Take a look at the MSDN in order to find out more.
hope this helps...
|
|
|
|
|
|
|
Hey guys,
I'm having some trouble with a std::map object I'm trying to use. Can any STL guys out there see something I'm doing wrong in my code. I've been debugging this for a couple hours now, stepping through STL code (which isn't fun!).
All I'm trying to do is associate a structure with a string. So, I insert a value_type with a string and a structure, then I try to look up the exact same string, and I get an invalid iterator. One wierd thing, is that it works perfectly for the first item I insert. Looking at the guts of the tree, I can see that the second object is there, it just checks the wrong side of the tree when it goes to look it up .
typedef basic_string<TCHAR> CTCharString;
struct CTCharStringLess : public binary_function<CTCharString, CTCharString, bool>
{
bool operator()(const CTCharString& x, const CTCharString& y) const
{
return _tcscmp( x.c_str(), y.c_str() );
}
};
typedef struct tagFoo
{
long Bar;
}Foo;
typedef map<CTCharString,Foo,CTCharStringLess> CStdMapStringToStruct;
CStdMapStringToStruct MyMap;
Foo stMyStruct;
MyMap.insert( CStdMapStringToStruct::value_type( _T("dummy_item", stMyStruct ) );
CStdMapStringToStruct::iterator oIter = MyMap.find( _T("dummy_item") );
MyMap.insert( CStdMapStringToStruct::value_type( _T("dummy_item_2"), stMyStruct ) );
oIter = MyMap.find( _T("dummy_item_2") );
Thanks,
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
i suspect :
return _tcscmp( x.c_str(), y.c_str() );
should be
return _tcscmp( x.c_str(), y.c_str() ) < 0;
|
|
|
|
|
Wow, do I feel like a dummy. Of course, your suggestion works perfectly.
Thanks!
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
Hey all, me again
i started a new thread because (thanks to all the cpians) i figured out the initial parts of the app i needed, and now its onto the next issue I have
to keep people from exiting my app , i need to disable all the ctrl-alt-delete , altf4 stuff, and the ::pretranslatemessage stuff is not quite robust enough for me
so apparently i need to create a system wide keyboard hook.....
i have no idea how to start.
please help
josh
todo....
:: insert inpirational text here ::
|
|
|
|
|
System Wide KH only can be in a DLL so...
STEPS:
1. You must create a DLL.
2. Declare a static callback function:
static LRESULT CALLBACK HookTeclatLL(int nCode,WPARAM wParam,LPARAM lParam);
3. Create a f(x) that you'll export in order to start/stop that hook depending on a boolean parameter:
Setting the hook:hHookTeclat = SetWindowsHookEx(WH_KEYBOARD_LL, HookTeclatLL, hInstDLLSCT, NULL);
Unhooking:
if(hHookTeclat != NULL)
{
UnhookWindowsHookEx(hHookTeclat);
return true;
}
4. in the static callback f(x)...
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;
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));
if (!bEliminarPressioTecla)
{
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);
}
I didn't wanted to format all that code... copy it and examine it outside the web page...
Hope this helps...
I'll go to sleep...
|
|
|
|
|
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.
|
|
|
|