|
Phil Harding wrote: Does anyone have any idea on how one can programmatically prevent another process terminating the process of "my application"
No. If the user account associated with the other application has high enough privileges, it can terminate your application. AFAIK, There's nothing you can do about it. Your best bet is to ensure your application runs as the "Local System" user, but even then an admin will be able to kill it.
Incidentally, those other nefarious (I love that word ) programs don't prevent themselves being terminated, they detect when they are, and then restart themselves. The usually run two processes, and since only one can be terminated at a time by the user, the other one can detect that it has been killed, and restart it. You could take this path, if it only matters that an instance of your program is running. Of course, it won't help if you require the same instance of your program running and not be terminated.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I just installed the VS .NET 2005 Professional and the accompanied MSDN library in FULL. I am using them for a VC++ project and am having trouble with the local Help functionality: F1 help is broken. That is, if I position the cursor over a keyword (for example OnEraseBkgnd) and hit F1, it always displays the topic-not-found page.
Any suggestions appreciated.
|
|
|
|
|
Check your Help settings: Tools->Options, Environment->Help->Online
Try setting it to "Try local first, then online" and see if that works.
--
I've killed again, haven't I?
|
|
|
|
|
I have tried that. The real issue is that sometimes the F1 help works, sometimes not. Any idea?
|
|
|
|
|
Does anyone know how can i find the user name in Windows XP?.
I want to make a programm in visual c++6 that can determine someone's user account name.
Thank you.
-- modified at 16:46 Tuesday 7th March, 2006
|
|
|
|
|
|
Thanks
|
|
|
|
|
using the following, the XML is saved as a single line in the file, and when loaded in either notepad
or VC6, it shows on one line :
MSXML2::IXMLDOMDocument2Ptr pXMLDoc;
pXMLDoc->save( path );
Is there a way to have some line-feed/carriage return so that the text XML is "well formatted" or at least better formatted so that it can be viewed in notepad ?
Thanks.
M.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
The only thing like that I know of is the preserveWhiteSpace property of the DOMDocument object. But I don't think that has any effect if you create a new file from scratch, only if you load and modify an existing file.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Hello folks,
I trying to instatiate a activex control, print template from Internet Explorer. The argv[1] parameter it's a path string to a HTML file(like these: c:\MyTemplate.htm). But it seems the type of vTemplatePath don't match and an exception is launched:
Error on line 474 atlbase.h
Expression: p!=0
I'm sorry to post this question here, but I'm a noob in C++. I'm a web programer(PHP, javascript, action script II), and I need very much of this.
Someone can help me to solve this?
Thanks a lot!
//Microsoft reference
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnie55/html/beyondprintpreview.asp
//code
int main(int argc, char * argv[])
{
int i;
IOleCommandTarget* pCmdTarg;
CComPtr pWB;
CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_INPROC, IID_IWebBrowser2, (void**)&pWB);
pWB->QueryInterface(IID_IOleCommandTarget, (void**)&pCmdTarg);
VARIANT vTemplatePath;
V_VT(&vTemplatePath) = VT_BSTR;
CComVariant vPTPath = argv[1];
pCmdTarg->Exec(&CGID_MSHTML, IDM_PRINTPREVIEW, NULL, &vPTPath, NULL);
return 0;
}
|
|
|
|
|
What was the particular string being passed? Formatting, spaces, backslashes can all affect it.
Elaine
The tigress is here
-- modified at 4:43 Wednesday 8th March, 2006
|
|
|
|
|
The string is: "c:\MyTemplate.htm".
|
|
|
|
|
Hi,
I've got a problm with the datagrid. I've changed the datasource of my datagrid to a dataview in order to control this new row that is created when switching between readonly true to false. I am controlling the readonly toggle via a button on the same form. This works fine if I don't touch the datagrid prior to switching the readonly status. However once I have selected a cell in the datagrid and then change the status, it seems like the entire datagrid freezes and I can't do anything.
Any suggestions?
Thanks
David
Think, try, think, think, try, think, think, think, try, ASK, think, try, advance on step and start over...
|
|
|
|
|
I need some help in writing an OPC server. The ideea is that i don't really need to write an OPC server but rather something wich acts as an OPC server. There is an application (that's already running) which is an opc client and i need to add some new data to it. My ideea is to write my own OPC server(simulation ) wich connects to a database at one end and provides the access to the data that the existing application needs at the other end.
I know that what i need is not really an opc server and i have already read the few articles that were posted here (which were of great help in getting closer to my solution) but i really need a few advices on were to go to from here.
Thanks.
|
|
|
|
|
hi eusto
i am also working on the OPC server/client application though without database.
you can download the OPC client and server code from (the one from Metadynamics is good one)
http://www.opcconnect.com/source.php[^]
But in the client side code provided he used ATL object which i am not able to figure it out...if u find it ...plz help
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
|
|
|
|
|
Well..for the server part there is only LightOpc which...well..only provides russian language support and i spent the last day trying to figure things out. I'll get back to you on the client side problem when i get around to it
|
|
|
|
|
eusto wrote: Well..for the server part there is only LightOpc
No...you can donwload the sample code for both server and client (either in VC++ or VB) from Metadynamics website ..check the link posted above for the toolkits.
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
|
|
|
|
|
Okay so I created a dialog box with a List Control in it. I am trying to
get the index of the current item selected in order to retrieve the text and
use it in a map. I found examples here but for some reason I am not getting
an index number back. All I get is 0.
Heres the code:
<br />
std::map<std::string, int>mpCalibrations;<br />
<br />
********<br />
<br />
for(i=0;i<=74;i++){<br />
LvItem.iItem=i;<br />
LvItem.iSubItem=1;<br />
sprintf(Temp,"%d",mpCalibrations[calibrate_list[i]]);<br />
LvItem.pszText=Temp;<br />
SendMessage(hList,LVM_SETITEM,0,(LPARAM)&LvItem); <br />
<br />
<br />
case WM_NOTIFY:{<br />
switch(LOWORD(wParam)){<br />
case IDC_LIST2:{<br />
int iSlected=0;<br />
int lResult=0;<br />
if(((LPNMHDR)lParam)->code == NM_CLICK){<br />
iSlected=SendMessage(hList,LVM_GETNEXTITEM,-1,LVNI_FOCUSED);<br />
Please help..
TY
-- modified at 13:47 Tuesday 7th March, 2006
|
|
|
|
|
How about:
int nItem = SendMessage(hList, LVM_GETNEXTITEM, -1, LVNI_SELECTED);
assert(nItem >= 0);
LVITEM lvi = {0};
char szTemp[128];
lvi.mask = LVIF_TEXT;
lvi.pszText = szTemp;
lvi.cchTextMax = sizeof(szTemp);
SendMessage(hList, LVM_GETITEMTEXT, nItem, (LPARAM) &lvi);
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Well, I still got a 0 back for nItem. I cannot see what the problem is.
Any other ideas???
|
|
|
|
|
At the time this code is executed, is there a selected item in the control?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
In debug mode(.NET), the value remains 0. Furthermore, I initialized the
value to 5 and it is being SET to 0. The final app, will allow you to select
an item and via the map, display the corresponding value in an EditBox for
modifying. I added this code to confirm that I'm getting 0 no matter what
I select.
The map is filled w/ random numbers for now.
<br />
if(((LPNMHDR)lParam)->code == NM_CLICK){<br />
int nItem = SendMessage(hList, <br />
LVM_GETNEXTITEM, <br />
-1, <br />
LVNI_SELECTED);<br />
SendMessage(hList, <br />
LVM_GETITEMTEXT, <br />
nItem, <br />
(LPARAM) &lvi);:confused:<br />
itoa(nItem,buffer,4);<br />
SetWindowText(hwndEdit,buffer);<br />
}
|
|
|
|
|
When you click a button to execute this code snippet, the list control will lose focus, and perhaps deselect any items that had been selected. Does the control have the LVS_SHOWSELALWAYS style?
What does this return:
int nCount = SendMessage(hList, LVM_GETSELECTEDCOUNT, 0, 0); Remember that items in the control are 0-based.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Getting back 0 from LVM_GETNEXTITEM is a valid return, not an error return; -1 is an error return (or "not items found"). Getting back 0 indicates that the first (zero-ith) item in the control is selected.
Calling SendMessage again with the same parameters will return zero again because you are still specifying -1 for the "start" of the search.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
A bit more code:
<br />
case WM_INITDIALOG:{<br />
HWND hList=GetDlgItem(hwnd,IDC_LIST2);<br />
SendMessage(hList,<br />
LVM_SETEXTENDEDLISTVIEWSTYLE,<br />
0,<br />
LVS_EX_FULLROWSELECT | LVS_SHOWSELALWAYS); <br />
Well David, I tried this snippet and a big fat 0. I initialized it to 500.
<br />
nCount = SendMessage(hList, LVM_GETSELECTEDCOUNT, 0, 0);<br />
itoa(nCount,buffer,10);<br />
SetWindowText(hwndEdit,buffer);<br />
James, my understanding is the above "SendMessage" will return the index
of the item selected. I'm selecting in the middle of my 75 item list.
Shouldn't it return a value the same as "GETCURSEL" does for a listbox???
This was so easy with a regular ListBox.(ughhhh)
I'm probably gonna be beating my head against the wall once the solution is
discovered. Something simple I'm sure...
|
|
|
|
|