|
-
Mar 6th, 2001, 10:45 AM
#1
Thread Starter
Frenzied Member
I know how to use menus....now how do I use pictures?
-
Mar 6th, 2001, 12:51 PM
#2
Frenzied Member
If you mean bitmaps you can just import them in the resource editor, if you are using MSVC. If you arent then I am not sure how exactly to do it.
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Mar 6th, 2001, 12:58 PM
#3
Thread Starter
Frenzied Member
I mean like in the code you need to add SetMenu...is there a command for bitmaps?
-
Mar 6th, 2001, 01:00 PM
#4
Frenzied Member
So you want to display a bitmap on an object?
What kind of object? Picturebox? Static?
Or add a picture to your menu?
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Mar 6th, 2001, 01:05 PM
#5
Thread Starter
Frenzied Member
ooooh... didn't know there were so many choices 
I'd like to know how to add them to menus and picture boxes.
Thanks
-
Mar 6th, 2001, 01:08 PM
#6
Frenzied Member
Well I am not sure how to add to a menu, because I have never done it before, but I know it can be done.
How are you creating your picture box?
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Mar 6th, 2001, 01:12 PM
#7
Thread Starter
Frenzied Member
you know what... scratch that idea, I know how to make Static boxes....so how would I add pictures to them?
Sorry wasn't thinking before
-
Mar 6th, 2001, 01:15 PM
#8
Frenzied Member
With a static box, you will have to use DCs and BitBlt. Are you familure with those?
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Mar 6th, 2001, 01:16 PM
#9
Thread Starter
Frenzied Member
-
Mar 6th, 2001, 01:17 PM
#10
Frenzied Member
Ok, well this is a long process to explain, are you up to it?
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Mar 6th, 2001, 01:20 PM
#11
Thread Starter
Frenzied Member
Sure...I'm off of school today due to the snow!
(Thanks by the way! )
-
Mar 6th, 2001, 01:33 PM
#12
Frenzied Member
No problem, ok here it goes:
Here is a VB world tutorial if you get stuck. I know its in VB but all the code is about the same.
http://www.vb-world.net/graphics/lander/
Ok first thing you need to do is load your bitmap into memory, or a DC (Device Handle).
I am writing this free hand so there might be spelling or ; errors 
Code:
HDC hdc; //File that will hold the bitmap in memory
hdc = CreateCompatibleDC(NULL); //Creates a space in memory
Ok now we have the DC setup now its time to get the bitamp. You will need to have a VAR with your instance, ie hInstance.
Code:
HBITMAP hBitmap; //This will hold the Bitmap so we can load it into the DC
//If you have the bitmap loaded as a resource
hBitmap = (HBITMAP)SelectObject(hdc, LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_YOURBITMAP)));
//What we did is load the bitmap from the resource editor to the VAR hBitmap, then move it to the DC using SelectObject.
//Little error checking
if ((!hdc) || (!hBitmap))
MessageBox(NULL,"ERROR","ERROR",NULL);
Its important that when you go to exit your program, or you are COMPLETELY done with them, you kill the DC and the Bitmap from memory or else you have a leak.
Code:
DeleteDC(hdc);
DeleteObject(hBitmap);
Ok now come BitBlt, I need a sec to look something up so I will post the rest in a sec
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Mar 6th, 2001, 01:44 PM
#13
Thread Starter
Frenzied Member
I get these errors:
Code:
C:\Windows\Profiles\Steve\Desktop\C c++\Pictures\Pictures.cpp(17) : error C2065: 'hdc' : undeclared identifier
C:\Windows\Profiles\Steve\Desktop\C c++\Pictures\Pictures.cpp(18) : error C2065: 'hBitmap' : undeclared identifier
C:\Windows\Profiles\Steve\Desktop\C c++\Pictures\Pictures.cpp(48) : error C2065: 'IDB_BITMAP1": undeclared identifier
-
Mar 6th, 2001, 01:45 PM
#14
Frenzied Member
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Mar 6th, 2001, 01:52 PM
#15
Frenzied Member
Ok BitBlting, here comes the hard part and the part that will drive you insane if you have anything wrong.
You will need to have the HDC of the device you want to paint to. You can use GetDC to get it or you can catch the WM_PAINT message and use PAINTSTRUCT. Since this is your first time you should just use GetDC for right now.
Example:
Code:
HDC hdc_topaint;
hdc_topaint = GetDC(hWndOfTheDeviceToPaint);
Once you have that you need to know the size of the bitmap and the size of the device you are painting to. You can get that using a number of different ways but for now just write the sizes down when you make your static object, and most bitmap editors will give you the size. I would make the bitmap the same size as your static object to make your life easier for right now.
Ok now BitBlt:
Code:
BitBlt(hdc_topaint, Xdest, Ydest, Width, Height, hdc, Xsrc, Ysrc, SRCOPY);
//hdc_topaint is the hdc of the device to paint to
//Xdest, put the X position to start painting at, you will prob use 0 most of the time
//Ydest, put the Y position to start painting at, you will prob use 0 most of the time
//Width, this is the exact width of the static device you are painting to
//Height, this is the exact height of the static device you are painting to
//hdc, this is the DC of the bitmap we loaded into memory
//Xsrc, put the X position to start copying the bitmap from, you will prob use 0 most of the time
//Ysrc, put the Y position to start copying the bitmap from, you will prob use 0 most of the time
//SRCOPY, this is the raster code we will use, this means exact copy from bitmap to device. There are a bunch of others that do different things, just look up BitBlt in the MSDN.
Now for some bad news, the image is not "actually" on that object. What the means is that each time the object is refreshed it will disapear. I can tell you how to fix that, but try to get it up there first then we will work on the refresh.
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Mar 6th, 2001, 01:52 PM
#16
Thread Starter
Frenzied Member
PHP Code:
// Pictures in Static Boxes
// By Steve Mack
// March 6, 2001 (06.03.01)
#include <windows.h>
HWND ghWnd_Main; // this is the main window
// }
HWND ghWnd_ExitButton;
HWND ghWnd_label;
HWND ghWnd_Hello;
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch(uMsg) {
case WM_CLOSE:
DestroyWindow(ghWnd_Main); // Destroy the main window
DeleteDC(hdc);
DeleteObject(hBitmap);
return 0;
case WM_DESTROY:
PostQuitMessage(0); // Quit the application
DeleteDC(hdc);
DeleteObject(hBitmap);
return 0;
case WM_COMMAND:
if(LOWORD(wParam) == BN_CLICKED && (HWND)lParam == ghWnd_ExitButton) {
PostQuitMessage(0);
}
if(LOWORD(wParam) == BN_CLICKED && (HWND)lParam == ghWnd_Hello) {
SendMessage(ghWnd_label, WM_SETTEXT, 0, (LPARAM) (LPCTSTR) "Hello World!");
}
return 0;
}
return DefWindowProc(hWnd, uMsg, wParam, lParam); // Not handled - let the system deal with it
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
WNDCLASSEX wcxMyClass;
HDC hdc; //File that will hold the bitmap in memory
hdc = CreateCompatibleDC(NULL); //Creates a space in memory
HBITMAP hBitmap; //This will hold the Bitmap so we can load it into the DC
//If you have the bitmap loaded as a resource
hBitmap = (HBITMAP)SelectObject(hdc, LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BITMAP1)));
//What we did is load the bitmap from the resource editor to the VAR hBitmap, then move it to the DC using SelectObject.
//Little error checking
if ((!hdc) || (!hBitmap)) {
MessageBox(NULL,"ERROR","ERROR",NULL);
}
wcxMyClass.cbSize = sizeof(WNDCLASSEX); // Size of structure in bytes
wcxMyClass.style = 0; // Extra style information
wcxMyClass.lpfnWndProc = WndProc; // Pointer to window procedure
wcxMyClass.cbClsExtra = 0; // Extra bytes in class definition
wcxMyClass.cbWndExtra = 0; // Extra bytes for each window
wcxMyClass.hInstance = hInstance; // Instance handle for the class
wcxMyClass.hIcon = NULL; // Default icon - use system
wcxMyClass.hCursor = LoadCursor(NULL, IDC_ARROW); // Load the system arrow
wcxMyClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); // Background brush
wcxMyClass.lpszMenuName = NULL; // Menu name [MAKEINTRESOURCE(IDM_MAINMENU)] - none here
wcxMyClass.lpszClassName = "TESTCLASS"; // Class name
wcxMyClass.hIconSm = NULL; // Small icon
RegisterClassEx(&wcxMyClass); // Register the class
ghWnd_Main = CreateWindow("TESTCLASS", "Steve's Program!", \
WS_OVERLAPPEDWINDOW, 100, 100, 300, 300, \
NULL, NULL, hInstance, NULL);
if(ghWnd_Main) {
ghWnd_ExitButton = CreateWindow("Button", "E&xit", WS_CHILD | WS_VISIBLE, 100, 200, 100, 30, ghWnd_Main, NULL, hInstance, NULL);
ghWnd_label = CreateWindow("Static", "&What Will I Say?", WS_CHILD | WS_VISIBLE, 50, 10, 200, 30, ghWnd_Main, NULL, hInstance, NULL);
ShowWindow(ghWnd_Main, nCmdShow); // Show using the specific show style
}
/////////////////////////
// Handle message loop //
/////////////////////////
MSG msg;
while(GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg); // Translate keycode messages
DispatchMessage(&msg); // Send to the window
}
UnregisterClass("TESTCLASS", hInstance); // Unregister our window class
return msg.wParam; // msg.wParam contains the code passed to PostQuitMessage()
}
(I have included the bitmap resource file and the resource header)
-
Mar 6th, 2001, 02:18 PM
#17
Frenzied Member
Ah ok, you need to move
HDC hdc;
HBITMAP hBitmap;
to be global so move them under
HWND ghWnd_Hello;
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Mar 6th, 2001, 02:19 PM
#18
Frenzied Member
You also need to include your resource header file so you can use IDB_BITMAP1
#include "resource.h" is the most common header for the resources
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Mar 6th, 2001, 02:28 PM
#19
Thread Starter
Frenzied Member
errors:
Code:
C:\Windows\Profiles\Steve\Desktop\C c++\Pictures\Pictures.cpp(14) : error C2501: 'hdc' : missing storage-class or type specifiers
C:\Windows\Profiles\Steve\Desktop\C c++\Pictures\Pictures.cpp(14) : error C2040: 'hdc' : 'int' differs in levels of indirection from 'struct HDC__ *'
C:\Windows\Profiles\Steve\Desktop\C c++\Pictures\Pictures.cpp(14) : error C2440: 'initializing' : cannot convert from 'struct HDC__ *' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
C:\Windows\Profiles\Steve\Desktop\C c++\Pictures\Pictures.cpp(21) : error C2065: 'hBitmap' : undeclared identifier
Code:
Code:
// Pictures in Static Boxes
// By Steve Mack
// March 6, 2001 (06.03.01)
#include <windows.h>
#include "resource.h"
HWND ghWnd_Main; // this is the main window
// }
HWND ghWnd_ExitButton;
HWND ghWnd_label;
HWND ghWnd_Hello;
HDC hdc; //File that will hold the bitmap in memory
hdc = CreateCompatibleDC(NULL); //Creates a space in memory
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch(uMsg) {
case WM_CLOSE:
DestroyWindow(ghWnd_Main); // Destroy the main window
DeleteDC(hdc);
DeleteObject(hBitmap);
return 0;
case WM_DESTROY:
PostQuitMessage(0); // Quit the application
DeleteDC(hdc);
DeleteObject(hBitmap);
return 0;
case WM_COMMAND:
if(LOWORD(wParam) == BN_CLICKED && (HWND)lParam == ghWnd_ExitButton) {
PostQuitMessage(0);
}
if(LOWORD(wParam) == BN_CLICKED && (HWND)lParam == ghWnd_Hello) {
MessageBox(hWnd, "Hello World", "...", MB_OK);
}
return 0;
}
return DefWindowProc(hWnd, uMsg, wParam, lParam); // Not handled - let the system deal with it
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
WNDCLASSEX wcxMyClass;
HBITMAP hBitmap; //This will hold the Bitmap so we can load it into the DC
//If you have the bitmap loaded as a resource
hBitmap = (HBITMAP)SelectObject(hdc, LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BITMAP1)));
//What we did is load the bitmap from the resource editor to the VAR hBitmap, then move it to the DC using SelectObject.
//Little error checking
if ((!hdc) || (!hBitmap)) {
MessageBox(NULL,"ERROR","ERROR",NULL);
}
wcxMyClass.cbSize = sizeof(WNDCLASSEX); // Size of structure in bytes
wcxMyClass.style = 0; // Extra style information
wcxMyClass.lpfnWndProc = WndProc; // Pointer to window procedure
wcxMyClass.cbClsExtra = 0; // Extra bytes in class definition
wcxMyClass.cbWndExtra = 0; // Extra bytes for each window
wcxMyClass.hInstance = hInstance; // Instance handle for the class
wcxMyClass.hIcon = NULL; // Default icon - use system
wcxMyClass.hCursor = LoadCursor(NULL, IDC_ARROW); // Load the system arrow
wcxMyClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); // Background brush
wcxMyClass.lpszMenuName = NULL; // Menu name [MAKEINTRESOURCE(IDM_MAINMENU)] - none here
wcxMyClass.lpszClassName = "TESTCLASS"; // Class name
wcxMyClass.hIconSm = NULL; // Small icon
RegisterClassEx(&wcxMyClass); // Register the class
ghWnd_Main = CreateWindow("TESTCLASS", "Steve's Program!", \
WS_OVERLAPPEDWINDOW, 100, 100, 300, 300, \
NULL, NULL, hInstance, NULL);
if(ghWnd_Main) {
ghWnd_ExitButton = CreateWindow("Button", "E&xit", WS_CHILD | WS_VISIBLE, 100, 200, 100, 30, ghWnd_Main, NULL, hInstance, NULL);
ghWnd_label = CreateWindow("Static", "&What Will I Say?", WS_CHILD | WS_VISIBLE, 50, 10, 200, 30, ghWnd_Main, NULL, hInstance, NULL);
ShowWindow(ghWnd_Main, nCmdShow); // Show using the specific show style
}
/////////////////////////
// Handle message loop //
/////////////////////////
MSG msg;
while(GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg); // Translate keycode messages
DispatchMessage(&msg); // Send to the window
}
UnregisterClass("TESTCLASS", hInstance); // Unregister our window class
return msg.wParam; // msg.wParam contains the code passed to PostQuitMessage()
}
-
Mar 6th, 2001, 03:13 PM
#20
Frenzied Member
Ummm........HEHE you can do this
hdc = CreateCompatibleDC(NULL); //Creates a space in memory
here move it back and put
HBITMAP hBitmap; //This will hold the Bitmap so we can load it into the DC
there
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Mar 6th, 2001, 03:20 PM
#21
Thread Starter
Frenzied Member
Okay no errors, but no picture either...do I have to change the declaration of the static box?
Code:
ghWnd_label = CreateWindow("Static", "Picture", WS_CHILD | WS_VISIBLE, 50, 10, 200, 30, ghWnd_Main, NULL, hInstance, NULL);
-
Mar 6th, 2001, 03:24 PM
#22
Frenzied Member
Try this
Code:
ghWnd_label = CreateWindowEx(WS_EX_NOPARENTNOTIFY, "Static", NULL, WS_CHILD | SS_REALSIZEIMAGE, 50, 10, 200, 20, ghWnd_Main, NULL, hInstance, NULL);
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Mar 6th, 2001, 03:25 PM
#23
Frenzied Member
I dont see your BitBlt, am I missing it?
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Mar 6th, 2001, 03:26 PM
#24
Thread Starter
Frenzied Member
-
Mar 6th, 2001, 03:28 PM
#25
Frenzied Member
I explained how to use it a few posts up.
Put it under your Hello button just as a test
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Mar 6th, 2001, 03:39 PM
#26
Thread Starter
Frenzied Member
Oh I'm sorry I didn't see you posted twice there!
still doesn't show up though
-
Mar 6th, 2001, 04:07 PM
#27
Frenzied Member
Can you zip you entire project dir and post it
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Mar 6th, 2001, 05:50 PM
#28
Thread Starter
Frenzied Member
ITs a little too big...I'll email it.
What's your email?
-
Mar 6th, 2001, 05:51 PM
#29
Frenzied Member
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Mar 6th, 2001, 06:02 PM
#30
Thread Starter
Frenzied Member
Sent
-
Mar 6th, 2001, 06:03 PM
#31
Frenzied Member
Got it I am looking at it right now
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Mar 6th, 2001, 06:18 PM
#32
Frenzied Member
Ok first of you did not put in BitBlt, that is what puts the Image on the screen for you, everything else just gets it ready.
I maked all the changes I think
Code:
// Pictures in Static Boxes
// By Steve Mack
// March 6, 2001 (06.03.01)
#include <windows.h>
#include "resource.h"
HWND ghWnd_Main; // this is the main window
HWND ghWnd_ExitButton;
HWND ghWnd_label;
HWND ghWnd_Hello;
HDC hdc; //File that will hold the bitmap in memory
HBITMAP hBitmap; //This will hold the Bitmap so we can load it into the DC
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_CLOSE:
DeleteDC(hdc); //<----------------Change
DeleteObject(hBitmap); //<----------------Change
DestroyWindow(ghWnd_Main); // Destroy the main window
return 0;
case WM_DESTROY:
DeleteDC(hdc); //<----------------Change
DeleteObject(hBitmap); //<----------------Change
PostQuitMessage(0); // Quit the application
return 0;
case WM_COMMAND:
if(LOWORD(wParam) == BN_CLICKED && (HWND)lParam == ghWnd_ExitButton)
{
PostQuitMessage(0);
}
//<----------------Changed To Be Used For BitBlt
if(LOWORD(wParam) == BN_CLICKED && (HWND)lParam == ghWnd_Hello)
{
HDC hdc_label;
hdc_label = GetDC(ghWnd_label);
BitBlt(hdc_label, 0, 0, 200, 50, hdc, 0, 0, SRCCOPY);
}
return 0;
}
return DefWindowProc(hWnd, uMsg, wParam, lParam); // Not handled - let the system deal with it
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX wcxMyClass;
hdc = CreateCompatibleDC(NULL); //Creates a space in memory
//HBITMAP hBitmap; //<------------Delete
//If you have the bitmap loaded as a resource
hBitmap = (HBITMAP)SelectObject(hdc, LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BITMAP1)));
//What we did is load the bitmap from the resource editor to the VAR hBitmap, then move it to the DC using SelectObject.
//Little error checking
if ((!hdc) || (!hBitmap))
{
MessageBox(NULL,"ERROR","ERROR",NULL);
}
wcxMyClass.cbSize = sizeof(WNDCLASSEX); // Size of structure in bytes
wcxMyClass.style = 0; // Extra style information
wcxMyClass.lpfnWndProc = WndProc; // Pointer to window procedure
wcxMyClass.cbClsExtra = 0; // Extra bytes in class definition
wcxMyClass.cbWndExtra = 0; // Extra bytes for each window
wcxMyClass.hInstance = hInstance; // Instance handle for the class
wcxMyClass.hIcon = NULL; // Default icon - use system
wcxMyClass.hCursor = LoadCursor(NULL, IDC_ARROW); // Load the system arrow
wcxMyClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); // Background brush
wcxMyClass.lpszMenuName = NULL; // Menu name [MAKEINTRESOURCE(IDM_MAINMENU)] - none here
wcxMyClass.lpszClassName = "TESTCLASS"; // Class name
wcxMyClass.hIconSm = NULL; // Small icon
RegisterClassEx(&wcxMyClass); // Register the class
ghWnd_Main = CreateWindow("TESTCLASS", "Steve's Program!", \
WS_OVERLAPPEDWINDOW, 100, 100, 300, 300, \
NULL, NULL, hInstance, NULL);
if(ghWnd_Main)
{
ghWnd_ExitButton = CreateWindow("Button", "E&xit", WS_CHILD | WS_VISIBLE, 100, 200, 100, 30, ghWnd_Main, NULL, hInstance, NULL);
//<----------Made Bigger
ghWnd_label = CreateWindowEx(WS_EX_NOPARENTNOTIFY, "Static", NULL, WS_CHILD | SS_REALSIZEIMAGE, 50, 10, 200, 50, ghWnd_Main, NULL, hInstance, NULL);
//<----------Added To Be Used For A Test
ghWnd_Hello = CreateWindow("Button", "BitBlt", WS_CHILD | WS_VISIBLE, 100, 230, 100, 30, ghWnd_Main, NULL, hInstance, NULL);
ShowWindow(ghWnd_Main, nCmdShow); // Show using the specific show style
ShowWindow(ghWnd_label, nCmdShow); //<----------Added
}
/////////////////////////
// Handle message loop //
/////////////////////////
MSG msg;
while(GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg); // Translate keycode messages
DispatchMessage(&msg); // Send to the window
}
UnregisterClass("TESTCLASS", hInstance); // Unregister our window class
return msg.wParam; // msg.wParam contains the code passed to PostQuitMessage()
}
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Mar 6th, 2001, 06:23 PM
#33
Frenzied Member
Bad Me you should change/add
Code:
if(LOWORD(wParam) == BN_CLICKED && (HWND)lParam == ghWnd_Hello)
{
HDC hdc_label;
hdc_label = GetDC(ghWnd_label);
BitBlt(hdc_label, 0, 0, 200, 50, hdc, 0, 0, SRCCOPY);
DeleteDC(hdc_label);
}
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Mar 6th, 2001, 06:26 PM
#34
Thread Starter
Frenzied Member
-
Mar 6th, 2001, 06:28 PM
#35
Frenzied Member
No prob, glad to help, but remember what I said earlier, a BitBlt image will not stay on when the window gets refreshed, unless you make it stay.
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|