|
How do we set theme to button..?
|
|
|
|
|
This will help you >
http://www.codeproject.com/buttonctrl/choverbitmapbutton.asp?print=true
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I will probably not follow this up, but what is the problem.
If I place a bitmap on a control (or whatever), I want it to display the same on all systems. If the display settings change then the only thing that should change is the background color.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
hare wnen i included "Themelib.h" file in stdafx.h then iam getting a error in ThemeLib.h that <uxtheme.h> no such file or directory
Now any files aslo inlude to avoid that exception ? and give me clear idea for that
|
|
|
|
|
Hi, I have been trying to learn how to use Direct3D, but I keep running into problems. After scratching my head for a while, and using the OutputDebugString() function, I found out that it was my message loop not branching correctly. It seems that PeekMessage is always returning true so I never get to the block of code that renders to the screen. I can't figure out how to fix the problem though; I was wondering if anyone here has any idea. BTW, I use a wrapper class to hold all my D3D code, thats what the g_Screen.render(); statement comes from.
#include "display.h"
const char g_szClassName[] = "Sandboxdx9";
Display g_Screen;
bool isrendered = false;
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE prevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
WNDCLASSEX wc;
HWND hwnd;
MSG msg;
wc.cbSize = sizeof(wc);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = NULL;
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = g_szClassName;
if(!RegisterClassEx(&wc))
{
OutputDebugString("Window Registration failed!\n");
return E_FAIL;
}
hwnd = CreateWindowEx(0, g_szClassName, "Sandbox", WS_POPUP | WS_SYSMENU | WS_VISIBLE,
0, 0, 640, 480, NULL, NULL, hInstance, NULL);
if(hwnd == NULL)
{
OutputDebugString("Window Creation failed!\n");
return E_FAIL;
}
if(g_Screen.init(hwnd) == false)
{
OutputDebugString("D3D initialization failed!\n");
return E_FAIL;
}
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
ShowCursor(false);
memset(&msg,0,sizeof(msg));
while(TRUE)
{
if(PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
{
if(msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
isrendered = true;
g_Screen.render();
}
}
if(isrendered)
OutputDebugString("It rendered.\n");
else
OutputDebugString("It didn't render.\n");
UnregisterClass(g_szClassName, wc.hInstance);
return (int)msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_CREATE:
{
}
break;
case WM_DESTROY:
{
PostQuitMessage(0);
}
break;
case WM_CLOSE:
{
PostQuitMessage(0);
}
break;
case WM_PAINT:
{
}
break;
case WM_KEYDOWN:
{
switch(wParam)
{
case VK_ESCAPE:
{
PostQuitMessage(0);
}
break;
}
}
break;
default:
{
return DefWindowProc(hwnd, msg, wParam, lParam);
}
break;
}
return 0;
}
|
|
|
|
|
Alright this is my second attempt to write a reasonable answer. Do not depend on PeekMessage to return false before your render a screen image. If you are going to make decisions at this level, then you should be making them based on messages. If the function PeekMessage is returning false, then you should be exiting the program.
You caught me off guard with the C level code, but I believe what I stated is correct because I programmed at that level for several years.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Thank you. I tried searching the messageboards before asking, sorry if this question was already answered in another post. The reason I used PeekMessage was mainly because that was how I was taught from all the tutorials I read on the net. Should I just create a timer and render when I recieve WM_TIMER messages instead?
|
|
|
|
|
Sorry I have been away for a while; almost any thing using a PeekMessage loop is probably old school. I had to reread the original post and I recommend visiting gaming sights. A WM_TIMER message will work fine (also old school); just make sure you have a flag to tell you when an update is needed. You will normally here the term dirty flag (like a modified flag), which simply means something has changed. So your timer function will check the flag and if nothing has changed then you do nothing, quick and clean. If something has changed then you need to redraw the screen or preferably only the portions that have changed. Given time you will figure it all out, provided no one else is breathing down your neck.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
hi,
How can we use AutoLoad() to load a bitmap for the button
Thank you
|
|
|
|
|
From The Docs:
// Initialize the owner-drawn button with the id IDC_MYBUTTON as a bitmap
// button. This code is used in the OnInitDialog handler of my dialog.
//The button property should be set as BS_OWNERDRAW
myButton.AutoLoad(IDC_MYBUTTON, this);
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
-- modified at 5:48 Saturday 3rd June, 2006
|
|
|
|
|
Hi,
Thanks for your reply.
I have taken a button and set the ownerdraw property and mapped it as myButton and used in InitDialog() I wrote :
myButton.AutoLoad(IDC_MYBUTTON, this);
But I am getting an exception in this line Please tell me how to solve it.
And can you tell me a bit more abt AutoLoad() bcoz I didnt understand how the bitmaap is loaded without mentioning the resource id in it.
Thank you.
|
|
|
|
|
http://support.microsoft.com/kb/q134421/
have a look at the above link.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hello everyone,
My friend and I are discussing about an interesting question, how to calculate efficiently how many 0s are at the end of N! (1 * 2 * 3 * ... * N-1 * N).
Our algorithm is like this,
1. Use a loop to calculate N!
2. Use a loop to calculate %10 result of N!, then /10 each step
Are there any better solutions?
regards,
George
|
|
|
|
|
First this will probably be the end of my contributions to your question.
The answer is none, or as many as you want.
If you do not understand the answer, then I suggest you reword your question.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence." Edsger Dijkstra
|
|
|
|
|
Hi John,
Do you have I have not made myself understood?
regards,
George
|
|
|
|
|
Hi George,
This is the first time I check my mail since posting, that and I really did not plan on coming back. The number of zeros following any number is none or infinite. The number of zeros displayed is up to the code displaying those numbers, which is limted.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Hi John,
I think to calculate the number of trailing 0s is an algorithm problem, why you say it is a display problem -- we can calculate the number without displaying it, right?
regards,
George
|
|
|
|
|
Hi George,
I was answering an email when I received your reply. I did not say the number of zeros was a display problem. I said the number of zeros following any number is infinite, which means you can display as many as you want. If you want to run an algorithm to display all the zeros following any number, then go ahead. Just remember that the machine will never stop printing zeros until you stop it or turn it off. It is a matter of how many zeros you want to display. I know there are some functions (algorithms) that will print a ridiculously high number of trailing zeros, but that is the designer’s choice. The normal problem for those using it is to trim all those unnecessary zeros before displaying it to the user. Trailing zeros are not really part of the number as they are a given. If a number has a hundred zeros following it and they end with a 1 then they are not trailing zeros, but any zeros following the 1 are.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Hi John,
I do not want to print the 0s. I want to print the number of 0s. For example, if the input is 5, then output is 1 (5! = 120), if the input is 3, the output is 0 (3! = 6).
regards,
George
|
|
|
|
|
I apparently do not understand the original question. I am not a mathematician and have forgotten most of my advanced math a long time ago. I thought we where dealing with trailing zeros which is the same in code as it is in mathematics. What you are showing me does not make since to me from a coding point of view. For some reason you have my attention, but to be honest I do not know what you are talking about. If you find an answer and remember me, please do not hesitate to send it to me via codeproject.
Well goodnight now, it is about 8 hours passed my bed time.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Thank you all the same, John! Have a good night.
regards,
George
|
|
|
|
|
Do you want the number of digits of the number of 0's. i.e.
4! = 4x3x2x1 = 24 = 2 digits; but no zeros.
If you want the number of digits use log (base 10). I believe it's called log10 .
Steve
|
|
|
|
|
Hi Steve,
Log10 is not working -- it only checks the length of a digit in base 10 -- not the number of trailing 0s.
regards,
George
|
|
|
|
|
I see; you literally want the number of trailing 0's and not the number of digits. It's an interesting question.
Steve
|
|
|
|
|
Hi Steve,
You are right. If you have any further comments or ideas, please post here. I am happy to discuss with you again.
regards,
George
|
|
|
|
|