|
TenFiftyTwo wrote: my App launches an instance of an ooRexx interpreter
Now i am confused, earlier you said that your app does not launch the other process. If you do launch it then you could use CreateProcess[^] along with CreateNamedPipe[^] to redirect its output to a named pipe, read this named pipe in your own app and write what you get to your own output (basicly the console) after some synching.
Sorry if i am missing the point.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
OK.
My application launches an instance of an ooRexx Interpreter - through a function call (not a seperate thread) as you might do to launch another process. Now, the user might have launched my application with re-directed output handles - so I cannot be sure where the output from ooRexx or my application is going to end up being written to. So, all I was looking for was a way to ensure that there would not be any output overlap between ooRexx and my application - I was just looking for a way to synchronise output.
|
|
|
|
|
TenFiftyTwo wrote: I was just looking for a way to synchronise output.
That i understood.
TenFiftyTwo wrote: through a function call
This clears up the confusion, thank you.
For now i have no idea how you could achieve syncronization, sorry. Maybe others here know better. I will think about it, if i think of anything, i'll share.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
Thank you for considering the issue.
Regards.
James
|
|
|
|
|
I have another idea that might or might not work. Since after running your ooRexx thing, it will write its output on the same console as your app, i guess it inherits its standard outputs from your process, so i was wondering, what would happen if you were to change your own process' standard output prior to calling the function that runs the ooRexx thingie and then changing it back to its original afterwards, this way the external process might inherit the changed output. So basicly:
-create named pipes (for stdout and/or stderr)
-set them as standard output/standard error for your own process (google for how to do this, maybe freopen with stdout/stderr can do this, not sure)
-call the method to run the ooRexx thing
-change your app's output back
-have a thread running that reads from the named pipes and does nothing more than writing what it got to your own process' original output with syncronization added.
How does this sound?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
Hi.
Thanks for the update. Yes that would work and to be honest I had considered a similar setup - but I wanted to avoid over-complicating the solution. I actually have a slew of named-pipes in the app already - so coding that is not an issue.
How I wish the I/O functions had been designed to implement a simple mutex or event to indicate that an output stream had been acquired.
I am going to have to go ahead and employ the mechanism as you describe.
I would like to thank you very much for the time you have given to this issue.
My best regards.
James.
|
|
|
|
|
Yourwelcome, such problems are fun to fiddle with, at least for me. I'd apriciate it if you could drop a line here telling me/us if it worked or not. Just curiosity, thanks in advance.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
modified on Sunday, August 21, 2011 4:31 PM
|
|
|
|
|
In order to start a program automaticaly, by some while I use the follow code :
void CMainFrame::OnOptionsStartwithwindows()
{
m_bAutoStart = ! m_bAutoStart;
long lRet = 0;
CString sPath;
CRegKey regKey;
::GetModuleFileName(NULL,sPath.GetBuffer(_MAX_PATH),_MAX_PATH);
sPath.ReleaseBuffer();
if(! regKey.Create(HKEY_LOCAL_MACHINE,_T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run")) == ERROR_SUCCESS)return;
if(m_bAutoStart)lRet = regKey.SetValue(sPath,theApp.m_pszAppName);
else lRet = regKey.DeleteValue(theApp.m_pszAppName);
regKey.Close();
if(lRet != ERROR_SUCCESS)m_bAutoStart = ! m_bAutoStart;
}
and works fine ... until Windows 7 ... why ? Whould be a rights problem ? If yes, how can I have programatically administrator rights when I write in registry ?
Thank you.
|
|
|
|
|
HKEY_LOCAL_MACHINE access requires elevated privileges under Windows 7. You can set this in your project manifest, or Linker->Manifest options in your project Properties.
|
|
|
|
|
I like to set this into manifest file ... but I don't know how to do it ... an you give a small ideea ? Or link, anything ?
|
|
|
|
|
|
You could easily have discovered this for yourself by setting the option in your Linker properties as I suggested, and looking at the generated manifest:
<security>
<requestedPrivileges>
<requestedExecutionLevel level='requireAdministrator' uiAccess='false' />
</requestedPrivileges>
</security>
|
|
|
|
|
I work in VC6, so there I haven't options for directly editing manifest file ... thank you much, I try this and let you know what I've done.
|
|
|
|
|
Flaviu2 wrote: I work in VC6
Time to upgrade then.
|
|
|
|
|
|
Seems to work now, thank you.
|
|
|
|
|
Hi!
Someome can help me to solve this problem?
Package 'Visual Studio Explorers and Designers Package'has failed to load properly (GUI={8D8529D3-625D-4496-8354-3DAD630ECC1B})because of previous errors. For assistance, contact the package vendor. To attempt to load this package again, type 'devenv /resetskippkgs' at the command .
I use this command but no result.
Thanks
Lahatra
|
|
|
|
|
lahatra wrote: For assistance, contact the package vendor.
Looks like a good place to start.
|
|
|
|
|
I'm using the winsock API in my VC++ 2008 app.
When the application is running and the socket is connected all the time reading/writing, I unplug the network cable to force a network problem.
In order to check if the connection is down I just send 0 bytes to the socket, but I still returns 0 instead of SOCKET_ERROR.
Does anyone know how to check if the connection is down?
|
|
|
|
|
Please do not crosspost; this has already been answered here[^].
|
|
|
|
|
I front with a serious problem on VC6 environment on Win7 ... when I try to open a file ( not a project ) the environemnt crush down -- it's describe here http://support.microsoft.com/kb/241396[^]
and the solution too ... I download this project, I compile, succesfully register FileTool.dll, but when I try to AddsIn this dll into VC6 environment ( Tools -> Customize -> Add-ins and Macro Files ), I get this error :
Unable to register this add-in because its DllRegisterServer returns an error ...
I think that I succesfully register this dll because when I registered I get this message :
DllRegisterServer in FileTool.dll succeded.
Have you put face with this kind of problem ? Any hint will help a lot. Thanks.
|
|
|
|
|
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
|
|
|
|