|
NishantB++ is right.
You can start with WinSock (Socket programming ). you will find lots of material regarding Socker Programming in CP.
|
|
|
|
|
|
i have displayed a 3D cube in directX 8.0 (in VISUAL C++ - MFC). and i want to make rotate that using mouse, as per mouse moves. i have seen examples in ms sdk .
is there any other way to make rotate the 3D object using mouse?
|
|
|
|
|
I want to use a picture holder which is capable of holding any number of pictures and of any type. As the number of pictures keep on increasing it has a scroll bar. and as pictures are deleted the srollbar gets removed.
What i mean is that is should be dynamically increasing or decreasing.
I want this thing to be done as i am trying to make a desktop application as webshot.
Remember I am using MFC, VC++ 6.0 and not ATL so cannot use CImage class.
Thanks In Advance
DKS
|
|
|
|
|
If you can live with 32x32-Pixel thumbnails, CListCtrl in IconView can do what you want.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
what do u mean by CListCtrl in IconView can do what you want.
Can you just elaborate what u r trying to say.
Please.
Dhiraj Kumar Saini
|
|
|
|
|
The CListCtrl can be put in one of four modes. MSDN states:
"List view controls can display their contents in four different ways, called "views."
Icon view
Each item appears as a full-sized icon (32 x 32 pixels) with a label below it. The user can drag the items to any location in the list view window. "
This is what e.g. the Control-Panel shows when you set it to "Icon-View".
Using a mode Microsoft calls "virtual list view ctrl", your application can prepare the (32x32 pixel) thumbnails on demand.
The complete work of loading and resizing the pictures remains at your application, though.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Hi to all,
I have written a code in C++ using VC6 compiler to transfer data at 'm_Bitrate' bps as follows,
if( cycle1[m_PID] != -1 )
{
do
{
Sleep(1);
Int64 cycles;
_asm rdtsc;
_asm lea ebx,cycles;
_asm mov [ebx],eax;
_asm mov [ebx+4],edx;
cycle2[m_PID] = cycles;
}while( (cycle2[m_PID]-cycle1[m_PID]) < (MachineCycPerSec*188*8*total_packs/m_Bitrate));
}
Int64 cycles;
_asm rdtsc;
_asm lea ebx,cycles;
_asm mov [ebx],eax;
_asm mov [ebx+4],edx;
cycle1[m_PID] = cycles;
But if I remove Sleep(1); statement, then I got approximate data transfer bitrate, but it takes maximum CPU utilization;
& if I add Sleep(1); statement, then CPU utilization is les, but transfer bitrate is very less than 'm_Bitrate' bps.
Is their any optimum solution here? OR
Is their any wrong logic used for data tranfer? OR
Any way to reduce CPU utilization (Sleep for less than 1 Millisecond)?
Please help.
Thanks in advance.
Thanks & Best Regards,
Aniket A. Salunkhe
|
|
|
|
|
You will never be able to achieve such precision: windows is not a real-time operating system, so, when you sleep for 1 msec, it can take up to 10 or 15 msec depending on the situation.
You could try to use WinCE, which is real-time.
|
|
|
|
|
Hi,
But is there any wrong logic I have used in the code? OR
Can you suggest me the proper logic, if I am wrong.
Thanks for your replay.
Thanks & Best Regards,
Aniket A. Salunkhe
|
|
|
|
|
How to create several files of integers to be used to test sorting.several sizes, for example, size 20, 200, and 2000. Make files that are in order, in reverse order, in random order, and partially in order. By keeping all this test data in files (rather than generating it with random numbers each time the program is run), the same data can be used to test different sorting methods, and hence it will be easier to compare their performance.
the code template
template<class t="">
void insertionsort(T data[],int n)
{
for(int i=1,j;i<n;i++){
t tmp="data[i];
for(j=i;j">0&&tmp
|
|
|
|
|
The easiest way is to use an empty project with Doc/View arquitecture.
In the CMyDoc::Serialize (it comes by default using the assistant) you can code directly your random functions to save the ints that you want.
If not...
You should use the CFile,
CFile f;
if (!f.Open ("FileName.ext", CFile::modeRead))
{
}
if (!f.Open ("FileName.ext", CFile::modeWrite))
{
}
Sample to write numbers
void CMyView::WriteFile (CFile* file)
{
int Array[LIM];
for (int i = 0; i < lim; i++)
{
}
int* pBuf;
pBuf = &Array[0];
file->Write (pBuf, sizeof (Array));
}
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
thank you M.D.V...well but I have here no idea how to start the coding..can you please do teach me
|
|
|
|
|
Sorry, but Im not going to make your job. I have given you the idea to do it. You should now try it by yourself and post when you have problems, we will help you. But you hav to show you are trying it.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Thanks i understand you are guiding me,but it this correct what i'm doing now.Please have a look and if there is mistakes please correct me.
Thank you.
#include<iostream.h>
#include<ctime>
#include<math.h>
CFile f;
if (!f.Open ("FileName.ext", CFile::modeRead))
{
//Read your ints
}
if (!f.Open ("FileName.ext", CFile::modeWrite))
{
//Write your ints
}
void CMyView::WriteFile (CFile* file)
{
int Array[LIM];
for (int i = 0; i < lim; i++)
{
//fill with random
}
int* pBuf;
pBuf = &Array[0];
file->Write (pBuf, sizeof (Array));
}
void insertionsort(T data[],int n)
{
for(int i=1,j;i
T tmp=data[i];
for(j=i;j>0&&tmp
data[j]=data[j-1];
data[j]=tmp;
}
}
void main()
{
int x, y, z;
int arr[];
getArray (arr, n);
cout<<"The array before sorting was"<<endl;
="" for="" (x="0;" x<n;="" x++)
=""
="" {
="" cout<<arr[x]<<'="" ';
="" }
="" cout<<endl;
="" insertionsort="" (arr,="" n);
="" cout<<"the="" array="" after="" sorting="" was="" (assending)"<<endl;
="" (y="0;" y<n;="" y++)
="" cout<<arr[y]<<'="" (decending)"<<endl;
="" (z="n;" z="">=0; z--)
{
cout<
|
|
|
|
|
Just some advices...
1) Use "< pre > your code < /pre >" for snippets of code biggers than some lines, and "< code > your sentence < /code >" to highlite sentences in red (as I made). The first tags make:
it would be easier for us to read
2) The best way to do it is... you make your program, you compile in your computer. Try to solve your errors (can be missings ; or easy things) and... if you don't know what is happening... THEN write us the error that your compiler says, and the piece of code where the compiler sends you when you double click on the error.
If we need more information... we will ask you to give us more code or to answer concrete questions we make
About your code...
I have write a guide, not a functional code... // This 2 shlashes means that, up to this point all the things in the line are COMMENTED, so is not going to be read/compiled.
So... you have to try there, a piece of valid code. I mean (and I do one thing) with this:
for (int i = 0; i < lim; i++)
{
}
has to be done something, for example...
srand( (unsigned)time( NULL ) );
for (int i = 0; i < lim; i++)
{
myArray[i] = rand ();
}
With that you fill an array with LIM - 1 positions with random numbers.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Nelek wrote: The easiest way is to use an empty project with Doc/View arquitecture.
Gotta love driving nails with a sledgehammer!
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
snoop82 wrote: How to create several files of integers to be used to test sorting.several sizes, for example, size 20, 200, and 2000. Make files that are in order, in reverse order...
Do you have access to Excel?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Well if you have a pseudo random generator and it's always initialized with the same seed than you will always generate the same sequence of numbers!!!
Thus it's possible to do the performance comparison test you are taking about.
---
Yours Truly, The One and Only!
devmentor.org
Design, Code, Test, Debug
|
|
|
|
|
Hi i am working on a dialog box in a MFC application in VC 6.0 I want to use a simple button on which there is no text written instead a bmp image is drawn. what i actually need is that the image of button will change on mouse over,mouse down,mouseup etc. I need help of you people to solve this problem.
Thanks
|
|
|
|
|
You must draw the different images yourself in the OnPaint() function and check your conditions. Search for ownerdrwan buttons (XPButton)
This is the way not the solution...
Greetings from Germany
|
|
|
|
|
Try to find 'BtnST' class on this site. All you have to do is place a button on dialog, delete all text and in your .h file(wich you added to yours project) declare them as 'CButtonST' (a.g. CButtonST m_btnMY). It take this much code in yours cpp:
m_btnMY.SetIcon(IDI_ICON10);
m_btnMY.SetFlat(TRUE);
m_btnMY.SetTooltipText(_T("some text"));
and that is it!!!
You could do a whole lot more... just reed the article and take at look at sample!
|
|
|
|
|
Fine idea, but I was not the asker.
Greetings from Germany
|
|
|
|
|
I'm sorry, I didn't mean to send this to you. When I clicked replay I meant generally to original post. Once again sorry!
|
|
|
|
|
Thaks a lot dear fellow
your suggestion really helped me a lot.
looking forward for further collaboration.
Regards
|
|
|
|