|
i have a mdi app (using vc++ 7) and i'm trying to enable keyboard accelerators. when there is no document open, the accelerators work fine. however, when a document is open, the accelerators do not work. i added a HACCEL member to my view class, initialized it with a call to ::LoadAccelerators() and overrode PreTranslateMessage() like so,
BOOL MyFormViewView::PreTranslateMessage(MSG* pMsg)
{
if ( CFormView::PreTranslateMessage(pMsg) )
return TRUE;
return ((FAccelTable != NULL) && ::TranslateAccelerator(m_hWnd, FAccelTable, pMsg));
}
as far as i can tell, FAccelTable is initialized properly.
what am i doing wrong?
thanks.
|
|
|
|
|
You need to create an accelerator table (resource) for each doc template.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
how do you associate the new accelerator table with the doc template? i tried using a new table with the method i described above, but it still didn't work.
|
|
|
|
|
Just create a new accelerator table resource with the appropriate id. The association with the doc templates happens automatically (using the id). You don't need to write any code to support this.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
this is my app wizard generated code in InitInstance():
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(IDR_MYTYPE,
RUNTIME_CLASS(CMYDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CMYView));
i created an accelerator table with an id of IDR_MYTYPE. the accelerators still do not work. is that what you were talking about?
|
|
|
|
|
Hi all,
Hoping for a little help with accessing portions of an .msi database from within C++ code. There are functions to access the various tables in the MFC, but for some reason I can not get them to work. So far my code is just a test that declares and MSIHANDLE and attempts to call MsiOpenDatabase. It looks like this:
#include <atlbase.h>
#include <msiquery.h>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
using namespace std;
int main (int argc, char **argv){
LPCSTR dbPath = "\\SRV1.msi";
LPCSTR dpPerm = "MSIDBOPEN_READONLY";
PMSIHANDLE m_h;
MsiOpenDatabase(dbPath, dpPerm, &m_h);
...
For some reason, this perpetually throws LNK2001 errors (specifically _MsiOpenDatabaseA@12 and _MsiCloseHandle@4). As I'm only using MFC and ATL classes, I'm confused. Any suggestions?
|
|
|
|
|
|
Boy do I feel stupid... it's always the little things . Thanks for the help!
"I went mad for a while myself, and rather enjoyed it. I spent a great deal of time thinking I was a lemon and jumping in and out of a small lake that thought it was a gin and tonic. At least, I think it thought it was a gin and tonic."
- Ford Prefect
|
|
|
|
|
Dear Forum,
I am currently developing an application in which a user must be able
to design a label.
Therefore I want to implement functionality like in the Word drawing tool, where
a user can draw a TextArea and fill in some formatted text.
When I use spy++ to try to reverse engineer how it is implemented in Word it looks
as if the Text Area is not a control. But that would mean that I would have to do
all the text formatting myself.
Can anyone tell me how to implement this and point me to some
code samples?
Thanks in advance,
Huub
|
|
|
|
|
Trying to implement the close all; follow up to a question I posted a few days ago.
When creating the CMDIChildWnd I register them to a list, as you suggested, and when closing them, I unregister them; it's working fine, but if I want to implement the close all window functionality, I will do the following.
The problem is that when the window is closed, it gets unregistered and removed from the list. and when going back to the CloseAllGraphicalWindow, the vector gets invalidated. and BANG !!
Is there something that I missed ?
I know I could hack this; but there should be a better way.
void CMainFrame::CloseAllGraphicalWindow()
{
ChildWindowVector_t::iterator it = m_ChildWindowVector.begin();
while (it != m_ChildWindowVector.end() )
{
CMDIChildWnd* p = *it;
p->SendMessage(WM_CLOSE, 0, 0 );
++it;
}
}
LRESULT CMainFrame::RegisterNewWindow(WPARAM wParam, LPARAM lParam )
{
CMDIChildWnd* pWnd = (CMDIChildWnd*)(lParam);
ASSERT( pWnd );
m_ChildWindowVector.push_back( pWnd );
return 0;
}
LRESULT CMainFrame::UnRegisterNewWindow(WPARAM wParam, LPARAM lParam )
{
CMDIChildWnd* pWnd = (CMDIChildWnd*)(lParam);
ASSERT( pWnd );
ChildWindowVector_t::iterator it = m_ChildWindowVector.begin();
while (it != m_ChildWindowVector.end() )
{
CMDIChildWnd* p = *it;
if ( p == pWnd )
{
m_ChildWindowVector.erase(it);
return 0;
}
++it;
}
ASSERT( 0 );
return 0;
}
Thanks a lot !!
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
when i add
#define UNICODE
#define _UNICODE
to stdafx.h file i got the following error during compilation
error LNK2019:unresolved external symbol _WinMain@16 reference in function _WinMainCRTStartup
who i can use #define UNICODE with out error during compilation
sinan swedani
|
|
|
|
|
Try changing the entry-point symbol to wWinMainCRTStartup on the Project/Link/output tab.
HTH,
Ian.
|
|
|
|
|
how i can do this with visual studio.net
thanks for yor reply
|
|
|
|
|
Sorry but I only have vs6 so can't help.
|
|
|
|
|
On Win9x it disables the keyboard
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Good point !!!! hahahahhahaha
Written by: Rafael Fernández López.
void life ( bool me, bool her )
{
while ( her )
{
me = true ;
}
else
{
me = false ;
} }
|
|
|
|
|
How to add an ifstream (or fstream) object into function as a parameters.
|
|
|
|
|
first: one post is enough!
void foo( fstream &fs )
{
...
}
fstream is a class, so handle it like one!
Don't try it, just do it!
|
|
|
|
|
How to add an ifstream (or fstream) object into function as a parameters?
|
|
|
|
|
Is there a way to change the size of the Icon Rect (and Text rect if that's possible) of a item in a CListCtrl in Icon mode.
I have a ownerdrawn listcontrol, but want Icons of different sizes in my control. I can set the icon size to real big, but then I have to do the sorting myself.
-------------------------------
Greetz,
MG
|
|
|
|
|
Load icons this way:
<br />
HICON my_icon = (HICON)LoadImage(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDD_MY_RESOURCE),IMAGE_ICON ,16,16,0);<br />
Hope it helped.
Rafael Fernández López.
I didn't fail hundred times, I found hundred ways that didn't work.
No fallé cien veces, encontré cien maneras de que no funcionara.
|
|
|
|
|
Don't think that's what I'm looking for.
I'll tell something more about the project.
I've got some icons in my CListCtrl, they are painted via GDI+. Instead of using the standard icons the end user can substitute the icon with a image file. Say a PNG file. This image can have a different size than the icon.
And if it is possible, I'd like to place the text at the right side of the icon.
-------------------------------
Greetz,
MG
|
|
|
|
|
Oh well, you could get CListCtrl rect as a window one, and then modify it and set that rect, or with GetSubItemRect, for example, or GetItemRect.
That way you will be able to modify rectangles into the control.
Hoping it helped...
Written by: Rafael Fernández López.
void life ( bool me, bool her )
{
while ( her )
{
me = true ;
}
else
{
me = false ;
} }
|
|
|
|
|
Tx for your really fast replies!!
But with GetItemRect I _get_ the rect; I want to _set_ it! So CListCtrl knows the different sizes of the items, so it can arrange it good. And so I can use that rect (and position) in the ownerdrawn function.
-------------------------------
Greetz,
MG
|
|
|
|
|
I am not sure, but I think that you can retrieve the rectangle that you want to make bigger and later modifying it, you will be able to set it into the control, there must exist different ways. I must leave now, in 2 hours or 3 I will come back and try to reply you. Bye for now.
Written by: Rafael Fernández López.
void life ( bool me, bool her )
{
while ( her )
{
me = true ;
}
else
{
me = false ;
} }
|
|
|
|