|
thanks a lot for your suggestion.
but i want find the time exactly, so i need to find number exection cycle of the program. with this execution cycle i can find the time taken by the code.
so please can you help me out in find execution cycle any code.
Regards and Thanking you
sham
|
|
|
|
|
does anyone know how to create a polygon for a graphics program on visual studio, i'm having problem figuring out the algorith, i know that i'm suppose to use vectors but i'm kind of lost. plus i have to ask the user to input the points of the polygon, any ideas
glowskull
|
|
|
|
|
I work with a subclassed CListCtrl. Tooltips will be displayed on the individual subitems; it works as expected.
I want to display tooltips on the header items as well. OnToolHitTest receives control, it sets the parameters, but OnToolTipText does not receive the control at all.
OnToolTipText will be mapped by
ON_NOTIFY(TTN_NEEDTEXTA, 0, On_ToolTipTextA)
ON_NOTIFY(TTN_NEEDTEXTW, 0, On_ToolTipTextW)
This should work for the CHeaderCtrl as well, should not it?
Btw, if I set the text pointer in OnToolHitTest directly in TOOLINFO.lpszText, instead of setting LPSTR_TEXTCALLBACK, it won't be displayed either (though it won't be ignored either: if I set the address of a constant string, I get an error, when it will be tried to release).
I did read about TTF_IDISHWND, etc. and tried all possible combinations, to no awail.
What else do I have to consider?
|
|
|
|
|
How do I make dialog to behave in a way that, no matter where I am clicking on the screen, I am always clicking the dialog (which is invisiable)? My program is to draw directly on the screen.
|
|
|
|
|
It depends on how it needs to act. There is away to set the transparency of a window on 2000? and XP. That is you could create a dialog that is invisable yet lets you see the screen behind it and draw on that. Or you can override the WM_PAINT and WM_NCPAINT, then only draw where you want, instead of drawing the the background and all that.
(best to do full screen window then).
The dialog needs to be the active window no matter how you do it.
There is one other possibiliy: Read up on the TRACKMOUSEEVENT, since SetCapture will not do the trick. I've used it
You may need to use a normal window instead of a dialog, if I remember correctly, dialogs do not give you much control of how there background is drawn.
Well out of ideas! I hope they were not to bad.
Good Luck!
INTP
|
|
|
|
|
Use a regular window (not a dialog), and give it the WS_EX_TOPMOST and WS_EX_TRANSPARENT extended styles.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
im using visual studio 2003.net and am trying to convert integer numbers from 1-255 into its equivalent ascii character then display it in a textbox, i tried to immediately display a character but the ascii code is the one that gets displayed. right now, im doing it the hard way by comparing each integer value and then placing into a variable its corresponding ascii character. is there a simpler way to do this? please help...
my original program flow:
char dataBuffer[512];
- data goes inside dataBuffer
- i get parts of it by using the index
- i use ToString() method to convert it to string
- display them in a textbox
the problem with this is that let's say,
dataBuffer[0] = 'A';
textBox->Text = dataBuffer[0].ToString();
OUTPUT: "65";
- i'd like it to be "A" instead of "65"
right now, i made a function which converts whatever is inside dataBuffer[x] by comparing it with ascii codes and placing in another variable the equivalent character, then that's what i display in the textbox.
i'm looking for a way to make it shorter 'coz the code to convert it is already about 510 lines.
please, please, please...
|
|
|
|
|
I don't do .NET, but have you tried:
textBox->Text = dataBuffer[0];
According MSDN online the ToString() method is doing exactly what is suposed to be doing.
INTP
|
|
|
|
|
yep, i tried that but the damn textbox keep on complaining that it cant convert char to string thingy or something like that...
|
|
|
|
|
Well if you where using regular C++ and the operator= accepted a regular C string ('\0' terminated) you could do the following.
char szTemp[2];
szTemp[0] = dataBuffer[0];
szTemp[1] = '\0';
text = szTemp;
or possibly
text = String(szTemp);
I do not know if that helped, but there is a .NET forum at CP, where I assume the experts hangout. There are also .NET articles, may be one of them will show you a code example.
Well I am done guessing!
Simple things keep getting harder to do (blast it anyway)!
INTP
|
|
|
|
|
I don't have .NET install on my machine, so I just can guess this.
dataBuffer[0] = 'A';
textBox->Text = String(dataBuffer[0]);
If it still doesn't work, try this:
dataBuffer[0] = 'A';
textBox->Text = (char)dataBuffer[0];
I hope this help.
Cheers...
Samin Thomas
|
|
|
|
|
i just did what "john" suggested and just appended a '\0' at the end of the character array. it seems to work fine...thanx again...
|
|
|
|
|
im using visual studio 2003.net and am trying to convert integer numbers from 1-255 into its equivalent ascii character. right now, im doing it the hard way by comparing each integer value and then placing into a variable its corresponding ascii character. is there a simpler way to do this? please help...
|
|
|
|
|
I think that if you just static cast the int to a char it will work...
ex.
asciiletter = char(intnumber);
|
|
|
|
|
What is wrong with this code? I get math errors,does not exit on entering n, and cannot print output? How do I make the program a page so the option to print is given.
// RWA's and Charges
#include <iostream>
using std::cout;
using std::cin;
using namespace std;
//using::endl;
int main()
{
int choice, c;
float amount,total,fee;
char choice3 ='y';
while(choice3=='y'|| choice3=='Y')
{
cout << "\nChoose from options below.\n";
cout << "\nEnter 1 to calculate total RWA cost.\n";
cout << "\nEnter 2 to calculate RWA base estimate.\n";
cout << "\n\t\tEnter your choice, then press the enter key:";
cin >> choice;
if (choice == 1){
cout << "\nEnter RWA Base Estimate, then press the enter key:$";
cin >> amount;
fee = amount * 0.04;
cout << "4% Management Fee:$" << fee <<"\n";
total = amount + fee;
cout << "Total:$" << total <<"\n";
if (total >= 1 && total <= 2499 ||total >= 1 && total <= 2,499)
{
cout << "Overhead:$" << total*0.1 <<"\n";
cout << "Total Obligation:$" << total + (total * 0.1) <<"\n";
}
if (total >= 2500 && total <= 9999 ||total >= 2,500 && total <= 9,999 )
{
cout << "Overhead:$" << total*0.09 <<"\n";
cout << "Total Obligation:$" << total + (total * 0.09) <<"\n";
}
if (total >= 10000 && total <= 24999 ||total >= 10,000 && total <= 24,999)
{
cout << "Overhead:$" << total*0.08 <<"\n";
cout << "Total Obligation:$" << total + (total * 0.08) <<"\n";
}
if (total >= 25000 && total <= 49999 ||total >= 25,000 && total <= 49,999)
{
cout << "Overhead:$" << total*0.07 <<"\n";
cout << "Total Obligation:$" << total + (total * 0.07) <<"\n";
}
if (total >= 50000 && total <= 99999 ||total >= 50,000 && total <= 99,999 )
{
cout << "Overhead:$" << total*0.05 <<"\n";
cout << "Total Obligation:$" << total + (total * 0.05) <<"\n";
}
if (total >= 100000 && total <= 299999 ||total >= 100,000 && total <= 299,999)
{
cout << "Overhead:$" << total*0.03 <<"\n";
cout << "Total Obligation:$" << total + (total * 0.03) <<"\n";
}
if (total >= 300000 && total <= 999999 ||total >= 300,000 && total <= 999,999)
{
cout << "Overhead:$" << total*0.015 <<"\n";
cout << "Total Obligation:$" << total + (total * 0.015) <<"\n";
}
if (total >= 1000000 && total <= 2425000 ||total >= 1,000,000 && total <= 2,425,000)
{
cout << "Overhead:$" << total*0.005 <<"\n";
cout << "Total Obligation:$" << total + (total * 0.005) <<"\n";
}
}
if (choice == 2) {
cout << "\nEnter Total RWA Cost, then press the enter key:$";
cin >> amount;
fee = amount * 0.04;
cout << "4% Management Fee:$" << fee <<"\n";
total = amount - fee;
cout << "Total:$" << total <<"\n";
if (total >= 1 && total <= 2499 ||total >= 1 && total <= 2,499)
{
cout << "Overhead:$" << total*0.1 <<"\n";
cout << "Spendable Amount:$" << total - (total * 0.1) <<"\n";
}
if (total >= 2500 && total <= 9999 ||total >= 2,500 && total <= 9,999 )
{
cout << "Overhead:$" << total*0.09 <<"\n";
cout << "Spendable Amount:$" << total - (total * 0.09) <<"\n";
}
if (total >= 10000 && total <= 24999 ||total >= 10,000 && total <= 24,999 )
{
cout << "Overhead:$" << total*0.08 <<"\n";
cout << "Spendable Amount:$" << total - (total * 0.08) <<"\n";
}
if (total >= 25000 && total <= 49999 ||total >= 25,000 && total <= 49,999)
{
cout << "Overhead:$" << total*0.07 <<"\n";
cout << "Spendable Amount:$" << total - (total * 0.07) <<"\n";
}
if (total >= 50000 && total <= 99999 ||total >= 50,000 && total <= 99,999 )
{
cout << "Overhead:$" << total*0.05 <<"\n";
cout << "Spendable Amount:$" << total - (total * 0.05) <<"\n";
}
if (total >= 100000 && total <= 299999 ||total >= 100,000 && total <= 299,999)
{
cout << "Overhead:$" << total*0.03 <<"\n";
cout << "Spendable Amount:$" << total - (total * 0.03) <<"\n";
}
if (total >= 300000 && total <= 999999 ||total >= 300,000 && total <= 999,999 )
{
cout << "Overhead:$" << total*0.015 <<"\n";
cout << "Spendable Amount:$" << total - (total * 0.015) <<"\n";
}
if (total >= 1000000 && total <= 2425000 ||total >= 1,000,000 && total <= 2,425,000)
{
cout << "Overhead:$" << total*0.005 <<"\n";
cout << "Spendable Amount:$" << total - (total * 0.005) <<"\n";
}
}
cout <<"********************************************************************""\n";
cout <<"***** Rate Range Subtotal Max. Range *****""\n";
cout <<"***** .01 .1 $2,499 $250.00 $250.00 *****""\n";
cout <<"***** 0.09 $2,500 $9,999 $675.00 $675.00 *****""\n";
cout <<"***** 0.08 $10,000 $24,999 $800.00 $1,200.00 *****""\n";
cout <<"***** 0.07 $25,000 $49,999 $1,750.00 *****""\n";
cout <<"***** 0.05 $50,000 $99,999 $2,500.00 *****""\n";
cout <<"***** 0.03 $100,000 299,999 $6,000.00 *****""\n";
cout <<"***** 0.015 $300,000 $999,999 $10,500.00 *****""\n";
cout <<"***** 0.005 $1,000,000 $2,425,000 $7,125.00 *****""\n";
cout <<"********************************************************************""\n";
cout<<"Would You Like to Perform Another Calculation (Y/N)?";
cin>>choice3;
}
//return 0;
cin >> c;
|
|
|
|
|
When you are storing the number (e.g. cin >> amount) you must include cin.ignore(); to ignore the carriage return ("\n").
|
|
|
|
|
Hey again to all...
I have a code that creates a dialog box...
But this dialog box is useless cause it doesn't handle
none of its messages...
And when I call DefDlgProc there is an error when it tries to handle message #48 (I think) about a 1000 times.
here is my code:
#include <windows.h>
#include "resource.h"
bool g_run = true;
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
ShowWindow(hDlg,SW_SHOW);
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
g_run = false;
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
}
return FALSE;
}
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
HWND hwnd = CreateDialog(hInstance, (LPCTSTR)IDD_DIALOG1, NULL ,(DLGPROC)About);
if (hwnd == NULL)
{
DWORD err = GetLastError();
}
while (g_run);
return 0;
};
|
|
|
|
|
Hey... dude...
You need to change your while (g_run); line
to this lines:
BOOL bRet;
MSG msg;
while ((g_run) && ( (bRet = GetMessage(&msg, NULL, 0, 0)) != 0 ))
{
if (bRet == -1 )
{
}
else if (!IsWindow(hwnd) || !IsDialogMessage(hwnd, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
I wonder why it works ????<br />
Really.. I don't know why it works... but it does
|
|
|
|
|
I tell why it works...
it didn't work because your dialog window didn't recieve the messages.
Now it works because your dialog now recieves the messages...
that is why we need to use TranslateMessage and DispatchMessage .
|
|
|
|
|
M$ has used a GUID in the path of some of their critical objects i.e.
C:\Documents and Settings\Owner\Local Settings\Application Data\Identities\{520682BF-0796-481Z-AZB4-4E13X899C96E}\Microsoft\Outlook\
So my question is very simple: Where do the embed this information so they may access the same?
I checked the registry and no joy, and I looked for fake dll's and no joy.
So I must assofme that it is encrypted data, yes?
I don't want their info I just wish to understand the issues and how they formulate a pointer to the stored data.
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
Hello
Does anyone have or know how write a program that searches for all video devices on your computer and displays them in the console. It is so that i can choose one to connect to and display the video from it.
Thanks for any help.
|
|
|
|
|
Hey... I'm working on a new network program... I have been getting away with using the PuTTy.exe program, but I want to do my own RAW programming... I was wondering if there was some guy out there who could pop me a message. This propably goes under the Web-development forum but I figured this would be good coz I am using MC VC++ 5.0 soon to be 6.0. Anyhow, I wanted a SOCK_RAW tute, because the Linux one's are a little vague, and don't help me much. I don't want to just send, I want to be able to recieve and stuff as well... the idea will be to trivialy plug the command line tool into whatever I want to, kindof like netcat. Anyway, a big thanks to the first person to reply with a full tute...
|
|
|
|
|
Can someone point me to a good CTreeCtrl Drag and Drop tutorial?
Thanks much!
-Ian
|
|
|
|
|
Hi all,
Can anyone please give a tip or 2 or 1000,
about... How to put an icon in the tray bar ?
woops... almost forgot, I m not using MFC.. only pure VC++
|
|
|
|
|
Using Shell_NotifyIcon . The documentation of that API pretty much provides you with all the necessat info.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|