Click here to Skip to main content
16,016,024 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Spy++ Utility Pin
ddmcr29-Sep-05 7:07
ddmcr29-Sep-05 7:07 
GeneralRe: Spy++ Utility Pin
David Crow29-Sep-05 9:16
David Crow29-Sep-05 9:16 
GeneralRe: Spy++ Utility Pin
ThatsAlok29-Sep-05 17:57
ThatsAlok29-Sep-05 17:57 
GeneralRe: Spy++ Utility Pin
ddmcr30-Sep-05 6:01
ddmcr30-Sep-05 6:01 
GeneralRe: Spy++ Utility Pin
ThatsAlok30-Sep-05 18:02
ThatsAlok30-Sep-05 18:02 
Questione How to get the source IP address and port ? Pin
rushing29-Sep-05 5:25
rushing29-Sep-05 5:25 
AnswerRe: e How to get the source IP address and port ? Pin
Graham Bradshaw29-Sep-05 13:51
Graham Bradshaw29-Sep-05 13:51 
QuestionHWND handle Pin
tl0825429-Sep-05 5:02
tl0825429-Sep-05 5:02 
Hi folks!

I'm working on a MFC project and i've got a question to make. The project i'm involved in, is a dialog based aplication. So, the Wizard took the first steps of the work. I'm basing the program on an example that has been created entirely programming, and it makes reference to a HWND handle variable that is necessary to pass to one of the methods.

The code is like this:


Code:
HRESULT CText::BlendText(HWND hwndApp, TCHAR *szNewText)
{

LONG cx, cy;
HRESULT hr;
CSubtitlesDlg dialog;

// Create a device context compatible with the current window
HDC hdc= GetDC(hwndApp);
HDC hdcBmp = CreateCompatibleDC(hdc);

// Write with a known font by selecting it into our HDC
HFONT hOldFont = (HFONT) SelectObject(hdcBmp, g_hFont);

// Determine the length of the string, then determine the
// dimensions (in pixels) of the character string using the
// currently selected font. These dimensions are used to create
// a bitmap below.
int nLength, nTextBmpWidth, nTextBmpHeight;
SIZE sz={0};

nLength = (int) _tcslen(szNewText);
GetTextExtentPoint32(hdcBmp, szNewText, nLength, &sz);
nTextBmpHeight = sz.cy;
nTextBmpWidth = sz.cx;

// Create a new bitmap that is compatible with the current
//window
HBITMAP hbm = CreateCompatibleBitmap(hdc, nTextBmpWidth,
nTextBmpHeight);
ReleaseDC(hwndApp, hdc);

// Select our bitmap into the device context and save the old one
BITMAP bm;
HBITMAP hbmOld;
GetObject(hbm, sizeof(bm), &bm);
hbmOld = (HBITMAP)SelectObject(hdcBmp, hbm);
...
I make a reference to this method in another class like this:
Code:
hr = Text.BlendText(___________, Text.g_szAppText);<- I need to know what to put in here

Does anybody know which method do i need to use in order to get this handle to the window i'm working with? I wonder if the question is clear, but i'll try!! Many thanks. Serj.
AnswerRe: HWND handle Pin
John M. Drescher29-Sep-05 6:15
John M. Drescher29-Sep-05 6:15 
AnswerRe: HWND handle Pin
ThatsAlok29-Sep-05 22:25
ThatsAlok29-Sep-05 22:25 
QuestionGet Text for a Control Pin
cats819929-Sep-05 4:19
cats819929-Sep-05 4:19 
AnswerRe: Get Text for a Control Pin
David Crow29-Sep-05 6:51
David Crow29-Sep-05 6:51 
GeneralRe: Get Text for a Control Pin
cats819929-Sep-05 7:19
cats819929-Sep-05 7:19 
GeneralRe: Get Text for a Control Pin
David Crow29-Sep-05 9:15
David Crow29-Sep-05 9:15 
AnswerRe: Get Text for a Control Pin
Andy Moore29-Sep-05 6:59
Andy Moore29-Sep-05 6:59 
GeneralRe: Get Text for a Control Pin
cats819929-Sep-05 7:19
cats819929-Sep-05 7:19 
AnswerRe: Get Text for a Control Pin
PJ Arends29-Sep-05 10:41
professionalPJ Arends29-Sep-05 10:41 
QuestionTAPI in VC++ Pin
SerGrey29-Sep-05 4:05
SerGrey29-Sep-05 4:05 
AnswerRe: TAPI in VC++ Pin
SerGrey29-Sep-05 4:13
SerGrey29-Sep-05 4:13 
GeneralRe: TAPI in VC++ Pin
Marc Soleda29-Sep-05 5:12
Marc Soleda29-Sep-05 5:12 
AnswerRe: TAPI in VC++ Pin
Eytukan29-Sep-05 6:46
Eytukan29-Sep-05 6:46 
AnswerRe: TAPI in VC++ Pin
shmily128029-Sep-05 21:09
shmily128029-Sep-05 21:09 
QuestionVC++ &amp; Interbase Pin
SerGrey29-Sep-05 3:59
SerGrey29-Sep-05 3:59 
AnswerRe: VC++ &amp; Interbase Pin
Eytukan3-Oct-05 7:11
Eytukan3-Oct-05 7:11 
GeneralRe: VC++ &amp; Interbase Pin
Eytukan3-Oct-05 7:11
Eytukan3-Oct-05 7:11 

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.