|
we have our installs elevate themselves when they run so admin rights are not a problem (user must know an admin password or have an admin account to install).
The crash issue would be a problem but since nothing happens between the two commands, it isn't much of a probability. about the only way this would happen is if windows crashed because we renamed a file we check...which shouldn't ever happen
|
|
|
|
|
An excellent suggestion with one minor flaw: It seems that it doesn't work for services. Even with the service running, I found that it is still possible to rename the executable. (I haven't tried it, but it might be the same with DLLs that the system is configured to use (e.g. a Web server).)
Rob Holstein (BSc)
Software Developer
Delta Controls, Inc.
|
|
|
|
|
I found out why you can rename the executable of a service even while the service is running. Apparently, when a service is installed, Windows takes a copy of the executable and runs that whenever the service is running, so the original file is never in use when the service runs.
Rob Holstein (BSc)
Software Developer
Delta Controls, Inc.
|
|
|
|
|
If all of the programs you need to detect are yours, you could use the solution provided by Mark S. You'd need to modify all of them to create a mutex and check for all of the mutexes.
Another solution would be to get a list of all processes running using the CreateToolhelp32Snapshot() function. I've used this under Win98, 2000, and XP. I can't say about Vista.
This will give you the names of the .exe files that are running, including services. You'll need to know the executable name (not full path) in order for this to work.
Hope that helps.
BDF
A learned fool is more a fool than an ignorant fool.
-- Moliere
|
|
|
|
|
Using Visual C++ 6.0 MFC in SDI application
I have a window that displays a drawing and also displays a modeless dialog window. When a user clicks on a button in the modeless dialog, I want to display a different drawing along with the modeless dialog window again. But I don't understand how to update the drawing immediately. I have a routine that gets called when the user clicks on the button, but if I simply use Invalidate(0), or UpdateWindow(), the new drawing isn't displayed until I do something on the drawing. So I'm assuming that the Invalidate(0) or UpdateWindow() are updating the modeless dialog window and not my drawing window. But I don't understand how to tell it to update my drawing window.
Thanks!
|
|
|
|
|
Well, assuming you dialog is child of the drawing window, whenever the button is clicked on the dialog you may call the updating functions on dialog's parent, for instance:
CMyDialog::OnBtnClick()
{
CWnd * pParentWnd = GetParent();
if (pParentWnd)
{
pParentWnd->Invalidate(FALSE);
pParentWnd->UpdateWindow();
}
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I'm using the famous XListCtrl class in my app and currently have checkboxes as one of the subitems to indicate a state (Disabled/Enabled).
What I am currently doing is changing the background colour of a list item when Disabled is set - this works.
What I would like to be able to do is change the colour of the currently selected line (default is blue) to Red.
This is a side effect I am experiencing as when I set the disabled state of the current item in the list, the colour of the selected item is still blue based upon selection.
Any advice?
Thanks.
|
|
|
|
|
I have an Application that I have made a Set class called HPDset that is based from CRecordSet to connect to an ODBC database and am trying to make it work in the mainfrm class of my application. It works fine in the view class but when I add the pointer definition i get a bunch of wierd errors. It also says HPDset is undefined, but I have included the header file in mainfrm.h.
class CMainFrame : public CFOPMDIFrameWnd
{
DECLARE_DYNAMIC(CMainFrame)
public:
CMainFrame();
public:
HPDset* m_pSet;
CStringArray m_UndoString;
CStringArray m_RedoString;
|
|
|
|
|
Cozmo23 wrote: It also says HPDset is undefined, but I have included the header file in mainfrm.h.
If that's the case, and the code you've shown is from mainfrm.h, then it
should compile. Is namespace, spelling, and capitalization all correct?
#pragma once
#include "HPDset.h"
class CMainFrame : public CFOPMDIFrameWnd
{
DECLARE_DYNAMIC(CMainFrame)
public:
CMainFrame();
public:
HPDset* m_pSet;
CStringArray m_UndoString;
CStringArray m_RedoString;
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Cozmo23 wrote: ...am trying to make it work in the mainfrm class of my application.
That's an odd place for a CRecordset -based object to be.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes thats what I thought as well, but the other programmer that is working on this is seeting up a dynamic memory that reads in to this class. Its not recognizing my pointer as being defined.
|
|
|
|
|
okay what I want to do is be able to open a serial port and then set and clear the str and rts whenever I want to.
For example:
open com port
do stuff
set dtr
send data
wait so long
clear dtr
Hear is what I have tried that I thought should work:
int result = EscapeCommFunction(_hCom,SETDTR);
WriteFileEx(_hCom,"\xFF",1,test,0);
Sleep(4);
result = EscapeCommFunction(_hCom,CLRDTR);
this was unsuccessful though the EscapeCommFunction returned successful (1).
Since that didn't work I tried this
BuildCommDCB("dtr = on", &dcb);
SetCommState(_hCom, &dcb);
WriteFileEx(_hCom,"\xFF",1,test,0);
Sleep(4);
BuildCommDCB("dtr = off", &dcb);
SetCommState(_hCom, &dcb);
which was equally as unsuccessful.
What am I doing wrong?
edited to try to fix reference (&) marks
|
|
|
|
|
this is going to sound so stupid. But it works now I had the OScope on the wrong pin.
~Brandy
|
|
|
|
|
One thing to note: your call to Sleep(4) will not sleep for exactly 4 milliseconds. It will probably sleep on the order of 10-20 milliseconds, depending upon the thread quantum (the thread-switching time).
|
|
|
|
|
For more information on timing, you may want to read my timers article.
|
|
|
|
|
I need to have my makefile select one file type(.mesh) in a data folder and then send it to a converttool.exe (in a different directory)
Does anyone know the commands I must use?
I tried searching around but couldn't find an answer. Thanks in advance.
This is what I am working with now and nothing seems to be happening (just some of the makefile)...
<br />
DATA := data<br />
OGRETOOLS := $(OGRE_HOME)/OgreCommandLineTools<br />
MESHFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)
|
|
|
|
|
try this, might be because OgreXmlConverter.exe doesnot take mutiple file names in the command line
content: $(MESHFILES)
$(MESHFILES):
$(OGRETOOLS)/OgreXmlConverter.exe $@
i know gmake supports wildcard target, i don't remember the syntax, then replace the line below,
$(MESHFILES):<br />
$(OGRETOOLS)/OgreXmlConverter.exe $@
with
*.mesh:<br />
$(OGRETOOLS)/OgreXmlConverter.exe $@
modified on Monday, July 21, 2008 8:03 AM
|
|
|
|
|
I have an old MFC application that I am trying to modify. In the new code I am opening an xml file using the MSXML DOM. When I make function calls to the xml dom document I want to be able to use my help just like all the old stuff by just putting the cursor in front of the function and pressing F1 (call me old fashioned). The problem is when I do this on the xml dom functions my MSDN library does not seem to have the documentation installed and therefore the help pops up but it doesnt find my function. Does anyone know what I need to install to get this xml dom stuff in my help documentation and where to get it?
Note: I am using Microsoft Visual C++ 6.0
Rock
|
|
|
|
|
I have no idea but you can find the documentation you need online on MSDN. Unless you are using ATL generated classes then I do not believe there is any because the generated classes are just pass through to the COM interfaces.
led mike
|
|
|
|
|
Yeah the COM thing, thats what I was afraid of. I know the documentation is online but like I said I'm old fashioned and just like tp press F1 to immediately see the help for the function I am using as opposed to searching and trying to find the right instance of the function for c++\mfc
Rock
|
|
|
|
|
Hi,
I'm using Extended MAPI to read and create calendar events in outlook, and as far as it goes, it's working nicely. However, I can only read and write events in the default calendar, but need to be able to access any calendar the user has access to. Here's a brief code snippet showing how I access the calendar (error checking etc removed)...
m_pMAPILogonEx(NULL, NULL, NULL, MAPI_EXTENDED | MAPI_LOGON_UI | MAPI_NEW_SESSION, &pSession);
pSession->GetMsgStoresTable(0, &pStoreTable);
SPropTagArray sptaEid = {1, {PR_ENTRYID}};
SRestriction res;
SPropValue spv;
res.rt = RES_PROPERTY;
res.res.resProperty.relop = RELOP_EQ;
res.res.resProperty.ulPropTag = PR_DEFAULT_STORE;
res.res.resProperty.lpProp = &spv;
spv.ulPropTag = PR_DEFAULT_STORE;
spv.Value.b = TRUE;
SYSTEMTIME st;
pHrQueryAllRows( pStoreTable, &sptaEid, &res, NULL, 1, &pRows );
LPSBinary pEntryId = &pRows->aRow[0].lpProps[0].Value.bin;
pSession->OpenMsgStore(0, pEntryId->cb, (LPENTRYID)pEntryId->lpb, NULL, MAPI_BEST_ACCESS, &pStore);
SBinary eidInbox;
pStore->GetReceiveFolder(NULL, 0, &eidInbox.cb, (LPENTRYID*)&eidInbox.lpb, NULL);
pStore->OpenEntry(eidInbox.cb, (LPENTRYID)eidInbox.lpb, NULL, MAPI_BEST_ACCESS, &ulObjType, (LPUNKNOWN*)&pMailbox);
pHrGetOneProp(pMailbox, PR_IPM_APPOINTMENT_ENTRYID, &pCalendarEid);
The key here is that PR_IPM_APPOINTMENT_ENTRYID gives me the entry id for the default Outlook calendar. But Outlook allows me to create other calendars, and I can see them using OutlookSpy (They appear to be at the same level as the default calendar). I want to access these other calendars, but can't seem to get the entry id in order to open them. I thought I might be able to step through all the entries in the receive folder, and look for entries with PR_CONTAINER_CLASS == "IPM.Appointment", but I get an error if I try to access property PR_CONTAINER_CLASS. Another code snippet...
IMAPITable *pReceiveFolderTable = NULL;
pMailbox->GetContentsTable(MAPI_UNICODE, &pReceiveFolderTable);
SizedSPropTagArray( 2, receiveFolderTableColumns ) = { 2, {PR_ENTRYID, PR_CONTAINER_CLASS} };
hResult = pReceiveFolderTable->SetColumns((LPSPropTagArray)&receiveFolderTableColumns, 0);
SRowSet *pReceiveFolderRows = NULL;
SRow *pReceiveFolderRow = NULL;
hResult = pReceiveFolderTable->QueryRows( 100, &pReceiveFolderRows );
while( ( hResult == S_OK ) && pReceiveFolderRows && pReceiveFolderRows->cRows > 0 )
{
for( ULONG i = 0; i < pReceiveFolderRows->cRows; i++ )
{
if( PROP_TYPE( pReceiveFolderRow->lpProps[1].ulPropTag ) != PT_ERROR )
{
Write something to log file. Never gets here, as ulPropTag is always PT_ERROR
}
}
}
Does anyone know how I can access these other calendars, or have any suggestions of where I could go for help?
And as if that wasn't enough, I have a second question...
When creating an Outlook appointment, I'd like to supply an email address (or a list of addresses) and have Outlook send an email notification to those addresses. Does anyone know which properties I need to set? And do I need to separately tell Outlook to send the notification, or can it figure that out if set the appropriate properties in the appointment? So far, I've set the named property 0x823b to an email address, and experimented in OutlookSpy with various other fields, but with no success.
Any help or pointers greatly appreciated,
Regards,
Terry Smyth (Got this far, but still a MAPI novice!)
|
|
|
|
|
Hi everybody!
I developped an application by using c++ windows forms (msdn).
I am trying to save picture in pgm format from the picturebox of my application. I tried to modify and use the C# code provided by this link http://www.codeproject.com/KB/cs/Managed_PGM.aspx
But my application always generate a couple errors that I couldn't fix.
Thank you in advance for your help.
|
|
|
|
|
Can anyone help me to get the co-ordinates of a button in a dialog. I have tried with GetWindowRect and GetClientRect. Both are giving the window position only. I need the co-ordinates of a button control in a window. More interestingly, I can get the co-ordinates using the above methods for Picture control and Static control. Please advice.
Many thanks in advance.
|
|
|
|
|
|
Alan Balkany wrote: After you get the screen coordinates of the button
Hello alan,
Thank you very much for your reply. Can you please tell me how to get the screen coordinates of the button.
Many thanks in advance.
modified on Friday, July 18, 2008 10:29 AM
|
|
|
|
|