Click here to Skip to main content
15,906,567 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Custom OnSize handling Pin
Terry O'Nolley29-Sep-03 5:26
Terry O'Nolley29-Sep-03 5:26 
GeneralRe: Custom OnSize handling Pin
Iain Clarke, Warrior Programmer29-Sep-03 5:57
Iain Clarke, Warrior Programmer29-Sep-03 5:57 
GeneralOutput Pin
sardinka29-Sep-03 4:45
sardinka29-Sep-03 4:45 
GeneralRe: Output Pin
David Crow29-Sep-03 4:58
David Crow29-Sep-03 4:58 
GeneralRe: Output Pin
Terry O'Nolley29-Sep-03 5:04
Terry O'Nolley29-Sep-03 5:04 
GeneralRe: Output Pin
sardinka29-Sep-03 6:25
sardinka29-Sep-03 6:25 
GeneralRe: Output Pin
DougW4829-Sep-03 8:03
DougW4829-Sep-03 8:03 
GeneralSetLayeredWindowAttributes in an ActiveX control Pin
Daed29-Sep-03 4:44
Daed29-Sep-03 4:44 
I am creating a button control and I want to set some parts of this button to be transparent. I am using SetLayeredWindowAttributes API but it is not giving any result.
It returns FALSE value and when I get the last error I got “The parameter is incorrect”. Is there something wrong in what I am doing or may be this API does not work with controls?
My code is as follows:

int CMyButtonCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (COleControl::OnCreate(lpCreateStruct) == -1)
return -1;

SetWindowLong(m_hWnd, GWL_EXSTYLE, GetWindowLong(m_hWnd, GWL_EXSTYLE) | WS_EX_LAYERED);
HMODULE hUser32 = GetModuleHandle(_T("USER32.DLL"));
g_pSetLayeredWindowAttributes = (lpfn)GetProcAddress(hUser32,
"SetLayeredWindowAttributes");

COLORREF col = RGB(255, 0, 0);

BOOL bResult = g_pSetLayeredWindowAttributes(m_hWnd, col, 150, LWA_COLORKEY);
if (!bResult)
{
LPVOID lpMsgBuf;

FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL);

AfxMessageBox((LPCTSTR)lpMsgBuf);
}
}

Any ideas?


Daed
GeneralRe: SetLayeredWindowAttributes in an ActiveX control Pin
igor196029-Sep-03 7:42
igor196029-Sep-03 7:42 
QuestionWhat type has CONTROL resource ? Pin
vgrigor29-Sep-03 4:31
vgrigor29-Sep-03 4:31 
General64 bit integers Pin
Jim Crafton29-Sep-03 4:14
Jim Crafton29-Sep-03 4:14 
GeneralRe: 64 bit integers Pin
KarstenK29-Sep-03 4:26
mveKarstenK29-Sep-03 4:26 
GeneralRe: 64 bit integers Pin
Jim Crafton29-Sep-03 4:54
Jim Crafton29-Sep-03 4:54 
GeneralRe: 64 bit integers Pin
Anonymous29-Sep-03 4:26
Anonymous29-Sep-03 4:26 
GeneralRe: 64 bit integers Pin
Jim Crafton29-Sep-03 4:53
Jim Crafton29-Sep-03 4:53 
GeneralRe: 64 bit integers Pin
David Crow29-Sep-03 5:04
David Crow29-Sep-03 5:04 
GeneralRe: 64 bit integers Pin
Jim Crafton29-Sep-03 5:14
Jim Crafton29-Sep-03 5:14 
GeneralRe: 64 bit integers Pin
Tom Pruett29-Sep-03 5:08
Tom Pruett29-Sep-03 5:08 
GeneralRe: 64 bit integers Pin
Jim Crafton29-Sep-03 5:14
Jim Crafton29-Sep-03 5:14 
GeneralEditable subitem code needed!! URGENT Pin
IrishSonic29-Sep-03 4:11
IrishSonic29-Sep-03 4:11 
GeneralRe: Editable subitem code needed!! URGENT Pin
b_girl29-Sep-03 4:26
b_girl29-Sep-03 4:26 
GeneralRe: Editable subitem code needed!! URGENT Pin
IrishSonic29-Sep-03 23:26
IrishSonic29-Sep-03 23:26 
GeneralRe: Editable subitem code needed!! URGENT Pin
b_girl30-Sep-03 3:17
b_girl30-Sep-03 3:17 
GeneralRe: Editable subitem code needed!! URGENT Pin
b_girl30-Sep-03 5:12
b_girl30-Sep-03 5:12 
GeneralRe: Editable subitem code needed!! URGENT Pin
IrishSonic2-Oct-03 22:26
IrishSonic2-Oct-03 22:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.