|
I haven't tried the solution you describe here, so I can't comment on that, but running VC6 in compatability mode with Windows XP solves the problem for me as well.
modified 13-Sep-18 21:01pm.
|
|
|
|
|
hello all, I have coded a round robin scheduling program using visual c++ , version 6.0. I want to add some simple graphics in my code so that a graphical representation of RR scheduling can be made. But, I don't know how to add graphics in visual c++. Can anyone of you give a suggestion or advice? Can you give me a sample code so that I can understand how to change my code to add graphics in it? Thanks.
Here is my code:
#include<stdio.h>
#include<conio.h>
struct round{
char name[20];
int at,bt,wt,trn,prev,ord,rem,cp,q,tc;
};
struct round Q[20],temp;
int main()
{
int f=0,r,i,j,k=0,n,q=0,exe=0,idle=0;
int tt=0,qt,wt=0,awt=0,flag=0,min=0;
float turn=0.0,wait=0.0;
printf("enter the number of process:");
scanf("%d",&n);
printf("enter the quantum:");
scanf("%d",&qt);
for(r=0;r<n;r++)
{
printf("\n Enter process name:");
scanf("%s",Q[r].name);
}
for(r=0;r<n;r++){
printf("\n Enter process %s arrival time:",Q[r].name);
scanf("%d",&Q[r].at);
}
for(r=0;r<n;r++){
printf("\n Enter process %s duration time:",Q[r].name);
scanf("%d",&Q[r].bt);
}
for(r=0;r<n;r++){
printf("\n Enter process %s order:",Q[r].name);
scanf("%d",&Q[r].ord);
}
for(i=0;i<n;i++){
for(j=i+1;j<n;j++){
if(Q[i].ord>Q[j].ord)
{
temp=Q[i];
Q[i]=Q[j];
Q[j]=temp;
}
}
}
min=Q[0].at;
for(i=0;i<n;i++){
if(min>Q[i].at){
min=Q[i].at;
}
}
for(i=0;i<n;i++){
exe=exe+Q[i].bt;
Q[i].cp=Q[i].at;
Q[i].tc=Q[i].at;
Q[r].wt=0;
}
printf("\n sequence of job:");
if(min!=0){
idle+=min;
}
while(tt<exe){
for(i=0;i<n;i++){
if((Q[i].tc<=tt)){
if(Q[i].bt>qt){
flag=1;
Q[i].wt=tt-Q[i].prev-Q[i].cp;
awt=awt+Q[i].wt;
if((Q[i].wt!=0)&&(Q[i].prev==0)){
Q[i].q=Q[i].wt;
}
Q[i].bt=Q[i].bt-qt;
tt+=qt;
Q[i].prev=tt;
printf("%s ",Q[i].name);
Q[i].cp=0;
Q[i].tc=tt;
}
else
{
if(Q[i].bt!=0){
flag=1;
Q[i].wt=tt-Q[i].prev-Q[i].cp;
awt=awt+Q[i].wt;
tt+=Q[i].bt;
Q[i].bt=0;
if((Q[i].wt!=0)&&(Q[i].prev==0)){
Q[i].q=Q[i].wt;
}
Q[i].prev=tt;
if(Q[i].bt==0){
Q[i].trn=tt-(Q[i].at+Q[i].q);
k+=Q[i].trn;
}
printf("%s ",Q[i].name);
Q[i].cp=0;
Q[i].tc=tt;
}
}
}
}
if(flag==0){
tt+=1;
idle+=1;
}
flag=0;
}
printf("\n Total Execution time:");
printf("%d",tt);
wait=(float)awt/n;
printf("\n Avarage Waiting time:");
printf("%.3f",wait);
printf("\n Avarage turnaround time:");
turn=(float)k/n;
printf("%.3f",turn);
printf("\n idle:%d",idle);
printf("\n");
return 0;
}
|
|
|
|
|
Assuming that you know how to create a Windows based application then you should start here[^] to learn GDI+.
|
|
|
|
|
I have a window derrived from CWnd which contains a number of rectangular areas. I would like the cursor to change shape when the mouse pointer is within any of the rectangular areas and I wondered if anyone could offer some advice as to what steps I need to take to do this.
Thanks
Tony
|
|
|
|
|
Override the CWnd::OnSetCursor() function. Call the Windows SetCursor() function to change the pointer.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
Thanks David, that worked a treat!
|
|
|
|
|
<?xml version="1.0" encoding="utf-8"?>
<LicenceManager xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://visionontech.com/vbp/LicenceConfiguration">
<ApplicationName>ovE1c/0l6IoKP/KF6bpqv22zqoYuT3Wv</ApplicationName>
<LicenseType>7Ax330npgHE=</LicenseType>
<VersionType>bbUl/DISjDzJkqERNmGqY8eWlTKz+Er3qSWdcEGFDUdsWo9DJrviULY/entknwWw2Z67rm0RnqeB3ENiAa1blfEkGPtfeELVxVG44JG4J5w=</VersionType>
<CompanyName>KWZwGJLdl+pI240K/PURWg==</CompanyName>
<SerialNumber>7515b594-6afb-4f0f-bf4c-13351339191c</SerialNumber>
<MachineID>I50NMYu1RZix+7AuMOhIDyhyFkiepjdK1Sy93luDdi4nCxRLW+Yy259FgXAvKvX9</MachineID>
<Signature>9XvKvAXgF952yY+WLRxCn4idDul39yS1KdjpeikFyhyDIhOMuA7+xiZR1uYMN05I</Signature>
<City>Q6H8NNOnO80=</City>
<CreatedBy>TZdhgIlUIBo2BIm8yvL3ww==</CreatedBy>
<LicenseCreationDate>1xtf7PZmvZQ5e+ohObsHFHokaELQyvIq</LicenseCreationDate>
</LicenceManager>
my laptop licence is
i m using other computer d'not work plz help me brack my code
|
|
|
|
|
|
The following error is referring to a variable that has a stale value.
Data4 CXX0017: Error: symbol "IID_IShellItem" not found
What does this mean (What is a stale value)?
Thanks!
|
|
|
|
|
Basically, the value could be retreived earlier however, there was a problem retreiving it on a more recent attempt.
See here[^]
|
|
|
|
|
Here is a stupid question...this means at some point the pointer went from a good pointer to a bad one. Is the stale value the address of the original memory location where the data was or a completely new location? This is meant to be a general question about what the stale value actually is....I think I understand that it was once valid.
|
|
|
|
|
Hi Experts,
I have 2 files ( .h and .c) I added in MFC dialog based application but I am getting linker error.
Is there any special thing to add .c file.
|
|
|
|
|
john5632 wrote: but I am getting linker error.
Are you certain the file is compiled as C++ ?
What link errors ?
Are you referencing an external library ?
Watched code never compiles.
|
|
|
|
|
yes, I am getting linker error 2019, 2001.
error LNK2019: unresolved external symbol "void __cdecl Unload(void)" (?Unload@@YAXXZ) referenced in function "public: void __thiscall CTestDlg::OnBnClickedButton2(void)" (?OnBnClickedButton2@CTestprotDlg@@QAEXXZ) TestprotDlg.obj
|
|
|
|
|
So, in function CTestDlg::OnBnClickedButton2() you have a call to function Unload() , but the linker cannot find it. Where is function Unload() declared?
[edit]I suspect that your source file should have the exctension .cpp rather than .c if this is an MFC project.[/edit]
|
|
|
|
|
Where is the "Unload" function? Is it in the file you added ? are you certain the file is compiled ?
Watched code never compiles.
|
|
|
|
|
I'm assuming certain things since you're haven't shared any code with us.
I assume that the Unload function is written in the .c file and its declaration is available in the corresponding .h file.
Now I believe that you're calling the Unload function from a routine in a .cpp file.
Since C++ compilers do name mangling, the Unload function name will be internally changed.
To prevent this from happening you must include the header file within an extern "C" block.
extern "C"
{
#include "my_c_header.h"
}
|
|
|
|
|
john5632 wrote: ...but I am getting linker error.
Care to share?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
Post the code.
John Nawrocki
Chief Technical Advisor
Custom Molded Products
|
|
|
|
|
NB: As indicated in a reply the issue has been solved. The DirectX module was changing the floating point precision.
A colleague is calling the constructor of a class which takes two doubles as arguments. Each argument he passes is the sum of two doubles:
CGridPoint( a + b, c + d)
The class object stores the two values internally. When he views the result he sees that the values have been rounded to 1 decimal place.
The values are not so large that this would be expected. Here are example:
a = 44.445472717
b = 724631.800000000
a + b = 724676.250000000
In other words he passes in 44.445472717 + 724631.800000000 as the first argument to the constructor and the result is stored internally and is seen to be 724676.250000000.
Does anyone know the cause of this rounding?
BTW he uses VS2008. This works in VS2010.
|
|
|
|
|
What is the code he is using to store the values and also to display them?
|
|
|
|
|
He is examing the property of the CGridPoint class using the debugger. He also confirms that the results look wrong when used. He displays a 2D representation of a Geophysical survey vessel and streamers on his screen, and position error ellipses are wrong, which is how he found this issue.
The code is C++ of course. He has rewritten like this:
CGridPoint gpt2 = gpt[i].Rotate(m_gptEllipseAngle);
gpt2.m_fEasting += gptLocation.m_fEasting;
gpt2.m_fNorthing += gptLocation.m_fNorthing;
pts[i] = ViewPoint(gpt2);
And it still fails. The original would have been something like:
CGridPoint gpt2 = gpt[i].Rotate(m_gptEllipseAngle);
pts[i] = ViewPoint(CGridPoint(gpt2.fEasting + gptLocation.m_fEasting, gpt2.fNorthing + gptLocation.m_fNorthing ));
The above might have a typo or two, not sure, I rewrote it here without compiling it.
|
|
|
|
|
I can't see the CGridPoint class in ATL or MFC; is this a Microsoft or home produced class?
|
|
|
|
|
He has found the cause. A call to DirectX was changing the floating point (double) precision ..
|
|
|
|
|
I think we need to see CGridPoint. I suspect that it is explicitly rounding things to 2dp (or could even be quarter-points from the particular example you gave).
|
|
|
|