|
In dialog boxes, handling accelerator keys require a slight tweak. I have explained this in the following article :-
http://www.codeproject.com/useritems/pretransdialog01.asp
Nish
The posting stats are now in PDF:-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
Updated - May 04th, Saturday
|
|
|
|
|
Hi,
Thanks Nish. Thanks for your advance. In fact I'm very weak in C++, nevertheless I will try your article
|
|
|
|
|
Anyone have some info on that? I'd very much like to learn something about it. The new Winamp 3 has it, anyone know anything about it?
Thankyou
|
|
|
|
|
I don't remember the names of the functions you use to make transparent windows, but search in the articles, I know there's a couple about this subject...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
They are supported only in W2000 and XP AFAIK. So to write an app that uses them you need to late bind to the function and detect the OS before callng them. I've done it, LMK if you can't find an article that covers this stuff and I'll knock one up for you.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
You should be able to find a couple of articles in MSDN and the APIs if you do a search on Layered Windows .
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Actually it's not that hard, you just use the SetLayeredWindowAttributes function.
|
|
|
|
|
WHen i try to compile my program, the compiler says that WS_EX_LAYERED and LWA_ALPHA an undeclared identifier. in the msdn library it says to include the windows.h file, and i have already included that...
|
|
|
|
|
You need a later platform SDK in order for these to be defined.
If you don't want to bother downloading it, slap this on your source file:
#ifndef WS_EX_LAYERED
#define WS_EX_LAYERED 0x00080000
#define LWA_COLORKEY 0x00000001
#define LWA_ALPHA 0x00000002
#endif
--------
Higher education helps your earning capacity. Ask any college professor. --Shog9 --
|
|
|
|
|
|
I am trying to implement a document/view application. I got the program to compile but it stalls when the line 'AddDocTemplate(pDocTemp);' is executed. I keep getting the 'Debug Assertion Failed' box. Below is a snippet of the InitInstance code. Thx
BOOL CApp::InitInstance(void) {
//register class and document
CSingleDocTemplate *pDocTemp;
pDocTemp = new CSingleDocTemplate(IDR_APP,//UINT nIDResource
RUNTIME_CLASS(CAppDoc),//CRuntimeClass* pDocClass
RUNTIME_CLASS(CMain),//CRuntimeClass* pFrameClass
RUNTIME_CLASS(CAppView));//CRuntimeClass* pViewClass
AddDocTemplate(pDocTemp);// !!!Problem here
//parse command line info
CCommandLineInfo cmd;
ParseCommandLine(cmd);
//dispatch command line info
if (!ProcessShellCommand(cmd))
return FALSE;
//show/update window
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
ralf.riedel@usm.edu
|
|
|
|
|
Which line of which module gives the ASSERT?
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Hi,
Does anyone know of a good FREE platform independant source
code control system that works with Visual C++?
I tried installing cygwin and its port of CVS
but Visual C++ projects seem to have a problem
co-existing with it.
Thanks
|
|
|
|
|
I haven't used it myself but you might want to give WinCVS a try.
Good luck!
Andy Metcalfe - Sonardyne International Ltd
Trouble with resource IDs? Try the Resource ID Organiser Add-In for Visual C++
"I would be careful in separating your wierdness, a good quirky weirdness, from the disturbed wierdness of people who take pleasure from PVC sheep with fruit repositories."
- Paul Watson
|
|
|
|
|
Folks,
When I replace the background HBRUSH on a Window:
1) Am I expected to delete the OLD HBRUSH?
2) Expected to delete my NEW HBRUSH?
Or both?
Mike.
|
|
|
|
|
Restore the old one when done. Then, you can call DeleteObject() on both.
Jeremy L. Falcon
"You do not know the power of the dumb side."
<nobr>
Homepage : Sonork = 100.16311 Maybe my mangling might misguide malicious miscreants momentarily?
|
|
|
|
|
Hi,
I have a listbox which I automatically scroll down when I add new new lines (for a chat). Unfortunately, I want to avoid this autoscroll behaviour when the user decided to scroll up and look for older text. Because otherwise each new incoming text would anoyingly scroll to the end again.
Hmmm, my idea was to look on GetScrollPos() and do not autoscroll when the position is != the ending position. Is this a good idea, any other ideas?
Thx for help.
|
|
|
|
|
Deselect the autoscroll feature. When inserting a string, check first whether the cursor is at the bottom, and if so, do a SetCursel to the new line. Otherwise, do nothing.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Using the scroll bar doesnt change the cursor/caret.
Also my idea with GetScrollPos() doesn't work alone. I need to calculate the TopIndex + number of visible items to get the ending position - or more easy I think: I use ItemFromPoint() and compare it with GetCount()-1. Let me implement it...
Have a nice weekend.
|
|
|
|
|
here it is:
BOOL CListBoxChat::IsAutoScroll()
{
int nBottom = GetBottomIndex();
if(nBottom == LB_ERR) return FALSE;
return (GetBottomIndex() == GetCount()-1)?TRUE:FALSE;
}
int CListBoxChat::GetBottomIndex()
{
ASSERT(m_hWnd);
CRect rect;
GetClientRect(rect);
int nIndex = LOWORD(::SendMessage(m_hWnd, LB_ITEMFROMPOINT, 0, MAKELPARAM(0, rect.bottom)));
if (nIndex == LOWORD(LB_ERR))
{
nIndex = LB_ERR;
}
return nIndex;
}
|
|
|
|
|
I vote that you give it a try. If it works then it is a good idea, if it doesn't work then it isn't.
-Jack
To an optimist the glass is half full.
To a pessimist the glass is half empty.
To a programmer the glass is twice as big as it needs to be.
|
|
|
|
|
Hi there ...
I wrote a structure like this:
struct MyObject
{
CDC dc;
CBitmap bmp;
short x, y;
};
In one of my functions i want to make a refrence parameter ...
I mean the function can chenge the value which got from parameter.
It is my function:
void CTileDlg::SwapTiles(MyObject &myObj)
{
int x, y;
short col, row;
x = myObj->nX;
y = myObj->nY;
col = myObj->nCol;
row = myObj->nRow;
myObj->nX = objNULL->nX;
myObj->nY = objNULL->nY;
myObj->nCol = objNULL->nCol;
myObj->nRow = objNULL->nRow;
objNULL->nX = x;
objNULL->nY = y;
objNULL->nCol = col;
objNULL->nRow = row;
}
I have to pass MyObject pointer object to that.
For example:
MyObject *mo;
SwapTiles(mp);
Could you tell me how can i make a right refrence function ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Don't pass a pointer. Just pass the struct variable normally. It gets passed by reference.
Nish
The posting stats are now in PDF:-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
Updated - May 04th, Saturday
|
|
|
|
|
MyObject *mo;
SwapTiles(*mo); Ther's a typo in your sample code --I guess you refered to the same variable mo in both sentences.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I have a dialog based MFC project. I have added a menu IDR_MAINFRAME to it, also I have filled up the Accelerator resources for IDR_MAINFRAME. But when the program is running, and the accelerator key is pressed (for example, Alt+F), nothing happens. But if I click on the corresponding menu item, the function would be called. Did I miss anything?
Thank you very much in advance!
|
|
|
|