Click here to Skip to main content
15,887,676 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralProblem with GetLine() in a CEdit Pin
selecta10-May-03 12:29
selecta10-May-03 12:29 
GeneralRe: Problem with GetLine() in a CEdit Pin
Ernest Laurentin10-May-03 14:44
Ernest Laurentin10-May-03 14:44 
GeneralRe: Problem with GetLine() in a CEdit Pin
selecta11-May-03 6:17
selecta11-May-03 6:17 
GeneralRe: Problem with GetLine() in a CEdit Pin
selecta11-May-03 7:27
selecta11-May-03 7:27 
GeneralHtml control and selection Pin
Atlence10-May-03 11:30
Atlence10-May-03 11:30 
GeneralCBTProc not working Pin
S van Leent10-May-03 8:46
S van Leent10-May-03 8:46 
GeneralRe: CBTProc not working Pin
Ernest Laurentin10-May-03 14:31
Ernest Laurentin10-May-03 14:31 
GeneralRe: CBTProc not working Pin
S van Leent11-May-03 8:24
S van Leent11-May-03 8:24 
Well, when I wrote the thing and uploaded it, in a minute I knew the solution, It works great.

The function looks like:


static LRESULT CALLBACK CBTProc(int nCode,
                                WPARAM wParam,
                                LPARAM lParam)
{
    if (nCode == HCBT_CREATEWND)
    {
        LONG counter = 0;
        HWND hWnd = reinterpret_cast<HWND>(wParam);
        LPCBT_CREATEWND lpcw = (LPCBT_CREATEWND)lParam;
        LONG lpCreateParams = (LONG)lpcw->lpcs->lpCreateParams;

        // This makes it possible to use "API-style" windows too, where
        // the lpCreateParams does not point to a class

        if (lpCreateParams != 0 && lpcw->lpcs->hInstance == __hInstance__)
        {
            for (iIterator = arrUnboxedClasses.begin(); iIterator != arrUnboxedClasses.end(); iIterator++, counter++)
            {
                if (arrUnboxedClasses.at(counter) == lpCreateParams)
                {
                    ::SetWindowLong(hWnd, GWL_USERDATA, lpCreateParams);
                    goto end;
                }
            }

        }
    }

    end:

    return CallNextHookEx(__hWndsHook__, nCode, wParam, lParam);
}


I still think that another application may not crash because I install a hook, this is not a really good design, I think.

LPCTSTR Dutch = TEXT("Double Dutch Smile | :) ");
GeneralCost of a function call Pin
Shah Shehpori10-May-03 8:13
sussShah Shehpori10-May-03 8:13 
GeneralRe: Cost of a function call Pin
Michael Dunn10-May-03 8:50
sitebuilderMichael Dunn10-May-03 8:50 
GeneralRe: Cost of a function call Pin
Joe Woodbury10-May-03 9:18
professionalJoe Woodbury10-May-03 9:18 
GeneralRe: Cost of a function call Pin
S van Leent10-May-03 11:17
S van Leent10-May-03 11:17 
GeneralRe: Cost of a function call Pin
Joe Woodbury10-May-03 12:04
professionalJoe Woodbury10-May-03 12:04 
GeneralRe: Cost of a function call Pin
S van Leent11-May-03 8:17
S van Leent11-May-03 8:17 
GeneralRe: Cost of a function call Pin
Shah Shehpori11-May-03 5:16
sussShah Shehpori11-May-03 5:16 
GeneralRe: Cost of a function call Pin
Joe Woodbury11-May-03 6:10
professionalJoe Woodbury11-May-03 6:10 
GeneralRe: Cost of a function call Pin
Baris Kurtlutepe11-May-03 5:40
Baris Kurtlutepe11-May-03 5:40 
GeneralSocket Error Pin
Mazdak10-May-03 2:31
Mazdak10-May-03 2:31 
GeneralRe: Socket Error Pin
valikac10-May-03 5:42
valikac10-May-03 5:42 
GeneralRe: Socket Error Pin
Mazdak10-May-03 7:47
Mazdak10-May-03 7:47 
GeneralRe: Socket Error Pin
Anders Molin10-May-03 5:43
professionalAnders Molin10-May-03 5:43 
GeneralRe: Socket Error Pin
Mazdak10-May-03 7:48
Mazdak10-May-03 7:48 
GeneralRe: Socket Error Pin
Anders Molin10-May-03 9:18
professionalAnders Molin10-May-03 9:18 
GeneralRe: Socket Error Pin
Mazdak10-May-03 18:05
Mazdak10-May-03 18:05 
QuestionIs ++i statement in the for loop better than i++? Pin
Link260010-May-03 0:56
Link260010-May-03 0:56 

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.