First of all, you'll have to make a dll to set a system-wide hook.
In this dll you'll have to register your keyboard hook procedure.
Your hook function will be called on every keypress the user makes, so at that point you check what key has been pressed and with the function 'GetAsyncKeyState' you can see wether ctrl, alt or one of the shift keys is down as well.
Next, you'll have to create an application which loads the dll and call a function in the dll to register the hook procedure (if not done by loading the dll).
If you want to keep things clean you should have a funtion in your dll to unhook your thing if you no longer need it, or close your app...
Does anyone know how to make an application (e.g. Dialog based) ignore Windows key + M?
I think I've figured out that Windows uses MoveWindow to minimize the application window (it also seems that Windows moves the application window outside the screen), but no matter how I try to override WM_WINDOWPOSCHANGING, the application window vanishes.
Any clues and hints are appreciated!
PS. I don't want to disable the Windows key by some registry hack.
i've been writing a simple app that draws a bitmap held in resource.
The idea Was to move a bitmap from x1 to x2 - simple animation.
I have never met such a problem with WM_PAINT / UpdateWindow,
the animation can be seen only when i drag another application over my form (it refreshes then) - it looks there is a problem with WM_PAINT in my app, can't get it working - any ideas?
Normally 99.9% of my apps (where some drawings are done) are refreshed using:
And after that call, everything is fine, but this time it doesn't work - any tip ?
Ok, I am stumped, I hope someone out there can help me. FYI I am using Win 98 with VC++ 6.0. I am trying to create a list control to display text output to a window. Since I am new to using the WIN32 API I am trying to create a List Control with some generic text output so I have a working example. I can create the List Control and insert Columns and Items with no problem but when the window is displayed I get no output. I have called ListView_GetItemCount, ListView_GetColumn, and ListView_GetItem macros and can see the info that I have added. I am trying to create the 2nd window in a 2 window app.
What do I need to do in order to display the data in an Edit Window that I have created? I am totally confused on how I get the data to display. I have looked at the List Control articles but I don't see any discussion about this question.
FYI...I have created and displayed the parent window, an edit window and a header control window with no problems.
List Control Create:
/* NOTE: I have tried this both ways shown below and neither
one seems to work (Nothing is displayed in the window.
rc = SendMessage(HWndSeasonList, WM_SETREDRAW, TRUE, 0);
btest = InvalidateRect(HWndSeasonList,NULL, TRUE);
btest = UpdateWindow(HWndSeasonList);
*/ btest = ShowWindow(HWndSeason,SW_NORMAL);
Error = GetLastError();
I'm wondering if I'm doing my message handling all wrong. Currently
when I send my thread a messages (using postthreadmessage from my main
app.) I handling it in the PreTranslateMessage function. While reading
the MSDN I noticed that it said that all messages come in to the run
function and are then passed on to the PreTranslateMessage function.
Is this true? What are the remifications of leaving it like it is if
I have this asynchronous pluggable protocol handler (apph) that I'm trying to integrate into a an MFC application.
I've based my view on CHtmlView and call the apph using the Navigate2 method.
This works as expected.
Now, the apph is designed that - at initialization - you have to call a routine to set some variables (current path, ...).
These are statically stored inside the apph to make them persistant for the life of the apph.
The problem I'm facing is this:
After a few minutes of inactivity of my MFC application, MSHTMLED.DLL gets unloaded which also unloads the apph.
Whenever I try to click a link in my MFC application, it will fail from now one, as the apph was unloaded (and the static variables are gone). The apph is automatically loaded after clicking the link though, but the initialization phase is skipped of course.
Question: is there any way so I can MFC in tricking not to unload my protocol handler?
I beleve not many of you had this kind of problem but if anyone knows what shoud I do it would be great. I am writing an application in Serbian language and that includes writing some non-English letters such as: Š, Đ, Ž, Ć and Č. Everything works fine but with the last two. They look fine inside the code but when I compile it they turn into C. I've tryed with different regional options and different encoding but nothing helped. I'm out of ideas and my deadline is coming closer and closer every day, so if anyone knows how to solve this one please help.
In the code I've got this: label = group + '/';
These variables are of type std::string.
At this point group contains "Vehicle". When label contains "name" or "mass" the label is correctly reseted to "Vehicle/". But when it comes to "MountPoints" it just sets it to ??? (According to the watch in VS). If I in the text-file cut down that row to just "MountPo", it works. Why??? Anyone knows?
I wrote a screensaver that mutes the volume using a call to mixerOpen followed by all the other relevant calls to get the ID of the MIXERCONTROL_CONTROLTYPE_MUTE. It works fine on my Windows98 machine, muting the sound perfectly. However it never works on WindowsXP, I believe that the mixerOpen function keeps failing. Does anyone have any ideas of how to mute the sound on XP. Unfortunately I don't have an XP machine that I can develop on.
I am a beginner at Visual C++. I created an editbox with an dword variable. I would like to enter hexadecimal values in the format for example 004FD210 and i want the corresponding variable for the editbox or (maybe with a small code others) to have corresponding decimal value. I thought to read into a string andthen to convert it to integer value. But is there a shorter way. Pls.
converting string to interger: value strtol(), strtoul().
converting interger value to hex string: sprintf(pStr,"%X",nValue).
If you want to convert to hex string with leading 0's:
sprintf(pStr,"%8.8,X",nValue); // 00000000
sprintf(pStr,"%*.*,X",8,8,nValue); // 00000000
I believe those should work for ASCII formated string.
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
I am writing a program that continuously stores data from an external memory.
// Do stuff over here
}// end while
However, when it runs, it takes all the memory (program is not responded).
I have another button (Stop) to call method to set isConnected to False in order to get out of the loop. However, I didn't even have a chance to hit that button because the program is freezed.