Search:

Type: Posts; User: DL1

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    8
    Views
    3,463

    That was what I was assuming. However, assuming...

    That was what I was assuming. However, assuming that to be correct, adapting Codeplug's example gives:


    SetWindowLong(hwnd, GWL_USERDATA, 0x1234abcd); // GWL_USERDATA = -21
    SetWindowLong(hwnd,...
  2. Replies
    8
    Views
    3,463

    I know in practice it's not important to know the...

    I know in practice it's not important to know the numerical values; I'm just really, really curious because it looks so wrong to me.
  3. Replies
    8
    Views
    3,463

    SetWindowLong nIndex argument

    I am a bit puzzled by the SetWindowLong function, as described here:

    SetWindowLong function

    Specifically, I cannot make sense of the offsets given for the argument nIndex. For example,...
  4. Replies
    7
    Views
    4,975

    I had two files with following: #include...

    I had two files with following:


    #include <stdio.h>
    #include <stdlib.h>

    struct point {int x; int y; int z;};
    extern struct point p2;

    int main()
  5. Replies
    7
    Views
    4,975

    So you can have two structure declarations (or...

    So you can have two structure declarations (or class definitions) with the same name in different files, with one having additional members? My compiler doesn't complain about this for C or C++; I...
  6. Replies
    7
    Views
    4,975

    I see. Does this mean the new code will be...

    I see. Does this mean the new code will be compiled with a new definition of the structure (containing the additional members), which is different from the definition used for compilation of the old...
  7. Replies
    7
    Views
    4,975

    Struct field containing size of struct

    Hello,

    Why might a struct need a field containing the size of the struct (for example, in Windows programming, the first field of the struct WNDCLASSEX is generally set to sizeof(WNDCLASSEX))? Can...
  8. Replies
    3
    Views
    2,587

    Yes, the code is pretty old. And it seems that in...

    Yes, the code is pretty old. And it seems that in pre-ANSI C, locally defined character arrays initialized with strings had to be static.
  9. Replies
    3
    Views
    2,587

    Why is szAppName static?

    Hello,

    I am unsure why szAppName in the following program (and in virtually every other windows application I have seen) is declared static:


    #include <windows.h>

    LRESULT CALLBACK WndProc...
  10. Replies
    8
    Views
    12,006

    So if you set WS_VISIBLE you make both the...

    So if you set WS_VISIBLE you make both the ShowWindow() and UpdateWindow() calls redundant.
  11. Replies
    8
    Views
    12,006

    adeyblue, I didn't see your reply before posting...

    adeyblue, I didn't see your reply before posting mine. Anyhow, I would still be very interested to hear exactly what event it is that causes the WM_PAINT to be sent if there is no UpdateWindow()...
  12. Replies
    8
    Views
    12,006

    So the UpdateWindow() in the example is...

    So the UpdateWindow() in the example is redundant?

    And is it thus the ShowWindow() call that causes the WM_PAINT? If I understand Petzold correctly, he implies that ShowWindow() doesn't cause a...
  13. Replies
    8
    Views
    12,006

    What is causing WM_PAINT to be sent?

    Hello,

    On my machine, running the following causes "Hello, Windows 98!" to be painted immediately, even with the call of UpdateWindow() in WinMain commented out. According to Charles Petzold in...
  14. Thread: HIWORD macro

    by DL1
    Replies
    6
    Views
    3,404

    I am not trying to be obtuse here, but I can't...

    I am not trying to be obtuse here, but I can't actually see why casting makes the code more obviously correct.

    In the normal case, I will be a DWORD (that is surely the whole point of the macro),...
  15. Thread: HIWORD macro

    by DL1
    Replies
    6
    Views
    3,404

    I still don't get it. Even if that happened, and...

    I still don't get it. Even if that happened, and you ended up with 16 1s in front of the number, aren't they going to be discarded when the result is cast to WORD?

    It seems to me that all you are...
  16. Thread: HIWORD macro

    by DL1
    Replies
    6
    Views
    3,404

    HIWORD macro

    Hello all,

    I am a bit puzzled by this macro definition:


    #define HIWORD(l) ((WORD) (((DWORD) (l) >> 16) & 0xFFFF))

    Couldn't the same effect be achieved with the following?
  17. Replies
    4
    Views
    1,428

    The standard says this: "Dependent name...

    The standard says this:

    "Dependent name resolution [temp.dep.res]
    1 In resolving dependent names, names from the following sources are considered:
    — Declarations that are visible at the point of...
  18. Replies
    4
    Views
    1,428

    Thanks. That's reassuring. I wonder though...

    Thanks. That's reassuring. I wonder though whether the declaration of f(float) wouldn't in fact have to be before the template definition to be considered, since floats don't have an associated...
  19. Replies
    4
    Views
    1,428

    Template name binding - instantiation point

    #include <iostream>

    using namespace std;

    void f(const char*)
    {
    cout << "f(const char*)\n";
    }

    template <class T> void g(T a){f(a);}
  20. Replies
    6
    Views
    1,568

    Nicely put. I see now where I went wrong, I...

    Nicely put. I see now where I went wrong, I think.

    And if the function took an argument of the same pointer type, it would presumably be declared as follows:


    int (*(fun(int(*)(int)))) (int);
  21. Replies
    6
    Views
    1,568

    Thanks. That's what I ended up doing. I am still...

    Thanks. That's what I ended up doing. I am still puzzled as to why my initial declaration didn't work though. I can't see any difference between it and the typedef version, other than that the latter...
  22. Replies
    6
    Views
    1,568

    Function returning pointer to function

    Hello,

    I am getting a compilation error for this:


    int(*)(int)fun();

    What I am trying to declare is a function that returns a pointer to a function taking an int argument and returning an...
  23. Thread: Finding friends

    by DL1
    Replies
    5
    Views
    1,241

    ns::fn(x); // error: ns::fn not found gcc does...

    ns::fn(x); // error: ns::fn not found

    gcc does seem to find ns::fn() even if it's not supposed to (it also finds fn() with the unqualified call using argument-dependent lookup).

    If fn() really...
  24. Thread: Finding friends

    by DL1
    Replies
    5
    Views
    1,241

    I actually don't find it that dry; the author...

    I actually don't find it that dry; the author even makes the odd joke in places, which is more than can be said for e.g. K&R.
  25. Thread: Finding friends

    by DL1
    Replies
    5
    Views
    1,241

    Finding friends

    I am trying to decipher the following paragraph from chapter 11.5.1 of Bjarne Stroustrup's The C++ Programming Language:

    "A friend class must be previously declared in an enclosing scope or...
Results 1 to 25 of 99
Page 1 of 4 1 2 3 4