|
Hi All,
When i am porting a VC++ 6.0 application to VC++ 9.0, i am getting a assertion in keyboard handeller.
This is what i ma doing.
Mapping the function keys F1 thru F12 to bialog buttons. There is no assertion when i press F1 thru F11, but when i press the F12 key to activate that particular buttion, this is the message that is popping up with assertion.
"Windows has triggered a breakpoint in application.exe.
This may be due to a corruption of the heap, which indicates a bug in application.exe or any of the DLLs it has loaded.
This may also be due to the user pressing F12 while application.exe has focus.
The output window may have more diagnostic information."
Code:
CKeyDef *CKeyboardCtrl::HandleKeyboardMsg(MSG *pMsg)
{
UINT msgCode = pMsg->message;
switch (msgCode) {
case WM_SYSKEYDOWN:
msgCode = WM_KEYDOWN;
break;
case WM_SYSKEYUP:
msgCode = WM_KEYUP;
break;
}
ASSERT(msgCode == WM_KEYDOWN || msgCode == WM_KEYUP); //Assertion for F12
long keyCode = pMsg->wParam;
CKeyDef *pKey = LookupKeyCode(keyCode); //Assertion for F12
}
CKeyDef * CKeyboardCtrl::LookupKeyCode(long keyCode)
{
for (KeyList::iterator it=m_keyList.begin(); it != m_keyList.end(); it++) {
if (it->m_keyCode == keyCode)
return &*it;
}
return NULL;
}
Thanks Everyone.
|
|
|
|
|
F12 is debugger hotkey for breaking the execution. If you press F12 when your application is debugged, then debugger will catch it and break at current line of execution. Run your application standalone and your application will be able to catch F12. Nothing to worry that its expected behavior and not a porting bug.
To demo the F12 fact, Create a dialog application, run by F5, then take the dialog and press F12. The debugger will break to the current line of execution.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hi raj,
Thanks. There is no assertion in release mode.
Thank you.
|
|
|
|
|
What i mean is if i want to hook a function
Somefunction(int arg1, int arg2);
Now this function has unique byte signature like /B2/C5/12/88.....
Is it possible to hook this function using the bytes and how would i do it?
|
|
|
|
|
What's the best way to have a certain menu only appear in DEBUG (or the reverse in RELEASE) ?
I've manually edited the resource file like this :
#ifdef _DEBUG
POPUP "Debug"
BEGIN
MENUITEM "Debug Command", IDM_DEMO
END
#endif
but I'm not certain this will survive future editing of the resources.
There's also a "Condition" for a whole menu, but that's a bit extreme.
I know I could add the menu programatically, but I'd like to be able to not have to do it.
Thanks.
|
|
|
|
|
Doesn't typing _DEBUG in the condition field do what you want?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
If your using MFC, then you can use a feature of your .rc file to do what you want:
If you open the .rc file as text you will find resources of type TEXTINCLUDE. If you add your menu definition code block as a string to one of these then it should quite happily persist between builds etc as VS preserves these resources "as is".
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\r\n"
"ifdef _DEBUG\r\n"
"IDR_MY_MENU MENU DISCARDABLE\r\n"
"BEGIN\r\n"
" MENUITEM ""Debug Command"", IDM_DEMO\r\n"
"END\r\n"
"#endif\r\n\0"
END
If you vote me down, my score will only get lower
|
|
|
|
|
that's a christmas gift...
will try it next year when I go back to work.
This signature was proudly tested on animals.
|
|
|
|
|
I'd like to be able to display a message on a WinXP computer which has been locked. This needs to be workable on both a machine which is locally locked (the user hit Windows-L and walked away) or a machine which is being used remotely. In either case, Windows displays the desktop wallpaper with a dialog box entitled "Computer Locked".
I can modify the wallpaper and I know how to change the title of the locked dialog box. These, however, are only static methods. I'd like to be able to but up a message that could be changed by the remote user. For instance "I'll expect to be finished with this machine by 2:30 today.".
My application is for lab machines which are used by both walkin and remote users. When someone walks up to a machine, they would like to know the status of that machine. If a remote user is using it, it would be helpful if they could update their status as needed so it displays on the machine.
Anyone know how I can direct output to this locked desktop?
Thanks
Al
|
|
|
|
|
Hi,
Sorry I can't help with the code, but are you convinced you have the right answer to your problem and users will update it as you want? You might end up with all your computers displaying "busy" or, or if requiring a time entered, you might just get most people entering some late time to make sure nobody user 'their' computer whilst they go for a drink!
|
|
|
|
|
I can see you've been there also . My real issue is with remote users that are using a machine but it appears that someone has just walked away for a while and other users get upset and log them out. The ability to stick a virtual postit note on the screen will help with this.
|
|
|
|
|
Hi everyone,
I would like to install a Vista Gadget programmatically from a win32 application. It appears at first sight that adding a gadget just consists in deploying a couple of files and adding a bunch of entry in the settings.ini
file, but there are two issues:
1/ When I update the settings.ini file to create the section for the new gadget the sidebar is not updated and I have to restart the process to get the new gadget displayed. Do you know if there is some kind of messages I can send to the sidebar to refresh its content?
2/ There is a Hashes section in the settings.ini file that lists every gadget available. Each entry contains the complete path to the gadget folder plus a hash value. Does anyone know how this value is computed?
Thank you for your help,
Yannick
|
|
|
|
|
Hi Frnds,
I have developed one application in visual studio 6.0. it will communicate with one PCB via RS485. The problem am facing in the application, sometimes if i close the application, the exe is running at the back side, am closing it suing task manager. i have closed the handles of the RS485 communication at the deconstructor of my class.
Request anyone help.
Thanks ,
Balaji s
|
|
|
|
|
Hi,
I've seen similar problems. The first thing I would recomend is to write Open and Close methods. Make sure you check the return values for any errors and display a message box with any error so you can se exactly what the problem is. Then add calls to these from, say, a menu. E.g. a Comms menu with Open and Close options. This will allow you to test if the port truly gets closed when you call Close. Can you then perform Open, Close, Open, Close with no problems?
This separates closing the port from the closing of the application.
Once the Close is proven, then add it to the OnClose window event rather than the destructor.
I'm afraid I don't understand what you mean about closing the application but the exe still running. Do you have a client and server and you close the client in task manager but the server (exe) is still running?
|
|
|
|
|
Hi,
Thanks for your reply.
am using the write , read and close functions.after closing my application, if i try to open once again, it says that still exe is running. so i used to task manager to close th exe.
thats the problem happening here.
regards,
balaji sk
|
|
|
|
|
Well, I'm not sure how much significant is my reply. Usage of TerminateThread()[^] can end up in application handups. If you're calling them just remove it.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
As I've noticed, Windows Explorer uses the icon with the lowest ID within an EXE file to represent it to the user. Is there any way to change this Icon for EXE files dynamically? (I mean replacing it with a custom one)
Thank you masters!
|
|
|
|
|
This pretty girl[^] knows how to replace resources in EXE and DLL files. She probably also knows how to use the codeproject search engine. How does that make you feel?
Best Wishes,
-David Delaune
|
|
|
|
|
Randor wrote: This pretty girl[^]
At first i didn't understand it. Once i opened the link, i got it.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Who's she any way? Is she single or married?
Thank you masters!
|
|
|
|
|
|
As a practical suggestion, if you have some type of malware installed on your system, it can be very difficult (even for an expert) to determine what it is and where it lives (and, of course, how to terminate it).
I would start out by downloading: Process Explorer, by Mark Russinovich[^]. It's a FREE utility, written by one of the authors of "Windows Internals". It provides a wealth of information.
To answer your question, "How can I run my code in this manner?", you should check the Forum at EvilDoers.com (OK, just kidding),...but, there is no simple answer. It depends on many factors. I could be as simple as writing an ActiveX component or a Shell Extension (tutorials here at CodeProject), or, it could be as complex as a Windows rootkit. I suspect that nobody here will help you with the rootkit. But, you can GOOGLE, say rootkit[^], and you will find an enormous amount of information on the subject.
|
|
|
|
|
Thank you for these information. I learned new things.
Thank you masters!
|
|
|
|
|
Check this[^] out, maybe it helps.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
Hi everyone
I'm having some trouble solving this problem, if you guys could help I'd appreciate.
A guy has N stores. He just received a shipment of K boxes and wants to distribute the boxes in order to maximize profit. The input is a NxK matrix, where matrix[N][K] tells you the profit he would get, sending K boxes to store N. One wants to know the maximum profit he can get (not necessarily the way he gets it), and how may ways can he get it (number of combinations that totalize the maximum profit).
Any suggestions?
Thx
|
|
|
|