|
Jörgen Sigvardsson wrote:
Did you call CoInitialize[Ex]()?
Hi Jorgen - thanks for the reply. I found my problem just after I made the posting (typical, eh !!) - I needed to select the tick boxes for OLE Automation and OLE Controls when generating the project using AppWizard - it doesn't seem to have included COInitialize() in my source files, but it's got me over the problem, until the next one pops up ...... ! Thanks again !;)
Doug
|
|
|
|
|
I finally settled on this but am still uneasy.
HINSTANCE res = ShellExecute(NULL,"Open", helpFile, "","E:\\", SW_SHOWNORMAL);
int r = (int)res;
if(r <=32)ShellExecute(NULL,"Open", helpFile, "","C:\\", SW_SHOWNORMAL);
I imagine all I need in the 5th paramtere is the drive letter where the explorer exe is stored. My assumption that its either in E or C is dangerous. How should I handle this dilemma?
Thanks,
ns
|
|
|
|
|
SHELLEXECUTEINFO sei;
ZeroMemory(&sei, sizeof(SHELLEXECUTEINFO));
sei.cbSize = sizeof (SHELLEXECUTEINFO);
sei.lpVerb = NULL;
sei.lpFile = m_strYourEXEFile;
sei.nShow = SW_SHOW;
sei.hInstApp = NULL;
sei.lpDirectory = NULL;
sei.fMask = SEE_MASK_DOENVSUBST|SEE_MASK_NOCLOSEPROCESS;
sei.lpParameters = NULL;
if (ShellExecuteEx (&sei) )
return TRUE;
else
return FALSE;
}
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
I think I didnt explain right: I want the .htm file to open up in explorer. Its not an exe file.
Thanks,
ns
|
|
|
|
|
|
sorry my mistake.
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
Visual C++ 6.0/SP5
I have written a program that sets folders to be either "hidden" or "normal" (based on user selections). This program works just fine on Win2K and WinXP, but Win98 users aren't seeing any success at all. Here's the code I'm using:
void CMyClass::ChangeFolderAttributes(CPersonality* pItem)
{
if (g_pPersonHelper->GetChangeTrackFiles())
{
CTracksINI* pTracksINI = GetSimTrackList(SIM_NR2K3);
if (pTracksINI)
{
CString sInstalledTrackDir = "";
CString sInstalledFullPath = "";
int nInstalledCount = pTracksINI->GetCount();
for (int i = 0; i < nInstalledCount; i++)
{
sInstalledTrackDir = pTracksINI->GetTrack(i)->GetTrackDir();
sInstalledFullPath.Format("%stracks\\%s", m_sSimPath, sInstalledTrackDir);
bool bInTrackSet = g_pTrackSetHelper->GetTrackSet(pItem->GetTrackSet())->TrackIsInSet(sInstalledTrackDir);
DWORD dwDesiredAttrib = (bInTrackSet) ? FILE_ATTRIBUTE_NORMAL : FILE_ATTRIBUTE_HIDDEN;
BOOL bResult = SetFileAttributes((LPCTSTR)sInstalledFullPath, dwDesiredAttrib);
}
}
else
{
}
}
else
{
}
}
I've scoured the MSDN stuff, google the API calls, and checked a number of programming bulletin boards, but there is no mention of an incompatibility.
The one thing I did notice is that when I manually select a folder and set it to hidden (using Windows Explorer) Win2k asks is I also want to hide all of the sub-items. I don't have a Win9x box, so I can't see if Win9x does the same thing, but I don't remember that happening.
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
"You won't like me when I'm angry..." - Dr. Bruce Banner
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
Two things I'd change.
1. The line that builds the full path:
sInstalledFullPath.Format("%stracks\\%s", m_sSimPath, sInstalledTrackDir); is assuming backslashes in certain places. Is that always right? I'd use the shlwapi functions instead (like PathAppend() ) to build the name.
2. You're calling SetFileAttributes() without getting the existing attributes first. This results in you unsetting the FILE_ATTRIBUTE_DIRECTORY attribute, which might be what's causing the error. You should always get the current attrs and modify them. I'd do:
DWORD dwAttrs = GetFileAttributes ( sInstalledFullPath );
DWORD dwDesiredAttrib = bInTrackSet ? FILE_ATTRIBUTE_NORMAL : FILE_ATTRIBUTE_HIDDEN;
if ( INVALID_FILE_ATTRIBUTES == dwAttrs )
else
{
dwAttrs &= ~(FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_HIDDEN);
dwAttrs |= dwDesiredAttrib;
BOOL bResult = SetFileAttributes ( sInstalledFullPath, dwAttrs );
}
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
If my rhyme was a drug, I'd sell it by the gram.
|
|
|
|
|
How Creating Login with Password included by Dot?
I need to connected also thru Telnet/FTP but to access to a Tandem machine (or whatever server types)from these must be(for example:"User=yulisa,password=yls.11").
-Also,How to facilitate Fstream(input.dat -->output.dat),which
at the middle after recieve from input.dat, I must absorb each/all field's value to Edit Boxes navigated by Next-Previous Icon,or by DBGrid provided by MFC,then all those records can be Restored to Database,ex:SQL Server for next purposes manipulation???(maybe Database as the Output File)
....I Need the Right Ansewr Soon, Thanks a Lot Before....
|
|
|
|
|
How Creating Login with Password included by Dot?
|
|
|
|
|
Hi all ,
does any body knows any thing about programming USB Port or IEEE 1394 (Firewire)
Mhmoud Rawas
------------
Software Eng.
|
|
|
|
|
For visual c++ can provide the help or explanation button usage...Mean that when the mouse cursor point to any button there can provide explanation function of this button!!!
|
|
|
|
|
|
Hi,
I wrote a program using the CFile object.It is giving the following error.
c:\program files\microsoft visual studio\vc98\mfc\include\afxv_w32.h(14) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
I included windows.h and afx.h as headers.What else should I include to get rid of this problem
Karteek
|
|
|
|
|
karteek wrote:
I included windows.h and afx.h as headers.What else should I include to get rid of this problem
Don't inlcude windows.h, afxv_w32.h takes care of that for you via afx.h.
Putting the laughter back into slaughter
|
|
|
|
|
My System-Menu only contains 'Close' and 'Move' commands.
What am I missing ? any specific style ?
|
|
|
|
|
|
I have them both but alas
My window wouldn't respond to the 'minimize-all' button until I added WS_MINIMIZEBOX, but still the option doesn't show on my window
|
|
|
|
|
I use SHBrowseForFolder, select the Recycle-Bin, get a PIDL, and fail to convert it to a legitimate path.
Is this by design ?
|
|
|
|
|
I think so, because there is no single one recycle bin. IIRC, there's a recycle bin on each drive. The one you see on the deskop is just a "union" of all the individual recycle bins.
--
Talk to the hand!
|
|
|
|
|
Hi. I am trying to connect to a remote module by TCPIP. It keeps failing at gethostbyaddr. THe error is WSANO_DATA. MSDN says that this means "Valid name, no data record of requested type." What does this mean? What do I need to change or do for this. From hyperterminal, it will connect correctly so there must be something simple to do to take care of this I think.
THanks!!
|
|
|
|
|
i have been able to successfully create a RAS connection using visual C++, what i'm looking for now is how to set a shortcut on the desktop for this connection, i could do that to a file ok, but to a dialup networking you don't have an actual (path) to it, any help is appreciated
|
|
|
|
|
Hi,
I found this article about catching outlook events:
http://www.codeproject.com/internet/outlookxpevents.asp?target=NewMail%7Cevent#xx635951xx
With this code you can catch the event, when a new mail is in the inbox.
It works fine !
I would like to catch an events when a new contact is saved or when a new appointment was created.
Theres´s no way for me to do this !
The problem is, that the FindConnectionPoint returns an error for the ItemEvents ConnectionPoint.
This is my code, which is same as in the article but only changed to the ContactItem.
//In the dialog class
1. ItemEvents m_OutlookContact;
2. //Add an event handler for the Application object.
m_pAppEventListener = new CAppEventListener();
m_pAppEventListener->AddRef();
m_pAppEventListener->AttachToSource
( m_OutlookContact.m_lpDispatch );
//In the cpp class where the EventListener is defined
STDMETHODIMP CAppEventListener::AttachToSource
( IUnknown* pEventSource )
HRESULT hr = S_OK;
IConnectionPointContainer* pCPC = NULL;
hr = pEventSource->QueryInterface( IID_IConnectionPointContainer,
(void**)&pCPC );
if (SUCCEEDED(hr)){
hr = pCPC->FindConnectionPoint( IID_ItemEvents,&m_pConnectionPoint);
if (SUCCEEDED(hr)){
hr = m_pConnectionPoint->Advise( this, &m_dwConnection );
}
pCPC->Release();
}
return hr;
}
//In the header class of the event listener I defined the item events from
the outlook typ libraries (OLE/COM Object Viewer)
const IID IID_ItemEvents=
{0x0006303A,0x0000,0x0000,{0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}};
Why is &m_pConnectionPoint : 0x00000000 ?
Only when I change the IID_ItemEvents to the IID_ApplicationEvents, which is
{0x0006304E,0x0000,0x0000,{0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}}
the function returns OK.
Can someone help me please ?
|
|
|
|
|
Hello Everyone,
I need your sincere help in finding the suitable header file
for the wsnprintf() method. For finding the Domain Users in
Microsoft Active Directory Services(ADSI), i called the ADSI API i.e. FindUsers() to fetch the list of user objects
from a container or directory tree. For that the FindUser()
API code has used the method i.e. wsnprintf() for adding the filter.
RESULT FindUsers(IDirectorySearch *pContainerToSearch, // IDirectorySearch pointer to the container to search.
LPOLESTR szFilter, // Filter for finding specific users LPOLESTR *pszPropertiesToReturn, // Properties to return user objects found.
BOOL bIsVerbose)
This FindUsers() is the API where the definition of the ADSI API calls the wsnprintf() method like as below : DWORD
#define MAX_PATH 520
dwLength = MAX_PATH*2;
// Create search filter.
LPOLESTR pszSearchFilter = new OLECHAR[dwLength];
// Add the filter.
wsnprintf(pszSearchFilter, dwLength, L"(&(objectClass=user)(objectCategory=person)%s)",szFilter);
Please help me out in giving me the details about the header file and the .lib file to make the code compilable.
Thanks,
Derik
|
|
|
|
|
derik_konark wrote:
wsnprintf()
Are you sure you don't mean _snwprintf() that is declared in stdio.h?
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!
|
|
|
|