This might be easy, but I can't seem to find where I can set or change this. I tried in winbgim.cpp, but I still get a Window with "Windows BGI" as the title.
-David
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2004-04-22
You can change the title in the winbgim.cpp sourcecode (the CreateWindow function), but normally you link the the libbgi.a file, so you need to use your modified winbgim.cpp file to rebuild the static library.
An easier and more flexible method is to use the Win32 API SetWindowText() function:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/setwindowtext.asp.
Clifford.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can't seem to change the title from "Windows BGI" to "My Window".
#include <winbgim.h>
#include <windows.h>
static HWND hWnd;
int main()
{
cleardevice();
initwindow(320,240);
SetWindowText(hWnd, "My Window");
int x =0;
int y =0;
while (!kbhit() && y <=240 )
{
putpixel(x,y,2);
Sleep(100);
x++;
y++;
}
return 0;
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am the OP and I found a fix. I think it can also be used to change the title of any Window.
Thanks for all the help...
-David
Fix follows
#include <winbgim.h>
#include <windows.h>
int main()
{
cleardevice();
initwindow(320,240);
HWND hWnd, hWndChild;
hWnd = FindWindow(NULL, "Windows BGI");
hWndChild = GetWindow(hWnd, GW_CHILD);
SendMessage((HWND) hWnd, WM_SETTEXT,0, (LPARAM)"My Window");
int x =0;
int y =0;
while (!kbhit() && y <=240 )
{
putpixel(x,y,2);
Sleep(100);
x++;
y++;
}
return 0;
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2004-04-23
In the first instance you declared a window handle, but never set it to anything. Your second code will work. I cannot find an alternative approach to getting the Window handle. However I'd be tempted to add an access function to the winbgim sourcecode to return the static hWnd that it holds. This would of course require you to re-build the library.
Clifford.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This might be easy, but I can't seem to find where I can set or change this. I tried in winbgim.cpp, but I still get a Window with "Windows BGI" as the title.
-David
Can you post the code?
JMan
You can change the title in the winbgim.cpp sourcecode (the CreateWindow function), but normally you link the the libbgi.a file, so you need to use your modified winbgim.cpp file to rebuild the static library.
An easier and more flexible method is to use the Win32 API SetWindowText() function:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/setwindowtext.asp.
Clifford.
Here is my code
I can't seem to change the title from "Windows BGI" to "My Window".
#include <winbgim.h>
#include <windows.h>
static HWND hWnd;
int main()
{
cleardevice();
initwindow(320,240);
SetWindowText(hWnd, "My Window");
int x =0;
int y =0;
while (!kbhit() && y <=240 )
{
putpixel(x,y,2);
Sleep(100);
x++;
y++;
}
return 0;
}
I am the OP and I found a fix. I think it can also be used to change the title of any Window.
Thanks for all the help...
-David
Fix follows
#include <winbgim.h>
#include <windows.h>
int main()
{
cleardevice();
initwindow(320,240);
HWND hWnd, hWndChild;
hWnd = FindWindow(NULL, "Windows BGI");
hWndChild = GetWindow(hWnd, GW_CHILD);
SendMessage((HWND) hWnd, WM_SETTEXT,0, (LPARAM)"My Window");
int x =0;
int y =0;
while (!kbhit() && y <=240 )
{
putpixel(x,y,2);
Sleep(100);
x++;
y++;
}
return 0;
}
In the first instance you declared a window handle, but never set it to anything. Your second code will work. I cannot find an alternative approach to getting the Window handle. However I'd be tempted to add an access function to the winbgim sourcecode to return the static hWnd that it holds. This would of course require you to re-build the library.
Clifford.