Results 1 to 7 of 7

Thread: Hwnd

  1. #1

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500

    Hwnd

    how do i convert an HWND to a string LPCTSTR?
    thanks
    Amon Ra
    The Power of Learning.

  2. #2
    Megatron
    Guest
    Code:
    LPCTSTR lpBuff;
    wsprintf( lpBuff, "%d", hWnd);
    // lpBuff now contains hWnd

  3. #3

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500
    cool thanks..also
    is there a way to achieve what this does in VB:

    PHP Code:
    cnt GetProp(hwnd"C" hwnd
    in C++, or do i have to use strcat?
    thanks
    Amon Ra
    The Power of Learning.

  4. #4

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500
    basivcally, can i put 2 strings together with "&" ? without using strcat?
    Amon Ra
    The Power of Learning.

  5. #5
    jim mcnamara
    Guest
    strcat(char *dest,char *source) returns a pointer to dest so it can be used in functions , just like you want.



    Code:
    char tmp[20];
    memset(tmp,0x0,sizeof(tmp));
    strcpy(tmp,"C");
    cnt = GetProp(hwnd, strcat(tmp,"hwnd") );

  6. #6

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500
    thanks..one more thing...what is the equivalent to this: (in VB)

    PHP Code:
    ObjPtr(iwp
    in C++?

    is it
    PHP Code:
    &iwp //? 
    thanks
    Amon Ra
    The Power of Learning.

  7. #7
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Originally posted by Amon Ra
    basivcally, can i put 2 strings together with "&" ? without using strcat?
    If you're using C++ strings, then you can use the + operator.

    Bear in mind that it won't do type conversion to strings for you, you need to define your own operators if you want that (or use a stringstream):
    Code:
    #include <sstream>
    
    using namespace std;
    
    string somecode() {
        ostringstream oss;
        int y = 5;
    
        oss << "Hello " << y;
    
        return oss.str();
    }
    As for ObjPtr, yep. & is the address-of operator, and its counterpart is the * dereferencing operator.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width