How to position a messagebox

This is a discussion on How to position a messagebox within the Windows Programming forums, part of the Platform Specific Boards category; Does anyone know if there are any functions in VC++ to position a messagebox, or do i have to write ...

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    329

    How to position a messagebox

    Does anyone know if there are any functions in VC++ to position a messagebox, or do i have to write my own messagebox class..?

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,669
    I've never seen any.



    ITSA
    Socket Library!

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    One alternative is to create a window and paint the texts and position it according.

    Kuphryn

  4. #4
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    Use FindWindow and MoveWindow...here's a console example, I haven't tested if you need threading on an actual windows app yet, but here's how I did it...

    Code:
    #include <windows.h>
    #include <iostream.h>
    #include <process.h>
    
    void MoveMB(PVOID)
    {
    	HWND hMB;
    	
    	while((hMB = FindWindow(NULL, "wow...")) == NULL);
    
    	MoveWindow(hMB, 0, 0, 150, 125, TRUE);
    }
    
    int main(void)
    {
    	_beginthread(MoveMB, 0, NULL);
    
    	MessageBox(NULL, "Look at this!", "wow...", MB_OK | MB_ICONEXCLAMATION);
    
    	return 0;
    }
    You're going to need to enable Mutli-Threading for this to work...

    In MSVC (Visual Studio), go to Project->Settings->Click the C++ tab. Change the "Category" dropdown box to "Code Generation", and then change the "Use run-time library" dropdown box to "Multithreaded".

  5. #5
    Registered User
    Join Date
    Feb 2002
    Posts
    329
    That was a good idea, i thought about that myself, but never tried to get the windowhandle...
    Thx!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Button handler
    By Nephiroth in forum Windows Programming
    Replies: 8
    Last Post: 03-12-2006, 05:23 AM
  2. Delete files that are used
    By Yuri in forum C++ Programming
    Replies: 8
    Last Post: 10-18-2005, 01:48 PM
  3. Problem with linked list ADT and incomplete structure
    By prawntoast in forum C Programming
    Replies: 1
    Last Post: 04-30-2005, 01:29 AM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  5. LISP (DrScheme) any one?
    By Jeremy G in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 03-31-2004, 11:52 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21