|
Hi,
I have created a service in C# which spawns four child processes for some specific purpose. However if the child process crashes bcoz of some reason then I need to create a new instance of the child process.
I am able to do this in C# as there are events triggered when an application shuts down.
Now for some reason I want to port the service to VC++. I want to implement the restarting feature in the service. Does any body have any idea about the same?
Regards,
Nitin Gautam.
|
|
|
|
|
Crashes as in GONE or crahses as in STUCK.
If you retain the four process handles for the four programs you started, they will be signaled when the application is 'no longer a process' but you have no idea if they are HUNG.
If I start a child process and want to know when it is gone, I just wait/watch for the child process' handle to be signaled.
|
|
|
|
|
I have a dll which gets called on every network application. Now i want to create a user-interface which will communicate with the dll. How do i make the user-interface communicate with the dll? please suggest the ways for doing it.
|
|
|
|
|
|
can u elaborate. or provide some links..
|
|
|
|
|
|
I am novice programmer.Now days I am working on one system level project.My perticular requirement is to find out low level info of system like motherboard manufacturer,the memory supported on it (i.e DDR or SDRAM).For my project I have got many useful info from registry.But as I know this info r not available in registry.I have also tried some BIOS calls but not succeeded yet.Can Any body show me the path to do this stuff.That will be great help to me.
|
|
|
|
|
Have u tried WMI. If not, try searching for classes starting with win32_ in MSDN. To start on WMI, u can find help here[^]
"Aerodynamically, the bumble bee shouldn't be able to fly, but the
bumble bee doesn't know it so it goes on flying anyway." - Mary Kay Ash
My Articles
|
|
|
|
|
Hmm do you mean to know you configuration settings about your PC? well you can simply view device manager from system proerties.
|
|
|
|
|
I have an exe say xyz.exe. Whn i click on that exe for the second time i need to re-invoke the previous instance of that application again.Could anyone help me out on finding the previous instance of an application?????
URagav
Everything can be sacrificed for truth, but truth cannot be sacrificed for anything .
|
|
|
|
|
|
hi,
under the WIN32API we have CreateMutex function...
u can use this function to check whether the appilcation is already running..
by its return values u can re-invoke the existing one...
Public Declare Function CreateMutex Lib "kernel32" Alias "CreateMutexA" (lpMutexAttributes As SECURITY_ATTRIBUTES, ByVal bInitialOwner As Long, ByVal lpName As String) As Long
this is the declaration for that function.(from API text viewer)
u can also find help in MSDN abt this.
http://support.microsoft.com/default.aspx?scid=kb;en-us;258088[^]
use this link...
heres a vb sample....
Option Explicit<br />
Const ERROR_ALREADY_EXISTS = 183<br />
<br />
Public Declare Function CreateMutex Lib "Coredll" Alias "CreateMutexW" _<br />
(lpMutexAttributes As Long, _<br />
ByVal bInitialOwner As Long, _<br />
ByVal lpName As String) As Long<br />
<br />
Public Declare Function GetLastError Lib "Coredll" () As Long<br />
<br />
Private Sub Form_Load()<br />
<br />
Dim error_code<br />
<br />
CreateMutex CLng(0), 1, App.Title<br />
If GetLastError() = ERROR_ALREADY_EXISTS Then<br />
MsgBox "Already running", vbOKOnly, App.Title<br />
App.End<br />
Else 'run the application<br />
MsgBox "OK to run"<br />
End If<br />
End Sub
all the best..
- thanks and regards,
Basavaraj P.Umadi
|
|
|
|
|
Sir how can i access the NAT router present in the LAN server programatically.
I want to do NAT Tunneling using NAT (network address translation)
protocol.
How can i do it in VC++
Means any one know about its commands etc.
Actually my server (private IP)is running on one LAN ( Public IP)
And Client(private IP) is Running on other LAN (public IP)
How can they communicate to each other ...
I Guessed that it is bcoz of NAT ..
But i not know about its Programming techniques
|
|
|
|
|
How to use directshow to stream avi or mpeg video, a remote listening server and a client player which request a remote video file by passing its ip address and file location. If possible can it be done with socket programming.
|
|
|
|
|
"... can use thread local storage to keep track of an object's internal data" from a cp article.
//now my doubt is
CMyObj ob; //my obj is stored inside stack.
CMyObj* pOb = new CMyObj(); //my obj is stored inside heap.
---------------- //now how to store in threads local storage ?
pls throw some light
|
|
|
|
|
|
look for TLS (thread local storage) in MSDN. Also the functions TlsAlloc , TlsFree , TlsGetValue , TlsSetValue might be helpful.
|
|
|
|
|
Hi, I have created a precompiled header in my Win32 App and when I compile I recieve an error:
pchafx.cpp(1) : error C2850: 'PCH header file' : only allowed at file scope; may not be in a nested construct
It points to #include "pchafx.h" in pchafx.cpp file (my precompiled header file)
Can someone please advise?
Thankyou
|
|
|
|
|
http://69.50.187.114/~area51/crash.jpg
I been working on this bug for few days and cant find way.
it is time reminder program.
I do know some validation things and they are not working
The int numbers have to be load from the .ini
|
|
|
|
|
That screenshot doesn't really help.
Paste the code for that field and anything to do with that field.
|
|
|
|
|
CMyDigClockDlg::CMyDigClockDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMyDigClockDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMyDigClockDlg)
m_name = _T("");
m_hour9 = _T("");
m_hour8 = _T("");
m_hour7 = _T("");
m_name2 = _T("");
m_name3 = _T("");
m_name4 = _T("");
m_name6 = _T("");
m_name5 = _T("");
m_hour = 0;
m_minutes = 0;
m_hour2 = 0;
m_hour3 = 0;
m_hour4 = 0;
m_hour5 = 0;
m_hour6 = 0;
m_minutes2 = 0;
m_minutes3 = 0;
m_minutes4 = 0;
m_minutes5 = 0;
m_minutes6 = 0;
m_ampm = _T("");
m_ampm2 = _T("");
m_ampm3 = _T("");
m_ampm4 = _T("");
m_ampm6 = _T("");
m_ampm5 = _T("");
m_notepad = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CMyDigClockDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMyDigClockDlg)
DDX_Control(pDX, IDC_CLOCK, m_clock);
DDX_Text(pDX, IDC_NAME, m_name);
DDX_Text(pDX, IDC_NAME2, m_name2);
DDX_Text(pDX, IDC_NAME3, m_name3);
DDX_Text(pDX, IDC_NAME4, m_name4);
DDX_Text(pDX, IDC_NAME6, m_name6);
DDX_Text(pDX, IDC_NAME5, m_name5);
DDX_Text(pDX, IDC_HOUR, m_hour);
DDX_Text(pDX, IDC_HOUR2, m_hour2);
DDX_Text(pDX, IDC_HOUR3, m_hour3);
DDX_Text(pDX, IDC_HOUR4, m_hour4);
DDX_Text(pDX, IDC_HOUR5, m_hour5);
DDX_Text(pDX, IDC_HOUR6, m_hour6);
DDX_Text(pDX, IDC_MINUTES, m_minutes);
DDX_Text(pDX, IDC_MINUTES2, m_minutes2);
DDX_Text(pDX, IDC_MINUTES3, m_minutes3);
DDX_Text(pDX, IDC_MINUTES4, m_minutes4);
DDX_Text(pDX, IDC_MINUTES5, m_minutes5);
DDX_Text(pDX, IDC_MINUTES6, m_minutes6);
DDX_CBString(pDX, IDC_AMPM, m_ampm);
DDV_MaxChars(pDX, m_ampm, 2);
DDX_CBString(pDX, IDC_AMPM2, m_ampm2);
DDV_MaxChars(pDX, m_ampm2, 2);
DDX_CBString(pDX, IDC_AMPM3, m_ampm3);
DDV_MaxChars(pDX, m_ampm3, 2);
DDX_CBString(pDX, IDC_AMPM4, m_ampm4);
DDV_MaxChars(pDX, m_ampm4, 2);
DDX_CBString(pDX, IDC_AMPM6, m_ampm6);
DDV_MaxChars(pDX, m_ampm6, 2);
DDX_CBString(pDX, IDC_AMPM5, m_ampm5);
DDV_MaxChars(pDX, m_ampm5, 2);
DDX_Text(pDX, IDC_NOTEPAD, m_notepad);
//}}AFX_DATA_MAP
}
I have those variables in OnTimer.
This is in my OnTimer function.
if ((CurTime.wHour == m_hour) && (CurTime.wMinute == m_minutes) && (CurTime.wSecond == 00) && (setampm == m_ampm))
{
CString msg;
msg.Format("%s %d:%d %s",m_name, m_hour, m_minutes, m_ampm);
addiconballoon(1,m_name,msg,m_name,10);
startanimateicon();
}
if ((CurTime.wHour == m_hour2) && (CurTime.wMinute == m_minutes2) && (CurTime.wSecond == 00) && (setampm == m_ampm2))
{
CString msg;
msg.Format("%s %d:%d %s",m_name2, m_hour2, m_minutes2, m_ampm2);
addiconballoon(1,m_name,msg,m_name,10);
startanimateicon();
}
|
|
|
|
|
Send me your project. I can't see anything wrong with that. djneried@homemail.com.au
But I have a vauge idea of what is happening
Ashman
I'm normally not a praying man, but if you're up there, please save me Superman.
|
|
|
|
|
So have you looked at line 3102 of wincore.cpp? That should tell you exactly what is wrong.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
So I'm doing a project for a C++ class. I've written all the code, just gotta check for errors
Long story short, it's a energy bill calculator. I'm not sure if I need to provide more information than that.
The only errors I'm getting are 'illegal case' errors, and they're all coming from the same place. (where the bill is calcuated)
Since there are 3 possible inputs (in this case, Residential, Commercial, or Industrial) I decided to use a switch statement. Here's the code:
// calculate the bill
switch(type); {
case 'r':
case 'R': bill = PRICE_R + (amount * KWH_R); break;
case 'c':
case 'C': bill = PRICE_C + ((amount - 1000) * KWH_R); break;
default: cout << "Unknown use code!";
}
switch(offpeak) {
case 'peak':
case 'PEAK': peak = PRICE_PEAK + ((amount - 1000) * KWH_PEAK); break;
case 'off':
case 'OFF': off = PRICE_OFF + ((offpeak - 1000) * KWH_OFF); break;
default: cout << "Unknown use code!";
Now, there are no errors for the Industrial park (the section with Peak or Off-peak cases), but there are for the Residential and Commerical parts in the first case. My question is, do I need to declare the R and C to make them valid cases?
Any help is greatly appreciated!
|
|
|
|
|
Every case value in a switch statement must be a literal scalar (i.e an int , char , bool or enum ).
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|