|
keegan wrote:
I'm using GetKeyState(VK_CONTROL) to see if control key is depressed.
GetKeyState() is probably not the right API. MSDN says: "The key status returned from this function changes as a thread reads key messages from its message queue. The status does not reflect the interrupt-level state associated with the hardware. Use the GetAsyncKeyState function to retrieve that information."
About GetAsyncKeyState() MSDN says: "The GetAsyncKeyState function determines whether a key is up or down at the time the function is called."
So GetAsyncKeyState() is what you want. You can call it like this:
BOOL bScrollLockDown = GetAsyncKeyState(VK_SCROLL) >> ((sizeof(SHORT) * 8) - 1);
keegan wrote:
when the ctrl key was pressed, other keys had abnormal values. For instance, in the OnChar function i have, if the user held control and hit the letter 'd', nChar would be equivalent to 7. d was equivalent to 4, a = 1, b = 2, c = 3, and so on. Now i looked at www.asciitable.com and i didnt see any numbering system that starts with a = 1 and increments with each letter.
The CTRL+key is ancient ASCII. You can see a chart here.
HPS HwndSpy - GUI developer's aid to visually
locate and inspect windows. For the month of August
only, use coupon code CP-81239 for 30% off.
|
|
|
|
|
Hi there,
Kindly tell me how can we retrieve the icon associated with a file which is defined by the application used to build that file.
Actually I've got a list of files which I want to display in a List Control along with the icon associated with it.
Regards
Gaurav
Gaurav Gumber
|
|
|
|
|
How about FindExecutable() and ExtractIcon() ?
|
|
|
|
|
Here's a function I use:
HICON GetFileIconHandle(CString cstrFileName, BOOL bSmallIcon)
{
SHFILEINFO sfi;
if (bSmallIcon)
{
SHGetFileInfo((LPCTSTR)cstrFileName,
FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(SHFILEINFO),
SHGFI_ICON | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES);
}
else
{
SHGetFileInfo((LPCTSTR)cstrFileName,
FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(SHFILEINFO),
SHGFI_ICON | SHGFI_LARGEICON | SHGFI_USEFILEATTRIBUTES);
}
return sfi.hIcon;
}
Jason Henderson "I can picture in my mind a world without war, a world without hate. And I can picture us attacking that world, because they'd never expect it."
- Jack Handey
|
|
|
|
|
Hi,
I'm using Qt for my application (but my question has nothing to do with Qt) and I'm using a global pointer, qApp.
I can use it everywhere in my classes, without having to do an 'extern'.
How is this possible ? When I want to declare my own global variables and use them in other files, I have to declare them 'extern' ???
Anyone could explain me this ?
Thanks !
Jerome
|
|
|
|
|
I'd imagine it's declared extern in some header file you're including in all your source files. I'm not that familiar with Qt, so I don't know where you'd look.
|
|
|
|
|
In C++. yes.
You need to declare extern to tell the compiler to look for the global variable in the obj files.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Hi,
I have an MFC application were in a View i dynamically create a set of Controls(Edit,Button etc).At one point i want to destry all the controls created in a view and create new controls.I am using destroy() window to destroy controls before displaying 2nd screen.
But both the screens are messed up..Controls are not deleted on calling Destroy()..Pls help
Thnks
Valar
|
|
|
|
|
Perhaps it would be easier to design two classes derived from CFormView, one carrying the first set of control, the other one the second set.
You could then replace the views as needed.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
|
Hi all
How i can to get color of pixel on my device context.
I get device context of my dialog box sucessfully and fill necessary rect by black color (COLORREF cr = 0x00000000).I watch so it was succesfully too.But when i get color of pixel from this rect by GetPixel routine it functiont retreive me unexpexcted color (not black)
Why???
Thanks.
|
|
|
|
|
The GetPixel() API expects screen coordinates, not client. You should call ClientToScreen() for your rect before calling GetPixel() .
HPS HwndSpy - GUI developer's aid to visually
locate and inspect windows. For the month of August
only, use coupon code CP-81239 for 30% off.
|
|
|
|
|
we are developping a screen capture app, but it is too slow.
the steps are:
1. get WindowDC or screen DC
2. create compatible bitmap and DC
3. call BitBlt function to copy image to compatible DC
4. GetDibits of compatible bitmap then save it to a file
the problem is:
step 3 is too slow (over 200 ms), we need to get all info in 30 ms.
we believe that there must be other ideas to do that, because we know many capture apps work very well.
do u have another idea or how to let it work faster ?
thx in advance
includeh10
|
|
|
|
|
This article may or may not be close enough to what you need. It does something entirely different but may trigger some ideas.
http://flounder.com/screencapture.htm
|
|
|
|
|
thx, but it looks the same as above code ...
includeh10
|
|
|
|
|
Just an idea:
Did you try simulating PrintScreen and grabing from ClipBoard (if allowed)?
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
Hi!!!
I have a problem reading a checked menu item.I am catching the WM_COMMAND
message and using (LOWORD)wParam checking if the menu item is selected.Can I check if the menu item is checked or not .
Thanx in advance.
|
|
|
|
|
|
Thanx !!!
It worked for me. Are there any articles on Menu Handling apart from MSDN examples.
|
|
|
|
|
|
Problem on porting from VC 6 to VC 7 - context sensitive help [Shift F1 Help] - using Onhelphittest()
OnHelpHitTest() return dialog contol ID to MFC and MFC calls COurWinApp::HtmlHelp()
Which is processed. and appropriate help is displayed. In VC7 MFC isn't calling COurWinApp::HtmlHelp()
HtmlHelp() function is not called instead gives "Failed to launch help" message.
Code Snippet below
------------------------------
To implement Shift F1 help for COurDlgCtrl
#1. we added
LRESULT COurDlgCtrl::OnHelpHitTest(WPARAM wParam, LPARAM lParam)
{
return GetDlgCtrlID(); // Nonzero value
}
#2. Then we added this
void COurWinApp::HtmlHelp(DWORD dwData, UINT nCmd )
{
DWORD HelpID = -1;
WORD wCtrlId = LOWORD (dwData);
WORD DlgCtrlId = HIWORD (dwData);
HANDLE hHtmlHelp;
// Map the Dialog Control IDs to corresponding Help IDs
switch (nCmd)
{
case HELP_CONTEXT:
switch (wCtrlId)
{
case OurDlgCtrlID:
HelpID = IDH_TEMPDLG_DRAG;
break;
default:
HelpID = -1;
}
hHtmlHelp = ::HtmlHelp(NULL,
m_pszHelpFilePath,
HH_HELP_CONTEXT,
HelpID);
}
}
For VC 7 migration
#3. We added EnabeHtmlHelp() in constructor of COurWinApp.
This still doesn't seem to work.
HtmlHelp() function is not called instead get "Failed to launch help" message.
Thanks in advance
Pralhad
|
|
|
|
|
Hi,
I could not execute any MFC files in my system as soon as I execute them , the system comes to a complete halt. A few minutes before I saw this happening to all the executable files in my system...can anyone help me..
Regards
Deepak Samuel
|
|
|
|
|
|
Deepak Samuel wrote:
...execute any MFC files...
Please explain, as MFC files are DLLs, not EXEs. Are you saying that programs built with MFC are causing the system to halt?
|
|
|
|
|
Hello friends,
I have created a folder, which is a shared folder on network.
Now as we know that there are sharing rights like Read, read/write,....etc.
I want to give Read only access to the folder. i hve tried with the ACCESS_READ Flag with the Netshare function but it Fails i mean the folder is still having Read/Write Access !!!!!!!!!!
Can anybody help me out ???????
Thanx
TAKE CARE
|
|
|
|