Click here to Skip to main content
15,902,112 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: COM Port Pin
A_Fa17-Jun-05 18:47
A_Fa17-Jun-05 18:47 
GeneralRe: COM Port Pin
Toby Opferman18-Jun-05 13:47
Toby Opferman18-Jun-05 13:47 
GeneralRe: COM Port Pin
Anonymous19-Jun-05 21:37
Anonymous19-Jun-05 21:37 
GeneralActiveXScripting Pin
dittygrail16-Jun-05 2:22
dittygrail16-Jun-05 2:22 
GeneralAdding image view capability to control bar Pin
MFCRookie16-Jun-05 2:09
MFCRookie16-Jun-05 2:09 
GeneralContext Sensitive help for Edit Box Pin
topagarwal16-Jun-05 0:46
topagarwal16-Jun-05 0:46 
GeneralRe: Context Sensitive help for Edit Box Pin
samit116-Jun-05 1:24
samit116-Jun-05 1:24 
Questionhow to create a temporary DC using ATL without a Parent Window? Pin
ThinkingPrometheus16-Jun-05 0:43
ThinkingPrometheus16-Jun-05 0:43 
hiho@ll

what i have:
a HBITMAP handle
no parent window
a browser helper object, which should do the job

what i need:
the upper left pixel of the HBITMAP handle

what i think how it could work: (well it doesn't work Wink | ;-) )
CWindow *tmpwin=new CWindow(::GetDesktopWindow()); // i don't have a parent
HDC hdc=tmpwin->GetDC();
SelectObject(hdc,hbmp); // select the HBITMAP
COLORREF cf=GetPixel(hdc,0,0);
return cf;

what i get:
the return RGB Values are 255,255,255
using GetLastError after the GetPixel and before Return i get ErrorCodes 6 and 8 (invalid handle, not enough space)
i'm calling the method a few times, so i get some error codes and not just one

question:
how can hdc be an invalid handle, if i use GetDesktopWindow?
how can i get "not enough space" for a bitmap which is 16x16?

a workaround i'm thinking of, but i don't know how to do:
i make my own window, use selectobject on my window, get the pixel, and destroy the window
question:
how can i make my own window? (some code would be great)
and how do i destroy the window?
btw, the only purpose of this window will be to get a valid DC to select the HBITMAP and get the pixel

thx@ll
AnswerRe: how to create a temporary DC using ATL without a Parent Window? Pin
Bob Stanneveld16-Jun-05 1:13
Bob Stanneveld16-Jun-05 1:13 
GeneralRe: how to create a temporary DC using ATL without a Parent Window? Pin
ThinkingPrometheus16-Jun-05 3:04
ThinkingPrometheus16-Jun-05 3:04 
GeneralRe: how to create a temporary DC using ATL without a Parent Window? Pin
Bob Stanneveld16-Jun-05 3:17
Bob Stanneveld16-Jun-05 3:17 
Questionconvert Variant to CString? Pin
ThinkingPrometheus15-Jun-05 23:08
ThinkingPrometheus15-Jun-05 23:08 
AnswerRe: convert Variant to CString? Pin
Graham Bradshaw15-Jun-05 23:18
Graham Bradshaw15-Jun-05 23:18 
AnswerRe: convert Variant to CString? Pin
Nilesh K.15-Jun-05 23:21
Nilesh K.15-Jun-05 23:21 
GeneralRe: convert Variant to CString? Pin
ThinkingPrometheus15-Jun-05 23:51
ThinkingPrometheus15-Jun-05 23:51 
AnswerRe: convert Variant to CString? Pin
Anonymous16-Jun-05 0:09
Anonymous16-Jun-05 0:09 
AnswerRe: convert Variant to CString? Pin
James R. Twine16-Jun-05 8:34
James R. Twine16-Jun-05 8:34 
GeneralSent data from Doc to dialog Pin
mafuza15-Jun-05 22:58
mafuza15-Jun-05 22:58 
GeneralRe: Sent data from Doc to dialog Pin
Nilesh K.15-Jun-05 23:17
Nilesh K.15-Jun-05 23:17 
GeneralRe: Sent data from Doc to dialog Pin
mafuza21-Jun-05 17:21
mafuza21-Jun-05 17:21 
GeneralRe: Sent data from Doc to dialog Pin
Nilesh K.21-Jun-05 17:50
Nilesh K.21-Jun-05 17:50 
GeneralPicture on dialog based application Pin
Rostfrei15-Jun-05 22:48
Rostfrei15-Jun-05 22:48 
GeneralRe: Picture on dialog based application Pin
Nilesh K.15-Jun-05 23:06
Nilesh K.15-Jun-05 23:06 
GeneralRe: Picture on dialog based application Pin
Rostfrei15-Jun-05 23:32
Rostfrei15-Jun-05 23:32 
GeneralRe: Picture on dialog based application Pin
toxcct16-Jun-05 0:14
toxcct16-Jun-05 0:14 

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.