|
Not clear from where u want to trap the keys. if it is from ur app dialog just use ON_WM_KEYDOWN - OnKeyDown msg handler. Otherwise, if u want system wide key trap , see documentaion of the API SetWindowsHookEx.
Best wishes..mil10
|
|
|
|
|
Like it says in winuser.h
/* VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39) */
/* VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A) */
Example...
void CMyCtrl::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if( nChar == 'A' )
{
}
}
|
|
|
|
|
hi!
i want to use IAccessible interface and other Accessibility interfaces.
when i compile .cpp file the complie error is "IAccessible' : undeclared identifier"
in msdn its specified that we IAccessible is declared in "oleacc.h" and use "oleacc.lib"
so i made an entry of oleacc.lib in
"Project->Settings->Link->object/library modules"
but still i am getting the same error.
next i tried
#import "oleacc.lib" in the .cpp file
the compile error is
"Cannot open type library file: 'oleacc.lib'"
so whats the way out?
thanks
anshu
|
|
|
|
|
I have soem queries regarding component versioning.
I had a component named "Old_Component" exposed as an STA, out-of proc COM server, developed in VC++. This is wrapped by another component "Old_Component_Wrapper" which is in-proc COM server and exposed to client.
Now we are planning to provide new version of our product.
In new version, we are thinking of removing the wrapper layer. That is we want to expose "Old_Component" to client instead of "Old_Component_Wrapper". Can you tell me is this possible? Or what can be the possible issues in doing this?
|
|
|
|
|
I want to make a combobox with bitmap items.
<br />
m_list.Create(IDB_BITMAP2, 50, 0, RGB(255,255,255));<br />
m_Lang.SetImageList(&m_list);<br />
<br />
COMBOBOXEXITEM cbItem;<br />
cbItem.mask = CBIF_IMAGE;<br />
cbItem.iItem = nItem;
cbItem.iImage = nImageIndex;
m_Lang.SetItem(&cbItem);
Like upper coding or another mehod, please give a help to me.
|
|
|
|
|
Hi!I have a strange question about the Vector.
I want to use vector in my project,but when I try to build my project.
Occur the errors like this:
c:\program files\microsoft visual studio\vc98\include\new(35) : error C2061: syntax error : identifier 'THIS_FILE'
c:\program files\microsoft visual studio\vc98\include\new(35) : error C2091: function returns function
c:\program files\microsoft visual studio\vc98\include\new(35) : error C2809: 'operator new' has no formal parameters
What can I do? I really want to use vector,use the STL container,but seems the VC++ not support the STL containers,anyone can help me? thank's
|
|
|
|
|
Did you add this line before defining any variable of type vector?
using namespace std;
A. Riazi
|
|
|
|
|
Move the include above the macro mess (redefinition of the new operator) that is added by MFC. You should end up with something like...
#include "stdafx.h"
#include "DlgDummy.h"
#include "DlgDummyDlg.h"
#include <vector>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
using namespace std;
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
I have created a dialog in the resource of VC++
Then I change the Class from CDialog to CDialogBar
I add a menu --> Show CDialogBar
--> Close CDialogBar
I created a variable in the CMainFrame header file
public:
CMyDialogBar *m_wndMyDialogBar;
under Show CDialogBar:
m_wndMyDialogBar = new CMyDialogBar;
m_wndMyDialogBar->Create(......); <-- i forgot the parameter
m_wndMyDialogBar->ShowWindow(SW_SHOW);
but the DialogBar only appeared when i try to resize the window.
I invoke the Invalidate() and the RedrawWindow() still i have to resize
the window just to make the DialogBar appear.
what should i do please help ....
syalexanderph@yahoo.com <--- please email me
|
|
|
|
|
send your code to me, i maybe help you.
dexo@etang.com
|
|
|
|
|
Alright I have a browse button on a dialog, and next to that is an exit box, can't figure out how to have the directory name and file automaticly placed into the edit box. For example if you hit browse and choose a file in C:\blah\ and the filename is blah.txt in the edit box you will see: C:\blah\blah.txt
Thanks for any help that can be given.
|
|
|
|
|
|
|
I want to create a pager control using CreateWindow function at CMainFrame class of the application:
---------------------
if (CreateWindow(WC_PAGESCROLLER,NULL,PGS_HORZ|WS_CHILD, 0, 0, 0, 0, m_hWnd, NULL ,AfxGetInstanceHandle(),NULL) == NULL)
{
AfxMessageBox("Failed creating the pager control.");
return -1;
}
----------------------
The function returns NULL, which means failing in creating one. Can you help me to create the pager control?
Eilzabeth
|
|
|
|
|
First of all, you should call ::GetLastError() to see why the control isnt created.
And my first guess would be you forgot to call InitCommonControlsEx with ICC_PAGESCROLLER_CLASS.
Magnus
|
|
|
|
|
Yes, I did.
-------------------------
LPINITCOMMONCONTROLSEX lpInitCtrls = new INITCOMMONCONTROLSEX;
lpInitCtrls->dwICC =ICC_PAGESCROLLER_CLASS;
InitCommonControlsEx(lpInitCtrls);
if (CreateWindow(WC_PAGESCROLLER,NULL,PGS_HORZ|WS_CHILD, 0, 0, 0, 0, m_hWnd, NULL ,AfxGetInstanceHandle(),NULL) == NULL)
{
AfxMessageBox("Failed creating the pager control.");
return -1;
}
-------------------------
I have the code in the CMainFrame class at end of the OnCreate function.
Eilzabeth
|
|
|
|
|
And what return value do you get from ::GetLastError(); ?
Magnus
|
|
|
|
|
The GetLastError function returns a DWORD. How can I tell from such a number? At GetLastError documentation, it says use FormatMessage to get the error string. But I don't know how to do it. Can you help me?
Eilzabeth
|
|
|
|
|
I got the error message now. It says can not find window class.
Eilzabeth
|
|
|
|
|
Hi
One easy way to convert an error number is to use Error Lookup (under your tools menu in visual studio)
If it cant find the window class, then you get some error from InitCommonControlsEx, you should always check all return values from APIs as most of them report what went wrong with SetLastError().
If the code you sent is correct then you dont set dwSize of the INITCOMMONCONTROLSEX struct. And that makes InitCommonControlsEx fail.
Hope that solves your problem.
Magnus
|
|
|
|
|
I got it. I set the size to the size of the structure (dwSize = sizeof(INITCOMMONCONTROLSEX). Thank you.
Eilzabeth
|
|
|
|
|
I need to compare local file Date Last Modified times with the same times of files on a FTP server. I've used the CFileFind/CFtpFileFind classes to get the times in the form of CTime classes, but now how do I properly compare them? The local file times are in GMT-6 (sometimes with DST) and the server file times are GMT with no DST. Proper DST support isn't that critical (I can require people running my program to disable DST), but I still need to compensate for GMT. I haven't found a good way to compare two CTime classes, one in GMT and one not. I can use the GetGmtTm() function, but I don't know an easy way to compare two tm structs.
Thanks!
|
|
|
|
|
Take a look at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/time.asp
it should have all information you will need.
Magnus
|
|
|
|
|
hello
how to add a color and icon to one button?
|
|
|
|
|
Plenty of articles on the site to show you how.
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|