|
U need to add an accelerator for the menu item
go to resource view, open Accelerator folder, open IDR_MAINFRAME
accl. table there u specify id of ur menu item & the short cut key u want
& it's type should be VIRTKEY
|
|
|
|
|
Hi giftsana,
maybe it is some helpful to you
/////////Example CDialog//////////////
1from Add resource Insert a Accelerator(IDR_ACCELERATOR1)
2in the Accelerator ID Modifier Key Type
3 ID_FILE_OPEN Ctrl O VIRTKEY
(ID_FILE_OPEN here is same with declare ID in Menu(ID_FILE_OPEN)
4 then insert HACCEL m_haccel=LoadAccelerators(AfxGetApp()->m_hInstance,(LPCTSTR)IDR_ACCELERATOR1);
5 insert this function
BOOL CAnswer::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message>=WM_KEYFIRST&&pMsg->message<= WM_KEYLAST)
return TranslateAccelerator ( m_hWnd, m_haccel, pMsg );
return 0;
}
---------------------else CDialog--------------------------
my answer is same with thatsme_cool
ID item(Menu) in Accelerator is same with ID item in Menu
|
|
|
|
|
Hello
Thank you very much for the suggestion.
So this should help me to programatically open e.g. the 'Open' submenu window using the shortcut key 'Ctrl+O' right? likewise i should be able to open all other existing submenu windows with their shortcut keys programatically.
Thanks
Giftsana
|
|
|
|
|
Few years ago I took from CodeProject a Hyperlink class witch defines a IDC_HAND as MAKEINTRESOURCE(32649) and I don't known it's copyright author. Can you help me? I want to mentions his full name in my application. The header looks like this:
class CHyperlinkStatic : public CStatic
{
public:
CHyperlinkStatic();
public:
public:
protected:
virtual void PreSubclassWindow();
public:
virtual ~CHyperlinkStatic();
protected:
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnPaint();
afx_msg void OnDestroy();
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg LRESULT OnMouseLeave(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()
public:
void SetHyperlink(CString strHyperlink);
void SetCaption(CString strCaption);
private:
CString _strCaption, _strHyperlink;
CFont _fontCaption;
CSize _sizeCaption;
bool _bCreateFont, _bMouseInControl, _bGetCaptionSize;
HCURSOR _hHandCursor, _hArrowCursor;
void CreateFont();
void GetCaptionSize();
bool InCaptionRange(CPoint &point);
}; (I might modified the class name and I don't known it's original name)
|
|
|
|
|
|
i have to develop a device driver for windows NT that will add a virtual audio device to the system. i need to hook up and capture the audio stream coming from microphone and send it to two differnt application. can anyone tell, is it possible or not?
if it is, where do i need to hook in the driver stack keeping in view that i can not replace miniport drivers.
is there any alternative to this
saad
-- modified at 5:21 Wednesday 12th April, 2006
|
|
|
|
|
I think a filter driver is what you need.
|
|
|
|
|
thank you kakan for helping me out
i have some Questions
can i show a separate virtual audio device with a filter driver?
2ndly we have different MSVAD drivers in DDK samples. are thay filter drivers?
can i use those sample codes for my work
saad
|
|
|
|
|
Hi All,
I am adding tooltip for a chart using CToolTipCtrl. No in-built method of chart drawing is used.
I am adding one column of chart as tool, but I cannot see the tooltip. When I tried to retrive the toolinfo again, the rectangle values are too different.
The code is like this.
CLineChart :: Create()
{
EnableToolTips(true);
mToolTip = new CToolTipCtrl();
mToolTip->Create(this);
}
CLineChart :: Draw()
{
CRect AreaValues; // This rectangle is determined to draw grid for chart
CString tText; // String to hold tool tip text
RECT tRect; // Tool rectangle
while adding columns (for c = 0 to 30)
{
tRect.top = AreaValues.top; // e.g. 8
tRect.bottom = AreaValues.bottom; // e.g. 182
tRect.left = AreaValues.left + column[c].start; // e.g. 8
tRect.right = tRect.left + column.width; // e.g. 50
tText = "Column No.";
mToolTip->AddTool(this, tText, &tRect, c+1);
mToolTip->Activate;
// After this I added code to check the values are set properly or not
CToolInfo ti;
mToolTip->GetToolInfo(ti, this, c+1);
// I checked rectangle and text values. Text values are proper.
// But for rectangle values w.r.t. above given example values I am
// getting something like this.
// ti.rect.top = 8
// ti.rect.bottom = 72
// ti.rect.left = 6
// ti.rect.right = 7
// And left and right values goes on decreasing even like -4, -5
}
}
Am I doing something wrong while adding tool? What can be the solution for this.
Thanks in advance.
Chioo.
Chioo.
|
|
|
|
|
I have troble in:
how to create scrollbar by the client rect?
how to adapt the scrollbar when the window's size changed?
my code:
int CDNAView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
CRect crect;
GetClientRect(&crect);
VERIFY(m_scrollBar.Create(
SBS_VERT | SBS_RIGHTALIGN | WS_CHILD , CRect(0,0,756,429),this,10));// how to create scrollbar by the client rect?
m_scrollBar.ShowScrollBar();
return 0;
}
void CDNAView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
int lt,tp,rt,btm;
CRect rect;
GetClientRect(&rect);
lt = rect.left;
tp = rect.top;
rt = rect.right;
btm = rect.bottom;
m_scrollBar.MoveWindow(rt,tp,5,btm);// how to adapt the scrollbar when the window's size changed?
}
how to resove this question?
your kind reply will be appreciated greatly.
|
|
|
|
|
Hi LZL1010 ,
this code isnt good?
int CSDIView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
m_scrollBar.Create(
SB_VERT | SBS_RIGHTALIGN | WS_CHILD|WS_VISIBLE , CRect(0,0,556,309),this,10);
// how to create scrollbar by the client rect?
m_scrollBar.ShowScrollBar();
return 0;
}
void CSDIView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
CRect rect;
m_scrollBar.GetClientRect(&rect);
rect.bottom=cy;
m_scrollBar.MoveWindow(&rect);// how to adapt the scrollbar when the window's }
}
|
|
|
|
|
your code is of a little problem.
when the size of the client area changed,the scrollbar should be redraw,because the position and the size of the scrollbar has been changed.your code redraw the scrollbar,but the size of the scrollbar doesn't change and the scrollbar lies to the left edge of the client.
because the data is too much.I draw at least 50000 lines on the view.
I want to implement it like the notepat . the notepad isn't a limit to the lines.
how to resolve this question?
|
|
|
|
|
LZL1010
I dont kown your code you write how to create scrollbar by the client rect
I insert a change to your code and if you need to left edge use rect.bottom=cy;rect.left=cx-15;rect.right=cx;
|
|
|
|
|
|
|
Hi Guys,
I'm creating one dll in MFC and compile by release mode. In my project I have used 3 global variables in stdafx.h file
global variables are
char *g_strename;
char *g_streid;
char *g_isalary;
Say file name: employee (DLL created using MFC appwizard DLL)when I compile my project it shows linker error messages & warning messages
StdAfx.obj : error LNK2005: "char * g_strename;(?g_strPassword@@3PADA) already defined in employee.obj
StdAfx.obj : error LNK2005: "char * g_streid@@3PADA) already defined in employee.obj
StdAfx.obj : error LNK2005: "int g_isalary;@@3HA) already defined in employee.obj
this is followed by LNK4006 warning message.
please help me out, to rectify this. Just quick will do be great.
Thanks
Vivek.S
You only have to do a very few things right in your life so long as you don't do too many things wrong.
|
|
|
|
|
vivek.s.vivek wrote: global variables are
char *g_strename;
char *g_streid;
char *g_isalary;
transfer these variable to a .cpp file and use
extern char *g_strename;
extern char *g_streid;
extern char *g_isalary;
in stdafx.h
|
|
|
|
|
there is another option too... declare it as
static char *g_strename;
static char *g_streid;
static char *g_isalary;
nave
|
|
|
|
|
Hey everyone:
Here's the scenario. I have a window that displays what I want the user to see the first time, but immediately they see it, I need to call a command that will send the window to all black. However, I want to keep painting the window with what the user saw the first time.
Is there a way of 'copying & pasting' contents from a window, so I can make it seem as though nothing has happend?
Thanks!
`Chase
(VC++ only, no MFC )
|
|
|
|
|
Hi all,
I'd like have the scrollbars for the main window of my MDI application corresponding to the Child windows' size and position. If anyone could suggest me something, it'd be more helpful.
Thanks in advance,
Sarvan AL
|
|
|
|
|
hi all,
i want to enable/disable menu items using SendMessage(...) Api. How can we achieve this using SendMessage(...) API. please tell me your solutions for this.
thanks,
uday.
uday kiran
|
|
|
|
|
|
|
I am doing some eval of debug tools, and so far I don't really like any of them.
I've tried:
* Rational Purify (IBM) (not too impressed)
* Insure++ ( jury is out )
* AQTime
What's the consensus out there?
What's the best tool for finding memory leaks in C++?
What do you think of these tools?
Would love a tool that can do some CPU usage profiling too.
Thanks!
Oh, I current run under dev studio 2003 C++
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
-- modified at 3:18 Wednesday 12th April, 2006
|
|
|
|
|