|
How can i understand one program is terminated?
for example suppose the NOTEPAD.EXE is running ,now i want to be notified whenever
that it is terminated? It is very important for me to understand.Please Help Me.
Please excuse me for bad comments,my english isn't well.
Thanks a lot.
|
|
|
|
|
If you have it's process handle, you can wait on the handle using one of the WaitForXXXX API calls.
Else if you have the HWND of the window, just do an IsWindow on it and then do a GetWindowText etc... and verify that it;s the same window.
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
check out my winsock hook - api hooking revealed article , hook the TerminateProcess() function and get notified of any process closing !
//more in the article
//rate me or hate me
I am the mighty keeper of the book on knowledge . Contact me to get your copy .
|
|
|
|
|
I want to read a file from a NT. the path is \\nt\mydata\myfile.txt. I write the following:
CFile aa.Open("\\\\nt\\mydata\\myfile.txt",CFile::modeRead);
but the above always is wrong! mybe it can't read the file from a network.
What is wrong with these? what can i do for this?
Please help me! Thanks a lot!
|
|
|
|
|
Let say you have computer, named nt...
1) Connect to remote computer:
CString strNetPath("\\\\nt\\MyData");
NETRESOURCE netRc;
ZeroMemory(&netRc, sizeof(netRc));
netRc.dwType = RESOURCETYPE_DISK;
netRc.lpRemoteName = (LPCTSTR) strNetPath;
WNetAddConnection2(&netRC, "Password", "UserName", NULL);
if(dwResult != NO_ERROR)
{
MessageBox( NULL, "Connection Failed", "Yeap", MB_OK);
return;
}
CFile aa.Open("\\\\nt\\mydata\\myfile.txt",CFile::modeRead);
|
|
|
|
|
When I add a new record to the Oracle table, I also want to get back to it to update more fields after some process.
Here is an example:
m_pSet->m_strFilter = "";
m_pSet->m_strFilter = "create_date desc";
m_pSet->Requery();
.
.
.
m_pSet->AddNew(); //line1
m_pSet->m_NAME = "Elizabeth"; //line2
m_pSet->Update(); //line3
m_pSet->Requery(); //line4
UpdateData(FALSE); //line5
line5 does not display data from the newly added record.
I tried using the primary key employee_id to locate the record. Unfortunately, employee_id is updated by the Insert trigger.
How can I get back to the newly added record?
-Elizabeth
Eilzabeth
|
|
|
|
|
Iam not exactly clear of what u want the program to do when Updatedata() is executed .
But when u Add records using AddNew() and execute Update() ,the record which was previously the current becomes the current record after Update() - I hope this is 'nt confusing !!!!!!
eg .
Before AddNew()
Current Record :A ( say)
Now you add record "B" .
Execute Update()
Now
Current Record :A( still it is A)
|
|
|
|
|
I see. No wonder I don't see the newly added record as the current record. Plus, If I loop through all the records in the recordset, the new record is not even there unless I do a Requery. Is there an easy way to get to the new record (assuming the recordset is sorted the way that the newly added record is not neccessary the first or the last in the recordset)?
Eilzabeth
|
|
|
|
|
It depends on how you open the recordset .If open it in snapshot mode or in dynaset mode ,ReQuery() is absolutely required .But if yyou open it in dynamic mode ,it is not required .However most of the Databases don't support "dynamic" recordsets .
Evene before Requery() ,u have to use CanRestart () function to check if rthe recordset can be requerried !!!!
|
|
|
|
|
main () {
for ( ; ; ) {
printf ("Hung up\t\b\b\b\b\b\b") ;
}
}
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Unknown wrote:
"I love long walks, especialy taken by those that annoy me."
Paraphrased from TMNT:
"Cricket? You have to know what a crumpet is to understand Cricket."
|
|
|
|
|
Yeah, this has been discussed many times. I think the backspaces go past the beginning of the line because of a problem with how tabs are accounted for.
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
No no you've got it all wrong - you are supposed to post it with the title "This is the answer to your homework"...
David Wulff
"David Wulff can't live without me, so you shouldn't either" - Paul Watson
|
|
|
|
|
Um... sorry... wrong... not homework. I found it ont he Internet because I was searching for a way to induce a BSOD for some testing I am doing but did not understand WHY it worked.
I Figured that it had something to do with the way it revereses through the buffer, but I could not understand why the tab had anything to do with it.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Unknown wrote:
"I love long walks, especialy taken by those that annoy me."
Paraphrased from TMNT:
"Cricket? You have to know what a crumpet is to understand Cricket."
|
|
|
|
|
No no no no no no no - not you posting a homework question, but rather you posting an answer to all the people who are posting homework questions. Get it now?
David Wulff
"David Wulff can't live without me, so you shouldn't either" - Paul Watson
|
|
|
|
|
Yes I get it....
I have found it... the elusive registry key that makes Windows crash..
http://support.microsoft.com/?kbid=244139[^]
This is so funny I can't wait to try it out.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Unknown wrote:
"I love long walks, especialy taken by those that annoy me."
Paraphrased from TMNT:
"Cricket? You have to know what a crumpet is to understand Cricket."
|
|
|
|
|
I wrote a function to write an integer to a file (i also wrote a function to write a string to a file, which works almost exactly the same way) but windows gives me an access violation error on it or something (the string function works fine btw, so its not the file mode etc.).
Here's the code:
int WriteInt(int Int, long pos)
{
if(fseek(npf, pos, SEEK_SET))
{
return -1;
}
int numwritten = fwrite((void*)Int, sizeof(int), 1, npf);
if(numwritten!=1)
{
return -1;
}
return 1;
}
npf is a valid open file stream to which i CAN write strings etc.
Any ideas why this wont work?
Kuniva
--------------------------------------------
|
|
|
|
|
Kuniva wrote:
int numwritten = fwrite((void*)Int, sizeof(int), 1, npf);
You are converting an integer to a memory address - so it will try to read from the address of the value currently in Int. Try:
int numwritten = fwrite(&Int), sizeof(int), 1, npf);
Dave
|
|
|
|
|
thanks, it solved my problem
Kuniva
--------------------------------------------
|
|
|
|
|
I am looking for a sample where you can paste in HTML format.
I got Rich Edit control and strData contains like this
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 MS Sans Serif;}}
\viewkind4\uc1\pard\f0\fs17
\par \b Test\b0
\par
What I am expecting is like this:
< HTML > (intended spaces there)
< B >Test < / B> (intended spaces there)
< / HTML> (intended spaces there)
Code from Copy to Clipboard function:
UINT format = ::RegisterClipboardFormat("HTML Format");<br />
<br />
if (strData.IsEmpty())<br />
return;<br />
<br />
CSharedFile sf(GMEM_MOVEABLE|GMEM_SHARE|GMEM_ZEROINIT);<br />
sf.Write(strData, strData.GetLength() * sizeof(TCHAR));<br />
<br />
if (!OpenClipboard())<br />
return;<br />
<br />
EmptyClipboard();<br />
<br />
SetClipboardData(format, sf.Detach());<br />
<br />
CloseClipboard();
But when I paste into another control(Edit), all I get is RTF only.
Do I need to convert from RTF format to HTML format??
If yes, then what's the use of CF_HTML("HTML Format") parameter??
Kant
|
|
|
|
|
DevStudio includes utility DataObjectViewer to allow you play with Clipboard.... (Enum Formats etc ).
I belive RichEdit does not support CF_HTML.
|
|
|
|
|
In my application there is a choice of two languages, Norwegian or English. They use different locales with comma or periode as decimal symbol, respectively. I'd like the decimal symbol on the numeric keypad to return the symbol which corresponds to the locale, whereas the comma/periode on the main keypad should remain unchanged. Excel has this functionality
I guess I should put an if() statement in OnChar(). I've noticed that the nFlags parameter in OnChar()is different if the decimal symbol is pressed from the numeric keypad or the main keypad, but I can't figure out how to interpret it. MSDN also has a statement that applications can not extract usefull information from nFlags. So, any tips..?
Regards, Haakon S.
|
|
|
|
|
I'm not sure, but the following might work.
in ::PreTranslateMessage()
if((pMsg->Message == WM_CHAR && pMsg->wParam == xx) && m_bNorwegian)
{
AfxGetMainWnd()->PostMessage(WM_CHAR, VK_COMMA);
return true;
}
where:
xx is the number corresponding to numeric period key. You can get this with a quick debug session.
m_bNorwegian is your flag to know which language your in.
I'm new to this stuff, but it seems like it would work.
BW
"We get general information and specific information, but none of the specific information talks about time, place or methods or means..."
- Tom Ridge - US Secretary of Homeland Security
|
|
|
|
|
Well, on my keypad the decimal symbol (numeric period) is comma, not period. But it is an interesting approach, I'll try it. Thank you for your help.
Regards, Haakon S.
Runners live two years longer. But those two years they spend running.
|
|
|
|
|
Haakon S. wrote:
I can't figure out how to interpret it
Every key on the keyboard has a unique scan code. You can retrieve that code from the bits 0 to 15 of the nFlags parameter. IIRC the scan codes for the main keypad are standard, but all other keys are OEM specific, they are not guaranteed to be the same across all systems.
UINT scancode = nFlags & 0xFF;
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
PJ Arends wrote:
You can retrieve that code from the bits 0 to 15 of the nFlags parameter
But MSDN reads, under OnChar():
"Value 0-15
Specifies the repeat count. The value is the number of times the keystroke is repeated as a result of the user holding down the key."
If you look up under OnKeyDown(), you'll see a description more in line with yours, but it also says that the scan codes are OEM specific. However, I'll try to dig into this. If Excel can do it, so can I.
Thanks alot, anyway.
Haakon S.
Runners live two years longer. But those two years they spend running.
|
|
|
|